Give OpenAL the ability to be optional

This commit is contained in:
Jasmine Iwanek
2022-01-29 20:25:00 -05:00
parent 8e00b37e22
commit c1d2a50175
7 changed files with 36 additions and 4 deletions

View File

@@ -40,8 +40,10 @@ enum fluid_interp {
};
#ifdef USE_OPENAL
extern void givealbuffer_midi(void *buf, uint32_t size);
extern void al_set_midi(int freq, int buf_size);
#endif
static void *fluidsynth_handle; /* handle to FluidSynth DLL */
@@ -150,7 +152,9 @@ static void fluidsynth_thread(void *param)
buf_pos += buf_size;
if (buf_pos >= data->buf_size)
{
#ifdef USE_OPENAL
givealbuffer_midi(data->buffer, data->buf_size / sizeof(float));
#endif
buf_pos = 0;
}
}
@@ -163,7 +167,9 @@ static void fluidsynth_thread(void *param)
buf_pos += buf_size;
if (buf_pos >= data->buf_size)
{
#ifdef USE_OPENAL
givealbuffer_midi(data->buffer_int16, data->buf_size / sizeof(int16_t));
#endif
buf_pos = 0;
}
}
@@ -314,7 +320,9 @@ void* fluidsynth_init(const device_t *info)
data->buffer_int16 = malloc(data->buf_size);
}
#ifdef USE_OPENAL
al_set_midi(data->samplerate, data->buf_size);
#endif
dev = malloc(sizeof(midi_device_t));
memset(dev, 0, sizeof(midi_device_t));