diff --git a/plugins/Nekobi/DistrhoPluginNekobi.cpp b/plugins/Nekobi/DistrhoPluginNekobi.cpp index c25967e..9c5e24c 100644 --- a/plugins/Nekobi/DistrhoPluginNekobi.cpp +++ b/plugins/Nekobi/DistrhoPluginNekobi.cpp @@ -66,8 +66,6 @@ DistrhoPluginNekobi::DistrhoPluginNekobi() fSynth.nugget_remains = 0; fSynth.note_id = 0; - fSynth.polyphony = XSYNTH_DEFAULT_POLYPHONY; - fSynth.voices = XSYNTH_DEFAULT_POLYPHONY; fSynth.monophonic = XSYNTH_MONO_MODE_ONCE; fSynth.glide = 0; fSynth.last_noteon_pitch = 0.0f; diff --git a/plugins/Nekobi/nekobee-src/nekobee.h b/plugins/Nekobi/nekobee-src/nekobee.h deleted file mode 100644 index 718cc26..0000000 --- a/plugins/Nekobi/nekobee-src/nekobee.h +++ /dev/null @@ -1,77 +0,0 @@ -/* nekobee DSSI software synthesizer plugin - * - * Copyright (C) 2004 Sean Bolton and others. - * - * Portions of this file may have come from Chris Cannam and Steve - * Harris's public domain DSSI example code. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be - * useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the Free - * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307, USA. - */ - -#ifndef _XSYNTH_H -#define _XSYNTH_H - -/* ==== debugging ==== */ - -/* XSYNTH_DEBUG bits */ -#define XDB_DSSI 1 /* DSSI interface */ -#define XDB_AUDIO 2 /* audio output */ -#define XDB_NOTE 4 /* note on/off, voice allocation */ -#define XDB_DATA 8 /* plugin patchbank handling */ -#define GDB_MAIN 16 /* GUI main program flow */ -#define GDB_OSC 32 /* GUI OSC handling */ -#define GDB_IO 64 /* GUI patch file input/output */ -#define GDB_GUI 128 /* GUI GUI callbacks, updating, etc. */ - -/* If you want debug information, define XSYNTH_DEBUG to the XDB_* bits you're - * interested in getting debug information about, bitwise-ORed together. - * Otherwise, leave it undefined. */ -// #define XSYNTH_DEBUG (1+8+16+32+64) - -//#define XSYNTH_DEBUG GDB_GUI + GDB_OSC - -// #define XSYNTH_DEBUG XDB_DSSI -#ifdef XSYNTH_DEBUG - -#include -#define XSYNTH_DEBUG_INIT(x) -#define XDB_MESSAGE(type, fmt...) { if (XSYNTH_DEBUG & type) fprintf(stderr, "nekobee-dssi.so" fmt); } -#define GDB_MESSAGE(type, fmt...) { if (XSYNTH_DEBUG & type) fprintf(stderr, "nekobee_gtk" fmt); } -// -FIX-: -// #include "message_buffer.h" -// #define XSYNTH_DEBUG_INIT(x) mb_init(x) -// #define XDB_MESSAGE(type, fmt...) { \- -// if (XSYNTH_DEBUG & type) { \- -// char _m[256]; \- -// snprintf(_m, 255, fmt); \- -// add_message(_m); \- -// } \- -// } - -#else /* !XSYNTH_DEBUG */ - -#define XDB_MESSAGE(type, fmt, ...) -#define GDB_MESSAGE(type, fmt, ...) -#define XSYNTH_DEBUG_INIT(x) - -#endif /* XSYNTH_DEBUG */ - -/* ==== end of debugging ==== */ - -#define XSYNTH_MAX_POLYPHONY 1 -#define XSYNTH_DEFAULT_POLYPHONY 1 - -#endif /* _XSYNTH_H */ diff --git a/plugins/Nekobi/nekobee-src/nekobee_synth.c b/plugins/Nekobi/nekobee-src/nekobee_synth.c index 90f14ce..52aef62 100644 --- a/plugins/Nekobi/nekobee-src/nekobee_synth.c +++ b/plugins/Nekobi/nekobee-src/nekobee_synth.c @@ -25,13 +25,13 @@ * MA 02111-1307, USA. */ -#include -#include -#include -#include - -#include "nekobee.h" #include "nekobee_synth.h" + +#include +#include +#include +#include + #include "nekobee_voice.h" /* @@ -39,19 +39,13 @@ * * stop processing all notes immediately */ -void -nekobee_synth_all_voices_off(nekobee_synth_t *synth) -{ +void nekobee_synth_all_voices_off(nekobee_synth_t *synth) { int i; - nekobee_voice_t *voice; - - for (i = 0; i < synth->voices; i++) { - //voice = synth->voice[i]; - voice = synth->voice; - if (_PLAYING(voice)) { - nekobee_voice_off(voice); - } + nekobee_voice_t *voice = synth->voice; + if (_PLAYING(voice)) { + nekobee_voice_off(voice); } + for (i = 0; i < 8; i++) synth->held_keys[i] = -1; } @@ -60,23 +54,16 @@ nekobee_synth_all_voices_off(nekobee_synth_t *synth) * * handle a note off message */ -void -nekobee_synth_note_off(nekobee_synth_t *synth, unsigned char key, unsigned char rvelocity) -{ - int i, count = 0; - nekobee_voice_t *voice; - - for (i = 0; i < synth->voices; i++) { - voice = synth->voice; - if (_PLAYING(voice)) { - XDB_MESSAGE(XDB_NOTE, " nekobee_synth_note_off: key %d rvel %d voice %d note id %d\n", key, rvelocity, i, voice->note_id); - nekobee_voice_note_off(synth, voice, key, 64); - count++; - } +void nekobee_synth_note_off(nekobee_synth_t *synth, unsigned char key, + unsigned char rvelocity) { + int count = 0; + nekobee_voice_t *voice = synth->voice; + if (_PLAYING(voice)) { + nekobee_voice_note_off(synth, voice, key, 64); + count++; } - if (!count) - nekobee_voice_remove_held_key(synth, key); + if (!count) nekobee_voice_remove_held_key(synth, key); return; (void)rvelocity; @@ -87,34 +74,28 @@ nekobee_synth_note_off(nekobee_synth_t *synth, unsigned char key, unsigned char * * put all notes into the released state */ -void -nekobee_synth_all_notes_off(nekobee_synth_t* synth) -{ - int i; - nekobee_voice_t *voice; +void nekobee_synth_all_notes_off(nekobee_synth_t *synth) { + nekobee_voice_t *voice = synth->voice; /* reset the sustain controller */ synth->cc[MIDI_CTL_SUSTAIN] = 0; - for (i = 0; i < synth->voices; i++) { - //voice = synth->voice[i]; - voice = synth->voice; - if (_ON(voice) || _SUSTAINED(voice)) { - nekobee_voice_release_note(synth, voice); - } + + if (_ON(voice) || _SUSTAINED(voice)) { + nekobee_voice_release_note(synth, voice); } } /* * nekobee_synth_note_on */ -void -nekobee_synth_note_on(nekobee_synth_t *synth, unsigned char key, unsigned char velocity) -{ - nekobee_voice_t* voice; +void nekobee_synth_note_on(nekobee_synth_t *synth, unsigned char key, + unsigned char velocity) { + nekobee_voice_t *voice; voice = synth->voice; if (_PLAYING(synth->voice)) { - XDB_MESSAGE(XDB_NOTE, " nekobee_synth_note_on: retriggering mono voice on new key %d\n", key); + // XDB_MESSAGE(XDB_NOTE, " nekobee_synth_note_on: retriggering mono + // voice on new key %d\n", key); } voice->note_id = synth->note_id++; @@ -125,112 +106,111 @@ nekobee_synth_note_on(nekobee_synth_t *synth, unsigned char key, unsigned char v /* * nekobee_synth_update_volume */ -void -nekobee_synth_update_volume(nekobee_synth_t* synth) -{ +void nekobee_synth_update_volume(nekobee_synth_t *synth) { synth->cc_volume = (float)(synth->cc[MIDI_CTL_MSB_MAIN_VOLUME] * 128 + - synth->cc[MIDI_CTL_LSB_MAIN_VOLUME]) / 16256.0f; - if (synth->cc_volume > 1.0f) - synth->cc_volume = 1.0f; - /* don't need to check if any playing voices need updating, because it's global */ + synth->cc[MIDI_CTL_LSB_MAIN_VOLUME]) / + 16256.0f; + if (synth->cc_volume > 1.0f) synth->cc_volume = 1.0f; + /* don't need to check if any playing voices need updating, because it's + * global */ } /* * nekobee_synth_control_change */ -void -nekobee_synth_control_change(nekobee_synth_t *synth, unsigned int param, signed int value) -{ +void nekobee_synth_control_change(nekobee_synth_t *synth, unsigned int param, + signed int value) { synth->cc[param] = value; switch (param) { + case MIDI_CTL_MSB_MAIN_VOLUME: + case MIDI_CTL_LSB_MAIN_VOLUME: + nekobee_synth_update_volume(synth); + break; - case MIDI_CTL_MSB_MAIN_VOLUME: - case MIDI_CTL_LSB_MAIN_VOLUME: - nekobee_synth_update_volume(synth); - break; + case MIDI_CTL_ALL_SOUNDS_OFF: + nekobee_synth_all_voices_off(synth); + break; - case MIDI_CTL_ALL_SOUNDS_OFF: - nekobee_synth_all_voices_off(synth); - break; + case MIDI_CTL_RESET_CONTROLLERS: + nekobee_synth_init_controls(synth); + break; - case MIDI_CTL_RESET_CONTROLLERS: - nekobee_synth_init_controls(synth); - break; + case MIDI_CTL_ALL_NOTES_OFF: + nekobee_synth_all_notes_off(synth); + break; - case MIDI_CTL_ALL_NOTES_OFF: - nekobee_synth_all_notes_off(synth); - break; + /* what others should we respond to? */ - /* what others should we respond to? */ - - /* these we ignore (let the host handle): - * BANK_SELECT_MSB - * BANK_SELECT_LSB - * DATA_ENTRY_MSB - * NRPN_MSB - * NRPN_LSB - * RPN_MSB - * RPN_LSB - * -FIX- no! we need RPN (0, 0) Pitch Bend Sensitivity! - */ + /* these we ignore (let the host handle): + * BANK_SELECT_MSB + * BANK_SELECT_LSB + * DATA_ENTRY_MSB + * NRPN_MSB + * NRPN_LSB + * RPN_MSB + * RPN_LSB + * -FIX- no! we need RPN (0, 0) Pitch Bend Sensitivity! + */ } } /* * nekobee_synth_init_controls */ -void -nekobee_synth_init_controls(nekobee_synth_t *synth) -{ +void nekobee_synth_init_controls(nekobee_synth_t *synth) { int i; for (i = 0; i < 128; i++) { synth->cc[i] = 0; } - synth->cc[7] = 127; /* full volume */ + synth->cc[7] = 127; /* full volume */ nekobee_synth_update_volume(synth); } /* * nekobee_synth_render_voices */ -void -nekobee_synth_render_voices(nekobee_synth_t *synth, float *out, unsigned long sample_count, - int do_control_update) -{ +void nekobee_synth_render_voices(nekobee_synth_t *synth, float *out, + unsigned long sample_count, + int do_control_update) { unsigned long i; float res, wow; /* clear the buffer */ - for (i = 0; i < sample_count; i++) - out[i] = 0.0f; + for (i = 0; i < sample_count; i++) out[i] = 0.0f; // we can do anything that must be updated all the time here // this is called even when a voice isn't playing // approximate a log scale - res = 1-synth->resonance; - wow = res*res; - wow = wow/10.0f; + res = 1 - synth->resonance; + wow = res * res; + wow = wow / 10.0f; // as the resonance is increased, "wow" slows down the accent attack - if ((synth->voice->velocity>90) && (synth->vcf_accent < synth->voice->vcf_eg)) { - synth->vcf_accent=(0.985-wow)*synth->vcf_accent+(0.015+wow)*synth->voice->vcf_eg; + if ((synth->voice->velocity > 90) && + (synth->vcf_accent < synth->voice->vcf_eg)) { + synth->vcf_accent = (0.985 - wow) * synth->vcf_accent + + (0.015 + wow) * synth->voice->vcf_eg; } else { - synth->vcf_accent=(0.985-wow)*synth->vcf_accent; // or just decay + synth->vcf_accent = (0.985 - wow) * synth->vcf_accent; // or just decay } - if (synth->voice->velocity>90) { - synth->vca_accent=0.95*synth->vca_accent+0.05; // ramp up accent on with a time constant + if (synth->voice->velocity > 90) { + synth->vca_accent = 0.95 * synth->vca_accent + + 0.05; // ramp up accent on with a time constant } else { - synth->vca_accent=0.95*synth->vca_accent; // accent off with time constant + synth->vca_accent = + 0.95 * synth->vca_accent; // accent off with time constant } #if defined(XSYNTH_DEBUG) && (XSYNTH_DEBUG & XDB_AUDIO) - out[0] += 0.10f; /* add a 'buzz' to output so there's something audible even when quiescent */ -#endif /* defined(XSYNTH_DEBUG) && (XSYNTH_DEBUG & XDB_AUDIO) */ + out[0] += 0.10f; /* add a 'buzz' to output so there's something audible even + when quiescent */ +#endif /* defined(XSYNTH_DEBUG) && (XSYNTH_DEBUG & XDB_AUDIO) */ if (_PLAYING(synth->voice)) { - nekobee_voice_render(synth, synth->voice, out, sample_count, do_control_update); + nekobee_voice_render(synth, out, sample_count); } + (void)do_control_update; } diff --git a/plugins/Nekobi/nekobee-src/nekobee_synth.h b/plugins/Nekobi/nekobee-src/nekobee_synth.h index 66479b2..dd7d756 100644 --- a/plugins/Nekobi/nekobee-src/nekobee_synth.h +++ b/plugins/Nekobi/nekobee-src/nekobee_synth.h @@ -26,7 +26,6 @@ #ifndef _XSYNTH_SYNTH_H #define _XSYNTH_SYNTH_H -#include "nekobee.h" #include "nekobee_types.h" #define XSYNTH_MONO_MODE_OFF 0 @@ -51,8 +50,6 @@ struct _nekobee_synth_t { /* voice tracking and data */ unsigned int note_id; /* incremented for every new note, used for voice-stealing prioritization */ - int polyphony; /* requested polyphony, must be <= XSYNTH_MAX_POLYPHONY */ - int voices; /* current polyphony, either requested polyphony above or 1 while in monophonic mode */ int monophonic; /* true if operating in monophonic mode */ int glide; /* current glide mode */ float last_noteon_pitch; /* glide start pitch for non-legato modes */ @@ -60,7 +57,6 @@ struct _nekobee_synth_t { float vcf_accent; /* used to emulate the circuit that sweeps the vcf at full resonance */ float vca_accent; /* used to smooth the accent pulse, removing the click */ - //nekobee_voice_t *voice[XSYNTH_MAX_POLYPHONY]; nekobee_voice_t *voice; /* current non-paramter-mapped controller values */ diff --git a/plugins/Nekobi/nekobee-src/nekobee_voice.c b/plugins/Nekobi/nekobee-src/nekobee_voice.c index 3266546..d81d52b 100644 --- a/plugins/Nekobi/nekobee-src/nekobee_voice.c +++ b/plugins/Nekobi/nekobee-src/nekobee_voice.c @@ -30,7 +30,6 @@ #include #include "nekobee_types.h" -#include "nekobee.h" #include "nekobee_synth.h" #include "nekobee_voice.h" @@ -57,7 +56,6 @@ nekobee_voice_note_on(nekobee_synth_t *synth, nekobee_voice_t *voice, unsigned char key, unsigned char velocity) { int i; - voice->key = key; voice->velocity = velocity; @@ -65,7 +63,6 @@ nekobee_voice_note_on(nekobee_synth_t *synth, nekobee_voice_t *voice, if (!synth->monophonic || !(_ON(voice) || _SUSTAINED(voice))) { // brand-new voice, or monophonic voice in release phase; set everything up - XDB_MESSAGE(XDB_NOTE, " nekobee_voice_note_on in polyphonic/new section: key %d, mono %d, old status %d\n", key, synth->monophonic, voice->status); voice->target_pitch = nekobee_pitch[key]; @@ -97,7 +94,6 @@ nekobee_voice_note_on(nekobee_synth_t *synth, nekobee_voice_t *voice, } else { /* synth is monophonic, and we're modifying a playing voice */ - XDB_MESSAGE(XDB_NOTE, " nekobee_voice_note_on in monophonic section: old key %d => new key %d\n", synth->held_keys[0], key); /* set new pitch */ voice->target_pitch = nekobee_pitch[key]; @@ -184,8 +180,6 @@ nekobee_voice_note_off(nekobee_synth_t *synth, nekobee_voice_t *voice, { unsigned char previous_top_key; - XDB_MESSAGE(XDB_NOTE, " nekobee_set_note_off: called for voice %p, key %d\n", voice, key); - /* save release velocity */ voice->velocity = rvelocity; @@ -202,7 +196,6 @@ nekobee_voice_note_off(nekobee_synth_t *synth, nekobee_voice_t *voice, /* most-recently-played key has changed */ voice->key = synth->held_keys[0]; - XDB_MESSAGE(XDB_NOTE, " note-off in monophonic section: changing pitch to %d\n", voice->key); voice->target_pitch = nekobee_pitch[voice->key]; if (synth->glide == XSYNTH_GLIDE_MODE_INITIAL || synth->glide == XSYNTH_GLIDE_MODE_OFF) @@ -221,14 +214,12 @@ nekobee_voice_note_off(nekobee_synth_t *synth, nekobee_voice_t *voice, if (XSYNTH_SYNTH_SUSTAINED(synth)) { /* no more keys in list, but we're sustained */ - XDB_MESSAGE(XDB_NOTE, " note-off in monophonic section: sustained with no held keys\n"); if (!_RELEASED(voice)) voice->status = XSYNTH_VOICE_SUSTAINED; } else { /* not sustained */ /* no more keys in list, so turn off note */ - XDB_MESSAGE(XDB_NOTE, " note-off in monophonic section: turning off voice %p\n", voice); nekobee_voice_set_release_phase(voice); voice->status = XSYNTH_VOICE_RELEASED; @@ -243,7 +234,6 @@ nekobee_voice_note_off(nekobee_synth_t *synth, nekobee_voice_t *voice, void nekobee_voice_release_note(nekobee_synth_t *synth, nekobee_voice_t *voice) { - XDB_MESSAGE(XDB_NOTE, " nekobee_voice_release_note: turning off voice %p\n", voice); if (_ON(voice)) { /* dummy up a release velocity */ voice->rvelocity = 64; diff --git a/plugins/Nekobi/nekobee-src/nekobee_voice.h b/plugins/Nekobi/nekobee-src/nekobee_voice.h index dc8d759..a26ddb7 100644 --- a/plugins/Nekobi/nekobee-src/nekobee_voice.h +++ b/plugins/Nekobi/nekobee-src/nekobee_voice.h @@ -27,131 +27,114 @@ #define _XSYNTH_VOICE_H #include +#include #include "nekobee_types.h" /* maximum size of a rendering burst */ -#define XSYNTH_NUGGET_SIZE 64 +#define XSYNTH_NUGGET_SIZE 64 /* minBLEP constants */ /* minBLEP table oversampling factor (must be a power of two): */ -#define MINBLEP_PHASES 64 +#define MINBLEP_PHASES 64 /* MINBLEP_PHASES minus one: */ -#define MINBLEP_PHASE_MASK 63 +#define MINBLEP_PHASE_MASK 63 /* length in samples of (truncated) step discontinuity delta: */ -#define STEP_DD_PULSE_LENGTH 72 +#define STEP_DD_PULSE_LENGTH 72 /* length in samples of (truncated) slope discontinuity delta: */ -#define SLOPE_DD_PULSE_LENGTH 71 +#define SLOPE_DD_PULSE_LENGTH 71 /* the longer of the two above: */ #define LONGEST_DD_PULSE_LENGTH STEP_DD_PULSE_LENGTH /* MINBLEP_BUFFER_LENGTH must be at least XSYNTH_NUGGET_SIZE plus * LONGEST_DD_PULSE_LENGTH, and not less than twice LONGEST_DD_PULSE_LENGTH: */ -#define MINBLEP_BUFFER_LENGTH 512 +#define MINBLEP_BUFFER_LENGTH 512 /* delay between start of DD pulse and the discontinuity, in samples: */ -#define DD_SAMPLE_DELAY 4 +#define DD_SAMPLE_DELAY 4 -struct _nekobee_patch_t -{ - float tuning; +struct _nekobee_patch_t { + float tuning; unsigned char waveform; - float cutoff; - float resonance; - float envmod; - float decay; - float accent; - float volume; + float cutoff; + float resonance; + float envmod; + float decay; + float accent; + float volume; }; -enum nekobee_voice_status -{ +enum nekobee_voice_status { XSYNTH_VOICE_OFF, /* silent: is not processed by render loop */ XSYNTH_VOICE_ON, /* has not received a note off event */ - XSYNTH_VOICE_SUSTAINED, /* has received note off, but sustain controller is on */ - XSYNTH_VOICE_RELEASED /* had note off, not sustained, in final decay phase of envelopes */ + XSYNTH_VOICE_SUSTAINED, /* has received note off, but sustain controller is + on */ + XSYNTH_VOICE_RELEASED /* had note off, not sustained, in final decay phase + of envelopes */ }; -struct blosc -{ - int last_waveform, /* persistent */ - waveform, /* comes from LADSPA port each cycle */ - bp_high; /* persistent */ - float pos, /* persistent */ - pw; /* comes from LADSPA port each cycle */ +struct blosc { + int last_waveform, /* persistent */ + waveform, /* comes from LADSPA port each cycle */ + bp_high; /* persistent */ + float pos, /* persistent */ + pw; /* comes from LADSPA port each cycle */ }; /* * nekobee_voice_t */ -struct _nekobee_voice_t -{ - unsigned int note_id; +struct _nekobee_voice_t { + unsigned int note_id; unsigned char status; unsigned char key; unsigned char velocity; - unsigned char rvelocity; /* the note-off velocity */ + unsigned char rvelocity; /* the note-off velocity */ /* translated controller values */ - float pressure; /* filter resonance multiplier, off = 1.0, full on = 0.0 */ + float pressure; /* filter resonance multiplier, off = 1.0, full on = 0.0 */ /* persistent voice state */ - float prev_pitch, - target_pitch, - lfo_pos; - struct blosc osc1; - float vca_eg, - vcf_eg, - accent_slug, - delay1, - delay2, - delay3, - delay4, - c5; - unsigned char vca_eg_phase, - vcf_eg_phase; - int osc_index; /* shared index into osc_audio */ - float osc_audio[MINBLEP_BUFFER_LENGTH]; - float freqcut_buf[XSYNTH_NUGGET_SIZE]; - float vca_buf[XSYNTH_NUGGET_SIZE]; + float prev_pitch, target_pitch, lfo_pos; + struct blosc osc1; + float vca_eg, vcf_eg, accent_slug, delay1, delay2, delay3, delay4, c5; + unsigned char vca_eg_phase, vcf_eg_phase; + int osc_index; /* shared index into osc_audio */ + float osc_audio[MINBLEP_BUFFER_LENGTH]; + float freqcut_buf[XSYNTH_NUGGET_SIZE]; + float vca_buf[XSYNTH_NUGGET_SIZE]; }; -#define _PLAYING(voice) ((voice)->status != XSYNTH_VOICE_OFF) -#define _ON(voice) ((voice)->status == XSYNTH_VOICE_ON) -#define _SUSTAINED(voice) ((voice)->status == XSYNTH_VOICE_SUSTAINED) -#define _RELEASED(voice) ((voice)->status == XSYNTH_VOICE_RELEASED) -#define _AVAILABLE(voice) ((voice)->status == XSYNTH_VOICE_OFF) +#define _PLAYING(voice) ((voice)->status != XSYNTH_VOICE_OFF) +#define _ON(voice) ((voice)->status == XSYNTH_VOICE_ON) +#define _SUSTAINED(voice) ((voice)->status == XSYNTH_VOICE_SUSTAINED) +#define _RELEASED(voice) ((voice)->status == XSYNTH_VOICE_RELEASED) +#define _AVAILABLE(voice) ((voice)->status == XSYNTH_VOICE_OFF) extern float nekobee_pitch[128]; -typedef struct { float value, delta; } float_value_delta; +typedef struct { + float value, delta; +} float_value_delta; extern float_value_delta step_dd_table[]; extern float slope_dd_table[]; /* nekobee_voice.c */ nekobee_voice_t *nekobee_voice_new(); -void nekobee_voice_note_on(nekobee_synth_t *synth, - nekobee_voice_t *voice, - unsigned char key, - unsigned char velocity); -void nekobee_voice_remove_held_key(nekobee_synth_t *synth, - unsigned char key); -void nekobee_voice_note_off(nekobee_synth_t *synth, - nekobee_voice_t *voice, - unsigned char key, - unsigned char rvelocity); -void nekobee_voice_release_note(nekobee_synth_t *synth, - nekobee_voice_t *voice); -void nekobee_voice_set_ports(nekobee_synth_t *synth, - nekobee_patch_t *patch); -void nekobee_voice_update_pressure_mod(nekobee_synth_t *synth, - nekobee_voice_t *voice); +void nekobee_voice_note_on(nekobee_synth_t *synth, nekobee_voice_t *voice, + unsigned char key, unsigned char velocity); +void nekobee_voice_remove_held_key(nekobee_synth_t *synth, unsigned char key); +void nekobee_voice_note_off(nekobee_synth_t *synth, nekobee_voice_t *voice, + unsigned char key, unsigned char rvelocity); +void nekobee_voice_release_note(nekobee_synth_t *synth, nekobee_voice_t *voice); +void nekobee_voice_set_ports(nekobee_synth_t *synth, nekobee_patch_t *patch); +void nekobee_voice_update_pressure_mod(nekobee_synth_t *synth, + nekobee_voice_t *voice); /* nekobee_voice_render.c */ void nekobee_init_tables(void); -void nekobee_voice_render(nekobee_synth_t *synth, nekobee_voice_t *voice, - float *out, unsigned long sample_count, - int do_control_update); +void nekobee_voice_render(nekobee_synth_t *synth, float *out, + uint32_t count); /* inline functions */ @@ -161,9 +144,7 @@ void nekobee_voice_render(nekobee_synth_t *synth, nekobee_voice_t *voice, * Purpose: Turns off a voice immediately, meaning that it is not processed * anymore by the render loop. */ -static inline void -nekobee_voice_off(nekobee_voice_t* voice) -{ +static inline void nekobee_voice_off(nekobee_voice_t *voice) { voice->status = XSYNTH_VOICE_OFF; /* silence the oscillator buffer for the next use */ memset(voice->osc_audio, 0, MINBLEP_BUFFER_LENGTH * sizeof(float)); @@ -173,9 +154,7 @@ nekobee_voice_off(nekobee_voice_t* voice) /* * nekobee_voice_start_voice */ -static inline void -nekobee_voice_start_voice(nekobee_voice_t *voice) -{ +static inline void nekobee_voice_start_voice(nekobee_voice_t *voice) { voice->status = XSYNTH_VOICE_ON; /* -FIX- increment active voice count? */ } diff --git a/plugins/Nekobi/nekobee-src/nekobee_voice_render.c b/plugins/Nekobi/nekobee-src/nekobee_voice_render.c index 075732e..15f4324 100644 --- a/plugins/Nekobi/nekobee-src/nekobee_voice_render.c +++ b/plugins/Nekobi/nekobee-src/nekobee_voice_render.c @@ -18,3 +18,27 @@ * MA 02111-1307, USA. */ +// complete rewrite of the voice engine + +#include +#include + +#include "nekobee_synth.h" + + +float nekobee_pitch[128]; + +void nekobee_init_tables(void) { + return; +} + +void nekobee_voice_render(nekobee_synth_t *synth, float *out, uint32_t count) { + // generate "count" samples into the buffer at out + + + return; + (void)synth; + (void)out; + (void)count; +} +