mirror of https://github.com/AxioDL/amuse.git
Various engine bug fixes
This commit is contained in:
parent
f2f11fee33
commit
3a8a9f0ef2
|
@ -205,7 +205,7 @@ struct AppCallback : boo::IApplicationCallback
|
|||
m_setupId = setupId;
|
||||
if (m_seq)
|
||||
{
|
||||
m_seq->stopSong();
|
||||
m_seq->stopSong(true);
|
||||
m_seq->kill();
|
||||
}
|
||||
m_seq = m_engine->seqPlay(m_groupId, setupId, nullptr);
|
||||
|
|
|
@ -54,7 +54,7 @@ class Sequencer : public Entity
|
|||
/** Voices corresponding to currently-pressed keys in channel */
|
||||
std::unordered_map<uint8_t, std::shared_ptr<Voice>> m_chanVoxs;
|
||||
std::unordered_set<std::shared_ptr<Voice>> m_keyoffVoxs;
|
||||
int8_t m_ctrlVals[128]; /**< MIDI controller values */
|
||||
int8_t m_ctrlVals[128] = {}; /**< MIDI controller values */
|
||||
float m_curPitchWheel = 0.f; /**< MIDI pitch-wheel */
|
||||
int8_t m_curProgram = 0; /**< MIDI program number */
|
||||
float m_curVol = 1.f; /**< Current volume of channel */
|
||||
|
|
|
@ -60,7 +60,7 @@ class Voice : public Entity
|
|||
int16_t m_prev1 = 0; /**< DSPADPCM prev sample */
|
||||
int16_t m_prev2 = 0; /**< DSPADPCM prev-prev sample */
|
||||
double m_sampleRate = 32000.0; /**< Current sample rate computed from relative sample key or SETPITCH */
|
||||
double m_voiceTime; /**< Current seconds of voice playback (per-sample resolution) */
|
||||
double m_voiceTime = 0.0; /**< Current seconds of voice playback (per-sample resolution) */
|
||||
|
||||
VoiceState m_voxState = VoiceState::Dead; /**< Current high-level state of voice */
|
||||
bool m_sustained = false; /**< Sustain pedal pressed for this voice */
|
||||
|
|
|
@ -144,7 +144,14 @@ std::shared_ptr<Voice> Sequencer::ChannelState::keyOn(uint8_t note, uint8_t velo
|
|||
return {};
|
||||
|
||||
/* Ensure keyoff sent first */
|
||||
keyOff(note, 0);
|
||||
auto keySearch = m_chanVoxs.find(note);
|
||||
if (keySearch != m_chanVoxs.cend())
|
||||
{
|
||||
keySearch->second->keyOff();
|
||||
keySearch->second->setPedal(false);
|
||||
m_keyoffVoxs.emplace(std::move(keySearch->second));
|
||||
m_chanVoxs.erase(keySearch);
|
||||
}
|
||||
|
||||
std::shared_ptr<Voice> ret = m_parent.m_engine._allocateVoice(m_parent.m_audioGroup,
|
||||
m_parent.m_groupId, 32000.0,
|
||||
|
|
|
@ -445,7 +445,7 @@ size_t Voice::supplyAudio(size_t samples, int16_t* data)
|
|||
if (dead && m_voxState == VoiceState::KeyOff &&
|
||||
m_sampleEndTrap.macroId == 0xffff &&
|
||||
m_messageTrap.macroId == 0xffff &&
|
||||
m_volAdsr.isComplete())
|
||||
(!m_curSample || (m_curSample && m_volAdsr.isComplete())))
|
||||
{
|
||||
m_voxState = VoiceState::Dead;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue