Threaded build nominally working

This commit is contained in:
hirsch 2016-07-29 15:40:45 -04:00
parent 96152fd3ed
commit f9527898df
26 changed files with 1237 additions and 1090 deletions

65
amp.cpp
View file

@ -1,84 +1,83 @@
#include "amp.h"
#include "mustang.h"
#include "constants.h"
#include "magic.h"
int
AmpCC::continuous_control( int parm5, int parm6, int parm7, int value ) {
Mustang::Cmd cmd;
cmd.state_index = AMP_STATE;
cmd.parm2 = 0x02;
cmd.parm5 = parm5;
cmd.parm6 = parm6;
cmd.parm7 = parm7;
cmd.value = value;
AmpCC::continuous_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd ) {
cmd[2] = 0x02;
memcpy( cmd + 3, model, 2 );
cmd[5] = parm5;
cmd[6] = parm6;
cmd[7] = parm7;
return amp->continuous_control( cmd );
unsigned short magic = magic_values[value];
cmd[9] = magic & 0xff;
cmd[10] = (magic >> 8) & 0xff;
return 0;
}
int
AmpCC::discrete_control( int parm5, int parm6, int parm7, int value ) {
Mustang::Cmd cmd;
cmd.state_index = AMP_STATE;
cmd.parm2 = 0x02;
cmd.parm5 = parm5;
cmd.parm6 = parm6;
cmd.parm7 = parm7;
cmd.value = value;
AmpCC::discrete_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd ) {
cmd[2] = 0x02;
memcpy( cmd + 3, model, 2 );
cmd[5] = parm5;
cmd[6] = parm6;
cmd[7] = parm7;
return amp->discrete_control( cmd );
cmd[9] = value;
return 0;
}
int
AmpCC::dispatch( int cc, int value ) {
AmpCC::dispatch( int cc, int value, unsigned char *cmd ) {
switch( cc ) {
case 69:
// Gain
return cc69( value );
return cc69( value, cmd );
break;
case 70:
// Channel volume
return cc70( value );
return cc70( value, cmd );
break;
case 71:
// Treble
return cc71( value );
return cc71( value, cmd );
break;
case 72:
// Mid
return cc72( value );
return cc72( value, cmd );
break;
case 73:
// Bass
return cc73( value );
return cc73( value, cmd );
break;
case 74:
// Sag
return cc74( value );
return cc74( value, cmd );
break;
case 75:
// Bias
return cc75( value );
return cc75( value, cmd );
break;
case 76:
// Noise Gate
return cc76( value );
return cc76( value, cmd );
break;
case 77:
// Cabinet
return cc77( value );
return cc77( value, cmd );
break;
case 78:
// Presence / Gain2 / Cut
return cc78( value );
return cc78( value, cmd );
break;
case 79:
// Blend / Master Volume
return cc79( value );
return cc79( value, cmd );
break;
default:
return 0;
return -1;
break;
}
}

102
amp.h
View file

@ -21,10 +21,8 @@ protected:
unsigned char model[2];
unsigned char slot;
// Only base class is friend of Mustang, so forward calls from
// derived classes through these methods.
int continuous_control( int parm5, int parm6, int parm7, int value );
int discrete_control( int parm5, int parm6, int parm7, int value );
int continuous_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd );
int discrete_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd );
public:
AmpCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) :
@ -34,50 +32,50 @@ public:
memcpy( this->model, model, 2 );
}
int dispatch( int cc, int value );
int dispatch( int cc, int value, unsigned char *cmd );
const unsigned char *getModel( void ) { return model;}
const unsigned char getSlot( void ) { return slot;}
private:
// Gain
virtual int cc69( int value ) { return continuous_control( 0x01, 0x01, 0x0c, value );}
virtual int cc69( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x0c, value, cmd );}
// Ch. Volume
virtual int cc70( int value ) { return continuous_control( 0x00, 0x00, 0x0c, value );}
virtual int cc70( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x0c, value, cmd );}
// Treble
virtual int cc71( int value ) { return continuous_control( 0x04, 0x04, 0x0c, value );}
virtual int cc71( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x0c, value, cmd );}
// Mid
virtual int cc72( int value ) { return continuous_control( 0x05, 0x05, 0x0c, value );}
virtual int cc72( int value, unsigned char *cmd ) { return continuous_control( 0x05, 0x05, 0x0c, value, cmd );}
// Bass
virtual int cc73( int value ) { return continuous_control( 0x06, 0x06, 0x0c, value );}
virtual int cc73( int value, unsigned char *cmd ) { return continuous_control( 0x06, 0x06, 0x0c, value, cmd );}
// Sag
virtual int cc74( int value ) {
if ( value > 2 ) return 0;
else return discrete_control( 0x13, 0x13, 0x8f, value );
virtual int cc74( int value, unsigned char *cmd ) {
if ( value <= 2 ) return discrete_control( 0x13, 0x13, 0x8f, value, cmd );
else return -1;
}
// Bias
virtual int cc75( int value ) { return continuous_control( 0x0a, 0x0a, 0x0d, value );}
virtual int cc75( int value, unsigned char *cmd ) { return continuous_control( 0x0a, 0x0a, 0x0d, value, cmd );}
// Noise Gate
virtual int cc76( int value ) {
if ( value > 4 ) return 0;
else return discrete_control( 0x0f, 0x0f, 0x90, value );
virtual int cc76( int value, unsigned char *cmd ) {
if ( value <= 4 ) return discrete_control( 0x0f, 0x0f, 0x90, value, cmd );
else return -1;
}
// Cabinet
virtual int cc77( int value ) {
if ( value > 12 ) return 0;
else return discrete_control( 0x11, 0x11, 0x8e, value );
virtual int cc77( int value, unsigned char *cmd ) {
if ( value <= 12 ) return discrete_control( 0x11, 0x11, 0x8e, value, cmd );
else return -1;
}
// Dummy in base class
virtual int cc78( int value ) { return 0;}
virtual int cc79( int value ) { return 0;}
virtual int cc78( int value, unsigned char *cmd ) { return -1;}
virtual int cc79( int value, unsigned char *cmd ) { return -1;}
// Noise Gate Custom Threshold
virtual int cc90( int value ) {
if ( value > 9 ) return 0;
else return discrete_control( 0x10, 0x10, 0x86, value );
virtual int cc90( int value, unsigned char *cmd ) {
if ( value <= 9 ) return discrete_control( 0x10, 0x10, 0x86, value, cmd );
else return -1;
}
// Noise Gate Custom Depth
virtual int cc91( int value ) { return continuous_control( 0x09, 0x09, 0x0c, value );}
virtual int cc91( int value, unsigned char *cmd ) { return continuous_control( 0x09, 0x09, 0x0c, value, cmd );}
};
@ -89,9 +87,9 @@ public:
AmpCC1( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private:
// Presence
virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );}
virtual int cc78( int value, unsigned char *cmd ) { return continuous_control( 0x07, 0x07, 0x0c, value, cmd );}
// Blend
virtual int cc79( int value ) { return continuous_control( 0x02, 0x02, 0x0c, value );}
virtual int cc79( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x0c, value, cmd );}
};
@ -102,9 +100,9 @@ public:
AmpCC2( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private:
// Gain2
virtual int cc78( int value ) { return continuous_control( 0x02, 0x02, 0x0c, value );}
virtual int cc78( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x0c, value, cmd );}
// Master Volume
virtual int cc79( int value ) { return continuous_control( 0x03, 0x03, 0x0c, value );}
virtual int cc79( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x0c, value, cmd );}
};
@ -115,9 +113,9 @@ public:
AmpCC3( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private:
// Cut
virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );}
virtual int cc78( int value, unsigned char *cmd ) { return continuous_control( 0x07, 0x07, 0x0c, value, cmd );}
// Master Volume
virtual int cc79( int value ) { return continuous_control( 0x03, 0x03, 0x0c, value );}
virtual int cc79( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x0c, value, cmd );}
};
@ -131,9 +129,9 @@ public:
AmpCC4( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private:
// Presence
virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );}
virtual int cc78( int value, unsigned char *cmd ) { return continuous_control( 0x07, 0x07, 0x0c, value, cmd );}
// Master Volume
virtual int cc79( int value ) { return continuous_control( 0x03, 0x03, 0x0c, value );}
virtual int cc79( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x0c, value, cmd );}
};
@ -144,11 +142,11 @@ public:
AmpCC5( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private:
// No sag / bias
virtual int cc74( int value ) { return 0;}
virtual int cc75( int value ) { return 0;}
virtual int cc74( int value, unsigned char *cmd ) { return -1;}
virtual int cc75( int value, unsigned char *cmd ) { return -1;}
// No pres / master
virtual int cc78( int value ) { return 0;}
virtual int cc79( int value ) { return 0;}
virtual int cc78( int value, unsigned char *cmd ) { return -1;}
virtual int cc79( int value, unsigned char *cmd ) { return -1;}
};
@ -156,10 +154,10 @@ private:
//
class AmpCC6 : public AmpCC {
public:
AmpCC6( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
AmpCC6( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {;}
private:
// Master Volume
virtual int cc79( int value ) { return continuous_control( 0x03, 0x03, 0x0c, value );}
virtual int cc79( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x0c, value, cmd );}
};
@ -170,7 +168,7 @@ public:
AmpCC7( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private:
// Presence
virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );}
virtual int cc78( int value, unsigned char *cmd ) { return continuous_control( 0x07, 0x07, 0x0c, value, cmd );}
};
@ -180,17 +178,17 @@ class NullAmpCC : public AmpCC {
public:
NullAmpCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private:
virtual int cc69( int value ) { return 0;}
virtual int cc70( int value ) { return 0;}
virtual int cc71( int value ) { return 0;}
virtual int cc72( int value ) { return 0;}
virtual int cc73( int value ) { return 0;}
virtual int cc74( int value ) { return 0;}
virtual int cc75( int value ) { return 0;}
virtual int cc76( int value ) { return 0;}
virtual int cc77( int value ) { return 0;}
virtual int cc78( int value ) { return 0;}
virtual int cc79( int value ) { return 0;}
virtual int cc69( int value, unsigned char *cmd ) { return -1;}
virtual int cc70( int value, unsigned char *cmd ) { return -1;}
virtual int cc71( int value, unsigned char *cmd ) { return -1;}
virtual int cc72( int value, unsigned char *cmd ) { return -1;}
virtual int cc73( int value, unsigned char *cmd ) { return -1;}
virtual int cc74( int value, unsigned char *cmd ) { return -1;}
virtual int cc75( int value, unsigned char *cmd ) { return -1;}
virtual int cc76( int value, unsigned char *cmd ) { return -1;}
virtual int cc77( int value, unsigned char *cmd ) { return -1;}
virtual int cc78( int value, unsigned char *cmd ) { return -1;}
virtual int cc79( int value, unsigned char *cmd ) { return -1;}
};
#endif

