diff --git a/doc_classes/SiOPMOperatorParams.xml b/doc_classes/SiOPMOperatorParams.xml index 37d6915..020ca3f 100644 --- a/doc_classes/SiOPMOperatorParams.xml +++ b/doc_classes/SiOPMOperatorParams.xml @@ -4,8 +4,72 @@ Container for processing operator parameters within [SiOPMChannelParams]. - [b]Warning:[/b] This class currently has no intended use in the API. If you need this class and its unexposed methods in your project, please [b][url=https://github.com/YuriSizov/gdsion/issues]create a feature request with your use case[/url][/b]! + + + Modulation shift for the amplitude. + + + Attack rate of the pulse. + + + Decay rate of the pulse. + + + First detune factor of the pulse. + + + Second detune factor of the pulse, typicaly a detune for pTSS. + + + Flag that enables envelope reset on attack. + + + Fine multiple factor. + + + Fixed pitch value for the pulse. This makes the operator ignore the pitch/note played with the owner voice. + + + Level for the frequency modulation. Value of [code]5[/code] means standard modulation. + + + Initial phase of the pulse. + + + Level for the key scaling. + + + Rate of the key scaling. + + + Multiple factor. + + + Mute flag. + + + Type of the pitch table used by the pulse. + + + Type of the pulse generator. Must be one of the [enum SiONPulseGeneratorType] values, or another value in the valid range. + + + Release rate of the pulse. + + + Type of the SSG envelope control. This features uses the ADSR envelope to create a wave shape as the final envelope. The exact nature of the effect depends on this value. + + + Sustain level of the pulse. + + + Sustain rate of the pulse. Allows for the pulse to change while being sustained. + + + Total level of the pulse. + + diff --git a/src/chip/channels/siopm_channel_fm.cpp b/src/chip/channels/siopm_channel_fm.cpp index 7666dda..631fbda 100644 --- a/src/chip/channels/siopm_channel_fm.cpp +++ b/src/chip/channels/siopm_channel_fm.cpp @@ -663,7 +663,7 @@ void SiOPMChannelFM::set_fixed_pitch(int p_value) { } void SiOPMChannelFM::set_ssg_envelope_control(int p_value) { - _active_operator->set_ssg_type_envelope_control(p_value); + _active_operator->set_ssg_type(p_value); } void SiOPMChannelFM::set_envelope_reset(bool p_reset) { diff --git a/src/chip/channels/siopm_channel_pcm.cpp b/src/chip/channels/siopm_channel_pcm.cpp index 71d9987..6e0f0d6 100644 --- a/src/chip/channels/siopm_channel_pcm.cpp +++ b/src/chip/channels/siopm_channel_pcm.cpp @@ -201,7 +201,7 @@ void SiOPMChannelPCM::set_fixed_pitch(int p_value) { } void SiOPMChannelPCM::set_ssg_envelope_control(int p_value) { - _operator->set_ssg_type_envelope_control(p_value); + _operator->set_ssg_type(p_value); } void SiOPMChannelPCM::set_envelope_reset(bool p_reset) { diff --git a/src/chip/channels/siopm_operator.cpp b/src/chip/channels/siopm_operator.cpp index 606be25..0fdeda6 100644 --- a/src/chip/channels/siopm_operator.cpp +++ b/src/chip/channels/siopm_operator.cpp @@ -25,7 +25,7 @@ const int SiOPMOperator::_eg_next_state_table[2][EG_MAX] = { void SiOPMOperator::set_attack_rate(int p_value) { _attack_rate = p_value & 63; - if (_ssg_type_envelope_control == 8 || _ssg_type_envelope_control == 12) { + if (_ssg_type == 8 || _ssg_type == 12) { _eg_ssgec_attack_rate = (_attack_rate >= 56) ? 1 : 0; } else { _eg_ssgec_attack_rate = (_attack_rate >= 60) ? 1 : 0; @@ -151,16 +151,16 @@ void SiOPMOperator::set_mute(bool p_mute) { _update_total_level(); } -void SiOPMOperator::set_ssg_type_envelope_control(int p_value) { +void SiOPMOperator::set_ssg_type(int p_value) { if (p_value > 7) { _eg_state_table_index = 1; - _ssg_type_envelope_control = p_value; - if (_ssg_type_envelope_control > 17) { - _ssg_type_envelope_control = 9; + _ssg_type = p_value; + if (_ssg_type > 17) { + _ssg_type = 9; } } else { _eg_state_table_index = 0; - _ssg_type_envelope_control = 0; + _ssg_type = 0; } } @@ -315,7 +315,7 @@ void SiOPMOperator::_shift_eg_state(EGState p_state) { if (_eg_sustain_level) { _eg_state = EG_DECAY; - if (_ssg_type_envelope_control != 0) { + if (_ssg_type != 0) { _eg_level = 0; _eg_state_shift_level = _eg_sustain_level >> 2; @@ -323,7 +323,7 @@ void SiOPMOperator::_shift_eg_state(EGState p_state) { _eg_state_shift_level = SiOPMRefTable::ENV_BOTTOM_SSGEC; } - int level_index = _table->eg_ssg_table_index[_ssg_type_envelope_control - 8][_eg_ssgec_attack_rate][_eg_ssgec_state]; + int level_index = _table->eg_ssg_table_index[_ssg_type - 8][_eg_ssgec_attack_rate][_eg_ssgec_state]; _eg_level_table = make_vector(_table->eg_level_tables[level_index]); } else { _eg_level = 0; @@ -342,11 +342,11 @@ void SiOPMOperator::_shift_eg_state(EGState p_state) { case EG_SUSTAIN: { _eg_state = EG_SUSTAIN; - if (_ssg_type_envelope_control != 0) { + if (_ssg_type != 0) { _eg_level = _eg_sustain_level >> 2; _eg_state_shift_level = SiOPMRefTable::ENV_BOTTOM_SSGEC; - int level_index = _table->eg_ssg_table_index[_ssg_type_envelope_control - 8][_eg_ssgec_attack_rate][_eg_ssgec_state]; + int level_index = _table->eg_ssg_table_index[_ssg_type - 8][_eg_ssgec_attack_rate][_eg_ssgec_state]; _eg_level_table = make_vector(_table->eg_level_tables[level_index]); } else { _eg_level = _eg_sustain_level; @@ -363,7 +363,7 @@ void SiOPMOperator::_shift_eg_state(EGState p_state) { if (_eg_level < SiOPMRefTable::ENV_BOTTOM) { _eg_state = EG_RELEASE; _eg_state_shift_level = SiOPMRefTable::ENV_BOTTOM; - _eg_level_table = make_vector(_table->eg_level_tables[_ssg_type_envelope_control != 0 ? 1 : 0]); + _eg_level_table = make_vector(_table->eg_level_tables[_ssg_type != 0 ? 1 : 0]); int index = _release_rate + _eg_key_scale_rate; _eg_increment_table = make_vector(_table->eg_increment_tables[_table->eg_table_selector[index]]); @@ -462,7 +462,7 @@ void SiOPMOperator::set_operator_params(const Ref &p_params _pitch_index_shift = p_params->get_detune2(); _mute = p_params->is_mute() ? SiOPMRefTable::ENV_BOTTOM : 0; - _ssg_type_envelope_control = p_params->get_ssg_type_envelope_control(); + _ssg_type = p_params->get_ssg_envelope_control(); _envelope_reset_on_attack = p_params->is_envelope_reset_on_attack(); if (p_params->get_fixed_pitch() > 0) { @@ -498,7 +498,7 @@ void SiOPMOperator::get_operator_params(const Ref &r_params r_params->set_detune2(get_ptss_detune()); r_params->set_amplitude_modulation_shift(get_amplitude_modulation_shift()); - r_params->set_ssg_type_envelope_control(_ssg_type_envelope_control); + r_params->set_ssg_envelope_control(_ssg_type); r_params->set_envelope_reset_on_attack(is_envelope_reset_on_attack()); r_params->set_initial_phase(get_key_on_phase()); @@ -611,7 +611,7 @@ String SiOPMOperator::_to_string() const { params += "phase=" + itos(get_key_on_phase()) + ", "; params += "note=" + String(is_pitch_fixed() ? "yes" : "no") + ", "; - params += "ssg=" + itos(_ssg_type_envelope_control) + ", "; + params += "ssgec=" + itos(_ssg_type) + ", "; params += "mute=" + itos(_mute) + ", "; params += "reset=" + String(_envelope_reset_on_attack ? "yes" : "no"); diff --git a/src/chip/channels/siopm_operator.h b/src/chip/channels/siopm_operator.h index a36792a..c1ff9d4 100644 --- a/src/chip/channels/siopm_operator.h +++ b/src/chip/channels/siopm_operator.h @@ -78,7 +78,8 @@ class SiOPMOperator : public Object { // Mute [0 / SiOPMRefTable::ENV_BOTTOM]. int _mute = 0; - int _ssg_type_envelope_control = 0; + // SSG-type envelope control [0,17]. + int _ssg_type = 0; bool _envelope_reset_on_attack = false; void _update_key_code(int p_value); @@ -223,8 +224,8 @@ class SiOPMOperator : public Object { bool is_mute() const; void set_mute(bool p_mute); - int get_ssg_type_envelope_control() const { return _ssg_type_envelope_control; } - void set_ssg_type_envelope_control(int p_value); + int get_ssg_type() const { return _ssg_type; } + void set_ssg_type(int p_value); bool is_envelope_reset_on_attack() const { return _envelope_reset_on_attack; } void set_envelope_reset_on_attack(bool p_reset) { _envelope_reset_on_attack = p_reset; } diff --git a/src/chip/siopm_channel_params.cpp b/src/chip/siopm_channel_params.cpp index ae4d630..f36d116 100644 --- a/src/chip/siopm_channel_params.cpp +++ b/src/chip/siopm_channel_params.cpp @@ -252,25 +252,20 @@ void SiOPMChannelParams::_bind_methods() { ClassDB::bind_method(D_METHOD("get_algorithm"), &SiOPMChannelParams::get_algorithm); ClassDB::bind_method(D_METHOD("set_algorithm", "value"), &SiOPMChannelParams::set_algorithm); - ClassDB::bind_method(D_METHOD("get_feedback"), &SiOPMChannelParams::get_feedback); ClassDB::bind_method(D_METHOD("set_feedback", "value"), &SiOPMChannelParams::set_feedback); - ClassDB::bind_method(D_METHOD("get_feedback_connection"), &SiOPMChannelParams::get_feedback_connection); ClassDB::bind_method(D_METHOD("set_feedback_connection", "value"), &SiOPMChannelParams::set_feedback_connection); ClassDB::bind_method(D_METHOD("get_envelope_frequency_ratio"), &SiOPMChannelParams::get_envelope_frequency_ratio); ClassDB::bind_method(D_METHOD("set_envelope_frequency_ratio", "value"), &SiOPMChannelParams::set_envelope_frequency_ratio); - ClassDB::bind_method(D_METHOD("get_lfo_wave_shape"), &SiOPMChannelParams::get_lfo_wave_shape); ClassDB::bind_method(D_METHOD("set_lfo_wave_shape", "value"), &SiOPMChannelParams::set_lfo_wave_shape); - ClassDB::bind_method(D_METHOD("get_lfo_frequency_step"), &SiOPMChannelParams::get_lfo_frequency_step); ClassDB::bind_method(D_METHOD("set_lfo_frequency_step", "value"), &SiOPMChannelParams::set_lfo_frequency_step); ClassDB::bind_method(D_METHOD("get_amplitude_modulation_depth"), &SiOPMChannelParams::get_amplitude_modulation_depth); ClassDB::bind_method(D_METHOD("set_amplitude_modulation_depth", "value"), &SiOPMChannelParams::set_amplitude_modulation_depth); - ClassDB::bind_method(D_METHOD("get_pitch_modulation_depth"), &SiOPMChannelParams::get_pitch_modulation_depth); ClassDB::bind_method(D_METHOD("set_pitch_modulation_depth", "value"), &SiOPMChannelParams::set_pitch_modulation_depth); @@ -282,37 +277,29 @@ void SiOPMChannelParams::_bind_methods() { ClassDB::bind_method(D_METHOD("get_filter_type"), &SiOPMChannelParams::get_filter_type); ClassDB::bind_method(D_METHOD("set_filter_type", "value"), &SiOPMChannelParams::set_filter_type); - ClassDB::bind_method(D_METHOD("get_filter_cutoff"), &SiOPMChannelParams::get_filter_cutoff); ClassDB::bind_method(D_METHOD("set_filter_cutoff", "value"), &SiOPMChannelParams::set_filter_cutoff); - ClassDB::bind_method(D_METHOD("get_filter_resonance"), &SiOPMChannelParams::get_filter_resonance); ClassDB::bind_method(D_METHOD("set_filter_resonance", "value"), &SiOPMChannelParams::set_filter_resonance); - ClassDB::bind_method(D_METHOD("get_filter_attack_rate"), &SiOPMChannelParams::get_filter_attack_rate); ClassDB::bind_method(D_METHOD("set_filter_attack_rate", "value"), &SiOPMChannelParams::set_filter_attack_rate); - ClassDB::bind_method(D_METHOD("get_filter_decay_rate1"), &SiOPMChannelParams::get_filter_decay_rate1); ClassDB::bind_method(D_METHOD("set_filter_decay_rate1", "value"), &SiOPMChannelParams::set_filter_decay_rate1); - ClassDB::bind_method(D_METHOD("get_filter_decay_rate2"), &SiOPMChannelParams::get_filter_decay_rate2); ClassDB::bind_method(D_METHOD("set_filter_decay_rate2", "value"), &SiOPMChannelParams::set_filter_decay_rate2); - ClassDB::bind_method(D_METHOD("get_filter_release_rate"), &SiOPMChannelParams::get_filter_release_rate); ClassDB::bind_method(D_METHOD("set_filter_release_rate", "value"), &SiOPMChannelParams::set_filter_release_rate); - ClassDB::bind_method(D_METHOD("get_filter_decay_offset1"), &SiOPMChannelParams::get_filter_decay_offset1); ClassDB::bind_method(D_METHOD("set_filter_decay_offset1", "value"), &SiOPMChannelParams::set_filter_decay_offset1); - ClassDB::bind_method(D_METHOD("get_filter_decay_offset2"), &SiOPMChannelParams::get_filter_decay_offset2); ClassDB::bind_method(D_METHOD("set_filter_decay_offset2", "value"), &SiOPMChannelParams::set_filter_decay_offset2); - ClassDB::bind_method(D_METHOD("get_filter_sustain_offset"), &SiOPMChannelParams::get_filter_sustain_offset); ClassDB::bind_method(D_METHOD("set_filter_sustain_offset", "value"), &SiOPMChannelParams::set_filter_sustain_offset); - ClassDB::bind_method(D_METHOD("get_filter_release_offset"), &SiOPMChannelParams::get_filter_release_offset); ClassDB::bind_method(D_METHOD("set_filter_release_offset", "value"), &SiOPMChannelParams::set_filter_release_offset); + // + ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "operator_count"), "set_operator_count", "get_operator_count"); ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::BOOL, "analog_like"), "set_analog_like", "is_analog_like"); diff --git a/src/chip/siopm_operator_params.cpp b/src/chip/siopm_operator_params.cpp index 68006c3..23c95f3 100644 --- a/src/chip/siopm_operator_params.cpp +++ b/src/chip/siopm_operator_params.cpp @@ -45,7 +45,7 @@ void SiOPMOperatorParams::initialize() { fixed_pitch = 0; mute = false; - ssg_type_envelope_control = 0; + ssg_envelope_control = 0; frequency_modulation_level = 5; envelope_reset_on_attack = false; } @@ -73,7 +73,7 @@ void SiOPMOperatorParams::copy_from(const Ref &p_params) { fixed_pitch = p_params->fixed_pitch; mute = p_params->mute; - ssg_type_envelope_control = p_params->ssg_type_envelope_control; + ssg_envelope_control = p_params->ssg_envelope_control; frequency_modulation_level = p_params->frequency_modulation_level; envelope_reset_on_attack = p_params->envelope_reset_on_attack; } @@ -99,7 +99,7 @@ String SiOPMOperatorParams::_to_string() const { params += "phase=" + itos(initial_phase) + ", "; params += "note=" + itos(fixed_pitch) + ", "; - params += "ssg=" + itos(ssg_type_envelope_control) + ", "; + params += "ssgec=" + itos(ssg_envelope_control) + ", "; params += "mute=" + String(mute ? "yes" : "no") + ", "; params += "reset=" + String(envelope_reset_on_attack ? "yes" : "no"); @@ -107,7 +107,82 @@ String SiOPMOperatorParams::_to_string() const { } void SiOPMOperatorParams::_bind_methods() { - // TODO: Expose methods and properties for this class. + ClassDB::bind_method(D_METHOD("get_pulse_generator_type"), &SiOPMOperatorParams::get_pulse_generator_type); + ClassDB::bind_method(D_METHOD("set_pulse_generator_type", "type"), &SiOPMOperatorParams::set_pulse_generator_type); + ClassDB::bind_method(D_METHOD("get_pitch_table_type"), &SiOPMOperatorParams::get_pitch_table_type); + ClassDB::bind_method(D_METHOD("set_pitch_table_type", "type"), &SiOPMOperatorParams::set_pitch_table_type); + + ClassDB::bind_method(D_METHOD("get_attack_rate"), &SiOPMOperatorParams::get_attack_rate); + ClassDB::bind_method(D_METHOD("set_attack_rate", "value"), &SiOPMOperatorParams::set_attack_rate); + ClassDB::bind_method(D_METHOD("get_decay_rate"), &SiOPMOperatorParams::get_decay_rate); + ClassDB::bind_method(D_METHOD("set_decay_rate", "value"), &SiOPMOperatorParams::set_decay_rate); + ClassDB::bind_method(D_METHOD("get_sustain_rate"), &SiOPMOperatorParams::get_sustain_rate); + ClassDB::bind_method(D_METHOD("set_sustain_rate", "value"), &SiOPMOperatorParams::set_sustain_rate); + ClassDB::bind_method(D_METHOD("get_release_rate"), &SiOPMOperatorParams::get_release_rate); + ClassDB::bind_method(D_METHOD("set_release_rate", "value"), &SiOPMOperatorParams::set_release_rate); + ClassDB::bind_method(D_METHOD("get_sustain_level"), &SiOPMOperatorParams::get_sustain_level); + ClassDB::bind_method(D_METHOD("set_sustain_level", "value"), &SiOPMOperatorParams::set_sustain_level); + ClassDB::bind_method(D_METHOD("get_total_level"), &SiOPMOperatorParams::get_total_level); + ClassDB::bind_method(D_METHOD("set_total_level", "value"), &SiOPMOperatorParams::set_total_level); + + ClassDB::bind_method(D_METHOD("get_key_scaling_rate"), &SiOPMOperatorParams::get_key_scaling_rate); + ClassDB::bind_method(D_METHOD("set_key_scaling_rate", "value"), &SiOPMOperatorParams::set_key_scaling_rate); + ClassDB::bind_method(D_METHOD("get_key_scaling_level"), &SiOPMOperatorParams::get_key_scaling_level); + ClassDB::bind_method(D_METHOD("set_key_scaling_level", "value"), &SiOPMOperatorParams::set_key_scaling_level); + + ClassDB::bind_method(D_METHOD("get_fine_multiple"), &SiOPMOperatorParams::get_fine_multiple); + ClassDB::bind_method(D_METHOD("set_fine_multiple", "value"), &SiOPMOperatorParams::set_fine_multiple); + ClassDB::bind_method(D_METHOD("get_multiple"), &SiOPMOperatorParams::get_multiple); + ClassDB::bind_method(D_METHOD("set_multiple", "value"), &SiOPMOperatorParams::set_multiple); + ClassDB::bind_method(D_METHOD("get_detune1"), &SiOPMOperatorParams::get_detune1); + ClassDB::bind_method(D_METHOD("set_detune1", "value"), &SiOPMOperatorParams::set_detune1); + ClassDB::bind_method(D_METHOD("get_detune2"), &SiOPMOperatorParams::get_detune2); + ClassDB::bind_method(D_METHOD("set_detune2", "value"), &SiOPMOperatorParams::set_detune2); + + ClassDB::bind_method(D_METHOD("get_amplitude_modulation_shift"), &SiOPMOperatorParams::get_amplitude_modulation_shift); + ClassDB::bind_method(D_METHOD("set_amplitude_modulation_shift", "value"), &SiOPMOperatorParams::set_amplitude_modulation_shift); + ClassDB::bind_method(D_METHOD("get_initial_phase"), &SiOPMOperatorParams::get_initial_phase); + ClassDB::bind_method(D_METHOD("set_initial_phase", "value"), &SiOPMOperatorParams::set_initial_phase); + ClassDB::bind_method(D_METHOD("get_fixed_pitch"), &SiOPMOperatorParams::get_fixed_pitch); + ClassDB::bind_method(D_METHOD("set_fixed_pitch", "value"), &SiOPMOperatorParams::set_fixed_pitch); + + ClassDB::bind_method(D_METHOD("is_mute"), &SiOPMOperatorParams::is_mute); + ClassDB::bind_method(D_METHOD("set_mute", "mute"), &SiOPMOperatorParams::set_mute); + ClassDB::bind_method(D_METHOD("get_ssg_envelope_control"), &SiOPMOperatorParams::get_ssg_envelope_control); + ClassDB::bind_method(D_METHOD("set_ssg_envelope_control", "value"), &SiOPMOperatorParams::set_ssg_envelope_control); + ClassDB::bind_method(D_METHOD("get_frequency_modulation_level"), &SiOPMOperatorParams::get_frequency_modulation_level); + ClassDB::bind_method(D_METHOD("set_frequency_modulation_level", "value"), &SiOPMOperatorParams::set_frequency_modulation_level); + ClassDB::bind_method(D_METHOD("is_envelope_reset_on_attack"), &SiOPMOperatorParams::is_envelope_reset_on_attack); + ClassDB::bind_method(D_METHOD("set_envelope_reset_on_attack", "reset"), &SiOPMOperatorParams::set_envelope_reset_on_attack); + + // + + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "pulse_generator_type"), "set_pulse_generator_type", "get_pulse_generator_type"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "pitch_table_type"), "set_pitch_table_type", "get_pitch_table_type"); + + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "attack_rate"), "set_attack_rate", "get_attack_rate"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "decay_rate"), "set_decay_rate", "get_decay_rate"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "sustain_rate"), "set_sustain_rate", "get_sustain_rate"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "release_rate"), "set_release_rate", "get_release_rate"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "sustain_level"), "set_sustain_level", "get_sustain_level"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "total_level"), "set_total_level", "get_total_level"); + + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "key_scaling_rate"), "set_key_scaling_rate", "get_key_scaling_rate"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "key_scaling_level"), "set_key_scaling_level", "get_key_scaling_level"); + + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "fine_multiple"), "set_fine_multiple", "get_fine_multiple"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "multiple"), "set_multiple", "get_multiple"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "detune1"), "set_detune1", "get_detune1"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "detune2"), "set_detune2", "get_detune2"); + + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "amplitude_modulation_shift"), "set_amplitude_modulation_shift", "get_amplitude_modulation_shift"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "initial_phase"), "set_initial_phase", "get_initial_phase"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "fixed_pitch"), "set_fixed_pitch", "get_fixed_pitch"); + + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::BOOL, "mute"), "set_mute", "is_mute"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "ssg_envelope_control"), "set_ssg_envelope_control", "get_ssg_envelope_control"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::INT, "frequency_modulation_level"), "set_frequency_modulation_level", "get_frequency_modulation_level"); + ClassDB::add_property("SiOPMOperatorParams", PropertyInfo(Variant::BOOL, "envelope_reset_on_attack"), "set_envelope_reset_on_attack", "is_envelope_reset_on_attack"); } SiOPMOperatorParams::SiOPMOperatorParams() { diff --git a/src/chip/siopm_operator_params.h b/src/chip/siopm_operator_params.h index 14f766d..8ae7561 100644 --- a/src/chip/siopm_operator_params.h +++ b/src/chip/siopm_operator_params.h @@ -50,7 +50,7 @@ class SiOPMOperatorParams : public RefCounted { // Detune 2 [0,...] int detune2 = 0; - // Amp modulation shift [0-3] + // Amp modulation shift [0,3] int amplitude_modulation_shift = 0; // Initial phase [0,255]. 255 means no phase reset. int initial_phase = 0; @@ -58,7 +58,8 @@ class SiOPMOperatorParams : public RefCounted { int fixed_pitch = 0; bool mute = false; - int ssg_type_envelope_control = 0; + // SSG-type envelope control [0,17]. + int ssg_envelope_control = 0; // Frequency modulation level [0,7]. 5 means standard modulation. int frequency_modulation_level = 5; bool envelope_reset_on_attack = false; @@ -111,8 +112,8 @@ class SiOPMOperatorParams : public RefCounted { bool is_mute() const { return mute; } void set_mute(bool p_mute) { mute = p_mute; } - int get_ssg_type_envelope_control() const { return ssg_type_envelope_control; } - void set_ssg_type_envelope_control(int p_value) { ssg_type_envelope_control = p_value; } + int get_ssg_envelope_control() const { return ssg_envelope_control; } + void set_ssg_envelope_control(int p_value) { ssg_envelope_control = p_value; } int get_frequency_modulation_level() const { return frequency_modulation_level; } void set_frequency_modulation_level(int p_value) { frequency_modulation_level = p_value; } bool is_envelope_reset_on_attack() const { return envelope_reset_on_attack; } diff --git a/src/chip/siopm_ref_table.h b/src/chip/siopm_ref_table.h index 8c8830e..09bc8b3 100644 --- a/src/chip/siopm_ref_table.h +++ b/src/chip/siopm_ref_table.h @@ -188,7 +188,7 @@ class SiOPMRefTable { int eg_timer_steps[128]; // 128 = 64 rates + 32 ks-rates + 32 dummies for dr,sr=0 // EG table to calculate EG level tables. int eg_level_tables[7][1 << ENV_BITS]; - // EG table from sgg_type to eg_level_tables index. + // EG table for SSG-type to EG level tables index. int eg_ssg_table_index[10][2][3] = { // [w/ ar], [w/o ar] { {3,3,3}, {1,3,3} }, // ssgec=8 @@ -200,7 +200,7 @@ class SiOPMRefTable { { {1,2,1}, {2,1,2} }, // ssgec=14 { {1,6,6}, {2,6,6} }, // ssgec=15 { {1,1,1}, {1,1,1} }, // ssgec=8+ - { {2,2,2}, {2,2,2} } // ssgec=12+ + { {2,2,2}, {2,2,2} } // ssgec=12+ }; // EG sustain level table from 15 to 1024. int eg_sustain_level_table[16];