Fix broken bounds check.
[calfbox.git] / song.h
blob7b2098ff168a3457823bc4ef760f112afb8ab6da
1 /*
2 Calf Box, an open source musical instrument.
3 Copyright (C) 2010-2011 Krzysztof Foltman
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef CBOX_SONG_H
20 #define CBOX_SONG_H
22 #include "dom.h"
23 #include "pattern.h"
25 CBOX_EXTERN_CLASS(cbox_song)
27 struct cbox_track;
29 struct cbox_master_track_item
31 uint32_t duration_ppqn;
32 // May be zero (= no change)
33 double tempo;
34 // Either both are zero (= no change) or both are non-zero
35 int timesig_nom, timesig_denom;
38 struct cbox_master_track
40 GList *items;
43 struct cbox_song
45 CBOX_OBJECT_HEADER()
46 struct cbox_command_target cmd_target;
47 GList *master_track_items;
48 GList *tracks;
49 GList *patterns;
50 gchar *lyrics_sheet, *chord_sheet;
51 uint32_t loop_start_ppqn, loop_end_ppqn;
54 extern struct cbox_song *cbox_song_new(struct cbox_document *document);
55 extern void cbox_song_add_track(struct cbox_song *song, struct cbox_track *track);
56 extern void cbox_song_remove_track(struct cbox_song *song, struct cbox_track *track);
57 extern void cbox_song_clear(struct cbox_song *song);
58 extern void cbox_song_use_looped_pattern(struct cbox_song *song, struct cbox_midi_pattern *pattern);
59 extern void cbox_song_set_mti(struct cbox_song *song, uint32_t pos, double tempo, int timesig_nom, int timesig_denom);
60 extern void cbox_song_destroy(struct cbox_song *song);
62 #endif