Build fixes for fluidsynth (always disabled after recent changes) and JACK (compiler...
[calfbox.git] / wavebank.h
bloba3a72ff6aacbee3c390bf6b4e935be0d22c6be09
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_WAVEBANK_H
20 #define CBOX_WAVEBANK_H
22 #include <glib.h>
23 #include <sndfile.h>
25 #define CBOX_WAVEFORM_ERROR cbox_waveform_error_quark()
27 enum CboxWaveformError
29 CBOX_WAVEFORM_ERROR_FAILED,
32 struct cbox_waveform_level
34 int16_t *data;
35 uint64_t max_rate;
38 struct cbox_waveform
40 int16_t *data;
41 SF_INFO info;
42 int id;
43 int refcount;
44 size_t bytes;
45 size_t preloaded_frames;
46 gchar *canonical_name;
47 gchar *display_name;
48 gboolean has_loop;
49 uint32_t loop_start, loop_end;
51 struct cbox_waveform_level *levels;
52 int level_count;
55 extern struct cbox_command_target cbox_waves_cmd_target;
57 extern void cbox_wavebank_init(void);
58 extern struct cbox_waveform *cbox_wavebank_get_waveform(const char *context_name, const char *sample_dir, const char *filename, GError **error);
59 extern struct cbox_waveform *cbox_wavebank_peek_waveform_by_id(int id);
60 extern void cbox_wavebank_foreach(void (*cb)(void *user_data, struct cbox_waveform *waveform), void *user_data);
61 extern void cbox_wavebank_add_std_waveform(const char *name, float (*getfunc)(float v, void *user_data), void *user_data, int levels);
62 extern int cbox_wavebank_get_count(void);
63 extern int64_t cbox_wavebank_get_bytes(void);
64 extern int64_t cbox_wavebank_get_maxbytes(void);
65 extern void cbox_wavebank_close(void);
67 extern void cbox_waveform_ref(struct cbox_waveform *waveform);
68 extern void cbox_waveform_unref(struct cbox_waveform *waveform);
71 #endif