nuclear@0: /*- nuclear@0: * Copyright (c) 2007, 2008 Edward Tomasz NapieraƂa nuclear@0: * All rights reserved. nuclear@0: * nuclear@0: * Redistribution and use in source and binary forms, with or without nuclear@0: * modification, are permitted provided that the following conditions nuclear@0: * are met: nuclear@0: * 1. Redistributions of source code must retain the above copyright nuclear@0: * notice, this list of conditions and the following disclaimer. nuclear@0: * 2. Redistributions in binary form must reproduce the above copyright nuclear@0: * notice, this list of conditions and the following disclaimer in the nuclear@0: * documentation and/or other materials provided with the distribution. nuclear@0: * nuclear@0: * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT IS PROVIDED BY THE nuclear@0: * AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, nuclear@0: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY nuclear@0: * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL nuclear@0: * THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, nuclear@0: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED nuclear@0: * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, nuclear@0: * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY nuclear@0: * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING nuclear@0: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS nuclear@0: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. nuclear@0: * nuclear@0: */ nuclear@0: nuclear@0: #ifndef SMF_PRIVATE_H nuclear@0: #define SMF_PRIVATE_H nuclear@0: nuclear@0: #include nuclear@0: #include nuclear@0: nuclear@0: #include "fake_glib.h" nuclear@0: nuclear@0: #include "config.h" nuclear@0: nuclear@0: #define SMF_VERSION PACKAGE_VERSION nuclear@0: nuclear@0: /** nuclear@0: * \file nuclear@0: * nuclear@0: * Private header. Applications using libsmf should use smf.h. nuclear@0: * nuclear@0: */ nuclear@0: nuclear@0: #if defined(__GNUC__) nuclear@0: #define ATTRIBUTE_PACKED __attribute__((__packed__)) nuclear@0: #else nuclear@0: #define ATTRIBUTE_PACKED nuclear@0: #pragma pack(1) nuclear@0: #endif nuclear@0: nuclear@0: /** SMF chunk header, used only by smf_load.c and smf_save.c. */ nuclear@0: struct chunk_header_struct { nuclear@0: char id[4]; nuclear@0: uint32_t length; nuclear@0: } ATTRIBUTE_PACKED; nuclear@0: nuclear@0: /** SMF chunk, used only by smf_load.c and smf_save.c. */ nuclear@0: struct mthd_chunk_struct { nuclear@0: struct chunk_header_struct mthd_header; nuclear@0: uint16_t format; nuclear@0: uint16_t number_of_tracks; nuclear@0: uint16_t division; nuclear@0: } ATTRIBUTE_PACKED; nuclear@0: nuclear@0: #if (!defined __GNUC__) nuclear@0: #pragma pack() nuclear@0: #endif nuclear@0: nuclear@0: void smf_track_add_event(smf_track_t *track, smf_event_t *event); nuclear@0: void smf_init_tempo(smf_t *smf); nuclear@0: void smf_fini_tempo(smf_t *smf); nuclear@0: void smf_create_tempo_map_and_compute_seconds(smf_t *smf); nuclear@0: void maybe_add_to_tempo_map(smf_event_t *event); nuclear@0: void remove_last_tempo_with_pulses(smf_t *smf, int pulses); nuclear@0: int smf_event_is_tempo_change_or_time_signature(const smf_event_t *event) WARN_UNUSED_RESULT; nuclear@0: int smf_event_length_is_valid(const smf_event_t *event) WARN_UNUSED_RESULT; nuclear@0: int is_status_byte(const unsigned char status) WARN_UNUSED_RESULT; nuclear@0: nuclear@0: #endif /* SMF_PRIVATE_H */ nuclear@0: