Got seek_ppqn/seek_samples the other way around :-)
[calfbox.git] / sampler_prg.h
blob492b330e3bbda6111a9d52a2e595bf4ba869a876
1 /*
2 Calf Box, an open source musical instrument.
3 Copyright (C) 2010-2013 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_SAMPLER_PRG_H
20 #define CBOX_SAMPLER_PRG_H
22 #include "cmd.h"
23 #include "dom.h"
25 struct sampler_channel;
27 CBOX_EXTERN_CLASS(sampler_program)
29 // Runtime layer lists; in future, I might something more clever, like a tree
30 struct sampler_rll
32 GSList *layers; // of sampler_layer
33 GSList *layers_release; // of sampler_layer
34 GSList *layers_oncc;
35 uint32_t cc_trigger_bitmask[4]; // one bit per CC
38 struct sampler_ctrlinit
40 uint8_t controller;
41 uint8_t value;
44 union sampler_ctrlinit_union {
45 gpointer ptr;
46 struct sampler_ctrlinit cinit;
47 } u;
50 struct sampler_program
52 CBOX_OBJECT_HEADER()
53 struct cbox_command_target cmd_target;
55 struct sampler_module *module;
56 gchar *name;
57 int prog_no;
58 struct sampler_layer *default_group;
59 GSList *groups;
60 GSList *all_layers;
61 GSList *ctrl_init_list;
62 struct sampler_rll *rll;
63 gchar *sample_dir; // can be empty, cannot be NULL
64 gchar *source_file; // can be empty, cannot be NULL
65 int in_use;
66 gboolean deleting;
69 extern struct sampler_rll *sampler_rll_new_from_program(struct sampler_program *prg);
70 extern void sampler_rll_destroy(struct sampler_rll *rll);
72 extern GSList *sampler_program_get_next_layer(struct sampler_program *prg, struct sampler_channel *c, GSList *next_layer, int note, int vel, float random, gboolean is_first);
73 extern struct sampler_program *sampler_program_new(struct sampler_module *m, int prog_no, const char *name, const char *sample_dir);
74 extern struct sampler_program *sampler_program_new_from_cfg(struct sampler_module *m, const char *cfg_section, const char *name, int pgm_id, GError **error);
75 extern void sampler_program_add_layer(struct sampler_program *prg, struct sampler_layer *l);
76 extern void sampler_program_delete_layer(struct sampler_program *prg, struct sampler_layer *l);
77 extern void sampler_program_add_group(struct sampler_program *prg, struct sampler_layer *l);
78 extern void sampler_program_add_controller_init(struct sampler_program *prg, uint8_t controller, uint8_t value);
79 extern void sampler_program_remove_controller_init(struct sampler_program *prg, uint8_t controller, int which);
80 extern void sampler_program_update_layers(struct sampler_program *prg);
82 #endif