Skip to content

Commit

Permalink
YM channel muting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
AidanHockey5 committed Feb 1, 2022
1 parent 880e6c2 commit 9df1588
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/VGMEngine/VGMEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,11 @@ uint16_t VGMEngineClass::parseVGM()
// check for an operator/channel key on/off write
if (addr == 0x28)
{
uint8_t channel = (data & 0x07);
const uint8_t chMap[7] = {0, 1, 2, 0xFF, 3, 4, 5}; //Yamaha doesn't know how to count in binary. Check register 0x28 key-on map.
uint8_t channel = chMap[(data & 0x07)]; //Mask out 0x28 register to get key-on data

if(channel == 0xFF) //Invalid channel
break;
// if the channel is disabled then make it silent (force a key-off)
if (!ym2612CHControl[channel])
{
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern "C" {
#define DEBUG_LED A4
bool commandFailed = false;
uint8_t failedCmd = 0x00;
#define DISABLE_IRQ_TEST true
#define DISABLE_IRQ_TEST false

//Structs
enum FileStrategy {FIRST_START, NEXT, PREV, RND, REQUEST};
Expand Down
Binary file modified tools/UF2/firmware.bin
Binary file not shown.
Binary file modified tools/UF2/firmware.uf2
Binary file not shown.

0 comments on commit 9df1588

Please sign in to comment.