Merge pull request #1038 from FluidSynth/oss-new

Revise OSS driver a bit
This commit is contained in:
Tom M 2022-02-20 18:26:41 +01:00 committed by GitHub
commit adc2794ef6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 60 deletions

View file

@ -16,7 +16,7 @@ and a description.
- jack: JACK Audio Connection Kit (Linux, Mac OS X, Windows)
- alsa: Advanced Linux Sound Architecture (Linux)
- oss: Open Sound System (Linux, Unix)
- oss: Open Sound System (primarily needed on BSD, rarely also Linux and Unix in general)
- pulseaudio: PulseAudio (Linux, Mac OS X, Windows)
- coreaudio: Apple CoreAudio (Mac OS X)
- dsound: Microsoft DirectSound (Windows)

View file

@ -123,17 +123,6 @@ new_fluid_oss_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
char *devname = NULL;
int format;
FLUID_LOG(FLUID_WARN,
"\n\n"
"================= OSS audio driver has been deprecated! ==================\n"
"You're using the OSS driver. This driver is old, unmaintained and believed\n"
"to be unused. If you still need it, pls. let us know by posting to our\n"
"mailing list at fluid-dev@nongnu.org - otherwise this driver might be removed\n"
"in a future release of FluidSynth!\n"
"================= OSS audio driver has been deprecated! ==================\n"
"\n"
);
dev = FLUID_NEW(fluid_oss_audio_driver_t);
if(dev == NULL)
@ -198,9 +187,18 @@ new_fluid_oss_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
}
}
if(stat(devname, &devstat) == -1)
dev->dspfd = open(devname, O_WRONLY, 0);
if(dev->dspfd == -1)
{
FLUID_LOG(FLUID_ERR, "Device <%s> does not exists", devname);
FLUID_LOG(FLUID_ERR, "Device <%s> could not be opened for writing: %s",
devname, g_strerror(errno));
goto error_recovery;
}
if(fstat(dev->dspfd, &devstat) == -1)
{
FLUID_LOG(FLUID_ERR, "fstat failed on device <%s>: %s", devname, g_strerror(errno));
goto error_recovery;
}
@ -210,15 +208,6 @@ new_fluid_oss_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
goto error_recovery;
}
dev->dspfd = open(devname, O_WRONLY, 0);
if(dev->dspfd == -1)
{
FLUID_LOG(FLUID_ERR, "Device <%s> could not be opened for writing: %s",
devname, strerror(errno));
goto error_recovery;
}
if(fluid_oss_set_queue_size(dev, sample_size, 2, queuesize, period_size) < 0)
{
FLUID_LOG(FLUID_ERR, "Can't set device buffer size");
@ -307,17 +296,6 @@ new_fluid_oss_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func,
int realtime_prio = 0;
int format;
FLUID_LOG(FLUID_WARN,
"\n\n"
"================= OSS audio driver has been deprecated! ==================\n"
"You're using the OSS driver. This driver is old, unmaintained and believed\n"
"to be unused. If you still need it, pls. let us know by posting to our\n"
"mailing list at fluid-dev@nongnu.org - otherwise this driver might be removed\n"
"in a future release of FluidSynth!\n"
"================= OSS audio driver has been deprecated! ==================\n"
"\n"
);
dev = FLUID_NEW(fluid_oss_audio_driver_t);
if(dev == NULL)
@ -355,9 +333,18 @@ new_fluid_oss_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func,
}
}
if(stat(devname, &devstat) == -1)
dev->dspfd = open(devname, O_WRONLY, 0);
if(dev->dspfd == -1)
{
FLUID_LOG(FLUID_ERR, "Device <%s> does not exists", devname);
FLUID_LOG(FLUID_ERR, "Device <%s> could not be opened for writing: %s",
devname, g_strerror(errno));
goto error_recovery;
}
if(fstat(dev->dspfd, &devstat) == -1)
{
FLUID_LOG(FLUID_ERR, "fstat failed on device <%s>: %s", devname, g_strerror(errno));
goto error_recovery;
}
@ -367,16 +354,6 @@ new_fluid_oss_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func,
goto error_recovery;
}
dev->dspfd = open(devname, O_WRONLY, 0);
if(dev->dspfd == -1)
{
FLUID_LOG(FLUID_ERR, "Device <%s> could not be opened for writing: %s",
devname, strerror(errno));
goto error_recovery;
}
if(fluid_oss_set_queue_size(dev, 16, 2, queuesize, period_size) < 0)
{
FLUID_LOG(FLUID_ERR, "Can't set device buffer size");
@ -426,7 +403,7 @@ new_fluid_oss_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func,
goto error_recovery;
}
/* allocate the buffers. FIXME!!! don't use interleaved samples */
/* allocate the buffers. */
dev->buffer = FLUID_MALLOC(dev->buffer_byte_size);
dev->buffers[0] = FLUID_ARRAY(float, dev->buffer_size);
dev->buffers[1] = FLUID_ARRAY(float, dev->buffer_size);
@ -486,6 +463,8 @@ delete_fluid_oss_audio_driver(fluid_audio_driver_t *p)
}
FLUID_FREE(dev->buffer);
FLUID_FREE(dev->buffers[0]);
FLUID_FREE(dev->buffers[1]);
FLUID_FREE(dev);
}
@ -629,17 +608,6 @@ new_fluid_oss_midi_driver(fluid_settings_t *settings,
int realtime_prio = 0;
char *device = NULL;
FLUID_LOG(FLUID_WARN,
"\n\n"
"================= OSS MIDI driver has been deprecated! ==================\n"
"You're using the OSS driver. This driver is old, unmaintained and believed\n"
"to be unused. If you still need it, pls. let us know by posting to our\n"
"mailing list at fluid-dev@nongnu.org - otherwise this driver might be removed\n"
"in a future release of FluidSynth!\n"
"================= OSS MIDI driver has been deprecated! ==================\n"
"\n"
);
/* not much use doing anything */
if(handler == NULL)
{
@ -699,7 +667,7 @@ new_fluid_oss_midi_driver(fluid_settings_t *settings,
if(fcntl(dev->fd, F_SETFL, O_NONBLOCK) == -1)
{
FLUID_LOG(FLUID_ERR, "Failed to set OSS MIDI device to non-blocking: %s",
strerror(errno));
g_strerror(errno));
goto error_recovery;
}
@ -788,7 +756,7 @@ fluid_oss_midi_run(void *d)
if(n < 0)
{
FLUID_LOG(FLUID_ERR, "Error waiting for MIDI input: %s", strerror(errno));
FLUID_LOG(FLUID_ERR, "Error waiting for MIDI input: %s", g_strerror(errno));
break;
}