Merge pull request #1 from atsampson/master
[calfbox.git] / pattern.h
blobec91fb5068f099df193b9b5676a326a866c9bddd
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_PATTERN_H
20 #define CBOX_PATTERN_H
22 #include "dom.h"
23 #include "master.h"
24 #include "midi.h"
26 CBOX_EXTERN_CLASS(cbox_midi_pattern)
28 struct cbox_blob;
29 struct cbox_song;
31 struct cbox_midi_pattern
33 CBOX_OBJECT_HEADER()
34 struct cbox_command_target cmd_target;
35 struct cbox_song *owner;
36 gchar *name;
37 struct cbox_midi_event *events;
38 int event_count;
39 int loop_end;
42 struct cbox_blob_serialized_event
44 int32_t time;
45 unsigned char len, cmd, byte1, byte2;
48 extern struct cbox_midi_pattern *cbox_midi_pattern_new_metronome(struct cbox_song *song, int ts, uint64_t ppqn_factor);
49 extern struct cbox_midi_pattern *cbox_midi_pattern_load(struct cbox_song *song, const char *name, int is_drum, uint64_t ppqn_factor);
50 extern struct cbox_midi_pattern *cbox_midi_pattern_load_track(struct cbox_song *song, const char *name, int is_drum, uint64_t ppqn_factor);
51 extern struct cbox_midi_pattern *cbox_midi_pattern_new_from_blob(struct cbox_song *song, const struct cbox_blob *blob, int length, uint64_t ppqn_factor);
53 extern struct cbox_blob *cbox_midi_pattern_to_blob(struct cbox_midi_pattern *pat, int *length);
55 extern gboolean cbox_midi_pattern_process_cmd(struct cbox_command_target *ct, struct cbox_command_target *fb, struct cbox_osc_command *cmd, GError **error);
57 #endif