Added the flasher but collected a few faults on the build regarding this bit..
These were the errors..
Source updated!
Kym
Quote :
// some small helper functions
#define strchan (chan?"2":"1")
char _strparam[128];
// Flasher based on timer divided by divisor 1/10th secs
inline int Flasher(int timer,int divisor,int default) { return (divisor ? ((timer % (divisor * 2)) < divisor):default); }
inline char *strparam(int v) {wsprintf(_strparam,"%i",v);return _strparam;}
// some small helper functions
#define strchan (chan?"2":"1")
char _strparam[128];
// Flasher based on timer divided by divisor 1/10th secs
inline int Flasher(int timer,int divisor,int default) { return (divisor ? ((timer % (divisor * 2)) < divisor):default); }
inline char *strparam(int v) {wsprintf(_strparam,"%i",v);return _strparam;}
These were the errors..
Quote :
dmc1mapper.cpp
dmc1mapper.cpp(26) : error C2143: syntax error : missing ')' before 'default'
dmc1mapper.cpp(26) : error C2143: syntax error : missing ';' before 'default'
dmc1mapper.cpp(26) : error C2059: syntax error : ')'
dmc1mapper.cpp(26) : error C2143: syntax error : missing ';' before '{'
dmc1mapper.cpp(26) : error C2447: '{' : missing function header (old-style formal list?)
dmc1mapper.cpp
dmc1mapper.cpp(26) : error C2143: syntax error : missing ')' before 'default'
dmc1mapper.cpp(26) : error C2143: syntax error : missing ';' before 'default'
dmc1mapper.cpp(26) : error C2059: syntax error : ')'
dmc1mapper.cpp(26) : error C2143: syntax error : missing ';' before '{'
dmc1mapper.cpp(26) : error C2447: '{' : missing function header (old-style formal list?)
Source updated!
Kym
Posté Sat 17 Jun 06 @ 2:54 pm
You seem to have an extra ; in the private part:
Try removing this (As indicated above.)
What C compiler are you using?
private:
// you can define your own private variables here
int Load[2],LoadTree[2],Shift[2],Waitlist[2],Loop[2],Pitch[2],Wheel[2],PitchLocked[2],temporary[2],video_xfade,show_elapsed[2],timer;
; // Remove this extra ;
};
Try removing this (As indicated above.)
What C compiler are you using?
Posté Sat 17 Jun 06 @ 6:26 pm
Microsoft visual studio 2003. You mean all those errors are caused by one ;? :-)
Posté Sat 17 Jun 06 @ 9:17 pm
No luck on that one still get the same errors! =(
dmc1mapper.cpp(26) : error C2143: syntax error : missing ')' before 'default'
dmc1mapper.cpp(26) : error C2143: syntax error : missing ';' before 'default'
dmc1mapper.cpp(26) : error C2059: syntax error : ')'
dmc1mapper.cpp(26) : error C2143: syntax error : missing ';' before '{'
dmc1mapper.cpp(26) : error C2447: '{' : missing function header (old-style formal list?)
(Updated)
dmc1mapper.cpp(26) : error C2143: syntax error : missing ')' before 'default'
dmc1mapper.cpp(26) : error C2143: syntax error : missing ';' before 'default'
dmc1mapper.cpp(26) : error C2059: syntax error : ')'
dmc1mapper.cpp(26) : error C2143: syntax error : missing ';' before '{'
dmc1mapper.cpp(26) : error C2447: '{' : missing function header (old-style formal list?)
(Updated)
Posté Sun 18 Jun 06 @ 9:16 am
Just tried compiling your code in Visual C++ 2005 Express Edition, which I use for the DAC-3 mapper and it compiles successfully.
I think your compiler doesn't like the use of the word 'default' as a parameter in the Flasher() function. Try changing this:
I think your compiler doesn't like the use of the word 'default' as a parameter in the Flasher() function. Try changing this:
inline int Flasher(int timer,int divisor,int defaultval) { return (divisor ? ((timer % (divisor * 2)) < divisor):defaultval); }
Posté Sun 18 Jun 06 @ 7:49 pm
That did the trick, but for some reason the 10 second flash seems pretty quick, like 4 per second, and then no flash at all from 4 seconds onwards. Maybe flashing too fast? I'll have a play with the timing tomorrow. Thanks again!
(Updated)
Kym
(Updated)
Kym
Posté Sun 18 Jun 06 @ 8:08 pm
The OnTimer() in the DAC-2 mapper might be called more frequently than it is in the DAC-3 mapper. Try increasing the remainflash values to slow the flashing down.
Posté Sun 18 Jun 06 @ 9:34 pm
Ok a quick question. I'm updating the plugin to add 1/2 beat and 1/4 beat loops and it don't seem as easy as it seems, morso that 1/2 beat is sent as "-2" or "50" and 1/4 is "-4" or "25"
The old code reads
and
I see a "<0" in there and suspect that this may cause problems with anything under 0?
I did try adding the "-1" and "+1" to the loop command, but found that the + and - buttons would only work when a loop was active, so no go on that front either.
Um, help
=D
The old code reads
case 0x48: // >>
if(Loop[chan]<1) Loop[chan]=1;
else if(Loop[chan]<2) Loop[chan]=2;
else if(Loop[chan]<4) Loop[chan]=4;
else if(Loop[chan]<8) Loop[chan]=8;
else if(Loop[chan]<16) Loop[chan]=16;
else if(Loop[chan]<32) Loop[chan]=32;
else Loop[chan]=1;
if(Song[chan].LoopLength) SendAction("loop",strchan,strparam(Loop[chan]));
break;
case 0x46: // <<
if(Loop[chan]>32) Loop[chan]=32;
else if(Loop[chan]>16) Loop[chan]=16;
else if(Loop[chan]>8) Loop[chan]=8;
else if(Loop[chan]>4) Loop[chan]=4;
else if(Loop[chan]>2) Loop[chan]=2;
else if(Loop[chan]>1) Loop[chan]=1;
else Loop[chan]=32;
if(Song[chan].LoopLength) SendAction("loop",strchan,strparam(Loop[chan]));
break;
and
// loop
if(Song[chan].Loop) Loop[chan]=Song[chan].Loop;
SetSymbol(chan,0x09,Song[chan].LoopLength!=0);
if(Loop[chan]<0) SetDigit(chan,0,0x0A);
else if(Loop[chan]>=10) SetDigit(chan,0,(Loop[chan]/10)%10);
else SetDigit(chan,0,0x0B);
SetDigit(chan,1,abs(Loop[chan])%10);
I see a "<0" in there and suspect that this may cause problems with anything under 0?
I did try adding the "-1" and "+1" to the loop command, but found that the + and - buttons would only work when a loop was active, so no go on that front either.
Um, help
=D
Posté Sat 23 Sep 06 @ 9:26 am
-8, -4 and -2 are used internally by VDJ to represent 1/8, 1/4 and 1/2 beat loops, but these must be set using the values 125, 25 and 50 respectively using the 'loop' action.
You could try the following adapted from the new v1.3 DAC-3 mapper:
You will also need the following:
You could try the following adapted from the new v1.3 DAC-3 mapper:
case 0x48: // >>
// Double loop length
int len = (!Song[chan].Loop || ABS(Song[chan].Loop) > 999) ? 4:MinMax((((Song[chan].Loop >= -2) && (Song[chan].Loop < 1)) ? 1:((Song[chan].Loop >= 1) ? (Song[chan].Loop * 2):(Song[chan].Loop / 2))),-8,128);
SendAction("loop",strchan,IntToStr((len > 0) ? len:(len >= -2) ? 50:(len >= -4) ? 25:125,buffer));
break;
case 0x46: // <<
// Half loop length
int len = (!Song[chan].Loop || ABS(Song[chan].Loop) > 999) ? 4:MinMax(((Song[chan].Loop == 1) ? -2:((Song[chan].Loop > 1) ? (Song[chan].Loop / 2):(Song[chan].Loop * 2))),-8,128);
SendAction("loop",strchan,IntToStr((len > 0) ? len:(len >= -2) ? 50:(len >= -4) ? 25:125,buffer));
break;
You will also need the following:
// Absolute value
#define ABS(val) (((val) < 0) ? (0 - (val)):(val))
// Limit value to specified minimum/maximum values
inline int MinMax(int val,int min,int max) { if(val > max) val = max; if(val < min) val = min; return val; }
Posté Mon 25 Sep 06 @ 12:23 am
Thanks again for that =D
Eeek, Help! Think i did bad though!
Build result.
I expect that the firt box of code replaces the the "CASE" commands for the loop - + buttons.
But was a little unsure of where the second box of code went, I added it to the "Extra helper functions"
Code on website if you need it.
Eeek, Help! Think i did bad though!
Build result.
d:\DENTECH\DAC\dmc1mapper.cpp(139) : error C3861: 'IntToStr': identifier not found, even with argument-dependent lookup
d:\DENTECH\DAC\dmc1mapper.cpp(142) : error C2360: initialization of 'len' is skipped by 'case' label
d:\DENTECH\DAC\dmc1mapper.cpp(138) : see declaration of 'len'
d:\DENTECH\DAC\dmc1mapper.cpp(145) : error C2360: initialization of 'len' is skipped by 'case' label
d:\DENTECH\DAC\dmc1mapper.cpp(138) : see declaration of 'len'
d:\DENTECH\DAC\dmc1mapper.cpp(147) : error C2374: 'len' : redefinition; multiple initialization
d:\DENTECH\DAC\dmc1mapper.cpp(138) : see declaration of 'len'
d:\DENTECH\DAC\dmc1mapper.cpp(148) : error C3861: 'IntToStr': identifier not found, even with argument-dependent lookup
d:\DENTECH\DAC\dmc1mapper.cpp(148) : error C3861: 'len': identifier not found, even with argument-dependent lookup
d:\DENTECH\DAC\dmc1mapper.cpp(148) : error C3861: 'len': identifier not found, even with argument-dependent lookup
d:\DENTECH\DAC\dmc1mapper.cpp(148) : error C3861: 'len': identifier not found, even with argument-dependent lookup
d:\DENTECH\DAC\dmc1mapper.cpp(148) : error C3861: 'len': identifier not found, even with argument-dependent lookup
d:\DENTECH\DAC\dmc1mapper.cpp(150) : error C2360: initialization of 'len' is skipped by 'case' label
d:\DENTECH\DAC\dmc1mapper.cpp(147) : see declaration of 'len'
d:\DENTECH\DAC\dmc1mapper.cpp(150) : error C2360: initialization of 'len' is skipped by 'case' label
d:\DENTECH\DAC\dmc1mapper.cpp(138) : see declaration of 'len'
d:\DENTECH\DAC\dmc1mapper.cpp(153) : error C2360: initialization of 'len' is skipped by 'case' label
d:\DENTECH\DAC\dmc1mapper.cpp(147) : see declaration of 'len'
d:\DENTECH\DAC\dmc1mapper.cpp(153) : error C2360: initialization of 'len' is skipped by 'case' label
d:\DENTECH\DAC\dmc1mapper.cpp(138) : see declaration of 'len'
d:\DENTECH\DAC\dmc1mapper.cpp(156) : error C2360: initialization of 'len' is skipped by 'case' label
d:\DENTECH\DAC\dmc1mapper.cpp(147) : see declaration of 'len'
d:\DENTECH\DAC\dmc1mapper.cpp(156) : error C2360: initialization of 'len' is skipped by 'case' label
d:\DENTECH\DAC\dmc1mapper.cpp(138) : see declaration of 'len'
I expect that the firt box of code replaces the the "CASE" commands for the loop - + buttons.
But was a little unsure of where the second box of code went, I added it to the "Extra helper functions"
#include <Windows.h>
#include "DMC1Mapper.h"
// class definition
class CDefaultDMC1Mapper : public IDMC1Mapper
{
public:
void OnCommand(unsigned char cmd,unsigned char note,unsigned char velocity);
void OnTimer();
void Release();
private:
// you can define your own private variables here
int Load[2],LoadTree[2],Shift[2],Waitlist[2],Loop[2],Pitch[2],Wheel[2],PitchLocked[2],temporary[2],video_xfade,show_elapsed[2],timer;
};
// creation and destruction procedures
IDMC1Mapper* __cdecl GetMapper() {return new CDefaultDMC1Mapper();}
void CDefaultDMC1Mapper::Release() {delete this;}
// some small helper functions
#define strchan (chan?"2":"1")
char _strparam[128];
// Flasher based on timer divided by divisor 1/10th secs
inline int Flasher(int timer,int divisor,int defaultval) { return (divisor ? ((timer % (divisor * 4)) < divisor):defaultval); }
// Absolute value
#define ABS(val) (((val) < 0) ? (0 - (val)):(val))
// Limit value to specified minimum/maximum values
inline int MinMax(int val,int min,int max) { if(val > max) val = max; if(val < min) val = min; return val; }
inline char *strparam(int v) {wsprintf(_strparam,"%i",v);return _strparam;}
// Convert const char * to char * string
inline char *CharStr(const char *val,char *str) { strcpy(str,val); return(str); }
// this function will be called each time an event is sent from the DMC1/DAC2
void CDefaultDMC1Mapper::OnCommand(unsigned char cmd,unsigned char note,unsigned char velocity)
{
char buffer[128];
if(cmd==0) // init
{
Code on website if you need it.
Posté Mon 25 Sep 06 @ 4:55 am
halo_djk wrote :
Thanks again for that =D
Eeek, Help! Think i did bad though!
Build result.
Code on website if you need it.
Eeek, Help! Think i did bad though!
Build result.
// this function will be called each time an event is sent from the DMC1/DAC2
void CDefaultDMC1Mapper::OnCommand(unsigned char cmd,unsigned char note,unsigned char velocity)
{
char buffer[128];
if(cmd==0) // init
{
Code on website if you need it.
I only had a small look at your code; the last '{' character should be '}'.
Posté Wed 27 Sep 06 @ 11:09 am
Thanks, found it, fixed it, and uploaded to site! =D
Posté Thu 28 Sep 06 @ 12:06 pm
Halo,
pm me when you get a chance.
pm me when you get a chance.
Posté Sat 07 Oct 06 @ 3:23 am