Skip to content

Commit

Permalink
Add remaining v2 model amps
Browse files Browse the repository at this point in the history
  • Loading branch information
offa committed Sep 28, 2024
1 parent b94e895 commit b2bac87
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 4 deletions.
8 changes: 8 additions & 0 deletions include/com/IdLookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ namespace plug
return amps::METAL_2000;
case 0xf1:
return amps::STUDIO_PREAMP;
case 0xf6:
return amps::FENDER_57_TWIN;
case 0xf9:
return amps::FENDER_60_THRIFT;
case 0xfc:
return amps::BRITISH_COLOUR;
case 0xff:
return amps::BRITISH_WATTS;
default:
throw std::invalid_argument{"Invalid amp id: " + std::to_string(id)};
}
Expand Down
14 changes: 11 additions & 3 deletions include/effects_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,23 @@ namespace plug
AMERICAN_90S,
METAL_2000,

// Mustang I v2
STUDIO_PREAMP
// Mustang v2
STUDIO_PREAMP,
FENDER_57_TWIN,
FENDER_60_THRIFT,
BRITISH_COLOUR,
BRITISH_WATTS
};

constexpr bool isV2Amp(amps amp)
{
switch(amp)
switch (amp)
{
case amps::STUDIO_PREAMP:
case amps::FENDER_57_TWIN:
case amps::FENDER_60_THRIFT:
case amps::BRITISH_COLOUR:
case amps::BRITISH_WATTS:
return true;
default:
return false;
Expand Down
21 changes: 21 additions & 0 deletions src/com/PacketSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,31 @@ namespace plug::com
payload.setModel(0x6d);
payload.setUnknownAmpSpecific(0x08, 0x08, 0x08, 0x08, 0x75);
break;

case amps::STUDIO_PREAMP:
payload.setModel(0xf1);
payload.setUnknownAmpSpecific(0x0d, 0x0d, 0x0d, 0x0d, 0xf6);
break;

case amps::FENDER_57_TWIN:
payload.setModel(0xf6);
payload.setUnknownAmpSpecific(0x0e, 0x0e, 0x0e, 0x0e, 0xf9);
break;

case amps::FENDER_60_THRIFT:
payload.setModel(0xf9);
payload.setUnknownAmpSpecific(0x0f, 0x0f, 0x0f, 0x0f, 0xfc);
break;

case amps::BRITISH_COLOUR:
payload.setModel(0xfc);
payload.setUnknownAmpSpecific(0x10, 0x10, 0x10, 0x10, 0xff);
break;

case amps::BRITISH_WATTS:
payload.setModel(0xff);
payload.setUnknownAmpSpecific(0x11, 0x11, 0x11, 0x11, 0x00);
break;
}

return Packet<AmpPayload>{header, payload};
Expand Down
6 changes: 5 additions & 1 deletion src/ui/amplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ namespace plug
{amps::BRITISH_80S, "British 80's"},
{amps::AMERICAN_90S, "American 90's"},
{amps::METAL_2000, "Metal 2000"},
{amps::STUDIO_PREAMP, "Studio Preamp"}};
{amps::STUDIO_PREAMP, "Studio Preamp"},
{amps::FENDER_57_TWIN, "Fender '57 Twin"},
{amps::FENDER_60_THRIFT, "Fender '60s Thrift"},
{amps::BRITISH_COLOUR, "British Colour"},
{amps::BRITISH_WATTS, "British Watts"}};
}

Amplifier::Amplifier(QWidget* parent)
Expand Down
24 changes: 24 additions & 0 deletions src/ui/savetofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,30 @@ namespace plug
something = 0x0d;
something2 = 0xf6;
break;

case amps::FENDER_57_TWIN:
model = 0xf6;
something = 0x0e;
something2 = 0xf9;
break;

case amps::FENDER_60_THRIFT:
model = 0xf9;
something = 0x0f;
something2 = 0xfc;
break;

case amps::BRITISH_COLOUR:
model = 0xfc;
something = 0x10;
something2 = 0xff;
break;

case amps::BRITISH_WATTS:
model = 0xff;
something = 0x11;
something2 = 0x00;
break;
}

xml->writeStartElement("Amplifier");
Expand Down
4 changes: 4 additions & 0 deletions test/IdLookupTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ namespace plug::test
EXPECT_EQ(lookupAmpById(0x6d), amps::METAL_2000);

EXPECT_EQ(lookupAmpById(0xf1), amps::STUDIO_PREAMP);
EXPECT_EQ(lookupAmpById(0xf6), amps::FENDER_57_TWIN);
EXPECT_EQ(lookupAmpById(0xf9), amps::FENDER_60_THRIFT);
EXPECT_EQ(lookupAmpById(0xfc), amps::BRITISH_COLOUR);
EXPECT_EQ(lookupAmpById(0xff), amps::BRITISH_WATTS);
}

TEST_F(IdLookupTest, lookupAmpByIdThrowsOnInvalidId)
Expand Down
4 changes: 4 additions & 0 deletions test/PacketSerializerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ namespace plug::test
EXPECT_THAT(serializeWithType(amps::METAL_2000), AmpDataIs(0x6d, 0x80, 0x08, 0x75));

EXPECT_THAT(serializeWithType(amps::STUDIO_PREAMP), AmpDataIs(0xf1, 0x80, 0x0d, 0xf6));
EXPECT_THAT(serializeWithType(amps::FENDER_57_TWIN), AmpDataIs(0xf6, 0x80, 0x0e, 0xf9));
EXPECT_THAT(serializeWithType(amps::FENDER_60_THRIFT), AmpDataIs(0xf9, 0x80, 0x0f, 0xfc));
EXPECT_THAT(serializeWithType(amps::BRITISH_COLOUR), AmpDataIs(0xfc, 0x80, 0x10, 0xff));
EXPECT_THAT(serializeWithType(amps::BRITISH_WATTS), AmpDataIs(0xff, 0x80, 0x11, 0x00));
}

TEST_F(PacketSerializerTest, serializeAmpSettingsCabinetData)
Expand Down

0 comments on commit b2bac87

Please sign in to comment.