Skip to content

Commit

Permalink
Modified the code
Browse files Browse the repository at this point in the history
  • Loading branch information
v1bh475u committed Aug 28, 2024
1 parent 843cfa6 commit 160fea2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 8 additions & 0 deletions src/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ void APU::test()
printf("APU test\n");
}

// Connecting CallBack function
void APU::setSignalCallback()
{
if (mMap)
mMap->connectObserver([this](Word address, Byte value)
{ this->onWrite(address, value); });
}

void APU::writeByte(Word address, Byte value)
{
printf("APU Address: %04X, Value: %02X\n", address, value);
Expand Down
7 changes: 1 addition & 6 deletions src/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,5 @@ class APU
// Write update
void writeUpdate(Word address, Byte value, bool WriteMem = false);

void setSignalCallback()
{
if (mMap)
mMap->connectObserver([this](Word address, Byte value)
{ this->onWrite(address, value); });
}
void setSignalCallback();
};
1 change: 1 addition & 0 deletions src/mmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class MemoryMap
// Stays in the I/O Ports at 0xFF4B
Byte* reg_WX;

// Audio Write Listener
std::function<void(Word, Byte)> globalFunction;

public:
Expand Down

0 comments on commit 160fea2

Please sign in to comment.