Exemplo n.º 1
0
Arquivo: smf.c Projeto: Darko8/libsmf
/**
 * Add End Of Track metaevent.  Using it is optional, libsmf will automatically
 * add EOT to the tracks during smf_save, with delta_pulses 0.  If you try to add EOT
 * in the middle of the track, it will fail and nonzero value will be returned.
 * If you try to add EOT after another EOT event, it will be added, but the existing
 * EOT event will be removed.
 *
 * \return 0 if everything went ok, nonzero otherwise.
 */
int
smf_track_add_eot_delta_pulses(smf_track_t *track, int delta)
{
	smf_event_t *event;

	event = smf_event_new_from_bytes(0xFF, 0x2F, 0x00);
	if (event == NULL)
		return (-1);

	smf_track_add_event_delta_pulses(track, event, delta);

	return (0);
}
Exemplo n.º 2
0
CAMLprim value ocaml_smf_event_new_from_bytes(value byte0, value byte1, value byte2)
{
    CAMLparam3(byte0, byte1, byte2);
    CAMLlocal1(ret);
    smf_event_t *event;
    event = smf_event_new_from_bytes(Int_val(byte0), Int_val(byte1), Int_val(byte2));
    if(event == NULL)
    {
        smf_err(0);
    }

    ret = create_event(event);

    CAMLreturn(ret);
}
Exemplo n.º 3
0
Arquivo: smf.c Projeto: Darko8/libsmf
int
smf_track_add_eot_seconds(smf_track_t *track, double seconds)
{
	smf_event_t *event, *last_event;

	last_event = smf_track_get_last_event(track);
	if (last_event != NULL) {
		if (last_event->time_seconds > seconds)
			return (-2);
	}

	event = smf_event_new_from_bytes(0xFF, 0x2F, 0x00);
	if (event == NULL)
		return (-1);

	smf_track_add_event_seconds(track, event, seconds);

	return (0);
}
Exemplo n.º 4
0
Arquivo: smf.c Projeto: Darko8/libsmf
int
smf_track_add_eot_pulses(smf_track_t *track, int pulses)
{
	smf_event_t *event, *last_event;

	last_event = smf_track_get_last_event(track);
	if (last_event != NULL) {
		if (last_event->time_pulses > pulses)
			return (-2);
	}

	event = smf_event_new_from_bytes(0xFF, 0x2F, 0x00);
	if (event == NULL)
		return (-3);

	smf_track_add_event_pulses(track, event, pulses);

	return (0);
}