New game boy emulator Dingux port need help with sound problems please
I am no programmer, I took a C class in undergrad and that is it.
I learned how to compile from this forum and Google.
***This is not a formal release I am seeking development help***
I cross compiled "gngb" a Game Boy/ Game Boy Color Emulator. I use this dmenu entry:
MenuItem Gngb
{
Icon = "res/emulators/gnuboy.png"
Name = " Gngb"
Executable = "./gngb"
WorkDir = "/usr/local/emulators/gngb"
Selector = yes
}
Keys:
L: brings up the Menu
Start: enter menus, toggle or select menu items
R: exit menus, Exit gngb
The Menu:
Load/Save State: can choose 8 different slots, has little thumbnail for saves
Video: can toggle Color Filter and enter the Filter sub-menu,
Filter Sub-menu: Select Filter 2 for 150% scaling (my temp default), none for native game boy resolution
Frameskip: Toggle frameskip, show fps meter
Sound: Toggle sound on/off (temp defaults off because of poor performance with sound on)
Reset: Resets Gameboy
Gngb can open/run zipped (.zip) roms.
It has audio problems though. With gngb the sound is choppy.
Press L, scroll down to Sound, and press start to turn on sound (it is currently off by default.)
Gngb uses AUDIO_S8 format which I only changed the name to AUDIO_S16 in sound.c, line 933.
Does this require some additional conversion?
Lowering the sample rate helped a bit but the sound is still choppy.
I have included the complete source code for suggestions/help/explanations.
Things I have done:
I changed the default conf.sample_rate=44100; to conf.sample_rate=16000; and remapped the default keys to match the Dingoo in emu.c.
The makefile is setup to use booboo’s 20090916 toolchain with the /opt/mipsel-linux-uclibc/usr prefix.
I temporarily repurposed the filter blit_std_with_scanline50 function in video_std.c to use the SDL_StretchSurface_23 function which gives 150% scale.
I am learning as I go and I will eventually put my own filter entry in. This is my first attempt.
How can the sound be fixed/improved?
Thanks!!!
EDIT: I re-uploaded the source, the previous version had some hard coded #include paths that I made while figuring out how to make the compiler link and include libraries.
The previous version will not work correctly if you are not using the /opt/mipsel-linux-uclibc/usr path structure.
If you configure with:
./configure --host=mipsel-linux --target=mipsel-linux --with-sdl-prefix=/opt/mipsel-linux-uclibc/usr --enable-static
Add:
-lSDL_stretch
to the LIBS = line in the Makefile
Then add:
-I/opt/mipsel-linux-uclibc/usr/include/SDL_stretch
To the CFLAGS = line in the Makefile
Use the Makefile in the gngb/src folder. A Dingux executable gngb is also in the src folder if you want to try it out.
sound.c.zip is just the sound.c source code file.