diff --git a/fluidsynth/README-OSX b/fluidsynth/README-OSX index 368f7aae..006ec168 100644 --- a/fluidsynth/README-OSX +++ b/fluidsynth/README-OSX @@ -1,18 +1,18 @@ -fluidsynth-1.0.9 on Mac OS X.5 (Leopard) +fluidsynth-1.1.0 on Mac OS X ----------------------------------------------------------------------- -fluidsynth-1.0.9 can be installed in two ways on your Apple computer: +fluidsynth-1.1.0 can be installed in two ways on your Apple computer: A. Compilation and installation by hand --------------------------------------- Requirements: -- "XcodeTools.mpkg","DevSDK.pkg", "CoreAudioSDK.pkg" packages (The Leopard Install DVD) +- "XcodeTools.mpkg","DevSDK.pkg", "CoreAudioSDK.pkg" packages (The Leopard/Snow Leopard Install DVD) - Fink installation -- libgnugetopt and readline from fink: e.g. "fink install libgnugetopt" +- libgnugetopt, readline5, libflac8-dev, libsndfile1-dev and glib2-dev from fink: e.g. "fink install libgnugetopt" -- JackOSX.0.81.pkg.zip +- JackOSX.0.83.pkg.zip - MIDI Patchbay 1.0.3 @@ -24,9 +24,13 @@ $ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure && make B. Compilation and installation of the fink fluidsynth package -------------------------------------------------------------- + +(The fink fluidsynth package is currently at version 1.0.9. The update will be announced after the source tarball for version 1.1.0 becomes officially +available on fluidsynth.resonance.org.) + Requirements: -- "XcodeTools.mpkg","DevSDK.pkg", "CoreAudioSDK.pkg" packages (The Leopard Install DVD) +- "XcodeTools.mpkg","DevSDK.pkg", "CoreAudioSDK.pkg" packages (The Leopard/Snow Leopard Install DVD) - Fink installation @@ -45,7 +49,7 @@ $ jackd -R -p 512 -d coreaudio -i 2 -o 2 then start fluidsynth -$ fluidsynth -a jack -m coremidi -j (it also possible to run the coreaudio sound driver simply by omitting the "-a jack -j" options) +$ fluidsynth -a jack -m coremidi -j (it also possible to run the coreaudio sound driver simply by replacing the "-a jack -j" options with "-a coreaudio") In order to run another instance of fluidsynth, open another terminal window: @@ -54,6 +58,6 @@ $ fluidsynth -a jack -m coremidi -o audio.jack.id=name_of_instance -p name_of_in Connect MIDI I/O devices using MIDI Patchbay Ebrahim Mayat -8th March 2009 +29th October 2009 diff --git a/fluidsynth/doc/example.c b/fluidsynth/doc/example.c index 15679f9c..384789e7 100644 --- a/fluidsynth/doc/example.c +++ b/fluidsynth/doc/example.c @@ -43,12 +43,9 @@ int main(int argc, char** argv) as the driver is created. */ adriver = new_fluid_audio_driver(settings, synth); - /* Load a SoundFont*/ - sfont_id = fluid_synth_sfload(synth, "example.sf2", 0); - - /* Select bank 0 and preset 0 in the SoundFont we just loaded on - channel 0 */ - fluid_synth_program_select(synth, 0, sfont_id, 0, 0); + /* Load a SoundFont and reset presets (so that new instruments + * get used from the SoundFont) */ + sfont_id = fluid_synth_sfload(synth, "example.sf2", 1); /* Initialze the random number generator */ srand(getpid()); diff --git a/fluidsynth/doc/fluidsynth-v11-devdoc.txt b/fluidsynth/doc/fluidsynth-v11-devdoc.txt index 57418d0a..0b9778eb 100644 --- a/fluidsynth/doc/fluidsynth-v11-devdoc.txt +++ b/fluidsynth/doc/fluidsynth-v11-devdoc.txt @@ -596,24 +596,6 @@ There are a number of general audio driver settings. The audio.driver settings d The size of the audio buffers (in frames). - - audio.realtime - Type - boolean - - - - Default - 1 (TRUE) - - - - Description - Enables or disables realtime scheduling priority for - audio driver and synthesis. Drivers which make use of this - option: alsa, oss and pulseaudio - - audio.realtime-prio Type @@ -622,18 +604,20 @@ There are a number of general audio driver settings. The audio.driver settings d Default - 90 + 60 Min-Max - 1-99 + 0-99 Description - If audio.realtime is enabled, then this value is used for - the realtime priority value (Linux only currently). + Sets the realtime scheduling priority of the audio synthesis thread + (0 disables high priority scheduling). Linux is the only platform which + currently makes use of different priority levels. Drivers which use this + option: alsa, oss and pulseaudio @@ -1083,24 +1067,6 @@ the MIDI subsystems used, which are described in a following table. The MIDI system to be used. - - midi.realtime - Type - string - - - - Default - "yes" - - - - Description - Enables or disables realtime scheduling priority for - MIDI driver. Drivers which make use of this option: - alsa_raw, alsa_seq, oss and pulseaudio - - midi.realtime-prio Type @@ -1109,18 +1075,20 @@ the MIDI subsystems used, which are described in a following table. Default - 80 + 50 Min-Max - 1-99 + 0-99 Description - If midi.realtime is enabled, then this value is used for - the realtime priority value (Linux only currently). + Sets the realtime scheduling priority of the MIDI thread + (0 disables high priority scheduling). Linux is the only platform which + currently makes use of different priority levels. Drivers which use this + option: alsa_raw, alsa_seq, oss diff --git a/fluidsynth/doc/fluidsynth.1 b/fluidsynth/doc/fluidsynth.1 index 6209a41b..676849eb 100644 --- a/fluidsynth/doc/fluidsynth.1 +++ b/fluidsynth/doc/fluidsynth.1 @@ -213,11 +213,9 @@ Period size for audio buffers. Used by many audio drivers. .B audio.periods INT [min=2, max=64, def=16] Count of audio buffers. Used by many audio drivers. .TP -.B audio.realtime BOOL [def=True] -High priority (real time) toggle for audio driver thread. -.TP -.B audio.realtime\-prio INT [min=1, max=99, def=90] -Priority to assign to audio thread if audio.realtime is enabled. +.B audio.realtime\-prio INT [min=0, max=99, def=60] +Realtime priority to assign to audio thread or 0 to disable high priority scheduling. +Only used by some audio drivers (currently 'alsa' and 'oss'). .TP .B audio.sample\-format STR [def='16bits' vals:'16bits','float'] Audio output format, to select format for those drivers which support 16 bit or floating point. @@ -284,11 +282,9 @@ PulseAudio driver server. .B midi.driver STR MIDI driver to use. Default and valid options depend on available drivers. .TP -.B midi.realtime BOOL [def=True] -High priority (real time) toggle for MIDI driver thread. -.TP -.B midi.realtime\-prio INT [min=1, max=99, def=80] -Priority to assign to MIDI thread if midi.realtime is enabled. +.B midi.realtime\-prio INT [min=0, max=99, def=50] +Realtime priority to assign to MIDI thread or 0 to disable high priority scheduling. +Only used by some MIDI drivers (currently 'alsa_seq', 'alsa_raw' and 'oss'). .TP .B MIDI DRIVER SPECIFIC diff --git a/fluidsynth/src/fluid_adriver.c b/fluidsynth/src/fluid_adriver.c index 72bd9b85..144f953c 100644 --- a/fluidsynth/src/fluid_adriver.c +++ b/fluidsynth/src/fluid_adriver.c @@ -219,9 +219,8 @@ void fluid_audio_driver_settings(fluid_settings_t* settings) fluid_settings_register_int(settings, "audio.periods", 16, 2, 64, 0, NULL, NULL); #endif - fluid_settings_register_int (settings, "audio.realtime", 1, 0, 1, FLUID_HINT_TOGGLED, NULL, NULL); fluid_settings_register_int (settings, "audio.realtime-prio", - FLUID_DEFAULT_AUDIO_RT_PRIO, 1, 99, 0, NULL, NULL); + FLUID_DEFAULT_AUDIO_RT_PRIO, 0, 99, 0, NULL, NULL); /* Set the default driver */ #if JACK_SUPPORT diff --git a/fluidsynth/src/fluid_alsa.c b/fluidsynth/src/fluid_alsa.c index 3a462097..b6a98800 100644 --- a/fluidsynth/src/fluid_alsa.c +++ b/fluidsynth/src/fluid_alsa.c @@ -191,8 +191,7 @@ new_fluid_alsa_audio_driver2(fluid_settings_t* settings, fluid_settings_dupstr(settings, "audio.alsa.device", &device); /* ++ dup device name */ fluid_settings_getint (settings, "audio.realtime-prio", &realtime_prio); - fluid_settings_getint (settings, "audio.realtime", &sched); - if (sched) + if (realtime_prio > 0) sched = SCHED_FIFO; else sched = SCHED_OTHER; @@ -332,7 +331,7 @@ new_fluid_alsa_audio_driver2(fluid_settings_t* settings, } /* SCHED_FIFO will not be active without setting the priority */ - priority.sched_priority = (sched == SCHED_FIFO) ? realtime_prio : 0; + priority.sched_priority = realtime_prio; pthread_attr_setschedparam(&attr, &priority); err = pthread_create(&dev->thread, &attr, fluid_alsa_formats[i].run, (void*) dev); @@ -652,8 +651,7 @@ new_fluid_alsa_rawmidi_driver(fluid_settings_t* settings, fluid_settings_getint (settings, "midi.realtime-prio", &realtime_prio); - fluid_settings_getint (settings, "midi.realtime", &sched); - if (sched) + if (realtime_prio > 0) sched = SCHED_FIFO; else sched = SCHED_OTHER; @@ -725,7 +723,7 @@ new_fluid_alsa_rawmidi_driver(fluid_settings_t* settings, } /* SCHED_FIFO will not be active without setting the priority */ - priority.sched_priority = (sched == SCHED_FIFO) ? realtime_prio : 0; + priority.sched_priority = realtime_prio; pthread_attr_setschedparam (&attr, &priority); err = pthread_create(&dev->thread, &attr, fluid_alsa_midi_run, (void*) dev); @@ -923,8 +921,7 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings, fluid_settings_getint (settings, "midi.realtime-prio", &realtime_prio); - fluid_settings_getint (settings, "midi.realtime", &sched); - if (sched) + if (realtime_prio > 0) sched = SCHED_FIFO; else sched = SCHED_OTHER; @@ -1054,7 +1051,7 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings, } /* SCHED_FIFO will not be active without setting the priority */ - priority.sched_priority = (sched == SCHED_FIFO) ? realtime_prio : 0; + priority.sched_priority = realtime_prio; pthread_attr_setschedparam (&attr, &priority); err = pthread_create(&dev->thread, &attr, fluid_alsa_seq_run, (void*) dev); diff --git a/fluidsynth/src/fluid_mdriver.c b/fluidsynth/src/fluid_mdriver.c index d537c32e..f38e8519 100644 --- a/fluidsynth/src/fluid_mdriver.c +++ b/fluidsynth/src/fluid_mdriver.c @@ -145,10 +145,8 @@ void fluid_midi_driver_settings(fluid_settings_t* settings) { int i; - fluid_settings_register_int (settings, "midi.realtime", 1, 0, 1, - FLUID_HINT_TOGGLED, NULL, NULL); fluid_settings_register_int (settings, "midi.realtime-prio", - FLUID_DEFAULT_MIDI_RT_PRIO, 1, 99, 0, NULL, NULL); + FLUID_DEFAULT_MIDI_RT_PRIO, 0, 99, 0, NULL, NULL); /* Set the default driver */ #if ALSA_SUPPORT diff --git a/fluidsynth/src/fluid_oss.c b/fluidsynth/src/fluid_oss.c index 95e237a9..25379f9d 100644 --- a/fluidsynth/src/fluid_oss.c +++ b/fluidsynth/src/fluid_oss.c @@ -133,8 +133,7 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth) fluid_settings_getnum(settings, "synth.sample-rate", &sample_rate); fluid_settings_getint (settings, "audio.realtime-prio", &realtime_prio); - fluid_settings_getint (settings, "audio.realtime", &sched); - if (sched) + if (realtime_prio > 0) sched = SCHED_FIFO; else sched = SCHED_OTHER; @@ -255,7 +254,7 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth) } /* SCHED_FIFO will not be active without setting the priority */ - priority.sched_priority = (sched == SCHED_FIFO) ? realtime_prio : 0; + priority.sched_priority = realtime_prio; pthread_attr_setschedparam (&attr, &priority); err = pthread_create(&dev->thread, &attr, fluid_oss_audio_run, (void*) dev); @@ -311,8 +310,7 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t func, fluid_settings_getnum(settings, "synth.sample-rate", &sample_rate); fluid_settings_getint (settings, "audio.realtime-prio", &realtime_prio); - fluid_settings_getint (settings, "audio.realtime", &sched); - if (sched) + if (realtime_prio > 0) sched = SCHED_FIFO; else sched = SCHED_OTHER; @@ -423,7 +421,7 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t func, } /* SCHED_FIFO will not be active without setting the priority */ - priority.sched_priority = (sched == SCHED_FIFO) ? realtime_prio : 0; + priority.sched_priority = realtime_prio; pthread_attr_setschedparam (&attr, &priority); err = pthread_create(&dev->thread, &attr, fluid_oss_audio_run2, (void*) dev); @@ -612,7 +610,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings, pthread_attr_t attr; int sched; struct sched_param priority; - int realtime_prio; + int realtime_prio = 0; char* device = NULL; /* not much use doing anything */ @@ -655,8 +653,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings, fluid_settings_getint (settings, "midi.realtime-prio", &realtime_prio); - fluid_settings_getint (settings, "midi.realtime", &sched); - if (sched) + if (realtime_prio > 0) sched = SCHED_FIFO; else sched = SCHED_OTHER; @@ -689,7 +686,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings, } /* SCHED_FIFO will not be active without setting the priority */ - priority.sched_priority = (sched == SCHED_FIFO) ? realtime_prio : 0; + priority.sched_priority = realtime_prio; pthread_attr_setschedparam (&attr, &priority); err = pthread_create(&dev->thread, &attr, fluid_oss_midi_run, (void*) dev); diff --git a/fluidsynth/src/fluid_pulse.c b/fluidsynth/src/fluid_pulse.c index 53d1d573..2c0fcbe5 100644 --- a/fluidsynth/src/fluid_pulse.c +++ b/fluidsynth/src/fluid_pulse.c @@ -87,7 +87,7 @@ new_fluid_pulse_audio_driver2(fluid_settings_t* settings, char *device = NULL; pthread_attr_t attr; struct sched_param priority; - int realtime_prio; + int realtime_prio = 0; int sched; int err; @@ -106,8 +106,7 @@ new_fluid_pulse_audio_driver2(fluid_settings_t* settings, fluid_settings_dupstr(settings, "audio.pulseaudio.device", &device); /* ++ alloc device string */ fluid_settings_getint (settings, "audio.realtime-prio", &realtime_prio); - fluid_settings_getint (settings, "audio.realtime", &sched); - if (sched) + if (realtime_prio > 0) sched = SCHED_FIFO; else sched = SCHED_OTHER; @@ -179,7 +178,7 @@ new_fluid_pulse_audio_driver2(fluid_settings_t* settings, } /* SCHED_FIFO will not be active without setting the priority */ - priority.sched_priority = (sched == SCHED_FIFO) ? realtime_prio : 0; + priority.sched_priority = realtime_prio; pthread_attr_setschedparam(&attr, &priority); err = pthread_create(&dev->thread, &attr, diff --git a/fluidsynth/src/fluid_synth.c b/fluidsynth/src/fluid_synth.c index a4333287..7cdb9bf1 100644 --- a/fluidsynth/src/fluid_synth.c +++ b/fluidsynth/src/fluid_synth.c @@ -735,7 +735,7 @@ new_fluid_synth(fluid_settings_t *settings) /* Initialize multi-core variables if multiple cores enabled */ if (synth->cores > 1) { - int prio, prio_level; + int prio_level = 0, prio; synth->core_mutex = new_fluid_cond_mutex (); synth->core_cond = new_fluid_cond (); @@ -761,18 +761,11 @@ new_fluid_synth(fluid_settings_t *settings) for (i = 0; i < synth->polyphony; i++) synth->core_voice_processed[i] = NULL; - fluid_settings_getint (synth->settings, "audio.realtime", &prio); + fluid_settings_getint (synth->settings, "audio.realtime-prio", &prio_level); - if (prio) - { + if (prio_level > 0) prio = FLUID_THREAD_PRIO_HIGH; - fluid_settings_getint (synth->settings, "audio.realtime-prio", &prio_level); - } - else - { - prio = FLUID_THREAD_PRIO_NORMAL; - prio_level = 0; - } + else prio = FLUID_THREAD_PRIO_NORMAL; for (i = 0; i < synth->cores - 1; i++) { diff --git a/fluidsynth/src/fluidsynth_priv.h b/fluidsynth/src/fluidsynth_priv.h index 7027d8b3..5a3e8806 100644 --- a/fluidsynth/src/fluidsynth_priv.h +++ b/fluidsynth/src/fluidsynth_priv.h @@ -197,8 +197,8 @@ typedef struct _fluid_sample_timer_t fluid_sample_timer_t; #define FLUID_MAX_EVENTS_PER_BUFSIZE 1024 /**< Maximum queued MIDI events per #FLUID_BUFSIZE */ #define FLUID_MAX_RETURN_EVENTS 1024 /**< Maximum queued synthesis thread return events */ #define FLUID_MAX_EVENT_QUEUES 16 /**< Maximum number of unique threads queuing events */ -#define FLUID_DEFAULT_AUDIO_RT_PRIO 90 /**< Default setting for audio.realtime-prio */ -#define FLUID_DEFAULT_MIDI_RT_PRIO 80 /**< Default setting for midi.realtime-prio */ +#define FLUID_DEFAULT_AUDIO_RT_PRIO 60 /**< Default setting for audio.realtime-prio */ +#define FLUID_DEFAULT_MIDI_RT_PRIO 50 /**< Default setting for midi.realtime-prio */ #ifndef PI #define PI 3.141592654