当前位置: 首页>>代码示例>>C++>>正文


C++ FLUID_FREE函数代码示例

本文整理汇总了C++中FLUID_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ FLUID_FREE函数的具体用法?C++ FLUID_FREE怎么用?C++ FLUID_FREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FLUID_FREE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: delete_fluid_sequencer

/**
 * Free a sequencer object.
 * @param seq Sequencer to delete
 */
void
delete_fluid_sequencer (fluid_sequencer_t* seq)
{

	if (seq == NULL) {
		return;
	}

	/* cleanup clients */
	while (seq->clients) {
		fluid_sequencer_client_t *client = (fluid_sequencer_client_t*)seq->clients->data;
		fluid_sequencer_unregister_client(seq, client->id);
	}

	_fluid_seq_queue_end(seq);

/*	if (seq->clients) {
		fluid_list_t *tmp = seq->clients;
		while (tmp != NULL) {
			fluid_sequencer_client_t *client = (fluid_sequencer_client_t*)tmp->data;
			if (client->name) FLUID_FREE(client->name);
			tmp = tmp->next;
		}
		delete_fluid_list(seq->clients);
		seq->clients = NULL;
	}*/

#if FLUID_SEQ_WITH_TRACE
	if (seq->tracebuf != NULL)
		FLUID_FREE(seq->tracebuf);
	seq->tracebuf = NULL;
#endif

	FLUID_FREE(seq);
}
开发者ID:libretro,项目名称:libretro-prboom,代码行数:39,代码来源:fluid_seq.c

示例2: _fluid_evt_heap_free

void
_fluid_evt_heap_free(fluid_evt_heap_t* heap)
{
#ifdef HEAP_WITH_DYNALLOC
  fluid_evt_entry *tmp, *next;

  /* LOCK */
  fluid_mutex_lock(heap->mutex);

  tmp = heap->freelist;
  while (tmp) {
    next = tmp->next;
    FLUID_FREE(tmp);
    tmp = next;
  }

  /* UNLOCK */
  fluid_mutex_unlock(heap->mutex);
  fluid_mutex_destroy(heap->mutex);

  FLUID_FREE(heap);

#else
	FLUID_FREE(heap);
#endif
}
开发者ID:caomw,项目名称:fluidsynth,代码行数:26,代码来源:fluid_event.c

示例3: new_fluid_midi_file

/**
 * Open a MIDI file and return a new MIDI file handle.
 * @internal
 * @param filename Path of file to open.
 * @return New MIDI file handle or NULL on error.
 */
fluid_midi_file* new_fluid_midi_file(char* filename)
{
	fluid_midi_file* mf;

	mf = FLUID_NEW(fluid_midi_file);
	if (mf == NULL) {
		FLUID_LOG(FLUID_ERR, "Out of memory");
		return NULL;
	}
	FLUID_MEMSET(mf, 0, sizeof(fluid_midi_file));

	mf->c = -1;
	mf->running_status = -1;
	mf->fp = FLUID_FOPEN(filename, "rb");

	if (mf->fp == NULL) {
		FLUID_LOG(FLUID_ERR, "Couldn't open the MIDI file");
		FLUID_FREE(mf);
		return NULL;
	}

	if (fluid_midi_file_read_mthd(mf) != FLUID_OK) {
		FLUID_FREE(mf);
		return NULL;
	}
	return mf;
}
开发者ID:caomw,项目名称:fluidsynth,代码行数:33,代码来源:fluid_midi.c

示例4: delete_fluid_dsound_audio_driver

void delete_fluid_dsound_audio_driver(fluid_audio_driver_t* d)
{
  fluid_dsound_audio_driver_t* dev = (fluid_dsound_audio_driver_t*) d;
  fluid_return_if_fail(dev != NULL);

  /* tell the audio thread to stop its loop */
  dev->cont = 0;

  /* wait till the audio thread exits */
  if (dev->thread != 0) {
    if (WaitForSingleObject(dev->thread, 2000) != WAIT_OBJECT_0) {
      /* on error kill the thread mercilessly */
      FLUID_LOG(FLUID_DBG, "Couldn't join the audio thread. killing it.");
      TerminateThread(dev->thread, 0);
    }
  }

  /* release all the allocated ressources */

    FLUID_FREE(dev->format);

  if (dev->sec_buffer != NULL) {
    IDirectSoundBuffer_Stop(dev->sec_buffer);
    IDirectSoundBuffer_Release(dev->sec_buffer);
  }
  if (dev->prim_buffer != NULL) {
    IDirectSoundBuffer_Release(dev->prim_buffer);
  }
  if (dev->direct_sound != NULL) {
    IDirectSound_Release(dev->direct_sound);
  }

  FLUID_FREE(dev);
}
开发者ID:nezticle,项目名称:fluidsynth,代码行数:34,代码来源:fluid_dsound.c

示例5: delete_fluid_portaudio_driver

/*
 * delete_fluid_portaudio_driver
 */
