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_WAVEBANK_H
20 #define CBOX_WAVEBANK_H
26 #define MAX_INTERPOLATION_ORDER 3
28 #define CBOX_WAVEFORM_ERROR cbox_waveform_error_quark()
30 enum CboxWaveformError
32 CBOX_WAVEFORM_ERROR_FAILED
,
35 struct cbox_waveform_level
48 size_t preloaded_frames
;
49 gchar
*canonical_name
;
52 uint32_t loop_start
, loop_end
;
53 struct cbox_tarfile
*tarfile
;
54 struct cbox_taritem
*taritem
;
55 struct cbox_tarfile_sndstream sndstream
;
57 struct cbox_waveform_level
*levels
;
61 extern struct cbox_command_target cbox_waves_cmd_target
;
63 extern void cbox_wavebank_init(void);
64 extern struct cbox_waveform
*cbox_wavebank_get_waveform(const char *context_name
, struct cbox_tarfile
*tf
, const char *sample_dir
, const char *filename
, GError
**error
);
65 extern struct cbox_waveform
*cbox_wavebank_peek_waveform_by_id(int id
);
66 extern void cbox_wavebank_foreach(void (*cb
)(void *user_data
, struct cbox_waveform
*waveform
), void *user_data
);
67 extern void cbox_wavebank_add_std_waveform(const char *name
, float (*getfunc
)(float v
, void *user_data
), void *user_data
, int levels
);
68 extern int cbox_wavebank_get_count(void);
69 extern int64_t cbox_wavebank_get_bytes(void);
70 extern int64_t cbox_wavebank_get_maxbytes(void);
71 extern void cbox_wavebank_close(void);
73 extern void cbox_waveform_ref(struct cbox_waveform
*waveform
);
74 extern void cbox_waveform_unref(struct cbox_waveform
*waveform
);