View file

@ -1,5 +1,7 @@
#include "amp_models.h"
const unsigned char null_amp_id[] = { 0x00, 0x00 };
const unsigned char f57_deluxe_id[] = { 0x67, 0x00 };
const unsigned char f59_bassman_id[] = { 0x64, 0x00 };
const unsigned char f57_champ_id[] = { 0x7c, 0x00 };

View file

@ -1,6 +1,8 @@
#ifndef AMP_MODELS_H
#define AMP_MODELS_H
extern const unsigned char null_amp_id[];
extern const unsigned char f57_deluxe_id[];
extern const unsigned char f59_bassman_id[];
extern const unsigned char f57_champ_id[];

View file

@ -13,18 +13,10 @@
#define MI_II_V2 0x0014
#define MIII_IV_V_V2 0x0016
#define DSP 2
#define PATCH_SLOT 4
#define EFFECT 16
#define FXSLOT 18
// direct control fields
#define FAMILY 2
#define ACTIVE_INVERT 3
// Offset to current device model for any state structure
#define MODEL 16
#define MODELX 17
// Index into current state structure
#define AMP_STATE 0
@ -34,19 +26,6 @@
#define REVERB_STATE 4
#define PEDAL_STATE 5
// DSP Category
#define AMP_DSP 5
#define STOMP_DSP 6
#define MOD_DSP 7
#define DELAY_DSP 8
#define REVERB_DSP 9
// DSP Family (used for direct parm set) - Effectively DSP - 3
#define STOMP_FAM 3
#define MOD_FAM 4
#define DELAY_FAM 5
#define REVERB_FAM 6
// Reverb model id values
#define SM_HALL_ID 0x0024
#define LG_HALL_ID 0x003a

View file

