示例#1
0
文件: midi.c 项目: denemo/denemo
static void
safely_track_remove_from_smf (smf_track_t * track)
{
  if (track->smf != NULL && (track->track_number>=1))
    smf_track_remove_from_smf (track);
  track->smf = NULL;
}
示例#2
0
文件: smf.c 项目: 63n/ardour
/**
 * Detaches track from its smf and frees it.
 */
void
smf_track_delete(smf_track_t *track)
{
	assert(track);
	assert(track->events_array);

	/* Remove all the events */
	unsigned int i;
	for (i = 0; i < track->events_array->len; ++i) {
		smf_event_t* ev = (smf_event_t*)g_ptr_array_index(track->events_array, i);
		free (ev->midi_buffer);
		free (ev);
	}

	g_ptr_array_remove_range(track->events_array, 0, track->events_array->len);
	track->number_of_events = 0;

	if (track->smf)
		smf_track_remove_from_smf(track);

	assert(track->events_array->len == 0);
	g_ptr_array_free(track->events_array, TRUE);

	memset(track, 0, sizeof(smf_track_t));
	free(track);
}
示例#3
0
文件: smf.c 项目: Darko8/libsmf
/**
 * Detaches track from its smf and frees it.
 */
void
smf_track_delete(smf_track_t *track)
{
	assert(track);
	assert(track->events_array);

	/* Remove all the events, from last to first. */
	while (track->events_array->len > 0)
		smf_event_delete(g_ptr_array_index(track->events_array, track->events_array->len - 1));

	if (track->smf)
		smf_track_remove_from_smf(track);

	assert(track->events_array->len == 0);
	assert(track->number_of_events == 0);
	g_ptr_array_free(track->events_array, TRUE);

	memset(track, 0, sizeof(smf_track_t));
	free(track);
}