Start work on multithreaded version

This commit is contained in:
hirsch 2016-07-24 21:45:35 -04:00
parent e9170b38ff
commit 96152fd3ed
25 changed files with 1486 additions and 1977 deletions

View file

@ -7,7 +7,7 @@ DEP = $(subst .cpp,.d,$(SRC))
# The -M* switches automatically generate .d dependency files # The -M* switches automatically generate .d dependency files
CPPFLAGS += -MP -MMD $(INCDIRS) CPPFLAGS += -MP -MMD $(INCDIRS)
LDLIBS = -lrtmidi -lusb-1.0 LDLIBS = -lrtmidi -lusb-1.0 -lpthread
BIN = mustang_midi BIN = mustang_midi

View file

@ -1,6 +1,7 @@
#include "amp.h" #include "amp.h"
#include "mustang.h" #include "mustang.h"
#include "constants.h"
int int
AmpCC::continuous_control( int parm5, int parm6, int parm7, int value ) { AmpCC::continuous_control( int parm5, int parm6, int parm7, int value ) {

31
amp.h
View file

@ -3,6 +3,8 @@
#ifndef _AMPCC_H #ifndef _AMPCC_H
#define _AMPCC_H #define _AMPCC_H
#include <cstring>
class Mustang; class Mustang;
// F57 Deluxe // F57 Deluxe
@ -16,6 +18,8 @@ class AmpCC {
protected: protected:
Mustang * amp; Mustang * amp;
unsigned char model[2];
unsigned char slot;
// Only base class is friend of Mustang, so forward calls from // Only base class is friend of Mustang, so forward calls from
// derived classes through these methods. // derived classes through these methods.
@ -23,9 +27,16 @@ protected:
int discrete_control( int parm5, int parm6, int parm7, int value ); int discrete_control( int parm5, int parm6, int parm7, int value );
public: public:
AmpCC( Mustang * theAmp ) : amp(theAmp) {} AmpCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) :
amp(theAmp),
slot(theSlot)
{
memcpy( this->model, model, 2 );
}
virtual int dispatch( int cc, int value ); int dispatch( int cc, int value );
const unsigned char *getModel( void ) { return model;}
const unsigned char getSlot( void ) { return slot;}
private: private:
// Gain // Gain
@ -75,7 +86,7 @@ private:
// //
class AmpCC1 : public AmpCC { class AmpCC1 : public AmpCC {
public: public:
AmpCC1( Mustang * theAmp ) : AmpCC(theAmp) {} AmpCC1( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private: private:
// Presence // Presence
virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );} virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );}
@ -88,7 +99,7 @@ private:
// //
class AmpCC2 : public AmpCC { class AmpCC2 : public AmpCC {
public: public:
AmpCC2( Mustang * theAmp ) : AmpCC(theAmp) {} AmpCC2( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private: private:
// Gain2 // Gain2
virtual int cc78( int value ) { return continuous_control( 0x02, 0x02, 0x0c, value );} virtual int cc78( int value ) { return continuous_control( 0x02, 0x02, 0x0c, value );}
@ -101,7 +112,7 @@ private:
// //
class AmpCC3 : public AmpCC { class AmpCC3 : public AmpCC {
public: public:
AmpCC3( Mustang * theAmp ) : AmpCC(theAmp) {} AmpCC3( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private: private:
// Cut // Cut
virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );} virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );}
@ -117,7 +128,7 @@ private:
// //
class AmpCC4 : public AmpCC { class AmpCC4 : public AmpCC {
public: public:
AmpCC4( Mustang * theAmp ) : AmpCC(theAmp) {} AmpCC4( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private: private:
// Presence // Presence
virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );} virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );}
@ -130,7 +141,7 @@ private:
// //
class AmpCC5 : public AmpCC { class AmpCC5 : public AmpCC {
public: public:
AmpCC5( Mustang * theAmp ) : AmpCC(theAmp) {} AmpCC5( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private: private:
// No sag / bias // No sag / bias
virtual int cc74( int value ) { return 0;} virtual int cc74( int value ) { return 0;}
@ -145,7 +156,7 @@ private:
// //
class AmpCC6 : public AmpCC { class AmpCC6 : public AmpCC {
public: public:
AmpCC6( Mustang * theAmp ) : AmpCC(theAmp) {} AmpCC6( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private: private:
// Master Volume // Master Volume
virtual int cc79( int value ) { return continuous_control( 0x03, 0x03, 0x0c, value );} virtual int cc79( int value ) { return continuous_control( 0x03, 0x03, 0x0c, value );}
@ -156,7 +167,7 @@ private:
// //
class AmpCC7 : public AmpCC { class AmpCC7 : public AmpCC {
public: public:
AmpCC7( Mustang * theAmp ) : AmpCC(theAmp) {} AmpCC7( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private: private:
// Presence // Presence
virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );} virtual int cc78( int value ) { return continuous_control( 0x07, 0x07, 0x0c, value );}
@ -167,7 +178,7 @@ private:
// //
class NullAmpCC : public AmpCC { class NullAmpCC : public AmpCC {
public: public:
NullAmpCC( Mustang * theAmp ) : AmpCC(theAmp) {} NullAmpCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : AmpCC(theAmp,model,theSlot) {}
private: private:
virtual int cc69( int value ) { return 0;} virtual int cc69( int value ) { return 0;}
virtual int cc70( int value ) { return 0;} virtual int cc70( int value ) { return 0;}

22
amp_models.cpp Normal file
View file

@ -0,0 +1,22 @@
#include "amp_models.h"
const unsigned char f57_deluxe_id[] = { 0x67, 0x00 };
const unsigned char f59_bassman_id[] = { 0x64, 0x00 };
const unsigned char f57_champ_id[] = { 0x7c, 0x00 };
const unsigned char f65_deluxe_id[] = { 0x53, 0x00 };
const unsigned char f65_princeton_id[] = { 0x6a, 0x00 };
const unsigned char f65_twin_id[] = { 0x75, 0x00 };
const unsigned char f_supersonic_id[] = { 0x72, 0x00 };
const unsigned char brit_60s_id[] = { 0x61, 0x00 };
const unsigned char brit_70s_id[] = { 0x79, 0x00 };
const unsigned char brit_80s_id[] = { 0x5e, 0x00 };
const unsigned char us_90s_id[] = { 0x5d, 0x00 };
const unsigned char metal_2k_id[] = { 0x6d, 0x00 };
// v2 only
const unsigned char studio_preamp_id[] = { 0xf1, 0x00 };
const unsigned char f57_twin_id[] = { 0xf6, 0x00 };
const unsigned char s60s_thrift_id[] = { 0xf9, 0x00 };
const unsigned char brit_watt_id[] = { 0xff, 0x00 };
const unsigned char brit_color_id[] = { 0xfc, 0x00 };

24
amp_models.h Normal file
View file

@ -0,0 +1,24 @@
#ifndef AMP_MODELS_H
#define AMP_MODELS_H
extern const unsigned char f57_deluxe_id[];
extern const unsigned char f59_bassman_id[];
extern const unsigned char f57_champ_id[];
extern const unsigned char f65_deluxe_id[];
extern const unsigned char f65_princeton_id[];
extern const unsigned char f65_twin_id[];
extern const unsigned char f_supersonic_id[];
extern const unsigned char brit_60s_id[];
extern const unsigned char brit_70s_id[];
extern const unsigned char brit_80s_id[];
extern const unsigned char us_90s_id[];
extern const unsigned char metal_2k_id[];
// v2 only
extern const unsigned char studio_preamp_id[];
extern const unsigned char f57_twin_id[];
extern const unsigned char s60s_thrift_id[];
extern const unsigned char brit_watt_id[];
extern const unsigned char brit_color_id[];
#endif

62
constants.h Normal file
View file

@ -0,0 +1,62 @@
#ifndef CONSTANTS_H
#define CONSTANTS_H
// USB vendor id
#define FENDER_VID 0x1ed8
// USB product ids
#define MI_II_V1 0x0004
#define MIII_IV_V_V1 0x0005
#define M_BRONCO_40 0x000a
#define M_MINI 0x0010
#define M_FLOOR 0x0012
#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
#define STOMP_STATE 1
#define MOD_STATE 2
#define DELAY_STATE 3
#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
#define SM_ROOM_ID 0x0026
#define LG_ROOM_ID 0x003b
#define SM_PLATE_ID 0x004e
#define LG_PLATE_ID 0x004b
#define AMBIENT_ID 0x004c
#define ARENA_ID 0x004d
#define SPRING_63_ID 0x0021
#define SPRING_65_ID 0x000b
#endif

View file

@ -1,38 +0,0 @@
#ifndef DATA_STRUCTS_H
#define DATA_STRUCTS_H
struct amp_settings
{
unsigned char amp_num;
unsigned char gain;
unsigned char volume;
unsigned char treble;
unsigned char middle;
unsigned char bass;
unsigned char cabinet;
unsigned char noise_gate;
unsigned char master_vol;
unsigned char gain2;
unsigned char presence;
unsigned char threshold;
unsigned char depth;
unsigned char bias;
unsigned char sag;
bool brightness;
unsigned char usb_gain;
};
struct fx_pedal_settings
{
unsigned char fx_slot;
unsigned char effect_num;
unsigned char knob1;
unsigned char knob2;
unsigned char knob3;
unsigned char knob4;
unsigned char knob5;
unsigned char knob6;
bool put_post_amp;
};
#endif // DATA_STRUCTS_H

View file

@ -1,6 +1,7 @@
#include "delay.h" #include "delay.h"
#include "mustang.h" #include "mustang.h"
#include "constants.h"
int int
DelayCC::continuous_control( int parm5, int parm6, int parm7, int value ) { DelayCC::continuous_control( int parm5, int parm6, int parm7, int value ) {

31
delay.h
View file

@ -3,20 +3,31 @@
#ifndef _DELAY_H #ifndef _DELAY_H
#define _DELAY_H #define _DELAY_H
#include <cstring>
class Mustang; class Mustang;
class DelayCC { class DelayCC {
protected: protected:
Mustang * amp; Mustang * amp;
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 );
int discrete_control( int parm5, int parm6, int parm7, int value ); int discrete_control( int parm5, int parm6, int parm7, int value );
public: public:
DelayCC( Mustang * theAmp ) : amp(theAmp) {} DelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) :
amp(theAmp),
slot(theSlot)
{
memcpy( this->model, model, 2 );
}
int dispatch( int cc, int value ); int dispatch( int cc, int value );
const unsigned char *getModel( void ) { return model;}
const unsigned char getSlot( void ) { return slot;}
private: private:
// Level // Level
@ -33,7 +44,7 @@ private:
class MonoDelayCC : public DelayCC { class MonoDelayCC : public DelayCC {
public: public:
MonoDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {} MonoDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private: private:
// Feedback // Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );} virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
@ -48,7 +59,7 @@ private:
class EchoFilterCC : public DelayCC { class EchoFilterCC : public DelayCC {
public: public:
EchoFilterCC( Mustang * theAmp ) : DelayCC(theAmp) {} EchoFilterCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private: private:
// Feedback // Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );} virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
@ -63,7 +74,7 @@ private:
class MultitapDelayCC : public DelayCC { class MultitapDelayCC : public DelayCC {
public: public:
MultitapDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {} MultitapDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private: private:
// Delay Time // Delay Time
virtual int cc50( int value ) { return continuous_control( 0x01, 0x01, 0x08, value );} virtual int cc50( int value ) { return continuous_control( 0x01, 0x01, 0x08, value );}
@ -83,7 +94,7 @@ private:
class PingPongDelayCC : public DelayCC { class PingPongDelayCC : public DelayCC {
public: public:
PingPongDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {} PingPongDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private: private:
// Feedback // Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );} virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
@ -98,7 +109,7 @@ private:
class DuckingDelayCC : public DelayCC { class DuckingDelayCC : public DelayCC {
public: public:
DuckingDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {} DuckingDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private: private:
// Feedback // Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );} virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
@ -113,7 +124,7 @@ private:
class ReverseDelayCC : public DelayCC { class ReverseDelayCC : public DelayCC {
public: public:
ReverseDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {} ReverseDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private: private:
// FFdbk // FFdbk
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );} virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
@ -128,7 +139,7 @@ private:
class TapeDelayCC : public DelayCC { class TapeDelayCC : public DelayCC {
public: public:
TapeDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {} TapeDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private: private:
// Feedback // Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );} virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
@ -143,7 +154,7 @@ private:
class StereoTapeDelayCC : public DelayCC { class StereoTapeDelayCC : public DelayCC {
public: public:
StereoTapeDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {} StereoTapeDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private: private:
// Feedback // Feedback
virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );} virtual int cc51( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );}
@ -158,7 +169,7 @@ private:
class NullDelayCC : public DelayCC { class NullDelayCC : public DelayCC {
public: public:
NullDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {} NullDelayCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : DelayCC(theAmp,model,theSlot) {}
private: private:
virtual int cc49( int value ) { return 0;} virtual int cc49( int value ) { return 0;}
virtual int cc50( int value ) { return 0;} virtual int cc50( int value ) { return 0;}

12
delay_models.cpp Normal file
View file

@ -0,0 +1,12 @@
#include "delay_models.h"
const unsigned char mono_dly_id[] = { 0x16, 0x00 };
const unsigned char mono_filter_id[] = { 0x43, 0x00 };
const unsigned char st_filter_id[] = { 0x48, 0x00 };
const unsigned char mtap_dly_id[] = { 0x44, 0x00 };
const unsigned char pong_dly_id[] = { 0x45, 0x00 };
const unsigned char duck_dly_id[] = { 0x15, 0x00 };
const unsigned char reverse_dly_id[] = { 0x46, 0x00 };
const unsigned char tape_dly_id[] = { 0x2b, 0x00 };
const unsigned char st_tape_dly_id[] = { 0x2a, 0x00 };

14
delay_models.h Normal file
View file

@ -0,0 +1,14 @@
#ifndef DELAY_MODELS_H
#define DELAY_MODELS_H
extern const unsigned char mono_dly_id[];
extern const unsigned char mono_filter_id[];
extern const unsigned char st_filter_id[];
extern const unsigned char mtap_dly_id[];
extern const unsigned char pong_dly_id[];
extern const unsigned char duck_dly_id[];
extern const unsigned char reverse_dly_id[];
extern const unsigned char tape_dly_id[];
extern const unsigned char st_tape_dly_id[];
#endif

View file

@ -1,102 +0,0 @@
#ifndef EFFECTS_ENUM_H
#define EFFECTS_ENUM_H
// enums used for switches (looks nicer
// and is more practical than numbers)
// list of all amplifiers
enum amps
{
STUDIO_PREAMP,
FENDER_57_CHAMP,
FENDER_57_DELUXE,
FENDER_57_TWIN,
FENDER_59_BASSMAN,
FENDER_65_PRINCETON,
FENDER_65_DELUXE_REVERB,
FENDER_65_TWIN_REVERB,
S60S_THRIFT,
BRITISH_WATTS,
BRITISH_60S,
BRITISH_70S,
BRITISH_80S,
BRITISH_COLOUR,
FENDER_SUPER_SONIC,
AMERICAN_90S,
METAL_2000
};
// list of all effects
enum effects
{
EMPTY,
RANGER,
GREENBOX,
OVERDRIVE,
FUZZ,
ORANGEBOX,
BLACKBOX,
BIG_FUZZ,
WAH,
TOUCH_WAH,
FUZZ_TOUCH_WAH,
SIMPLE_COMP,
COMPRESSOR,
SINE_CHORUS,
TRIANGLE_CHORUS,
SINE_FLANGER,
TRIANGLE_FLANGER,
VIBRATONE,
VINTAGE_TREMOLO,
SINE_TREMOLO,
RING_MODULATOR,
STEP_FILTER,
PHASER,
MOD_WAH,
MOD_TOUCH_WAH,
DIATONIC_PITCH_SHIFTER,
PITCH_SHIFTER,
MONO_DELAY,
MONO_ECHO_FILTER,
STEREO_ECHO_FILTER,
MULTITAP_DELAY,
PING_PONG_DELAY,
DUCKING_DELAY,
REVERSE_DELAY,
TAPE_DELAY,
STEREO_TAPE_DELAY,
SMALL_HALL_REVERB,
LARGE_HALL_REVERB,
SMALL_ROOM_REVERB,
LARGE_ROOM_REVERB,
SMALL_PLATE_REVERB,
LARGE_PLATE_REVERB,
AMBIENT_REVERB,
ARENA_REVERB,
FENDER_63_SPRING_REVERB,
FENDER_65_SPRING_REVERB
};
// list of all cabinets
enum cabinets
{
OFF,
cab57DLX,
cabBSSMN,
cab65DLX,
cab65PRN,
cabCHAMP,
cab4x12M,
cab2x12C,
cab4x12G,
cab65TWN,
cab4x12V,
cabSS212,
cabSS112
};
#endif // EFFECTS_ENUM_H

View file

@ -1,6 +1,7 @@
#include "mod.h" #include "mod.h"
#include "mustang.h" #include "mustang.h"
#include "constants.h"
int int
ModCC::continuous_control( int parm5, int parm6, int parm7, int value ) { ModCC::continuous_control( int parm5, int parm6, int parm7, int value ) {

35
mod.h
View file

@ -3,20 +3,31 @@
#ifndef _MOD_H #ifndef _MOD_H
#define _MOD_H #define _MOD_H
#include <cstring>
class Mustang; class Mustang;
class ModCC { class ModCC {
protected: protected:
Mustang * amp; Mustang * amp;
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 );
int discrete_control( int parm5, int parm6, int parm7, int value ); int discrete_control( int parm5, int parm6, int parm7, int value );
public: public:
ModCC( Mustang * theAmp ) : amp(theAmp) {} ModCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) :
amp(theAmp),
slot(theSlot)
{
memcpy( this->model, model, 2 );
}
int dispatch( int cc, int value ); int dispatch( int cc, int value );
const unsigned char *getModel( void ) { return model;}
const unsigned char getSlot( void ) { return slot;}
private: private:
virtual int cc39( int value ) = 0; virtual int cc39( int value ) = 0;
@ -29,7 +40,7 @@ private:
class ChorusCC : public ModCC { class ChorusCC : public ModCC {
public: public:
ChorusCC( Mustang * theAmp ) : ModCC(theAmp) {} ChorusCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -46,7 +57,7 @@ private:
class FlangerCC : public ModCC { class FlangerCC : public ModCC {
public: public:
FlangerCC( Mustang * theAmp ) : ModCC(theAmp) {} FlangerCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -63,7 +74,7 @@ private:
class VibratoneCC : public ModCC { class VibratoneCC : public ModCC {
public: public:
VibratoneCC( Mustang * theAmp ) : ModCC(theAmp) {} VibratoneCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -80,7 +91,7 @@ private:
class TremCC : public ModCC { class TremCC : public ModCC {
public: public:
TremCC( Mustang * theAmp ) : ModCC(theAmp) {} TremCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -97,7 +108,7 @@ private:
class RingModCC : public ModCC { class RingModCC : public ModCC {
public: public:
RingModCC( Mustang * theAmp ) : ModCC(theAmp) {} RingModCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -117,7 +128,7 @@ private:
class StepFilterCC : public ModCC { class StepFilterCC : public ModCC {
public: public:
StepFilterCC( Mustang * theAmp ) : ModCC(theAmp) {} StepFilterCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -134,7 +145,7 @@ private:
class PhaserCC : public ModCC { class PhaserCC : public ModCC {
public: public:
PhaserCC( Mustang * theAmp ) : ModCC(theAmp) {} PhaserCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -154,7 +165,7 @@ private:
class PitchShifterCC : public ModCC { class PitchShifterCC : public ModCC {
public: public:
PitchShifterCC( Mustang * theAmp ) : ModCC(theAmp) {} PitchShifterCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -171,7 +182,7 @@ private:
// Wah + Touch Wah // Wah + Touch Wah
class ModWahCC : public ModCC { class ModWahCC : public ModCC {
public: public:
ModWahCC( Mustang * theAmp ) : ModCC(theAmp) {} ModWahCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
// Mix // Mix
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -191,7 +202,7 @@ private:
class DiatonicShiftCC : public ModCC { class DiatonicShiftCC : public ModCC {
public: public:
DiatonicShiftCC( Mustang * theAmp ) : ModCC(theAmp) {} DiatonicShiftCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
// Mix // Mix
virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -217,7 +228,7 @@ private:
class NullModCC : public ModCC { class NullModCC : public ModCC {
public: public:
NullModCC( Mustang * theAmp ) : ModCC(theAmp) {} NullModCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ModCC(theAmp,model,theSlot) {}
private: private:
virtual int cc39( int value ) { return 0;} virtual int cc39( int value ) { return 0;}
virtual int cc40( int value ) { return 0;} virtual int cc40( int value ) { return 0;}

17
mod_models.cpp Normal file
View file

@ -0,0 +1,17 @@
#include "mod_models.h"
const unsigned char sine_chorus_id[] = { 0x12, 0x00 };
const unsigned char tri_chorus_id[] = { 0x13, 0x00 };
const unsigned char sine_flange_id[] = { 0x18, 0x00 };
const unsigned char tri_flange_id[] = { 0x19, 0x00 };
const unsigned char vibratone_id[] = { 0x2d, 0x00 };
const unsigned char vint_trem_id[] = { 0x40, 0x00 };
const unsigned char sine_trem_id[] = { 0x41, 0x00 };
const unsigned char ring_mod_id[] = { 0x22, 0x00 };
const unsigned char step_filt_id[] = { 0x29, 0x00 };
const unsigned char phaser_id[] = { 0x4f, 0x00 };
const unsigned char pitch_shift_id[] = { 0x1f, 0x00 };
const unsigned char m_wah_id[] = { 0xf4, 0x00 };
const unsigned char m_touch_wah_id[] = { 0xf5, 0x00 };
const unsigned char dia_pitch_id[] = { 0x1f, 0x10 };

22
mod_models.h Normal file
View file

@ -0,0 +1,22 @@
// -*-c++-*-
#ifndef MOD_MODELS_H
#define MOD_MODELS_H
extern const unsigned char sine_chorus_id[];
extern const unsigned char tri_chorus_id[];
extern const unsigned char sine_flange_id[];
extern const unsigned char tri_flange_id[];
extern const unsigned char vibratone_id[];
extern const unsigned char vint_trem_id[];
extern const unsigned char sine_trem_id[];
extern const unsigned char ring_mod_id[];
extern const unsigned char step_filt_id[];
extern const unsigned char phaser_id[];
extern const unsigned char pitch_shift_id[];
// v2 only
extern const unsigned char m_wah_id[];
extern const unsigned char m_touch_wah_id[];
extern const unsigned char dia_pitch_id[];
#endif

File diff suppressed because it is too large Load diff

389
mustang.h
View file

@ -1,185 +1,18 @@
// -*-c++-*- // -*-c++-*-
#ifndef MUSTANG_H #ifndef MUSTANG2_H
#define MUSTANG_H #define MUSTANG2_H
#include <cstdio> #include <stdint.h>
#include <string.h> #include <cstring>
#include <unistd.h>
#include <libusb-1.0/libusb.h> #include <libusb-1.0/libusb.h>
#include "effects_enum.h" #include <pthread.h>
#include "data_structs.h" #include "constants.h"
// amp's VID and PID #define USB_IN 0x81
#define USB_VID 0x1ed8 #define USB_OUT 0x01
#define OLD_USB_PID 0x0004 //Mustang I and II
#define NEW_USB_PID 0x0005 //Mustang III, IV and V
#define V2_USB_PID 0x0014 // Mustang II (and I? !) V2
#define MINI_USB_PID 0x0010 //Mustang Mini
#define FLOOR_USB_PID 0x0012 //Mustang Floor
#define BRONCO40_USB_PID 0x0a //BRONCO 40
#define V2_III_PID 0x16 // Mustang III v2
#define V2_IV_PID 0x17 // Mustang IV v2 (?)
// amp's VID and PID while in update mode
#define USB_UPDATE_VID 0x1ed8
#define OLD_USB_UPDATE_PID 0x0006 //Mustang I and II
#define NEW_USB_UPDATE_PID 0x0007 //Mustang III, IV, V
#define MINI_USB_UPDATE_PID 0x0011 //Mustang Mini
#define FLOOR_USB_UPDATE_PID 0x0013 //Mustang Floor
// #define BRONCO40_USB_PID 0x00a //BRONCO 40
// for USB communication
#define TMOUT 500
#define LENGTH 64
// effect array fields
#define DSP 2
#define EFFECT 16
#define FXSLOT 18
#define KNOB1 32
#define KNOB2 33
#define KNOB3 34
#define KNOB4 35
#define KNOB5 36
#define KNOB6 37
// amp array fields
#define AMPLIFIER 16
#define VOLUME 32
#define GAIN 33
#define TREBLE 36
#define MIDDLE 37
#define BASS 38
#define CABINET 49
#define NOISE_GATE 47
#define THRESHOLD 48
#define MASTER_VOL 35
#define GAIN2 34
#define PRESENCE 39
#define DEPTH 41
#define BIAS 42
#define SAG 51
#define BRIGHTNESS 52
// save fields
#define SAVE_SLOT 4
#define FXKNOB 3
// 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 PRESET_NAME 0
#define AMP_STATE 1
#define STOMP_STATE 2
#define MOD_STATE 3
#define DELAY_STATE 4
#define REVERB_STATE 5
#define EXP_STATE 6
// 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
// Amp model id values
#define F57_DELUXE_ID 0x67
#define F59_BASSMAN_ID 0x64
#define F57_CHAMP_ID 0x7c
#define F65_DELUXE_ID 0x53
#define F65_PRINCETON_ID 0x6a
#define F65_TWIN_ID 0x75
#define F_SUPERSONIC_ID 0x72
#define BRIT_60S_ID 0x61
#define BRIT_70S_ID 0x79
#define BRIT_80S_ID 0x5e
#define US_90S_ID 0x5d
#define METAL_2K_ID 0x6d
// v2 amp only
#define STUDIO_PREAMP_ID 0xf1
#define F57_TWIN_ID 0xf6
#define S60S_THRIFT_ID 0xf9
#define BRIT_WATT_ID 0xff
#define BRIT_COLOR_ID 0xfc
// Reverb model id values
#define SM_HALL_ID 0x24
#define LG_HALL_ID 0x3a
#define SM_ROOM_ID 0x26
#define LG_ROOM_ID 0x3b
#define SM_PLATE_ID 0x4e
#define LG_PLATE_ID 0x4b
#define AMBIENT_ID 0x4c
#define ARENA_ID 0x4d
#define SPRING_63_ID 0x21
#define SPRING_65_ID 0x0b
// Delay model id values
#define MONO_DLY_ID 0x16
#define MONO_FILTER_ID 0x43
#define ST_FILTER_ID 0x48
#define MTAP_DLY_ID 0x44
#define PONG_DLY_ID 0x45
#define DUCK_DLY_ID 0x15
#define REVERSE_DLY_ID 0x46
#define TAPE_DLY_ID 0x2b
#define ST_TAPE_DLY_ID 0x2a
// Mod model id values
#define SINE_CHORUS_ID 0x12
#define TRI_CHORUS_ID 0x13
#define SINE_FLANGE_ID 0x18
#define TRI_FLANGE_ID 0x19
#define VIBRATONE_ID 0x2d
#define VINT_TREM_ID 0x40
#define SINE_TREM_ID 0x41
#define RING_MOD_ID 0x22
#define STEP_FILT_ID 0x29
#define PHASER_ID 0x4f
// Note: Diatonic shifter also uses this as model byte and
// is differentiated by 0x10 in the following 'extra' model byte.
#define PITCH_SHIFT_ID 0x1f
// v2 mod only
#define M_WAH_ID 0xf4
#define M_TOUCH_WAH_ID 0xf5
// Stomp model id values
#define OVERDRIVE_ID 0x3c
#define WAH_ID 0x49
#define TOUCH_WAH_ID 0x4a
#define FUZZ_ID 0x1a
// This is not present in v2:
#define FUZZ_TWAH_ID 0x1c
#define SIMPLE_COMP_ID 0x88
#define COMP_ID 0x07
// v2 stomp only
#define RANGE_BOOST_ID 0x03
#define GREEN_BOX_ID 0xba
#define ORANGE_BOX_ID 0x10
#define BLACK_BOX_ID 0x11
#define BIG_FUZZ_ID 0x0f
#define USB_TIMEOUT_MS 500
class AmpCC; class AmpCC;
class ReverbCC; class ReverbCC;
@ -188,108 +21,134 @@ class ModCC;
class StompCC; class StompCC;
class Mustang { class Mustang {
friend class AmpCC; friend class AmpCC;
friend class ReverbCC; friend class ReverbCC;
friend class DelayCC; friend class DelayCC;
friend class ModCC; friend class ModCC;
friend class StompCC; 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;
template <class T>
class Condition {
public:
pthread_mutex_t lock;
pthread_cond_t cond;
T value;
Condition( void ) {
pthread_mutex_init( &(lock), NULL);
pthread_cond_init( &(cond), NULL);
}
};
// Manage access to each DSP block
Condition<bool> dsp_sync[5];
Condition<bool> preset_names_sync;
// Synchronize init on end of initial parm dump
Condition<bool> parm_read_sync;
struct usb_id {
// product id
int pid;
// magic value for init packet
int init_value;
// v2?
bool isV2;
};
// For device probe
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;
public: public:
Mustang(); struct Cmd {
~Mustang(); int state_index;
int start_amp(void); // initialize communication int parm2;
int stop_amp(void); // terminate communication int parm5;
int set_effect(struct fx_pedal_settings); int parm6;
int parm7;
int setAmp( int ord ); int value;
int setReverb( int ord ); };
int setDelay( int ord );
int setMod( int ord );
int setStomp( int ord );
int tunerMode( int value );
int save_on_amp(char *, int);
int load_memory_bank(int);
int save_effects(int , char *, int , struct fx_pedal_settings *);
int effect_toggle(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;}
struct Cmd {
int state_index;
int parm2;
int parm5;
int parm6;
int parm7;
int value;
};
private: private:
int continuous_control( const Mustang::Cmd & cmd );
int discrete_control( const Mustang::Cmd & cmd );
struct usb_id { void updateAmpObj( const unsigned char *data );
// product id void updateStompObj( const unsigned char *data );
int pid; void updateReverbObj( const unsigned char *data );
// magic value for init packet void updateDelayObj( const unsigned char *data );
int init_value; void updateModObj( const unsigned char *data );
// v2?
bool isV2;
};
// For device probe inline bool is_type(const unsigned char *a, const unsigned char *b) {
static usb_id ids[]; return ( 0==memcmp(a,b,2) );
}
libusb_device_handle *amp_hand; // handle for USB communication public:
unsigned char execute[LENGTH]; // "apply" command sent after each instruction Mustang( void );
bool isV2; int initialize( void );
int deinitialize( void );
// Current state of effects. Read from amp initially and maintained int commStart( void );
// as we change it. Major index is DSP# - 6, where: int commShutdown( void );
//
// 0 : Stomp
// 1 : Modulation
// 2 : Delay
// 3 : Reverb
//
unsigned char prev_array[4][LENGTH]; // array used to clear the effect
int setAmp( int ord );
int setReverb( int ord );
int setDelay( int ord );
int setMod( int ord );
int setStomp( int ord );
// Current state of amp. int tunerMode( int value );
//
// 0 : Preset Name
// 1 : Amp
// 2 : Stomp
// 3 : Mod
// 4 : Delay
// 5 : Reverb
// 6 : Expression Pedal
//
unsigned char curr_state[7][LENGTH];
bool tuner_active; int patchChange( int );
AmpCC * curr_amp; int effectToggle( int cc, int value );
ReverbCC * curr_reverb;
DelayCC * curr_delay;
ModCC * curr_mod;
StompCC * curr_stomp;
int continuous_control( const Mustang::Cmd & cmd ); AmpCC * getAmp( void ) { return curr_amp;}
int discrete_control( const Mustang::Cmd & cmd ); ReverbCC * getReverb( void ) { return curr_reverb;}
DelayCC * getDelay( void ) { return curr_delay;}
void handle_parm_dump(void); ModCC * getMod( void ) { return curr_mod;}
StompCC * getStomp( void ) { return curr_stomp;}
void updateAmpObj(void);
void updateReverbObj(void);
void updateDelayObj(void);
void updateModObj(void);
void updateStompObj(void);
}; };
#endif // MUSTANG_H
#endif

View file

@ -1,20 +1,26 @@
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>
#include <cstdio>
#include <unistd.h>
#include <RtMidi.h> #include <RtMidi.h>
#include <cerrno> #include <cerrno>
#include "mustang.h" #include "mustang.h"
#if 0
#include "amp.h" #include "amp.h"
#include "reverb.h" #include "reverb.h"
#include "delay.h" #include "delay.h"
#include "mod.h" #include "mod.h"
#include "stomp.h" #include "stomp.h"
#endif
static Mustang mustang; static Mustang mustang;
static int channel; static int channel;
#if 0
void message_action( double deltatime, std::vector< unsigned char > *message, void *userData ) { void message_action( double deltatime, std::vector< unsigned char > *message, void *userData ) {
#if 0 #if 0
unsigned int nBytes = message->size(); unsigned int nBytes = message->size();
@ -125,6 +131,8 @@ void message_action( double deltatime, std::vector< unsigned char > *message, vo
} }
#endif
// void errorcallback( RtError::Type type, const std::string & detail, void *userData ) { // void errorcallback( RtError::Type type, const std::string & detail, void *userData ) {
// std::cout << "Error: Code = " << type << ", Msg: " << detail << "\n"; // std::cout << "Error: Code = " << type << ", Msg: " << detail << "\n";
// } // }
@ -149,12 +157,18 @@ int main( int argc, const char **argv ) {
if ( endptr == argv[0] ) usage(); if ( endptr == argv[0] ) usage();
if ( channel < 0 || channel > 15 ) usage(); if ( channel < 0 || channel > 15 ) usage();
int rc = mustang.start_amp(); if ( 0 != mustang.initialize() ) {
if (rc) { fprintf( stderr, "Cannot setup USB communication\n" );
std::cout << "Fender USB initialization failed: " << rc << "\n"; exit( 1 );
return 8; }
if ( 0 != mustang.commStart() ) {
fprintf( stderr, "Thread setup and init failed\n" );
exit( 1 );
} }
fprintf( stderr, "Setup done!\n" );
#if 0
RtMidiIn *input_handler = new RtMidiIn(); RtMidiIn *input_handler = new RtMidiIn();
// See if we have any ports // See if we have any ports
@ -171,9 +185,23 @@ int main( int argc, const char **argv ) {
// Don't want sysex, timing, active sense // Don't want sysex, timing, active sense
input_handler->ignoreTypes( true, true, true ); input_handler->ignoreTypes( true, true, true );
#endif
// Block and wait for signal // Block and wait for signal
pause(); pause();
delete input_handler; if ( 0 != mustang.commShutdown() ) {
fprintf( stderr, "Thread shutdown failed\n" );
exit( 1 );
}
if ( 0 != mustang.deinitialize() ) {
fprintf( stderr, "USB shutdown failed\n" );
exit( 1 );
}
fprintf( stderr, "Shutdown complete!\n" );
// delete input_handler;
return 0; return 0;
} }

View file

@ -1,6 +1,7 @@
#include "reverb.h" #include "reverb.h"
#include "mustang.h" #include "mustang.h"
#include "constants.h"
int int
ReverbCC::continuous_control( int parm5, int parm6, int parm7, int value ) { ReverbCC::continuous_control( int parm5, int parm6, int parm7, int value ) {

View file

@ -3,19 +3,30 @@
#ifndef _REVERB_H #ifndef _REVERB_H
#define _REVERB_H #define _REVERB_H
#include <cstring>
class Mustang; class Mustang;
class ReverbCC { class ReverbCC {
protected: protected:
Mustang * amp; Mustang * amp;
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 );
public: public:
ReverbCC( Mustang * theAmp ) : amp(theAmp) {} ReverbCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) :
amp(theAmp),
slot(theSlot)
{
memcpy( this->model, model, 2 );
}
int dispatch( int cc, int value ); int dispatch( int cc, int value );
const unsigned char *getModel( void ) { return model;}
const unsigned char getSlot( void ) { return slot;}
private: private:
// Level // Level
@ -33,7 +44,7 @@ private:
class NullReverbCC : public ReverbCC { class NullReverbCC : public ReverbCC {
public: public:
NullReverbCC( Mustang * theAmp ) : ReverbCC(theAmp) {} NullReverbCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : ReverbCC(theAmp,model,theSlot) {}
private: private:
int cc59( int value ) { return 0;} int cc59( int value ) { return 0;}
int cc60( int value ) { return 0;} int cc60( int value ) { return 0;}

View file

@ -1,6 +1,7 @@
#include "stomp.h" #include "stomp.h"
#include "mustang.h" #include "mustang.h"
#include "constants.h"
int int
StompCC::continuous_control( int parm5, int parm6, int parm7, int value ) { StompCC::continuous_control( int parm5, int parm6, int parm7, int value ) {

37
stomp.h
View file

@ -3,20 +3,31 @@
#ifndef _STOMP_H #ifndef _STOMP_H
#define _STOMP_H #define _STOMP_H
#include <cstring>
class Mustang; class Mustang;
class StompCC { class StompCC {
protected: protected:
Mustang * amp; Mustang * amp;
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 );
int discrete_control( int parm5, int parm6, int parm7, int value ); int discrete_control( int parm5, int parm6, int parm7, int value );
public: public:
StompCC( Mustang * theAmp ) : amp(theAmp) {} StompCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) :
amp(theAmp),
slot(theSlot)
{
memcpy( this->model, model, 2 );
}
int dispatch( int cc, int value ); int dispatch( int cc, int value );
const unsigned char *getModel( void ) { return model;}
const unsigned char getSlot( void ) { return slot;}
private: private:
virtual int cc29( int value ) = 0; virtual int cc29( int value ) = 0;
@ -29,7 +40,7 @@ private:
class OverdriveCC : public StompCC { class OverdriveCC : public StompCC {
public: public:
OverdriveCC( Mustang * theAmp ) : StompCC(theAmp) {} OverdriveCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -46,7 +57,7 @@ private:
class WahCC : public StompCC { class WahCC : public StompCC {
public: public:
WahCC( Mustang * theAmp ) : StompCC(theAmp) {} WahCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
// Mix // Mix
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -66,7 +77,7 @@ private:
class FuzzCC : public StompCC { class FuzzCC : public StompCC {
public: public:
FuzzCC( Mustang * theAmp ) : StompCC(theAmp) {} FuzzCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -83,7 +94,7 @@ private:
class FuzzTouchWahCC : public StompCC { class FuzzTouchWahCC : public StompCC {
public: public:
FuzzTouchWahCC( Mustang * theAmp ) : StompCC(theAmp) {} FuzzTouchWahCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -100,7 +111,7 @@ private:
class SimpleCompCC : public StompCC { class SimpleCompCC : public StompCC {
public: public:
SimpleCompCC( Mustang * theAmp ) : StompCC(theAmp) {} SimpleCompCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
// Type // Type
virtual int cc29( int value ) { virtual int cc29( int value ) {
@ -116,7 +127,7 @@ private:
class CompCC : public StompCC { class CompCC : public StompCC {
public: public:
CompCC( Mustang * theAmp ) : StompCC(theAmp) {} CompCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -133,7 +144,7 @@ private:
class RangerCC : public StompCC { class RangerCC : public StompCC {
public: public:
RangerCC( Mustang * theAmp ) : StompCC(theAmp) {} RangerCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot) : StompCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -150,7 +161,7 @@ private:
class GreenBoxCC : public StompCC { class GreenBoxCC : public StompCC {
public: public:
GreenBoxCC( Mustang * theAmp ) : StompCC(theAmp) {} GreenBoxCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -167,7 +178,7 @@ private:
class OrangeBoxCC : public StompCC { class OrangeBoxCC : public StompCC {
public: public:
OrangeBoxCC( Mustang * theAmp ) : StompCC(theAmp) {} OrangeBoxCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -184,7 +195,7 @@ private:
class BlackBoxCC : public StompCC { class BlackBoxCC : public StompCC {
public: public:
BlackBoxCC( Mustang * theAmp ) : StompCC(theAmp) {} BlackBoxCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -201,7 +212,7 @@ private:
class BigFuzzCC : public StompCC { class BigFuzzCC : public StompCC {
public: public:
BigFuzzCC( Mustang * theAmp ) : StompCC(theAmp) {} BigFuzzCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
// Level // Level
virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );}
@ -218,7 +229,7 @@ private:
class NullStompCC : public StompCC { class NullStompCC : public StompCC {
public: public:
NullStompCC( Mustang * theAmp ) : StompCC(theAmp) {} NullStompCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
private: private:
virtual int cc29( int value ) { return 0;} virtual int cc29( int value ) { return 0;}
virtual int cc30( int value ) { return 0;} virtual int cc30( int value ) { return 0;}

16
stomp_models.cpp Normal file
View file

@ -0,0 +1,16 @@
#include "stomp_models.h"
const unsigned char overdrive_id[] = { 0x3c, 0x00 };
const unsigned char wah_id[] = { 0x49, 0x00 };
const unsigned char touch_wah_id[] = { 0x4a, 0x00 };
const unsigned char fuzz_id[] = { 0x1a, 0x00 };
const unsigned char fuzz_twah_id[] = { 0x1c, 0x00 };
const unsigned char simple_comp_id[] = { 0x88, 0x00 };
const unsigned char comp_id[] = { 0x07, 0x00 };
const unsigned char range_boost_id[] = { 0x03, 0x00 };
const unsigned char green_box_id[] = { 0xba, 0x00 };
const unsigned char orange_box_id[] = { 0x10, 0x00 };
const unsigned char black_box_id[] = { 0x11, 0x00 };
const unsigned char big_fuzz_id[] = { 0x0f, 0x00 };

19
stomp_models.h Normal file
View file

@ -0,0 +1,19 @@
#ifndef STOMP_MODELS_H
#define STOMP_MODELS_H
extern const unsigned char overdrive_id[];
extern const unsigned char wah_id[];
extern const unsigned char touch_wah_id[];
extern const unsigned char fuzz_id[];
extern const unsigned char fuzz_twah_id[];
extern const unsigned char simple_comp_id[];
extern const unsigned char comp_id[];
// v2 only
extern const unsigned char range_boost_id[];
extern const unsigned char green_box_id[];
extern const unsigned char orange_box_id[];
extern const unsigned char black_box_id[];
extern const unsigned char big_fuzz_id[];
#endif