libsmf

- Main Page
- Data Structures
- Files

- File List
- Globals

Data Structures | Functions | Variables
smf_private.h File Reference

Private header. More...

Go to the source code of this file.

## Data Structures
struct | chunk_header_struct
| SMF chunk header, used only by smf_load.c and smf_save.c. More...
struct | mthd_chunk_struct
| SMF chunk, used only by smf_load.c and smf_save.c. More...

## Functions
void | smf_track_add_event (smf_track_t *track, smf_event_t *event)
| Adds the event to the track and computes ->delta_pulses. More...
void | smf_init_tempo (smf_t *smf)
void | smf_fini_tempo (smf_t *smf)
void | smf_create_tempo_map_and_compute_seconds (smf_t *smf)
void | maybe_add_to_tempo_map (smf_event_t *event)
void | remove_last_tempo_with_pulses (smf_t *smf, int pulses)
int | smf_event_is_tempo_change_or_time_signature (const smf_event_t *event) WARN_UNUSED_RESULT
int | smf_event_length_is_valid (const smf_event_t *event) WARN_UNUSED_RESULT
int | is_status_byte (const unsigned char status) WARN_UNUSED_RESULT
| Returns 1 if the given byte is a valid status byte, 0 otherwise. More...

## Variables
struct chunk_header_struct | ATTRIBUTE_PACKED

## Detailed Description

Private header.

Applications using libsmf should use smf.h.

Definition in file smf_private.h.

## Function Documentation

int is_status_byte | ( | const unsigned char | status | ) |

Returns 1 if the given byte is a valid status byte, 0 otherwise.

Definition at line 251 of file smf_load.c.

Referenced by smf_event_is_valid(), and smf_event_new_from_bytes().

void maybe_add_to_tempo_map | ( | smf_event_t * | event | ) |

Definition at line 125 of file smf_tempo.c.

References smf_event_struct::midi_buffer, smf_event_struct::midi_buffer_length, smf_track_struct::smf, smf_event_is_metadata(), smf_event_struct::time_pulses, and smf_event_struct::track.

Referenced by smf_create_tempo_map_and_compute_seconds(), and smf_track_add_event().

void remove_last_tempo_with_pulses | ( | smf_t * | smf,
|  | int | pulses
| ) |  |

Definition at line 173 of file smf_tempo.c.

References smf_get_last_tempo(), smf_struct::tempo_array, and smf_tempo_struct::time_pulses.

Referenced by smf_event_remove_from_track().

void smf_create_tempo_map_and_compute_seconds | ( | smf_t * | smf | ) |

Definition at line 235 of file smf_tempo.c.

References maybe_add_to_tempo_map(), smf_get_next_event(), smf_init_tempo(), smf_rewind(), and smf_event_struct::time_pulses.

Referenced by smf_event_remove_from_track(), and smf_track_add_event().

int smf_event_is_tempo_change_or_time_signature | ( | const smf_event_t * | event | ) |

Returns
  Nonzero if event is Tempo Change or Time Signature metaevent.

Definition at line 631 of file smf.c.

References smf_event_struct::midi_buffer, smf_event_struct::midi_buffer_length, and smf_event_is_metadata().

Referenced by smf_event_remove_from_track(), and smf_track_add_event().

int smf_event_length_is_valid | ( | const smf_event_t * | event | ) |

Returns
  Nonzero, if event is as long as it should be, from the MIDI specification point of view. Does not work for SysExes - it doesn't recognize internal structure of SysEx.

Definition at line 718 of file smf_load.c.

References smf_event_struct::midi_buffer, smf_event_struct::midi_buffer_length, and smf_event_is_sysex().

Referenced by smf_event_decode(), and smf_event_is_valid().

void smf_fini_tempo | ( | smf_t * | smf | ) |

Definition at line 342 of file smf_tempo.c.

References smf_struct::tempo_array.

Referenced by smf_delete(), and smf_init_tempo().

void smf_init_tempo | ( | smf_t * | smf | ) |

Definition at line 367 of file smf_tempo.c.

References smf_fini_tempo().

Referenced by smf_create_tempo_map_and_compute_seconds(), and smf_new().

void smf_track_add_event | ( | smf_track_t * | track,
|  | smf_event_t * | event
| ) |  |

Adds the event to the track and computes ->delta_pulses.

Note that it is faster to append events to the end of the track than to insert them in the middle. Usually you want to use smf_track_add_event_seconds or smf_track_add_event_pulses instead of this one. Event needs to have ->time_pulses and ->time_seconds already set. If you try to add event after an EOT, EOT event will be automatically deleted.

Definition at line 441 of file smf.c.

References smf_event_struct::delta_time_pulses, smf_event_struct::event_number, smf_track_struct::events_array, maybe_add_to_tempo_map(), smf_track_struct::next_event_number, smf_track_struct::number_of_events, smf_track_struct::smf, smf_create_tempo_map_and_compute_seconds(), smf_event_is_last(), smf_event_is_tempo_change_or_time_signature(), smf_track_get_event_by_number(), smf_track_get_last_event(), smf_event_struct::time_pulses, smf_event_struct::time_seconds, smf_event_struct::track, and smf_track_struct::track_number.

Referenced by smf_track_add_event_pulses(), and smf_track_add_event_seconds().

## Variable Documentation

struct mthd_chunk_struct ATTRIBUTE_PACKED