int
delete_fluid_portaudio_driver(fluid_audio_driver_t *p)
{
  fluid_portaudio_driver_t* dev;
  PaError err;

  dev = (fluid_portaudio_driver_t*)p;
  if (dev == NULL) return FLUID_OK;

  /* PortAudio section */
  if (dev->stream) Pa_CloseStream (dev->stream);

  err = Pa_Terminate();

  if (err != paNoError)
    printf ("PortAudio termination error: %s\n", Pa_GetErrorText (err) );

  if (dev->buffers[0]) {
    FLUID_FREE(dev->buffers[0]);
  }
  if (dev->buffers[1]) {
    FLUID_FREE(dev->buffers[1]);
  }

  FLUID_FREE (dev);
  return FLUID_OK;
}
开发者ID:antoineschmitt,项目名称:fluidXtra,代码行数:30,代码来源:fluid_portaudio.c

示例6: delete_fluid_player

/**
 * Delete a MIDI player instance.
 * @param player MIDI player instance
 * @return Always returns #FLUID_OK
 */
int
delete_fluid_player(fluid_player_t *player)
{
    fluid_list_t *q;
    fluid_playlist_item* pi;

    if (player == NULL) {
        return FLUID_OK;
    }
    fluid_player_stop(player);
    fluid_player_reset(player);

    while (player->playlist != NULL) {
        q = player->playlist->next;
        pi = (fluid_playlist_item*) player->playlist->data;
        FLUID_FREE(pi->filename);
        FLUID_FREE(pi->buffer);
        FLUID_FREE(pi);
        delete1_fluid_list(player->playlist);
        player->playlist = q;
    }

    FLUID_FREE(player);
    return FLUID_OK;
}
开发者ID:midifi,项目名称:fluidsynth,代码行数:30,代码来源:fluid_midi.c

示例7: delete_samplecache_entry

static void delete_samplecache_entry(fluid_samplecache_entry_t *entry)
{
    fluid_return_if_fail(entry != NULL);

    FLUID_FREE(entry->filename);
    FLUID_FREE(entry->sample_data);
    FLUID_FREE(entry->sample_data24);
    FLUID_FREE(entry);
}
开发者ID:tecan,项目名称:LunaLibs,代码行数:9,代码来源:fluid_samplecache.c

示例8: delete_fluid_tuning

