Implement egN_vel2freq and egN_vel2gain. Tighten EQ-change logic.
[calfbox.git] / wavebank.h
blob2d37444484e62bf8e050ce73bbe9095c74eb651b
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 MAX_INTERPOLATION_ORDER 3
27 #define CBOX_WAVEFORM_ERROR cbox_waveform_error_quark()
29 enum CboxWaveformError
31 CBOX_WAVEFORM_ERROR_FAILED,
34 struct cbox_waveform_level
36 int16_t *data;
37 uint64_t max_rate;
40 struct cbox_waveform
42 int16_t *data;
43 SF_INFO info;
44 int id;
45 int refcount;
46 size_t bytes;
47 size_t preloaded_frames;
48 gchar *canonical_name;
49 gchar *display_name;
50 gboolean has_loop;
51 uint32_t loop_start, loop_end;
53 struct cbox_waveform_level *levels;
54 int level_count;
57 extern struct cbox_command_target cbox_waves_cmd_target;
59 extern void cbox_wavebank_init(void);
60 extern struct cbox_waveform *cbox_wavebank_get_waveform(const char *context_name, const char *sample_dir, const char *filename, GError **error);
61 extern struct cbox_waveform *cbox_wavebank_peek_waveform_by_id(int id);
62 extern void cbox_wavebank_foreach(void (*cb)(void *user_data, struct cbox_waveform *waveform), void *user_data);
63 extern void cbox_wavebank_add_std_waveform(const char *name, float (*getfunc)(float v, void *user_data), void *user_data, int levels);
64 extern int cbox_wavebank_get_count(void);
65 extern int64_t cbox_wavebank_get_bytes(void);
66 extern int64_t cbox_wavebank_get_maxbytes(void);
67 extern void cbox_wavebank_close(void);
69 extern void cbox_waveform_ref(struct cbox_waveform *waveform);
70 extern void cbox_waveform_unref(struct cbox_waveform *waveform);
73 #endif