LMMS
Loading...
Searching...
No Matches
nekobee_synth.h
Go to the documentation of this file.
1/* nekobee DSSI software synthesizer plugin
2 *
3 * Copyright (C) 2004 Sean Bolton and others.
4 *
5 * Portions of this file may have come from Peter Hanappe's
6 * Fluidsynth, copyright (C) 2003 Peter Hanappe and others.
7 * Portions of this file may have come from alsa-lib, copyright
8 * and licensed under the LGPL v2.1.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be
16 * useful, but WITHOUT ANY WARRANTY; without even the implied
17 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 * PURPOSE. See the GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public
21 * License along with this program; if not, write to the Free
22 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307, USA.
24 */
25
26#ifndef _XSYNTH_SYNTH_H
27#define _XSYNTH_SYNTH_H
28
29#include <pthread.h>
30
31#include "nekobee.h"
32#include "nekobee_types.h"
33
34#define XSYNTH_MONO_MODE_OFF 0
35#define XSYNTH_MONO_MODE_ON 1
36#define XSYNTH_MONO_MODE_ONCE 2
37#define XSYNTH_MONO_MODE_BOTH 3
38
39#define XSYNTH_GLIDE_MODE_LEGATO 0
40#define XSYNTH_GLIDE_MODE_INITIAL 1
41#define XSYNTH_GLIDE_MODE_ALWAYS 2
42#define XSYNTH_GLIDE_MODE_LEFTOVER 3
43#define XSYNTH_GLIDE_MODE_OFF 4
44
45/*
46 * nekobee_synth_t
47 */
49 /* output */
50 unsigned long sample_rate;
51 float deltat; /* 1 / sample_rate */
52 unsigned long nugget_remains;
53
54 /* voice tracking and data */
55 unsigned int note_id; /* incremented for every new note, used for voice-stealing prioritization */
56 int polyphony; /* requested polyphony, must be <= XSYNTH_MAX_POLYPHONY */
57 int voices; /* current polyphony, either requested polyphony above or 1 while in monophonic mode */
58 int monophonic; /* true if operating in monophonic mode */
59 int glide; /* current glide mode */
60 float last_noteon_pitch; /* glide start pitch for non-legato modes */
61 signed char held_keys[8]; /* for monophonic key tracking, an array of note-ons, most recently received first */
62 float vcf_accent; /* used to emulate the circuit that sweeps the vcf at full resonance */
63 float vca_accent; /* used to smooth the accent pulse, removing the click */
64
65 //nekobee_voice_t *voice[XSYNTH_MAX_POLYPHONY];
67 pthread_mutex_t voicelist_mutex;
69
70 /* current non-paramter-mapped controller values */
71 unsigned char key_pressure[128];
72 unsigned char cc[128]; /* controller values */
73 unsigned char channel_pressure;
74 unsigned char pitch_wheel_sensitivity; /* in semitones */
75 int pitch_wheel; /* range is -8192 - 8191 */
76
77 /* translated controller values */
78 float mod_wheel; /* filter cutoff multiplier, off = 1.0, full on = 0.0 */
79 float pitch_bend; /* frequency multiplier, product of wheel setting and sensitivity, center = 1.0 */
80 float cc_volume; /* volume multiplier, 0.0 to 1.0 */
81
82 /* patch parameters */
83 float tuning;
84 float waveform;
85 float cutoff;
86 float resonance;
87 float envmod;
88 float decay;
89 float accent;
90 float volume;
91};
92
95 unsigned char rvelocity);
98 unsigned char velocity);
99void nekobee_synth_control_change(nekobee_synth_t *synth, unsigned int param,
100 signed int value);
103 unsigned long sample_count,
104 int do_control_update);
105
106/* these come right out of alsa/asoundef.h */
107#define MIDI_CTL_MSB_MODWHEEL 0x01
108#define MIDI_CTL_MSB_PORTAMENTO_TIME 0x05
109#define MIDI_CTL_MSB_MAIN_VOLUME 0x07
110#define MIDI_CTL_MSB_BALANCE 0x08
111#define MIDI_CTL_LSB_MODWHEEL 0x21
112#define MIDI_CTL_LSB_PORTAMENTO_TIME 0x25
113#define MIDI_CTL_LSB_MAIN_VOLUME 0x27
114#define MIDI_CTL_LSB_BALANCE 0x28
115#define MIDI_CTL_SUSTAIN 0x40
116
117// nekobee defines
118#define MIDI_CTL_TUNING 0x4b // impossible
119#define MIDI_CTL_WAVEFORM 0x46 // select waveform
120#define MIDI_CTL_CUTOFF 0x4a // VCF Cutoff
121#define MIDI_CTL_RESONANCE 0x47 // VCF Resonance
122#define MIDI_CTL_ENVMOD 0x01 // cheat and use modwheel
123#define MIDI_CTL_DECAY 0x48 // Decay time (well release really)
124#define MIDI_CTL_ACCENT 0x4c // impossible
125
126#define MIDI_CTL_ALL_SOUNDS_OFF 0x78
127#define MIDI_CTL_RESET_CONTROLLERS 0x79
128#define MIDI_CTL_ALL_NOTES_OFF 0x7b
129
130#define XSYNTH_SYNTH_SUSTAINED(_s) ((_s)->cc[MIDI_CTL_SUSTAIN] >= 64)
131
132#endif /* _XSYNTH_SYNTH_H */
SYNTH_T * synth
Definition LocalZynAddSubFx.cpp:47
static PuglViewHint int value
Definition pugl.h:1708
float out
Definition lilv_test.c:1461
void nekobee_synth_note_off(nekobee_synth_t *synth, unsigned char key, unsigned char rvelocity)
Definition nekobee_synth.c:65
void nekobee_synth_all_notes_off(nekobee_synth_t *synth)
Definition nekobee_synth.c:92
void nekobee_synth_control_change(nekobee_synth_t *synth, unsigned int param, signed int value)
Definition nekobee_synth.c:143
void nekobee_synth_render_voices(nekobee_synth_t *synth, float *out, unsigned long sample_count, int do_control_update)
Definition nekobee_synth.c:201
void nekobee_synth_init_controls(nekobee_synth_t *synth)
Definition nekobee_synth.c:185
void nekobee_synth_all_voices_off(nekobee_synth_t *synth)
Definition nekobee_synth.c:44
void nekobee_synth_note_on(nekobee_synth_t *synth, unsigned char key, unsigned char velocity)
Definition nekobee_synth.c:112
struct _nekobee_synth_t nekobee_synth_t
Definition nekobee_types.h:26
struct _nekobee_voice_t nekobee_voice_t
Definition nekobee_types.h:27
Definition nekobee_synth.h:48
unsigned long sample_rate
Definition nekobee_synth.h:50
signed char held_keys[8]
Definition nekobee_synth.h:61
float waveform
Definition nekobee_synth.h:84
unsigned char key_pressure[128]
Definition nekobee_synth.h:71
pthread_mutex_t voicelist_mutex
Definition nekobee_synth.h:67
unsigned char cc[128]
Definition nekobee_synth.h:72
unsigned char channel_pressure
Definition nekobee_synth.h:73
int monophonic
Definition nekobee_synth.h:58
unsigned char pitch_wheel_sensitivity
Definition nekobee_synth.h:74
float decay
Definition nekobee_synth.h:88
int voices
Definition nekobee_synth.h:57
unsigned long nugget_remains
Definition nekobee_synth.h:52
int polyphony
Definition nekobee_synth.h:56
float envmod
Definition nekobee_synth.h:87
float cc_volume
Definition nekobee_synth.h:80
float tuning
Definition nekobee_synth.h:83
float pitch_bend
Definition nekobee_synth.h:79
int glide
Definition nekobee_synth.h:59
int pitch_wheel
Definition nekobee_synth.h:75
float vca_accent
Definition nekobee_synth.h:63
float resonance
Definition nekobee_synth.h:86
float cutoff
Definition nekobee_synth.h:85
nekobee_voice_t * voice
Definition nekobee_synth.h:66
float vcf_accent
Definition nekobee_synth.h:62
float last_noteon_pitch
Definition nekobee_synth.h:60
float volume
Definition nekobee_synth.h:90
float deltat
Definition nekobee_synth.h:51
float accent
Definition nekobee_synth.h:89
int voicelist_mutex_grab_failed
Definition nekobee_synth.h:68
float mod_wheel
Definition nekobee_synth.h:78
unsigned int note_id
Definition nekobee_synth.h:55
ZCONST char * key
Definition crypt.c:587