mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-04-22 23:50:53 +00:00
Removed audio.realtime and midi.realtime boolean settings as suggested by David Henningsson. audio.realtime-prio and midi.realtime-prio now take 0 to disable high priority scheduling.
Updated docs and drivers relating to high priority settings. Adjusted default values of audio and MIDI high priority to 60 and 50 respectively. Changed doc/example.c to enable reset_presets option to fluid_synth_sfload(). Updated README-OSX from Ebrahim Mayat.
This commit is contained in:
parent
e49ccb7373
commit
f746e8d1ec
11 changed files with 57 additions and 109 deletions
|
@ -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 <http://fink.sourceforge.net>
|
||||
|
||||
- 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 <http://www.jackosx.com>
|
||||
- JackOSX.0.83.pkg.zip <http://www.jackosx.com>
|
||||
|
||||
- MIDI Patchbay 1.0.3 <http://www.apple.com/downloads/macosx/audio/index6.html>
|
||||
|
||||
|
@ -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 <http://fink.sourceforge.net>
|
||||
|
||||
|
@ -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 <emayat@users.sourceforge.net>
|
||||
8th March 2009
|
||||
29th October 2009
|
||||
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -596,24 +596,6 @@ There are a number of general audio driver settings. The audio.driver settings d
|
|||
<td>The size of the audio buffers (in frames).</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>audio.realtime</td>
|
||||
<td>Type</td>
|
||||
<td>boolean</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Default</td>
|
||||
<td>1 (TRUE)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Description</td>
|
||||
<td>Enables or disables realtime scheduling priority for
|
||||
audio driver and synthesis. Drivers which make use of this
|
||||
option: alsa, oss and pulseaudio</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>audio.realtime-prio</td>
|
||||
<td>Type</td>
|
||||
|
@ -622,18 +604,20 @@ There are a number of general audio driver settings. The audio.driver settings d
|
|||
<tr>
|
||||
<td></td>
|
||||
<td>Default</td>
|
||||
<td>90</td>
|
||||
<td>60</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Min-Max</td>
|
||||
<td>1-99</td>
|
||||
<td>0-99</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Description</td>
|
||||
<td>If audio.realtime is enabled, then this value is used for
|
||||
the realtime priority value (Linux only currently).</td>
|
||||
<td>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</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
@ -1083,24 +1067,6 @@ the MIDI subsystems used, which are described in a following table.
|
|||
<td>The MIDI system to be used.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>midi.realtime</td>
|
||||
<td>Type</td>
|
||||
<td>string</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Default</td>
|
||||
<td>"yes"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Description</td>
|
||||
<td>Enables or disables realtime scheduling priority for
|
||||
MIDI driver. Drivers which make use of this option:
|
||||
alsa_raw, alsa_seq, oss and pulseaudio</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>midi.realtime-prio</td>
|
||||
<td>Type</td>
|
||||
|
@ -1109,18 +1075,20 @@ the MIDI subsystems used, which are described in a following table.
|
|||
<tr>
|
||||
<td></td>
|
||||
<td>Default</td>
|
||||
<td>80</td>
|
||||
<td>50</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Min-Max</td>
|
||||
<td>1-99</td>
|
||||
<td>0-99</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Description</td>
|
||||
<td>If midi.realtime is enabled, then this value is used for
|
||||
the realtime priority value (Linux only currently).</td>
|
||||
<td>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</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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++)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue