Expose all 8 voices
[zyn.git] / zynadd_internal.h
blobd6a2e8298d1180211ce5b827f91d9e334ce48137
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License
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, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *****************************************************************************/
21 #ifndef ZYNADD_INTERNAL_H__A38C6254_E7AD_443E_AA5F_A5AB3FCB8B06__INCLUDED
22 #define ZYNADD_INTERNAL_H__A38C6254_E7AD_443E_AA5F_A5AB3FCB8B06__INCLUDED
25 * The number of voices of additive synth for a single note
27 #define VOICES_COUNT 8
29 #define LV2DYNPARAM_PARAMETER_TYPE_BOOL 1
30 #define LV2DYNPARAM_PARAMETER_TYPE_FLOAT 2
31 #define LV2DYNPARAM_PARAMETER_TYPE_INT 3
32 #define LV2DYNPARAM_PARAMETER_TYPE_ENUM 4
34 #define LV2DYNPARAM_PARAMETER_SCOPE_TYPE_ALWAYS 0 /* always visible, not interacting with other parameters */
35 #define LV2DYNPARAM_PARAMETER_SCOPE_TYPE_SHOW_OTHER 1 /* always visible bool, when true, other param appearing */
36 #define LV2DYNPARAM_PARAMETER_SCOPE_TYPE_HIDE_OTHER 2 /* always visible bool, when true, other param disappearing */
37 #define LV2DYNPARAM_PARAMETER_SCOPE_TYPE_SEMI 3 /* sometimes visible parameter */
39 #define LV2DYNPARAM_GROUP_INVALID -2
40 #define LV2DYNPARAM_GROUP_ROOT -1
42 #define HINT_HIDDEN "http://home.gna.org/zynjacku/hints#hidden"
43 #define HINT_TOGGLE_FLOAT "http://home.gna.org/zynjacku/hints#togglefloat"
44 #define HINT_ONE_SUBGROUP "http://home.gna.org/zynjacku/hints#onesubgroup"
46 #include "zynadd_dynparam_forest_map.h"
48 struct zynadd_parameter
50 struct list_head siblings;
51 struct zynadd * synth_ptr;
52 zyn_addsynth_component addsynth_component;
53 unsigned int addsynth_parameter; /* one of ZYNADD_PARAMETER_XXX */
54 unsigned int scope; /* one of LV2DYNPARAM_PARAMETER_SCOPE_TYPE_XXX */
55 struct zynadd_parameter * other_parameter; /* used for bools controling other parameters appear/disappear */
57 struct zynadd_group * parent_ptr; /* NULL for parameters, children of root */
58 const char * name_ptr; /* parameter name, points to somewhere in forest map */
59 unsigned int type; /* one of LV2DYNPARAM_PARAMETER_TYPE_XXX */
60 struct lv2dynparam_hints * hints_ptr; /* parameter hints, points to somewhere in forest map */
62 struct parameter_descriptor * map_element_ptr;
64 lv2dynparam_plugin_parameter lv2parameter;
67 struct zynadd_group
69 struct list_head siblings;
70 struct zynadd_group * parent_ptr; /* NULL for groups, children of root */
71 const char * name_ptr; /* group name, points to somewhere in forest map */
72 struct lv2dynparam_hints * hints_ptr; /* group hints, points to somewhere in forest map */
73 lv2dynparam_plugin_group lv2group;
76 struct zyn_forest_initializer
78 struct zyn_forest_map * map_ptr;
80 size_t groups_count;
81 size_t parameters_count;
83 struct zynadd_group ** groups;
84 struct zynadd_parameter ** parameters;
87 struct zynadd
89 double sample_rate;
90 char * bundle_path;
91 void ** ports;
93 zyn_addsynth_handle synth;
94 zyn_addsynth_component synth_global_components[ZYNADD_GLOBAL_COMPONENTS_COUNT];
95 zyn_addsynth_component synth_voice_components[VOICES_COUNT * ZYNADD_VOICE_COMPONENTS_COUNT];
97 zyn_sample_type synth_output_left[SOUND_BUFFER_SIZE];
98 zyn_sample_type synth_output_right[SOUND_BUFFER_SIZE];
100 uint32_t synth_output_offset; /* offset of unread data within synth_output_xxx audio buffers */
102 lv2dynparam_plugin_instance dynparams;
104 struct list_head groups;
105 struct list_head parameters;
107 const LV2_Feature * const * host_features;
110 bool zynadd_dynparam_init(struct zynadd * zynadd_ptr);
112 void zynadd_dynparam_uninit(struct zynadd * zynadd_ptr);
114 bool
115 zynadd_appear_parameter(
116 struct zynadd * zynadd_ptr,
117 struct zynadd_parameter * parameter_ptr);
119 #endif /* #ifndef ZYNADD_INTERNAL_H__A38C6254_E7AD_443E_AA5F_A5AB3FCB8B06__INCLUDED */