In case of running out of prefetch pipes, truncate the sample to the preloaded part.
[calfbox.git] / engine.h
blob30b9bfa20c7b5c73077cafa2097d1f85f018f333
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_ENGINE_H
20 #define CBOX_ENGINE_H
22 #include "cmd.h"
23 #include "dom.h"
24 #include "io.h"
25 #include "midi.h"
26 #include "rt.h"
28 CBOX_EXTERN_CLASS(cbox_engine)
30 #define GET_RT_FROM_cbox_engine(ptr) ((ptr)->rt)
32 struct cbox_engine
34 CBOX_OBJECT_HEADER()
35 struct cbox_command_target cmd_target;
36 struct cbox_io_env io_env;
37 struct cbox_rt *rt;
38 struct cbox_scene **scenes;
39 int scene_count;
40 struct cbox_song_playback *spb;
41 struct cbox_module *effect;
42 struct cbox_master *master;
43 struct cbox_midi_buffer midibuf_aux, midibuf_jack, midibuf_song;
44 struct cbox_midi_appsink appsink;
47 // These use an RT command internally
48 extern struct cbox_engine *cbox_engine_new(struct cbox_document *doc, struct cbox_rt *rt);
49 extern void cbox_engine_update_song_playback(struct cbox_engine *engine);
50 extern void cbox_engine_update_input_connections(struct cbox_engine *engine);
51 extern void cbox_engine_add_scene(struct cbox_engine *engine, struct cbox_scene *scene);
52 void cbox_engine_remove_scene(struct cbox_engine *engine, struct cbox_scene *scene);
53 extern struct cbox_song *cbox_engine_set_song(struct cbox_engine *engine, struct cbox_song *song, int new_pos);
54 extern struct cbox_song *cbox_engine_set_pattern(struct cbox_engine *engine, struct cbox_midi_pattern *pattern, int new_pos);
55 extern void cbox_engine_set_pattern_and_destroy(struct cbox_engine *engine, struct cbox_midi_pattern *pattern);
56 extern void cbox_engine_send_events_to(struct cbox_engine *engine, struct cbox_midi_merger *merger, struct cbox_midi_buffer *buffer);
57 extern void cbox_engine_process(struct cbox_engine *engine, struct cbox_io *io, uint32_t nframes, float **output_buffers);
58 extern gboolean cbox_engine_on_transport_sync(struct cbox_engine *engine, enum cbox_transport_state state, uint32_t frame);
59 extern struct cbox_midi_merger *cbox_engine_get_midi_output(struct cbox_engine *engine, struct cbox_uuid *uuid);
61 extern int cbox_engine_get_sample_rate(struct cbox_engine *engine);
62 extern int cbox_engine_get_buffer_size(struct cbox_engine *engine);
64 #endif