smflite
diff src/smf_private.h @ 0:4264abea8b06
smf-lite initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 26 Jan 2012 11:25:11 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/smf_private.h Thu Jan 26 11:25:11 2012 +0200 1.3 @@ -0,0 +1,83 @@ 1.4 +/*- 1.5 + * Copyright (c) 2007, 2008 Edward Tomasz NapieraĆa <trasz@FreeBSD.org> 1.6 + * All rights reserved. 1.7 + * 1.8 + * Redistribution and use in source and binary forms, with or without 1.9 + * modification, are permitted provided that the following conditions 1.10 + * are met: 1.11 + * 1. Redistributions of source code must retain the above copyright 1.12 + * notice, this list of conditions and the following disclaimer. 1.13 + * 2. Redistributions in binary form must reproduce the above copyright 1.14 + * notice, this list of conditions and the following disclaimer in the 1.15 + * documentation and/or other materials provided with the distribution. 1.16 + * 1.17 + * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT IS PROVIDED BY THE 1.18 + * AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 1.19 + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 1.20 + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 1.21 + * THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.22 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 1.23 + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 1.24 + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 1.25 + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1.26 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 1.27 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.28 + * 1.29 + */ 1.30 + 1.31 +#ifndef SMF_PRIVATE_H 1.32 +#define SMF_PRIVATE_H 1.33 + 1.34 +#include <stdint.h> 1.35 +#include <sys/types.h> 1.36 + 1.37 +#include "fake_glib.h" 1.38 + 1.39 +#include "config.h" 1.40 + 1.41 +#define SMF_VERSION PACKAGE_VERSION 1.42 + 1.43 +/** 1.44 + * \file 1.45 + * 1.46 + * Private header. Applications using libsmf should use smf.h. 1.47 + * 1.48 + */ 1.49 + 1.50 +#if defined(__GNUC__) 1.51 +#define ATTRIBUTE_PACKED __attribute__((__packed__)) 1.52 +#else 1.53 +#define ATTRIBUTE_PACKED 1.54 +#pragma pack(1) 1.55 +#endif 1.56 + 1.57 +/** SMF chunk header, used only by smf_load.c and smf_save.c. */ 1.58 +struct chunk_header_struct { 1.59 + char id[4]; 1.60 + uint32_t length; 1.61 +} ATTRIBUTE_PACKED; 1.62 + 1.63 +/** SMF chunk, used only by smf_load.c and smf_save.c. */ 1.64 +struct mthd_chunk_struct { 1.65 + struct chunk_header_struct mthd_header; 1.66 + uint16_t format; 1.67 + uint16_t number_of_tracks; 1.68 + uint16_t division; 1.69 +} ATTRIBUTE_PACKED; 1.70 + 1.71 +#if (!defined __GNUC__) 1.72 +#pragma pack() 1.73 +#endif 1.74 + 1.75 +void smf_track_add_event(smf_track_t *track, smf_event_t *event); 1.76 +void smf_init_tempo(smf_t *smf); 1.77 +void smf_fini_tempo(smf_t *smf); 1.78 +void smf_create_tempo_map_and_compute_seconds(smf_t *smf); 1.79 +void maybe_add_to_tempo_map(smf_event_t *event); 1.80 +void remove_last_tempo_with_pulses(smf_t *smf, int pulses); 1.81 +int smf_event_is_tempo_change_or_time_signature(const smf_event_t *event) WARN_UNUSED_RESULT; 1.82 +int smf_event_length_is_valid(const smf_event_t *event) WARN_UNUSED_RESULT; 1.83 +int is_status_byte(const unsigned char status) WARN_UNUSED_RESULT; 1.84 + 1.85 +#endif /* SMF_PRIVATE_H */ 1.86 +