Add an example demonstrating use of sequencer API.
[calfbox.git] / wavebank.h
blobef539b84a5768976c152ae204c2cf0e8f8796838
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 gchar *canonical_name;
46 gchar *display_name;
47 gboolean has_loop;
48 uint32_t loop_start, loop_end;
50 struct cbox_waveform_level *levels;
51 int level_count;
54 extern struct cbox_command_target cbox_waves_cmd_target;
56 extern void cbox_wavebank_init();
57 extern struct cbox_waveform *cbox_wavebank_get_waveform(const char *context_name, const char *filename, GError **error);
58 extern struct cbox_waveform *cbox_wavebank_peek_waveform_by_id(int id);
59 extern void cbox_wavebank_foreach(void (*cb)(void *user_data, struct cbox_waveform *waveform), void *user_data);
60 extern void cbox_wavebank_add_std_waveform(const char *name, float (*getfunc)(float v, void *user_data), void *user_data, int levels);
61 extern int cbox_wavebank_get_count();
62 extern int64_t cbox_wavebank_get_bytes();
63 extern int64_t cbox_wavebank_get_maxbytes();
64 extern void cbox_wavebank_close();
66 extern void cbox_waveform_ref(struct cbox_waveform *waveform);
67 extern void cbox_waveform_unref(struct cbox_waveform *waveform);
70 #endif