@@ -312,7 +312,11 @@ int my_main (int argc, char** argv)
312312
313313 int sound_quality = settings.get (" sound_quality" );
314314
315- MA_freq = 11025 * sound_quality;
315+ int ma_freq = 11025 * sound_quality;
316+ if (ma_freq == 0 )
317+ {
318+ ma_freq = 22050 ;
319+ }
316320
317321 // initialize SDL video
318322 /* if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
@@ -335,16 +339,40 @@ int my_main (int argc, char** argv)
335339
336340 gfx_dos_init_impl (settings.get (" screen_x" ), settings.get (" screen_y" ));
337341
342+ static const char aldeviceNone[] = " none" ;
343+ static const char aldeviceSB[] = " sb" ;
344+ static const char aldeviceGUS[] = " gus" ;
345+
346+ const char * aldevicestr = 0 ;
347+ switch (settings.get (" sound_device" ))
348+ {
349+ case 0 :
350+ aldevicestr = aldeviceNone;
351+ break ;
352+ case 1 :
353+ aldevicestr = aldeviceSB;
354+ break ;
355+ case 2 :
356+ aldevicestr = aldeviceGUS;
357+ break ;
358+ default :
359+ break ;
360+ }
361+
338362 glClearColor (0 , 0 , 0 , 0 );
339363
340364 // Initialize Open AL
341365
342- const char * aldevicestr = settings.getOpenalDevice ();
343-
344366 ALCdevice* aldevice = alcOpenDevice (aldevicestr); // NULL parameter = open default device
345367 ALCcontext* alcontext = NULL ;
346368 if (aldevice != NULL ) {
347- alcontext = alcCreateContext (aldevice,NULL ); // create context
369+
370+ static const ALCint attribs[] = {
371+ ALC_FREQUENCY, ma_freq,
372+ 0 , 0
373+ };
374+
375+ alcontext = alcCreateContext (aldevice, attribs); // create context
348376 if (alcontext != NULL ) {
349377 alcMakeContextCurrent (alcontext); // set active context
350378 } else {
0 commit comments