From e9170b38fff83ef12f60c7d878712bdf27380c30 Mon Sep 17 00:00:00 2001 From: hirsch Date: Tue, 19 Jul 2016 21:24:04 -0400 Subject: [PATCH] Complete implementation of v2 features --- mod.h | 46 ++++++++++++++++++++ mustang.cpp | 119 +++++++++++++++++++++++++++++++--------------------- mustang.h | 4 +- stomp.h | 85 +++++++++++++++++++++++++++++++++++++ 4 files changed, 206 insertions(+), 48 deletions(-) diff --git a/mod.h b/mod.h index 601e319..e901fa2 100644 --- a/mod.h +++ b/mod.h @@ -168,6 +168,52 @@ private: virtual int cc43( int value ) { return continuous_control( 0x04, 0x04, 0x01, value );} }; +// Wah + Touch Wah +class ModWahCC : public ModCC { +public: + ModWahCC( Mustang * theAmp ) : ModCC(theAmp) {} +private: + // Mix + virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} + // Freq + virtual int cc40( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );} + // Heel Freq + virtual int cc41( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );} + // Toe Freq + virtual int cc42( int value ) { return continuous_control( 0x03, 0x03, 0x01, value );} + // Hi-Q + virtual int cc43( int value ) { + if ( value > 1 ) return 0; + else return discrete_control( 0x04, 0x04, 0x81, value ); + } +}; + + +class DiatonicShiftCC : public ModCC { +public: + DiatonicShiftCC( Mustang * theAmp ) : ModCC(theAmp) {} +private: + // Mix + virtual int cc39( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} + // Pitch + virtual int cc40( int value ) { + if ( value > 0x15 ) return 0; + else return discrete_control( 0x01, 0x0b, 0x98, value ); + } + // Key + virtual int cc41( int value ) { + if ( value > 0x0b ) return 0; + else return discrete_control( 0x02, 0x02, 0x99, value ); + } + // Scale + virtual int cc42( int value ) { + if ( value > 8 ) return 0; + else return discrete_control( 0x03, 0x03, 0x9a, value ); + } + // Tone + virtual int cc43( int value ) { return continuous_control( 0x04, 0x07, 0x01, value );} +}; + class NullModCC : public ModCC { public: diff --git a/mustang.cpp b/mustang.cpp index e5c4e41..8b6ca3a 100644 --- a/mustang.cpp +++ b/mustang.cpp @@ -293,7 +293,7 @@ void Mustang::updateAmpObj(void) { break; } - if ( (new_amp!=NULL) && (new_amp!=curr_amp) ) { + if ( new_amp!=NULL ) { delete curr_amp; curr_amp = new_amp; } @@ -319,160 +319,185 @@ void Mustang::updateReverbObj(void) { void Mustang::updateDelayObj(void) { int curr = curr_state[DELAY_STATE][MODEL]; + DelayCC * new_delay = NULL; switch (curr) { case 0: break; case MONO_DLY_ID: - delete curr_delay; - curr_delay = new MonoDelayCC(this); + new_delay = new MonoDelayCC(this); break; case MONO_FILTER_ID: case ST_FILTER_ID: - delete curr_delay; - curr_delay = new EchoFilterCC(this); + new_delay = new EchoFilterCC(this); break; case MTAP_DLY_ID: - delete curr_delay; - curr_delay = new MultitapDelayCC(this); + new_delay = new MultitapDelayCC(this); break; case PONG_DLY_ID: - delete curr_delay; - curr_delay = new PingPongDelayCC(this); + new_delay = new PingPongDelayCC(this); break; case DUCK_DLY_ID: - delete curr_delay; - curr_delay = new DuckingDelayCC(this); + new_delay = new DuckingDelayCC(this); break; case REVERSE_DLY_ID: - delete curr_delay; - curr_delay = new ReverseDelayCC(this); + new_delay = new ReverseDelayCC(this); break; case TAPE_DLY_ID: - delete curr_delay; - curr_delay = new TapeDelayCC(this); + new_delay = new TapeDelayCC(this); break; case ST_TAPE_DLY_ID: - delete curr_delay; - curr_delay = new StereoTapeDelayCC(this); + new_delay = new StereoTapeDelayCC(this); break; default: fprintf( stderr, "W - Delay id %x not supported yet\n", curr ); break; } + + if ( new_delay!=NULL ) { + delete curr_delay; + curr_delay = new_delay; + } } void Mustang::updateModObj(void) { int curr = curr_state[MOD_STATE][MODEL]; - + ModCC * new_mod = NULL; + switch (curr) { case 0: break; case SINE_CHORUS_ID: case TRI_CHORUS_ID: - delete curr_mod; - curr_mod = new ChorusCC(this); + new_mod = new ChorusCC(this); break; case SINE_FLANGE_ID: case TRI_FLANGE_ID: - delete curr_mod; - curr_mod = new FlangerCC(this); + new_mod = new FlangerCC(this); break; case VIBRATONE_ID: - delete curr_mod; - curr_mod = new VibratoneCC(this); + new_mod = new VibratoneCC(this); break; case VINT_TREM_ID: case SINE_TREM_ID: - delete curr_mod; - curr_mod = new TremCC(this); + new_mod = new TremCC(this); break; case RING_MOD_ID: - delete curr_mod; - curr_mod = new RingModCC(this); + new_mod = new RingModCC(this); break; case STEP_FILT_ID: - delete curr_mod; - curr_mod = new StepFilterCC(this); + new_mod = new StepFilterCC(this); break; case PHASER_ID: - delete curr_mod; - curr_mod = new PhaserCC(this); + new_mod = new PhaserCC(this); break; case PITCH_SHIFT_ID: - delete curr_mod; - curr_mod = new PitchShifterCC(this); + { + int xtra = curr_state[MOD_STATE][MODELX]; + if ( xtra == 0 ) new_mod = new PitchShifterCC(this); + else if ( xtra == 0x10 ) new_mod = new DiatonicShiftCC(this); + } + break; + + case M_WAH_ID: + case M_TOUCH_WAH_ID: + new_mod = new ModWahCC(this); break; default: fprintf( stderr, "W - Mod id %x not supported yet\n", curr ); break; } + + if ( new_mod!=NULL ) { + delete curr_mod; + curr_mod = new_mod; + } } void Mustang::updateStompObj(void) { int curr = curr_state[STOMP_STATE][MODEL]; - + StompCC * new_stomp = NULL; + switch (curr) { case 0: break; case OVERDRIVE_ID: - delete curr_stomp; - curr_stomp = new OverdriveCC(this); + new_stomp = new OverdriveCC(this); break; case WAH_ID: case TOUCH_WAH_ID: - delete curr_stomp; - curr_stomp = new WahCC(this); + new_stomp = new WahCC(this); break; case FUZZ_ID: - delete curr_stomp; - curr_stomp = new FuzzCC(this); + new_stomp = new FuzzCC(this); break; case FUZZ_TWAH_ID: - delete curr_stomp; - curr_stomp = new FuzzTouchWahCC(this); + new_stomp = new FuzzTouchWahCC(this); break; case SIMPLE_COMP_ID: - delete curr_stomp; - curr_stomp = new SimpleCompCC(this); + new_stomp = new SimpleCompCC(this); break; case COMP_ID: - delete curr_stomp; - curr_stomp = new CompCC(this); + new_stomp = new CompCC(this); + break; + + case RANGE_BOOST_ID: + new_stomp = new RangerCC(this); break; + case GREEN_BOX_ID: + new_stomp = new GreenBoxCC(this); + break; + + case ORANGE_BOX_ID: + new_stomp = new OrangeBoxCC(this); + break; + + case BLACK_BOX_ID: + new_stomp = new BlackBoxCC(this); + break; + + case BIG_FUZZ_ID: + new_stomp = new BigFuzzCC(this); + break; + default: fprintf( stderr, "W - Stomp id %x not supported yet\n", curr ); break; } + + if ( new_stomp!=NULL ) { + delete curr_stomp; + curr_stomp = new_stomp; + } } diff --git a/mustang.h b/mustang.h index 6cfc4a0..b62a365 100644 --- a/mustang.h +++ b/mustang.h @@ -74,6 +74,7 @@ // Offset to current device model for any state structure #define MODEL 16 +#define MODELX 17 // Index into current state structure #define PRESET_NAME 0 @@ -152,12 +153,13 @@ #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 -#define DIA_PSHIFT_ID 0x1f // Stomp model id values #define OVERDRIVE_ID 0x3c diff --git a/stomp.h b/stomp.h index f1f2724..06770da 100644 --- a/stomp.h +++ b/stomp.h @@ -131,6 +131,91 @@ private: }; +class RangerCC : public StompCC { +public: + RangerCC( Mustang * theAmp ) : StompCC(theAmp) {} +private: + // Level + virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} + // Gain + virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );} + // Lo-Cut + virtual int cc31( int value ) { return continuous_control( 0x02, 0x03, 0x01, value );} + // Bright + virtual int cc32( int value ) { return continuous_control( 0x03, 0x02, 0x01, value );} + // n/a + virtual int cc33( int value ) { return 0;} +}; + + +class GreenBoxCC : public StompCC { +public: + GreenBoxCC( Mustang * theAmp ) : StompCC(theAmp) {} +private: + // Level + virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} + // Gain + virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );} + // Tone + virtual int cc31( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );} + // Bright + virtual int cc32( int value ) { return continuous_control( 0x03, 0x03, 0x12, value );} + // n/a + virtual int cc33( int value ) { return 0;} +}; + + +class OrangeBoxCC : public StompCC { +public: + OrangeBoxCC( Mustang * theAmp ) : StompCC(theAmp) {} +private: + // Level + virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} + // Dist + virtual int cc30( int value ) { return continuous_control( 0x01, 0x02, 0x01, value );} + // Tone + virtual int cc31( int value ) { return continuous_control( 0x02, 0x01, 0x01, value );} + // n/a + virtual int cc32( int value ) { return 0;} + // n/a + virtual int cc33( int value ) { return 0;} +}; + + +class BlackBoxCC : public StompCC { +public: + BlackBoxCC( Mustang * theAmp ) : StompCC(theAmp) {} +private: + // Level + virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} + // Dist + virtual int cc30( int value ) { return continuous_control( 0x01, 0x02, 0x01, value );} + // Filter + virtual int cc31( int value ) { return continuous_control( 0x02, 0x01, 0x01, value );} + // n/a + virtual int cc32( int value ) { return 0;} + // n/a + virtual int cc33( int value ) { return 0;} +}; + + +class BigFuzzCC : public StompCC { +public: + BigFuzzCC( Mustang * theAmp ) : StompCC(theAmp) {} +private: + // Level + virtual int cc29( int value ) { return continuous_control( 0x00, 0x00, 0x01, value );} + // Tone + virtual int cc30( int value ) { return continuous_control( 0x01, 0x01, 0x01, value );} + // Sustain + virtual int cc31( int value ) { return continuous_control( 0x02, 0x02, 0x01, value );} + // n/a + virtual int cc32( int value ) { return 0;} + // n/a + virtual int cc33( int value ) { return 0;} +}; + + class NullStompCC : public StompCC { public: NullStompCC( Mustang * theAmp ) : StompCC(theAmp) {}