Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion include/com/IdLookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}


constexpr effects lookupEffectById(std::uint8_t id)
constexpr effects lookupEffectById(std::uint16_t id)

Check warning

Code scanning / CodeQL

Poorly documented large function Warning

Poorly documented function: fewer than 2% comments for a function of 101 lines.
{
switch (id)
{
Expand Down Expand Up @@ -152,6 +152,23 @@
return effects::FENDER_63_SPRING_REVERB;
case 0x0b:
return effects::FENDER_65_SPRING_REVERB;
/* Mustang I V2 */
case 0x103:
return effects::RANGER_BOOST;
case 0xba:
return effects::GREENBOX;
case 0x110:
return effects::ORANGEBOX;
case 0x111:
return effects::BLACKBOX;
case 0x10f:
return effects::BIG_FUZZ;
case 0xf4:
return effects::WAH_MOD;
case 0xf5:
return effects::TOUCH_WAH_MOD;
case 0x101f:
return effects::DIATONIC_PITCH_SHIFTER;
default:
throw std::invalid_argument{"Invalid effect id: " + std::to_string(id)};
}
Expand Down
4 changes: 2 additions & 2 deletions include/com/Packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ namespace plug::com
void setSlot(std::uint8_t slot);
std::uint8_t getSlot() const;

void setModel(std::uint8_t model);
std::uint8_t getModel() const;
void setModel(std::uint16_t model);
std::uint16_t getModel() const;

void setUnknown(std::uint8_t value0, std::uint8_t value1, std::uint8_t value2);
};
Expand Down
35 changes: 33 additions & 2 deletions include/effects_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,22 @@ namespace plug
enum class effects
{
EMPTY,
/* Gain/Stomp Box */
OVERDRIVE,
WAH,
TOUCH_WAH,
FUZZ,
FUZZ_TOUCH_WAH,
SIMPLE_COMP,
COMPRESSOR,

/* Mustang I V2 Effect */
RANGER_BOOST,
GREENBOX,
ORANGEBOX,
BLACKBOX,
BIG_FUZZ,

/* Modulation */
SINE_CHORUS,
TRIANGLE_CHORUS,
SINE_FLANGER,
Expand All @@ -88,7 +96,12 @@ namespace plug
STEP_FILTER,
PHASER,
PITCH_SHIFTER,
/* Mustang I V2 Modulation */
WAH_MOD,
TOUCH_WAH_MOD,
DIATONIC_PITCH_SHIFTER,

/* Delay */
MONO_DELAY,
MONO_ECHO_FILTER,
STEREO_ECHO_FILTER,
Expand All @@ -99,6 +112,7 @@ namespace plug
TAPE_DELAY,
STEREO_TAPE_DELAY,

/* Reverb */
SMALL_HALL_REVERB,
LARGE_HALL_REVERB,
SMALL_ROOM_REVERB,
Expand All @@ -108,7 +122,7 @@ namespace plug
AMBIENT_REVERB,
ARENA_REVERB,
FENDER_63_SPRING_REVERB,
FENDER_65_SPRING_REVERB
FENDER_65_SPRING_REVERB,
};

// list of all cabinets
Expand All @@ -129,6 +143,23 @@ namespace plug
cabSS112
};

constexpr bool isV2Effect(effects effect)
{
switch (effect)
{
case effects::RANGER_BOOST:
case effects::GREENBOX:
case effects::ORANGEBOX:
case effects::BLACKBOX:
case effects::BIG_FUZZ:
case effects::WAH_MOD:
case effects::TOUCH_WAH_MOD:
case effects::DIATONIC_PITCH_SHIFTER:
return true;
default:
return false;
}
}

// Helper functions - for compatibility only.
constexpr auto value(amps a)
Expand Down
5 changes: 5 additions & 0 deletions include/ui/effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
#include "data_structs.h"
#include "effects_enum.h"
#include "FxSlot.h"
#include <DeviceModel.h>
#include <QMainWindow>
#include <memory>
#include <vector>

namespace Ui
{
Expand All @@ -48,6 +50,7 @@ namespace plug
bool get_changed() const;

fx_pedal_settings getSettings() const;
void setDeviceModel(DeviceModel model);

Effect& operator=(const Effect&) = delete;

Expand All @@ -69,6 +72,8 @@ namespace plug
QString temp1;
QString temp2;

std::vector<QString> vEffectLabels;

public slots:
// functions to set variables
void set_knob1(int);
Expand Down
9 changes: 5 additions & 4 deletions src/com/Packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,15 @@ namespace plug::com
return bytes[2];
}

void EffectPayload::setModel(std::uint8_t model)
void EffectPayload::setModel(std::uint16_t model)
{
bytes[0] = model;
bytes[0] = model & 0xFF;
bytes[1] = (model >> 8) & 0xFF;
}

std::uint8_t EffectPayload::getModel() const
std::uint16_t EffectPayload::getModel() const
{
return bytes[0];
return (bytes[1] << 8 | bytes[0]);
}

void EffectPayload::setUnknown(std::uint8_t value0, std::uint8_t value1, std::uint8_t value2)
Expand Down
45 changes: 45 additions & 0 deletions src/com/PacketSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ namespace plug::com
case effects::FUZZ_TOUCH_WAH:
case effects::SIMPLE_COMP:
case effects::COMPRESSOR:
case effects::RANGER_BOOST:
case effects::GREENBOX:
case effects::ORANGEBOX:
case effects::BLACKBOX:
case effects::BIG_FUZZ:
return DSP::effect0;

case effects::SINE_CHORUS:
Expand All @@ -101,6 +106,9 @@ namespace plug::com
case effects::STEP_FILTER:
case effects::PHASER:
case effects::PITCH_SHIFTER:
case effects::WAH_MOD:
case effects::TOUCH_WAH_MOD:
case effects::DIATONIC_PITCH_SHIFTER:
return DSP::effect1;

case effects::MONO_DELAY:
Expand Down Expand Up @@ -555,6 +563,43 @@ namespace plug::com
payload.setModel(0x0b);
break;

// Mustang I V2
case effects::RANGER_BOOST:
payload.setModel(0x0103);
break;

case effects::GREENBOX:
payload.setModel(0xba);
break;

case effects::ORANGEBOX:
payload.setModel(0x0110);
break;

case effects::BLACKBOX:
payload.setModel(0x0111);
break;

case effects::BIG_FUZZ:
payload.setModel(0x010f);
break;

case effects::WAH_MOD:
payload.setModel(0xf4);
payload.setUnknown(0x01, 0x08, 0x01);
break;

case effects::TOUCH_WAH_MOD:
payload.setModel(0xf5);
payload.setUnknown(0x01, 0x08, 0x01);
break;

case effects::DIATONIC_PITCH_SHIFTER:
payload.setModel(0x101f);
payload.setUnknown(0x00, 0x08, 0x01);
break;


default:
break;
}
Expand Down
Loading