void delete_fluid_tuning(fluid_tuning_t* tuning)
{
  if (tuning == NULL) {
    return;
  }
  if (tuning->name != NULL) {
    FLUID_FREE(tuning->name);
  }
  FLUID_FREE(tuning);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:10,代码来源:fluid_tuning.c

示例9: delete_fluid_track

/*
 * delete_fluid_track
 */
int delete_fluid_track(fluid_track_t* track)
{
	if (track->name != NULL) {
		FLUID_FREE(track->name);
	}
	if (track->first != NULL) {
		delete_fluid_midi_event(track->first);
	}
	FLUID_FREE(track);
	return FLUID_OK;
}
开发者ID:caomw,项目名称:fluidsynth,代码行数:14,代码来源:fluid_midi.c

示例10: fluid_hashtable_unref

/**
 * fluid_hashtable_unref:
 * @hashtable: a valid #fluid_hashtable_t.
 *
 * Atomically decrements the reference count of @hashtable by one.
 * If the reference count drops to 0, all keys and values will be
 * destroyed, and all memory allocated by the hash table is released.
 * This function is MT-safe and may be called from any thread.
 *
 * Since: 2.10
 **/
void
fluid_hashtable_unref (fluid_hashtable_t *hashtable)
{
  fluid_return_if_fail (hashtable != NULL);
  fluid_return_if_fail (hashtable->ref_count > 0);

  if (fluid_atomic_int_exchange_and_add (&hashtable->ref_count, -1) - 1 == 0)
    {
      fluid_hashtable_remove_all_nodes (hashtable, TRUE);
      FLUID_FREE (hashtable->nodes);
      FLUID_FREE (hashtable);
    }
}
开发者ID:caomw,项目名称:fluidsynth,代码行数:24,代码来源:fluid_hash.c

示例11: delete_fluid_midishare_midi_driver

/*
 * delete_fluid_midishare_midi_driver
 */
int delete_fluid_midishare_midi_driver(fluid_midi_driver_t* p)
{
    fluid_midishare_midi_driver_t* dev;

    dev = (fluid_midishare_midi_driver_t*) p;
    if (dev == NULL) {
        return FLUID_OK;
    }

    if (dev->filter) MidiFreeFilter(dev->filter);

#if defined(MIDISHARE_DRIVER)
    fluid_midishare_close_driver(dev);
#else
    fluid_midishare_close_appl(dev);
#endif

#if defined(MACINTOSH) && defined(MACOS9)
    DisposeRoutineDescriptor(dev->upp_alarm_ptr);
    DisposeRoutineDescriptor(dev->upp_wakeup_ptr);
    DisposeRoutineDescriptor(dev->upp_sleep_ptr);
    DisposeRoutineDescriptor(dev->upp_task_ptr);
#endif

    dev->status = FLUID_MIDI_DONE;

    FLUID_FREE(dev);
    return FLUID_OK;
}
开发者ID:kirbyfan64,项目名称:fluidsynth,代码行数:32,代码来源:fluid_midishare.c

示例12: fluid_settings_remove_option

/**
 * Remove an option previously assigned by fluid_settings_add_option().
 * @param settings a settings object
 * @param name a setting's name
 * @param s option string to remove
 * @return 1 if the setting exists and option was removed, 0 otherwise
 */
int
fluid_settings_remove_option(fluid_settings_t* settings, const char *name, const char* s)
{
  fluid_setting_node_t *node;
  int retval = 0;

  fluid_return_val_if_fail (settings != NULL, 0);
  fluid_return_val_if_fail (name != NULL, 0);
  fluid_return_val_if_fail (s != NULL, 0);

  fluid_rec_mutex_lock (settings->mutex);

  if (fluid_settings_get(settings, name, &node)
      && (node->type == FLUID_STR_TYPE)) {

    fluid_str_setting_t* setting = (fluid_str_setting_t*) node;
    fluid_list_t* list = setting->options;

    while (list) {
      char* option = (char*) fluid_list_get(list);
      if (FLUID_STRCMP(s, option) == 0) {
	FLUID_FREE (option);
	setting->options = fluid_list_remove_link(setting->options, list);
	retval = 1;
        break;
      }
      list = fluid_list_next(list);
    }
  }

  fluid_rec_mutex_unlock (settings->mutex);

  return retval;
}
开发者ID:caomw,项目名称:fluidsynth,代码行数:41,代码来源:fluid_settings.c

示例13: delete_fluid_dart_audio_driver

int delete_fluid_dart_audio_driver(fluid_audio_driver_t* p)
{
    fluid_dart_audio_driver_t* dev = (fluid_dart_audio_driver_t*) p;

    if (dev == NULL) {
        return FLUID_OK;
    }

    if (dev->usDeviceID != 0) {
        MCI_GENERIC_PARMS    GenericParms;

        /* Send message to stop the audio device
         */
        m_pfnmciSendCommand(dev->usDeviceID, MCI_STOP, MCI_WAIT,
                            (PVOID)&GenericParms, 0);

        /* Deallocate device buffers
         */
        m_pfnmciSendCommand(dev->usDeviceID, MCI_BUFFER,
                            MCI_WAIT | MCI_DEALLOCATE_MEMORY,
                            (PVOID)&dev->BufferParms, 0);

        /* Close device the mixer device
         */
        m_pfnmciSendCommand(dev->usDeviceID, MCI_CLOSE, MCI_WAIT,
                            (PVOID)&GenericParms, 0);
    }

    FLUID_FREE(dev);
    return FLUID_OK;
}
开发者ID:OS2World,项目名称:MM-UTIL-fluidsynth,代码行数:31,代码来源:fluid_dart.c

示例14: new_fluid_timer

fluid_timer_t*
new_fluid_timer (int msec, fluid_timer_callback_t callback, void* data,
                 int new_thread, int auto_destroy, int high_priority)
{
  fluid_timer_t *timer;

  timer = FLUID_NEW (fluid_timer_t);

  if (timer == NULL)
  {
    FLUID_LOG (FLUID_ERR, "Out of memory");
    return NULL;
  }

  timer->msec = msec;
  timer->callback = callback;
  timer->data = data;
  timer->cont = TRUE ;
  timer->thread = NULL;
  timer->auto_destroy = auto_destroy;

  if (new_thread)
  {
    timer->thread = new_fluid_thread ("timer", fluid_timer_run, timer, high_priority
                                      ? FLUID_SYS_TIMER_HIGH_PRIO_LEVEL : 0, FALSE);
    if (!timer->thread)
    {
      FLUID_FREE (timer);
      return NULL;
    }
  }
  else fluid_timer_run (timer);  /* Run directly, instead of as a separate thread */

  return timer;
}
开发者ID:paulsapps,项目名称:fluidsynth,代码行数:35,代码来源:fluid_sys.c

示例15: fluid_timer_run

void
fluid_timer_run (void *data)
{
  fluid_timer_t *timer;
  int count = 0;
  int cont;
  long start;
  long delay;

  timer = (fluid_timer_t *)data;

  /* keep track of the start time for absolute positioning */
  start = fluid_curtime ();

  while (timer->cont)
  {
    cont = (*timer->callback)(timer->data, fluid_curtime() - start);

    count++;
    if (!cont) break;

    /* to avoid incremental time errors, calculate the delay between
       two callbacks bringing in the "absolute" time (count *
       timer->msec) */
    delay = (count * timer->msec) - (fluid_curtime() - start);
    if (delay > 0) fluid_usleep (delay * 1000);
  }

  FLUID_LOG (FLUID_DBG, "Timer thread finished");

  if (timer->auto_destroy)
    FLUID_FREE (timer);

  return;
}
开发者ID:paulsapps,项目名称:fluidsynth,代码行数:35,代码来源:fluid_sys.c


注:本文中的FLUID_FREE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。