Got seek_ppqn/seek_samples the other way around :-)
[calfbox.git] / mididest.h
blob78b294d1befb723cdc20ce714aa0fa98b562a4f9
1 /*
2 Calf Box, an open source musical instrument.
3 Copyright (C) 2010-2013 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_MIDIDEST_H
20 #define CBOX_MIDIDEST_H
22 #include "midi.h"
23 #include <glib.h>
25 struct cbox_command_target;
26 struct cbox_rt;
28 struct cbox_midi_source
30 struct cbox_midi_buffer *data;
31 int bpos;
32 gboolean streaming;
35 struct cbox_midi_merger
37 struct cbox_midi_source **inputs;
38 int input_count;
39 struct cbox_midi_buffer *output;
42 void cbox_midi_merger_init(struct cbox_midi_merger *dest, struct cbox_midi_buffer *output);
43 void cbox_midi_merger_render_to(struct cbox_midi_merger *dest, struct cbox_midi_buffer *output);
44 static inline void cbox_midi_merger_render(struct cbox_midi_merger *dest)
46 if (dest->output)
47 cbox_midi_merger_render_to(dest, dest->output);
49 int cbox_midi_merger_find_source(struct cbox_midi_merger *dest, struct cbox_midi_buffer *buffer);
50 void cbox_midi_merger_connect(struct cbox_midi_merger *dest, struct cbox_midi_buffer *buffer, struct cbox_rt *rt);
51 void cbox_midi_merger_disconnect(struct cbox_midi_merger *dest, struct cbox_midi_buffer *buffer, struct cbox_rt *rt);
52 void cbox_midi_merger_push(struct cbox_midi_merger *dest, struct cbox_midi_buffer *buffer, struct cbox_rt *rt);
53 void cbox_midi_merger_close(struct cbox_midi_merger *dest);
55 #define GET_RT_FROM_cbox_midi_appsink(appsink) ((appsink)->rt)
57 struct cbox_midi_appsink
59 struct cbox_rt *rt;
60 struct cbox_midi_buffer midibufs[2];
61 int current_buffer;
64 extern void cbox_midi_appsink_init(struct cbox_midi_appsink *appsink, struct cbox_rt *rt);
65 extern void cbox_midi_appsink_supply(struct cbox_midi_appsink *appsink, struct cbox_midi_buffer *buffer);
66 extern const struct cbox_midi_buffer *cbox_midi_appsink_get_input_midi_data(struct cbox_midi_appsink *appsink);
67 extern gboolean cbox_midi_appsink_send_to(struct cbox_midi_appsink *appsink, struct cbox_command_target *fb, GError **error);
69 #endif