Start work on multithreaded version
This commit is contained in:
parent
e9170b38ff
commit
96152fd3ed
25 changed files with 1486 additions and 1977 deletions
2
Makefile
2
Makefile
|
|
@ -7,7 +7,7 @@ DEP = $(subst .cpp,.d,$(SRC))
|
|||
# The -M* switches automatically generate .d dependency files
|
||||
CPPFLAGS += -MP -MMD $(INCDIRS)
|
||||
|
||||
LDLIBS = -lrtmidi -lusb-1.0
|
||||
LDLIBS = -lrtmidi -lusb-1.0 -lpthread
|
||||
|
||||
BIN = mustang_midi
|
||||
|
||||
|
|
|
|||
1
amp.cpp
1
amp.cpp
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "amp.h"
|
||||
#include "mustang.h"
|
||||
#include "constants.h"
|
||||
|
||||
int
|
||||
AmpCC::continuous_control( int parm5, int parm6, int parm7, int value ) {
|
||||
|
|
|
|||
31
amp.h
31
amp.h
|
|
@ -3,6 +3,8 @@
|
|||
#ifndef _AMPCC_H
|
||||
#define _AMPCC_H
|
||||
|
||||
#include <cstring>
|
||||
|
||||
class Mustang;
|
||||
|
||||
// F57 Deluxe
|
||||
|
|
@ -16,6 +18,8 @@ class AmpCC {
|
|||
|
||||
protected:
|
||||
Mustang * amp;
|
||||
unsigned char model[2];
|
||||
unsigned char slot;
|
||||
|
||||
// Only base class is friend of Mustang, so forward calls from
|
||||
// derived classes through these methods.
|
||||
|
|
@ -23,9 +27,16 @@ protected:
|
|||
int discrete_control( int parm5, int parm6, int parm7, int value );
|
||||
|
||||
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:
|
||||
// Gain
|
||||
|
|
@ -75,7 +86,7 @@ private:
|
|||
//
|
||||
class AmpCC1 : public AmpCC {
|
||||
public:
|
||||
AmpCC1( Mustang * theAmp ) : AmpCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -88,7 +99,7 @@ private:
|
|||
//
|
||||
class AmpCC2 : public AmpCC {
|
||||
public:
|
||||
AmpCC2( Mustang * theAmp ) : AmpCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -101,7 +112,7 @@ private:
|
|||
//
|
||||
class AmpCC3 : public AmpCC {
|
||||
public:
|
||||
AmpCC3( Mustang * theAmp ) : AmpCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -117,7 +128,7 @@ private:
|
|||
//
|
||||
class AmpCC4 : public AmpCC {
|
||||
public:
|
||||
AmpCC4( Mustang * theAmp ) : AmpCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -130,7 +141,7 @@ private:
|
|||
//
|
||||
class AmpCC5 : public AmpCC {
|
||||
public:
|
||||
AmpCC5( Mustang * theAmp ) : AmpCC(theAmp) {}
|
||||
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;}
|
||||
|
|
@ -145,7 +156,7 @@ private:
|
|||
//
|
||||
class AmpCC6 : public AmpCC {
|
||||
public:
|
||||
AmpCC6( Mustang * theAmp ) : AmpCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -156,7 +167,7 @@ private:
|
|||
//
|
||||
class AmpCC7 : public AmpCC {
|
||||
public:
|
||||
AmpCC7( Mustang * theAmp ) : AmpCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -167,7 +178,7 @@ private:
|
|||
//
|
||||
class NullAmpCC : public AmpCC {
|
||||
public:
|
||||
NullAmpCC( Mustang * theAmp ) : AmpCC(theAmp) {}
|
||||
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;}
|
||||
|
|
|
|||
22
amp_models.cpp
Normal file
22
amp_models.cpp
Normal 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
24
amp_models.h
Normal 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
62
constants.h
Normal 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
|
||||
|
|
@ -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
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "delay.h"
|
||||
#include "mustang.h"
|
||||
#include "constants.h"
|
||||
|
||||
int
|
||||
DelayCC::continuous_control( int parm5, int parm6, int parm7, int value ) {
|
||||
|
|
|
|||
31
delay.h
31
delay.h
|
|
@ -3,20 +3,31 @@
|
|||
#ifndef _DELAY_H
|
||||
#define _DELAY_H
|
||||
|
||||
#include <cstring>
|
||||
|
||||
class Mustang;
|
||||
|
||||
class DelayCC {
|
||||
|
||||
protected:
|
||||
Mustang * amp;
|
||||
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 );
|
||||
|
||||
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 );
|
||||
const unsigned char *getModel( void ) { return model;}
|
||||
const unsigned char getSlot( void ) { return slot;}
|
||||
|
||||
private:
|
||||
// Level
|
||||
|
|
@ -33,7 +44,7 @@ private:
|
|||
|
||||
class MonoDelayCC : public DelayCC {
|
||||
public:
|
||||
MonoDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -48,7 +59,7 @@ private:
|
|||
|
||||
class EchoFilterCC : public DelayCC {
|
||||
public:
|
||||
EchoFilterCC( Mustang * theAmp ) : DelayCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -63,7 +74,7 @@ private:
|
|||
|
||||
class MultitapDelayCC : public DelayCC {
|
||||
public:
|
||||
MultitapDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -83,7 +94,7 @@ private:
|
|||
|
||||
class PingPongDelayCC : public DelayCC {
|
||||
public:
|
||||
PingPongDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -98,7 +109,7 @@ private:
|
|||
|
||||
class DuckingDelayCC : public DelayCC {
|
||||
public:
|
||||
DuckingDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -113,7 +124,7 @@ private:
|
|||
|
||||
class ReverseDelayCC : public DelayCC {
|
||||
public:
|
||||
ReverseDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -128,7 +139,7 @@ private:
|
|||
|
||||
class TapeDelayCC : public DelayCC {
|
||||
public:
|
||||
TapeDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -143,7 +154,7 @@ private:
|
|||
|
||||
class StereoTapeDelayCC : public DelayCC {
|
||||
public:
|
||||
StereoTapeDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -158,7 +169,7 @@ private:
|
|||
|
||||
class NullDelayCC : public DelayCC {
|
||||
public:
|
||||
NullDelayCC( Mustang * theAmp ) : DelayCC(theAmp) {}
|
||||
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;}
|
||||
|
|
|
|||
12
delay_models.cpp
Normal file
12
delay_models.cpp
Normal 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
14
delay_models.h
Normal 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
|
||||
102
effects_enum.h
102
effects_enum.h
|
|
@ -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
|
||||
1
mod.cpp
1
mod.cpp
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "mod.h"
|
||||
#include "mustang.h"
|
||||
#include "constants.h"
|
||||
|
||||
int
|
||||
ModCC::continuous_control( int parm5, int parm6, int parm7, int value ) {
|
||||
|
|
|
|||
35
mod.h
35
mod.h
|
|
@ -3,20 +3,31 @@
|
|||
#ifndef _MOD_H
|
||||
#define _MOD_H
|
||||
|
||||
#include <cstring>
|
||||
|
||||
class Mustang;
|
||||
|
||||
class ModCC {
|
||||
|
||||
protected:
|
||||
Mustang * amp;
|
||||
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 );
|
||||
|
||||
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 );
|
||||
const unsigned char *getModel( void ) { return model;}
|
||||
const unsigned char getSlot( void ) { return slot;}
|
||||
|
||||
private:
|
||||
virtual int cc39( int value ) = 0;
|
||||
|
|
@ -29,7 +40,7 @@ private:
|
|||
|
||||
class ChorusCC : public ModCC {
|
||||
public:
|
||||
ChorusCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -46,7 +57,7 @@ private:
|
|||
|
||||
class FlangerCC : public ModCC {
|
||||
public:
|
||||
FlangerCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -63,7 +74,7 @@ private:
|
|||
|
||||
class VibratoneCC : public ModCC {
|
||||
public:
|
||||
VibratoneCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -80,7 +91,7 @@ private:
|
|||
|
||||
class TremCC : public ModCC {
|
||||
public:
|
||||
TremCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -97,7 +108,7 @@ private:
|
|||
|
||||
class RingModCC : public ModCC {
|
||||
public:
|
||||
RingModCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -117,7 +128,7 @@ private:
|
|||
|
||||
class StepFilterCC : public ModCC {
|
||||
public:
|
||||
StepFilterCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -134,7 +145,7 @@ private:
|
|||
|
||||
class PhaserCC : public ModCC {
|
||||
public:
|
||||
PhaserCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -154,7 +165,7 @@ private:
|
|||
|
||||
class PitchShifterCC : public ModCC {
|
||||
public:
|
||||
PitchShifterCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -171,7 +182,7 @@ private:
|
|||
// Wah + Touch Wah
|
||||
class ModWahCC : public ModCC {
|
||||
public:
|
||||
ModWahCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -191,7 +202,7 @@ private:
|
|||
|
||||
class DiatonicShiftCC : public ModCC {
|
||||
public:
|
||||
DiatonicShiftCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -217,7 +228,7 @@ private:
|
|||
|
||||
class NullModCC : public ModCC {
|
||||
public:
|
||||
NullModCC( Mustang * theAmp ) : ModCC(theAmp) {}
|
||||
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;}
|
||||
|
|
|
|||
17
mod_models.cpp
Normal file
17
mod_models.cpp
Normal 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
22
mod_models.h
Normal 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
|
||||
2534
mustang.cpp
2534
mustang.cpp
File diff suppressed because it is too large
Load diff
385
mustang.h
385
mustang.h
|
|
@ -1,185 +1,18 @@
|
|||
// -*-c++-*-
|
||||
|
||||
#ifndef MUSTANG_H
|
||||
#define MUSTANG_H
|
||||
#ifndef MUSTANG2_H
|
||||
#define MUSTANG2_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <cstring>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
#include "effects_enum.h"
|
||||
#include "data_structs.h"
|
||||
#include <pthread.h>
|
||||
#include "constants.h"
|
||||
|
||||
// amp's VID and PID
|
||||
#define USB_VID 0x1ed8
|
||||
#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_IN 0x81
|
||||
#define USB_OUT 0x01
|
||||
|
||||
#define USB_TIMEOUT_MS 500
|
||||
|
||||
class AmpCC;
|
||||
class ReverbCC;
|
||||
|
|
@ -188,108 +21,134 @@ class ModCC;
|
|||
class StompCC;
|
||||
|
||||
class Mustang {
|
||||
friend class AmpCC;
|
||||
friend class ReverbCC;
|
||||
friend class DelayCC;
|
||||
friend class ModCC;
|
||||
friend class StompCC;
|
||||
friend class AmpCC;
|
||||
friend class ReverbCC;
|
||||
friend class DelayCC;
|
||||
friend class ModCC;
|
||||
friend class StompCC;
|
||||
|
||||
public:
|
||||
Mustang();
|
||||
~Mustang();
|
||||
int start_amp(void); // initialize communication
|
||||
int stop_amp(void); // terminate communication
|
||||
int set_effect(struct fx_pedal_settings);
|
||||
char preset_names[100][33];
|
||||
unsigned curr_preset_idx;
|
||||
|
||||
unsigned char dsp_parms[6][64];
|
||||
|
||||
int setAmp( int ord );
|
||||
int setReverb( int ord );
|
||||
int setDelay( int ord );
|
||||
int setMod( int ord );
|
||||
int setStomp( int ord );
|
||||
unsigned char curr_model[5][2];
|
||||
|
||||
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 *);
|
||||
unsigned char execute[64];
|
||||
|
||||
int effect_toggle(int cc, int value);
|
||||
static const unsigned char state_prefix[];
|
||||
static const unsigned char parms_done[];
|
||||
|
||||
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;}
|
||||
static const unsigned char tuner_ack[];
|
||||
static const unsigned char tuner_prefix[];
|
||||
|
||||
struct Cmd {
|
||||
int state_index;
|
||||
int parm2;
|
||||
int parm5;
|
||||
int parm6;
|
||||
int parm7;
|
||||
int value;
|
||||
};
|
||||
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:
|
||||
struct Cmd {
|
||||
int state_index;
|
||||
int parm2;
|
||||
int parm5;
|
||||
int parm6;
|
||||
int parm7;
|
||||
int value;
|
||||
};
|
||||
|
||||
private:
|
||||
int continuous_control( const Mustang::Cmd & cmd );
|
||||
int discrete_control( const Mustang::Cmd & cmd );
|
||||
|
||||
void updateAmpObj( const unsigned char *data );
|
||||
void updateStompObj( const unsigned char *data );
|
||||
void updateReverbObj( const unsigned char *data );
|
||||
void updateDelayObj( const unsigned char *data );
|
||||
void updateModObj( const unsigned char *data );
|
||||
|
||||
struct usb_id {
|
||||
// product id
|
||||
int pid;
|
||||
// magic value for init packet
|
||||
int init_value;
|
||||
// v2?
|
||||
bool isV2;
|
||||
};
|
||||
inline bool is_type(const unsigned char *a, const unsigned char *b) {
|
||||
return ( 0==memcmp(a,b,2) );
|
||||
}
|
||||
|
||||
// For device probe
|
||||
static usb_id ids[];
|
||||
public:
|
||||
Mustang( void );
|
||||
|
||||
libusb_device_handle *amp_hand; // handle for USB communication
|
||||
unsigned char execute[LENGTH]; // "apply" command sent after each instruction
|
||||
int initialize( void );
|
||||
int deinitialize( void );
|
||||
|
||||
int commStart( void );
|
||||
int commShutdown( void );
|
||||
|
||||
bool isV2;
|
||||
|
||||
// Current state of effects. Read from amp initially and maintained
|
||||
// as we change it. Major index is DSP# - 6, where:
|
||||
//
|
||||
// 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 );
|
||||
|
||||
int tunerMode( int value );
|
||||
|
||||
// Current state of amp.
|
||||
//
|
||||
// 0 : Preset Name
|
||||
// 1 : Amp
|
||||
// 2 : Stomp
|
||||
// 3 : Mod
|
||||
// 4 : Delay
|
||||
// 5 : Reverb
|
||||
// 6 : Expression Pedal
|
||||
//
|
||||
unsigned char curr_state[7][LENGTH];
|
||||
int patchChange( int );
|
||||
|
||||
bool tuner_active;
|
||||
int effectToggle( int cc, int value );
|
||||
|
||||
AmpCC * curr_amp;
|
||||
ReverbCC * curr_reverb;
|
||||
DelayCC * curr_delay;
|
||||
ModCC * curr_mod;
|
||||
StompCC * curr_stomp;
|
||||
|
||||
int continuous_control( const Mustang::Cmd & cmd );
|
||||
int discrete_control( const Mustang::Cmd & cmd );
|
||||
|
||||
void handle_parm_dump(void);
|
||||
|
||||
void updateAmpObj(void);
|
||||
void updateReverbObj(void);
|
||||
void updateDelayObj(void);
|
||||
void updateModObj(void);
|
||||
void updateStompObj(void);
|
||||
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;}
|
||||
};
|
||||
|
||||
#endif // MUSTANG_H
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,20 +1,26 @@
|
|||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <unistd.h>
|
||||
#include <RtMidi.h>
|
||||
#include <cerrno>
|
||||
|
||||
#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();
|
||||
|
|
@ -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 ) {
|
||||
// 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 ( channel < 0 || channel > 15 ) usage();
|
||||
|
||||
int rc = mustang.start_amp();
|
||||
if (rc) {
|
||||
std::cout << "Fender USB initialization failed: " << rc << "\n";
|
||||
return 8;
|
||||
if ( 0 != mustang.initialize() ) {
|
||||
fprintf( stderr, "Cannot setup USB communication\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
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();
|
||||
|
||||
// See if we have any ports
|
||||
|
|
@ -171,9 +185,23 @@ 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();
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "reverb.h"
|
||||
#include "mustang.h"
|
||||
#include "constants.h"
|
||||
|
||||
int
|
||||
ReverbCC::continuous_control( int parm5, int parm6, int parm7, int value ) {
|
||||
|
|
|
|||
15
reverb.h
15
reverb.h
|
|
@ -3,19 +3,30 @@
|
|||
#ifndef _REVERB_H
|
||||
#define _REVERB_H
|
||||
|
||||
#include <cstring>
|
||||
|
||||
class Mustang;
|
||||
|
||||
class ReverbCC {
|
||||
|
||||
protected:
|
||||
Mustang * amp;
|
||||
unsigned char model[2];
|
||||
unsigned char slot;
|
||||
|
||||
int continuous_control( int parm5, int parm6, int parm7, int value );
|
||||
|
||||
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 );
|
||||
const unsigned char *getModel( void ) { return model;}
|
||||
const unsigned char getSlot( void ) { return slot;}
|
||||
|
||||
private:
|
||||
// Level
|
||||
|
|
@ -33,7 +44,7 @@ private:
|
|||
|
||||
class NullReverbCC : public ReverbCC {
|
||||
public:
|
||||
NullReverbCC( Mustang * theAmp ) : ReverbCC(theAmp) {}
|
||||
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;}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "stomp.h"
|
||||
#include "mustang.h"
|
||||
#include "constants.h"
|
||||
|
||||
int
|
||||
StompCC::continuous_control( int parm5, int parm6, int parm7, int value ) {
|
||||
|
|
|
|||
39
stomp.h
39
stomp.h
|
|
@ -3,20 +3,31 @@
|
|||
#ifndef _STOMP_H
|
||||
#define _STOMP_H
|
||||
|
||||
#include <cstring>
|
||||
|
||||
class Mustang;
|
||||
|
||||
class StompCC {
|
||||
|
||||
protected:
|
||||
Mustang * amp;
|
||||
|
||||
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 );
|
||||
|
||||
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 );
|
||||
const unsigned char *getModel( void ) { return model;}
|
||||
const unsigned char getSlot( void ) { return slot;}
|
||||
|
||||
private:
|
||||
virtual int cc29( int value ) = 0;
|
||||
|
|
@ -29,7 +40,7 @@ private:
|
|||
|
||||
class OverdriveCC : public StompCC {
|
||||
public:
|
||||
OverdriveCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -46,7 +57,7 @@ private:
|
|||
|
||||
class WahCC : public StompCC {
|
||||
public:
|
||||
WahCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -66,7 +77,7 @@ private:
|
|||
|
||||
class FuzzCC : public StompCC {
|
||||
public:
|
||||
FuzzCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -83,7 +94,7 @@ private:
|
|||
|
||||
class FuzzTouchWahCC : public StompCC {
|
||||
public:
|
||||
FuzzTouchWahCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -100,7 +111,7 @@ private:
|
|||
|
||||
class SimpleCompCC : public StompCC {
|
||||
public:
|
||||
SimpleCompCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
SimpleCompCC( Mustang * theAmp, const unsigned char *model, const unsigned char theSlot ) : StompCC(theAmp,model,theSlot) {}
|
||||
private:
|
||||
// Type
|
||||
virtual int cc29( int value ) {
|
||||
|
|
@ -116,7 +127,7 @@ private:
|
|||
|
||||
class CompCC : public StompCC {
|
||||
public:
|
||||
CompCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -133,7 +144,7 @@ private:
|
|||
|
||||
class RangerCC : public StompCC {
|
||||
public:
|
||||
RangerCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -150,7 +161,7 @@ private:
|
|||
|
||||
class GreenBoxCC : public StompCC {
|
||||
public:
|
||||
GreenBoxCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -167,7 +178,7 @@ private:
|
|||
|
||||
class OrangeBoxCC : public StompCC {
|
||||
public:
|
||||
OrangeBoxCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -184,7 +195,7 @@ private:
|
|||
|
||||
class BlackBoxCC : public StompCC {
|
||||
public:
|
||||
BlackBoxCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -201,7 +212,7 @@ private:
|
|||
|
||||
class BigFuzzCC : public StompCC {
|
||||
public:
|
||||
BigFuzzCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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 );}
|
||||
|
|
@ -218,7 +229,7 @@ private:
|
|||
|
||||
class NullStompCC : public StompCC {
|
||||
public:
|
||||
NullStompCC( Mustang * theAmp ) : StompCC(theAmp) {}
|
||||
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;}
|
||||
|
|
|
|||
16
stomp_models.cpp
Normal file
16
stomp_models.cpp
Normal 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
19
stomp_models.h
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue