本文整理汇总了C++中FLUID_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ FLUID_LOG函数的具体用法?C++ FLUID_LOG怎么用?C++ FLUID_LOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FLUID_LOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fluid_rvoice_event_dispatch
void
fluid_rvoice_event_dispatch(fluid_rvoice_event_t* event)
{
EVENTFUNC_PTR(fluid_rvoice_mixer_add_voice, fluid_rvoice_mixer_t*, fluid_rvoice_t*);
EVENTFUNC_I1(fluid_rvoice_noteoff, fluid_rvoice_t*);
EVENTFUNC_0(fluid_rvoice_voiceoff, fluid_rvoice_t*);
EVENTFUNC_0(fluid_rvoice_reset, fluid_rvoice_t*);
EVENTFUNC_ALL(fluid_adsr_env_set_data, fluid_adsr_env_t*);
EVENTFUNC_I1(fluid_lfo_set_delay, fluid_lfo_t*);
EVENTFUNC_R1(fluid_lfo_set_incr, fluid_lfo_t*);
EVENTFUNC_R1(fluid_iir_filter_set_fres, fluid_iir_filter_t*);
EVENTFUNC_R1(fluid_iir_filter_set_q_dB, fluid_iir_filter_t*);
EVENTFUNC_IR(fluid_rvoice_buffers_set_mapping, fluid_rvoice_buffers_t*);
EVENTFUNC_IR(fluid_rvoice_buffers_set_amp, fluid_rvoice_buffers_t*);
EVENTFUNC_R1(fluid_rvoice_set_modenv_to_pitch, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_output_rate, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_root_pitch_hz, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_synth_gain, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_pitch, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_attenuation, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_min_attenuation_cB, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_viblfo_to_pitch, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_modlfo_to_pitch, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_modlfo_to_vol, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_modlfo_to_fc, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_modenv_to_fc, fluid_rvoice_t*);
EVENTFUNC_R1(fluid_rvoice_set_modenv_to_pitch, fluid_rvoice_t*);
EVENTFUNC_I1(fluid_rvoice_set_interp_method, fluid_rvoice_t*);
EVENTFUNC_I1(fluid_rvoice_set_start, fluid_rvoice_t*);
EVENTFUNC_I1(fluid_rvoice_set_end, fluid_rvoice_t*);
EVENTFUNC_I1(fluid_rvoice_set_loopstart, fluid_rvoice_t*);
EVENTFUNC_I1(fluid_rvoice_set_loopend, fluid_rvoice_t*);
EVENTFUNC_I1(fluid_rvoice_set_samplemode, fluid_rvoice_t*);
EVENTFUNC_PTR(fluid_rvoice_set_sample, fluid_rvoice_t*, fluid_sample_t*);
EVENTFUNC_R1(fluid_rvoice_mixer_set_samplerate, fluid_rvoice_mixer_t*);
EVENTFUNC_I1(fluid_rvoice_mixer_set_polyphony, fluid_rvoice_mixer_t*);
EVENTFUNC_I1(fluid_rvoice_mixer_set_reverb_enabled, fluid_rvoice_mixer_t*);
EVENTFUNC_I1(fluid_rvoice_mixer_set_chorus_enabled, fluid_rvoice_mixer_t*);
EVENTFUNC_I1(fluid_rvoice_mixer_set_mix_fx, fluid_rvoice_mixer_t*);
EVENTFUNC_0(fluid_rvoice_mixer_reset_fx, fluid_rvoice_mixer_t*);
EVENTFUNC_0(fluid_rvoice_mixer_reset_reverb, fluid_rvoice_mixer_t*);
EVENTFUNC_0(fluid_rvoice_mixer_reset_chorus, fluid_rvoice_mixer_t*);
EVENTFUNC_IR(fluid_rvoice_mixer_set_threads, fluid_rvoice_mixer_t*);
EVENTFUNC_ALL(fluid_rvoice_mixer_set_chorus_params, fluid_rvoice_mixer_t*);
EVENTFUNC_R4(fluid_rvoice_mixer_set_reverb_params, fluid_rvoice_mixer_t*);
FLUID_LOG(FLUID_ERR, "fluid_rvoice_event_dispatch: Unknown method %p to dispatch!", event->method);
}
示例2: fluid_sndio_midi_run
void *
fluid_sndio_midi_run(void *addr)
{
int n, i;
fluid_midi_event_t* evt;
fluid_sndio_midi_driver_t *dev = (fluid_sndio_midi_driver_t *)addr;
#define MIDI_BUFLEN (3125 / 10)
unsigned char buffer[MIDI_BUFLEN];
/* make sure the other threads can cancel this thread any time */
if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL)) {
FLUID_LOG(FLUID_ERR, "Failed to set the cancel state of the midi thread");
pthread_exit(NULL);
}
if (pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL)) {
FLUID_LOG(FLUID_ERR, "Failed to set the cancel state of the midi thread");
pthread_exit(NULL);
}
/* go into a loop until someone tells us to stop */
dev->status = FLUID_MIDI_LISTENING;
while (dev->status == FLUID_MIDI_LISTENING) {
/* read new data */
n = mio_read(dev->hdl, buffer, MIDI_BUFLEN);
if (n == 0 && mio_eof(dev->hdl)) {
FLUID_LOG(FLUID_ERR, "Failed to read the midi input");
dev->status = FLUID_MIDI_DONE;
}
/* let the parser convert the data into events */
for (i = 0; i < n; i++) {
evt = fluid_midi_parser_parse(dev->parser, buffer[i]);
if (evt != NULL) {
/* send the event to the next link in the chain */
(*dev->driver.handler)(dev->driver.data, evt);
}
}
}
pthread_exit(NULL);
}
示例3: fluid_portaudio_driver_settings
void
fluid_portaudio_driver_settings (fluid_settings_t *settings)
{
const PaDeviceInfo *deviceInfo;
int numDevices;
PaError err;
int i;
fluid_settings_register_str (settings, "audio.portaudio.device", PORTAUDIO_DEFAULT_DEVICE, 0, NULL, NULL);
fluid_settings_add_option (settings, "audio.portaudio.device", PORTAUDIO_DEFAULT_DEVICE);
err = Pa_Initialize();
if (err != paNoError)
{
FLUID_LOG (FLUID_ERR, "Error initializing PortAudio driver: %s",
Pa_GetErrorText (err));
return;
}
numDevices = Pa_GetDeviceCount();
if (numDevices < 0)
{
FLUID_LOG (FLUID_ERR, "PortAudio returned unexpected device count %d", numDevices);
return;
}
for (i = 0; i < numDevices; i++)
{
deviceInfo = Pa_GetDeviceInfo (i);
if ( deviceInfo->maxOutputChannels >= 2 )
fluid_settings_add_option (settings, "audio.portaudio.device",
deviceInfo->name);
}
/* done with PortAudio for now, may get reopened later */
err = Pa_Terminate();
if (err != paNoError)
printf ("PortAudio termination error: %s\n", Pa_GetErrorText (err) );
}
示例4: new_fluid_midi_parser
/*
* new_fluid_midi_parser
*/
fluid_midi_parser_t* new_fluid_midi_parser()
{
fluid_midi_parser_t* parser;
parser = FLUID_NEW(fluid_midi_parser_t);
if (parser == NULL) {
FLUID_LOG(FLUID_ERR, "Out of memory");
return NULL;
}
parser->status = 0; /* As long as the status is 0, the parser won't do anything -> no need to initialize all the fields. */
return parser;
}
示例5: fluid_profiling_print
void fluid_profiling_print(void)
{
int i;
printf("fluid_profiling_print\n");
FLUID_LOG(FLUID_INFO, "Estimated times: min/avg/max (micro seconds)");
for (i = 0; i < FLUID_PROF_LAST; i++) {
if (fluid_profile_data[i].count > 0) {
FLUID_LOG(FLUID_INFO, "%s: %.3f/%.3f/%.3f",
fluid_profile_data[i].description,
fluid_profile_data[i].min,
fluid_profile_data[i].total / fluid_profile_data[i].count,
fluid_profile_data[i].max);
} else {
FLUID_LOG(FLUID_DBG, "%s: no profiling available", fluid_profile_data[i].description);
}
}
}
示例6: fluid_samplecache_load
int fluid_samplecache_load(SFData *sf,
unsigned int sample_start, unsigned int sample_end, int sample_type,
int try_mlock, short **sample_data, char **sample_data24)
{
fluid_samplecache_entry_t *entry;
int ret;
fluid_mutex_lock(samplecache_mutex);
entry = get_samplecache_entry(sf, sample_start, sample_end, sample_type);
if (entry == NULL)
{
entry = new_samplecache_entry(sf, sample_start, sample_end, sample_type);
if (entry == NULL)
{
ret = -1;
goto unlock_exit;
}
samplecache_list = fluid_list_prepend(samplecache_list, entry);
}
if (try_mlock && !entry->mlocked)
{
/* Lock the memory to disable paging. It's okay if this fails. It
* probably means that the user doesn't have the required permission. */
if (fluid_mlock(entry->sample_data, entry->sample_count * sizeof(short)) == 0)
{
if (entry->sample_data24 != NULL)
{
entry->mlocked = (fluid_mlock(entry->sample_data24, entry->sample_count) == 0);
}
else
{
entry->mlocked = TRUE;
}
if (!entry->mlocked)
{
fluid_munlock(entry->sample_data, entry->sample_count * sizeof(short));
FLUID_LOG(FLUID_WARN, "Failed to pin the sample data to RAM; swapping is possible.");
}
}
}
entry->num_references++;
*sample_data = entry->sample_data;
*sample_data24 = entry->sample_data24;
ret = entry->sample_count;
unlock_exit:
fluid_mutex_unlock(samplecache_mutex);
return ret;
}
示例7: fluid_midi_file_read
/*
* fluid_midi_file_read
*/
int fluid_midi_file_read(fluid_midi_file* mf, void* buf, int len)
{
int num = FLUID_FREAD(buf, 1, len, mf->fp);
mf->trackpos += num;
#if DEBUG
if (num != len) {
FLUID_LOG(FLUID_DBG, "Coulnd't read the requested number of bytes");
}
#endif
return (num != len)? FLUID_FAILED : FLUID_OK;
}
示例8: fluid_player_set_midi_tempo
/**
* Set the tempo of a MIDI player.
* @param player MIDI player instance
* @param tempo Tempo to set playback speed to (in microseconds per quarter note, as per MIDI file spec)
* @return Always returns #FLUID_OK
*/
int fluid_player_set_midi_tempo(fluid_player_t* player, int tempo)
{
player->miditempo = tempo;
player->deltatime = (double) tempo / player->division / 1000.0; /* in milliseconds */
player->start_msec = player->cur_msec;
player->start_ticks = player->cur_ticks;
FLUID_LOG(FLUID_DBG,"tempo=%d, tick time=%f msec, cur time=%d msec, cur tick=%d",
tempo, player->deltatime, player->cur_msec, player->cur_ticks);
return FLUID_OK;
}
示例9: new_fluid_thread
/**
* Create a new thread.
* @param func Function to execute in new thread context
* @param data User defined data to pass to func
* @param prio_level Priority level. If greater than 0 then high priority scheduling will
* be used, with the given priority level (used by pthreads only). 0 uses normal scheduling.
* @param detach If TRUE, 'join' does not work and the thread destroys itself when finished.
* @return New thread pointer or NULL on error
*/
fluid_thread_t *
new_fluid_thread (fluid_thread_func_t func, void *data, int prio_level, int detach)
{
GThread *thread;
fluid_thread_info_t *info;
GError *err = NULL;
g_return_val_if_fail (func != NULL, NULL);
/* Make sure g_thread_init has been called.
* FIXME - Probably not a good idea in a shared library,
* but what can we do *and* remain backwards compatible? */
if (!g_thread_supported ()) g_thread_init (NULL);
if (prio_level > 0)
{
info = FLUID_NEW (fluid_thread_info_t);
if (!info)
{
FLUID_LOG(FLUID_ERR, "Out of memory");
return NULL;
}
info->func = func;
info->data = data;
info->prio_level = prio_level;
thread = g_thread_create (fluid_thread_high_prio, info, detach == FALSE, &err);
}
else thread = g_thread_create ((GThreadFunc)func, data, detach == FALSE, &err);
if (!thread)
{
FLUID_LOG(FLUID_ERR, "Failed to create the thread: %s",
fluid_gerror_message (err));
g_clear_error (&err);
}
return thread;
}
示例10: new_fluid_sndmgr_audio_driver2
/*
* new_fluid_sndmgr_audio_driver2
*
* This implementation used the audio_func float format, with
* conversion from float to 16bits in the driver.
*/
fluid_audio_driver_t*
new_fluid_sndmgr_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t func, void* data)
{
fluid_sndmgr_audio_driver_t* dev = NULL;
int period_size, periods, buffer_size;
/* compute buffer size */
fluid_settings_getint(settings, "audio.period-size", &period_size);
fluid_settings_getint(settings, "audio.periods", &periods);
buffer_size = period_size*periods;
/* allocated dev */
dev = FLUID_NEW(fluid_sndmgr_audio_driver_t);
if (dev == NULL) {
FLUID_LOG(FLUID_PANIC, "Out of memory");
return NULL;
}
FLUID_MEMSET(dev, 0, sizeof(fluid_sndmgr_audio_driver_t));
/* allocate the conversion buffers */
dev->convbuffers[0] = FLUID_ARRAY(float, buffer_size);
dev->convbuffers[1] = FLUID_ARRAY(float, buffer_size);
if ((dev->convbuffers[0] == NULL) || (dev->convbuffers[1] == NULL)) {
FLUID_LOG(FLUID_PANIC, "Out of memory");
goto error_recovery;
}
dev->callback_is_audio_func = true;
dev->data = data;
dev->callback = func;
if (start_fluid_sndmgr_audio_driver(settings, dev, buffer_size) != 0) {
goto error_recovery;
}
return (fluid_audio_driver_t*)dev;
error_recovery:
delete_fluid_sndmgr_audio_driver((fluid_audio_driver_t*)dev);
return NULL;
}
示例11: new_fluid_file_audio_driver
fluid_audio_driver_t*
new_fluid_file_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth)
{
fluid_file_audio_driver_t* dev;
int msec;
dev = FLUID_NEW(fluid_file_audio_driver_t);
if (dev == NULL) {
FLUID_LOG(FLUID_ERR, "Out of memory");
return NULL;
}
FLUID_MEMSET(dev, 0, sizeof(fluid_file_audio_driver_t));
fluid_settings_getint(settings, "audio.period-size", &dev->period_size);
fluid_settings_getnum(settings, "synth.sample-rate", &dev->sample_rate);
dev->data = synth;
dev->callback = (fluid_audio_func_t) fluid_synth_process;
dev->samples = 0;
dev->renderer = new_fluid_file_renderer(synth);
if (dev->renderer == NULL)
goto error_recovery;
msec = (int) (0.5 + dev->period_size / dev->sample_rate * 1000.0);
dev->timer = new_fluid_timer(msec, fluid_file_audio_run_s16, (void*) dev, TRUE, FALSE, TRUE);
if (dev->timer == NULL) {
FLUID_LOG(FLUID_PANIC, "Couldn't create the audio thread.");
goto error_recovery;
}
return (fluid_audio_driver_t*) dev;
error_recovery:
delete_fluid_file_audio_driver((fluid_audio_driver_t*) dev);
return NULL;
}
示例12: fluid_hashtable_insert_internal
/*
* fluid_hashtable_insert_internal:
* @hashtable: our #fluid_hashtable_t
* @key: the key to insert
* @value: the value to insert
* @keep_new_key: if %TRUE and this key already exists in the table
* then call the destroy notify function on the old key. If %FALSE
* then call the destroy notify function on the new key.
*
* Implements the common logic for the fluid_hashtable_insert() and
* fluid_hashtable_replace() functions.
*
* Do a lookup of @key. If it is found, replace it with the new
* @value (and perhaps the new @key). If it is not found, create a
* new node.
*/
static void
fluid_hashtable_insert_internal (fluid_hashtable_t *hashtable, void *key,
void *value, int keep_new_key)
{
fluid_hashnode_t **node_ptr, *node;
unsigned int key_hash;
fluid_return_if_fail (hashtable != NULL);
fluid_return_if_fail (hashtable->ref_count > 0);
node_ptr = fluid_hashtable_lookup_node (hashtable, key, &key_hash);
if ((node = *node_ptr))
{
if (keep_new_key)
{
if (hashtable->key_destroy_func)
hashtable->key_destroy_func (node->key);
node->key = key;
}
else
{
if (hashtable->key_destroy_func)
hashtable->key_destroy_func (key);
}
if (hashtable->value_destroy_func)
hashtable->value_destroy_func (node->value);
node->value = value;
}
else
{
node = FLUID_NEW (fluid_hashnode_t);
if (!node)
{
FLUID_LOG (FLUID_ERR, "Out of memory");
return;
}
node->key = key;
node->value = value;
node->key_hash = key_hash;
node->next = NULL;
*node_ptr = node;
hashtable->nnodes++;
fluid_hashtable_maybe_resize (hashtable);
}
}
示例13: fluid_midishare_open_appl
/*
* fluid_midishare_open_appl
*/
static int fluid_midishare_open_appl (fluid_midishare_midi_driver_t* dev)
{
/* register to MidiShare */
#if defined(MACINTOSH) && defined(MACOS9)
dev->refnum = MidiOpen(MSHDriverName);
if (dev->refnum < 0) {
FLUID_LOG(FLUID_ERR, "Can not open MidiShare Driver client");
return 0;
}
dev->upp_alarm_ptr = NewRcvAlarmPtr(fluid_midishare_midi_driver_receive);
dev->upp_task_ptr = NewTaskPtr(fluid_midishare_keyoff_task);
MidiSetRcvAlarm(dev->refnum, dev->upp_alarm_ptr);
#else
dev->refnum = MidiOpen(MSHDriverName);
if (dev->refnum < 0) {
FLUID_LOG(FLUID_ERR, "Can not open MidiShare Driver client");
return 0;
}
MidiSetRcvAlarm(dev->refnum, fluid_midishare_midi_driver_receive);
MidiConnect(0,dev->refnum,true);
#endif
return 1;
}
示例14: fluid_tuning_duplicate
/* Duplicate a tuning */
fluid_tuning_t *
fluid_tuning_duplicate (fluid_tuning_t *tuning)
{
fluid_tuning_t *new_tuning;
int i;
new_tuning = FLUID_NEW (fluid_tuning_t);
if (!new_tuning) {
FLUID_LOG (FLUID_PANIC, "Out of memory");
return NULL;
}
if (tuning->name)
{
new_tuning->name = FLUID_STRDUP (tuning->name);
if (!new_tuning->name)
{
FLUID_FREE (new_tuning);
FLUID_LOG (FLUID_PANIC, "Out of memory");
return NULL;
}
}
else new_tuning->name = NULL;
new_tuning->bank = tuning->bank;
new_tuning->prog = tuning->prog;
for (i = 0; i < 128; i++)
new_tuning->pitch[i] = tuning->pitch[i];
new_tuning->refcount = 1; /* Start with a refcount of 1 */
return new_tuning;
}
示例15: fluid_midi_file_skip
/*
* fluid_midi_file_skip
*/
int
fluid_midi_file_skip (fluid_midi_file *mf, int skip)
{
int new_pos = mf->buf_pos + skip;
/* Mimic the behaviour of fseek: Error to seek past the start of file, but
* OK to seek past end (this just puts it into the EOF state). */
if (new_pos < 0) {
FLUID_LOG(FLUID_ERR, "Failed to seek position in file");
return FLUID_FAILED;
}
/* Clear the EOF flag, even if moved past the end of the file (this is
* consistent with the behaviour of fseek). */
mf->eof = FALSE;
mf->buf_pos = new_pos;
return FLUID_OK;
}