[AD] WaveOut sounddriver |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
This adds 2 new drivers to allegro (win ver) which use WaveOut instead of DirectSound. The attached file goes in allegro/src/win (wsndwo.c). The diff makes minor changes to integrate the new drivers. Please test compilation with MSVC, I used mingw only. Reasons: Works without DirectX Some drivers work better with WaveOut than dsound Negligible size increase Selectable sound quality
Index: makefile.lst =================================================================== RCS file: /cvsroot/alleg/allegro/makefile.lst,v retrieving revision 1.7 diff -u -r1.7 makefile.lst --- makefile.lst 2000/09/26 14:55:32 1.7 +++ makefile.lst 2000/10/08 21:23:00 @@ -166,6 +166,7 @@ src/win/update.s \ src/win/wdsound.c \ src/win/wdsndmix.c \ + src/win/wsndwo.c \ src/win/wdxver.c \ src/win/wdispsw.c \ src/win/wfile.c \ Index: include/allegro/alwin.h =================================================================== RCS file: /cvsroot/alleg/allegro/include/allegro/alwin.h,v retrieving revision 1.2 diff -u -r1.2 alwin.h --- include/allegro/alwin.h 2000/09/24 15:51:01 1.2 +++ include/allegro/alwin.h 2000/10/08 21:23:03 @@ -155,6 +155,7 @@ /********************************************/ #define DIGI_DIRECTX(n) AL_ID('D','X','A'+(n),' ') #define DIGI_DIRECTAMX(n) AL_ID('A','X','A'+(n),' ') +#define DIGI_WAVOUTID(n) AL_ID('W','O','A'+(n),' ') #define MIDI_WIN32(n) AL_ID('W','3','2','A'+(n)) Index: src/win/wdsound.c =================================================================== RCS file: /cvsroot/alleg/allegro/src/win/wdsound.c,v retrieving revision 1.4 diff -u -r1.4 wdsound.c --- src/win/wdsound.c 2000/09/24 15:51:01 1.4 +++ src/win/wdsound.c 2000/10/08 21:23:44 @@ -194,6 +194,9 @@ /* Function from wdsndmix.c to get a driver */ DIGI_DRIVER * _get_dsalmix_driver (char *, int); +/* Function from wsndwo.c to get a driver */ +DIGI_DRIVER *_get_woalmix_driver (int); + /* _get_digi_driver_list: * System driver hook for listing the available sound drivers. This * generates the device list at runtime, to match whatever DirectSound @@ -208,7 +211,8 @@ DirectSoundEnumerate(DSEnumCallback, NULL); /* This function has to allocate drivers for wdsndmix.c as well */ - driver_list = malloc(sizeof(_DRIVER_INFO) * ((num_drivers*2)+2)); +/* and also, wsndwo.c ASSUMES 2 DRIVERS */ + driver_list = malloc(sizeof(_DRIVER_INFO) * ((num_drivers*2)+4)); /* wdsound.c drivers */ for (i=0; i<num_drivers; i++) { @@ -232,17 +236,29 @@ driver_list[i+num_drivers].driver = driver; driver_list[i+num_drivers].autodetect = TRUE; } + + driver = _get_woalmix_driver (0); + driver_list[i+num_drivers].id = driver->id; + driver_list[i+num_drivers].driver = driver; + driver_list[i+num_drivers].autodetect = TRUE; + i++; + driver = _get_woalmix_driver (1); + driver_list[i+num_drivers].id = driver->id; + driver_list[i+num_drivers].driver = driver; + driver_list[i+num_drivers].autodetect = TRUE; + i++; + driver_list[i+num_drivers].id = DIGI_NONE; driver_list[i+num_drivers].driver = &digi_none; driver_list[i+num_drivers].autodetect = TRUE; + i++; - driver_list[i+num_drivers+1].id = 0; - driver_list[i+num_drivers+1].driver = NULL; - driver_list[i+num_drivers+1].autodetect = FALSE; + driver_list[i+num_drivers].id = 0; + driver_list[i+num_drivers].driver = NULL; + driver_list[i+num_drivers].autodetect = FALSE; } return driver_list; - }
Attachment:
wsndwo.c
Description: application/unknown-content-type-devcpp.c
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |