mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-11 17:29:57 +00:00
Calculate voice step length adjustments.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
5084d85e49
commit
210286514e
@ -375,6 +375,14 @@ namespace EightBit {
|
||||
std::array<std::shared_ptr<AudioVoice>, 4> m_voices;
|
||||
std::array<OutputChannel, 2> m_channels;
|
||||
bool m_enabled;
|
||||
|
||||
template<class T>
|
||||
static void stepLength(T* voice) {
|
||||
if (voice->length() > 0) {
|
||||
auto current = voice->length();
|
||||
voice->setLength(--current);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -47,7 +47,7 @@ void EightBit::GameBoy::Envelope::step() {
|
||||
auto volume = m_volume + (m_direction == Amplify ? +1 : -1);
|
||||
if (volume >= 0 || volume <= 15)
|
||||
m_volume = volume;
|
||||
m_position == m_period;
|
||||
m_position = m_period;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -784,6 +784,10 @@ void EightBit::GameBoy::Audio::Sequencer_FrameStep(const int step) {
|
||||
}
|
||||
|
||||
void EightBit::GameBoy::Audio::Sequencer_LengthStep(const int step) {
|
||||
stepLength(voice1());
|
||||
stepLength(voice2());
|
||||
stepLength(voice3());
|
||||
stepLength(voice4());
|
||||
}
|
||||
|
||||
void EightBit::GameBoy::Audio::Sequencer_VolumeStep(const int step) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user