Merge pull request #25 from lioncash/array

Envelope: Make lookup table const
This commit is contained in:
Phillip Stephens 2019-08-26 15:54:04 -07:00 committed by GitHub
commit 80da83eb16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 10 deletions

View File

@ -1,20 +1,22 @@
#include "amuse/Envelope.hpp"
#include <array>
#include "amuse/AudioGroupPool.hpp"
#include "amuse/Voice.hpp"
namespace amuse {
static int32_t MIDItoTIME[104] = {/* [0..103] -> milliseconds */
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110,
110, 120, 130, 140, 150, 160, 170, 190, 200, 220, 230, 250,
270, 290, 310, 330, 350, 380, 410, 440, 470, 500, 540, 580,
620, 660, 710, 760, 820, 880, 940, 1000, 1000, 1100, 1200, 1300,
1400, 1500, 1600, 1700, 1800, 2000, 2100, 2300, 2400, 2600, 2800, 3000,
3200, 3500, 3700, 4000, 4300, 4600, 4900, 5300, 5700, 6100, 6500, 7000,
7500, 8100, 8600, 9300, 9900, 10000, 11000, 12000, 13000, 14000, 15000, 16000,
17000, 18000, 19000, 21000, 22000, 24000, 26000, 28000, 30000, 32000, 34000, 37000,
39000, 42000, 45000, 49000, 50000, 55000, 60000, 65000};
// [0..103] -> milliseconds
constexpr std::array<int32_t, 104> MIDItoTIME{
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 110, 120, 130,
140, 150, 160, 170, 190, 200, 220, 230, 250, 270, 290, 310, 330, 350, 380,
410, 440, 470, 500, 540, 580, 620, 660, 710, 760, 820, 880, 940, 1000, 1000,
1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 2000, 2100, 2300, 2400, 2600, 2800, 3000,
3200, 3500, 3700, 4000, 4300, 4600, 4900, 5300, 5700, 6100, 6500, 7000, 7500, 8100, 8600,
9300, 9900, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 21000, 22000, 24000,
26000, 28000, 30000, 32000, 34000, 37000, 39000, 42000, 45000, 49000, 50000, 55000, 60000, 65000,
};
void Envelope::reset(const ADSR* adsr) {
m_phase = State::Attack;