Thanks for trying it out

Any tips on vram bank switching? My code is really plain, I simply have 2 external banks and I switch them in and out into memory whenever VBK is written too. Then in my drawing code, I retrieve the data from whatever bank. (and if the bank is the current one in memory, I just read straight from mem).
As for the sound, here is all the included files. Set up is REALLY simple. Add all the files to your project. Boost is a library of common functions used, if you already have it setup in your compiler you don't need it, otherwise you can add the files that are there. Include Audio.h, which is the main wrapper which is very basic. Declare a AUDIO aud; somewhere. Then when the program initializes, call aud.Initialize(). In your write to memory function, do something like:
Code:
if(address>=0xff10 && address<=0xff26)
{
aud.WriteRegister(address,data);
return;
}
Same thing goes for aud.ReadRegister in your read register function, though this one isn't entirelly necessary. I think only some GBC games rely on reading back the values of the sound io registers.
Lastly, when LY=144 (when you just finished drawing the screen) call aud.EndFrame();
Voila! Sound. Just make sure that you include the sdl libs. Here is some extra information Blargg sent me in an email:
I guess you can tell by now that the simplified APU is simulating the Z80
as if it were writing to the sound chip every instruction at the beginning
of the frame. Once you are ready to switch to the full APU, you'll be
passing the actual number of clocks since the beginning of the frame.
> Also, reseting
> doesn't reset the sound properly. But none of that is anything I
> can't work out on my own.
I'll have to look into reset behavior. I originally wrote the APU only for
a GBS music player, so most problems are due this.
Even if you work out problems, let me know so I can fix the
library/documentation.
Here are a couple of features you could add in the future, once everything
else it working well (my standard pitch, heh):
You can adjust the treble and bass frequency response, good for simulating
the small speaker in a Game Boy:
Basic_Gb_Apu::Basic_Gb_Apu()
{
time = 0;
apu.treble_eq( -20.0 ); // lower values reduce treble
buf.bass_freq( 461 ); // higher values reduce bass
}
These can be adjusted at any time, not just during initialization.
There's also Effects_Buffer, which adds adjustable panning and stereo echo
to the sound channels. Since most Game Boy games never even use stereo, it
makes them sound a little better on headphones.
As you may of guessed, this isn't using his full APU, but a basic version for getting started.
EDIT: If anyone gets his APU working with DirectSound, please let me know. It was giving me a hard time, so I just stuck with SDL.
EDIT: Also note there was a bug in the sound in the last build of my emu that messed up the timings and it eventually turned to static. This is fixed in this code here, and in the current build of my emulator.
Regards