Skip to content

Commit 57216ff

Browse files
committed
MiniAL implementation interface in preparation for GUS implementation.
1 parent 43ef555 commit 57216ff

9 files changed

Lines changed: 519 additions & 339 deletions

File tree

src/Makefile.djgpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LFLAGS = \
1818
CC = i586-pc-msdosdjgpp-gcc
1919
CXX = i586-pc-msdosdjgpp-g++
2020
LINK = i586-pc-msdosdjgpp-g++
21-
EXE2COFF = /home/vojta/djgpp/i586-pc-msdosdjgpp/bin/exe2coff
21+
EXE2COFF = ~/djgpp/i586-pc-msdosdjgpp/bin/exe2coff
2222
INTERM = interm
2323
TARGET = openmrac.exe
2424
INTERM2 = interm2

src/main.cpp

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)