From dd8464f5f747685e385c7e2246f64eeef4a84fc1 Mon Sep 17 00:00:00 2001 From: dashodanger Date: Tue, 22 Oct 2024 00:26:55 -0600 Subject: [PATCH] Restore FMMIDI --- libraries/CMakeLists.txt | 1 + libraries/fmmidi/CMakeLists.txt | 10 + libraries/fmmidi/LICENSE.txt | 26 + libraries/fmmidi/filter.cpp | 286 ++++ libraries/fmmidi/filter.hpp | 54 + libraries/fmmidi/midisynth.cpp | 2685 ++++++++++++++++++++++++++++++ libraries/fmmidi/midisynth.hpp | 681 ++++++++ source_files/edge/CMakeLists.txt | 2 + source_files/edge/m_option.cc | 7 +- source_files/edge/s_fmm.cc | 357 ++++ source_files/edge/s_fmm.h | 28 + source_files/edge/s_music.cc | 7 +- 12 files changed, 4141 insertions(+), 3 deletions(-) create mode 100644 libraries/fmmidi/CMakeLists.txt create mode 100644 libraries/fmmidi/LICENSE.txt create mode 100644 libraries/fmmidi/filter.cpp create mode 100644 libraries/fmmidi/filter.hpp create mode 100644 libraries/fmmidi/midisynth.cpp create mode 100644 libraries/fmmidi/midisynth.hpp create mode 100644 source_files/edge/s_fmm.cc create mode 100644 source_files/edge/s_fmm.h diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt index 44423d023..aa96c08d8 100644 --- a/libraries/CMakeLists.txt +++ b/libraries/CMakeLists.txt @@ -2,6 +2,7 @@ add_subdirectory(almostequals) add_subdirectory(crsid) add_subdirectory(dr_libs) add_subdirectory(fluidlite) +add_subdirectory(fmmidi) if (NOT EDGE_GL_ES2) add_subdirectory(glad) else() diff --git a/libraries/fmmidi/CMakeLists.txt b/libraries/fmmidi/CMakeLists.txt new file mode 100644 index 000000000..3e7aab924 --- /dev/null +++ b/libraries/fmmidi/CMakeLists.txt @@ -0,0 +1,10 @@ +########################################## +# fmmidi +########################################## + +add_library(fmmidi + filter.cpp + midisynth.cpp +) + +target_include_directories(fmmidi PUBLIC ./) \ No newline at end of file diff --git a/libraries/fmmidi/LICENSE.txt b/libraries/fmmidi/LICENSE.txt new file mode 100644 index 000000000..17d8fdc5d --- /dev/null +++ b/libraries/fmmidi/LICENSE.txt @@ -0,0 +1,26 @@ +Copyright 2003-2006 yuno. +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list +of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this +list of conditions and the following disclaimer in the documentation and/or other +materials provided with the distribution. + +3. The name of the author may not be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/libraries/fmmidi/filter.cpp b/libraries/fmmidi/filter.cpp new file mode 100644 index 000000000..9a9ac556b --- /dev/null +++ b/libraries/fmmidi/filter.cpp @@ -0,0 +1,286 @@ +#include "filter.hpp" + +#include +#include + +using namespace std; + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +namespace filter +{ +// n��2���Ƃ���ΐ�(�؂�̂�) +int log2(int n) +{ + assert(n >= 1); + int x = 0; + while (n) + { + ++x; + n >>= 1; + } + return x - 1; +} +// n��2���Ƃ���ΐ�(�؂�グ) +int log2_ceil(int n) +{ + assert(n >= 1); + int x = 0; + while (n > 1) + { + ++x; + n >>= 1; + } + return x; +} + +// �����t�[���G�ϊ� +void fft(complex dst[], const complex src[], int n) +{ + assert(n >= 1); + int size = pow2(n); + vector reversal(size); + for (int i = 0; i < size; ++i) + { + int a = i, b = 0; + for (int j = 0; j < n; ++j) + { + b <<= 1; + b |= a & 1; + a >>= 1; + } + reversal[i] = b; + } + vector> x0(&src[0], &src[size]); + vector> x1(size); + complex A = exp(complex(0, -2 * M_PI / size)); + for (int r = 1; r <= n; ++r) + { + int n_r = n - r; + int bit = pow2(n_r); + for (int i = 0; i < size; ++i) + { + int s = i & ~((bit << 1) - 1); // s = i / (bit * 2) * (bit * 2); + s = reversal[s]; + s <<= n_r; // s *= bit; + const complex &src1 = x0[i & ~bit]; + const complex &src2 = x0[i | bit]; + if (i & bit) + { + x1[i] = src1 - src2 * pow(A, s); + } + else + { + x1[i] = src1 + src2 * pow(A, s); + } + } + if (r < n) + { + x0.swap(x1); + } + } + for (int i = 0; i < size; ++i) + { + dst[i] = x1[reversal[i]]; + } +} + +// �t�����t�[���G�ϊ� +void ifft(complex dst[], const complex src[], int n) +{ + assert(n >= 1); + int size = pow2(n); + vector reversal(size); + for (int i = 0; i < size; ++i) + { + int a = i, b = 0; + for (int j = 0; j < n; ++j) + { + b <<= 1; + b |= a & 1; + a >>= 1; + } + reversal[i] = b; + } + vector> x0(&src[0], &src[size]); + vector> x1(size); + complex A = exp(complex(0, 2 * M_PI / size)); + for (int r = 1; r <= n; ++r) + { + int n_r = n - r; + int bit = pow2(n_r); + for (int i = 0; i < size; i++) + { + int s = i & ~((bit << 1) - 1); // s = i / (bit * 2) * (bit * 2); + s = reversal[s]; + s <<= n_r; // s *= bit; + const complex &src1 = x0[i & ~bit]; + const complex &src2 = x0[i | bit]; + if (i & bit) + { + x1[i] = src1 - src2 * pow(A, s); + } + else + { + x1[i] = src1 + src2 * pow(A, s); + } + } + if (r < n) + { + x0.swap(x1); + } + } + for (int i = 0; i < size; ++i) + { + dst[i] = x1[reversal[i]] / static_cast(size); + } +} + +// �n�j���O�� +void hanning_window(double dst[], const double src[], size_t n) +{ + double t = 2 * M_PI / n; + for (size_t i = 0; i < n; ++i) + { + dst[i] = src[i] * (0.5 - 0.5 * cos(t * i)); + } +} + +// FIR�R���X�g���N�^ +finite_impulse_response::finite_impulse_response() +{ + buffer.resize(1); + h.assign(1, 1); + pos = 0; + hlen = 1; +} +// FIR�W���ݒ� +void finite_impulse_response::set_impulse_response(const double *h_, size_t length) +{ + hlen = length; + h.resize(pow2(log2_ceil(length))); + for (size_t i = 0; i < length; ++i) + { + h[i] = static_cast(h_[i] * (1 << 12)); + } + for (size_t i = length; i < h.size(); ++i) + { + h[i] = 0; + } + while (hlen > 1 && h[hlen - 1] == 0) + { + --hlen; + } + length = h.size(); + if (buffer.size() < length) + { + size_t size = buffer.size(); + size_t d = length - size; + buffer.resize(length); + memmove(&buffer[pos + d], &buffer[pos], sizeof(buffer[0]) * (size - pos)); + memset(&buffer[pos], 0, sizeof(buffer[0]) * d); + } +} +// FIR�t�B���^�K�p +void finite_impulse_response::apply(int_least32_t *out, const int_least32_t *in, size_t length, std::size_t stride) +{ + std::size_t buflenmask = buffer.size() - 1; + while (length > 0) + { + buffer[pos] = *in; + pos = (pos + 1) & buflenmask; + size_t offset = pos + buffer.size() - hlen; + int_least32_t result = 0; + for (size_t i = 0; i < hlen; ++i) + { + result += h[i] * buffer[(offset + i) & buflenmask] >> 12; + } + *out = result; + in = reinterpret_cast(reinterpret_cast(in) + stride); + out = reinterpret_cast(reinterpret_cast(out) + stride); + --length; + } +} + +// �C�R���C�UFIR�t�B���^�쐬 +void compute_equalizer_fir(double *h, std::size_t length, double rate, const std::map &gains) +{ + for (std::size_t i = 0; i < length; ++i) + { + h[i] = 0; + } + if (gains.empty()) + { + h[0] = 1; + } + else + { + int h_bits = log2(length); + size_t length = pow2(h_bits); + size_t half_length = length / 2; + std::map gain_bounds; + std::map::const_iterator i = gains.begin(); + gain_bounds[0] = i->second; + for (;;) + { + double fL = i->first; + double gL = i->second; + ++i; + if (i == gains.end()) + { + break; + } + double fR = i->first; + double gR = i->second; + double log_fL = log(fL); + double log_fR = log(fR); + const int n = 16; + for (int i = 0; i < n; ++i) + { + double ft = (i + 0.5) / n; + double f = exp(log_fL * (1 - ft) + log_fR * ft); + double gt = static_cast(i) / n; + double g = gL * (1 - gt) + gR * gt; + gain_bounds[f] = g; + } + } + double T = 1 / rate; + for (size_t k = 0; k < half_length; ++k) + { + double kT = k * T; + double hk = 0; + i = gain_bounds.begin(); + while (i != gain_bounds.end()) + { + double gain = i->second; + double f0 = i->first; + ++i; + double f1 = i == gain_bounds.end() ? rate / 2 : i->first; + double w0 = f0 * 2 * M_PI; + double w1 = f1 * 2 * M_PI; + if (k == 0) + { + hk += gain * (w1 - w0 + (-w0) - (-w1)); + } + else + { + double w0kT = w0 * kT; + double w1kT = w1 * kT; + /* + hk += + gain * exp(complex(0, w1kT)) / complex(0, kT) + - gain * exp(complex(0, w0kT)) / complex(0, kT) + + gain * exp(complex(0, -w0kT)) / complex(0, kT) + - gain * exp(complex(0, -w1kT)) / complex(0, kT); + */ + hk += gain * (sin(w1kT) - sin(w0kT)) * 2 / kT; + } + } + hk *= T / (2 * M_PI); + h[half_length - 1 - k] = hk; + h[half_length - 1 + k] = hk; + } + } +} +} // namespace filter diff --git a/libraries/fmmidi/filter.hpp b/libraries/fmmidi/filter.hpp new file mode 100644 index 000000000..cd4db9835 --- /dev/null +++ b/libraries/fmmidi/filter.hpp @@ -0,0 +1,54 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace filter +{ +/* +typedef long int_least32_t; +*/ + +// �v�Z +inline int pow2(int x) +{ + return 1 << x; +} + +int log2(int n); +int log2_ceil(int n); + +// �����t�[���G�ϊ� +void fft(std::complex dst[], const std::complex src[], int n); +void ifft(std::complex dst[], const std::complex src[], int n); + +// ���֐� +void hanning_window(double dst[], const double src[], std::size_t n); + +// FIR�t�B���^ +class finite_impulse_response +{ + public: + finite_impulse_response(); + void set_impulse_response(const double *h, std::size_t length); + void set_impulse_response(const std::vector &h) + { + set_impulse_response(&h[0], h.size()); + } + void apply(int_least32_t *out, const int_least32_t *in, std::size_t length, + std::size_t stride = sizeof(int_least32_t)); + + private: + std::vector h; + std::vector buffer; + std::size_t pos; + std::size_t hlen; +}; + +// �t�B���^�쐬 +void compute_equalizer_fir(double *h, std::size_t length, double rate, const std::map &gains); +} // namespace filter \ No newline at end of file diff --git a/libraries/fmmidi/midisynth.cpp b/libraries/fmmidi/midisynth.cpp new file mode 100644 index 000000000..bf457d7bc --- /dev/null +++ b/libraries/fmmidi/midisynth.cpp @@ -0,0 +1,2685 @@ +// �\�t�g�E�F�AMIDI�V���Z�T�C�U�B +// Copyright(c)2003-2005 yuno +#include "midisynth.hpp" + +#include +#include +#include +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +namespace midisynth +{ +// �`�����l���R���X�g���N�^�B +channel::channel(note_factory *factory_, int bank) : factory(factory_), default_bank(bank) +{ + notes.reserve(16); + reset_all_parameters(); +} +// �`�����l���f�X�g���N�^�B +channel::~channel() +{ + all_sound_off_immediately(); +} +// �������̉�����������B +int channel::synthesize(int_least32_t *out, std::size_t samples, float rate, int_least32_t master_volume, + int master_balance) +{ + double volume = + mute ? 0.0 + : std::pow(static_cast(master_volume) * this->volume * expression / (16383.0 * 16383.0 * 16383.0), + 2) * + 16383.0; + int num_notes = 0; + std::vector::iterator i = notes.begin(); + while (i != notes.end()) + { + class note *note = i->note; + int_least32_t panpot = note->get_panpot(); + if (this->panpot <= 8192) + { + panpot = panpot * this->panpot / 8192; + } + else + { + panpot = panpot * (16384 - this->panpot) / 8192 + (this->panpot - 8192) * 2; + } + if (master_balance <= 8192) + { + panpot = panpot * master_balance / 8192; + } + else + { + panpot = panpot * (16384 - master_balance) / 8192 + (master_balance - 8192) * 2; + } + int_least32_t left = + static_cast(volume * std::cos(std::max(0, panpot - 1) * (M_PI / 2 / 16382))); + int_least32_t right = + static_cast(volume * std::sin(std::max(0, panpot - 1) * (M_PI / 2 / 16382))); + bool ret = note->synthesize(out, samples, rate, left, right); + if (ret) + { + ++i; + } + else + { + i = notes.erase(i); + delete note; + } + ++num_notes; + } + return num_notes; +} +// ���ׂẴp�����[�^��������Ԃɖ߂��B +void channel::reset_all_parameters() +{ + program = default_bank * 128; + bank = default_bank; + panpot = 8192; + volume = 12800; + fine_tuning = 8192; + coarse_tuning = 8192; + tremolo_frequency = 3; + vibrato_frequency = 3; + master_frequency_multiplier = 1; + mono = false; + mute = false; + system_mode = system_mode_default; + reset_all_controller(); +} +// �p�����[�^��������Ԃɖ߂��B +void channel::reset_all_controller() +{ + expression = 16383; + channel_pressure(0); + pitch_bend = 8192; + pitch_bend_sensitivity = 256; + update_frequency_multiplier(); + modulation_depth = 0; + modulation_depth_range = 64; + update_modulation(); + set_damper(0); + set_sostenute(0); + set_freeze(0); + RPN = 0x3FFF; + NRPN = 0x3FFF; +} +// ���ׂẲ����m�[�g�I�t����B +void channel::all_note_off() +{ + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + if (i->status == NOTE::NOTEON) + { + i->status = NOTE::NOTEOFF; + i->note->note_off(64); + } + } +} +// ���ׂẲ����T�E���h�I�t����B +void channel::all_sound_off() +{ + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + if (i->status != NOTE::SOUNDOFF) + { + i->status = NOTE::SOUNDOFF; + i->note->sound_off(); + } + } +} +// ���������B +void channel::all_sound_off_immediately() +{ + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + delete i->note; + } + notes.clear(); +} +// �m�[�g�I���B�����o���B +void channel::note_on(int note, int velocity) +{ + assert(note >= 0 && note < NUM_NOTES); + assert(velocity >= 0 && velocity <= 127); + + note_off(note, 64); + if (velocity) + { + if (mono) + { + all_sound_off(); + } + class note *p = factory->note_on(program, note, velocity, frequency_multiplier); + if (p) + { + int assign = p->get_assign(); + if (assign) + { + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + if (i->note->get_assign() == assign) + { + i->note->sound_off(); + } + } + } + if (freeze) + { + p->set_freeze(freeze); + } + if (damper) + { + p->set_damper(damper); + } + if (modulation_depth) + { + float depth = static_cast(modulation_depth) * modulation_depth_range / (16383.0 * 128.0); + p->set_vibrato(depth, vibrato_frequency); + } + if (pressure) + { + p->set_tremolo(pressure, tremolo_frequency); + } + notes.push_back(NOTE(p, note)); + } + } +} +// �m�[�g�I�t�B���������[�X�^�C���ɓ���B +void channel::note_off(int note, int velocity) +{ + assert(note >= 0 && note < NUM_NOTES); + assert(velocity >= 0 && velocity <= 127); + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + if (i->key == note && i->status == NOTE::NOTEON) + { + i->status = NOTE::NOTEOFF; + i->note->note_off(velocity); + } + } +} +// �|���t�H�j�b�N�L�[�v���b�V���B +void channel::polyphonic_key_pressure(int note, int value) +{ + assert(note >= 0 && note < NUM_NOTES); + assert(value >= 0 && value <= 127); + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + if (i->key == note && i->status == NOTE::NOTEON) + { + i->note->set_tremolo(value, tremolo_frequency); + } + } +} +// �`�����l���v���b�V���B +void channel::channel_pressure(int value) +{ + assert(value >= 0 && value <= 127); + if (pressure != value) + { + pressure = value; + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + if (i->status == NOTE::NOTEON) + { + i->note->set_tremolo(value, tremolo_frequency); + } + } + } +} +// �R���g���[���`�F���W�B +void channel::control_change(int control, int value) +{ + assert(value >= 0 && value <= 0x7F); + switch (control) + { + case 0x00: + bank_select((bank & 0x7F) | (value << 7)); + break; + case 0x01: + set_modulation_depth((modulation_depth & 0x7F) | (value << 7)); + break; + case 0x06: + set_registered_parameter((get_registered_parameter() & 0x7F) | (value << 7)); + break; + case 0x07: + volume = (volume & 0x7F) | (value << 7); + break; + case 0x0A: + panpot = (panpot & 0x7F) | (value << 7); + break; + case 0x0B: + expression = (expression & 0x7F) | (value << 7); + break; + case 0x20: + bank_select((bank & 0x7F) | (value << 7)); + break; + case 0x21: + set_modulation_depth((modulation_depth & ~0x7F) | value); + break; + case 0x26: + set_registered_parameter((get_registered_parameter() & ~0x7F) | value); + break; + case 0x27: + volume = (volume & ~0x7F) | value; + break; + case 0x2A: + panpot = (panpot & ~0x7F) | value; + break; + case 0x2B: + expression = (expression & ~0x7F) | value; + break; + case 0x40: + set_damper(value); + break; + case 0x42: + set_sostenute(value); + break; + case 0x45: + set_freeze(value); + break; + case 0x60: + set_registered_parameter(std::min(0x3FFF, get_registered_parameter() + 1)); + break; + case 0x61: + set_registered_parameter(std::max(0, get_registered_parameter() - 1)); + break; + case 0x62: + set_NRPN((NRPN & ~0x7F) | value); + break; + case 0x63: + set_NRPN((NRPN & 0x7F) | (value << 7)); + break; + case 0x64: + set_RPN((RPN & ~0x7F) | value); + break; + case 0x65: + set_RPN((RPN & 0x7F) | (value << 7)); + break; + case 0x78: + all_sound_off(); + break; + case 0x79: + reset_all_controller(); + break; + case 0x7B: + case 0x7C: + case 0x7D: + all_note_off(); + break; + case 0x7E: + mono_mode_on(); + break; + case 0x7F: + poly_mode_on(); + break; + } +} +// �o���N�Z���N�g +void channel::bank_select(int value) +{ + switch (system_mode) + { + case system_mode_gm: + break; + case system_mode_gs: + if (((bank & 0x3F80) == 0x3C00) == ((value & 0x3F80) == 0x3C00)) + { + set_bank(value); + } + break; + case system_mode_xg: + if (default_bank == 0x3C00) + { + set_bank(0x3C00 | (value & 0x7F)); + } + else if ((value & 0x3F80) == 0x3F80) + { + set_bank(0x3C00 | (value & 0x7F)); + } + else + { + set_bank(value); + } + break; + default: + if (default_bank == 0x3C00) + { + set_bank(0x3C00 | (value & 0x7F)); + } + else + { + set_bank(value); + } + break; + } +} +// �_���p�[���ʁB +void channel::set_damper(int value) +{ + if (damper != value) + { + damper = value; + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + i->note->set_damper(value); + } + } +} +// �\�X�e�k�[�g���ʁB +void channel::set_sostenute(int value) +{ + sostenute = value; + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + i->note->set_sostenute(value); + } +} +// �t���[�Y���ʁB +void channel::set_freeze(int value) +{ + if (freeze != value) + { + freeze = value; + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + i->note->set_freeze(value); + } + } +} +// RPN�擾�B +int channel::get_registered_parameter() +{ + switch (RPN) + { + case 0x0000: + return pitch_bend_sensitivity; + case 0x0001: + return fine_tuning; + case 0x0002: + return coarse_tuning; + case 0x0005: + return modulation_depth_range; + default: + return 0; + } +} +// RPN�ݒ�B +void channel::set_registered_parameter(int value) +{ + switch (RPN) + { + case 0x0000: + set_pitch_bend_sensitivity(value); + break; + case 0x0001: + set_fine_tuning(value); + break; + case 0x0002: + set_coarse_tuning(value); + break; + case 0x0005: + set_modulation_depth_range(value); + break; + default: + break; + } +} +// ���g���{�����Čv�Z���X�V����B +void channel::update_frequency_multiplier() +{ + float value = + master_frequency_multiplier * + std::pow(2, (coarse_tuning - 8192) / (128.0 * 100.0 * 12.0) + (fine_tuning - 8192) / (8192.0 * 100.0 * 12.0) + + static_cast(pitch_bend - 8192) * pitch_bend_sensitivity / (8192.0 * 128.0 * 12.0)); + if (frequency_multiplier != value) + { + frequency_multiplier = value; + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + i->note->set_frequency_multiplier(value); + } + } +} +// ���W�����[�V�����f�v�X���ʂ̍X�V�B +void channel::update_modulation() +{ + float depth = static_cast(modulation_depth) * modulation_depth_range / (16383.0 * 128.0); + for (std::vector::iterator i = notes.begin(); i != notes.end(); ++i) + { + i->note->set_vibrato(depth, vibrato_frequency); + } +} + +// �V���Z�T�C�U�R���X�g���N�^�B +synthesizer::synthesizer(note_factory *factory) +{ + for (int i = 0; i < NUM_CHANNELS; ++i) + { + channels[i] = new channel(factory, i == 9 ? 0x3C00 : 0x3C80); + } + reset_all_parameters(); +} + +synthesizer::~synthesizer() +{ + for (int i = 0; i < NUM_CHANNELS; ++i) + delete channels[i]; +} +// �`�����l���擾�B +channel *synthesizer::get_channel(int ch) +{ + assert(ch >= 0 && ch < NUM_CHANNELS); + return channels[ch]; +} +// ������������B��������Ԃ��B +int synthesizer::synthesize(int_least16_t *output, std::size_t samples, float rate) +{ + if (samples == 0) + return 0; + std::size_t n = samples * 2; + std::vector buf(n); + int num_notes = synthesize_mixing(&buf[0], samples, rate); + if (num_notes) + { + for (std::size_t i = 0; i < n; ++i) + { + int_least32_t x = buf[i]; + if (x < -32767) + { + output[i] = -32767; + } + else if (x > 32767) + { + output[i] = 32767; + } + else + { + output[i] = static_cast(x); + } + } + } + else + { + std::memset(output, 0, sizeof(int_least16_t) * n); + } + return num_notes; +} +int synthesizer::synthesize_mixing(int_least32_t *output, std::size_t samples, float rate) +{ + if (active_sensing == 0) + { + all_sound_off(); + active_sensing = -1; + } + else if (active_sensing > 0) + { + active_sensing = std::max(0.0f, active_sensing - samples / rate); + } + int_least32_t volume = static_cast(main_volume) * master_volume / 16384; + int num_notes = 0; + for (int i = 0; i < NUM_CHANNELS; ++i) + { + num_notes += channels[i]->synthesize(output, samples, rate, volume, master_balance); + } + return num_notes; +} +// �V���Z�T�C�U�����S�Ƀ��Z�b�g����B +void synthesizer::reset() +{ + all_sound_off_immediately(); + reset_all_parameters(); +} +// ���ׂẴp�����[�^��������Ԃɖ߂��B +void synthesizer::reset_all_parameters() +{ + active_sensing = -1; + main_volume = 8192; + master_volume = 16383; + master_balance = 8192; + master_fine_tuning = 8192; + master_coarse_tuning = 8192; + master_frequency_multiplier = 1; + system_mode = system_mode_default; + for (int i = 0; i < NUM_CHANNELS; ++i) + { + channels[i]->reset_all_parameters(); + } +} +// �p�����[�^��������Ԃɖ߂��B +void synthesizer::reset_all_controller() +{ + for (int i = 0; i < NUM_CHANNELS; ++i) + { + channels[i]->reset_all_controller(); + } +} +// �I�[���m�[�g�I�t�B���ׂẲ����m�[�g�I�t����B +void synthesizer::all_note_off() +{ + for (int i = 0; i < NUM_CHANNELS; ++i) + { + channels[i]->all_note_off(); + } +} +// �I�[���T�E���h�I�t�B���ׂẲ����T�E���h�I�t����B +void synthesizer::all_sound_off() +{ + for (int i = 0; i < NUM_CHANNELS; ++i) + { + channels[i]->all_sound_off(); + } +} +// ���������B +void synthesizer::all_sound_off_immediately() +{ + for (int i = 0; i < NUM_CHANNELS; ++i) + { + channels[i]->all_sound_off_immediately(); + } +} +// �V�X�e���G�N�X�N���[�V�u���b�Z�[�W�̉��ߎ��s�B +void synthesizer::sysex_message(const void *pvdata, std::size_t size) +{ + const unsigned char *data = reinterpret_cast(pvdata); + if (size == 6 && std::memcmp(data, "\xF0\x7E\x7F\x09\x01\xF7", 6) == 0) + { + /* GM system on */ + set_system_mode(system_mode_gm); + } + else if (size == 6 && std::memcmp(data, "\xF0\x7E\x7F\x09\x02\xF7", 6) == 0) + { + /* GM system off */ + set_system_mode(system_mode_gm2); + } + else if (size == 6 && std::memcmp(data, "\xF0\x7E\x7F\x09\x03\xF7", 6) == 0) + { + /* GM2 system on */ + set_system_mode(system_mode_gm2); + } + else if (size == 11 && std::memcmp(data, "\xF0\x41", 2) == 0 && + std::memcmp(data + 3, "\x42\x12\x40\x00\x7F\x00\x41\xF7", 8) == 0) + { + /* GS reset */ + set_system_mode(system_mode_gs); + } + else if (size == 9 && std::memcmp(data, "\xF0\x43", 2) == 0 && (data[2] & 0xF0) == 0x10 && + std::memcmp(data + 3, "\x4C\x00\x00\x7E\x00\xF7", 6) == 0) + { + /* XG system on */ + set_system_mode(system_mode_xg); + } + else if (size == 8 && std::memcmp(data, "\xF0\x7F\x7F\x04\x01", 5) == 0 && data[7] == 0xF7) + { + /* master volume */ + set_master_volume((data[5] & 0x7F) | ((data[6] & 0x7F) << 7)); + } + else if (size == 8 && std::memcmp(data, "\xF0\x7F\x7F\x04\x02", 5) == 0 && data[7] == 0xF7) + { + /* master balance */ + set_master_balance((data[5] & 0x7F) | ((data[6] & 0x7F) << 7)); + } + else if (size == 8 && std::memcmp(data, "\xF0\x7F\x7F\x04\x03", 5) == 0 && data[7] == 0xF7) + { + /* master fine tuning */ + set_master_fine_tuning((data[5] & 0x7F) | ((data[6] & 0x7F) << 7)); + } + else if (size == 8 && std::memcmp(data, "\xF0\x7F\x7F\x04\x04", 5) == 0 && data[7] == 0xF7) + { + /* master coarse tuning */ + set_master_coarse_tuning((data[5] & 0x7F) | ((data[6] & 0x7F) << 7)); + } + else if (size == 11 && std::memcmp(data, "\xF0\x41", 2) == 0 && (data[2] & 0xF0) == 0x10 && + std::memcmp(data + 3, "\x42\x12\x40", 3) == 0 && (data[6] & 0xF0) == 0x10 && data[7] == 0x15 && + data[10] == 0xF7) + { + /* use for rhythm part */ + int channel = data[6] & 0x0F; + int map = data[8]; + if (map == 0) + { + channels[channel]->set_bank(0x3C80); + } + else + { + channels[channel]->set_bank(0x3C00); + } + channels[channel]->program_change(0); + } +} +// MIDI�C�x���g�̉��ߎ��s�B +void synthesizer::midi_event(int event, int param1, int param2) +{ + if (event == 0xFE) + active_sensing = 0.33f; + else if (event == 0xFF) + { + all_sound_off(); + reset_all_parameters(); + } + else + { + switch (event & 0xF0) + { + case 0x80: + note_off(event & 0x0F, param1 & 0x7F, param2 & 0x7F); + break; + case 0x90: + note_on(event & 0x0F, param1 & 0x7F, param2 & 0x7F); + break; + case 0xA0: + polyphonic_key_pressure(event & 0x0F, param1 & 0x7F, param2 & 0x7F); + break; + case 0xB0: + control_change(event & 0x0F, param1 & 0x7F, param2 & 0x7F); + break; + case 0xC0: + program_change(event & 0x0F, param1 & 0x7F); + break; + case 0xD0: + channel_pressure(event & 0x0F, param1 & 0x7F); + break; + case 0xE0: + pitch_bend_change(event & 0x0F, ((param2 & 0x7F) << 7) | (param1 & 0x7F)); + break; + } + } +} +// �V�X�e�����[�h��ύX����B +void synthesizer::set_system_mode(system_mode_t mode) +{ + all_sound_off(); + reset_all_parameters(); + system_mode = mode; + for (int i = 0; i < NUM_CHANNELS; ++i) + { + channels[i]->set_system_mode(mode); + } +} +// �}�X�^�[�`���[�j���O���Čv�Z���X�V����B +void synthesizer::update_master_frequency_multiplier() +{ + float value = std::pow(2, (master_coarse_tuning - 8192) / (128.0 * 100.0 * 12.0) + + (master_fine_tuning - 8192) / (8192.0 * 100.0 * 12.0)); + if (master_frequency_multiplier != value) + { + master_frequency_multiplier = value; + for (int i = 0; i < NUM_CHANNELS; ++i) + { + channels[i]->set_master_frequency_multiplier(value); + } + } +} + +// �����e�[�u���B�����g�W�F�l���[�^�p�B +namespace +{ +class sine_table +{ + public: + enum + { + DIVISION = 4096 + }; + sine_table(); + int_least16_t get(int n) const + { + return data[n]; + } + + private: + int_least16_t data[DIVISION]; +} sine_table; + +sine_table::sine_table() +{ + for (int i = 0; i < DIVISION; ++i) + { + data[i] = static_cast(32767 * std::sin(i * 2 * M_PI / DIVISION)); + } +} +} // namespace +// �����g������R���X�g���N�^�B +inline sine_wave_generator::sine_wave_generator() : position(0), step(0) +{ +} +inline sine_wave_generator::sine_wave_generator(float cycle) : position(0) +{ + set_cycle(cycle); +} +// �����g�̎�����ύX����B +void sine_wave_generator::set_cycle(float cycle) +{ + if (cycle) + { + step = static_cast(sine_table::DIVISION * 32768.0 / cycle); + } + else + { + step = 0; + } +} +// ���W�����[�V������������B +void sine_wave_generator::add_modulation(int_least32_t x) +{ + position += static_cast(static_cast(step) * x >> 16); +} +// ���̃T���v�������o���B +inline int sine_wave_generator::get_next() +{ + return sine_table.get((position += step) / 32768 % sine_table::DIVISION); +} +// ���̃T���v�������o��(���g���ϒ��t��)�B +inline int sine_wave_generator::get_next(int_least32_t modulation) +{ + uint_least32_t m = modulation * sine_table::DIVISION / 65536; + uint_least32_t p = ((position += step) / 32768 + m) % sine_table::DIVISION; + return sine_table.get(p); +} + +// �ΐ��ϊ��e�[�u���B�G���x���[�v�W�F�l���[�^�̃f�B�P�C�ȍ~�Ŏg���B +namespace +{ +#define LOG10_32767 4.5154366811416989472479934140484 +#define LOGTABLE_SIZE 4096 +#define LOGTABLE_FACTOR (LOGTABLE_SIZE / LOG10_32767) +class log_table +{ + public: + log_table(); + uint_least16_t get(int x) const + { + return data[x]; + } + + private: + uint_least16_t data[LOGTABLE_SIZE]; +} log_table; +log_table::log_table() +{ + for (int i = 0; i < LOGTABLE_SIZE; ++i) + { + data[i] = static_cast(std::pow(10, static_cast(i) / LOGTABLE_FACTOR)); + } +} +} // namespace + +// ���[�g�e�[�u���BAR�ADR�ASR�ARR�̌v�Z�����̍������B +namespace +{ +struct envelope_table +{ + envelope_table(); + uint_least32_t TL[128]; + uint_least32_t SL[16][128]; + double AR[64][128]; + double RR[64][128]; +} const envelope_table; + +envelope_table::envelope_table() +{ + for (int t = 0; t < 128; ++t) + { + double fTL = 32767 * std::pow(10, t * -0.75 / 10); + TL[t] = static_cast(fTL); + if (TL[t] == 0) + { + TL[t] = 1; + } + for (int s = 0; s < 16; ++s) + { + double x = fTL * std::pow(10, s * -3.0 / 10); + if (x <= 1) + { + SL[s][t] = 0; + } + else + { + SL[s][t] = static_cast(65536 * LOGTABLE_FACTOR * std::log10(x)); + } + } + } + for (int x = 0; x < 64; ++x) + { + double attack_time = 15.3262 * std::pow(10, x * -0.75 / 10); + double release_time = 211.84 * std::pow(10, x * -0.75 / 10); + for (int t = 0; t < 128; ++t) + { + AR[x][t] = TL[t] / attack_time; + RR[x][t] = 65536 * LOGTABLE_FACTOR * 48.0 / 10 * TL[t] / 32767 / release_time; + } + } +} +} // namespace + +// �G���x���[�v������R���X�g���N�^�B +envelope_generator::envelope_generator(int AR_, int DR_, int SR_, int RR_, int SL, int TL_) + : state(ATTACK), AR(AR_), DR(DR_), SR(SR_), RR(RR_), TL(TL_), current(0), rate(1), hold(0), freeze(0) +{ + if (AR >= 63) + AR = 63; + if (DR >= 63) + DR = 63; + if (SR >= 63) + SR = 63; + if (RR >= 63) + RR = 63; + assert(AR >= 0); + assert(DR >= 0); + assert(SR >= 0); + assert(RR >= 0); + assert(SL >= 0 && SL <= 15); + assert(TL >= 0 && TL <= 127); + + fTL = envelope_table.TL[TL]; + fSS = fSL = envelope_table.SL[SL][TL]; + fAR = 0; + fDR = 0; + fSR = 0; + fRR = 0; + fOR = 0; + fDRR = 0; + fDSS = 0; +} +// �Đ����[�g��ݒ肷��B +inline void envelope_generator::set_rate(float rate) +{ + this->rate = rate ? rate : 1; + update_parameters(); +} +// �z�[���h(�_���p�[&�\�X�e�k�[�g)��ݒ肷��B +void envelope_generator::set_hold(float hold) +{ + if (this->hold > hold || state <= SASTAIN || current >= fSL) + { + this->hold = hold; + update_parameters(); + } +} +// �t���[�Y��ݒ肷��B +void envelope_generator::set_freeze(float freeze) +{ + if (this->freeze > freeze || state <= SASTAIN || current >= fSL) + { + this->freeze = freeze; + update_parameters(); + } +} +// �e�p�����[�^�̍X�V�B +void envelope_generator::update_parameters() +{ + double fAR = envelope_table.AR[AR][TL] / rate; + double fDR = envelope_table.RR[DR][TL] / rate; + double fSR = envelope_table.RR[SR][TL] / rate; + double fRR = envelope_table.RR[RR][TL] / rate; + + if (fRR < 1) + { + fRR = 1; + } + if (hold > 0) + { + fRR = fSR * hold + fRR * (1 - hold); + } + if (freeze > 0) + { + fDR *= (1 - freeze); + fSR *= (1 - freeze); + fRR *= (1 - freeze); + } + if (fAR < 1) + { + fAR = 1; + } + this->fAR = static_cast(fAR); + this->fDR = static_cast(fDR); + this->fSR = static_cast(fSR); + this->fRR = static_cast(fRR); + this->fOR = static_cast(envelope_table.RR[63][0] / rate); + this->fSS = std::max(this->fDR, fSL); + this->fDRR = std::max(this->fDR, this->fRR); + this->fDSS = std::max(this->fDRR, this->fSS); +} +// �L�[�I�t�B�����[�X�ɓ���B +void envelope_generator::key_off() +{ + switch (state) + { + case ATTACK: + state = ATTACK_RELEASE; + break; + case DECAY: + state = DECAY_RELEASE; + break; + case SASTAIN: + state = RELEASE; + break; + default: + break; + } +} +// �T�E���h�I�t�B�}���������[�h�ɓ���B +void envelope_generator::sound_off() +{ + switch (state) + { + case ATTACK: + case ATTACK_RELEASE: + if (current) + { + current = static_cast(65536 * LOGTABLE_FACTOR * std::log10(static_cast(current))); + } + break; + default: + break; + } + state = SOUNDOFF; +} +// �����[�X����T�E���h�I�t�Ɉڂ郌�x���B�����[�X�̒����������‚܂ł����� +// ���Ă��CPU�p���[�̖��ʂȂ̂œK���ȂƂ���Ő؂邽�߁B�����͑ΐ��Ȃ̂� +// ���ʂ��^�Ƀ[���ɂȂ�ɂ͖����̎��Ԃ�v����B���ۂɂ͐����ɐ؂�̂Ă� +// �������Ă���̂łP�����ɂȂ����疳���ɂȂ�Ƃ͂����c�B +// �s���R�łȂ����x�ɂȂ�ׂ������l�̕����p�t�H�[�}���X�����シ��B +#define SOUNDOFF_LEVEL 1024 +// ���̃T���v���𓾂�B +int envelope_generator::get_next() +{ + uint_least32_t current = this->current; + switch (state) + { + case ATTACK: + if (current < fTL) + { + return this->current = current + fAR; + } + this->current = static_cast(65536 * LOGTABLE_FACTOR * std::log10(static_cast(fTL))); + state = DECAY; + return fTL; + case DECAY: + if (current > fSS) + { + this->current = current -= fDR; + return log_table.get(current / 65536); + } + this->current = current = fSL; + state = SASTAIN; + return log_table.get(current / 65536); + case SASTAIN: + if (current > fSR) + { + this->current = current -= fSR; + int n = log_table.get(current / 65536); + if (n > 1) + { + return n; + } + } + state = FINISHED; + return 0; + case ATTACK_RELEASE: + if (current < fTL) + { + return this->current = current + fAR; + } + this->current = static_cast(65536 * LOGTABLE_FACTOR * std::log10(static_cast(fTL))); + state = DECAY_RELEASE; + return fTL; + case DECAY_RELEASE: + if (current > fDSS) + { + this->current = current -= fDRR; + return log_table.get(current / 65536); + } + this->current = current = fSL; + state = RELEASE; + return log_table.get(current / 65536); + case RELEASE: + if (current > fRR) + { + this->current = current -= fRR; + int n = log_table.get(current / 65536); + if (n > SOUNDOFF_LEVEL) + { + return n; + } + state = SOUNDOFF; + return n; + } + state = FINISHED; + return 0; + case SOUNDOFF: + if (current > fOR) + { + this->current = current -= fOR; + int n = log_table.get(current / 65536); + if (n > 1) + { + return n; + } + } + state = FINISHED; + return 0; + default: + return 0; + } +} + +namespace +{ +// �L�[�X�P�[�����O�e�[�u�� +const int keyscale_table[4][128] = { + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 4, 4, + 4, 4, 4, 4, 4, 5, 5, 6, 6, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 10, 10, 11, 12, 12, 12, 12, + 12, 12, 12, 13, 13, 14, 14, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 18, 18, 19, 20, 20, 20, 20, 20, 20, + 20, 21, 21, 22, 22, 23, 24, 24, 24, 24, 24, 24, 24, 25, 25, 26, 26, 27, 28, 28, 28, 28, 28, 28, 28, 29, + 29, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31}}; +// �f�B�`���[���e�[�u�� +const float detune_table[4][128] = { + {0}, + {0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, + 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, + 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, + 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, + 0.106, 0.106, 0.106, 0.159, 0.159, 0.159, 0.159, 0.159, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, + 0.212, 0.212, 0.212, 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.317, 0.317, 0.317, 0.317, 0.370, + 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, + 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.423}, + {0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.053, 0.053, + 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.053, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, + 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, + 0.159, 0.159, 0.159, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.264, + 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.317, 0.317, 0.317, 0.317, 0.370, 0.423, 0.423, 0.423, + 0.423, 0.423, 0.423, 0.423, 0.423, 0.423, 0.476, 0.476, 0.529, 0.582, 0.582, 0.582, 0.582, 0.582, 0.582, + 0.582, 0.635, 0.635, 0.688, 0.688, 0.741, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, + 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846}, + {0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.106, 0.106, 0.106, + 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.106, 0.159, + 0.159, 0.159, 0.159, 0.159, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.212, 0.264, + 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.264, 0.317, 0.317, 0.317, 0.317, 0.370, 0.423, 0.423, 0.423, 0.423, + 0.423, 0.423, 0.423, 0.423, 0.423, 0.476, 0.476, 0.529, 0.582, 0.582, 0.582, 0.582, 0.582, 0.582, 0.582, 0.635, + 0.635, 0.688, 0.688, 0.741, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.899, 0.899, 1.005, 1.005, 1.058, + 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, + 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164, 1.164}}; +// LFO�e�[�u�� +const uint_least32_t ams_table[4] = {0, static_cast(128 - 128 * std::pow(10, -1.44 / 10)), + static_cast(128 - 128 * std::pow(10, -5.9 / 10)), + static_cast(128 - 128 * std::pow(10, -11.8 / 10))}; +} // namespace + +// FM�I�y���[�^�̃R���X�g���N�^�B +fm_operator::fm_operator(int AR, int DR, int SR, int RR, int SL, int TL, int KS, int ML_, int DT_, int AMS_, int key) + : eg(AR * 2 + keyscale_table[KS][key], DR * 2 + keyscale_table[KS][key], SR * 2 + keyscale_table[KS][key], + RR * 4 + keyscale_table[KS][key] + 2, SL, TL) +{ + assert(AR >= 0 && AR <= 31); + assert(DR >= 0 && DR <= 31); + assert(SR >= 0 && SR <= 31); + assert(RR >= 0 && RR <= 15); + assert(SL >= 0); + assert(TL >= 0); + assert(KS >= 0 && KS <= 3); + assert(ML_ >= 0 && ML_ <= 15); + assert(DT_ >= 0 && DT_ <= 7); + assert(AMS_ >= 0 && AMS_ <= 3); + assert(key >= 0 && key <= 127); + + if (DT_ >= 4) + { + DT = -detune_table[DT_ - 4][key]; + } + else + { + DT = detune_table[DT_][key]; + } + if (ML_ == 0) + { + ML = 0.5; + } + else + { + ML = ML_; + } + + ams_factor = ams_table[AMS_] / 2; + ams_bias = 32768 - ams_factor * 256; +} +// �Đ����g���ݒ�B +void fm_operator::set_freq_rate(float freq, float rate) +{ + freq += DT; + freq *= ML; + swg.set_cycle(rate / freq); + eg.set_rate(rate); +} +// ���̃T���v���𓾂�B +inline int fm_operator::get_next() +{ + return static_cast(swg.get_next()) * eg.get_next() >> 15; +} +inline int fm_operator::get_next(int modulate) +{ + return static_cast(swg.get_next(modulate)) * eg.get_next() >> 15; +} +inline int fm_operator::get_next(int ams, int modulate) +{ + return (static_cast(swg.get_next(modulate)) * eg.get_next() >> 15) * (ams * ams_factor + ams_bias) >> + 15; +} + +// �r�u���[�g�e�[�u���B +namespace +{ +class vibrato_table +{ + public: + enum + { + DIVISION = 16384 + }; + vibrato_table(); + int_least32_t get(int x) const + { + return data[x + DIVISION / 2]; + } + + private: + int_least32_t data[DIVISION]; +} vibrato_table; + +vibrato_table::vibrato_table() +{ + for (int i = 0; i < DIVISION; ++i) + { + double x = (static_cast(i) / DIVISION - 0.5) * 256.0 / 12.0; + data[i] = static_cast((std::pow(2, x) - 1) * 65536.0); + } +} +} // namespace + +// FM�����R���X�g���N�^�B +fm_sound_generator::fm_sound_generator(const FMPARAMETER ¶ms, int note, float frequency_multiplier) + : op1(params.op1.AR, params.op1.DR, params.op1.SR, params.op1.RR, params.op1.SL, params.op1.TL, params.op1.KS, + params.op1.ML, params.op1.DT, params.op1.AMS, note), + op2(params.op2.AR, params.op2.DR, params.op2.SR, params.op2.RR, params.op2.SL, params.op2.TL, params.op2.KS, + params.op2.ML, params.op2.DT, params.op2.AMS, note), + op3(params.op3.AR, params.op3.DR, params.op3.SR, params.op3.RR, params.op3.SL, params.op3.TL, params.op3.KS, + params.op3.ML, params.op3.DT, params.op3.AMS, note), + op4(params.op4.AR, params.op4.DR, params.op4.SR, params.op4.RR, params.op4.SL, params.op4.TL, params.op4.KS, + params.op4.ML, params.op4.DT, params.op4.AMS, note), + ALG(params.ALG), freq(440 * std::pow(2.0, (note - 69) / 12.0)), freq_mul(frequency_multiplier), tremolo_depth(0), + tremolo_freq(1), vibrato_depth(0), vibrato_freq(1), rate(0), feedback(0), damper(0), sostenute(0) +{ + assert(ALG >= 0 && ALG <= 7); + assert(params.LFO >= 0 && params.LFO <= 7); + assert(params.FB >= 0 && params.FB <= 7); + + static const int feedbacks[8] = {31, 6, 5, 4, 3, 2, 1, 0}; + FB = feedbacks[params.FB]; + + static const float ams_table[8] = {3.98, 5.56, 6.02, 6.37, 6.88, 9.63, 48.1, 72.2}; + ams_freq = ams_table[params.LFO]; + ams_enable = (params.op1.AMS + params.op2.AMS + params.op3.AMS + params.op4.AMS != 0); +} +// �Đ����[�g�ݒ�B +void fm_sound_generator::set_rate(float rate) +{ + if (this->rate != rate) + { + this->rate = rate; + ams_lfo.set_cycle(rate / ams_freq); + vibrato_lfo.set_cycle(rate / vibrato_freq); + tremolo_lfo.set_cycle(rate / tremolo_freq); + float f = freq * freq_mul; + op1.set_freq_rate(f, rate); + op2.set_freq_rate(f, rate); + op3.set_freq_rate(f, rate); + op4.set_freq_rate(f, rate); + } +} +// ���g���{���ݒ�B +void fm_sound_generator::set_frequency_multiplier(float value) +{ + freq_mul = value; + float f = freq * freq_mul; + op1.set_freq_rate(f, rate); + op2.set_freq_rate(f, rate); + op3.set_freq_rate(f, rate); + op4.set_freq_rate(f, rate); +} +// �_���p�[���ʐݒ�B +void fm_sound_generator::set_damper(int damper) +{ + this->damper = damper; + float value = 1.0 - (1.0 - damper / 127.0) * (1.0 - sostenute / 127.0); + op1.set_hold(value); + op2.set_hold(value); + op3.set_hold(value); + op4.set_hold(value); +} +// �\�X�e�k�[�g���ʐݒ�B +void fm_sound_generator::set_sostenute(int sostenute) +{ + this->sostenute = sostenute; + float value = 1.0 - (1.0 - damper / 127.0) * (1.0 - sostenute / 127.0); + op1.set_hold(value); + op2.set_hold(value); + op3.set_hold(value); + op4.set_hold(value); +} +// �t���[�Y���ʐݒ�B +void fm_sound_generator::set_freeze(int freeze) +{ + float value = freeze / 127.0; + op1.set_freeze(value); + op2.set_freeze(value); + op3.set_freeze(value); + op4.set_freeze(value); +} +// �g���������ʐݒ�B +void fm_sound_generator::set_tremolo(int depth, float frequency) +{ + tremolo_depth = depth; + tremolo_freq = frequency; + tremolo_lfo.set_cycle(rate / frequency); +} +// �r�u���[�g���ʐݒ�B +void fm_sound_generator::set_vibrato(float depth, float frequency) +{ + vibrato_depth = static_cast(depth * (vibrato_table::DIVISION / 256.0)); + vibrato_freq = frequency; + vibrato_lfo.set_cycle(rate / frequency); +} +// �L�[�I�t�B +void fm_sound_generator::key_off() +{ + op1.key_off(); + op2.key_off(); + op3.key_off(); + op4.key_off(); +} +// �T�E���h�I�t�B +void fm_sound_generator::sound_off() +{ + op1.sound_off(); + op2.sound_off(); + op3.sound_off(); + op4.sound_off(); +} +// ���̔������I���������ǂ�����Ԃ��B +bool fm_sound_generator::is_finished() const +{ + switch (ALG) + { + case 0: + case 1: + case 2: + case 3: + return op4.is_finished(); + case 4: + return op2.is_finished() && op4.is_finished(); + case 5: + case 6: + return op2.is_finished() && op3.is_finished() && op4.is_finished(); + case 7: + return op1.is_finished() && op2.is_finished() && op3.is_finished() && op4.is_finished(); + default: + assert(!"fm_sound_generator: invalid algorithm number"); + return true; + } +} +// ���̃T���v���𓾂�B +int fm_sound_generator::get_next() +{ + if (vibrato_depth) + { + int x = static_cast(vibrato_lfo.get_next()) * vibrato_depth >> 15; + int_least32_t modulation = vibrato_table.get(x); + op1.add_modulation(modulation); + op2.add_modulation(modulation); + op3.add_modulation(modulation); + op4.add_modulation(modulation); + } + int feedback = (this->feedback << 1) >> FB; + int ret; + if (ams_enable) + { + int ams = ams_lfo.get_next() >> 7; + switch (ALG) + { + case 0: + ret = op4(ams, op3(ams, op2(ams, this->feedback = op1(ams, feedback)))); + break; + case 1: + ret = op4(ams, op3(ams, op2(ams, 0) + (this->feedback = op1(ams, feedback)))); + break; + case 2: + ret = op4(ams, op3(ams, op2(ams, 0)) + (this->feedback = op1(ams, feedback))); + break; + case 3: + ret = op4(ams, op3(ams, 0) + op2(ams, this->feedback = op1(ams, feedback))); + break; + case 4: + ret = op4(ams, op3(ams, 0)) + op2(ams, this->feedback = op1(ams, feedback)); + break; + case 5: + this->feedback = feedback = op1(ams, feedback); + ret = op4(ams, feedback) + op3(ams, feedback) + op2(ams, feedback); + break; + case 6: + ret = op4(ams, 0) + op3(ams, 0) + op2(ams, this->feedback = op1(ams, feedback)); + break; + case 7: + ret = op4(ams, 0) + op3(ams, 0) + op2(ams, 0) + (this->feedback = op1(ams, feedback)); + break; + default: + assert(!"fm_sound_generator: invalid algorithm number"); + return 0; + } + } + else + { + switch (ALG) + { + case 0: + ret = op4(op3(op2(this->feedback = op1(feedback)))); + break; + case 1: + ret = op4(op3(op2() + (this->feedback = op1(feedback)))); + break; + case 2: + ret = op4(op3(op2()) + (this->feedback = op1(feedback))); + break; + case 3: + ret = op4(op3() + op2(this->feedback = op1(feedback))); + break; + case 4: + ret = op4(op3()) + op2(this->feedback = op1(feedback)); + break; + case 5: + this->feedback = feedback = op1(feedback); + ret = op4(feedback) + op3(feedback) + op2(feedback); + break; + case 6: + ret = op4() + op3() + op2(this->feedback = op1(feedback)); + break; + case 7: + ret = op4() + op3() + op2() + (this->feedback = op1(feedback)); + break; + default: + assert(!"fm_sound_generator: invalid algorithm number"); + return 0; + } + } + if (tremolo_depth) + { + int_least32_t x = 4096 - (((static_cast(tremolo_lfo.get_next()) + 32768) * tremolo_depth) >> 11); + ret = ret * x >> 12; + } + return ret; +} + +// FM�m�[�g�̃R���X�g���N�^�B +fm_note::fm_note(const FMPARAMETER ¶ms, int note, int velocity_, int panpot, int assign, float frequency_multiplier) + : midisynth::note(assign, panpot), fm(params, note, frequency_multiplier), velocity(velocity_) +{ + assert(velocity >= 1 && velocity <= 127); + ++velocity; +} +// �g�`�o�́B +bool fm_note::synthesize(int_least32_t *buf, std::size_t samples, float rate, int_least32_t left, int_least32_t right) +{ + left = (left * velocity) >> 7; + right = (right * velocity) >> 7; + fm.set_rate(rate); + for (std::size_t i = 0; i < samples; ++i) + { + int_least32_t sample = fm.get_next(); + buf[i * 2 + 0] += (sample * left) >> 14; + buf[i * 2 + 1] += (sample * right) >> 14; + } + return !fm.is_finished(); +} +// �m�[�g�I�t�B +void fm_note::note_off(int) +{ + fm.key_off(); +} +// �T�E���h�I�t�B +void fm_note::sound_off() +{ + fm.sound_off(); +} +// ���g���{���ݒ�B +void fm_note::set_frequency_multiplier(float value) +{ + fm.set_frequency_multiplier(value); +} +// �g���������ʐݒ�B +void fm_note::set_tremolo(int depth, float freq) +{ + fm.set_tremolo(depth, freq); +} +// �r�u���[�g���ʐݒ�B +void fm_note::set_vibrato(float depth, float freq) +{ + fm.set_vibrato(depth, freq); +} +// �_���p�[���ʐݒ�B +void fm_note::set_damper(int value) +{ + fm.set_damper(value); +} +// �\�X�e�k�[�g���ʐݒ�B +void fm_note::set_sostenute(int value) +{ + fm.set_sostenute(value); +} +// �t���[�Y���ʐݒ�B +void fm_note::set_freeze(int value) +{ + fm.set_freeze(value); +} + +// FM�m�[�g�t�@�N�g���������B +fm_note_factory::fm_note_factory() +{ + clear(); + midisynth::DRUMPARAMETER p; + p.ALG = 4, p.FB = 3, p.LFO = 0, p.op1.AR = 26, p.op1.DR = 10, p.op1.SR = 1, p.op1.RR = 0, p.op1.SL = 0, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 3, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 10, p.op2.SR = 2, + p.op2.RR = 7, p.op2.SL = 2, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 3, p.op2.AMS = 0, p.op3.AR = 26, + p.op3.DR = 10, p.op3.SR = 2, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 7, + p.op3.AMS = 0, p.op4.AR = 18, p.op4.DR = 6, p.op4.SR = 1, p.op4.RR = 6, p.op4.SL = 4, p.op4.TL = 2, p.op4.KS = 1, + p.op4.ML = 1, p.op4.DT = 7, p.op4.AMS = 0; + set_program(0, p); + p.ALG = 4, p.FB = 5, p.LFO = 0, p.op1.AR = 26, p.op1.DR = 10, p.op1.SR = 1, p.op1.RR = 0, p.op1.SL = 0, + p.op1.TL = 5, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 3, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 10, p.op2.SR = 3, + p.op2.RR = 7, p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 3, p.op2.AMS = 0, p.op3.AR = 26, + p.op3.DR = 10, p.op3.SR = 2, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 20, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 7, + p.op3.AMS = 0, p.op4.AR = 18, p.op4.DR = 6, p.op4.SR = 2, p.op4.RR = 6, p.op4.SL = 4, p.op4.TL = 2, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 7, p.op4.AMS = 0; + set_program(1, p); + p.ALG = 4, p.FB = 5, p.LFO = 0, p.op1.AR = 26, p.op1.DR = 10, p.op1.SR = 1, p.op1.RR = 0, p.op1.SL = 0, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 3, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 10, p.op2.SR = 2, + p.op2.RR = 7, p.op2.SL = 2, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 3, p.op2.AMS = 0, p.op3.AR = 26, + p.op3.DR = 10, p.op3.SR = 2, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 7, + p.op3.AMS = 0, p.op4.AR = 18, p.op4.DR = 6, p.op4.SR = 1, p.op4.RR = 6, p.op4.SL = 4, p.op4.TL = 2, p.op4.KS = 1, + p.op4.ML = 1, p.op4.DT = 7, p.op4.AMS = 0; + set_program(2, p); + p.ALG = 5, p.FB = 7, p.LFO = 0, p.op1.AR = 26, p.op1.DR = 10, p.op1.SR = 1, p.op1.RR = 0, p.op1.SL = 0, + p.op1.TL = 10, p.op1.KS = 3, p.op1.ML = 6, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 10, p.op2.SR = 4, + p.op2.RR = 7, p.op2.SL = 1, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 7, p.op2.AMS = 0, p.op3.AR = 15, + p.op3.DR = 20, p.op3.SR = 5, p.op3.RR = 8, p.op3.SL = 1, p.op3.TL = 2, p.op3.KS = 1, p.op3.ML = 2, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 8, p.op4.DR = 15, p.op4.SR = 3, p.op4.RR = 11, p.op4.SL = 2, p.op4.TL = 3, p.op4.KS = 3, + p.op4.ML = 3, p.op4.DT = 3, p.op4.AMS = 0; + set_program(3, p); + p.ALG = 4, p.FB = 3, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 10, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 16, p.op2.SR = 0, + p.op2.RR = 12, p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 10, p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 20, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 22, p.op4.DR = 9, p.op4.SR = 0, p.op4.RR = 10, p.op4.SL = 4, p.op4.TL = 2, p.op4.KS = 0, + p.op4.ML = 2, p.op4.DT = 0, p.op4.AMS = 0; + set_program(4, p); + p.ALG = 6, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 12, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 3, p.op1.AMS = 0, p.op2.AR = 29, p.op2.DR = 12, p.op2.SR = 1, + p.op2.RR = 7, p.op2.SL = 1, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 26, + p.op3.DR = 12, p.op3.SR = 2, p.op3.RR = 6, p.op3.SL = 2, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 3, + p.op3.AMS = 0, p.op4.AR = 26, p.op4.DR = 12, p.op4.SR = 2, p.op4.RR = 6, p.op4.SL = 2, p.op4.TL = 5, p.op4.KS = 0, + p.op4.ML = 0, p.op4.DT = 7, p.op4.AMS = 0; + set_program(5, p); + p.ALG = 2, p.FB = 4, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 16, p.op1.SR = 1, p.op1.RR = 0, p.op1.SL = 0, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 7, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 16, p.op2.SR = 2, + p.op2.RR = 8, p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 3, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 14, p.op3.SR = 2, p.op3.RR = 8, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 3, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 12, p.op4.SR = 1, p.op4.RR = 7, p.op4.SL = 2, p.op4.TL = 0, p.op4.KS = 1, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(6, p); + p.ALG = 2, p.FB = 4, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 16, p.op1.SR = 1, p.op1.RR = 0, p.op1.SL = 0, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 7, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 16, p.op2.SR = 2, + p.op2.RR = 7, p.op2.SL = 1, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 3, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 14, p.op3.SR = 2, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 4, p.op3.DT = 3, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 14, p.op4.SR = 1, p.op4.RR = 7, p.op4.SL = 2, p.op4.TL = 0, p.op4.KS = 1, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(7, p); + p.ALG = 7, p.FB = 6, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 18, p.op1.SR = 9, p.op1.RR = 6, p.op1.SL = 1, + p.op1.TL = 1, p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 14, p.op2.SR = 8, + p.op2.RR = 5, p.op2.SL = 3, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 3, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 14, p.op3.SR = 9, p.op3.RR = 6, p.op3.SL = 1, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 14, p.op4.SR = 10, p.op4.RR = 6, p.op4.SL = 2, p.op4.TL = 2, p.op4.KS = 0, + p.op4.ML = 0, p.op4.DT = 7, p.op4.AMS = 0; + set_program(8, p); + p.ALG = 7, p.FB = 6, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 26, p.op1.SR = 21, p.op1.RR = 10, p.op1.SL = 2, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 7, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 0, p.op2.SR = 11, + p.op2.RR = 5, p.op2.SL = 0, p.op2.TL = 7, p.op2.KS = 0, p.op2.ML = 4, p.op2.DT = 1, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 0, p.op3.SR = 11, p.op3.RR = 5, p.op3.SL = 0, p.op3.TL = 3, p.op3.KS = 0, p.op3.ML = 4, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 28, p.op4.SR = 15, p.op4.RR = 7, p.op4.SL = 3, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 2, p.op4.DT = 0, p.op4.AMS = 0; + set_program(9, p); + p.ALG = 6, p.FB = 2, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 2, + p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 13, p.op2.RR = 6, + p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 25, p.op3.RR = 12, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 13, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 3, p.op4.ML = 4, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(10, p); + p.ALG = 6, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 16, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 2, + p.op1.TL = 1, p.op1.KS = 0, p.op1.ML = 7, p.op1.DT = 7, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 10, + p.op2.RR = 7, p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 3, p.op2.AMS = 0, p.op3.AR = 24, + p.op3.DR = 10, p.op3.SR = 9, p.op3.RR = 7, p.op3.SL = 1, p.op3.TL = 2, p.op3.KS = 1, p.op3.ML = 1, p.op3.DT = 7, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 24, p.op4.SR = 13, p.op4.RR = 9, p.op4.SL = 4, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(11, p); + p.ALG = 7, p.FB = 1, p.LFO = 0, p.op1.AR = 27, p.op1.DR = 20, p.op1.SR = 25, p.op1.RR = 12, p.op1.SL = 1, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 16, p.op2.DR = 0, p.op2.SR = 13, + p.op2.RR = 6, p.op2.SL = 0, p.op2.TL = 12, p.op2.KS = 0, p.op2.ML = 4, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 16, + p.op3.DR = 0, p.op3.SR = 15, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 27, p.op4.DR = 0, p.op4.SR = 19, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 0, + p.op4.ML = 4, p.op4.DT = 0, p.op4.AMS = 0; + set_program(12, p); + p.ALG = 7, p.FB = 0, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 11, p.op1.RR = 5, p.op1.SL = 0, + p.op1.TL = 0, p.op1.KS = 2, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 15, + p.op2.RR = 7, p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 1, p.op2.ML = 3, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 0, p.op3.SR = 19, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 8, p.op3.KS = 0, p.op3.ML = 6, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, + p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(13, p); + p.ALG = 6, p.FB = 3, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 2, + p.op1.KS = 0, p.op1.ML = 5, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 16, p.op2.SR = 11, p.op2.RR = 5, + p.op2.SL = 2, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 3, p.op2.AMS = 0, p.op3.AR = 24, p.op3.DR = 0, + p.op3.SR = 13, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 7, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 19, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 1, p.op4.KS = 0, p.op4.ML = 3, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(14, p); + p.ALG = 4, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 7, + p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 24, p.op2.SR = 9, p.op2.RR = 6, + p.op2.SL = 1, p.op2.TL = 1, p.op2.KS = 1, p.op2.ML = 1, p.op2.DT = 7, p.op2.AMS = 0, p.op3.AR = 28, p.op3.DR = 0, + p.op3.SR = 9, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 7, p.op3.DT = 3, p.op3.AMS = 0, + p.op4.AR = 28, p.op4.DR = 24, p.op4.SR = 9, p.op4.RR = 6, p.op4.SL = 2, p.op4.TL = 3, p.op4.KS = 1, p.op4.ML = 1, + p.op4.DT = 3, p.op4.AMS = 0; + set_program(15, p); + p.ALG = 7, p.FB = 5, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 12, p.op1.SL = 0, + p.op1.TL = 4, p.op1.KS = 0, p.op1.ML = 0, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 12, p.op2.SL = 0, p.op2.TL = 6, p.op2.KS = 0, p.op2.ML = 4, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 0, p.op3.SR = 0, p.op3.RR = 12, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 12, p.op4.SL = 0, p.op4.TL = 3, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(16, p); + p.ALG = 7, p.FB = 3, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 22, p.op1.SR = 0, p.op1.RR = 12, p.op1.SL = 10, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 20, p.op2.SR = 0, + p.op2.RR = 12, p.op2.SL = 2, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 18, p.op3.SR = 0, p.op3.RR = 12, p.op3.SL = 1, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 18, p.op4.SR = 0, p.op4.RR = 12, p.op4.SL = 1, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 0, p.op4.DT = 0, p.op4.AMS = 0; + set_program(17, p); + p.ALG = 7, p.FB = 5, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 12, p.op1.SL = 0, + p.op1.TL = 4, p.op1.KS = 0, p.op1.ML = 0, p.op1.DT = 0, p.op1.AMS = 3, p.op2.AR = 28, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 12, p.op2.SL = 0, p.op2.TL = 6, p.op2.KS = 0, p.op2.ML = 4, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 0, p.op3.SR = 0, p.op3.RR = 12, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 12, p.op4.SL = 0, p.op4.TL = 3, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 2; + set_program(18, p); + p.ALG = 6, p.FB = 5, p.LFO = 0, p.op1.AR = 18, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 9, p.op1.SL = 0, p.op1.TL = 2, + p.op1.KS = 0, p.op1.ML = 6, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 10, p.op3.SL = 0, p.op3.TL = 3, p.op3.KS = 0, p.op3.ML = 4, p.op3.DT = 3, p.op3.AMS = 0, + p.op4.AR = 28, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 12, p.op4.SL = 0, p.op4.TL = 5, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 7, p.op4.AMS = 0; + set_program(19, p); + p.ALG = 6, p.FB = 2, p.LFO = 0, p.op1.AR = 14, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 10, p.op1.SL = 0, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 6, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 12, p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 1, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 14, + p.op3.DR = 0, p.op3.SR = 0, p.op3.RR = 8, p.op3.SL = 0, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 17, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 0, p.op4.TL = 8, p.op4.KS = 1, + p.op4.ML = 0, p.op4.DT = 0, p.op4.AMS = 0; + set_program(20, p); + p.ALG = 3, p.FB = 3, p.LFO = 0, p.op1.AR = 16, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 12, p.op2.DR = 3, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 4, p.op2.TL = 6, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 14, p.op3.DR = 7, + p.op3.SR = 0, p.op3.RR = 8, p.op3.SL = 4, p.op3.TL = 3, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 22, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(21, p); + p.ALG = 4, p.FB = 5, p.LFO = 0, p.op1.AR = 16, p.op1.DR = 0, p.op1.SR = 1, p.op1.RR = 11, p.op1.SL = 0, + p.op1.TL = 3, p.op1.KS = 0, p.op1.ML = 5, p.op1.DT = 3, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 0, p.op2.SR = 3, + p.op2.RR = 9, p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 3, p.op2.AMS = 0, p.op3.AR = 18, + p.op3.DR = 0, p.op3.SR = 1, p.op3.RR = 11, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 4, p.op3.DT = 7, + p.op3.AMS = 0, p.op4.AR = 24, p.op4.DR = 0, p.op4.SR = 2, p.op4.RR = 10, p.op4.SL = 0, p.op4.TL = 2, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 7, p.op4.AMS = 0; + set_program(22, p); + p.ALG = 3, p.FB = 3, p.LFO = 0, p.op1.AR = 20, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 2, + p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 16, p.op2.DR = 3, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 4, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 7, + p.op3.SR = 0, p.op3.RR = 8, p.op3.SL = 4, p.op3.TL = 3, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 24, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(23, p); + p.ALG = 0, p.FB = 0, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 31, p.op1.SR = 31, p.op1.RR = 15, p.op1.SL = 0, + p.op1.TL = 127, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 0, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 0, p.op3.SR = 4, p.op3.RR = 10, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 29, p.op4.DR = 14, p.op4.SR = 8, p.op4.RR = 9, p.op4.SL = 2, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(24, p); + p.ALG = 1, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 4, p.op3.RR = 10, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 20, p.op4.SR = 8, p.op4.RR = 9, p.op4.SL = 2, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(25, p); + p.ALG = 1, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 31, p.op1.SR = 31, p.op1.RR = 15, p.op1.SL = 0, + p.op1.TL = 127, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 0, p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 3, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 0, p.op3.SR = 4, p.op3.RR = 10, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 12, p.op4.SR = 8, p.op4.RR = 9, p.op4.SL = 1, p.op4.TL = 3, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(26, p); + p.ALG = 0, p.FB = 0, p.LFO = 0, p.op1.AR = 20, p.op1.DR = 0, p.op1.SR = 2, p.op1.RR = 9, p.op1.SL = 0, + p.op1.TL = 10, p.op1.KS = 0, p.op1.ML = 12, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 0, p.op2.SR = 2, + p.op2.RR = 10, p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 4, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 0, p.op3.SR = 4, p.op3.RR = 10, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 14, p.op4.SR = 8, p.op4.RR = 9, p.op4.SL = 2, p.op4.TL = 4, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(27, p); + p.ALG = 0, p.FB = 0, p.LFO = 0, p.op1.AR = 20, p.op1.DR = 0, p.op1.SR = 2, p.op1.RR = 15, p.op1.SL = 0, + p.op1.TL = 10, p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 0, p.op2.SR = 2, + p.op2.RR = 15, p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 0, p.op3.SR = 6, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 8, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 16, p.op4.SR = 10, p.op4.RR = 15, p.op4.SL = 2, p.op4.TL = 5, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(28, p); + p.ALG = 1, p.FB = 0, p.LFO = 0, p.op1.AR = 16, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 12, p.op1.SL = 0, + p.op1.TL = 4, p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 18, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 12, p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 3, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 20, + p.op3.DR = 0, p.op3.SR = 0, p.op3.RR = 12, p.op3.SL = 0, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 29, p.op4.DR = 4, p.op4.SR = 2, p.op4.RR = 12, p.op4.SL = 1, p.op4.TL = 2, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(29, p); + p.ALG = 5, p.FB = 0, p.LFO = 0, p.op1.AR = 20, p.op1.DR = 0, p.op1.SR = 1, p.op1.RR = 9, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 5, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 14, p.op2.SR = 1, p.op2.RR = 9, + p.op2.SL = 1, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 5, p.op2.DT = 7, p.op2.AMS = 0, p.op3.AR = 28, p.op3.DR = 14, + p.op3.SR = 1, p.op3.RR = 9, p.op3.SL = 1, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 28, p.op4.DR = 14, p.op4.SR = 1, p.op4.RR = 9, p.op4.SL = 1, p.op4.TL = 4, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 3, p.op4.AMS = 0; + set_program(30, p); + p.ALG = 4, p.FB = 3, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 9, p.op1.SL = 0, p.op1.TL = 2, + p.op1.KS = 0, p.op1.ML = 8, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 12, p.op2.SR = 2, p.op2.RR = 9, + p.op2.SL = 2, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 18, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 5, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 10, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 18, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 3, p.op4.TL = 2, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(31, p); + p.ALG = 4, p.FB = 5, p.LFO = 0, p.op1.AR = 24, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 2, p.op1.ML = 0, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 24, p.op2.DR = 18, p.op2.SR = 4, p.op2.RR = 8, + p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 2, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 18, + p.op3.SR = 3, p.op3.RR = 7, p.op3.SL = 1, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 22, p.op4.DR = 18, p.op4.SR = 3, p.op4.RR = 7, p.op4.SL = 1, p.op4.TL = 2, p.op4.KS = 0, p.op4.ML = 2, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(32, p); + p.ALG = 2, p.FB = 3, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 10, p.op1.SR = 0, p.op1.RR = 15, p.op1.SL = 1, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 22, p.op2.SR = 0, + p.op2.RR = 6, p.op2.SL = 1, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 8, p.op3.SR = 8, p.op3.RR = 8, p.op3.SL = 1, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 22, p.op4.DR = 14, p.op4.SR = 0, p.op4.RR = 7, p.op4.SL = 1, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(33, p); + p.ALG = 2, p.FB = 3, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 10, p.op1.SR = 5, p.op1.RR = 15, p.op1.SL = 1, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 22, p.op2.SR = 10, + p.op2.RR = 6, p.op2.SL = 1, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 8, p.op3.SR = 8, p.op3.RR = 8, p.op3.SL = 1, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 14, p.op4.SR = 6, p.op4.RR = 7, p.op4.SL = 1, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(34, p); + p.ALG = 4, p.FB = 0, p.LFO = 0, p.op1.AR = 24, p.op1.DR = 8, p.op1.SR = 3, p.op1.RR = 13, p.op1.SL = 0, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 9, p.op2.SR = 1, + p.op2.RR = 13, p.op2.SL = 2, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 31, p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, + p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(35, p); + p.ALG = 2, p.FB = 0, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 10, p.op1.SR = 5, p.op1.RR = 15, p.op1.SL = 1, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 18, p.op2.SR = 8, + p.op2.RR = 6, p.op2.SL = 1, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 6, p.op3.SR = 6, p.op3.RR = 10, p.op3.SL = 1, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 4, p.op4.SR = 6, p.op4.RR = 10, p.op4.SL = 1, p.op4.TL = 2, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(36, p); + p.ALG = 2, p.FB = 0, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 10, p.op1.SR = 2, p.op1.RR = 15, p.op1.SL = 1, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 18, p.op2.SR = 0, + p.op2.RR = 6, p.op2.SL = 1, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 6, p.op3.SR = 2, p.op3.RR = 10, p.op3.SL = 1, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 4, p.op4.SR = 4, p.op4.RR = 10, p.op4.SL = 1, p.op4.TL = 2, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(37, p); + p.ALG = 2, p.FB = 4, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 16, p.op1.SR = 12, p.op1.RR = 15, p.op1.SL = 1, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 7, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 12, p.op2.SR = 6, + p.op2.RR = 6, p.op2.SL = 2, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 13, p.op3.SR = 11, p.op3.RR = 8, p.op3.SL = 1, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 3, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 10, p.op4.SR = 6, p.op4.RR = 12, p.op4.SL = 3, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(38, p); + p.ALG = 3, p.FB = 1, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 7, p.op1.SR = 3, p.op1.RR = 15, p.op1.SL = 1, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 10, p.op2.SR = 2, + p.op2.RR = 6, p.op2.SL = 1, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 10, p.op3.SR = 1, p.op3.RR = 8, p.op3.SL = 1, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 12, p.op4.SL = 1, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(39, p); + p.ALG = 5, p.FB = 7, p.LFO = 0, p.op1.AR = 20, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 6, p.op1.SL = 0, + p.op1.TL = 11, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 16, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 6, p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 16, + p.op3.DR = 0, p.op3.SR = 0, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 4, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 16, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 10, p.op4.KS = 0, + p.op4.ML = 8, p.op4.DT = 0, p.op4.AMS = 0; + set_program(40, p); + p.ALG = 3, p.FB = 7, p.LFO = 0, p.op1.AR = 20, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 8, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 16, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 6, + p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 16, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 8, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 16, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(41, p); + p.ALG = 2, p.FB = 4, p.LFO = 0, p.op1.AR = 20, p.op1.DR = 1, p.op1.SR = 1, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 2, p.op2.SR = 2, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 20, p.op3.DR = 2, + p.op3.SR = 2, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 1, p.op4.SR = 1, p.op4.RR = 1, p.op4.SL = 7, p.op4.TL = 0, p.op4.KS = 3, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(42, p); + p.ALG = 2, p.FB = 5, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 1, p.op1.SR = 1, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 1, p.op2.SR = 1, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 1, + p.op3.SR = 1, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 3, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 1, p.op4.SR = 1, p.op4.RR = 7, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 1, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(43, p); + p.ALG = 3, p.FB = 4, p.LFO = 1, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 5, + p.op1.KS = 0, p.op1.ML = 5, p.op1.DT = 0, p.op1.AMS = 1, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 20, p.op3.DR = 10, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 5, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 14, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 1, p.op4.TL = 2, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(44, p); + p.ALG = 5, p.FB = 4, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 0, p.op1.SR = 13, p.op1.RR = 6, p.op1.SL = 0, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 0, p.op2.SR = 13, + p.op2.RR = 6, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 0, p.op3.SR = 19, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 4, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 17, p.op4.RR = 8, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 2, p.op4.DT = 0, p.op4.AMS = 0; + set_program(45, p); + p.ALG = 6, p.FB = 2, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 0, p.op1.SR = 9, p.op1.RR = 6, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 1, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 16, p.op2.SR = 9, p.op2.RR = 6, + p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 1, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, p.op3.DR = 16, + p.op3.SR = 9, p.op3.RR = 6, p.op3.SL = 1, p.op3.TL = 0, p.op3.KS = 1, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(46, p); + p.ALG = 0, p.FB = 6, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 13, p.op1.RR = 6, p.op1.SL = 0, + p.op1.TL = 0, p.op1.KS = 2, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 13, + p.op2.RR = 6, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 2, p.op2.ML = 4, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 0, p.op3.SR = 13, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 2, p.op3.ML = 2, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 13, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 2, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(47, p); + p.ALG = 3, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 5, + p.op1.KS = 0, p.op1.ML = 5, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 24, p.op3.DR = 10, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 5, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 14, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 1, p.op4.TL = 2, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(48, p); + p.ALG = 3, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 5, + p.op1.KS = 0, p.op1.ML = 5, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 24, p.op3.DR = 10, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 5, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 12, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(49, p); + p.ALG = 3, p.FB = 4, p.LFO = 0, p.op1.AR = 14, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 5, p.op1.DT = 3, p.op1.AMS = 0, p.op2.AR = 14, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 14, p.op3.DR = 10, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 5, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 14, p.op4.DR = 14, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 1, p.op4.TL = 2, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(50, p); + p.ALG = 3, p.FB = 4, p.LFO = 0, p.op1.AR = 14, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 5, p.op1.DT = 3, p.op1.AMS = 0, p.op2.AR = 14, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 14, p.op3.DR = 10, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 5, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 12, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 2, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(51, p); + p.ALG = 7, p.FB = 5, p.LFO = 0, p.op1.AR = 16, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 8, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 7, p.op1.AMS = 0, p.op2.AR = 16, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 7, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 3, p.op3.AMS = 0, + p.op4.AR = 18, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 3, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 3, p.op4.AMS = 0; + set_program(52, p); + p.ALG = 7, p.FB = 4, p.LFO = 0, p.op1.AR = 24, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 8, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 3, p.op1.AMS = 0, p.op2.AR = 24, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 7, p.op2.AMS = 0, p.op3.AR = 24, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 8, p.op3.SL = 0, p.op3.TL = 15, p.op3.KS = 0, p.op3.ML = 4, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 24, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 0, p.op4.TL = 18, p.op4.KS = 0, p.op4.ML = 0, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(53, p); + p.ALG = 7, p.FB = 3, p.LFO = 0, p.op1.AR = 17, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 3, p.op1.AMS = 0, p.op2.AR = 17, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 7, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 7, p.op2.AMS = 0, p.op3.AR = 17, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 8, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 17, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 7, p.op4.SL = 0, p.op4.TL = 14, p.op4.KS = 0, p.op4.ML = 4, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(54, p); + p.ALG = 5, p.FB = 5, p.LFO = 0, p.op1.AR = 16, p.op1.DR = 0, p.op1.SR = 13, p.op1.RR = 6, p.op1.SL = 0, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 18, p.op2.DR = 0, p.op2.SR = 13, + p.op2.RR = 6, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 0, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 20, + p.op3.DR = 0, p.op3.SR = 13, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 16, p.op4.DR = 0, p.op4.SR = 13, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 2, p.op4.DT = 0, p.op4.AMS = 0; + set_program(55, p); + p.ALG = 4, p.FB = 4, p.LFO = 0, p.op1.AR = 22, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 22, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 22, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 8, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 22, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(56, p); + p.ALG = 4, p.FB = 4, p.LFO = 0, p.op1.AR = 17, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 8, p.op1.SL = 0, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 17, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 20, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 8, p.op3.SL = 1, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 1, p.op4.TL = 12, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(57, p); + p.ALG = 4, p.FB = 3, p.LFO = 0, p.op1.AR = 17, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 8, p.op1.SL = 0, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 17, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 20, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 8, p.op3.SL = 1, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 1, p.op4.TL = 12, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(58, p); + p.ALG = 3, p.FB = 3, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 4, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 18, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(59, p); + p.ALG = 4, p.FB = 2, p.LFO = 0, p.op1.AR = 17, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 8, p.op1.SL = 0, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 17, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 20, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 8, p.op3.SL = 1, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 1, p.op4.TL = 12, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(60, p); + p.ALG = 4, p.FB = 5, p.LFO = 0, p.op1.AR = 17, p.op1.DR = 9, p.op1.SR = 0, p.op1.RR = 9, p.op1.SL = 1, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 17, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 17, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 17, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(61, p); + p.ALG = 4, p.FB = 5, p.LFO = 0, p.op1.AR = 17, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 9, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 17, p.op2.DR = 9, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 2, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 17, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 0, p.op4.ML = 3, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(62, p); + p.ALG = 4, p.FB = 5, p.LFO = 0, p.op1.AR = 14, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 9, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 14, p.op2.DR = 7, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 2, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 14, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 0, p.op4.ML = 3, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(63, p); + p.ALG = 3, p.FB = 5, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 8, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 10, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(64, p); + p.ALG = 1, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 10, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(65, p); + p.ALG = 1, p.FB = 5, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 10, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(66, p); + p.ALG = 3, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 24, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 10, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(67, p); + p.ALG = 5, p.FB = 5, p.LFO = 0, p.op1.AR = 18, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 3, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 18, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(68, p); + p.ALG = 4, p.FB = 4, p.LFO = 0, p.op1.AR = 20, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 9, p.op1.SL = 0, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 24, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 24, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(69, p); + p.ALG = 3, p.FB = 2, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 7, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 22, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 10, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(70, p); + p.ALG = 4, p.FB = 5, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 5, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 16, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 1, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 16, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 1, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(71, p); + p.ALG = 4, p.FB = 4, p.LFO = 0, p.op1.AR = 16, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 9, p.op1.SL = 0, + p.op1.TL = 12, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 9, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 1, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 0, p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 12, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 16, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 8, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(72, p); + p.ALG = 6, p.FB = 1, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 18, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 18, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 3, p.op4.KS = 0, p.op4.ML = 3, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(73, p); + p.ALG = 6, p.FB = 3, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 8, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 20, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 28, p.op4.DR = 18, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 1, p.op4.TL = 2, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(74, p); + p.ALG = 4, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 10, p.op1.SL = 0, + p.op1.TL = 6, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 17, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 10, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 0, p.op3.SR = 0, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 17, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 10, p.op4.SL = 0, p.op4.TL = 8, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(75, p); + p.ALG = 6, p.FB = 4, p.LFO = 0, p.op1.AR = 13, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 9, p.op1.SL = 0, p.op1.TL = 8, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 3, p.op1.AMS = 0, p.op2.AR = 16, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 16, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 8, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 16, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 16, p.op4.KS = 0, p.op4.ML = 4, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(76, p); + p.ALG = 4, p.FB = 4, p.LFO = 2, p.op1.AR = 12, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 12, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 10, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 2, + p.op4.AR = 20, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(77, p); + p.ALG = 6, p.FB = 2, p.LFO = 0, p.op1.AR = 14, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 8, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 18, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 18, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 2, p.op4.KS = 0, p.op4.ML = 4, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(78, p); + p.ALG = 7, p.FB = 4, p.LFO = 0, p.op1.AR = 17, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 9, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 17, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 17, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(79, p); + p.ALG = 6, p.FB = 5, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 15, p.op1.SL = 0, + p.op1.TL = 4, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 15, p.op2.SL = 0, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 31, p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, + p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(80, p); + p.ALG = 6, p.FB = 5, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 15, p.op1.SL = 0, + p.op1.TL = 4, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 15, p.op2.SL = 0, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 31, p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, + p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(81, p); + p.ALG = 4, p.FB = 2, p.LFO = 0, p.op1.AR = 2, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 10, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 16, p.op2.SR = 0, p.op2.RR = 10, + p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 20, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 10, p.op3.SL = 0, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 16, p.op4.SR = 0, p.op4.RR = 10, p.op4.SL = 1, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(82, p); + p.ALG = 3, p.FB = 7, p.LFO = 0, p.op1.AR = 16, p.op1.DR = 0, p.op1.SR = 14, p.op1.RR = 11, p.op1.SL = 0, + p.op1.TL = 5, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 0, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 31, p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 11, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(83, p); + p.ALG = 5, p.FB = 4, p.LFO = 0, p.op1.AR = 16, p.op1.DR = 16, p.op1.SR = 1, p.op1.RR = 9, p.op1.SL = 1, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 14, p.op2.SR = 1, + p.op2.RR = 9, p.op2.SL = 1, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 4, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 14, p.op3.SR = 1, p.op3.RR = 9, p.op3.SL = 1, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 14, p.op4.SR = 1, p.op4.RR = 9, p.op4.SL = 1, p.op4.TL = 2, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(84, p); + p.ALG = 7, p.FB = 5, p.LFO = 0, p.op1.AR = 16, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 8, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 7, p.op1.AMS = 0, p.op2.AR = 16, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 7, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 3, p.op3.AMS = 0, + p.op4.AR = 18, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 0, p.op4.TL = 3, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 3, p.op4.AMS = 0; + set_program(85, p); + p.ALG = 4, p.FB = 5, p.LFO = 0, p.op1.AR = 26, p.op1.DR = 4, p.op1.SR = 0, p.op1.RR = 9, p.op1.SL = 1, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 4, p.op2.SR = 0, p.op2.RR = 9, + p.op2.SL = 1, p.op2.TL = 1, p.op2.KS = 0, p.op2.ML = 3, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 26, p.op3.DR = 4, + p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 1, p.op3.TL = 1, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 26, p.op4.DR = 4, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 1, p.op4.TL = 1, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(86, p); + p.ALG = 5, p.FB = 5, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 16, p.op1.SR = 0, p.op1.RR = 10, p.op1.SL = 1, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 16, p.op2.SR = 0, + p.op2.RR = 10, p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 16, p.op3.SR = 0, p.op3.RR = 10, p.op3.SL = 1, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 16, p.op4.SR = 0, p.op4.RR = 10, p.op4.SL = 1, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(87, p); + p.ALG = 7, p.FB = 4, p.LFO = 1, p.op1.AR = 18, p.op1.DR = 0, p.op1.SR = 4, p.op1.RR = 5, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 2, p.op2.AR = 18, p.op2.DR = 0, p.op2.SR = 4, p.op2.RR = 5, + p.op2.SL = 0, p.op2.TL = 1, p.op2.KS = 1, p.op2.ML = 2, p.op2.DT = 1, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 0, + p.op3.SR = 4, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 2, p.op3.ML = 4, p.op3.DT = 2, p.op3.AMS = 0, + p.op4.AR = 18, p.op4.DR = 0, p.op4.SR = 4, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 6, p.op4.KS = 3, p.op4.ML = 8, + p.op4.DT = 3, p.op4.AMS = 0; + set_program(88, p); + p.ALG = 6, p.FB = 3, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 1, p.op2.AR = 10, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 7, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 10, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(89, p); + p.ALG = 5, p.FB = 5, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 14, p.op1.SR = 0, p.op1.RR = 10, p.op1.SL = 1, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 24, p.op2.DR = 10, p.op2.SR = 0, + p.op2.RR = 6, p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 1, p.op2.AMS = 0, p.op3.AR = 26, + p.op3.DR = 14, p.op3.SR = 0, p.op3.RR = 9, p.op3.SL = 1, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 14, p.op4.SR = 0, p.op4.RR = 9, p.op4.SL = 1, p.op4.TL = 4, p.op4.KS = 0, + p.op4.ML = 4, p.op4.DT = 0, p.op4.AMS = 0; + set_program(90, p); + p.ALG = 7, p.FB = 2, p.LFO = 4, p.op1.AR = 16, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 6, p.op1.SL = 0, p.op1.TL = 2, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 7, p.op1.AMS = 0, p.op2.AR = 16, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 7, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 7, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 3, p.op3.AMS = 0, + p.op4.AR = 18, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 7, p.op4.SL = 0, p.op4.TL = 3, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 3, p.op4.AMS = 3; + set_program(91, p); + p.ALG = 7, p.FB = 4, p.LFO = 0, p.op1.AR = 12, p.op1.DR = 8, p.op1.SR = 0, p.op1.RR = 6, p.op1.SL = 1, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 15, p.op2.DR = 8, p.op2.SR = 0, p.op2.RR = 6, + p.op2.SL = 1, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 1, p.op2.AMS = 0, p.op3.AR = 16, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 8, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 16, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 24, p.op4.KS = 0, p.op4.ML = 6, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(92, p); + p.ALG = 6, p.FB = 6, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 6, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 11, p.op2.DR = 6, p.op2.SR = 4, p.op2.RR = 7, + p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, + p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(93, p); + p.ALG = 7, p.FB = 4, p.LFO = 2, p.op1.AR = 20, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 2, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 7, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 7, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 7, p.op2.AMS = 0, p.op3.AR = 20, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 8, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 3, p.op3.AMS = 3, + p.op4.AR = 20, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 3, p.op4.AMS = 0; + set_program(94, p); + p.ALG = 6, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 12, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 6, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 1, p.op2.AMS = 0, p.op3.AR = 12, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 3, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 12, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 6, p.op4.KS = 0, p.op4.ML = 3, + p.op4.DT = 2, p.op4.AMS = 0; + set_program(95, p); + p.ALG = 4, p.FB = 4, p.LFO = 5, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 26, p.op2.DR = 16, p.op2.SR = 4, p.op2.RR = 6, + p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 7, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 26, p.op4.DR = 16, p.op4.SR = 5, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 16, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 3; + set_program(96, p); + p.ALG = 5, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 11, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 1, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 2, p.op1.AMS = 1, p.op2.AR = 16, p.op2.DR = 0, p.op2.SR = 0, + p.op2.RR = 6, p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 16, + p.op3.DR = 0, p.op3.SR = 0, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 16, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 8, p.op4.KS = 0, + p.op4.ML = 6, p.op4.DT = 0, p.op4.AMS = 0; + set_program(97, p); + p.ALG = 6, p.FB = 2, p.LFO = 0, p.op1.AR = 24, p.op1.DR = 0, p.op1.SR = 7, p.op1.RR = 5, p.op1.SL = 0, p.op1.TL = 8, + p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 24, p.op2.DR = 0, p.op2.SR = 7, p.op2.RR = 5, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, + p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(98, p); + p.ALG = 3, p.FB = 2, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 8, + p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 16, p.op2.SR = 0, p.op2.RR = 6, + p.op2.SL = 1, p.op2.TL = 6, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, p.op3.DR = 16, + p.op3.SR = 0, p.op3.RR = 6, p.op3.SL = 1, p.op3.TL = 6, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 28, p.op4.DR = 16, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 1, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(99, p); + p.ALG = 5, p.FB = 4, p.LFO = 5, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 8, p.op1.RR = 5, p.op1.SL = 0, p.op1.TL = 8, + p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 1, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 0, p.op2.SR = 8, p.op2.RR = 6, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, p.op3.DR = 0, + p.op3.SR = 8, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 2, + p.op4.AR = 28, p.op4.DR = 0, p.op4.SR = 8, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 0, p.op4.ML = 3, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(100, p); + p.ALG = 7, p.FB = 2, p.LFO = 0, p.op1.AR = 10, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 6, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 10, p.op2.DR = 0, p.op2.SR = 1, p.op2.RR = 6, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 10, p.op3.DR = 0, + p.op3.SR = 2, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 8, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 10, p.op4.DR = 0, p.op4.SR = 2, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 12, p.op4.KS = 0, p.op4.ML = 3, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(101, p); + p.ALG = 4, p.FB = 3, p.LFO = 1, p.op1.AR = 22, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 7, + p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 1, p.op2.AR = 22, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 6, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 22, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 1, + p.op4.AR = 22, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(102, p); + p.ALG = 4, p.FB = 6, p.LFO = 2, p.op1.AR = 22, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 6, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 22, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 6, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 22, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, p.op3.AMS = 1, + p.op4.AR = 22, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 8, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(103, p); + p.ALG = 5, p.FB = 4, p.LFO = 0, p.op1.AR = 22, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 22, p.op2.DR = 0, p.op2.SR = 6, p.op2.RR = 6, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 22, p.op3.DR = 0, + p.op3.SR = 6, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 3, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(104, p); + p.ALG = 7, p.FB = 5, p.LFO = 0, p.op1.AR = 24, p.op1.DR = 0, p.op1.SR = 7, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 14, p.op2.SR = 14, p.op2.RR = 15, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, + p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(105, p); + p.ALG = 3, p.FB = 0, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 1, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 17, p.op3.RR = 8, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 24, p.op4.DR = 0, p.op4.SR = 10, p.op4.RR = 7, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(106, p); + p.ALG = 3, p.FB = 0, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 2, + p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 17, p.op3.RR = 8, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 24, p.op4.DR = 0, p.op4.SR = 11, p.op4.RR = 5, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(107, p); + p.ALG = 4, p.FB = 5, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 20, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 2, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 0, p.op2.SR = 13, + p.op2.RR = 7, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 0, p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 28, p.op4.DR = 0, p.op4.SR = 13, p.op4.RR = 7, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(108, p); + p.ALG = 3, p.FB = 2, p.LFO = 0, p.op1.AR = 18, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 2, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 20, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, + p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 20, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(109, p); + p.ALG = 3, p.FB = 0, p.LFO = 0, p.op1.AR = 18, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 22, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 0, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 18, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 8, p.op3.KS = 0, p.op3.ML = 2, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 22, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 8, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(110, p); + p.ALG = 4, p.FB = 6, p.LFO = 0, p.op1.AR = 15, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 17, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 11, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 15, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 0, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 17, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 11, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(111, p); + p.ALG = 4, p.FB = 4, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 10, p.op1.RR = 6, p.op1.SL = 0, + p.op1.TL = 2, p.op1.KS = 0, p.op1.ML = 5, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 24, p.op2.DR = 0, p.op2.SR = 10, + p.op2.RR = 6, p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 0, p.op3.SR = 10, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 5, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 24, p.op4.DR = 0, p.op4.SR = 10, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 0, + p.op4.ML = 4, p.op4.DT = 0, p.op4.AMS = 0; + set_program(112, p); + p.ALG = 5, p.FB = 5, p.LFO = 6, p.op1.AR = 24, p.op1.DR = 0, p.op1.SR = 15, p.op1.RR = 8, p.op1.SL = 0, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 2, p.op2.AR = 24, p.op2.DR = 0, p.op2.SR = 15, + p.op2.RR = 8, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 22, + p.op3.DR = 0, p.op3.SR = 15, p.op3.RR = 8, p.op3.SL = 0, p.op3.TL = 2, p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 20, p.op4.DR = 0, p.op4.SR = 15, p.op4.RR = 8, p.op4.SL = 0, p.op4.TL = 4, p.op4.KS = 0, + p.op4.ML = 5, p.op4.DT = 0, p.op4.AMS = 0; + set_program(113, p); + p.ALG = 4, p.FB = 3, p.LFO = 5, p.op1.AR = 28, p.op1.DR = 0, p.op1.SR = 11, p.op1.RR = 5, p.op1.SL = 0, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 0, p.op2.SR = 11, + p.op2.RR = 6, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, + p.op3.DR = 0, p.op3.SR = 11, p.op3.RR = 5, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 2, p.op4.AR = 28, p.op4.DR = 0, p.op4.SR = 11, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 5, p.op4.KS = 0, + p.op4.ML = 2, p.op4.DT = 0, p.op4.AMS = 0; + set_program(114, p); + p.ALG = 5, p.FB = 3, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 5, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 21, p.op2.RR = 10, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 21, p.op3.RR = 10, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 5, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 21, p.op4.RR = 10, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 7, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(115, p); + p.ALG = 6, p.FB = 7, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 0, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 19, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 0, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, + p.op3.SR = 13, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 11, p.op4.RR = 5, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 0, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(116, p); + p.ALG = 5, p.FB = 5, p.LFO = 0, p.op1.AR = 28, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 4, + p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 28, p.op2.DR = 0, p.op2.SR = 17, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 0, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 28, p.op3.DR = 0, + p.op3.SR = 19, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 0, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 28, p.op4.DR = 0, p.op4.SR = 21, p.op4.RR = 10, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 2, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(117, p); + p.ALG = 4, p.FB = 7, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 0, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 19, p.op2.RR = 9, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 0, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 14, p.op3.DR = 0, + p.op3.SR = 15, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 0, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 11, p.op4.RR = 5, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 0, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(118, p); + p.ALG = 6, p.FB = 7, p.LFO = 6, p.op1.AR = 7, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 6, + p.op1.KS = 0, p.op1.ML = 4, p.op1.DT = 0, p.op1.AMS = 1, p.op2.AR = 8, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 15, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, + p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(119, p); + p.ALG = 7, p.FB = 0, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 31, p.op1.SR = 31, p.op1.RR = 15, p.op1.SL = 0, + p.op1.TL = 127, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 31, + p.op2.SR = 31, p.op2.RR = 15, p.op2.SL = 0, p.op2.TL = 127, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, + p.op3.AR = 31, p.op3.DR = 31, p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, + p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, + p.op4.TL = 127, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(120, p); + p.ALG = 6, p.FB = 7, p.LFO = 0, p.op1.AR = 17, p.op1.DR = 0, p.op1.SR = 17, p.op1.RR = 8, p.op1.SL = 0, + p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 15, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 17, p.op2.DR = 0, p.op2.SR = 17, + p.op2.RR = 8, p.op2.SL = 0, p.op2.TL = 16, p.op2.KS = 0, p.op2.ML = 1, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, + p.op3.DR = 31, p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, + p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, + p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(121, p); + p.ALG = 6, p.FB = 7, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 15, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 8, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 6, + p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 15, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, + p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(122, p); + p.ALG = 5, p.FB = 2, p.LFO = 5, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 12, p.op1.DT = 0, p.op1.AMS = 1, p.op2.AR = 16, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 7, + p.op2.SL = 0, p.op2.TL = 2, p.op2.KS = 0, p.op2.ML = 3, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 16, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 4, p.op3.KS = 0, p.op3.ML = 9, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 16, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 7, p.op4.SL = 0, p.op4.TL = 6, p.op4.KS = 0, p.op4.ML = 12, + p.op4.DT = 0, p.op4.AMS = 0; + set_program(123, p); + p.ALG = 5, p.FB = 4, p.LFO = 5, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 13, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 2, p.op2.DT = 0, p.op2.AMS = 1, p.op3.AR = 31, p.op3.DR = 31, + p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(124, p); + p.ALG = 6, p.FB = 7, p.LFO = 5, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 15, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 8, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 0, p.op2.DT = 0, p.op2.AMS = 3, p.op3.AR = 31, p.op3.DR = 31, + p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(125, p); + p.ALG = 5, p.FB = 7, p.LFO = 6, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 15, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 8, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 6, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 4, p.op2.DT = 0, p.op2.AMS = 3, p.op3.AR = 8, p.op3.DR = 0, + p.op3.SR = 0, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 0, p.op3.KS = 0, p.op3.ML = 8, p.op3.DT = 0, p.op3.AMS = 3, + p.op4.AR = 8, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 6, p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 12, + p.op4.DT = 0, p.op4.AMS = 3; + set_program(126, p); + p.ALG = 5, p.FB = 7, p.LFO = 0, p.op1.AR = 31, p.op1.DR = 0, p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, + p.op1.KS = 0, p.op1.ML = 11, p.op1.DT = 0, p.op1.AMS = 0, p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 15, p.op2.RR = 7, + p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 11, p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, + p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, + p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, + p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_program(127, p); + p.ALG = 7, p.FB = 7, p.LFO = 0, p.key = 36, p.panpot = 8192, p.assign = 1, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 17, p.op1.RR = 8, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 1, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 0, p.op2.RR = 15, p.op2.SL = 0, p.op2.TL = 127, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 0, p.op3.RR = 15, p.op3.SL = 0, p.op3.TL = 127, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 0, p.op4.RR = 15, + p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(-1, p); + p.ALG = 5, p.FB = 0, p.LFO = 0, p.key = 11, p.panpot = 8192, p.assign = 35, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 17, p.op1.RR = 8, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 17, p.op2.RR = 8, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 17, p.op3.RR = 8, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 17, p.op4.RR = 8, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(35, p); + p.ALG = 5, p.FB = 0, p.LFO = 0, p.key = 14, p.panpot = 8192, p.assign = 36, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 15, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 15, p.op2.RR = 7, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 15, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 15, p.op4.RR = 7, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(36, p); + p.ALG = 6, p.FB = 7, p.LFO = 0, p.key = 59, p.panpot = 8192, p.assign = 37, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 19, p.op1.RR = 9, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 19, p.op2.RR = 9, p.op2.SL = 0, p.op2.TL = 4, p.op2.KS = 0, p.op2.ML = 2, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, + p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, + p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(37, p); + p.ALG = 5, p.FB = 7, p.LFO = 0, p.key = 48, p.panpot = 8192, p.assign = 38, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 15, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 24, p.op2.SR = 17, p.op2.RR = 8, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 24, p.op3.SR = 17, p.op3.RR = 8, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 24, p.op4.SR = 17, p.op4.RR = 8, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(38, p); + p.ALG = 5, p.FB = 7, p.LFO = 0, p.key = 87, p.panpot = 6912, p.assign = 39, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 15, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 19, p.op2.RR = 9, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 1, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 19, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 2, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 19, p.op4.RR = 9, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 3, p.op4.AMS = 0; + set_drum_program(39, p); + p.ALG = 5, p.FB = 7, p.LFO = 0, p.key = 55, p.panpot = 8192, p.assign = 40, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 15, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 19, p.op2.RR = 9, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 19, p.op3.RR = 9, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 19, p.op4.RR = 9, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(40, p); + p.ALG = 5, p.FB = 0, p.LFO = 0, p.key = 14, p.panpot = 4352, p.assign = 41, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 15, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 15, p.op2.RR = 7, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 15, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 15, p.op4.RR = 7, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(41, p); + p.ALG = 6, p.FB = 7, p.LFO = 0, p.key = 99, p.panpot = 10752, p.assign = 42, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 21, p.op2.RR = 10, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, + p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, + p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(42, p); + p.ALG = 5, p.FB = 0, p.LFO = 0, p.key = 18, p.panpot = 5888, p.assign = 43, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 15, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 15, p.op2.RR = 7, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 15, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 15, p.op4.RR = 7, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(43, p); + p.ALG = 6, p.FB = 7, p.LFO = 0, p.key = 100, p.panpot = 10752, p.assign = 42, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 21, p.op2.RR = 10, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, + p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, + p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(44, p); + p.ALG = 5, p.FB = 0, p.LFO = 0, p.key = 20, p.panpot = 7424, p.assign = 45, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 15, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 15, p.op2.RR = 7, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 15, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 15, p.op4.RR = 7, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(45, p); + p.ALG = 6, p.FB = 7, p.LFO = 0, p.key = 100, p.panpot = 10752, p.assign = 42, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 13, p.op2.RR = 6, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 31, p.op3.SR = 31, p.op3.RR = 15, p.op3.SL = 0, + p.op3.TL = 127, p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, + p.op4.SR = 31, p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(46, p); + p.ALG = 5, p.FB = 0, p.LFO = 0, p.key = 24, p.panpot = 8960, p.assign = 47, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 15, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 15, p.op2.RR = 7, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 15, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 15, p.op4.RR = 7, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(47, p); + p.ALG = 5, p.FB = 0, p.LFO = 0, p.key = 27, p.panpot = 10496, p.assign = 48, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 15, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 15, p.op2.RR = 7, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 15, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 15, p.op4.RR = 7, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(48, p); + p.ALG = 5, p.FB = 7, p.LFO = 3, p.key = 104, p.panpot = 10752, p.assign = 49, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 8, p.op1.DT = 0, p.op1.AMS = 1, + p.op2.AR = 31, p.op2.DR = 20, p.op2.SR = 11, p.op2.RR = 5, p.op2.SL = 1, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 2, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 20, p.op3.SR = 11, p.op3.RR = 5, p.op3.SL = 2, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 3, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 20, p.op4.SR = 11, p.op4.RR = 5, + p.op4.SL = 3, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 5, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(49, p); + p.ALG = 5, p.FB = 0, p.LFO = 0, p.key = 31, p.panpot = 12032, p.assign = 50, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 15, p.op1.RR = 7, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 3, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 15, p.op2.RR = 7, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 15, p.op3.RR = 7, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 0, p.op4.SR = 15, p.op4.RR = 7, + p.op4.SL = 0, p.op4.TL = 0, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(50, p); + p.ALG = 5, p.FB = 7, p.LFO = 0, p.key = 97, p.panpot = 5632, p.assign = 51, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 6, p.op1.KS = 0, p.op1.ML = 8, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 11, p.op2.RR = 5, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 11, p.op3.RR = 5, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, + p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(51, p); + p.ALG = 5, p.FB = 7, p.LFO = 3, p.key = 94, p.panpot = 5632, p.assign = 52, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 0, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 2, p.op1.DT = 0, p.op1.AMS = 1, + p.op2.AR = 31, p.op2.DR = 0, p.op2.SR = 11, p.op2.RR = 5, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 1, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 0, p.op3.SR = 11, p.op3.RR = 5, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 1, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, p.op4.RR = 15, + p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, p.op4.ML = 1, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(52, p); + p.ALG = 5, p.FB = 4, p.LFO = 0, p.key = 72, p.panpot = 3072, p.assign = 80, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 10, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 15, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 24, p.op2.SR = 17, p.op2.RR = 8, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 15, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 24, p.op3.SR = 17, p.op3.RR = 8, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 15, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, + p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, p.op4.ML = 15, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(80, p); + p.ALG = 5, p.FB = 4, p.LFO = 0, p.key = 72, p.panpot = 3072, p.assign = 80, p.op1.AR = 31, p.op1.DR = 0, + p.op1.SR = 5, p.op1.RR = 0, p.op1.SL = 0, p.op1.TL = 0, p.op1.KS = 0, p.op1.ML = 15, p.op1.DT = 0, p.op1.AMS = 0, + p.op2.AR = 31, p.op2.DR = 24, p.op2.SR = 13, p.op2.RR = 6, p.op2.SL = 0, p.op2.TL = 0, p.op2.KS = 0, p.op2.ML = 15, + p.op2.DT = 0, p.op2.AMS = 0, p.op3.AR = 31, p.op3.DR = 24, p.op3.SR = 13, p.op3.RR = 6, p.op3.SL = 0, p.op3.TL = 0, + p.op3.KS = 0, p.op3.ML = 15, p.op3.DT = 0, p.op3.AMS = 0, p.op4.AR = 31, p.op4.DR = 31, p.op4.SR = 31, + p.op4.RR = 15, p.op4.SL = 0, p.op4.TL = 127, p.op4.KS = 0, p.op4.ML = 15, p.op4.DT = 0, p.op4.AMS = 0; + set_drum_program(81, p); +} +// �N���A�B +void fm_note_factory::clear() +{ + // �f�t�H���g�̉��F(sin�g) + static const struct FMPARAMETER param = {7, + 0, + 0, // ALG FB LFO + // AR DR SR RR SL TL KS ML DT AMS + {31, 0, 0, 15, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 15, 0, 127, 0, 0, 0, 0}, + {0, 0, 0, 15, 0, 127, 0, 0, 0, 0}, + {0, 0, 0, 15, 0, 127, 0, 0, 0, 0}}; + drums.clear(); + programs.clear(); + programs[-1] = param; +} +// ���F�p�����[�^�̐��������� +namespace +{ +bool is_valid_fmparameter(const FMPARAMETER &p) +{ + return p.ALG >= 0 && p.ALG <= 7 && p.FB >= 0 && p.FB <= 7 && p.LFO >= 0 && p.LFO <= 7 && p.op1.AR >= 0 && + p.op1.AR <= 31 && p.op1.DR >= 0 && p.op1.DR <= 31 && p.op1.SR >= 0 && p.op1.SR <= 31 && p.op1.RR >= 0 && + p.op1.RR <= 15 && p.op1.SL >= 0 && p.op1.SL <= 15 && p.op1.TL >= 0 && p.op1.TL <= 127 && p.op1.KS >= 0 && + p.op1.KS <= 3 && p.op1.ML >= 0 && p.op1.ML <= 15 && p.op1.DT >= 0 && p.op1.DT <= 7 && p.op1.AMS >= 0 && + p.op1.AMS <= 3 && p.op2.AR >= 0 && p.op2.AR <= 31 && p.op2.DR >= 0 && p.op2.DR <= 31 && p.op2.SR >= 0 && + p.op2.SR <= 31 && p.op2.RR >= 0 && p.op2.RR <= 15 && p.op2.SL >= 0 && p.op2.SL <= 15 && p.op2.TL >= 0 && + p.op2.TL <= 127 && p.op2.KS >= 0 && p.op2.KS <= 3 && p.op2.ML >= 0 && p.op2.ML <= 15 && p.op2.DT >= 0 && + p.op2.DT <= 7 && p.op2.AMS >= 0 && p.op2.AMS <= 3 && p.op3.AR >= 0 && p.op3.AR <= 31 && p.op3.DR >= 0 && + p.op3.DR <= 31 && p.op3.SR >= 0 && p.op3.SR <= 31 && p.op3.RR >= 0 && p.op3.RR <= 15 && p.op3.SL >= 0 && + p.op3.SL <= 15 && p.op3.TL >= 0 && p.op3.TL <= 127 && p.op3.KS >= 0 && p.op3.KS <= 3 && p.op3.ML >= 0 && + p.op3.ML <= 15 && p.op3.DT >= 0 && p.op3.DT <= 7 && p.op3.AMS >= 0 && p.op3.AMS <= 3 && p.op4.AR >= 0 && + p.op4.AR <= 31 && p.op4.DR >= 0 && p.op4.DR <= 31 && p.op4.SR >= 0 && p.op4.SR <= 31 && p.op4.RR >= 0 && + p.op4.RR <= 15 && p.op4.SL >= 0 && p.op4.SL <= 15 && p.op4.TL >= 0 && p.op4.TL <= 127 && p.op4.KS >= 0 && + p.op4.KS <= 3 && p.op4.ML >= 0 && p.op4.ML <= 15 && p.op4.DT >= 0 && p.op4.DT <= 7 && p.op4.AMS >= 0 && + p.op4.AMS <= 3; +} +bool is_valid_drumparameter(const DRUMPARAMETER &p) +{ + return is_valid_fmparameter(p) && p.key >= 0 && p.key <= 127 && p.panpot >= 0 && p.panpot <= 16383; +} +} // namespace +// ���F�p�����[�^�擾�B +void fm_note_factory::get_program(int program, FMPARAMETER &p) +{ + if (programs.find(program) != programs.end()) + { + p = programs[program]; + } + else if (programs.find(program & 0x3FFF) != programs.end()) + { + p = programs[program & 0x3FFF]; + } + else if (programs.find(program & 0x7F) != programs.end()) + { + p = programs[program & 0x7F]; + } + else + { + p = programs[-1]; + } +} +// ���F�p�����[�^���Z�b�g�B +bool fm_note_factory::set_program(int number, const FMPARAMETER &p) +{ + if (is_valid_fmparameter(p)) + { + programs[number] = p; + return true; + } + else + { + return false; + } +} +// �h�������F�p�����[�^���Z�b�g�B +bool fm_note_factory::set_drum_program(int number, const DRUMPARAMETER &p) +{ + if (is_valid_drumparameter(p)) + { + drums[number] = p; + return true; + } + else + { + return false; + } +} +// �m�[�g�I���B +note *fm_note_factory::note_on(int_least32_t program, int note, int velocity, float frequency_multiplier) +{ + bool drum = (program >> 14) == 120; + if (drum) + { + int n = (program & 0x3FFF) * 128 + note; + struct DRUMPARAMETER *p; + if (drums.find(n) != drums.end()) + { + p = &drums[n]; + } + else if (drums.find(n & 0x3FFF) != drums.end()) + { + p = &drums[n & 0x3FFF]; + } + else if (drums.find(note) != drums.end()) + { + p = &drums[note]; + } + else if (drums.find(-1) != drums.end()) + { + p = &drums[-1]; + } + else + { + return NULL; + } + return new fm_note(*p, p->key, velocity, p->panpot, p->assign, 1); + } + else + { + struct FMPARAMETER *p; + if (programs.find(program) != programs.end()) + { + p = &programs[program]; + } + else if (programs.find(program & 0x7F) != programs.end()) + { + p = &programs[program & 0x7F]; + } + else + { + p = &programs[-1]; + } + return new fm_note(*p, note, velocity, 8192, 0, frequency_multiplier); + } +} +} // namespace midisynth diff --git a/libraries/fmmidi/midisynth.hpp b/libraries/fmmidi/midisynth.hpp new file mode 100644 index 000000000..b97874ab4 --- /dev/null +++ b/libraries/fmmidi/midisynth.hpp @@ -0,0 +1,681 @@ +// �\�t�g�E�F�AMIDI�V���Z�T�C�U�B +// Copyright(c)2003-2005 yuno +#pragma once + +#include +#include +#include +#include + +namespace midisynth +{ +/* +typedef short int_least16_t; +typedef unsigned short uint_least16_t; +typedef long int_least32_t; +typedef unsigned long uint_least32_t; +typedef __int64 int_least64_t; +*/ +class channel; + +// �V�X�e�����[�h�񋓌^�B +enum system_mode_t +{ + system_mode_default, + system_mode_gm, + system_mode_gm2, + system_mode_gs, + system_mode_xg +}; + +// �R�s�[�s�‚̊�{�N���X�B +class uncopyable +{ + public: + uncopyable() + { + } + + private: + uncopyable(const uncopyable &) + { + } + void operator=(const uncopyable &) + { + } +}; + +// �m�[�g�B�������̉��B +class note : uncopyable +{ + public: + note(int assign_, int panpot_) : assign(assign_), panpot(panpot_) + { + } + virtual ~note() + { + } + int get_assign() const + { + return assign; + } + int get_panpot() const + { + return panpot; + } + virtual bool synthesize(int_least32_t *buf, std::size_t samples, float rate, int_least32_t left, + int_least32_t right) = 0; + virtual void note_off(int velocity) = 0; + virtual void sound_off() = 0; + virtual void set_frequency_multiplier(float value) = 0; + virtual void set_tremolo(int depth, float freq) = 0; + virtual void set_vibrato(float depth, float freq) = 0; + virtual void set_damper(int value) = 0; + virtual void set_sostenute(int value) = 0; + virtual void set_freeze(int value) = 0; + + private: + int assign; + int panpot; +}; + +// �m�[�g�t�@�N�g���B +// �m�[�g�I�����b�Z�[�W�ɑ΂��ēK�؂ȃm�[�g�����o���B +class note_factory : uncopyable +{ + public: + virtual note *note_on(int_least32_t program, int note, int velocity, float frequency_multiplier) = 0; + + protected: + ~note_factory() + { + } +}; + +// MIDI�`�����l���B +class channel : uncopyable +{ + enum + { + NUM_NOTES = 128 + }; + + public: + channel(note_factory *factory, int bank); + ~channel(); + + int synthesize(int_least32_t *out, std::size_t samples, float rate, int_least32_t master_volume, + int master_balance); + void reset_all_parameters(); + void reset_all_controller(); + void all_note_off(); + void all_sound_off(); + void all_sound_off_immediately(); + + void note_off(int note, int velocity); + void note_on(int note, int velocity); + void polyphonic_key_pressure(int note, int value); + void program_change(int value) + { + set_program(128 * bank + value); + } + void channel_pressure(int value); + void pitch_bend_change(int value) + { + pitch_bend = value; + update_frequency_multiplier(); + } + void control_change(int control, int value); + void bank_select(int value); + + void set_bank(int value) + { + bank = value; + } + void set_program(int value) + { + program = value; + } + void set_panpot(int value) + { + panpot = value; + } + void set_volume(int value) + { + volume = value; + } + void set_expression(int value) + { + expression = value; + } + void set_pitch_bend_sensitivity(int value) + { + pitch_bend_sensitivity = value; + update_frequency_multiplier(); + } + void set_modulation_depth(int value) + { + modulation_depth = value; + update_modulation(); + } + void set_modulation_depth_range(int value) + { + modulation_depth_range = value; + update_modulation(); + } + void set_damper(int value); + void set_sostenute(int value); + void set_freeze(int value); + void set_fine_tuning(int value) + { + fine_tuning = value; + update_frequency_multiplier(); + } + void set_coarse_tuning(int value) + { + coarse_tuning = value; + update_frequency_multiplier(); + } + void set_RPN(int value) + { + RPN = value; + NRPN = 0x3FFF; + } + void set_NRPN(int value) + { + NRPN = value; + RPN = 0x3FFF; + } + void set_tremolo_frequency(float value) + { + tremolo_frequency = value; + } + void set_vibrato_frequency(float value) + { + vibrato_frequency = value; + } + void set_master_frequency_multiplier(float value) + { + master_frequency_multiplier = value; + update_frequency_multiplier(); + } + void set_mute(bool mute_) + { + mute = mute_; + } + void set_system_mode(system_mode_t mode) + { + system_mode = mode; + } + void mono_mode_on() + { + all_note_off(); + mono = true; + } + void poly_mode_on() + { + all_note_off(); + mono = false; + } + + int get_program() const + { + return program; + } + int get_bank() const + { + return bank; + } + int get_panpot() const + { + return panpot; + } + int get_volume() const + { + return volume; + } + int get_expression() const + { + return expression; + } + int get_channel_pressure() const + { + return pressure; + } + int get_pitch_bend() const + { + return pitch_bend; + } + int get_pitch_bend_sensitivity() const + { + return pitch_bend_sensitivity; + } + int get_modulation_depth() const + { + return modulation_depth; + } + int get_modulation_depth_range() const + { + return modulation_depth_range; + } + int get_damper() const + { + return damper; + } + int get_sostenute() const + { + return sostenute; + } + int get_freeze() const + { + return freeze; + } + int get_fine_tuning() const + { + return fine_tuning; + } + int get_coarse_tuning() const + { + return coarse_tuning; + } + int get_RPN() const + { + return RPN; + } + int get_NRPN() const + { + return NRPN; + } + float get_tremolo_frequency() const + { + return tremolo_frequency; + } + float get_vibrato_frequency() const + { + return vibrato_frequency; + } + bool get_mute() const + { + return mute; + } + bool get_mono_mode() const + { + return mono; + } + + private: + struct NOTE + { + class note *note; + int key; + enum STATUS + { + NOTEON, + NOTEOFF, + SOUNDOFF + } status; + NOTE(class note *p, int key_) : note(p), key(key_), status(NOTEON) + { + } + }; + std::vector notes; + note_factory *factory; + int default_bank; + int program; + int bank; + int panpot; + int volume; + int expression; + int pressure; + int pitch_bend; + int pitch_bend_sensitivity; + int modulation_depth; + int modulation_depth_range; + int damper; + int sostenute; + int freeze; + int fine_tuning; + int coarse_tuning; + int RPN; + int NRPN; + bool mono; + bool mute; + float tremolo_frequency; + float vibrato_frequency; + float frequency_multiplier; + float master_frequency_multiplier; + system_mode_t system_mode; + + int get_registered_parameter(); + void set_registered_parameter(int value); + void update_frequency_multiplier(); + void update_modulation(); +}; + +// MIDI�V���Z�T�C�U�B +class synthesizer : uncopyable +{ + enum + { + NUM_CHANNELS = 16 + }; + + public: + synthesizer(note_factory *factory); + ~synthesizer(); + + channel *get_channel(int ch); + + int synthesize(int_least16_t *output, std::size_t samples, float rate); + int synthesize_mixing(int_least32_t *output, std::size_t samples, float rate); + void reset(); + void reset_all_parameters(); + void reset_all_controller(); + void all_note_off(); + void all_sound_off(); + void all_sound_off_immediately(); + + void note_on(int channel, int note, int velocity) + { + get_channel(channel)->note_on(note, velocity); + } + void note_off(int channel, int note, int velocity) + { + get_channel(channel)->note_off(note, velocity); + } + void polyphonic_key_pressure(int channel, int note, int value) + { + get_channel(channel)->polyphonic_key_pressure(note, value); + } + void control_change(int channel, int control, int value) + { + get_channel(channel)->control_change(control, value); + } + void program_change(int channel, int program) + { + get_channel(channel)->program_change(program); + } + void channel_pressure(int channel, int value) + { + get_channel(channel)->channel_pressure(value); + } + void pitch_bend_change(int channel, int value) + { + get_channel(channel)->pitch_bend_change(value); + } + void sysex_message(const void *data, std::size_t size); + void midi_event(int command, int param1, int param2); + void midi_event(uint_least32_t message) + { + midi_event(message & 0xFF, (message >> 8) & 0x7F, (message >> 16) & 0x7F); + } + + void set_main_volume(int value) + { + main_volume = value; + } + void set_master_volume(int value) + { + master_volume = value; + } + void set_master_balance(int value) + { + master_balance = value; + } + void set_master_fine_tuning(int value) + { + master_fine_tuning = value; + update_master_frequency_multiplier(); + } + void set_master_coarse_tuning(int value) + { + master_coarse_tuning = value; + update_master_frequency_multiplier(); + } + void set_system_mode(system_mode_t mode); + + int get_main_volume() const + { + return main_volume; + } + int get_master_volume() const + { + return master_volume; + } + int get_master_balance() const + { + return master_balance; + } + int get_master_fine_tuning() const + { + return master_fine_tuning; + } + int get_master_coarse_tuning() const + { + return master_coarse_tuning; + } + system_mode_t get_system_mode() const + { + return system_mode; + } + + private: + channel *channels[NUM_CHANNELS]; + float active_sensing; + int main_volume; + int master_volume; + int master_balance; + int master_fine_tuning; + int master_coarse_tuning; + float master_frequency_multiplier; + system_mode_t system_mode; + void update_master_frequency_multiplier(); +}; + +// �����g������B +// �U�� 32768 (-32767�`32767) �̐����g�𐶐�����B +class sine_wave_generator +{ + public: + sine_wave_generator(); + sine_wave_generator(float cycle); + void set_cycle(float cycle); + void add_modulation(int_least32_t x); + int get_next(); + int get_next(int_least32_t modulation); + + private: + uint_least32_t position; + uint_least32_t step; +}; + +// �G���x���[�v������B +// TL=0 �̂Ƃ� 0�`32767 �̒l�𐶐�����B +class envelope_generator +{ + public: + envelope_generator(int AR, int DR, int SR, int RR, int SL, int TL); + void set_rate(float rate); + void set_hold(float value); + void set_freeze(float value); + void key_off(); + void sound_off(); + bool is_finished() const + { + return state == FINISHED; + } + int get_next(); + + private: + enum + { + ATTACK, + ATTACK_RELEASE, + DECAY, + DECAY_RELEASE, + SASTAIN, + RELEASE, + SOUNDOFF, + FINISHED + } state; + int AR, DR, SR, RR, TL; + uint_least32_t fAR, fDR, fSR, fRR, fSL, fTL, fOR, fSS, fDRR, fDSS; + uint_least32_t current; + float rate; + float hold; + float freeze; + void update_parameters(); +}; + +// FM�I�y���[�^ (���W�����[�^����уL�����A)�B +class fm_operator +{ + public: + fm_operator(int AR, int DR, int SR, int RR, int SL, int TL, int KS, int ML, int DT, int AMS, int key); + void set_freq_rate(float freq, float rate); + void set_hold(float value) + { + eg.set_hold(value); + } + void set_freeze(float value) + { + eg.set_freeze(value); + } + void add_modulation(int_least32_t x) + { + swg.add_modulation(x); + } + void key_off() + { + eg.key_off(); + } + void sound_off() + { + eg.sound_off(); + } + bool is_finished() const + { + return eg.is_finished(); + } + int get_next(); + int get_next(int modulate); + int get_next(int lfo, int modulate); + inline int operator()() + { + return get_next(); + } + inline int operator()(int m) + { + return get_next(m); + } + inline int operator()(int lfo, int m) + { + return get_next(lfo, m); + } + + private: + sine_wave_generator swg; + envelope_generator eg; + float ML; + float DT; + int_least32_t ams_factor; + int_least32_t ams_bias; +}; + +// FM�����p�����[�^�B +struct FMPARAMETER +{ + int ALG, FB, LFO; + struct + { + int AR, DR, SR, RR, SL, TL, KS, ML, DT, AMS; + } op1, op2, op3, op4; +}; +// �h�����p�����[�^�B +struct DRUMPARAMETER : FMPARAMETER +{ + int key, panpot, assign; +}; + +// FM�T�E���h�W�F�l���[�^�B +class fm_sound_generator +{ + public: + fm_sound_generator(const FMPARAMETER ¶ms, int note, float frequency_multiplier); + void set_rate(float rate); + void set_frequency_multiplier(float value); + void set_damper(int damper); + void set_sostenute(int sostenute); + void set_freeze(int freeze); + void set_tremolo(int depth, float frequency); + void set_vibrato(float depth, float frequency); + void key_off(); + void sound_off(); + bool is_finished() const; + int get_next(); + + private: + fm_operator op1; + fm_operator op2; + fm_operator op3; + fm_operator op4; + sine_wave_generator ams_lfo; + sine_wave_generator vibrato_lfo; + sine_wave_generator tremolo_lfo; + int ALG; + int FB; + float freq; + float freq_mul; + float ams_freq; + bool ams_enable; + int tremolo_depth; + float tremolo_freq; + int vibrato_depth; + float vibrato_freq; + float rate; + int feedback; + int damper; + int sostenute; +}; + +// FM�����m�[�g�B +class fm_note : public note +{ + public: + fm_note(const FMPARAMETER ¶ms, int note, int velocity, int panpot, int assign, float frequency_multiplier); + virtual void release() + { + delete this; + } + virtual bool synthesize(int_least32_t *buf, std::size_t samples, float rate, int_least32_t left, + int_least32_t right); + virtual void note_off(int velocity); + virtual void sound_off(); + virtual void set_frequency_multiplier(float value); + virtual void set_tremolo(int depth, float freq); + virtual void set_vibrato(float depth, float freq); + virtual void set_damper(int value); + virtual void set_sostenute(int value); + virtual void set_freeze(int value); + + public: + fm_sound_generator fm; + int velocity; +}; + +// FM�����m�[�g�t�@�N�g���B +class fm_note_factory : public note_factory +{ + public: + fm_note_factory(); + void clear(); + void get_program(int number, FMPARAMETER &p); + bool set_program(int number, const FMPARAMETER &p); + bool set_drum_program(int number, const DRUMPARAMETER &p); + virtual note *note_on(int_least32_t program, int note, int velocity, float frequency_multiplier); + + private: + std::map programs; + std::map drums; +}; +} // namespace midisynth \ No newline at end of file diff --git a/source_files/edge/CMakeLists.txt b/source_files/edge/CMakeLists.txt index 3ea3234a4..a656f141b 100644 --- a/source_files/edge/CMakeLists.txt +++ b/source_files/edge/CMakeLists.txt @@ -86,6 +86,7 @@ set (EDGE_SOURCE_FILES s_music.cc s_ogg.cc s_fluid.cc + s_fmm.cc s_m4p.cc s_opl.cc s_rad.cc @@ -140,6 +141,7 @@ set (EDGE_LINK_LIBRARIES crsid dr_libs fluidlite + fmmidi HandmadeMath libRAD libvwad diff --git a/source_files/edge/m_option.cc b/source_files/edge/m_option.cc index cd3ab3644..62f614082 100644 --- a/source_files/edge/m_option.cc +++ b/source_files/edge/m_option.cc @@ -108,6 +108,7 @@ #include "s_blit.h" #include "s_cache.h" #include "s_fluid.h" +#include "s_fmm.h" #include "s_music.h" #include "s_opl.h" #include "s_sound.h" @@ -526,7 +527,7 @@ static OptionMenuItem soundoptions[] = { {kOptionMenuItemTypePlain, "", nullptr, 0, nullptr, nullptr, nullptr}, {kOptionMenuItemTypeSwitch, "Stereo", "Off/On/Swapped", 3, &var_sound_stereo, nullptr, "NeedRestart"}, {kOptionMenuItemTypePlain, "", nullptr, 0, nullptr, nullptr, nullptr}, - {kOptionMenuItemTypeSwitch, "MIDI Player", "Fluidlite/Opal", 2, &var_midi_player, OptionMenuChangeMidiPlayer, + {kOptionMenuItemTypeSwitch, "MIDI Player", "Fluidlite/Opal/FMMIDI", 3, &var_midi_player, OptionMenuChangeMidiPlayer, nullptr}, {kOptionMenuItemTypeFunction, "Fluidlite Soundfont", nullptr, 0, nullptr, OptionMenuChangeSoundfont, nullptr}, {kOptionMenuItemTypeBoolean, "PC Speaker Mode", YesNo, 2, &pc_speaker_mode, OptionMenuChangePCSpeakerMode, @@ -2038,8 +2039,10 @@ static void OptionMenuChangeMidiPlayer(int key_pressed, ConsoleVariable *console if (var_midi_player == 1 || (playing && (playing->type_ == kDDFMusicIMF280 || playing->type_ == kDDFMusicIMF560 || playing->type_ == kDDFMusicIMF700))) RestartOpal(); - else + else if (var_midi_player == 0) RestartFluid(); + else + RestartFMM(); } // diff --git a/source_files/edge/s_fmm.cc b/source_files/edge/s_fmm.cc new file mode 100644 index 000000000..3a259b6f9 --- /dev/null +++ b/source_files/edge/s_fmm.cc @@ -0,0 +1,357 @@ +//---------------------------------------------------------------------------- +// EDGE FMMIDI Music Player +//---------------------------------------------------------------------------- +// +// Copyright (c) 2023-2024 The EDGE Team. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 3 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +//---------------------------------------------------------------------------- + +#include "s_fmm.h" + +#include +#include + +#include "dm_state.h" +#include "epi_file.h" +#include "epi_filesystem.h" +#include "epi_str_util.h" +#include "i_system.h" +#include "m_misc.h" +#include "midisynth.hpp" +// clang-format off +#define MidiFraction FMMFraction +#define MidiSequencer FMMSequencer +typedef struct MidiRealTimeInterface FMMInterface; +#include "midi_sequencer_impl.hpp" +// clang-format on +#include "s_blit.h" + +extern int sound_device_frequency; + +// Should only be invoked when switching MIDI players +void RestartFMM(void) +{ + int old_entry = entry_playing; + + StopMusic(); + + ChangeMusic(old_entry, true); // Restart track that was kPlaying when switched + + return; // OK! +} + +class FMMPlayer : public AbstractMusicPlayer +{ + private: + private: + enum status_ + { + kNotLoaded, + kPlaying, + kPaused, + kStopped + }; + + int status_; + bool looping_; + + FMMInterface *fmm_interface_; + + public: + FMMPlayer(uint8_t *data, int length, bool looping) : status_(kNotLoaded), looping_(looping) + { + SequencerInit(); + } + + ~FMMPlayer() + { + Close(); + } + + public: + FMMSequencer *fmm_sequencer_; + midisynth::synthesizer *fmm_synth_; + midisynth::fm_note_factory *fmm_note_factory_; + + static void rtNoteOn(void *userdata, uint8_t channel, uint8_t note, uint8_t velocity) + { + FMMPlayer *player = (FMMPlayer *)userdata; + player->fmm_synth_->note_on(channel, note, velocity); + } + + static void rtNoteOff(void *userdata, uint8_t channel, uint8_t note) + { + FMMPlayer *player = (FMMPlayer *)userdata; + player->fmm_synth_->note_off(channel, note, 0); + } + + static void rtNoteAfterTouch(void *userdata, uint8_t channel, uint8_t note, uint8_t atVal) + { + FMMPlayer *player = (FMMPlayer *)userdata; + player->fmm_synth_->polyphonic_key_pressure(channel, note, atVal); + } + + static void rtChannelAfterTouch(void *userdata, uint8_t channel, uint8_t atVal) + { + FMMPlayer *player = (FMMPlayer *)userdata; + player->fmm_synth_->channel_pressure(channel, atVal); + } + + static void rtControllerChange(void *userdata, uint8_t channel, uint8_t type, uint8_t value) + { + FMMPlayer *player = (FMMPlayer *)userdata; + player->fmm_synth_->control_change(channel, type, value); + } + + static void rtPatchChange(void *userdata, uint8_t channel, uint8_t patch) + { + FMMPlayer *player = (FMMPlayer *)userdata; + player->fmm_synth_->program_change(channel, patch); + } + + static void rtPitchBend(void *userdata, uint8_t channel, uint8_t msb, uint8_t lsb) + { + FMMPlayer *player = (FMMPlayer *)userdata; + player->fmm_synth_->pitch_bend_change(channel, (msb << 7) | lsb); + } + + static void rtSysEx(void *userdata, const uint8_t *msg, size_t size) + { + FMMPlayer *player = (FMMPlayer *)userdata; + player->fmm_synth_->sysex_message(msg, size); + } + + static void rtDeviceSwitch(void *userdata, size_t track, const char *data, size_t length) + { + (void)userdata; + (void)track; + (void)data; + (void)length; + } + + static size_t rtCurrentDevice(void *userdata, size_t track) + { + (void)userdata; + (void)track; + return 0; + } + + static void playSynth(void *userdata, uint8_t *stream, size_t length) + { + FMMPlayer *player = (FMMPlayer *)userdata; + player->fmm_synth_->synthesize(reinterpret_cast(stream), length / 4, sound_device_frequency); + } + + void SequencerInit() + { + fmm_sequencer_ = new FMMSequencer; + fmm_interface_ = new FMMInterface; + memset(fmm_interface_, 0, sizeof(MidiRealTimeInterface)); + + fmm_interface_->rtUserData = this; + fmm_interface_->rt_noteOn = rtNoteOn; + fmm_interface_->rt_noteOff = rtNoteOff; + fmm_interface_->rt_noteAfterTouch = rtNoteAfterTouch; + fmm_interface_->rt_channelAfterTouch = rtChannelAfterTouch; + fmm_interface_->rt_controllerChange = rtControllerChange; + fmm_interface_->rt_patchChange = rtPatchChange; + fmm_interface_->rt_pitchBend = rtPitchBend; + fmm_interface_->rt_systemExclusive = rtSysEx; + + fmm_interface_->onPcmRender = playSynth; + fmm_interface_->onPcmRender_userdata = this; + + fmm_interface_->pcmSampleRate = sound_device_frequency; + fmm_interface_->pcmFrameSize = 2 /*channels*/ * 2 /*size of one sample*/; + + fmm_interface_->rt_deviceSwitch = rtDeviceSwitch; + fmm_interface_->rt_currentDevice = rtCurrentDevice; + + fmm_sequencer_->SetInterface(fmm_interface_); + } + + bool LoadTrack(const uint8_t *data, int length) + { + return fmm_sequencer_->LoadMidi(data, length); + } + + void Close(void) + { + if (status_ == kNotLoaded) + return; + + // Stop playback + if (status_ != kStopped) + Stop(); + + if (fmm_sequencer_) + { + delete fmm_sequencer_; + fmm_sequencer_ = nullptr; + } + if (fmm_interface_) + { + delete fmm_interface_; + fmm_interface_ = nullptr; + } + if (fmm_note_factory_) + { + delete fmm_note_factory_; + fmm_note_factory_ = nullptr; + } + if (fmm_synth_) + { + delete fmm_synth_; + fmm_synth_ = nullptr; + } + + status_ = kNotLoaded; + } + + void Play(bool loop) + { + if (!(status_ == kNotLoaded || status_ == kStopped)) + return; + + status_ = kPlaying; + looping_ = loop; + + // Load up initial buffer data + Ticker(); + } + + void Stop(void) + { + if (!(status_ == kPlaying || status_ == kPaused)) + return; + + fmm_synth_->all_sound_off_immediately(); + + SoundQueueStop(); + + status_ = kStopped; + } + + void Pause(void) + { + if (status_ != kPlaying) + return; + + fmm_synth_->all_sound_off(); + + status_ = kPaused; + } + + void Resume(void) + { + if (status_ != kPaused) + return; + + status_ = kPlaying; + } + + void Ticker(void) + { + while (status_ == kPlaying && !pc_speaker_mode) + { + SoundData *buf = SoundQueueGetFreeBuffer(kMusicBuffer); + + if (!buf) + break; + + if (StreamIntoBuffer(buf)) + { + SoundQueueAddBuffer(buf, sound_device_frequency); + } + else + { + // finished playing + SoundQueueReturnBuffer(buf); + + Stop(); + } + } + } + + private: + bool StreamIntoBuffer(SoundData *buf) + { + int16_t *data_buf = buf->data_; + + bool song_done = false; + + int played = fmm_sequencer_->PlayStream((uint8_t *)data_buf, kMusicBuffer); + + if (fmm_sequencer_->PositionAtEnd()) + song_done = true; + + buf->length_ = played / 4; + + if (song_done) /* EOF */ + { + if (!looping_) + return false; + fmm_sequencer_->Rewind(); + return true; + } + + return true; + } +}; + +AbstractMusicPlayer *PlayFMMMusic(uint8_t *data, int length, bool loop) +{ + FMMPlayer *player = new FMMPlayer(data, length, loop); + + if (!player) + { + LogDebug("FMMIDI player: error initializing!\n"); + delete[] data; + return nullptr; + } + + player->fmm_note_factory_ = new midisynth::fm_note_factory; + if (!player->fmm_note_factory_) + { + LogDebug("FMMIDI player: error initializing!\n"); + delete[] data; + delete player; + return nullptr; + } + + player->fmm_synth_ = new midisynth::synthesizer(player->fmm_note_factory_); + if (!player->fmm_synth_) + { + LogDebug("FMMIDI player: error initializing!\n"); + delete[] data; + delete player; + return nullptr; + } + + if (!player->LoadTrack(data, length)) // Lobo: quietly log it instead of completely exiting EDGE + { + LogDebug("FMMIDI player: failed to load MIDI file!\n"); + delete[] data; + delete player; + return nullptr; + } + + delete[] data; + + player->Play(loop); + + return player; +} + +//--- editor settings --- +// vi:ts=4:sw=4:noexpandtab diff --git a/source_files/edge/s_fmm.h b/source_files/edge/s_fmm.h new file mode 100644 index 000000000..c37b81187 --- /dev/null +++ b/source_files/edge/s_fmm.h @@ -0,0 +1,28 @@ +//---------------------------------------------------------------------------- +// EDGE FMMIDI Music Player +//---------------------------------------------------------------------------- +// +// Copyright (c) 2023-2024 The EDGE Team. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 3 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "s_music.h" + +void RestartFMM(void); + +AbstractMusicPlayer *PlayFMMMusic(uint8_t *data, int length, bool loop); + +//--- editor settings --- +// vi:ts=4:sw=4:noexpandtab diff --git a/source_files/edge/s_music.cc b/source_files/edge/s_music.cc index 79ca894d2..a2c6e4cfe 100644 --- a/source_files/edge/s_music.cc +++ b/source_files/edge/s_music.cc @@ -32,6 +32,7 @@ #include "m_misc.h" #include "s_flac.h" #include "s_fluid.h" +#include "s_fmm.h" #include "s_m4p.h" #include "s_mp3.h" #include "s_ogg.h" @@ -215,10 +216,14 @@ void ChangeMusic(int entry_number, bool loop) { music_player = PlayFluidMusic(data, length, loop); } - else + else if (var_midi_player == 1) { music_player = PlayOPLMusic(data, length, loop, play->type_); } + else + { + music_player = PlayFMMMusic(data, length, loop); + } break; default: