summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2013-01-25 18:29:42 +0800
committerrekado <rekado@elephly.net>2013-01-25 18:29:42 +0800
commit4e3fd1f417861282121ee4f29091373dd672a51a (patch)
tree56a065e8b4ea3d3d6358975d3f46b387d5c33d1d /src
parenta4bf64eb72d145366874a85444e27e67a8df2349 (diff)
move around block for easier comparison with mdaEPiano
Diffstat (limited to 'src')
-rw-r--r--src/mdaPiano.cpp19
-rw-r--r--src/mdaPianoVoice.cpp25
2 files changed, 22 insertions, 22 deletions
diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp
index 1b153c8..6e3d8e7 100644
--- a/src/mdaPiano.cpp
+++ b/src/mdaPiano.cpp
@@ -22,6 +22,8 @@
mdaPiano::mdaPiano(double rate)
: LV2::Synth<mdaPianoVoice, mdaPiano>(p_n_ports, p_midi) {
+ sustain = 0;
+
static const char* sample_names[] =
{ "0c.raw", "0e.raw", "0g.raw"
, "1c.raw", "1e.raw", "1g.raw"
@@ -41,18 +43,9 @@ mdaPiano::mdaPiano(double rate)
add_voices(voices[i]);
}
- sustain = 0;
-
add_audio_outputs(p_left, p_right);
}
-//parameter change
-void mdaPiano::update() {
- for (uint32_t v=0; v<NVOICES; ++v) {
- voices[v]->update(Current);
- }
-}
-
unsigned mdaPiano::find_free_voice(unsigned char key, unsigned char velocity) {
//is this a retriggered note during sustain?
@@ -85,6 +78,14 @@ void mdaPiano::setVolume(float value) {
}
+//parameter change
+void mdaPiano::update() {
+ for (uint32_t v=0; v<NVOICES; ++v) {
+ voices[v]->update(Current);
+ }
+}
+
+
void mdaPiano::handle_midi(uint32_t size, unsigned char* data) {
#ifdef DEBUG
printf("%d\n", data[1]);
diff --git a/src/mdaPianoVoice.cpp b/src/mdaPianoVoice.cpp
index 8eba4e3..6d8256e 100644
--- a/src/mdaPianoVoice.cpp
+++ b/src/mdaPianoVoice.cpp
@@ -26,17 +26,6 @@ mdaPianoVoice::mdaPianoVoice(double rate, Sample * master_samples, KGRP * master
}
-void mdaPianoVoice::reset() {
- env = 0.0f;
- dec = 0.99f;
- muff = 160.0f;
- volume = 0.2f;
- sustain = 0;
- cpos = 0;
- m_key = LV2::INVALID_KEY;
-}
-
-
float mdaPianoVoice::p_helper(unsigned short id, Param d) {
if (d == Default)
return default_preset[p_offset(id)];
@@ -99,8 +88,18 @@ void mdaPianoVoice::on(unsigned char note, unsigned char velocity) {
}
-void mdaPianoVoice::release(unsigned char velocity)
-{
+void mdaPianoVoice::reset() {
+ env = 0.0f;
+ dec = 0.99f;
+ muff = 160.0f;
+ volume = 0.2f;
+ sustain = 0;
+ cpos = 0;
+ m_key = LV2::INVALID_KEY;
+}
+
+
+void mdaPianoVoice::release(unsigned char velocity) {
if(sustain==0) {
//no release on highest notes
if(m_key < 94 || m_key == SUSTAIN) {