rev |
line source |
nuclear@0
|
1 /*-
|
nuclear@0
|
2 * Copyright (c) 2007, 2008 Edward Tomasz NapieraĆa <trasz@FreeBSD.org>
|
nuclear@0
|
3 * All rights reserved.
|
nuclear@0
|
4 *
|
nuclear@0
|
5 * Redistribution and use in source and binary forms, with or without
|
nuclear@0
|
6 * modification, are permitted provided that the following conditions
|
nuclear@0
|
7 * are met:
|
nuclear@0
|
8 * 1. Redistributions of source code must retain the above copyright
|
nuclear@0
|
9 * notice, this list of conditions and the following disclaimer.
|
nuclear@0
|
10 * 2. Redistributions in binary form must reproduce the above copyright
|
nuclear@0
|
11 * notice, this list of conditions and the following disclaimer in the
|
nuclear@0
|
12 * documentation and/or other materials provided with the distribution.
|
nuclear@0
|
13 *
|
nuclear@0
|
14 * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT IS PROVIDED BY THE
|
nuclear@0
|
15 * AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
nuclear@0
|
16 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
nuclear@0
|
17 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
nuclear@0
|
18 * THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
nuclear@0
|
19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
nuclear@0
|
20 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
nuclear@0
|
21 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
nuclear@0
|
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
nuclear@0
|
23 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
nuclear@0
|
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
nuclear@0
|
25 *
|
nuclear@0
|
26 */
|
nuclear@0
|
27
|
nuclear@0
|
28 #ifndef SMF_PRIVATE_H
|
nuclear@0
|
29 #define SMF_PRIVATE_H
|
nuclear@0
|
30
|
nuclear@0
|
31 #include <stdint.h>
|
nuclear@0
|
32 #include <sys/types.h>
|
nuclear@0
|
33
|
nuclear@0
|
34 #include "fake_glib.h"
|
nuclear@0
|
35
|
nuclear@0
|
36 #include "config.h"
|
nuclear@0
|
37
|
nuclear@0
|
38 #define SMF_VERSION PACKAGE_VERSION
|
nuclear@0
|
39
|
nuclear@0
|
40 /**
|
nuclear@0
|
41 * \file
|
nuclear@0
|
42 *
|
nuclear@0
|
43 * Private header. Applications using libsmf should use smf.h.
|
nuclear@0
|
44 *
|
nuclear@0
|
45 */
|
nuclear@0
|
46
|
nuclear@0
|
47 #if defined(__GNUC__)
|
nuclear@0
|
48 #define ATTRIBUTE_PACKED __attribute__((__packed__))
|
nuclear@0
|
49 #else
|
nuclear@0
|
50 #define ATTRIBUTE_PACKED
|
nuclear@0
|
51 #pragma pack(1)
|
nuclear@0
|
52 #endif
|
nuclear@0
|
53
|
nuclear@0
|
54 /** SMF chunk header, used only by smf_load.c and smf_save.c. */
|
nuclear@0
|
55 struct chunk_header_struct {
|
nuclear@0
|
56 char id[4];
|
nuclear@0
|
57 uint32_t length;
|
nuclear@0
|
58 } ATTRIBUTE_PACKED;
|
nuclear@0
|
59
|
nuclear@0
|
60 /** SMF chunk, used only by smf_load.c and smf_save.c. */
|
nuclear@0
|
61 struct mthd_chunk_struct {
|
nuclear@0
|
62 struct chunk_header_struct mthd_header;
|
nuclear@0
|
63 uint16_t format;
|
nuclear@0
|
64 uint16_t number_of_tracks;
|
nuclear@0
|
65 uint16_t division;
|
nuclear@0
|
66 } ATTRIBUTE_PACKED;
|
nuclear@0
|
67
|
nuclear@0
|
68 #if (!defined __GNUC__)
|
nuclear@0
|
69 #pragma pack()
|
nuclear@0
|
70 #endif
|
nuclear@0
|
71
|
nuclear@0
|
72 void smf_track_add_event(smf_track_t *track, smf_event_t *event);
|
nuclear@0
|
73 void smf_init_tempo(smf_t *smf);
|
nuclear@0
|
74 void smf_fini_tempo(smf_t *smf);
|
nuclear@0
|
75 void smf_create_tempo_map_and_compute_seconds(smf_t *smf);
|
nuclear@0
|
76 void maybe_add_to_tempo_map(smf_event_t *event);
|
nuclear@0
|
77 void remove_last_tempo_with_pulses(smf_t *smf, int pulses);
|
nuclear@0
|
78 int smf_event_is_tempo_change_or_time_signature(const smf_event_t *event) WARN_UNUSED_RESULT;
|
nuclear@0
|
79 int smf_event_length_is_valid(const smf_event_t *event) WARN_UNUSED_RESULT;
|
nuclear@0
|
80 int is_status_byte(const unsigned char status) WARN_UNUSED_RESULT;
|
nuclear@0
|
81
|
nuclear@0
|
82 #endif /* SMF_PRIVATE_H */
|
nuclear@0
|
83
|