Ignore JACK port connection failures due to connection already existing.
[calfbox.git] / recsrc.h
blobc8fa28d4210b260b1ac71717cba9ce1c7c3a2b67
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 CBOX_EXTERN_CLASS(cbox_recorder)
29 struct cbox_recorder
31 CBOX_OBJECT_HEADER()
32 void *user_data;
33 struct cbox_command_target cmd_target;
35 gboolean (*attach)(struct cbox_recorder *handler, struct cbox_recording_source *src, GError **error);
36 void (*record_block)(struct cbox_recorder *handler, const float **buffers, uint32_t numsamples);
37 gboolean (*detach)(struct cbox_recorder *handler, GError **error);
38 void (*destroy)(struct cbox_recorder *handler);
41 struct cbox_recording_source
43 struct cbox_command_target cmd_target;
44 struct cbox_scene *scene;
46 struct cbox_recorder **handlers;
47 int handler_count;
48 uint32_t max_numsamples;
49 int channels;
52 #define IS_RECORDING_SOURCE_CONNECTED(src) ((src).handler_count != 0)
54 extern void cbox_recording_source_init(struct cbox_recording_source *src, struct cbox_scene *scene, uint32_t max_numsamples, int channels);
55 extern gboolean cbox_recording_source_attach(struct cbox_recording_source *src, struct cbox_recorder *rec, GError **error);
56 extern int cbox_recording_source_detach(struct cbox_recording_source *src, struct cbox_recorder *rec, GError **error);
57 extern void cbox_recording_source_push(struct cbox_recording_source *src, const float **buffers, uint32_t numsamples);
58 extern void cbox_recording_source_uninit(struct cbox_recording_source *src);
60 extern struct cbox_recorder *cbox_recorder_new_stream(struct cbox_rt *rt, const char *filename);
62 #endif