@ -1,62 +1,61 @@
#include "delay.h"
#include "mustang.h"
#include "constants.h"
#include "magic.h"
int
DelayCC::continuous_control( int parm5, int parm6, int parm7, int value ) {
Mustang::Cmd cmd;
cmd.state_index = DELAY_STATE;
cmd.parm2 = 0x05;
cmd.parm5 = parm5;
cmd.parm6 = parm6;
cmd.parm7 = parm7;
cmd.value = value;
DelayCC::continuous_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd ) {
cmd[2] = 0x05;
memcpy( cmd + 3, model, 2 );
cmd[5] = parm5;
cmd[6] = parm6;
cmd[7] = parm7;
return amp->continuous_control( cmd );
unsigned short magic = magic_values[value];
cmd[9] = magic & 0xff;
cmd[10] = (magic >> 8) & 0xff;
return 0;
}
int
DelayCC::discrete_control( int parm5, int parm6, int parm7, int value ) {
Mustang::Cmd cmd;
cmd.state_index = DELAY_STATE;
cmd.parm2 = 0x05;
cmd.parm5 = parm5;
cmd.parm6 = parm6;
cmd.parm7 = parm7;
cmd.value = value;
DelayCC::discrete_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd ) {
cmd[2] = 0x05;
memcpy( cmd + 3, model, 2 );
cmd[5] = parm5;
cmd[6] = parm6;
cmd[7] = parm7;
return amp->discrete_control( cmd );
cmd[9] = value;
return 0;
}
int
DelayCC::dispatch( int cc, int value ) {
DelayCC::dispatch( int cc, int value, unsigned char *cmd ) {
switch ( cc ) {
case 49:
// Level
return cc49( value );
return cc49( value, cmd );
break;
case 50:
// Delay Time
return cc50( value );
return cc50( value, cmd );
break;
case 51:
// Feedback / FFdbk
return cc51( value );
return cc51( value, cmd );
break;
case 52:
// Brightness / Frequency / Release / RFdbk / Flutter
return cc52( value );
return cc52( value, cmd );
break;
case 53:
// Attenuation / Resonance / Mode / Stereo / Threshold
// Tone / Brightness / Separation
return cc53( value );
return cc53( value, cmd );
break;
case 54:
// Input Level / Stereo / Brightness
return cc54( value );
return cc54( value, cmd );
break;
default:
return 0;

100
delay.h
View file

@ -14,8 +14,8 @@ protected:
unsigned char model[2];
unsigned char slot;
int continuous_control( int parm5, int parm6, int parm7, int value );
int discrete_control( int parm5, int parm6, int parm7, int value );
int continuous_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd );
int discrete_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd );
public:
DelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) :
@ -25,20 +25,20 @@ public:
memcpy( this->model, model, 2 );
}
int dispatch( int cc, int value );
int dispatch( int cc, int value, unsigned char *cmd );
const unsigned char *getModel( void ) { return model;}
const unsigned char getSlot( void ) { return slot;}
private:
// Level
virtual int cc49( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc49( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Delay Time
virtual int cc50( int value ) { return continuous_control( 0x01, 0x01, 0x06, value );}
virtual int cc50( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x06, value, cmd );}
virtual int cc51( int value ) = 0;
virtual int cc52( int value ) = 0;
virtual int cc53( int value ) = 0;
virtual int cc54( int value ) = 0;
virtual int cc51( int value, unsigned char *cmd ) = 0;
virtual int cc52( int value, unsigned char *cmd ) = 0;
virtual int cc53( int value, unsigned char *cmd ) = 0;
virtual int cc54( int value, unsigned char *cmd ) = 0;
};
@ -47,13 +47,13 @@ public:
MonoDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private:
// Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc51( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Brightness
virtual int cc52( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc52( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Attenuation
virtual int cc53( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc53( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
// no-op
virtual int cc54( int value ) { return 0;}
virtual int cc54( int value, unsigned char *cmd ) { return -1;}
};
@ -62,13 +62,13 @@ public:
EchoFilterCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private:
// Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc51( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Frequency
virtual int cc52( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc52( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Resonance
virtual int cc53( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc53( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
// Input Level
virtual int cc54( int value ) { return continuous_control( 0x05, 0x05, 0x01, value );}
virtual int cc54( int value, unsigned char *cmd ) { return continuous_control( 0x05, 0x05, 0x01, value, cmd );}
};
@ -77,18 +77,18 @@ public:
MultitapDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private:
// Delay Time
virtual int cc50( int value ) { return continuous_control( 0x01, 0x01, 0x08, value );}
virtual int cc50( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x08, value, cmd );}
// Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc51( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Brightness
virtual int cc52( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc52( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Mode
virtual int cc53( int value ) {
if ( value > 3 ) return 0;
else return discrete_control( 0x04, 0x04, 0x8b, value );
virtual int cc53( int value, unsigned char *cmd ) {
if ( value > 3 ) return -1;
else return discrete_control( 0x04, 0x04, 0x8b, value, cmd );
}
// no-op
virtual int cc54( int value ) { return 0;}
virtual int cc54( int value, unsigned char *cmd ) { return -1;}
};
@ -97,13 +97,13 @@ public:
PingPongDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private:
// Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc51( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Brightness
virtual int cc52( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc52( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Stereo
virtual int cc53( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc53( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
// no-op
virtual int cc54( int value ) { return 0;}
virtual int cc54( int value, unsigned char *cmd ) { return -1;}
};
@ -112,13 +112,13 @@ public:
DuckingDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private:
// Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc51( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Release
virtual int cc52( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc52( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Threshold
virtual int cc53( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc53( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
// no-op
virtual int cc54( int value ) { return 0;}
virtual int cc54( int value, unsigned char *cmd ) { return -1;}
};
@ -127,13 +127,13 @@ public:
ReverseDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private:
// FFdbk
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc51( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// RFdbk
virtual int cc52( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc52( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Tone
virtual int cc53( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc53( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
// no-op
virtual int cc54( int value ) { return 0;}
virtual int cc54( int value, unsigned char *cmd ) { return -1;}
};
@ -142,13 +142,13 @@ public:
TapeDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private:
// Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc51( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Flutter
virtual int cc52( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc52( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Brightness
virtual int cc53( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc53( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
// Stereo
virtual int cc54( int value ) { return continuous_control( 0x05, 0x05, 0x01, value );}
virtual int cc54( int value, unsigned char *cmd ) { return continuous_control( 0x05, 0x05, 0x01, value, cmd );}
};
@ -157,13 +157,13 @@ public:
StereoTapeDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private:
// Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc51( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Flutter
virtual int cc52( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc52( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Separation
virtual int cc53( int value ) { return continuous_control( 0x04, 0x05, 0x01, value );}
virtual int cc53( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x05, 0x01, value, cmd );}
// Brightness
virtual int cc54( int value ) { return continuous_control( 0x05, 0x04, 0x01, value );}
virtual int cc54( int value, unsigned char *cmd ) { return continuous_control( 0x05, 0x04, 0x01, value, cmd );}
};
@ -171,12 +171,12 @@ class NullDelayCC : public DelayCC {
public:
NullDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private:
virtual int cc49( int value ) { return 0;}
virtual int cc50( int value ) { return 0;}
virtual int cc51( int value ) { return 0;}
virtual int cc52( int value ) { return 0;}
virtual int cc53( int value ) { return 0;}
virtual int cc54( int value ) { return 0;}
virtual int cc49( int value, unsigned char *cmd ) { return -1;}
virtual int cc50( int value, unsigned char *cmd ) { return -1;}
virtual int cc51( int value, unsigned char *cmd ) { return -1;}
virtual int cc52( int value, unsigned char *cmd ) { return -1;}
virtual int cc53( int value, unsigned char *cmd ) { return -1;}
virtual int cc54( int value, unsigned char *cmd ) { return -1;}
};

View file

@ -1,5 +1,7 @@
#include "delay_models.h"
const unsigned char null_dly_id[] = { 0x00, 0x00 };
const unsigned char mono_dly_id[] = { 0x16, 0x00 };
const unsigned char mono_filter_id[] = { 0x43, 0x00 };
const unsigned char st_filter_id[] = { 0x48, 0x00 };

View file

@ -1,6 +1,8 @@
#ifndef DELAY_MODELS_H
#define DELAY_MODELS_H
extern const unsigned char null_dly_id[];
extern const unsigned char mono_dly_id[];
extern const unsigned char mono_filter_id[];
extern const unsigned char st_filter_id[];

25
magic.cpp Normal file
View file

@ -0,0 +1,25 @@
// Magic values for direct conditioning of Mustang analog controls
//
#include "magic.h"
unsigned short magic_values[] = {
0x0000, 0x01e1, 0x036a, 0x04f3, 0x067c, 0x085d, 0x0a69, 0x0fdf,
0x100b, 0x129a, 0x1555, 0x178d, 0x199a, 0x1af7, 0x1c80, 0x1fbe,
0x2016, 0x21cb, 0x2354, 0x2486, 0x263b, 0x2873, 0x29fc, 0x2f9e,
0x30a4, 0x3333, 0x3514, 0x36f4, 0x3826, 0x39db, 0x3b64, 0x3fd4,
0x402b, 0x41e0, 0x43ed, 0x45f9, 0x47ae, 0x490b, 0x4ac0, 0x4f88,
0x500b, 0x5217, 0x547b, 0x5604, 0x57e4, 0x5999, 0x5ba6, 0x5fea,
0x6041, 0x6279, 0x642e, 0x6692, 0x6872, 0x6a53, 0x6c33, 0x6ff5,
0x7020, 0x7201, 0x7439, 0x7619, 0x7851, 0x79af, 0x7b90, 0x7fff,
0x8083, 0x8237, 0x8418, 0x8624, 0x8805, 0x898e, 0x8b9a, 0x8f87,
0x900a, 0x926e, 0x947a, 0x96de, 0x9893, 0x9a1c, 0x9b4e, 0x9f92,
0xa041, 0xa24d, 0xa42e, 0xa5e3, 0xa7ef, 0xa9d0, 0xab59, 0xaf9d,
0xb020, 0xb201, 0xb38a, 0xb56a, 0xb74b, 0xb957, 0xbb38, 0xbfff,
0xc057, 0xc28f, 0xc51e, 0xc72a, 0xc888, 0xca68, 0xcc75, 0xcfb3,
0xd00a, 0xd168, 0xd2f1, 0xd4a6, 0xd686, 0xd8be, 0xdacb, 0xdfe9,
0xe041, 0xe221, 0xe3d6, 0xe5e2, 0xe7ef, 0xe978, 0xeb84, 0xeff4,
0xf077, 0xf40d, 0xf56a, 0xf74b, 0xf9da, 0xfbe6, 0xfe4a, 0xffff
};

31
magic.h
View file

@ -4,35 +4,6 @@
#ifndef _MAGIC_H
#define _MAGIC_H
unsigned short magic_values[] = {
0x0000, 0x013b, 0x02ef, 0x036a, 0x04a4, 0x0659, 0x06d4, 0x080e, 0x0a3d, 0x0b78,
0x0bf2, 0x0d2d, 0x0da7, 0x0ee2, 0x0f5c, 0x1111, 0x124c, 0x12c6, 0x1400, 0x147b,
0x1630, 0x176a, 0x17e5, 0x191f, 0x1999, 0x1ad4, 0x1b4e, 0x1c89, 0x1d03, 0x1e3e,
0x1eb8, 0x1ff3, 0x206d, 0x21a8, 0x2222, 0x235d, 0x23d7, 0x2511, 0x258c, 0x26c6,
0x2741, 0x287b, 0x28f6, 0x2a30, 0x2aaa, 0x2be5, 0x2c5f, 0x2d9a, 0x2e14, 0x2f4f,
0x2fc9, 0x3104, 0x317e, 0x32b9, 0x3333, 0x346e, 0x34e8, 0x3622, 0x369d, 0x37d7,
0x3852, 0x398c, 0x3a07, 0x3b41, 0x3bbb, 0x3cf6, 0x3d70, 0x3eab, 0x3f25, 0x4060,
0x40da, 0x4215, 0x428f, 0x43ca, 0x4444, 0x457f, 0x45f9, 0x4733, 0x47ae, 0x48e8,
0x4963, 0x4a9d, 0x4b18, 0x4c52, 0x4ccc, 0x4e07, 0x4e81, 0x4fbc, 0x5036, 0x5171,
0x51eb, 0x5326, 0x53a0, 0x54db, 0x5555, 0x5690, 0x570a, 0x5844, 0x58bf, 0x59f9,
0x5a74, 0x5bae, 0x5c29, 0x5d63, 0x5dde, 0x5f18, 0x5f92, 0x60cd, 0x6282, 0x62fc,
0x6437, 0x64b1, 0x65ec, 0x6666, 0x67a1, 0x681b, 0x6955, 0x69d0, 0x6b0a, 0x6b85,
0x6cbf, 0x6d3a, 0x6e74, 0x6eef, 0x7029, 0x70a3, 0x71de, 0x7258, 0x7393, 0x740d,
0x7548, 0x75c2, 0x76fd, 0x7777, 0x78b2, 0x792c, 0x7a66, 0x7ae1, 0x7c1b, 0x7c96,
0x7dd0, 0x7e4b, 0x7f85, 0x8000, 0x813a, 0x81b4, 0x82ef, 0x8369, 0x84a4, 0x851e,
0x8659, 0x86d3, 0x880e, 0x8888, 0x89c3, 0x8a3d, 0x8bf2, 0x8d2c, 0x8da7, 0x8ee1,
0x9096, 0x9111, 0x924b, 0x92c5, 0x947a, 0x962f, 0x97e4, 0x9b4e, 0x9d03, 0x9eb8,
0xa06d, 0xa222, 0xa3d6, 0xa58b, 0xa740, 0xa8f5, 0xaaaa, 0xac5f, 0xafc9, 0xb17e,
0xb333, 0xb4e7, 0xb851, 0xba06, 0xbbbb, 0xbd70, 0xbf25, 0xc0da, 0xc28f, 0xc444,
0xc5f8, 0xc962, 0xcb17, 0xcccc, 0xce81, 0xd036, 0xd1eb, 0xd3a0, 0xd555, 0xd709,
0xd8be, 0xda73, 0xdc28, 0xdddd, 0xdf92, 0xe147, 0xe2fc, 0xe4b1, 0xe666, 0xe81a,
0xe9cf, 0xeb84, 0xf0a3, 0xf258, 0xf5c2, 0xf92b, 0xfae0, 0xfe4a, 0xffff
};
// Max index in array
unsigned magic_max = 218;
// Scale MIDI CC value to array index
double magic_scale_factor = 1.711;
extern unsigned short magic_values[];
#endif

51
mod.cpp
View file

@ -1,57 +1,56 @@
#include "mod.h"
#include "mustang.h"
#include "constants.h"
#include "magic.h"
int
ModCC::continuous_control( int parm5, int parm6, int parm7, int value ) {
Mustang::Cmd cmd;
cmd.state_index = MOD_STATE;
cmd.parm2 = 0x04;
cmd.parm5 = parm5;
cmd.parm6 = parm6;
cmd.parm7 = parm7;
cmd.value = value;
ModCC::continuous_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd ) {
cmd[2] = 0x04;
memcpy( cmd + 3, model, 2 );
cmd[5] = parm5;
cmd[6] = parm6;
cmd[7] = parm7;
return amp->continuous_control( cmd );
unsigned short magic = magic_values[value];
cmd[9] = magic & 0xff;
cmd[10] = (magic >> 8) & 0xff;
return 0;
}
int
ModCC::discrete_control( int parm5, int parm6, int parm7, int value ) {
Mustang::Cmd cmd;
cmd.state_index = MOD_STATE;
cmd.parm2 = 0x04;
cmd.parm5 = parm5;
cmd.parm6 = parm6;
cmd.parm7 = parm7;
cmd.value = value;
ModCC::discrete_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd ) {
cmd[2] = 0x04;
memcpy( cmd + 3, model, 2 );
cmd[5] = parm5;
cmd[6] = parm6;
cmd[7] = parm7;
return amp->discrete_control( cmd );
cmd[9] = value;
return 0;
}
int
ModCC::dispatch( int cc, int value ) {
ModCC::dispatch( int cc, int value, unsigned char *cmd ) {
switch ( cc ) {
case 39:
// Level / Mix
return cc39( value );
return cc39( value, cmd );
break;
case 40:
// Rate / Rotor / Freq / Pitch
return cc40( value );
return cc40( value, cmd );
break;
case 41:
// Depth / Duty Cycle / Resonance / Detune / Heel Freq
return cc41( value );
return cc41( value, cmd );
break;
case 42:
// Delay / Fdbk / LFO / Min Freq / Feedback / Toe Freq
return cc42( value );
return cc42( value, cmd );
break;
case 43:
// LR Phase / Release / Tri Shape / PreDelay / High Q
return cc43( value );
return cc43( value, cmd );
break;
default:
return 0;

150
mod.h
View file

@ -14,8 +14,8 @@ protected:
unsigned char model[2];
unsigned char slot;
int continuous_control( int parm5, int parm6, int parm7, int value );
int discrete_control( int parm5, int parm6, int parm7, int value );
int continuous_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd );
int discrete_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd );
public:
ModCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) :
@ -25,16 +25,16 @@ public:
memcpy( this->model, model, 2 );
}
int dispatch( int cc, int value );
int dispatch( int cc, int value, unsigned char *cmd );
const unsigned char *getModel( void ) { return model;}
const unsigned char getSlot( void ) { return slot;}
private:
virtual int cc39( int value ) = 0;
virtual int cc40( int value ) = 0;
virtual int cc41( int value ) = 0;
virtual int cc42( int value ) = 0;
virtual int cc43( int value ) = 0;
virtual int cc39( int value, unsigned char *cmd ) = 0;
virtual int cc40( int value, unsigned char *cmd ) = 0;
virtual int cc41( int value, unsigned char *cmd ) = 0;
virtual int cc42( int value, unsigned char *cmd ) = 0;
virtual int cc43( int value, unsigned char *cmd ) = 0;
};
@ -43,15 +43,15 @@ public:
ChorusCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc39( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Rate
virtual int cc40( int value ) { return continuous_control( 0x01, 0x01, 0x10, value );}
virtual int cc40( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x10, value, cmd );}
// Depth
virtual int cc41( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc41( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Avg Delay
virtual int cc42( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc42( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// LR Phase
virtual int cc43( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc43( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
@ -60,15 +60,15 @@ public:
FlangerCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc39( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Rate
virtual int cc40( int value ) { return continuous_control( 0x01, 0x01, 0x10, value );}
virtual int cc40( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x10, value, cmd );}
// Depth
virtual int cc41( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc41( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Feedback
virtual int cc42( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc42( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// LR Phase
virtual int cc43( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc43( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
@ -77,15 +77,15 @@ public:
VibratoneCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc39( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Rotor Speed
virtual int cc40( int value ) { return continuous_control( 0x01, 0x01, 0x0f, value );}
virtual int cc40( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x0f, value, cmd );}
// Depth
virtual int cc41( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc41( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Feedback
virtual int cc42( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc42( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// LR Phase
virtual int cc43( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc43( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
@ -94,15 +94,15 @@ public:
TremCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc39( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Rotor Speed
virtual int cc40( int value ) { return continuous_control( 0x01, 0x01, 0x0e, value );}
virtual int cc40( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x0e, value, cmd );}
// Duty Cycle
virtual int cc41( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc41( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Attack / LFO Clip
virtual int cc42( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc42( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Release / Tri Shape
virtual int cc43( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc43( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
@ -111,18 +111,18 @@ public:
RingModCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc39( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Freq
virtual int cc40( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc40( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Depth
virtual int cc41( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc41( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// LFO Depth
virtual int cc42( int value ) {
if ( value > 1 ) return 0;
else return discrete_control( 0x03, 0x03, 0x8c, value );
virtual int cc42( int value, unsigned char *cmd ) {
if ( value > 1 ) return -1;
else return discrete_control( 0x03, 0x03, 0x8c, value, cmd );
}
// LFO Phase
virtual int cc43( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc43( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
@ -131,15 +131,15 @@ public:
StepFilterCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc39( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Rate
virtual int cc40( int value ) { return continuous_control( 0x01, 0x01, 0x10, value );}
virtual int cc40( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x10, value, cmd );}
// Resonance
virtual int cc41( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc41( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Min Freq
virtual int cc42( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc42( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Max Freq
virtual int cc43( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc43( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
@ -148,17 +148,17 @@ public:
PhaserCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc39( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Rate
virtual int cc40( int value ) { return continuous_control( 0x01, 0x01, 0x10, value );}
virtual int cc40( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x10, value, cmd );}
// Depth
virtual int cc41( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc41( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Feedback
virtual int cc42( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc42( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// LFO Shape
virtual int cc43( int value ) {
if ( value > 1 ) return 0;
else return discrete_control( 0x04, 0x04, 0x8c, value );
virtual int cc43( int value, unsigned char *cmd ) {
if ( value > 1 ) return -1;
else return discrete_control( 0x04, 0x04, 0x8c, value, cmd );
}
};
@ -168,15 +168,15 @@ public:
PitchShifterCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc39( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Pitch
virtual int cc40( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc40( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Detune
virtual int cc41( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc41( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Feedback
virtual int cc42( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc42( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Predelay
virtual int cc43( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc43( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
// Wah + Touch Wah
@ -185,17 +185,17 @@ public:
ModWahCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
// Mix
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc39( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Freq
virtual int cc40( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc40( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Heel Freq
virtual int cc41( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc41( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Toe Freq
virtual int cc42( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc42( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Hi-Q
virtual int cc43( int value ) {
if ( value > 1 ) return 0;
else return discrete_control( 0x04, 0x04, 0x81, value );
virtual int cc43( int value, unsigned char *cmd ) {
if ( value > 1 ) return -1;
else return discrete_control( 0x04, 0x04, 0x81, value, cmd );
}
};
@ -205,24 +205,24 @@ public:
DiatonicShiftCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
// Mix
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc39( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Pitch
virtual int cc40( int value ) {
if ( value > 0x15 ) return 0;
else return discrete_control( 0x01, 0x0b, 0x98, value );
virtual int cc40( int value, unsigned char *cmd ) {
if ( value > 0x15 ) return -1;
else return discrete_control( 0x01, 0x0b, 0x98, value, cmd );
}
// Key
virtual int cc41( int value ) {
if ( value > 0x0b ) return 0;
else return discrete_control( 0x02, 0x02, 0x99, value );
virtual int cc41( int value, unsigned char *cmd ) {
if ( value > 0x0b ) return -1;
else return discrete_control( 0x02, 0x02, 0x99, value, cmd );
}
// Scale
virtual int cc42( int value ) {
if ( value > 8 ) return 0;
else return discrete_control( 0x03, 0x03, 0x9a, value );
virtual int cc42( int value, unsigned char *cmd ) {
if ( value > 8 ) return -1;
else return discrete_control( 0x03, 0x03, 0x9a, value, cmd );
}
// Tone
virtual int cc43( int value ) { return continuous_control( 0x04, 0x07, 0x01, value );}
virtual int cc43( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x07, 0x01, value, cmd );}
};
@ -230,11 +230,11 @@ class NullModCC : public ModCC {
public:
NullModCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private:
virtual int cc39( int value ) { return 0;}
virtual int cc40( int value ) { return 0;}
virtual int cc41( int value ) { return 0;}
virtual int cc42( int value ) { return 0;}
virtual int cc43( int value ) { return 0;}
virtual int cc39( int value, unsigned char *cmd ) { return -1;}
virtual int cc40( int value, unsigned char *cmd ) { return -1;}
virtual int cc41( int value, unsigned char *cmd ) { return -1;}
virtual int cc42( int value, unsigned char *cmd ) { return -1;}
virtual int cc43( int value, unsigned char *cmd ) { return -1;}
};

View file

@ -1,5 +1,7 @@
#include "mod_models.h"
const unsigned char null_mod_id[] = { 0x00, 0x00 };
const unsigned char sine_chorus_id[] = { 0x12, 0x00 };
const unsigned char tri_chorus_id[] = { 0x13, 0x00 };
const unsigned char sine_flange_id[] = { 0x18, 0x00 };

View file

@ -3,6 +3,8 @@
#ifndef MOD_MODELS_H
#define MOD_MODELS_H
extern const unsigned char null_mod_id[];
extern const unsigned char sine_chorus_id[];
extern const unsigned char tri_chorus_id[];
extern const unsigned char sine_flange_id[];

File diff suppressed because it is too large Load diff

View file

@ -20,37 +20,18 @@ class DelayCC;
class ModCC;
class StompCC;
class Mustang {
friend class AmpCC;
friend class ReverbCC;
friend class DelayCC;
friend class ModCC;
friend class StompCC;
char preset_names[100][33];
unsigned curr_preset_idx;
unsigned char dsp_parms[6][64];
unsigned char curr_model[5][2];
unsigned char execute[64];
static const unsigned char state_prefix[];
static const unsigned char parms_done[];
static const unsigned char tuner_ack[];
static const unsigned char tuner_prefix[];
static const unsigned char select_ack[];
static const unsigned char cc_ack[];
libusb_device_handle *usb_io;
pthread_t worker;
pthread_mutex_t data_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t shutdown_lock = PTHREAD_MUTEX_INITIALIZER;
bool want_shutdown;
@ -66,13 +47,35 @@ class Mustang {
}
};
// Manage access to each DSP block
Condition<bool> dsp_sync[5];
Condition<bool> preset_names_sync;
char preset_names[100][33];
unsigned curr_preset_idx;
// Manage access to each DSP block
Condition<bool> dsp_sync[6];
unsigned char dsp_parms[6][64];
// Received {0x1c, 0x01, 0x00, ...}
Condition<bool> cc_ack_eom;
// Received {0x00, 0x00, 0x19, ... }
Condition<bool> efx_toggle_sync;
static const unsigned char efx_toggle_ack[];
// Synchronize init on end of initial parm dump
Condition<bool> parm_read_sync;
static const unsigned char parm_read_ack[];
// Synchronize on receipt of model change acknowledge
Condition<bool> model_change_sync;
static const unsigned char model_change_ack[];
// Synchronize on receipt of control change acknowledge
Condition<bool> cc_ack_sync;
static const unsigned char cc_ack[];
Condition<bool> tuner_ack_sync;
static const unsigned char tuner_ack[];
struct usb_id {
// product id
@ -87,30 +90,23 @@ class Mustang {
static const usb_id amp_ids[];
bool isV2;
static void *threadStarter( void * );
void handleInput( void );
bool tuner_active;
AmpCC * curr_amp;
ReverbCC * curr_reverb;
DelayCC * curr_delay;
ModCC * curr_mod;
StompCC * curr_stomp;
ModCC * curr_mod;
DelayCC * curr_delay;
ReverbCC * curr_reverb;
public:
struct Cmd {
int state_index;
int parm2;
int parm5;
int parm6;
int parm7;
int value;
};
static void *threadStarter( void * );
void handleInput( void );
private:
int continuous_control( const Mustang::Cmd & cmd );
int discrete_control( const Mustang::Cmd & cmd );
int direct_control( unsigned char *cmd );
int sendCmd( unsigned char *buffer );
int requestDump( void );
int executeModelChange( unsigned char *buffer );
void updateAmpObj( const unsigned char *data );
void updateStompObj( const unsigned char *data );
@ -132,22 +128,25 @@ public:
int commShutdown( void );
int setAmp( int ord );
int setReverb( int ord );
int setDelay( int ord );
int setMod( int ord );
int ampControl( int cc, int value );
int setStomp( int ord );
int stompControl( int cc, int value );
int setMod( int ord );
int modControl( int cc, int value );
int setDelay( int ord );
int delayControl( int cc, int value );
int setReverb( int ord );
int reverbControl( int cc, int value );
int tunerMode( int value );
int patchChange( int );
int effectToggle( int cc, int value );
AmpCC * getAmp( void ) { return curr_amp;}
ReverbCC * getReverb( void ) { return curr_reverb;}
DelayCC * getDelay( void ) { return curr_delay;}
ModCC * getMod( void ) { return curr_mod;}
StompCC * getStomp( void ) { return curr_stomp;}
};

View file

@ -7,26 +7,16 @@
#include "mustang.h"
#if 0
#include "amp.h"
#include "reverb.h"
#include "delay.h"
#include "mod.h"
#include "stomp.h"
#endif
static Mustang mustang;
static int channel;
#if 0
void message_action( double deltatime, std::vector< unsigned char > *message, void *userData ) {
#if 0
unsigned int nBytes = message->size();
if ( nBytes > 0 ) {
fprintf( stdout, "%02x %d %d\n", (int)message->at(0), (int)message->at(1), (int)message->at(2) );
}
if ( nBytes == 2 ) fprintf( stdout, "%02x %d\n", (int)message->at(0), (int)message->at(1) );
else if ( nBytes == 3 ) fprintf( stdout, "%02x %d %d\n", (int)message->at(0), (int)message->at(1), (int)message->at(2) );
#endif
// Is this for us?
@ -40,7 +30,7 @@ void message_action( double deltatime, std::vector< unsigned char > *message, vo
case 0xc0: {
// Program change
int bank = (int)(*message)[1];
int rc = mustang.load_memory_bank( bank );
int rc = mustang.patchChange( bank );
if ( rc ) {
fprintf( stderr, "Error: PC#%d failed. RC = %d\n", bank, rc );
}
@ -59,20 +49,20 @@ void message_action( double deltatime, std::vector< unsigned char > *message, vo
}
// All EFX toggle
else if ( cc == 22 ) {
rc = mustang.effect_toggle( 23, value );
rc = mustang.effectToggle( 23, value );
if ( rc == 0 ) {
rc = mustang.effect_toggle( 24, value );
rc = mustang.effectToggle( 24, value );
if ( rc == 0 ) {
rc = mustang.effect_toggle( 25, value );
rc = mustang.effectToggle( 25, value );
if ( rc == 0 ) {
rc = mustang.effect_toggle( 26, value );
rc = mustang.effectToggle( 26, value );
}
}
}
}
// Effects on/off
else if ( cc >= 23 && cc <= 26 ) {
rc = mustang.effect_toggle( cc, value );
rc = mustang.effectToggle( cc, value );
}
// Set stomp model
else if ( cc == 28 ) {
@ -80,8 +70,7 @@ void message_action( double deltatime, std::vector< unsigned char > *message, vo
}
// Stomp CC handler
else if ( cc >= 29 && cc <= 33 ) {
StompCC *stompObj = mustang.getStomp();
rc = stompObj->dispatch( cc, value );
rc = mustang.stompControl( cc, value );
}
// Set mod model
else if ( cc == 38 ) {
@ -89,8 +78,7 @@ void message_action( double deltatime, std::vector< unsigned char > *message, vo
}
// Mod CC handler
else if ( cc >= 39 && cc <= 43 ) {
ModCC *modObj = mustang.getMod();
rc = modObj->dispatch( cc, value );
rc = mustang.modControl( cc, value );
}
// Set delay model
else if ( cc == 48 ) {
@ -98,8 +86,7 @@ void message_action( double deltatime, std::vector< unsigned char > *message, vo
}
// Delay CC handler
else if ( cc >= 49 && cc <= 54 ) {
DelayCC *delayObj = mustang.getDelay();
rc = delayObj->dispatch( cc, value );
rc = mustang.delayControl( cc, value );
}
// Set reverb model
else if ( cc == 58 ) {
@ -107,8 +94,7 @@ void message_action( double deltatime, std::vector< unsigned char > *message, vo
}
// Reverb CC handler
else if ( cc >= 59 && cc <= 63 ) {
ReverbCC *reverbObj = mustang.getReverb();
rc = reverbObj->dispatch( cc, value );
rc = mustang.reverbControl( cc, value );
}
// Set amp model
else if ( cc == 68 ) {
@ -116,8 +102,7 @@ void message_action( double deltatime, std::vector< unsigned char > *message, vo
}
// Amp CC Handler
else if ( cc >= 69 && cc <= 79 ) {
AmpCC *ampObj = mustang.getAmp();
rc = ampObj->dispatch( cc, value );
rc = mustang.ampControl( cc, value );
}
if ( rc ) {
fprintf( stderr, "Error: CC#%d failed. RC = %d\n", cc, rc );
@ -131,8 +116,6 @@ void message_action( double deltatime, std::vector< unsigned char > *message, vo
}
#endif
// void errorcallback( RtError::Type type, const std::string & detail, void *userData ) {
// std::cout << "Error: Code = " << type << ", Msg: " << detail << "\n";
// }
@ -166,9 +149,6 @@ int main( int argc, const char **argv ) {
exit( 1 );
}
fprintf( stderr, "Setup done!\n" );
#if 0
RtMidiIn *input_handler = new RtMidiIn();
// See if we have any ports
@ -185,8 +165,6 @@ int main( int argc, const char **argv ) {
// Don't want sysex, timing, active sense
input_handler->ignoreTypes( true, true, true );
#endif
// Block and wait for signal
pause();
@ -199,8 +177,6 @@ int main( int argc, const char **argv ) {
exit( 1 );
}
fprintf( stderr, "Shutdown complete!\n" );
// delete input_handler;
return 0;

View file

@ -1,44 +1,44 @@
#include "reverb.h"
#include "mustang.h"
#include "constants.h"
#include "magic.h"
int
ReverbCC::continuous_control( int parm5, int parm6, int parm7, int value ) {
Mustang::Cmd cmd;
cmd.state_index = REVERB_STATE;
cmd.parm2 = 0x06;
cmd.parm5 = parm5;
cmd.parm6 = parm6;
cmd.parm7 = parm7;
cmd.value = value;
ReverbCC::continuous_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd ) {
cmd[2] = 0x06;
memcpy( cmd + 3, model, 2 );
cmd[5] = parm5;
cmd[6] = parm6;
cmd[7] = parm7;
return amp->continuous_control( cmd );
unsigned short magic = magic_values[value];
cmd[9] = magic & 0xff;
cmd[10] = (magic >> 8) & 0xff;
return 0;
}
int
ReverbCC::dispatch( int cc, int value ) {
ReverbCC::dispatch( int cc, int value, unsigned char *cmd ) {
switch ( cc ) {
case 59:
// Level
return cc59( value );
return cc59( value, cmd );
break;
case 60:
// Decay
return cc60( value );
return cc60( value, cmd );
break;
case 61:
// Dwell
return cc61( value );
return cc61( value, cmd );
break;
case 62:
// Diffusion
return cc62( value );
return cc62( value, cmd );
break;
case 63:
// Tone
return cc63( value );
return cc63( value, cmd );
break;
default:
return 0;

View file

@ -14,7 +14,7 @@ protected:
unsigned char model[2];
unsigned char slot;
int continuous_control( int parm5, int parm6, int parm7, int value );
int continuous_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd );
public:
ReverbCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) :
@ -24,21 +24,21 @@ public:
memcpy( this->model, model, 2 );
}
int dispatch( int cc, int value );
int dispatch( int cc, int value, unsigned char *cmd );
const unsigned char *getModel( void ) { return model;}
const unsigned char getSlot( void ) { return slot;}
private:
// Level
int cc59( int value ) { return continuous_control( 0x00, 0x00, 0x0b, value );}
int cc59( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x0b, value, cmd );}
// Decay
int cc60( int value ) { return continuous_control( 0x01, 0x01, 0x0b, value );}
int cc60( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x0b, value, cmd );}
// Dwell
int cc61( int value ) { return continuous_control( 0x02, 0x02, 0x0b, value );}
int cc61( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x0b, value, cmd );}
// Diffusion
int cc62( int value ) { return continuous_control( 0x03, 0x03, 0x0b, value );}
int cc62( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x0b, value, cmd );}
// Tone
int cc63( int value ) { return continuous_control( 0x04, 0x04, 0x0b, value );}
int cc63( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x0b, value, cmd );}
};
@ -46,11 +46,11 @@ class NullReverbCC : public ReverbCC {
public:
NullReverbCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ReverbCC(theAmp,model,theSlot) {}
private:
int cc59( int value ) { return 0;}
int cc60( int value ) { return 0;}
int cc61( int value ) { return 0;}
int cc62( int value ) { return 0;}
int cc63( int value ) { return 0;}
int cc59( int value, unsigned char *cmd ) { return -1;}
int cc60( int value, unsigned char *cmd ) { return -1;}
int cc61( int value, unsigned char *cmd ) { return -1;}
int cc62( int value, unsigned char *cmd ) { return -1;}
int cc63( int value, unsigned char *cmd ) { return -1;}
};

4
reverb_models.cpp Normal file
View file

@ -0,0 +1,4 @@
#include "reverb_models.h"
const unsigned char null_reverb_id[] = { 0x00, 0x00 };

8
reverb_models.h Normal file
View file

@ -0,0 +1,8 @@
// -*-c++-*-
#ifndef REVERB_MODELS_H
#define REVERB_MODELS_H
extern const unsigned char null_reverb_id[];
#endif

View file

@ -1,57 +1,56 @@
#include "stomp.h"
#include "mustang.h"
#include "constants.h"
#include "magic.h"
int
StompCC::continuous_control( int parm5, int parm6, int parm7, int value ) {
Mustang::Cmd cmd;
cmd.state_index = STOMP_STATE;
cmd.parm2 = 0x03;
cmd.parm5 = parm5;
cmd.parm6 = parm6;
cmd.parm7 = parm7;
cmd.value = value;
StompCC::continuous_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd ) {
cmd[2] = 0x03;
memcpy( cmd + 3, model, 2 );
cmd[5] = parm5;
cmd[6] = parm6;
cmd[7] = parm7;
return amp->continuous_control( cmd );
unsigned short magic = magic_values[value];
cmd[9] = magic & 0xff;
cmd[10] = (magic >> 8) & 0xff;
return 0;
}
int
StompCC::discrete_control( int parm5, int parm6, int parm7, int value ) {
Mustang::Cmd cmd;
cmd.state_index = STOMP_STATE;
cmd.parm2 = 0x03;
cmd.parm5 = parm5;
cmd.parm6 = parm6;
cmd.parm7 = parm7;
cmd.value = value;
StompCC::discrete_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd ) {
cmd[2] = 0x03;
memcpy( cmd + 3, model, 2 );
cmd[5] = parm5;
cmd[6] = parm6;
cmd[7] = parm7;
return amp->discrete_control( cmd );
cmd[9] = value;
return 0;
}
int
StompCC::dispatch( int cc, int value ) {
StompCC::dispatch( int cc, int value, unsigned char *cmd ) {
switch ( cc ) {
case 29:
// Level / Mix / Type
return cc29( value );
return cc29( value, cmd );
break;
case 30:
// Gain / Freq / Sens / Thresh
return cc30( value );
return cc30( value, cmd );
break;
case 31:
// Low / Heel Freq / Octave / Sens / Ratio
return cc31( value );
return cc31( value, cmd );
break;
case 32:
// Mid / Toe Freq / Low / Octave / Attack
return cc32( value );
return cc32( value, cmd );
break;
case 33:
// High / High Q / Peak / Relase
return cc33( value );
return cc33( value, cmd );
break;
default:
return 0;

144
stomp.h
View file

@ -14,8 +14,8 @@ protected:
unsigned char model[2];
unsigned char slot;
int continuous_control( int parm5, int parm6, int parm7, int value );
int discrete_control( int parm5, int parm6, int parm7, int value );
int continuous_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd );
int discrete_control( int parm5, int parm6, int parm7, int value, unsigned char *cmd );
public:
StompCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) :
@ -25,16 +25,16 @@ public:
memcpy( this->model, model, 2 );
}
int dispatch( int cc, int value );
int dispatch( int cc, int value, unsigned char *cmd );
const unsigned char *getModel( void ) { return model;}
const unsigned char getSlot( void ) { return slot;}
private:
virtual int cc29( int value ) = 0;
virtual int cc30( int value ) = 0;
virtual int cc31( int value ) = 0;
virtual int cc32( int value ) = 0;
virtual int cc33( int value ) = 0;
virtual int cc29( int value, unsigned char *cmd ) = 0;
virtual int cc30( int value, unsigned char *cmd ) = 0;
virtual int cc31( int value, unsigned char *cmd ) = 0;
virtual int cc32( int value, unsigned char *cmd ) = 0;
virtual int cc33( int value, unsigned char *cmd ) = 0;
};
@ -43,15 +43,15 @@ public:
OverdriveCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc29( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Gain
virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc30( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Low
virtual int cc31( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc31( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Mid
virtual int cc32( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc32( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// High
virtual int cc33( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc33( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
@ -60,17 +60,17 @@ public:
WahCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
// Mix
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc29( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Freq
virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc30( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Heel Freq
virtual int cc31( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc31( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Toe Freq
virtual int cc32( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc32( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// High Q
virtual int cc33( int value ) {
if ( value > 1 ) return 0;
else return discrete_control( 0x04, 0x04, 0x81, value );
virtual int cc33( int value, unsigned char *cmd ) {
if ( value > 1 ) return -1;
else return discrete_control( 0x04, 0x04, 0x81, value, cmd );
}
};
@ -80,15 +80,15 @@ public:
FuzzCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc29( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Gain
virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc30( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Octave
virtual int cc31( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc31( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Low
virtual int cc32( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc32( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// High
virtual int cc33( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc33( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
@ -97,15 +97,15 @@ public:
FuzzTouchWahCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc29( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Gain
virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc30( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Sens
virtual int cc31( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc31( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Octave
virtual int cc32( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc32( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Peak
virtual int cc33( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc33( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
@ -114,14 +114,14 @@ public:
SimpleCompCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
// Type
virtual int cc29( int value ) {
if ( value > 3 ) return 0;
else return discrete_control( 0x00, 0x05, 0x92, value );
virtual int cc29( int value, unsigned char *cmd ) {
if ( value > 3 ) return -1;
else return discrete_control( 0x00, 0x05, 0x92, value, cmd );
}
virtual int cc30( int value ) { return 0;}
virtual int cc31( int value ) { return 0;}
virtual int cc32( int value ) { return 0;}
virtual int cc33( int value ) { return 0;}
virtual int cc30( int value, unsigned char *cmd ) { return -1;}
virtual int cc31( int value, unsigned char *cmd ) { return -1;}
virtual int cc32( int value, unsigned char *cmd ) { return -1;}
virtual int cc33( int value, unsigned char *cmd ) { return -1;}
};
@ -130,15 +130,15 @@ public:
CompCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc29( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Thresh
virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc30( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Ratio
virtual int cc31( int value ) { return continuous_control( 0x02, 0x02, 0x04, value );}
virtual int cc31( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x04, value, cmd );}
// Attack
virtual int cc32( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );}
virtual int cc32( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x01, value, cmd );}
// Release
virtual int cc33( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );}
virtual int cc33( int value, unsigned char *cmd ) { return continuous_control( 0x04, 0x04, 0x01, value, cmd );}
};
@ -147,15 +147,15 @@ public:
RangerCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot) : StompCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc29( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Gain
virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc30( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Lo-Cut
virtual int cc31( int value ) { return continuous_control( 0x02, 0x03, 0x01, value );}
virtual int cc31( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x03, 0x01, value, cmd );}
// Bright
virtual int cc32( int value ) { return continuous_control( 0x03, 0x02, 0x01, value );}
virtual int cc32( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x02, 0x01, value, cmd );}
// n/a
virtual int cc33( int value ) { return 0;}
virtual int cc33( int value, unsigned char *cmd ) { return -1;}
};
@ -164,15 +164,15 @@ public:
GreenBoxCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc29( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Gain
virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc30( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Tone
virtual int cc31( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc31( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// Bright
virtual int cc32( int value ) { return continuous_control( 0x03, 0x03, 0x12, value );}
virtual int cc32( int value, unsigned char *cmd ) { return continuous_control( 0x03, 0x03, 0x12, value, cmd );}
// n/a
virtual int cc33( int value ) { return 0;}
virtual int cc33( int value, unsigned char *cmd ) { return -1;}
};
@ -181,15 +181,15 @@ public:
OrangeBoxCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc29( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Dist
virtual int cc30( int value ) { return continuous_control( 0x01, 0x02, 0x01, value );}
virtual int cc30( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x02, 0x01, value, cmd );}
// Tone
virtual int cc31( int value ) { return continuous_control( 0x02, 0x01, 0x01, value );}
virtual int cc31( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x01, 0x01, value, cmd );}
// n/a
virtual int cc32( int value ) { return 0;}
virtual int cc32( int value, unsigned char *cmd ) { return -1;}
// n/a
virtual int cc33( int value ) { return 0;}
virtual int cc33( int value, unsigned char *cmd ) { return -1;}
};
@ -198,15 +198,15 @@ public:
BlackBoxCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc29( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Dist
virtual int cc30( int value ) { return continuous_control( 0x01, 0x02, 0x01, value );}
virtual int cc30( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x02, 0x01, value, cmd );}
// Filter
virtual int cc31( int value ) { return continuous_control( 0x02, 0x01, 0x01, value );}
virtual int cc31( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x01, 0x01, value, cmd );}
// n/a
virtual int cc32( int value ) { return 0;}
virtual int cc32( int value, unsigned char *cmd ) { return -1;}
// n/a
virtual int cc33( int value ) { return 0;}
virtual int cc33( int value, unsigned char *cmd ) { return -1;}
};
@ -215,15 +215,15 @@ public:
BigFuzzCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
// Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
virtual int cc29( int value, unsigned char *cmd ) { return continuous_control( 0x00, 0x00, 0x01, value, cmd );}
// Tone
virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );}
virtual int cc30( int value, unsigned char *cmd ) { return continuous_control( 0x01, 0x01, 0x01, value, cmd );}
// Sustain
virtual int cc31( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
virtual int cc31( int value, unsigned char *cmd ) { return continuous_control( 0x02, 0x02, 0x01, value, cmd );}
// n/a
virtual int cc32( int value ) { return 0;}
virtual int cc32( int value, unsigned char *cmd ) { return -1;}
// n/a
virtual int cc33( int value ) { return 0;}
virtual int cc33( int value, unsigned char *cmd ) { return -1;}
};
@ -231,11 +231,11 @@ class NullStompCC : public StompCC {
public:
NullStompCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private:
virtual int cc29( int value ) { return 0;}
virtual int cc30( int value ) { return 0;}
virtual int cc31( int value ) { return 0;}
virtual int cc32( int value ) { return 0;}
virtual int cc33( int value ) { return 0;}
virtual int cc29( int value, unsigned char *cmd ) { return -1;}
virtual int cc30( int value, unsigned char *cmd ) { return -1;}
virtual int cc31( int value, unsigned char *cmd ) { return -1;}
virtual int cc32( int value, unsigned char *cmd ) { return -1;}
virtual int cc33( int value, unsigned char *cmd ) { return -1;}
};

View file

@ -1,5 +1,7 @@
#include "stomp_models.h"
const unsigned char null_stomp_id[] = { 0x00, 0x00 };
const unsigned char overdrive_id[] = { 0x3c, 0x00 };
const unsigned char wah_id[] = { 0x49, 0x00 };
const unsigned char touch_wah_id[] = { 0x4a, 0x00 };

View file

@ -1,6 +1,8 @@
#ifndef STOMP_MODELS_H
#define STOMP_MODELS_H
extern const unsigned char null_stomp_id[];
extern const unsigned char overdrive_id[];
extern const unsigned char wah_id[];
extern const unsigned char touch_wah_id[];