In case of running out of prefetch pipes, truncate the sample to the preloaded part.
[calfbox.git] / scene.h
blob1ff845c9bdef32e93f98a2d4f14ab944d1c83ee9
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_SCENE_H
20 #define CBOX_SCENE_H
22 #include "cmd.h"
23 #include "dom.h"
24 #include "mididest.h"
26 CBOX_EXTERN_CLASS(cbox_scene)
28 struct cbox_aux_bus;
29 struct cbox_instrument;
30 struct cbox_midi_buffer;
31 struct cbox_recording_source;
32 struct cbox_song_playback;
34 struct cbox_scene
36 CBOX_OBJECT_HEADER()
37 struct cbox_command_target cmd_target;
38 gchar *name;
39 gchar *title;
41 GHashTable *instrument_hash;
42 struct cbox_rt *rt;
43 struct cbox_layer **layers;
44 int layer_count;
45 struct cbox_instrument **instruments;
46 int instrument_count;
47 struct cbox_aux_bus **aux_buses;
48 int aux_bus_count;
49 int transpose;
50 struct cbox_engine *engine;
51 struct cbox_midi_merger scene_input_merger;
52 struct cbox_midi_buffer midibuf_total;
54 struct cbox_midi_input **connected_inputs;
55 int connected_input_count;
57 gboolean enable_default_song_input, enable_default_external_input;
59 struct cbox_recording_source *rec_mono_inputs, *rec_mono_outputs;
60 struct cbox_recording_source *rec_stereo_inputs, *rec_stereo_outputs;
62 struct cbox_adhoc_pattern *adhoc_patterns, *retired_adhoc_patterns;
65 extern struct cbox_scene *cbox_scene_new(struct cbox_document *document, struct cbox_engine *engine);
66 extern gboolean cbox_scene_add_layer(struct cbox_scene *scene, struct cbox_layer *layer, GError **error);
67 extern gboolean cbox_scene_insert_layer(struct cbox_scene *scene, struct cbox_layer *layer, int pos, GError **error);
68 extern struct cbox_layer *cbox_scene_remove_layer(struct cbox_scene *scene, int pos);
69 extern void cbox_scene_move_layer(struct cbox_scene *scene, int oldpos, int newpos);
70 extern gboolean cbox_scene_load(struct cbox_scene *scene, const char *section, GError **error);
71 extern gboolean cbox_scene_remove_instrument(struct cbox_scene *scene, struct cbox_instrument *instrument);
72 extern struct cbox_aux_bus *cbox_scene_get_aux_bus(struct cbox_scene *scene, const char *name, int allow_load, GError **error);
73 extern void cbox_scene_render(struct cbox_scene *scene, uint32_t nframes, float *output_buffers[]);
74 extern void cbox_scene_clear(struct cbox_scene *scene);
75 extern void cbox_scene_update_connected_inputs(struct cbox_scene *scene);
76 extern gboolean cbox_scene_move_instrument_to(struct cbox_scene *scene, struct cbox_instrument *instrument, struct cbox_scene *new_scene, int dstpos, GError **error);
77 extern struct cbox_instrument *cbox_scene_get_instrument_by_name(struct cbox_scene *scene, const char *name, gboolean load, GError **error);
78 extern struct cbox_instrument *cbox_scene_create_instrument(struct cbox_scene *scene, const char *instrument_name, const char *engine_name, GError **error);
79 extern void cbox_scene_play_adhoc_pattern(struct cbox_scene *scene, struct cbox_adhoc_pattern *ap);
81 #endif