diff options
author | rekado <rekado@elephly.net> | 2013-01-16 07:46:57 +0800 |
---|---|---|
committer | rekado <rekado@elephly.net> | 2013-01-16 07:46:57 +0800 |
commit | b273ec03ac4d420a5a33ae50ed588eb7b236bec0 (patch) | |
tree | 7a048ec58df332e2fa3a090fe42a4ae239cd5903 | |
parent | 9e2d18d07bc7c88a5fb6fee99f960d559205806e (diff) |
remove voice[vl] from `mdaPianoVoice::on`
-rw-r--r-- | src/mdaPianoVoice.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/mdaPianoVoice.cpp b/src/mdaPianoVoice.cpp index abb6a95..86203eb 100644 --- a/src/mdaPianoVoice.cpp +++ b/src/mdaPianoVoice.cpp @@ -53,7 +53,7 @@ void mdaPianoVoice::on(unsigned char note, unsigned char velocity) // TODO: replace with this voice's local copy float * param = programs[curProgram].param; float l=99.0f; - uint32_t v, vl=0, k, s; + uint32_t v, k, s; if(velocity>0) { @@ -85,39 +85,38 @@ void mdaPianoVoice::on(unsigned char note, unsigned char velocity) l += (float)(note - kgrp[k].root); //pitch l = 22050.0f * iFs * (float)exp(0.05776226505 * l); - voice[vl].delta = (uint32_t)(65536.0f * l); - voice[vl].frac = 0; - voice[vl].pos = kgrp[k].pos; - voice[vl].end = kgrp[k].end; - voice[vl].loop = kgrp[k].loop; + delta = (uint32_t)(65536.0f * l); + frac = 0; + pos = kgrp[k].pos; + end = kgrp[k].end; + loop = kgrp[k].loop; - voice[vl].env = (0.5f + velsens) * (float)pow(0.0078f * velocity, velsens); //velocity + env = (0.5f + velsens) * (float)pow(0.0078f * velocity, velsens); //velocity l = 50.0f + param[4] * param[4] * muff + muffvel * (float)(velocity - 64); //muffle if(l < (55.0f + 0.25f * (float)note)) l = 55.0f + 0.25f * (float)note; if(l > 210.0f) l = 210.0f; - voice[vl].ff = l * l * iFs; - voice[vl].f0 = voice[vl].f1 = 0.0f; + ff = l * l * iFs; + f0 = f1 = 0.0f; - voice[vl].note = note; //note->pan if(note < 12) note = 12; if(note > 108) note = 108; l = volume * trim; - voice[vl].outr = l + l * width * (float)(note - 60); - voice[vl].outl = l + l - voice[vl].outr; + outr = l + l * width * (float)(note - 60); + outl = l + l - outr; if(note < 44) note = 44; //limit max decay length l = 2.0f * param[0]; if(l < 1.0f) l += 0.25f - 0.5f * param[0]; - voice[vl].dec = (float)exp(-iFs * exp(-0.6 + 0.033 * (double)note - l)); + dec = (float)exp(-iFs * exp(-0.6 + 0.033 * (double)note - l)); } else //note off { // TODO: move the loop to mdaPiano.cpp - for(v=0; v<NVOICES; v++) if(voice[v].note==note) //any voices playing that note? - { + //for(v=0; v<NVOICES; v++) if(voice[v].note==note) //any voices playing that note? + //{ release(0); - } + //} } } |