In case of running out of prefetch pipes, truncate the sample to the preloaded part.
[calfbox.git] / recsrc.h
blob45caf96b955a524ac8d2d516070ca18b398d959a
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_RECSRC_H
20 #define CBOX_RECSRC_H
22 #include "cmd.h"
23 #include "dom.h"
25 struct cbox_recording_source;
26 struct cbox_rt;
27 struct cbox_engine;
29 CBOX_EXTERN_CLASS(cbox_recorder)
31 struct cbox_recorder
33 CBOX_OBJECT_HEADER()
34 void *user_data;
35 struct cbox_command_target cmd_target;
37 gboolean (*attach)(struct cbox_recorder *handler, struct cbox_recording_source *src, GError **error);
38 void (*record_block)(struct cbox_recorder *handler, const float **buffers, uint32_t numsamples);
39 gboolean (*detach)(struct cbox_recorder *handler, GError **error);
40 void (*destroy)(struct cbox_recorder *handler);
43 struct cbox_recording_source
45 struct cbox_command_target cmd_target;
46 struct cbox_scene *scene;
48 struct cbox_recorder **handlers;
49 int handler_count;
50 uint32_t max_numsamples;
51 int channels;
54 #define IS_RECORDING_SOURCE_CONNECTED(src) ((src).handler_count != 0)
56 extern void cbox_recording_source_init(struct cbox_recording_source *src, struct cbox_scene *scene, uint32_t max_numsamples, int channels);
57 extern gboolean cbox_recording_source_attach(struct cbox_recording_source *src, struct cbox_recorder *rec, GError **error);
58 extern int cbox_recording_source_detach(struct cbox_recording_source *src, struct cbox_recorder *rec, GError **error);
59 extern void cbox_recording_source_push(struct cbox_recording_source *src, const float **buffers, uint32_t numsamples);
60 extern void cbox_recording_source_uninit(struct cbox_recording_source *src);
62 extern struct cbox_recorder *cbox_recorder_new_stream(struct cbox_engine *engine, struct cbox_rt *rt, const char *filename);
64 #endif