Using blocking IO in Alsa driver, applied Ken Ellinwood's patch for Jack

This commit is contained in:
Peter Hanappe 2003-03-27 09:37:53 +00:00
parent ebbbfba022
commit 52be3cec9a
4 changed files with 28 additions and 12 deletions

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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));