mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-04-08 08:41:21 +00:00
Using blocking IO in Alsa driver, applied Ken Ellinwood's patch for Jack
This commit is contained in:
parent
ebbbfba022
commit
52be3cec9a
4 changed files with 28 additions and 12 deletions
|
@ -55,8 +55,16 @@ AC_DEFUN(AC_JACK,
|
|||
|
||||
if test "${ac_cv_header_jack_jack_h}" = "yes"; then
|
||||
|
||||
dnl jack-0.6.? and above are dependent on librt.
|
||||
rt_lib_arg=-lrt
|
||||
AC_CHECK_LIB([rt], [shm_open],, [rt_lib_arg=])
|
||||
|
||||
if test "x$rt_lib_arg" = "x" ; then
|
||||
AC_MSG_WARN([ *** Could not find the required rt library. Newer versions of JACK depend on it])
|
||||
fi
|
||||
|
||||
jack_found=yes
|
||||
AC_CHECK_LIB([jack], [jack_client_new],, [jack_found=no])
|
||||
AC_CHECK_LIB([jack], [jack_client_new],, [jack_found=no], $rt_lib_arg)
|
||||
|
||||
if test "x$jack_found" = "xyes" ; then
|
||||
JACK_SUPPORT=1
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#undef HAVE_LIBPTHREAD
|
||||
|
||||
/* Define to 1 if you have the `rt' library (-lrt). */
|
||||
#undef HAVE_LIBRT
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
|
|
|
@ -407,6 +407,11 @@ static void* fluid_alsa_audio_run_float(void* d)
|
|||
handle[0] = left;
|
||||
handle[1] = right;
|
||||
|
||||
if (snd_pcm_nonblock(dev->pcm, 0) != 0) { /* double negation */
|
||||
FLUID_LOG(FLUID_ERR, "Failed to set the audio device to blocking mode");
|
||||
goto error_recovery;
|
||||
}
|
||||
|
||||
if (snd_pcm_prepare(dev->pcm) != 0) {
|
||||
FLUID_LOG(FLUID_ERR, "Failed to prepare the audio device");
|
||||
goto error_recovery;
|
||||
|
@ -486,6 +491,11 @@ static void* fluid_alsa_audio_run_s16(void* d)
|
|||
handle[0] = left;
|
||||
handle[1] = right;
|
||||
|
||||
if (snd_pcm_nonblock(dev->pcm, 0) != 0) { /* double negation */
|
||||
FLUID_LOG(FLUID_ERR, "Failed to set the audio device to blocking mode");
|
||||
goto error_recovery;
|
||||
}
|
||||
|
||||
if (snd_pcm_prepare(dev->pcm) != 0) {
|
||||
FLUID_LOG(FLUID_ERR, "Failed to prepare the audio device");
|
||||
goto error_recovery;
|
||||
|
|
|
@ -235,10 +235,10 @@ int main(int argc, char** argv)
|
|||
fluid_settings_setint(settings, "audio.jack.autoconnect", 1);
|
||||
break;
|
||||
case 'z':
|
||||
fluid_settings_setint(settings, "audio.period-size", atof(optarg));
|
||||
fluid_settings_setint(settings, "audio.period-size", atoi(optarg));
|
||||
break;
|
||||
case 'c':
|
||||
fluid_settings_setint(settings, "audio.periods", atof(optarg));
|
||||
fluid_settings_setint(settings, "audio.periods", atoi(optarg));
|
||||
break;
|
||||
case 'g':
|
||||
fluid_settings_setnum(settings, "synth.gain", atof(optarg));
|
||||
|
@ -429,17 +429,12 @@ int main(int argc, char** argv)
|
|||
|
||||
flags = CCA_Config_Data_Set | CCA_Terminal;
|
||||
|
||||
#ifdef JACK_SUPPORT
|
||||
fluid_settings_getstr (settings, "audio.driver", &str);
|
||||
if (str && strcmp (str, "jack") == 0)
|
||||
if (fluid_settings_str_equal(settings, "audio.driver", "jack")) {
|
||||
flags |= CCA_Use_Jack;
|
||||
#endif /* JACK_SUPPORT */
|
||||
|
||||
#ifdef ALSA_SUPPORT
|
||||
fluid_settings_getstr (settings, "midi.driver", &str);
|
||||
if (str && strcmp (str, "alsa_seq") == 0)
|
||||
}
|
||||
if (fluid_settings_str_equal(settings, "midi.driver", "alsa_seq")) {
|
||||
flags |= CCA_Use_Alsa;
|
||||
#endif /* ALSA_SUPPORT */
|
||||
}
|
||||
|
||||
fluid_cca_client = cca_init (cca_args, "FluidSynth", flags, CCA_PROTOCOL (1,1));
|
||||
|
||||
|
|
Loading…
Reference in a new issue