mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-28 15:02:00 +00:00
Reverted char * -> const char * changes to function prototypes: fluid_log_function_t, fluid_default_log_function, fluid_settings_foreach_option_t, fluid_settings_foreach_t, fluid_server_newclient_func_t.
Removed WITHOUT_SERVER from src/config_win32.h.in (the right one this time). Added atomic value set/get functions for various channel parameters in fluid_chan.h. Removed shadow parameters in fluid_chorus_t (they weren't needed before). Merged fluid_chorus_update() into fluid_chorus_set(). Fixed crash bug in Jack driver related to last_client remaining set even if the client was deleted. fluid_mod_get_value() now uses new fluid_channel_get_* atomic macros. Synth gain, polyphony, channel pressure, pitch bend and pitch bend sensitivity are now assigned atomically AND querying the value will return the most recent assignment (fixes QSynth knob jumping issues), also changed many _LOCAL functions to update the current assigned value instead of passing the value via the event queue. Reverb and chorus shadow values set atomically and querying the values will return the most recently assigned ones (fixes QSynth knob jumping issues). Fixed bug in fluid_synth_process_event_queue_LOCAL() related to chorus parameter order. Added -Wno-cast-qual to get rid of warning of required cast from (const char *) to (char *).
This commit is contained in:
parent
8b231faab7
commit
5040b4bcb0
16 changed files with 231 additions and 290 deletions
|
@ -67,12 +67,12 @@ enum fluid_log_level {
|
|||
* @param message Log message text
|
||||
* @param data User data pointer supplied to fluid_set_log_function().
|
||||
*/
|
||||
typedef void (*fluid_log_function_t)(int level, const char* message, void* data);
|
||||
typedef void (*fluid_log_function_t)(int level, char* message, void* data);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
fluid_log_function_t fluid_set_log_function(int level, fluid_log_function_t fun, void* data);
|
||||
|
||||
FLUIDSYNTH_API void fluid_default_log_function(int level, const char* message, void* data);
|
||||
FLUIDSYNTH_API void fluid_default_log_function(int level, char* message, void* data);
|
||||
|
||||
FLUIDSYNTH_API int fluid_log(int level, const char *fmt, ...);
|
||||
|
||||
|
|
|
@ -188,8 +188,7 @@ void fluid_settings_getint_range(fluid_settings_t* settings, const char *name,
|
|||
* @param name Setting name
|
||||
* @param option A string option for this setting (iterates through the list)
|
||||
*/
|
||||
typedef void (*fluid_settings_foreach_option_t)(void *data, const char *name,
|
||||
const char *option);
|
||||
typedef void (*fluid_settings_foreach_option_t)(void *data, char *name, char *option);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
void fluid_settings_foreach_option(fluid_settings_t* settings,
|
||||
|
@ -207,7 +206,7 @@ FLUIDSYNTH_API char *fluid_settings_option_concat (fluid_settings_t* settings,
|
|||
* @param name Setting name
|
||||
* @param type Setting type (#fluid_types_enum)
|
||||
*/
|
||||
typedef void (*fluid_settings_foreach_t)(void *data, const char *name, int type);
|
||||
typedef void (*fluid_settings_foreach_t)(void *data, char *name, int type);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
void fluid_settings_foreach(fluid_settings_t* settings, void* data,
|
||||
|
|
|
@ -42,7 +42,14 @@ FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout(void);
|
|||
FLUIDSYNTH_API char* fluid_get_userconf(char* buf, int len);
|
||||
FLUIDSYNTH_API char* fluid_get_sysconf(char* buf, int len);
|
||||
|
||||
|
||||
/**
|
||||
* Command handler function prototype.
|
||||
* @param data User defined data
|
||||
* @param ac Argument count
|
||||
* @param av Array of string arguments
|
||||
* @param out Output stream to send response to
|
||||
* @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*/
|
||||
typedef int (*fluid_cmd_func_t)(void* data, int ac, char** av, fluid_ostream_t out);
|
||||
|
||||
/**
|
||||
|
@ -105,7 +112,7 @@ FLUIDSYNTH_API void delete_fluid_shell(fluid_shell_t* shell);
|
|||
* @param addr The IP address of the client (can be NULL)
|
||||
* @return Should return a new command handler for the connection (new_fluid_cmd_handler()).
|
||||
*/
|
||||
typedef fluid_cmd_handler_t* (*fluid_server_newclient_func_t)(void* data, const char* addr);
|
||||
typedef fluid_cmd_handler_t* (*fluid_server_newclient_func_t)(void* data, char* addr);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
fluid_server_t* new_fluid_server(fluid_settings_t* settings,
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
#pragma warning(disable : 4305)
|
||||
#pragma warning(disable : 4996)
|
||||
|
||||
#define WITHOUT_SERVER 1
|
||||
|
||||
#ifndef inline
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
|
|
@ -167,7 +167,6 @@ new_fluid_alsa_audio_driver2(fluid_settings_t* settings,
|
|||
double sample_rate;
|
||||
int periods, period_size;
|
||||
char* device = NULL;
|
||||
int sched;
|
||||
int realtime_prio = 0;
|
||||
int i, err, dir = 0;
|
||||
snd_pcm_hw_params_t* hwparams;
|
||||
|
@ -188,10 +187,6 @@ 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);
|
||||
|
||||
if (realtime_prio > 0)
|
||||
sched = SCHED_FIFO;
|
||||
else sched = SCHED_OTHER;
|
||||
|
||||
dev->data = data;
|
||||
dev->callback = func;
|
||||
dev->cont = 1;
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
*
|
||||
* Synthesis thread context only:
|
||||
* preset
|
||||
* key_pressure
|
||||
* tuning
|
||||
* nrpn_select
|
||||
* nrpn_active
|
||||
|
@ -45,6 +44,7 @@
|
|||
*
|
||||
* Uses atomic operations:
|
||||
* sfont_bank_prog
|
||||
* key_pressure
|
||||
* channel_pressure
|
||||
* pitch_bend
|
||||
* pitch_wheel_sensitivity
|
||||
|
@ -117,8 +117,23 @@ int fluid_channel_get_interp_method(fluid_channel_t* chan);
|
|||
#define fluid_channel_get_preset(chan) ((chan)->preset)
|
||||
#define fluid_channel_set_cc(chan, num, val) \
|
||||
fluid_atomic_int_set (&(chan)->cc[num], val)
|
||||
#define fluid_channel_get_cc(chan, num) \
|
||||
fluid_atomic_int_get (&(chan)->cc[num])
|
||||
#define fluid_channel_get_cc(chan, num) fluid_atomic_int_get (&(chan)->cc[num])
|
||||
#define fluid_channel_get_key_pressure(chan) \
|
||||
fluid_atomic_int_get (&(chan)->key_pressure)
|
||||
#define fluid_channel_set_key_pressure(chan, val) \
|
||||
fluid_atomic_int_set (&(chan)->key_pressure, val)
|
||||
#define fluid_channel_get_channel_pressure(chan) \
|
||||
fluid_atomic_int_get (&(chan)->channel_pressure)
|
||||
#define fluid_channel_set_channel_pressure(chan, val) \
|
||||
fluid_atomic_int_set (&(chan)->channel_pressure, val)
|
||||
#define fluid_channel_get_pitch_bend(chan) \
|
||||
fluid_atomic_int_get (&(chan)->pitch_bend)
|
||||
#define fluid_channel_set_pitch_bend(chan, val) \
|
||||
fluid_atomic_int_set (&(chan)->pitch_bend, val)
|
||||
#define fluid_channel_get_pitch_wheel_sensitivity(chan) \
|
||||
fluid_atomic_int_get (&(chan)->pitch_wheel_sensitivity)
|
||||
#define fluid_channel_set_pitch_wheel_sensitivity(chan, val) \
|
||||
fluid_atomic_int_set (&(chan)->pitch_wheel_sensitivity, val)
|
||||
#define fluid_channel_get_num(chan) ((chan)->channum)
|
||||
#define fluid_channel_set_interp_method(chan, new_method) \
|
||||
fluid_atomic_int_set (&(chan)->interp_method, new_method)
|
||||
|
|
|
@ -104,24 +104,11 @@
|
|||
|
||||
/* Private data for SKEL file */
|
||||
struct _fluid_chorus_t {
|
||||
/* Store the values between fluid_chorus_set_xxx and fluid_chorus_update
|
||||
* Logic behind this:
|
||||
* - both 'parameter' and 'new_parameter' hold the same value.
|
||||
* - To change the chorus settings, 'new_parameter' is modified and
|
||||
* fluid_chorus_update is called.
|
||||
* - If the new value is valid, it is copied to 'parameter'.
|
||||
* - If it is invalid, 'new_parameter' is restored to 'parameter'.
|
||||
*/
|
||||
int type; /* current value */
|
||||
int new_type; /* next value, if parameter check is OK */
|
||||
fluid_real_t depth_ms; /* current value */
|
||||
fluid_real_t new_depth_ms; /* next value, if parameter check is OK */
|
||||
fluid_real_t level; /* current value */
|
||||
fluid_real_t new_level; /* next value, if parameter check is OK */
|
||||
fluid_real_t speed_Hz; /* current value */
|
||||
fluid_real_t new_speed_Hz; /* next value, if parameter check is OK */
|
||||
int number_blocks; /* current value */
|
||||
int new_number_blocks; /* next value, if parameter check is OK */
|
||||
int type;
|
||||
fluid_real_t depth_ms;
|
||||
fluid_real_t level;
|
||||
fluid_real_t speed_Hz;
|
||||
int number_blocks;
|
||||
|
||||
fluid_real_t *chorusbuf;
|
||||
int counter;
|
||||
|
@ -134,7 +121,6 @@ struct _fluid_chorus_t {
|
|||
fluid_real_t sinc_table[INTERPOLATION_SAMPLES][INTERPOLATION_SUBSAMPLES];
|
||||
};
|
||||
|
||||
static void fluid_chorus_update(fluid_chorus_t* chorus);
|
||||
static void fluid_chorus_triangle(int *buf, int len, int depth);
|
||||
static void fluid_chorus_sine(int *buf, int len, int depth);
|
||||
|
||||
|
@ -260,62 +246,55 @@ void
|
|||
fluid_chorus_set(fluid_chorus_t* chorus, int set, int nr, float level,
|
||||
float speed, float depth_ms, int type)
|
||||
{
|
||||
if (set & FLUID_CHORUS_SET_NR) chorus->new_number_blocks = nr;
|
||||
if (set & FLUID_CHORUS_SET_LEVEL) chorus->new_level = level;
|
||||
if (set & FLUID_CHORUS_SET_SPEED) chorus->new_speed_Hz = speed;
|
||||
if (set & FLUID_CHORUS_SET_DEPTH) chorus->new_depth_ms = depth_ms;
|
||||
if (set & FLUID_CHORUS_SET_TYPE) chorus->new_type = type;
|
||||
|
||||
fluid_chorus_update (chorus);
|
||||
}
|
||||
|
||||
/* Purpose:
|
||||
* Calculates the internal chorus parameters. */
|
||||
static void
|
||||
fluid_chorus_update(fluid_chorus_t* chorus)
|
||||
{
|
||||
int i;
|
||||
int modulation_depth_samples;
|
||||
int i;
|
||||
|
||||
if (chorus->new_number_blocks < 0) {
|
||||
if (set & FLUID_CHORUS_SET_NR) chorus->number_blocks = nr;
|
||||
if (set & FLUID_CHORUS_SET_LEVEL) chorus->level = level;
|
||||
if (set & FLUID_CHORUS_SET_SPEED) chorus->speed_Hz = speed;
|
||||
if (set & FLUID_CHORUS_SET_DEPTH) chorus->depth_ms = depth_ms;
|
||||
if (set & FLUID_CHORUS_SET_TYPE) chorus->type = type;
|
||||
|
||||
if (chorus->number_blocks < 0) {
|
||||
fluid_log(FLUID_WARN, "chorus: number blocks must be >=0! Setting value to 0.");
|
||||
chorus->new_number_blocks = 0;
|
||||
} else if (chorus->new_number_blocks > MAX_CHORUS) {
|
||||
chorus->number_blocks = 0;
|
||||
} else if (chorus->number_blocks > MAX_CHORUS) {
|
||||
fluid_log(FLUID_WARN, "chorus: number blocks larger than max. allowed! Setting value to %d.",
|
||||
MAX_CHORUS);
|
||||
chorus->new_number_blocks = MAX_CHORUS;
|
||||
};
|
||||
chorus->number_blocks = MAX_CHORUS;
|
||||
}
|
||||
|
||||
if (chorus->new_speed_Hz < MIN_SPEED_HZ) {
|
||||
if (chorus->speed_Hz < MIN_SPEED_HZ) {
|
||||
fluid_log(FLUID_WARN, "chorus: speed is too low (min %f)! Setting value to min.",
|
||||
(double) MIN_SPEED_HZ);
|
||||
chorus->new_speed_Hz = MIN_SPEED_HZ;
|
||||
} else if (chorus->new_speed_Hz > MAX_SPEED_HZ) {
|
||||
chorus->speed_Hz = MIN_SPEED_HZ;
|
||||
} else if (chorus->speed_Hz > MAX_SPEED_HZ) {
|
||||
fluid_log(FLUID_WARN, "chorus: speed must be below %f Hz! Setting value to max.",
|
||||
(double) MAX_SPEED_HZ);
|
||||
chorus->new_speed_Hz = MAX_SPEED_HZ;
|
||||
chorus->speed_Hz = MAX_SPEED_HZ;
|
||||
}
|
||||
if (chorus->new_depth_ms < 0.0) {
|
||||
|
||||
if (chorus->depth_ms < 0.0) {
|
||||
fluid_log(FLUID_WARN, "chorus: depth must be positive! Setting value to 0.");
|
||||
chorus->new_depth_ms = 0.0;
|
||||
chorus->depth_ms = 0.0;
|
||||
}
|
||||
/* Depth: Check for too high value through modulation_depth_samples. */
|
||||
|
||||
if (chorus->new_level < 0.0) {
|
||||
if (chorus->level < 0.0) {
|
||||
fluid_log(FLUID_WARN, "chorus: level must be positive! Setting value to 0.");
|
||||
chorus->new_level = 0.0;
|
||||
} else if (chorus->new_level > 10) {
|
||||
chorus->level = 0.0;
|
||||
} else if (chorus->level > 10) {
|
||||
fluid_log(FLUID_WARN, "chorus: level must be < 10. A reasonable level is << 1! "
|
||||
"Setting it to 0.1.");
|
||||
chorus->new_level = 0.1;
|
||||
chorus->level = 0.1;
|
||||
}
|
||||
|
||||
/* The modulating LFO goes through a full period every x samples: */
|
||||
chorus->modulation_period_samples = chorus->sample_rate / chorus->new_speed_Hz;
|
||||
chorus->modulation_period_samples = chorus->sample_rate / chorus->speed_Hz;
|
||||
|
||||
/* The variation in delay time is x: */
|
||||
modulation_depth_samples = (int)
|
||||
(chorus->new_depth_ms / 1000.0 /* convert modulation depth in ms to s*/
|
||||
(chorus->depth_ms / 1000.0 /* convert modulation depth in ms to s*/
|
||||
* chorus->sample_rate);
|
||||
|
||||
if (modulation_depth_samples > MAX_SAMPLES) {
|
||||
|
@ -335,7 +314,7 @@ fluid_chorus_update(fluid_chorus_t* chorus)
|
|||
chorus->type = FLUID_CHORUS_MOD_SINE;
|
||||
fluid_chorus_sine(chorus->lookup_tab, chorus->modulation_period_samples,
|
||||
modulation_depth_samples);
|
||||
};
|
||||
}
|
||||
|
||||
for (i = 0; i < chorus->number_blocks; i++) {
|
||||
/* Set the phase of the chorus blocks equally spaced */
|
||||
|
@ -345,12 +324,6 @@ fluid_chorus_update(fluid_chorus_t* chorus)
|
|||
|
||||
/* Start of the circular buffer */
|
||||
chorus->counter = 0;
|
||||
|
||||
chorus->type = chorus->new_type;
|
||||
chorus->depth_ms = chorus->new_depth_ms;
|
||||
chorus->level = chorus->new_level;
|
||||
chorus->speed_Hz = chorus->new_speed_Hz;
|
||||
chorus->number_blocks = chorus->new_number_blocks;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1334,7 +1334,7 @@ struct _fluid_handle_settings_data_t {
|
|||
fluid_ostream_t out;
|
||||
};
|
||||
|
||||
static void fluid_handle_settings_iter1(void* data, const char* name, int type)
|
||||
static void fluid_handle_settings_iter1(void* data, char* name, int type)
|
||||
{
|
||||
struct _fluid_handle_settings_data_t* d = (struct _fluid_handle_settings_data_t*) data;
|
||||
|
||||
|
@ -1344,7 +1344,7 @@ static void fluid_handle_settings_iter1(void* data, const char* name, int type)
|
|||
}
|
||||
}
|
||||
|
||||
static void fluid_handle_settings_iter2(void* data, const char* name, int type)
|
||||
static void fluid_handle_settings_iter2(void* data, char* name, int type)
|
||||
{
|
||||
struct _fluid_handle_settings_data_t* d = (struct _fluid_handle_settings_data_t*) data;
|
||||
|
||||
|
@ -1404,7 +1404,7 @@ struct _fluid_handle_option_data_t {
|
|||
fluid_ostream_t out;
|
||||
};
|
||||
|
||||
void fluid_handle_print_option(void* data, const char* name, const char* option)
|
||||
void fluid_handle_print_option(void* data, char* name, char* option)
|
||||
{
|
||||
struct _fluid_handle_option_data_t* d = (struct _fluid_handle_option_data_t*) data;
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
enum fluid_event_queue_elem
|
||||
{
|
||||
FLUID_EVENT_QUEUE_ELEM_MIDI, /**< MIDI event. Uses midi field of event value */
|
||||
FLUID_EVENT_QUEUE_ELEM_GAIN, /**< Synth gain set or return event. Uses dval field of event value */
|
||||
FLUID_EVENT_QUEUE_ELEM_POLYPHONY, /**< Synth polyphony event. Uses ival field of event value */
|
||||
FLUID_EVENT_QUEUE_ELEM_UPDATE_GAIN, /**< Update synthesizer gain. No payload value */
|
||||
FLUID_EVENT_QUEUE_ELEM_POLYPHONY, /**< Synth polyphony event. No payload value */
|
||||
FLUID_EVENT_QUEUE_ELEM_GEN, /**< Generator event. Uses gen field of event value */
|
||||
FLUID_EVENT_QUEUE_ELEM_PRESET, /**< Preset set event. Uses preset field of event value */
|
||||
FLUID_EVENT_QUEUE_ELEM_STOP_VOICES, /**< Stop voices event. Uses ival field of event value */
|
||||
|
|
|
@ -92,6 +92,8 @@ int fluid_jack_driver_process(jack_nframes_t nframes, void *arg);
|
|||
int delete_fluid_jack_midi_driver(fluid_midi_driver_t *p);
|
||||
|
||||
|
||||
static fluid_mutex_t last_client_mutex = G_STATIC_MUTEX_INIT; /* Probably not necessary, but just in case drivers are created by multiple threads */
|
||||
static fluid_jack_client_t *last_client = NULL; /* Last unpaired client. For audio/MIDI driver pairing. */
|
||||
|
||||
|
||||
void
|
||||
|
@ -114,8 +116,6 @@ fluid_jack_audio_driver_settings(fluid_settings_t* settings)
|
|||
static fluid_jack_client_t *
|
||||
new_fluid_jack_client (fluid_settings_t *settings, int isaudio, void *driver)
|
||||
{
|
||||
static fluid_mutex_t mutex = G_STATIC_MUTEX_INIT; /* Probably not necessary, but just in case drivers are created by multiple threads */
|
||||
static fluid_jack_client_t *last_client = NULL; /* Last unpaired client. For audio/MIDI driver pairing. */
|
||||
fluid_jack_client_t *client_ref = NULL;
|
||||
char *server = NULL;
|
||||
char* client_name;
|
||||
|
@ -124,7 +124,7 @@ new_fluid_jack_client (fluid_settings_t *settings, int isaudio, void *driver)
|
|||
fluid_settings_dupstr (settings, isaudio ? "audio.jack.server" /* ++ alloc server name */
|
||||
: "midi.jack.server", &server);
|
||||
|
||||
fluid_mutex_lock (mutex); /* ++ lock last_client */
|
||||
fluid_mutex_lock (last_client_mutex); /* ++ lock last_client */
|
||||
|
||||
/* If the last client uses the same server and is not the same type (audio or MIDI),
|
||||
* then re-use the client. */
|
||||
|
@ -142,7 +142,7 @@ new_fluid_jack_client (fluid_settings_t *settings, int isaudio, void *driver)
|
|||
if (isaudio) fluid_atomic_pointer_set (&client_ref->audio_driver, driver);
|
||||
else fluid_atomic_pointer_set (&client_ref->midi_driver, driver);
|
||||
|
||||
fluid_mutex_unlock (mutex); /* -- unlock last_client */
|
||||
fluid_mutex_unlock (last_client_mutex); /* -- unlock last_client */
|
||||
|
||||
if (server) FLUID_FREE (server);
|
||||
|
||||
|
@ -216,7 +216,7 @@ new_fluid_jack_client (fluid_settings_t *settings, int isaudio, void *driver)
|
|||
if (isaudio) fluid_atomic_pointer_set (&client_ref->audio_driver, driver);
|
||||
else fluid_atomic_pointer_set (&client_ref->midi_driver, driver);
|
||||
|
||||
fluid_mutex_unlock (mutex); /* -- unlock last_client */
|
||||
fluid_mutex_unlock (last_client_mutex); /* -- unlock last_client */
|
||||
|
||||
if (server) FLUID_FREE (server);
|
||||
|
||||
|
@ -224,7 +224,7 @@ new_fluid_jack_client (fluid_settings_t *settings, int isaudio, void *driver)
|
|||
|
||||
error_recovery:
|
||||
|
||||
fluid_mutex_unlock (mutex); /* -- unlock clients list */
|
||||
fluid_mutex_unlock (last_client_mutex); /* -- unlock clients list */
|
||||
if (server) FLUID_FREE (server); /* -- free server name */
|
||||
|
||||
if (client_ref)
|
||||
|
@ -340,6 +340,13 @@ fluid_jack_client_close (fluid_jack_client_t *client_ref, void *driver)
|
|||
return;
|
||||
}
|
||||
|
||||
fluid_mutex_lock (last_client_mutex);
|
||||
|
||||
if (client_ref == last_client)
|
||||
last_client = NULL;
|
||||
|
||||
fluid_mutex_unlock (last_client_mutex);
|
||||
|
||||
if (client_ref->client)
|
||||
jack_client_close (client_ref->client);
|
||||
|
||||
|
|
|
@ -224,17 +224,17 @@ fluid_mod_get_value(fluid_mod_t* mod, fluid_channel_t* chan, fluid_voice_t* voic
|
|||
v1 = voice->key;
|
||||
break;
|
||||
case FLUID_MOD_KEYPRESSURE:
|
||||
v1 = chan->key_pressure;
|
||||
v1 = fluid_channel_get_key_pressure (chan);
|
||||
break;
|
||||
case FLUID_MOD_CHANNELPRESSURE:
|
||||
v1 = chan->channel_pressure;
|
||||
v1 = fluid_channel_get_channel_pressure (chan);
|
||||
break;
|
||||
case FLUID_MOD_PITCHWHEEL:
|
||||
v1 = chan->pitch_bend;
|
||||
v1 = fluid_channel_get_pitch_bend (chan);
|
||||
range1 = 0x4000;
|
||||
break;
|
||||
case FLUID_MOD_PITCHWHEELSENS:
|
||||
v1 = chan->pitch_wheel_sensitivity;
|
||||
v1 = fluid_channel_get_pitch_wheel_sensitivity (chan);
|
||||
break;
|
||||
default:
|
||||
v1 = 0.0;
|
||||
|
@ -317,16 +317,16 @@ fluid_mod_get_value(fluid_mod_t* mod, fluid_channel_t* chan, fluid_voice_t* voic
|
|||
v2 = voice->key;
|
||||
break;
|
||||
case FLUID_MOD_KEYPRESSURE:
|
||||
v2 = chan->key_pressure;
|
||||
v2 = fluid_channel_get_key_pressure (chan);
|
||||
break;
|
||||
case FLUID_MOD_CHANNELPRESSURE:
|
||||
v2 = chan->channel_pressure;
|
||||
v2 = fluid_channel_get_channel_pressure (chan);
|
||||
break;
|
||||
case FLUID_MOD_PITCHWHEEL:
|
||||
v2 = chan->pitch_bend;
|
||||
v2 = fluid_channel_get_pitch_bend (chan);
|
||||
break;
|
||||
case FLUID_MOD_PITCHWHEELSENS:
|
||||
v2 = chan->pitch_wheel_sensitivity;
|
||||
v2 = fluid_channel_get_pitch_wheel_sensitivity (chan);
|
||||
break;
|
||||
default:
|
||||
v1 = 0.0f;
|
||||
|
|
|
@ -1376,7 +1376,7 @@ fluid_settings_foreach_option (fluid_settings_t* settings, const char *name,
|
|||
newlist = fluid_list_sort (newlist, fluid_list_str_compare_func);
|
||||
|
||||
for (p = newlist; p; p = p->next)
|
||||
(*func)(data, name, (const char *)fluid_list_get (p));
|
||||
(*func)(data, (char *)name, (char *)fluid_list_get (p));
|
||||
|
||||
fluid_rec_mutex_unlock (settings->mutex); /* -- unlock */
|
||||
|
||||
|
@ -1564,7 +1564,7 @@ fluid_settings_foreach (fluid_settings_t* settings, void* data,
|
|||
for (p = bag.names; p; p = p->next)
|
||||
{
|
||||
r = fluid_settings_get (settings, (char *)(p->data), &node);
|
||||
if (r && node) (*func) (data, (const char *)(p->data), node->type);
|
||||
if (r && node) (*func) (data, (char *)(p->data), node->type);
|
||||
FLUID_FREE (p->data); /* -- Free name */
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ static int fluid_synth_queue_midi_event (fluid_synth_t* synth, int type, int cha
|
|||
int param1, int param2);
|
||||
static int fluid_synth_queue_gen_event (fluid_synth_t* synth, int chan,
|
||||
int param, float value, int absolute);
|
||||
static int fluid_synth_queue_float_event (fluid_synth_t* synth, int type, float val);
|
||||
static int fluid_synth_queue_int_event (fluid_synth_t* synth, int type, int val);
|
||||
static void fluid_synth_thread_queue_destroy_notify (void *data);
|
||||
static int fluid_synth_noteon_LOCAL(fluid_synth_t* synth, int chan, int key,
|
||||
|
@ -71,11 +70,9 @@ static int fluid_synth_system_reset_LOCAL(fluid_synth_t* synth);
|
|||
static int fluid_synth_modulate_voices_LOCAL(fluid_synth_t* synth, int chan,
|
||||
int is_cc, int ctrl);
|
||||
static int fluid_synth_modulate_voices_all_LOCAL(fluid_synth_t* synth, int chan);
|
||||
static int fluid_synth_channel_pressure_LOCAL(fluid_synth_t* synth, int channum,
|
||||
int val);
|
||||
static int fluid_synth_pitch_bend_LOCAL(fluid_synth_t* synth, int chan, int val);
|
||||
static int fluid_synth_pitch_wheel_sens_LOCAL(fluid_synth_t* synth, int chan,
|
||||
int val);
|
||||
static int fluid_synth_update_channel_pressure_LOCAL(fluid_synth_t* synth, int channum);
|
||||
static int fluid_synth_update_pitch_bend_LOCAL(fluid_synth_t* synth, int chan);
|
||||
static int fluid_synth_update_pitch_wheel_sens_LOCAL(fluid_synth_t* synth, int chan);
|
||||
static int fluid_synth_set_preset (fluid_synth_t *synth, int chan,
|
||||
fluid_preset_t *preset);
|
||||
static int fluid_synth_set_preset_LOCAL (fluid_synth_t *synth, int chan,
|
||||
|
@ -90,10 +87,10 @@ fluid_synth_get_preset_by_sfont_name(fluid_synth_t* synth, const char *sfontname
|
|||
static void fluid_synth_update_presets(fluid_synth_t* synth);
|
||||
static int fluid_synth_update_gain(fluid_synth_t* synth,
|
||||
char* name, double value);
|
||||
static void fluid_synth_set_gain_LOCAL(fluid_synth_t* synth, float gain);
|
||||
static void fluid_synth_update_gain_LOCAL(fluid_synth_t* synth);
|
||||
static int fluid_synth_update_polyphony(fluid_synth_t* synth,
|
||||
char* name, int value);
|
||||
static int fluid_synth_set_polyphony_LOCAL(fluid_synth_t* synth, int polyphony);
|
||||
static int fluid_synth_update_polyphony_LOCAL(fluid_synth_t* synth);
|
||||
static void init_dither(void);
|
||||
static inline int roundi (float x);
|
||||
static int fluid_synth_one_block(fluid_synth_t* synth, int do_not_mix_fx_to_out);
|
||||
|
@ -499,9 +496,10 @@ int delete_fluid_sample_timer(fluid_synth_t* synth, fluid_sample_timer_t* timer)
|
|||
fluid_synth_t*
|
||||
new_fluid_synth(fluid_settings_t *settings)
|
||||
{
|
||||
int i;
|
||||
fluid_synth_t* synth;
|
||||
fluid_sfloader_t* loader;
|
||||
double gain;
|
||||
int i;
|
||||
|
||||
/* initialize all the conversion tables and other stuff */
|
||||
if (fluid_synth_initialized == 0) {
|
||||
|
@ -539,7 +537,8 @@ new_fluid_synth(fluid_settings_t *settings)
|
|||
fluid_settings_getint(settings, "synth.audio-channels", &synth->audio_channels);
|
||||
fluid_settings_getint(settings, "synth.audio-groups", &synth->audio_groups);
|
||||
fluid_settings_getint(settings, "synth.effects-channels", &synth->effects_channels);
|
||||
fluid_settings_getnum(settings, "synth.gain", &synth->gain);
|
||||
fluid_settings_getnum(settings, "synth.gain", &gain);
|
||||
synth->gain = gain;
|
||||
fluid_settings_getint(settings, "synth.device-id", &synth->device_id);
|
||||
fluid_settings_getint(settings, "synth.cpu-cores", &synth->cores);
|
||||
|
||||
|
@ -797,27 +796,34 @@ fluid_synth_return_event_process_callback (void* data, unsigned int msec)
|
|||
{
|
||||
switch (event->type)
|
||||
{
|
||||
case FLUID_EVENT_QUEUE_ELEM_GAIN: /* Sync gain variable */
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock gain variable */
|
||||
synth->gain = event->dval;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
break;
|
||||
case FLUID_EVENT_QUEUE_ELEM_REVERB: /* Sync reverb shadow variables */
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock reverb shadow variables */
|
||||
synth->reverb_roomsize = event->reverb.roomsize;
|
||||
synth->reverb_damping = event->reverb.damping;
|
||||
synth->reverb_width = event->reverb.width;
|
||||
synth->reverb_level = event->reverb.level;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
if (event->reverb.set & FLUID_REVMODEL_SET_ROOMSIZE)
|
||||
fluid_atomic_float_set (&synth->reverb_roomsize, event->reverb.roomsize);
|
||||
|
||||
if (event->reverb.set & FLUID_REVMODEL_SET_DAMPING)
|
||||
fluid_atomic_float_set (&synth->reverb_damping, event->reverb.damping);
|
||||
|
||||
if (event->reverb.set & FLUID_REVMODEL_SET_WIDTH)
|
||||
fluid_atomic_float_set (&synth->reverb_width, event->reverb.width);
|
||||
|
||||
if (event->reverb.set & FLUID_REVMODEL_SET_LEVEL)
|
||||
fluid_atomic_float_set (&synth->reverb_level, event->reverb.level);
|
||||
break;
|
||||
case FLUID_EVENT_QUEUE_ELEM_CHORUS: /* Sync chorus shadow variables */
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock chorus shadow variables */
|
||||
synth->chorus_nr = event->chorus.nr;
|
||||
synth->chorus_level = event->chorus.level;
|
||||
synth->chorus_speed = event->chorus.speed;
|
||||
synth->chorus_depth = event->chorus.depth;
|
||||
synth->chorus_type = event->chorus.type;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
if (event->chorus.set & FLUID_CHORUS_SET_NR)
|
||||
fluid_atomic_int_set (&synth->chorus_nr, event->chorus.nr);
|
||||
|
||||
if (event->chorus.set & FLUID_CHORUS_SET_LEVEL)
|
||||
fluid_atomic_float_set (&synth->chorus_level, event->chorus.level);
|
||||
|
||||
if (event->chorus.set & FLUID_CHORUS_SET_SPEED)
|
||||
fluid_atomic_float_set (&synth->chorus_speed, event->chorus.speed);
|
||||
|
||||
if (event->chorus.set & FLUID_CHORUS_SET_DEPTH)
|
||||
fluid_atomic_float_set (&synth->chorus_depth, event->chorus.depth);
|
||||
|
||||
if (event->chorus.set & FLUID_CHORUS_SET_TYPE)
|
||||
fluid_atomic_int_set (&synth->chorus_type, event->chorus.type);
|
||||
break;
|
||||
case FLUID_EVENT_QUEUE_ELEM_FREE_PRESET: /* Preset free event */
|
||||
preset = (fluid_preset_t *)(event->pval);
|
||||
|
@ -1187,30 +1193,6 @@ fluid_synth_queue_gen_event (fluid_synth_t* synth, int chan,
|
|||
return FLUID_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queues an event with a floating point value payload.
|
||||
* @param synth FluidSynth instance
|
||||
* @param type Event type (#fluid_event_queue_elem)
|
||||
* @param val Event value
|
||||
* @return FLUID_OK on success, FLUID_FAILED otherwise
|
||||
*/
|
||||
static int
|
||||
fluid_synth_queue_float_event (fluid_synth_t* synth, int type, float val)
|
||||
{
|
||||
fluid_event_queue_t *queue;
|
||||
fluid_event_queue_elem_t *event;
|
||||
|
||||
event = fluid_synth_get_event_elem (synth, &queue);
|
||||
if (!event) return FLUID_FAILED;
|
||||
|
||||
event->type = type;
|
||||
event->dval = val;
|
||||
|
||||
fluid_event_queue_next_inptr (queue);
|
||||
|
||||
return FLUID_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queues an event with an integer value payload.
|
||||
* @param synth FluidSynth instance
|
||||
|
@ -1474,8 +1456,9 @@ fluid_synth_cc_real (fluid_synth_t* synth, int channum, int num, int value,
|
|||
{
|
||||
switch (rpn_lsb)
|
||||
{
|
||||
case RPN_PITCH_BEND_RANGE:
|
||||
fluid_synth_pitch_wheel_sens_LOCAL (synth, channum, value); /* Set bend range in semitones */
|
||||
case RPN_PITCH_BEND_RANGE: /* Set bend range in semitones */
|
||||
fluid_channel_set_pitch_wheel_sensitivity (synth->channel[channum], value);
|
||||
fluid_synth_update_pitch_wheel_sens_LOCAL (synth, channum); /* Update bend range */
|
||||
/* FIXME - Handle LSB? (Fine bend range in cents) */
|
||||
break;
|
||||
case RPN_CHANNEL_FINE_TUNE: /* Fine tune is 14 bit over 1 semitone (+/- 50 cents, 8192 = center) */
|
||||
|
@ -1998,19 +1981,20 @@ fluid_synth_channel_pressure(fluid_synth_t* synth, int chan, int val)
|
|||
fluid_return_val_if_fail (chan >= 0 && chan < synth->midi_channels, FLUID_FAILED);
|
||||
fluid_return_val_if_fail (val >= 0 && val <= 127, FLUID_FAILED);
|
||||
|
||||
if (fluid_synth_should_queue (synth))
|
||||
return fluid_synth_queue_midi_event (synth, CHANNEL_PRESSURE, chan, val, 0);
|
||||
else return fluid_synth_channel_pressure_LOCAL (synth, chan, val);
|
||||
}
|
||||
|
||||
/* Local synthesis thread variant of channel pressure set */
|
||||
static int
|
||||
fluid_synth_channel_pressure_LOCAL(fluid_synth_t* synth, int chan, int val)
|
||||
{
|
||||
if (synth->verbose)
|
||||
FLUID_LOG(FLUID_INFO, "channelpressure\t%d\t%d", chan, val);
|
||||
|
||||
fluid_atomic_int_set (&synth->channel[chan]->channel_pressure, val);
|
||||
fluid_channel_set_channel_pressure (synth->channel[chan], val);
|
||||
|
||||
if (fluid_synth_should_queue (synth))
|
||||
return fluid_synth_queue_midi_event (synth, CHANNEL_PRESSURE, chan, 0, 0);
|
||||
else return fluid_synth_update_channel_pressure_LOCAL (synth, chan);
|
||||
}
|
||||
|
||||
/* Updates channel pressure from within synthesis thread */
|
||||
static int
|
||||
fluid_synth_update_channel_pressure_LOCAL(fluid_synth_t* synth, int chan)
|
||||
{
|
||||
return fluid_synth_modulate_voices_LOCAL (synth, chan, 0, FLUID_MOD_CHANNELPRESSURE);
|
||||
}
|
||||
|
||||
|
@ -2028,19 +2012,20 @@ fluid_synth_pitch_bend(fluid_synth_t* synth, int chan, int val)
|
|||
fluid_return_val_if_fail (chan >= 0 && chan < synth->midi_channels, FLUID_FAILED);
|
||||
fluid_return_val_if_fail (val >= 0 && val <= 16383, FLUID_FAILED);
|
||||
|
||||
if (synth->verbose)
|
||||
FLUID_LOG(FLUID_INFO, "pitchb\t%d\t%d", chan, val);
|
||||
|
||||
fluid_channel_set_pitch_bend (synth->channel[chan], val);
|
||||
|
||||
if (fluid_synth_should_queue (synth))
|
||||
return fluid_synth_queue_midi_event (synth, PITCH_BEND, chan, val, 0);
|
||||
else return fluid_synth_pitch_bend_LOCAL (synth, chan, val);
|
||||
return fluid_synth_queue_midi_event (synth, PITCH_BEND, chan, 0, 0);
|
||||
else return fluid_synth_update_pitch_bend_LOCAL (synth, chan);
|
||||
}
|
||||
|
||||
/* Local synthesis thread variant of pitch bend */
|
||||
static int
|
||||
fluid_synth_pitch_bend_LOCAL(fluid_synth_t* synth, int chan, int val)
|
||||
fluid_synth_update_pitch_bend_LOCAL(fluid_synth_t* synth, int chan)
|
||||
{
|
||||
if (synth->verbose)
|
||||
FLUID_LOG(FLUID_INFO, "pitchb\t%d\t%d", chan, val);
|
||||
|
||||
fluid_atomic_int_set (&synth->channel[chan]->pitch_bend, val);
|
||||
return fluid_synth_modulate_voices_LOCAL (synth, chan, 0, FLUID_MOD_PITCHWHEEL);
|
||||
}
|
||||
|
||||
|
@ -2059,7 +2044,7 @@ fluid_synth_get_pitch_bend(fluid_synth_t* synth, int chan, int* ppitch_bend)
|
|||
fluid_return_val_if_fail (chan >= 0 && chan < synth->midi_channels, FLUID_FAILED);
|
||||
fluid_return_val_if_fail (ppitch_bend != NULL, FLUID_FAILED);
|
||||
|
||||
*ppitch_bend = fluid_atomic_int_get (&synth->channel[chan]->pitch_bend);
|
||||
*ppitch_bend = fluid_channel_get_pitch_bend (synth->channel[chan]);
|
||||
return FLUID_OK;
|
||||
}
|
||||
|
||||
|
@ -2077,20 +2062,21 @@ fluid_synth_pitch_wheel_sens(fluid_synth_t* synth, int chan, int val)
|
|||
fluid_return_val_if_fail (chan >= 0 && chan < synth->midi_channels, FLUID_FAILED);
|
||||
fluid_return_val_if_fail (val >= 0 && val <= 72, FLUID_FAILED); /* 6 octaves!? Better than no limit.. */
|
||||
|
||||
if (synth->verbose)
|
||||
FLUID_LOG(FLUID_INFO, "pitchsens\t%d\t%d", chan, val);
|
||||
|
||||
fluid_channel_set_pitch_wheel_sensitivity (synth->channel[chan], val);
|
||||
|
||||
if (fluid_synth_should_queue (synth))
|
||||
return fluid_synth_queue_midi_event (synth, RPN_LSB, chan,
|
||||
RPN_PITCH_BEND_RANGE, val);
|
||||
else return fluid_synth_pitch_wheel_sens_LOCAL (synth, chan, val);
|
||||
else return fluid_synth_update_pitch_wheel_sens_LOCAL (synth, chan);
|
||||
}
|
||||
|
||||
/* Local synthesis thread variant of set pitch wheel sensitivity */
|
||||
static int
|
||||
fluid_synth_pitch_wheel_sens_LOCAL(fluid_synth_t* synth, int chan, int val)
|
||||
fluid_synth_update_pitch_wheel_sens_LOCAL(fluid_synth_t* synth, int chan)
|
||||
{
|
||||
if (synth->verbose)
|
||||
FLUID_LOG(FLUID_INFO, "pitchsens\t%d\t%d", chan, val);
|
||||
|
||||
fluid_atomic_int_set (&synth->channel[chan]->pitch_wheel_sensitivity, val);
|
||||
return fluid_synth_modulate_voices_LOCAL (synth, chan, 0, FLUID_MOD_PITCHWHEELSENS);
|
||||
}
|
||||
|
||||
|
@ -2109,7 +2095,7 @@ fluid_synth_get_pitch_wheel_sens(fluid_synth_t* synth, int chan, int* pval)
|
|||
fluid_return_val_if_fail (chan >= 0 && chan < synth->midi_channels, FLUID_FAILED);
|
||||
fluid_return_val_if_fail (pval != NULL, FLUID_FAILED);
|
||||
|
||||
*pval = fluid_atomic_int_get (&synth->channel[chan]->pitch_wheel_sensitivity);
|
||||
*pval = fluid_channel_get_pitch_wheel_sensitivity (synth->channel[chan]);
|
||||
return FLUID_OK;
|
||||
}
|
||||
|
||||
|
@ -2505,19 +2491,21 @@ fluid_synth_set_gain(fluid_synth_t* synth, float gain)
|
|||
|
||||
fluid_clip (gain, 0.0f, 10.0f);
|
||||
|
||||
fluid_atomic_float_set (&synth->gain, gain);
|
||||
|
||||
if (fluid_synth_should_queue (synth))
|
||||
fluid_synth_queue_float_event (synth, FLUID_EVENT_QUEUE_ELEM_GAIN, gain);
|
||||
else fluid_synth_set_gain_LOCAL (synth, gain);
|
||||
fluid_synth_queue_int_event (synth, FLUID_EVENT_QUEUE_ELEM_UPDATE_GAIN, 0); /* Integer value not actually used */
|
||||
else fluid_synth_update_gain_LOCAL (synth);
|
||||
}
|
||||
|
||||
/* Called by synthesis thread to update the gain in all voices */
|
||||
static void
|
||||
fluid_synth_set_gain_LOCAL(fluid_synth_t* synth, float gain)
|
||||
fluid_synth_update_gain_LOCAL(fluid_synth_t* synth)
|
||||
{
|
||||
fluid_event_queue_elem_t *event;
|
||||
float gain;
|
||||
int i;
|
||||
|
||||
synth->st_gain = gain; /* Set Synth Thread gain value */
|
||||
gain = fluid_atomic_float_get (&synth->gain);
|
||||
|
||||
for (i = 0; i < synth->polyphony; i++) {
|
||||
fluid_voice_t* voice = synth->voice[i];
|
||||
|
@ -2525,18 +2513,6 @@ fluid_synth_set_gain_LOCAL(fluid_synth_t* synth, float gain)
|
|||
fluid_voice_set_gain(voice, gain);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send a return gain event to sync synth's copy of gain */
|
||||
|
||||
event = fluid_event_queue_get_inptr (synth->return_queue);
|
||||
|
||||
if (event)
|
||||
{
|
||||
event->type = FLUID_EVENT_QUEUE_ELEM_GAIN;
|
||||
event->dval = gain;
|
||||
fluid_event_queue_next_inptr (synth->return_queue);
|
||||
}
|
||||
else FLUID_LOG (FLUID_ERR, "Synth return event queue full");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2547,15 +2523,9 @@ fluid_synth_set_gain_LOCAL(fluid_synth_t* synth, float gain)
|
|||
float
|
||||
fluid_synth_get_gain(fluid_synth_t* synth)
|
||||
{
|
||||
float gain;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, 0.0);
|
||||
|
||||
fluid_rec_mutex_lock (synth->mutex);
|
||||
gain = synth->gain;
|
||||
fluid_rec_mutex_unlock (synth->mutex);
|
||||
|
||||
return (gain);
|
||||
return fluid_atomic_float_get (&synth->gain);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2581,19 +2551,20 @@ fluid_synth_set_polyphony(fluid_synth_t* synth, int polyphony)
|
|||
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
|
||||
fluid_return_val_if_fail (polyphony >= 16 && polyphony <= synth->nvoice, FLUID_FAILED);
|
||||
|
||||
fluid_atomic_int_set (&synth->polyphony, polyphony);
|
||||
|
||||
if (fluid_synth_should_queue (synth))
|
||||
return fluid_synth_queue_int_event (synth, FLUID_EVENT_QUEUE_ELEM_POLYPHONY,
|
||||
polyphony);
|
||||
else return fluid_synth_set_polyphony_LOCAL (synth, polyphony);
|
||||
return fluid_synth_queue_int_event (synth, FLUID_EVENT_QUEUE_ELEM_POLYPHONY, 0);
|
||||
else return fluid_synth_update_polyphony_LOCAL (synth);
|
||||
}
|
||||
|
||||
/* Called by synthesis thread to update the polyphony value */
|
||||
static int
|
||||
fluid_synth_set_polyphony_LOCAL(fluid_synth_t* synth, int polyphony)
|
||||
fluid_synth_update_polyphony_LOCAL(fluid_synth_t* synth)
|
||||
{
|
||||
int i;
|
||||
int i, polyphony;
|
||||
|
||||
fluid_atomic_int_set (&synth->polyphony, polyphony);
|
||||
polyphony = fluid_atomic_int_get (&synth->polyphony);
|
||||
|
||||
/* turn off any voices above the new limit */
|
||||
for (i = polyphony; i < synth->nvoice; i++) {
|
||||
|
@ -3350,29 +3321,26 @@ fluid_synth_process_event_queue_LOCAL (fluid_synth_t *synth,
|
|||
fluid_synth_system_reset_LOCAL (synth);
|
||||
break;
|
||||
case CHANNEL_PRESSURE:
|
||||
fluid_synth_channel_pressure_LOCAL (synth, event->midi.channel,
|
||||
event->midi.param1);
|
||||
fluid_synth_update_channel_pressure_LOCAL (synth, event->midi.channel);
|
||||
break;
|
||||
case PITCH_BEND:
|
||||
fluid_synth_pitch_bend_LOCAL (synth, event->midi.channel,
|
||||
event->midi.param1);
|
||||
fluid_synth_update_pitch_bend_LOCAL (synth, event->midi.channel);
|
||||
break;
|
||||
case RPN_LSB:
|
||||
switch (event->midi.param1)
|
||||
{
|
||||
case RPN_PITCH_BEND_RANGE:
|
||||
fluid_synth_pitch_wheel_sens_LOCAL (synth, event->midi.channel,
|
||||
event->midi.param2);
|
||||
fluid_synth_update_pitch_wheel_sens_LOCAL (synth, event->midi.channel);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FLUID_EVENT_QUEUE_ELEM_GAIN:
|
||||
fluid_synth_set_gain_LOCAL (synth, event->dval);
|
||||
case FLUID_EVENT_QUEUE_ELEM_UPDATE_GAIN:
|
||||
fluid_synth_update_gain_LOCAL (synth);
|
||||
break;
|
||||
case FLUID_EVENT_QUEUE_ELEM_POLYPHONY:
|
||||
fluid_synth_set_polyphony_LOCAL (synth, event->ival);
|
||||
fluid_synth_update_polyphony_LOCAL (synth);
|
||||
break;
|
||||
case FLUID_EVENT_QUEUE_ELEM_GEN:
|
||||
fluid_synth_set_gen_LOCAL (synth, event->gen.channel, event->gen.param,
|
||||
|
@ -3392,8 +3360,8 @@ fluid_synth_process_event_queue_LOCAL (fluid_synth_t *synth,
|
|||
break;
|
||||
case FLUID_EVENT_QUEUE_ELEM_CHORUS:
|
||||
fluid_synth_set_chorus_LOCAL (synth, event->chorus.set, event->chorus.nr,
|
||||
event->chorus.type, event->chorus.level,
|
||||
event->chorus.speed, event->chorus.depth);
|
||||
event->chorus.level, event->chorus.speed,
|
||||
event->chorus.depth, event->chorus.type);
|
||||
break;
|
||||
case FLUID_EVENT_QUEUE_ELEM_SET_TUNING:
|
||||
fluid_synth_set_tuning_LOCAL (synth, event->set_tuning.channel,
|
||||
|
@ -4207,7 +4175,23 @@ fluid_synth_set_reverb_full(fluid_synth_t* synth, int set, double roomsize,
|
|||
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
|
||||
|
||||
if (!(set & FLUID_REVMODEL_SET_ALL))
|
||||
set = FLUID_REVMODEL_SET_ALL;
|
||||
set = FLUID_REVMODEL_SET_ALL;
|
||||
|
||||
/* Synth shadow values are set here so that they will be returned if querried,
|
||||
* but shadow values are also updated via a return event to ensure they don't
|
||||
* get out of sync, if this is called from synthesis and non-synthesis context. */
|
||||
|
||||
if (set & FLUID_REVMODEL_SET_ROOMSIZE)
|
||||
fluid_atomic_float_set (&synth->reverb_roomsize, roomsize);
|
||||
|
||||
if (set & FLUID_REVMODEL_SET_DAMPING)
|
||||
fluid_atomic_float_set (&synth->reverb_damping, damping);
|
||||
|
||||
if (set & FLUID_REVMODEL_SET_WIDTH)
|
||||
fluid_atomic_float_set (&synth->reverb_width, width);
|
||||
|
||||
if (set & FLUID_REVMODEL_SET_LEVEL)
|
||||
fluid_atomic_float_set (&synth->reverb_level, level);
|
||||
|
||||
if (fluid_synth_should_queue (synth))
|
||||
{
|
||||
|
@ -4265,15 +4249,9 @@ fluid_synth_set_reverb_LOCAL(fluid_synth_t* synth, int set, double roomsize,
|
|||
double
|
||||
fluid_synth_get_reverb_roomsize(fluid_synth_t* synth)
|
||||
{
|
||||
double value;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, 0.0);
|
||||
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock reverb value */
|
||||
value = synth->reverb_roomsize;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
|
||||
return value;
|
||||
return fluid_atomic_float_get (&synth->reverb_roomsize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4284,15 +4262,9 @@ fluid_synth_get_reverb_roomsize(fluid_synth_t* synth)
|
|||
double
|
||||
fluid_synth_get_reverb_damp(fluid_synth_t* synth)
|
||||
{
|
||||
double value;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, 0.0);
|
||||
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock reverb value */
|
||||
value = synth->reverb_damping;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
|
||||
return value;
|
||||
return fluid_atomic_float_get (&synth->reverb_damping);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4303,15 +4275,9 @@ fluid_synth_get_reverb_damp(fluid_synth_t* synth)
|
|||
double
|
||||
fluid_synth_get_reverb_level(fluid_synth_t* synth)
|
||||
{
|
||||
double value;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, 0.0);
|
||||
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock reverb value */
|
||||
value = synth->reverb_level;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
|
||||
return value;
|
||||
return fluid_atomic_float_get (&synth->reverb_level);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4322,15 +4288,9 @@ fluid_synth_get_reverb_level(fluid_synth_t* synth)
|
|||
double
|
||||
fluid_synth_get_reverb_width(fluid_synth_t* synth)
|
||||
{
|
||||
double value;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, 0.0);
|
||||
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock reverb value */
|
||||
value = synth->reverb_width;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
|
||||
return value;
|
||||
return fluid_atomic_float_get (&synth->reverb_width);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4389,6 +4349,25 @@ fluid_synth_set_chorus_full(fluid_synth_t* synth, int set, int nr, double level,
|
|||
if (!(set & FLUID_CHORUS_SET_ALL))
|
||||
set = FLUID_CHORUS_SET_ALL;
|
||||
|
||||
/* Synth shadow values are set here so that they will be returned if querried,
|
||||
* but shadow values are also updated via a return event to ensure they don't
|
||||
* get out of sync, if this is called from synthesis and non-synthesis context. */
|
||||
|
||||
if (set & FLUID_CHORUS_SET_NR)
|
||||
fluid_atomic_int_set (&synth->chorus_nr, nr);
|
||||
|
||||
if (set & FLUID_CHORUS_SET_LEVEL)
|
||||
fluid_atomic_float_set (&synth->chorus_level, level);
|
||||
|
||||
if (set & FLUID_CHORUS_SET_SPEED)
|
||||
fluid_atomic_float_set (&synth->chorus_speed, speed);
|
||||
|
||||
if (set & FLUID_CHORUS_SET_DEPTH)
|
||||
fluid_atomic_float_set (&synth->chorus_depth, depth_ms);
|
||||
|
||||
if (set & FLUID_CHORUS_SET_TYPE)
|
||||
fluid_atomic_int_set (&synth->chorus_type, type);
|
||||
|
||||
if (fluid_synth_should_queue (synth))
|
||||
{
|
||||
event = fluid_synth_get_event_elem (synth, &queue);
|
||||
|
@ -4447,15 +4426,9 @@ fluid_synth_set_chorus_LOCAL(fluid_synth_t* synth, int set, int nr, float level,
|
|||
int
|
||||
fluid_synth_get_chorus_nr(fluid_synth_t* synth)
|
||||
{
|
||||
int value;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, 0.0);
|
||||
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock chorus value */
|
||||
value = synth->chorus_nr;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
|
||||
return value;
|
||||
return fluid_atomic_int_get (&synth->chorus_nr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4466,15 +4439,9 @@ fluid_synth_get_chorus_nr(fluid_synth_t* synth)
|
|||
double
|
||||
fluid_synth_get_chorus_level(fluid_synth_t* synth)
|
||||
{
|
||||
double value;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, 0.0);
|
||||
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock chorus value */
|
||||
value = synth->chorus_level;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
|
||||
return value;
|
||||
return fluid_atomic_float_get (&synth->chorus_level);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4485,15 +4452,9 @@ fluid_synth_get_chorus_level(fluid_synth_t* synth)
|
|||
double
|
||||
fluid_synth_get_chorus_speed_Hz(fluid_synth_t* synth)
|
||||
{
|
||||
double value;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, 0.0);
|
||||
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock chorus value */
|
||||
value = synth->chorus_speed;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
|
||||
return value;
|
||||
return fluid_atomic_float_get (&synth->chorus_speed);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4504,15 +4465,9 @@ fluid_synth_get_chorus_speed_Hz(fluid_synth_t* synth)
|
|||
double
|
||||
fluid_synth_get_chorus_depth_ms(fluid_synth_t* synth)
|
||||
{
|
||||
double value;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, 0.0);
|
||||
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock chorus value */
|
||||
value = synth->chorus_depth;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
|
||||
return value;
|
||||
return fluid_atomic_float_get (&synth->chorus_depth);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4523,15 +4478,9 @@ fluid_synth_get_chorus_depth_ms(fluid_synth_t* synth)
|
|||
int
|
||||
fluid_synth_get_chorus_type(fluid_synth_t* synth)
|
||||
{
|
||||
int value;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, 0.0);
|
||||
|
||||
fluid_rec_mutex_lock (synth->mutex); /* ++ Lock chorus value */
|
||||
value = synth->chorus_type;
|
||||
fluid_rec_mutex_unlock (synth->mutex); /* -- Unlock */
|
||||
|
||||
return value;
|
||||
return fluid_atomic_int_get (&synth->chorus_type);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5540,7 +5489,7 @@ fluid_synth_handle_midi_event(void* data, fluid_midi_event_t* event)
|
|||
return fluid_synth_program_change(synth, chan, fluid_midi_event_get_program(event));
|
||||
|
||||
case CHANNEL_PRESSURE:
|
||||
return fluid_synth_channel_pressure(synth, chan, fluid_midi_event_get_program(event));
|
||||
return fluid_synth_channel_pressure(synth, chan, fluid_midi_event_get_program(event));
|
||||
|
||||
case PITCH_BEND:
|
||||
return fluid_synth_pitch_bend(synth, chan, fluid_midi_event_get_pitch(event));
|
||||
|
|
|
@ -123,7 +123,6 @@ typedef struct _fluid_sfont_info_t {
|
|||
* sfont_info<>
|
||||
* tuning
|
||||
* sfont_id
|
||||
* gain
|
||||
* reverb_roomsize, reverb_damping, reverb_width, reverb_level
|
||||
* chorus_nr, chorus_level, chorus_speed, chorus_depth, chorus_type
|
||||
*
|
||||
|
@ -132,6 +131,7 @@ typedef struct _fluid_sfont_info_t {
|
|||
* with_reverb
|
||||
* with_chorus
|
||||
* state
|
||||
* gain
|
||||
* cpu_load
|
||||
* noteid
|
||||
* storeid
|
||||
|
@ -146,7 +146,6 @@ typedef struct _fluid_sfont_info_t {
|
|||
* cur
|
||||
* dither_index
|
||||
* polyphony
|
||||
* st_gain
|
||||
* active_voice_count
|
||||
*/
|
||||
|
||||
|
@ -183,8 +182,7 @@ struct _fluid_synth_t
|
|||
fluid_hashtable_t *sfont_hash; /**< Hash of fluid_sfont_t->fluid_sfont_info_t (remains until SoundFont is deleted) */
|
||||
unsigned int sfont_id; /**< Incrementing ID assigned to each loaded SoundFont */
|
||||
|
||||
double gain; /**< master gain */
|
||||
double st_gain; /**< Synth thread gain shadow value */
|
||||
float gain; /**< master gain */
|
||||
fluid_channel_t** channel; /**< the channels */
|
||||
int nvoice; /**< the length of the synthesis process array (max polyphony allowed) */
|
||||
fluid_voice_t** voice; /**< the synthesis voices */
|
||||
|
|
|
@ -131,7 +131,7 @@ fluid_set_log_function(int level, fluid_log_function_t fun, void* data)
|
|||
* @param data User supplied data (not used)
|
||||
*/
|
||||
void
|
||||
fluid_default_log_function(int level, const char* message, void* data)
|
||||
fluid_default_log_function(int level, char* message, void* data)
|
||||
{
|
||||
FILE* out;
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ void print_usage(void);
|
|||
void print_help(fluid_settings_t *settings);
|
||||
void print_welcome(void);
|
||||
|
||||
static fluid_cmd_handler_t* newclient(void* data, const char* addr);
|
||||
static fluid_cmd_handler_t* newclient(void* data, char* addr);
|
||||
|
||||
/*
|
||||
* the globals
|
||||
|
@ -149,7 +149,7 @@ typedef struct
|
|||
|
||||
/* Function to display each string option value */
|
||||
static void
|
||||
settings_option_foreach_func (void *data, const char *name, const char *option)
|
||||
settings_option_foreach_func (void *data, char *name, char *option)
|
||||
{
|
||||
OptionBag *bag = data;
|
||||
|
||||
|
@ -162,7 +162,7 @@ settings_option_foreach_func (void *data, const char *name, const char *option)
|
|||
|
||||
/* fluid_settings_foreach function for displaying option help "-o help" */
|
||||
static void
|
||||
settings_foreach_func (void *data, const char *name, int type)
|
||||
settings_foreach_func (void *data, char *name, int type)
|
||||
{
|
||||
fluid_settings_t *settings = (fluid_settings_t *)data;
|
||||
double dmin, dmax, ddef;
|
||||
|
@ -793,7 +793,7 @@ int main(int argc, char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static fluid_cmd_handler_t* newclient(void* data, const char* addr)
|
||||
static fluid_cmd_handler_t* newclient(void* data, char* addr)
|
||||
{
|
||||
fluid_synth_t* synth = (fluid_synth_t*) data;
|
||||
return new_fluid_cmd_handler(synth);
|
||||
|
|
Loading…
Reference in a new issue