diff --git a/src/SCsub b/src/SCsub index ccc0dba..10ffe06 100644 --- a/src/SCsub +++ b/src/SCsub @@ -4,9 +4,9 @@ Import("env") env.add_source_files(env.library_sources, "*.cpp") +SConscript("chip/SCsub") SConscript("effector/SCsub") SConscript("events/SCsub") -SConscript("processor/SCsub") SConscript("sequencer/SCsub") SConscript("templates/SCsub") SConscript("utils/SCsub") diff --git a/src/processor/SCsub b/src/chip/SCsub similarity index 100% rename from src/processor/SCsub rename to src/chip/SCsub diff --git a/src/processor/channels/SCsub b/src/chip/channels/SCsub similarity index 100% rename from src/processor/channels/SCsub rename to src/chip/channels/SCsub diff --git a/src/processor/channels/siopm_channel_base.cpp b/src/chip/channels/siopm_channel_base.cpp similarity index 90% rename from src/processor/channels/siopm_channel_base.cpp rename to src/chip/channels/siopm_channel_base.cpp index 078d13d..b2553f0 100644 --- a/src/processor/channels/siopm_channel_base.cpp +++ b/src/chip/channels/siopm_channel_base.cpp @@ -7,8 +7,8 @@ #include "siopm_channel_base.h" #include -#include "processor/siopm_module.h" -#include "processor/siopm_stream.h" +#include "chip/siopm_sound_chip.h" +#include "chip/siopm_stream.h" #include "utils/godot_util.h" #define COPY_TL_TABLE(m_target, m_source) \ @@ -47,13 +47,13 @@ void SiOPMChannelBase::set_filter_type(int p_type) { // Volume control. void SiOPMChannelBase::set_all_stream_send_levels(Vector p_levels) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { int value = p_levels[i]; _volumes.write[i] = value != INT32_MIN ? value * 0.0078125 : 0; } _has_effect_send = false; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { _has_effect_send = true; } @@ -74,7 +74,7 @@ void SiOPMChannelBase::set_stream_send(int p_stream_num, double p_volume) { _has_effect_send = true; } else { _has_effect_send = false; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { _has_effect_send = true; } @@ -139,11 +139,11 @@ void SiOPMChannelBase::offset_filter(int p_offset) { void SiOPMChannelBase::set_input(int p_level, int p_pipe_index) { if (p_level > 0) { - _in_pipe = _chip->get_pipe(p_pipe_index & 3, _buffer_index); + _in_pipe = _sound_chip->get_pipe(p_pipe_index & 3, _buffer_index); _input_mode = InputMode::INPUT_PIPE; _input_level = p_level + 10; } else { - _in_pipe = _chip->get_zero_buffer(); + _in_pipe = _sound_chip->get_zero_buffer(); _input_mode = InputMode::INPUT_ZERO; _input_level = 0; } @@ -151,7 +151,7 @@ void SiOPMChannelBase::set_input(int p_level, int p_pipe_index) { void SiOPMChannelBase::set_ring_modulation(int p_level, int p_pipe_index) { _ringmod_level = p_level * 4.0 / (1 << SiOPMRefTable::LOG_VOLUME_BITS); - _ring_pipe = p_level > 0 ? _chip->get_pipe(p_pipe_index & 3, _buffer_index) : nullptr; + _ring_pipe = p_level > 0 ? _sound_chip->get_pipe(p_pipe_index & 3, _buffer_index) : nullptr; } void SiOPMChannelBase::set_output(OutputMode p_output_mode, int p_pipe_index) { @@ -166,8 +166,8 @@ void SiOPMChannelBase::set_output(OutputMode p_output_mode, int p_pipe_index) { } _output_mode = p_output_mode; - _out_pipe = _chip->get_pipe(pipe_index, _buffer_index); - _base_pipe = flag_add ? _out_pipe : _chip->get_zero_buffer(); + _out_pipe = _sound_chip->get_pipe(pipe_index, _buffer_index); + _base_pipe = flag_add ? _out_pipe : _sound_chip->get_zero_buffer(); } void SiOPMChannelBase::set_volume_tables(int (&p_velocity_table)[SiOPMRefTable::TL_TABLE_SIZE], int (&p_expression_table)[SiOPMRefTable::TL_TABLE_SIZE]) { @@ -274,11 +274,11 @@ void SiOPMChannelBase::_no_process(int p_length) { // Rotate the output buffer. if (_output_mode == OutputMode::OUTPUT_STANDARD) { - int pipe_index = (_buffer_index + p_length) & (_chip->get_buffer_length() - 1); - _out_pipe = _chip->get_pipe(4, pipe_index); + int pipe_index = (_buffer_index + p_length) & (_sound_chip->get_buffer_length() - 1); + _out_pipe = _sound_chip->get_pipe(4, pipe_index); } else { _out_pipe = _rotate_pipe(_out_pipe, p_length); - _base_pipe = _output_mode == OutputMode::OUTPUT_ADD ? pipe : _chip->get_zero_buffer(); + _base_pipe = _output_mode == OutputMode::OUTPUT_ADD ? pipe : _sound_chip->get_zero_buffer(); } // Rotate the input buffer when connected by @i. @@ -381,16 +381,16 @@ void SiOPMChannelBase::buffer(int p_length) { if (_output_mode == OutputMode::OUTPUT_STANDARD && !_mute) { if (_has_effect_send) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { - SiOPMStream *stream = _streams[i] ? _streams[i] : _chip->get_stream_slot(i); + SiOPMStream *stream = _streams[i] ? _streams[i] : _sound_chip->get_stream_slot(i); if (stream) { stream->write(mono_out, _buffer_index, p_length, _volumes[i], _pan); } } } } else { - SiOPMStream *stream = _streams[0] ? _streams[0] : _chip->get_output_stream(); + SiOPMStream *stream = _streams[0] ? _streams[0] : _sound_chip->get_output_stream(); stream->write(mono_out, _buffer_index, p_length, _volumes[0], _pan); } } @@ -409,7 +409,7 @@ void SiOPMChannelBase::initialize(SiOPMChannelBase *p_prev, int p_buffer_index) // Volume. if (p_prev) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { _volumes.write[i] = p_prev->_volumes[i]; _streams.write[i] = p_prev->_streams[i]; } @@ -422,7 +422,7 @@ void SiOPMChannelBase::initialize(SiOPMChannelBase *p_prev, int p_buffer_index) } else { _volumes.write[0] = 0.5; _streams.write[0] = nullptr; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { _volumes.write[i] = 0; _streams.write[i] = nullptr; } @@ -469,15 +469,15 @@ void SiOPMChannelBase::_bind_methods() { ClassDB::bind_method(D_METHOD("_no_process", "length"), &SiOPMChannelBase::_no_process); } -SiOPMChannelBase::SiOPMChannelBase(SiOPMModule *p_chip) { +SiOPMChannelBase::SiOPMChannelBase(SiOPMSoundChip *p_chip) { _table = SiOPMRefTable::get_instance(); - _chip = p_chip; + _sound_chip = p_chip; _process_function = Callable(this, "_no_process"); _streams.clear(); - _streams.resize_zeroed(SiOPMModule::STREAM_SEND_SIZE); + _streams.resize_zeroed(SiOPMSoundChip::STREAM_SEND_SIZE); _volumes.clear(); - _volumes.resize_zeroed(SiOPMModule::STREAM_SEND_SIZE); + _volumes.resize_zeroed(SiOPMSoundChip::STREAM_SEND_SIZE); } #undef COPY_TL_TABLE diff --git a/src/processor/channels/siopm_channel_base.h b/src/chip/channels/siopm_channel_base.h similarity index 97% rename from src/processor/channels/siopm_channel_base.h rename to src/chip/channels/siopm_channel_base.h index 428e459..77bb064 100644 --- a/src/processor/channels/siopm_channel_base.h +++ b/src/chip/channels/siopm_channel_base.h @@ -11,14 +11,14 @@ #include #include #include "sion_enums.h" -#include "processor/channels/siopm_channel_manager.h" -#include "processor/siopm_ref_table.h" +#include "chip/channels/siopm_channel_manager.h" +#include "chip/siopm_ref_table.h" #include "templates/singly_linked_list.h" using namespace godot; class SiOPMChannelParams; -class SiOPMModule; +class SiOPMSoundChip; class SiOPMStream; class SiOPMWaveBase; @@ -70,7 +70,7 @@ class SiOPMChannelBase : public Object { // SiOPMRefTable *_table = nullptr; - SiOPMModule *_chip = nullptr; + SiOPMSoundChip *_sound_chip = nullptr; Callable _process_function; @@ -228,7 +228,7 @@ class SiOPMChannelBase : public Object { virtual void initialize(SiOPMChannelBase *p_prev, int p_buffer_index); virtual void reset(); - SiOPMChannelBase(SiOPMModule *p_chip = nullptr); + SiOPMChannelBase(SiOPMSoundChip *p_chip = nullptr); ~SiOPMChannelBase() {} }; diff --git a/src/processor/channels/siopm_channel_fm.cpp b/src/chip/channels/siopm_channel_fm.cpp similarity index 98% rename from src/processor/channels/siopm_channel_fm.cpp rename to src/chip/channels/siopm_channel_fm.cpp index 962ed37..6a5b4d8 100644 --- a/src/processor/channels/siopm_channel_fm.cpp +++ b/src/chip/channels/siopm_channel_fm.cpp @@ -7,12 +7,12 @@ #include "siopm_channel_fm.h" #include -#include "processor/channels/siopm_operator.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_module.h" -#include "processor/wave/siopm_wave_pcm_data.h" -#include "processor/wave/siopm_wave_pcm_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/channels/siopm_operator.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_sound_chip.h" +#include "chip/wave/siopm_wave_pcm_data.h" +#include "chip/wave/siopm_wave_pcm_table.h" +#include "chip/wave/siopm_wave_table.h" List SiOPMChannelFM::_free_operators; @@ -23,7 +23,7 @@ SiOPMOperator *SiOPMChannelFM::_alloc_fm_operator() { return op; } else { - return memnew(SiOPMOperator(_chip)); + return memnew(SiOPMOperator(_sound_chip)); } } @@ -85,7 +85,7 @@ void SiOPMChannelFM::get_channel_params(SiOPMChannelParams *r_params) const { r_params->set_amplitude_modulation_depth(_amplitude_modulation_depth); r_params->set_pitch_modulation_depth(_pitch_modulation_depth); - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { r_params->set_master_volume(i, _volumes[i]); } r_params->set_pan(_pan); @@ -113,12 +113,12 @@ void SiOPMChannelFM::set_channel_params(SiOPMChannelParams *p_params, bool p_wit } if (p_with_volume) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { _volumes.write[i] = p_params->get_master_volume(i); } _has_effect_send = false; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { _has_effect_send = true; break; @@ -567,7 +567,7 @@ void SiOPMChannelFM::set_feedback(int p_level, int p_connection) { _input_mode = INPUT_FEEDBACK; } else { // Disable feedback. - _in_pipe = _chip->get_zero_buffer(); + _in_pipe = _sound_chip->get_zero_buffer(); _input_level = 0; _input_mode = INPUT_ZERO; } @@ -1515,7 +1515,7 @@ void SiOPMChannelFM::_bind_methods() { ClassDB::bind_method(D_METHOD("_process_sync", "length"), &SiOPMChannelFM::_process_sync); } -SiOPMChannelFM::SiOPMChannelFM(SiOPMModule *p_chip) : SiOPMChannelBase(p_chip) { +SiOPMChannelFM::SiOPMChannelFM(SiOPMSoundChip *p_chip) : SiOPMChannelBase(p_chip) { _process_function_list = { { Callable(this, "_process_operator1_lfo_off"), diff --git a/src/processor/channels/siopm_channel_fm.h b/src/chip/channels/siopm_channel_fm.h similarity index 98% rename from src/processor/channels/siopm_channel_fm.h rename to src/chip/channels/siopm_channel_fm.h index c5c6e5b..6e2caf7 100644 --- a/src/processor/channels/siopm_channel_fm.h +++ b/src/chip/channels/siopm_channel_fm.h @@ -9,7 +9,7 @@ #include #include -#include "processor/channels/siopm_channel_base.h" +#include "chip/channels/siopm_channel_base.h" #include "templates/singly_linked_list.h" using namespace godot; @@ -171,7 +171,7 @@ class SiOPMChannelFM : public SiOPMChannelBase { virtual void initialize(SiOPMChannelBase *p_prev, int p_buffer_index) override; virtual void reset() override; - SiOPMChannelFM(SiOPMModule *p_chip = nullptr); + SiOPMChannelFM(SiOPMSoundChip *p_chip = nullptr); }; #endif // SIOPM_CHANNEL_FM_H diff --git a/src/processor/channels/siopm_channel_ks.cpp b/src/chip/channels/siopm_channel_ks.cpp similarity index 93% rename from src/processor/channels/siopm_channel_ks.cpp rename to src/chip/channels/siopm_channel_ks.cpp index b08aff5..2a8c939 100644 --- a/src/processor/channels/siopm_channel_ks.cpp +++ b/src/chip/channels/siopm_channel_ks.cpp @@ -7,11 +7,11 @@ #include "siopm_channel_ks.h" #include "sion_enums.h" -#include "processor/channels/siopm_operator.h" -#include "processor/siopm_module.h" -#include "processor/siopm_stream.h" -#include "processor/wave/siopm_wave_pcm_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/channels/siopm_operator.h" +#include "chip/siopm_sound_chip.h" +#include "chip/siopm_stream.h" +#include "chip/wave/siopm_wave_pcm_table.h" +#include "chip/wave/siopm_wave_table.h" #include "sequencer/simml_ref_table.h" #include "sequencer/simml_voice.h" @@ -198,16 +198,16 @@ void SiOPMChannelKS::buffer(int p_length) { if (_output_mode == OutputMode::OUTPUT_STANDARD && !_mute) { if (_has_effect_send) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { - SiOPMStream *stream = _streams[i] ? _streams[i] : _chip->get_stream_slot(i); + SiOPMStream *stream = _streams[i] ? _streams[i] : _sound_chip->get_stream_slot(i); if (stream) { stream->write(mono_out, _buffer_index, p_length, _volumes[i] * _expression, _pan); } } } } else { - SiOPMStream *stream = _streams[0] ? _streams[0] : _chip->get_output_stream(); + SiOPMStream *stream = _streams[0] ? _streams[0] : _sound_chip->get_output_stream(); stream->write(mono_out, _buffer_index, p_length, _volumes[0] * _expression, _pan); } } @@ -270,6 +270,6 @@ void SiOPMChannelKS::reset() { SiOPMChannelFM::reset(); } -SiOPMChannelKS::SiOPMChannelKS(SiOPMModule *p_chip) : SiOPMChannelFM(p_chip) { +SiOPMChannelKS::SiOPMChannelKS(SiOPMSoundChip *p_chip) : SiOPMChannelFM(p_chip) { _ks_delay_buffer.resize_zeroed(KS_BUFFER_SIZE); } diff --git a/src/processor/channels/siopm_channel_ks.h b/src/chip/channels/siopm_channel_ks.h similarity index 95% rename from src/processor/channels/siopm_channel_ks.h rename to src/chip/channels/siopm_channel_ks.h index 805b87a..f9c227a 100644 --- a/src/processor/channels/siopm_channel_ks.h +++ b/src/chip/channels/siopm_channel_ks.h @@ -8,13 +8,13 @@ #define SIOPM_CHANNEL_KS_H #include -#include "processor/channels/siopm_channel_fm.h" +#include "chip/channels/siopm_channel_fm.h" #include "templates/singly_linked_list.h" using namespace godot; enum SiONPitchTableType : unsigned int; -class SiOPMModule; +class SiOPMSoundChip; // Karplus-Strong algorithm with FM synth. class SiOPMChannelKS : public SiOPMChannelFM { @@ -89,7 +89,7 @@ class SiOPMChannelKS : public SiOPMChannelFM { virtual void initialize(SiOPMChannelBase *p_prev, int p_buffer_index) override; virtual void reset() override; - SiOPMChannelKS(SiOPMModule *p_chip = nullptr); + SiOPMChannelKS(SiOPMSoundChip *p_chip = nullptr); }; #endif // SIOPM_CHANNEL_KS_H diff --git a/src/processor/channels/siopm_channel_manager.cpp b/src/chip/channels/siopm_channel_manager.cpp similarity index 84% rename from src/processor/channels/siopm_channel_manager.cpp rename to src/chip/channels/siopm_channel_manager.cpp index a4f2b41..d42a80e 100644 --- a/src/processor/channels/siopm_channel_manager.cpp +++ b/src/chip/channels/siopm_channel_manager.cpp @@ -7,20 +7,20 @@ #include "siopm_channel_manager.h" #include -#include "processor/channels/siopm_channel_base.h" -#include "processor/channels/siopm_channel_fm.h" -#include "processor/channels/siopm_channel_ks.h" -#include "processor/channels/siopm_channel_pcm.h" -#include "processor/channels/siopm_channel_sampler.h" -#include "processor/siopm_module.h" +#include "chip/channels/siopm_channel_base.h" +#include "chip/channels/siopm_channel_fm.h" +#include "chip/channels/siopm_channel_ks.h" +#include "chip/channels/siopm_channel_pcm.h" +#include "chip/channels/siopm_channel_sampler.h" +#include "chip/siopm_sound_chip.h" using namespace godot; -SiOPMModule *SiOPMChannelManager::_chip = nullptr; +SiOPMSoundChip *SiOPMChannelManager::_sound_chip = nullptr; HashMap SiOPMChannelManager::_channel_managers; -void SiOPMChannelManager::initialize(SiOPMModule *p_chip) { - _chip = p_chip; +void SiOPMChannelManager::initialize(SiOPMSoundChip *p_chip) { + _sound_chip = p_chip; _channel_managers[CT_CHANNEL_FM] = memnew(SiOPMChannelManager(CT_CHANNEL_FM)); _channel_managers[CT_CHANNEL_PCM] = memnew(SiOPMChannelManager(CT_CHANNEL_PCM)); @@ -63,16 +63,16 @@ SiOPMChannelBase *SiOPMChannelManager::_create_channel(SiOPMChannelBase *p_prev, switch (_channel_type) { case CT_CHANNEL_FM: { - new_channel = memnew(SiOPMChannelFM(_chip)); + new_channel = memnew(SiOPMChannelFM(_sound_chip)); } break; case CT_CHANNEL_PCM: { - new_channel = memnew(SiOPMChannelPCM(_chip)); + new_channel = memnew(SiOPMChannelPCM(_sound_chip)); } break; case CT_CHANNEL_SAMPLER: { - new_channel = memnew(SiOPMChannelSampler(_chip)); + new_channel = memnew(SiOPMChannelSampler(_sound_chip)); } break; case CT_CHANNEL_KS: { - new_channel = memnew(SiOPMChannelKS(_chip)); + new_channel = memnew(SiOPMChannelKS(_sound_chip)); } break; default: break; // Silences enum warnings. @@ -123,7 +123,7 @@ void SiOPMChannelManager::_reset_all() { SiOPMChannelManager::SiOPMChannelManager(ChannelType p_channel_type) { _channel_type = p_channel_type; - _terminator = new SiOPMChannelBase(_chip); + _terminator = new SiOPMChannelBase(_sound_chip); _terminator->_is_free = false; _terminator->_next = _terminator; _terminator->_prev = _terminator; diff --git a/src/processor/channels/siopm_channel_manager.h b/src/chip/channels/siopm_channel_manager.h similarity index 92% rename from src/processor/channels/siopm_channel_manager.h rename to src/chip/channels/siopm_channel_manager.h index a087dc3..d471070 100644 --- a/src/processor/channels/siopm_channel_manager.h +++ b/src/chip/channels/siopm_channel_manager.h @@ -12,7 +12,7 @@ using namespace godot; class SiOPMChannelBase; -class SiOPMModule; +class SiOPMSoundChip; class SiOPMChannelManager { @@ -26,7 +26,7 @@ class SiOPMChannelManager { }; private: - static SiOPMModule *_chip; + static SiOPMSoundChip *_sound_chip; static HashMap _channel_managers; ChannelType _channel_type = ChannelType::CT_MAX; @@ -40,7 +40,7 @@ class SiOPMChannelManager { void _reset_all(); public: - static void initialize(SiOPMModule *p_chip); + static void initialize(SiOPMSoundChip *p_chip); static void initialize_all_channels(); static void reset_all_channels(); diff --git a/src/processor/channels/siopm_channel_pcm.cpp b/src/chip/channels/siopm_channel_pcm.cpp similarity index 90% rename from src/processor/channels/siopm_channel_pcm.cpp rename to src/chip/channels/siopm_channel_pcm.cpp index 6487090..8aec9f5 100644 --- a/src/processor/channels/siopm_channel_pcm.cpp +++ b/src/chip/channels/siopm_channel_pcm.cpp @@ -6,12 +6,12 @@ #include "siopm_channel_pcm.h" -#include "processor/channels/siopm_operator.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_module.h" -#include "processor/siopm_stream.h" -#include "processor/wave/siopm_wave_pcm_data.h" -#include "processor/wave/siopm_wave_pcm_table.h" +#include "chip/channels/siopm_operator.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_sound_chip.h" +#include "chip/siopm_stream.h" +#include "chip/wave/siopm_wave_pcm_data.h" +#include "chip/wave/siopm_wave_pcm_table.h" void SiOPMChannelPCM::get_channel_params(SiOPMChannelParams *r_params) const { r_params->set_operator_count(1); @@ -28,7 +28,7 @@ void SiOPMChannelPCM::get_channel_params(SiOPMChannelParams *r_params) const { r_params->set_amplitude_modulation_depth(_amplitude_modulation_depth); r_params->set_pitch_modulation_depth(_pitch_modulation_depth); - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { r_params->set_master_volume(i, _volumes[i]); } r_params->set_pan(_pan); @@ -55,12 +55,12 @@ void SiOPMChannelPCM::set_channel_params(SiOPMChannelParams *p_params, bool p_wi } if (p_with_volume) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { _volumes.write[i] = p_params->get_master_volume(i); } _has_effect_send = false; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { _has_effect_send = true; break; @@ -274,9 +274,9 @@ void SiOPMChannelPCM::set_pitch_modulation(int p_depth) { void SiOPMChannelPCM::_no_process(int p_length) { // Rotate the output buffer. - int pipe_index = (_buffer_index + p_length) & (_chip->get_buffer_length() - 1); - _out_pipe = _chip->get_pipe(4, pipe_index); - _out_pipe2 = _chip->get_pipe(3, pipe_index); + int pipe_index = (_buffer_index + p_length) & (_sound_chip->get_buffer_length() - 1); + _out_pipe = _sound_chip->get_pipe(4, pipe_index); + _out_pipe2 = _sound_chip->get_pipe(3, pipe_index); } void SiOPMChannelPCM::_update_lfo() { @@ -297,7 +297,7 @@ void SiOPMChannelPCM::_update_lfo() { } void SiOPMChannelPCM::_process_operator_mono(int p_length, bool p_mix) { - SinglyLinkedList *base_pipe = (p_mix ? _out_pipe : _chip->get_zero_buffer()); + SinglyLinkedList *base_pipe = (p_mix ? _out_pipe : _sound_chip->get_zero_buffer()); SinglyLinkedList *out_pipe = _out_pipe; // Noop. @@ -364,9 +364,9 @@ void SiOPMChannelPCM::_process_operator_mono(int p_length, bool p_mix) { } void SiOPMChannelPCM::_process_operator_stereo(int p_length, bool p_mix) { - SinglyLinkedList *base_pipe = (p_mix ? _out_pipe : _chip->get_zero_buffer()); + SinglyLinkedList *base_pipe = (p_mix ? _out_pipe : _sound_chip->get_zero_buffer()); SinglyLinkedList *out_pipe = _out_pipe; - SinglyLinkedList *base_pipe2 = (p_mix ? _out_pipe2 : _chip->get_zero_buffer()); + SinglyLinkedList *base_pipe2 = (p_mix ? _out_pipe2 : _sound_chip->get_zero_buffer()); SinglyLinkedList *out_pipe2 = _out_pipe2; // Noop. @@ -458,39 +458,39 @@ void SiOPMChannelPCM::_process_operator_stereo(int p_length, bool p_mix) { } void SiOPMChannelPCM::_write_stream_mono(SinglyLinkedList *p_output, int p_length) { - double volume_coef = _sample_volume * _chip->get_pcm_volume(); + double volume_coef = _sample_volume * _sound_chip->get_pcm_volume(); int pan = CLAMP(_pan + _sample_pan, 0, 128); if (_has_effect_send) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { - SiOPMStream *stream = _streams[i] ? _streams[i] : _chip->get_stream_slot(i); + SiOPMStream *stream = _streams[i] ? _streams[i] : _sound_chip->get_stream_slot(i); if (stream) { stream->write(p_output, _buffer_index, p_length, _volumes[i] * volume_coef, pan); } } } } else { - SiOPMStream *stream = _streams[0] ? _streams[0] : _chip->get_output_stream(); + SiOPMStream *stream = _streams[0] ? _streams[0] : _sound_chip->get_output_stream(); stream->write(p_output, _buffer_index, p_length, _volumes[0] * volume_coef, pan); } } void SiOPMChannelPCM::_write_stream_stereo(SinglyLinkedList *p_output_left, SinglyLinkedList *p_output_right, int p_length) { - double volume_coef = _sample_volume * _chip->get_pcm_volume(); + double volume_coef = _sample_volume * _sound_chip->get_pcm_volume(); int pan = CLAMP(_pan + _sample_pan, 0, 128); if (_has_effect_send) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { - SiOPMStream *stream = _streams[i] ? _streams[i] : _chip->get_stream_slot(i); + SiOPMStream *stream = _streams[i] ? _streams[i] : _sound_chip->get_stream_slot(i); if (stream) { stream->write_stereo(p_output_left, p_output_right, _buffer_index, p_length, _volumes[i] * volume_coef, pan); } } } } else { - SiOPMStream *stream = _streams[0] ? _streams[0] : _chip->get_output_stream(); + SiOPMStream *stream = _streams[0] ? _streams[0] : _sound_chip->get_output_stream(); stream->write_stereo(p_output_left, p_output_right, _buffer_index, p_length, _volumes[0] * volume_coef, pan); } } @@ -574,7 +574,7 @@ void SiOPMChannelPCM::initialize(SiOPMChannelBase *p_prev, int p_buffer_index) { _operator->initialize(); _is_note_on = false; - _out_pipe2 = _chip->get_pipe(3, p_buffer_index); + _out_pipe2 = _sound_chip->get_pipe(3, p_buffer_index); _filter_variables2[0] = 0; _filter_variables2[1] = 0; @@ -598,7 +598,7 @@ void SiOPMChannelPCM::_bind_methods() { ClassDB::bind_method(D_METHOD("_no_process", "length"), &SiOPMChannelPCM::_no_process); } -SiOPMChannelPCM::SiOPMChannelPCM(SiOPMModule *p_chip) : SiOPMChannelBase(p_chip) { +SiOPMChannelPCM::SiOPMChannelPCM(SiOPMSoundChip *p_chip) : SiOPMChannelBase(p_chip) { _operator = memnew(SiOPMOperator(p_chip)); _process_function = Callable(this, "_no_process"); diff --git a/src/processor/channels/siopm_channel_pcm.h b/src/chip/channels/siopm_channel_pcm.h similarity index 97% rename from src/processor/channels/siopm_channel_pcm.h rename to src/chip/channels/siopm_channel_pcm.h index 1b24d66..7638046 100644 --- a/src/processor/channels/siopm_channel_pcm.h +++ b/src/chip/channels/siopm_channel_pcm.h @@ -7,7 +7,7 @@ #ifndef SIOPM_CHANNEL_PCM_H #define SIOPM_CHANNEL_PCM_H -#include "processor/channels/siopm_channel_base.h" +#include "chip/channels/siopm_channel_base.h" #include "templates/singly_linked_list.h" class SiOPMOperator; @@ -107,7 +107,7 @@ class SiOPMChannelPCM : public SiOPMChannelBase { virtual void initialize(SiOPMChannelBase *p_prev, int p_buffer_index) override; virtual void reset() override; - SiOPMChannelPCM(SiOPMModule *p_chip = nullptr); + SiOPMChannelPCM(SiOPMSoundChip *p_chip = nullptr); }; #endif // SIOPM_CHANNEL_PCM_H diff --git a/src/processor/channels/siopm_channel_sampler.cpp b/src/chip/channels/siopm_channel_sampler.cpp similarity index 82% rename from src/processor/channels/siopm_channel_sampler.cpp rename to src/chip/channels/siopm_channel_sampler.cpp index 3221c5f..56fc30a 100644 --- a/src/processor/channels/siopm_channel_sampler.cpp +++ b/src/chip/channels/siopm_channel_sampler.cpp @@ -7,15 +7,15 @@ #include "siopm_channel_sampler.h" #include "sion_enums.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_module.h" -#include "processor/siopm_stream.h" -#include "processor/wave/siopm_wave_base.h" -#include "processor/wave/siopm_wave_sampler_data.h" -#include "processor/wave/siopm_wave_sampler_table.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_sound_chip.h" +#include "chip/siopm_stream.h" +#include "chip/wave/siopm_wave_base.h" +#include "chip/wave/siopm_wave_sampler_data.h" +#include "chip/wave/siopm_wave_sampler_table.h" void SiOPMChannelSampler::get_channel_params(SiOPMChannelParams *r_params) const { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { r_params->set_master_volume(i, _volumes[i]); } r_params->set_pan(_pan); @@ -27,12 +27,12 @@ void SiOPMChannelSampler::set_channel_params(SiOPMChannelParams *p_params, bool } if (p_with_volume) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { _volumes.write[i] = p_params->get_master_volume(i); } _has_effect_send = false; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { _has_effect_send = true; break; @@ -115,19 +115,19 @@ void SiOPMChannelSampler::buffer(int p_length) { int processed = MIN(residue, remaining); if (_has_effect_send) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { - SiOPMStream *stream = _streams[i] ? _streams[i] : _chip->get_stream_slot(i); + SiOPMStream *stream = _streams[i] ? _streams[i] : _sound_chip->get_stream_slot(i); if (stream) { - double volume = _volumes[i] * _expression * _chip->get_sampler_volume(); + double volume = _volumes[i] * _expression * _sound_chip->get_sampler_volume(); stream->write_from_vector(_sample_data->get_wave_data(), _sample_index, _buffer_index, processed, volume, _sample_pan, _sample_data->get_channel_count()); } } } } else { - SiOPMStream *stream = _streams[0] ? _streams[0] : _chip->get_output_stream(); + SiOPMStream *stream = _streams[0] ? _streams[0] : _sound_chip->get_output_stream(); - double volume = _volumes[0] * _expression * _chip->get_sampler_volume(); + double volume = _volumes[0] * _expression * _sound_chip->get_sampler_volume(); stream->write_from_vector(_sample_data->get_wave_data(), _sample_index, _buffer_index, processed, volume, _sample_pan, _sample_data->get_channel_count()); } @@ -190,6 +190,6 @@ void SiOPMChannelSampler::reset() { _sample_pan = 0; } -SiOPMChannelSampler::SiOPMChannelSampler(SiOPMModule *p_chip) : SiOPMChannelBase(p_chip) { +SiOPMChannelSampler::SiOPMChannelSampler(SiOPMSoundChip *p_chip) : SiOPMChannelBase(p_chip) { // Empty. } diff --git a/src/processor/channels/siopm_channel_sampler.h b/src/chip/channels/siopm_channel_sampler.h similarity index 93% rename from src/processor/channels/siopm_channel_sampler.h rename to src/chip/channels/siopm_channel_sampler.h index de7384c..677ea5f 100644 --- a/src/processor/channels/siopm_channel_sampler.h +++ b/src/chip/channels/siopm_channel_sampler.h @@ -7,11 +7,11 @@ #ifndef SIOPM_CHANNEL_SAMPLER_H #define SIOPM_CHANNEL_SAMPLER_H -#include "processor/channels/siopm_channel_base.h" +#include "chip/channels/siopm_channel_base.h" enum SiONPitchTableType : unsigned int; class SiOPMChannelParams; -class SiOPMModule; +class SiOPMSoundChip; class SiOPMWaveBase; class SiOPMWaveSamplerData; class SiOPMWaveSamplerTable; @@ -65,7 +65,7 @@ class SiOPMChannelSampler : public SiOPMChannelBase { virtual void initialize(SiOPMChannelBase *p_prev, int p_buffer_index) override; virtual void reset() override; - SiOPMChannelSampler(SiOPMModule *p_chip = nullptr); + SiOPMChannelSampler(SiOPMSoundChip *p_chip = nullptr); }; #endif // SIOPM_CHANNEL_SAMPLER_H diff --git a/src/processor/channels/siopm_operator.cpp b/src/chip/channels/siopm_operator.cpp similarity index 96% rename from src/processor/channels/siopm_operator.cpp rename to src/chip/channels/siopm_operator.cpp index 99140ed..b6fcc2b 100644 --- a/src/processor/channels/siopm_operator.cpp +++ b/src/chip/channels/siopm_operator.cpp @@ -7,11 +7,11 @@ #include "siopm_operator.h" #include -#include "processor/siopm_module.h" -#include "processor/siopm_operator_params.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_pcm_data.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/siopm_operator_params.h" +#include "chip/siopm_ref_table.h" +#include "chip/siopm_sound_chip.h" +#include "chip/wave/siopm_wave_pcm_data.h" +#include "chip/wave/siopm_wave_table.h" #include "utils/godot_util.h" const int SiOPMOperator::_eg_next_state_table[2][EG_MAX] = { @@ -431,8 +431,8 @@ void SiOPMOperator::set_pipes(SinglyLinkedList *p_out_pipe, SinglyLinkedLis _fm_shift = 15; _out_pipe = p_out_pipe; - _in_pipe = p_in_pipe ? p_in_pipe : _chip->get_zero_buffer(); - _base_pipe = (p_out_pipe != p_in_pipe) ? p_out_pipe : _chip->get_zero_buffer(); + _in_pipe = p_in_pipe ? p_in_pipe : _sound_chip->get_zero_buffer(); + _base_pipe = (p_out_pipe != p_in_pipe) ? p_out_pipe : _sound_chip->get_zero_buffer(); } // @@ -582,12 +582,12 @@ String SiOPMOperator::to_string() const { void SiOPMOperator::initialize() { // Reset operator connections. _final = true; - _in_pipe = _chip->get_zero_buffer(); - _base_pipe = _chip->get_zero_buffer(); + _in_pipe = _sound_chip->get_zero_buffer(); + _base_pipe = _sound_chip->get_zero_buffer(); _feed_pipe->value = 0; // Reset all parameters. - set_operator_params(_chip->get_init_operator_params()); + set_operator_params(_sound_chip->get_init_operator_params()); // Reset some other parameters. @@ -613,9 +613,9 @@ void SiOPMOperator::reset() { _phase = 0; } -SiOPMOperator::SiOPMOperator(SiOPMModule *p_chip) { +SiOPMOperator::SiOPMOperator(SiOPMSoundChip *p_chip) { _table = SiOPMRefTable::get_instance(); - _chip = p_chip; + _sound_chip = p_chip; _feed_pipe = SinglyLinkedList::alloc_ring(1); _eg_increment_table = make_vector(_table->eg_increment_tables[17]); diff --git a/src/processor/channels/siopm_operator.h b/src/chip/channels/siopm_operator.h similarity index 98% rename from src/processor/channels/siopm_operator.h rename to src/chip/channels/siopm_operator.h index 8792439..24fd2d2 100644 --- a/src/processor/channels/siopm_operator.h +++ b/src/chip/channels/siopm_operator.h @@ -13,9 +13,9 @@ using namespace godot; -class SiOPMModule; class SiOPMOperatorParams; class SiOPMRefTable; +class SiOPMSoundChip; class SiOPMWavePCMData; class SiOPMWaveTable; @@ -43,7 +43,7 @@ class SiOPMOperator { static const int _eg_next_state_table[2][EG_MAX]; SiOPMRefTable *_table = nullptr; - SiOPMModule *_chip = nullptr; + SiOPMSoundChip *_sound_chip = nullptr; // FM module parameters. @@ -316,7 +316,7 @@ class SiOPMOperator { void initialize(); void reset(); - SiOPMOperator(SiOPMModule *p_chip); + SiOPMOperator(SiOPMSoundChip *p_chip); ~SiOPMOperator() {} }; diff --git a/src/processor/siopm_channel_params.cpp b/src/chip/siopm_channel_params.cpp similarity index 97% rename from src/processor/siopm_channel_params.cpp rename to src/chip/siopm_channel_params.cpp index 3796417..dac993c 100644 --- a/src/processor/siopm_channel_params.cpp +++ b/src/chip/siopm_channel_params.cpp @@ -8,9 +8,9 @@ #include #include "sion_enums.h" -#include "processor/siopm_module.h" -#include "processor/siopm_operator_params.h" -#include "processor/siopm_ref_table.h" +#include "chip/siopm_operator_params.h" +#include "chip/siopm_ref_table.h" +#include "chip/siopm_sound_chip.h" #include "sequencer/base/mml_sequence.h" using namespace godot; @@ -168,7 +168,7 @@ void SiOPMChannelParams::initialize() { pitch_modulation_depth = 0; envelope_frequency_ratio = 100; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { master_volumes.write[i] = 0; } master_volumes.write[0] = 0.5; @@ -207,7 +207,7 @@ void SiOPMChannelParams::copy_from(SiOPMChannelParams *p_params) { pitch_modulation_depth = p_params->pitch_modulation_depth; envelope_frequency_ratio = p_params->envelope_frequency_ratio; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { master_volumes.write[i] = p_params->master_volumes[i]; } pan = p_params->pan; @@ -281,7 +281,7 @@ void SiOPMChannelParams::_bind_methods() { SiOPMChannelParams::SiOPMChannelParams() { init_sequence = memnew(MMLSequence); master_volumes.clear(); - master_volumes.resize_zeroed(SiOPMModule::STREAM_SEND_SIZE); + master_volumes.resize_zeroed(SiOPMSoundChip::STREAM_SEND_SIZE); operator_params.clear(); for (int i = 0; i < 4; i++) { diff --git a/src/processor/siopm_channel_params.h b/src/chip/siopm_channel_params.h similarity index 100% rename from src/processor/siopm_channel_params.h rename to src/chip/siopm_channel_params.h diff --git a/src/processor/siopm_operator_params.cpp b/src/chip/siopm_operator_params.cpp similarity index 97% rename from src/processor/siopm_operator_params.cpp rename to src/chip/siopm_operator_params.cpp index c4e1f64..fe49ad0 100644 --- a/src/processor/siopm_operator_params.cpp +++ b/src/chip/siopm_operator_params.cpp @@ -6,8 +6,8 @@ #include "siopm_operator_params.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/siopm_ref_table.h" +#include "chip/wave/siopm_wave_table.h" void SiOPMOperatorParams::set_pulse_generator_type(int p_type) { pulse_generator_type = p_type & 511; diff --git a/src/processor/siopm_operator_params.h b/src/chip/siopm_operator_params.h similarity index 100% rename from src/processor/siopm_operator_params.h rename to src/chip/siopm_operator_params.h diff --git a/src/processor/siopm_ref_table.cpp b/src/chip/siopm_ref_table.cpp similarity index 99% rename from src/processor/siopm_ref_table.cpp rename to src/chip/siopm_ref_table.cpp index 653de7a..7d08a6e 100644 --- a/src/processor/siopm_ref_table.cpp +++ b/src/chip/siopm_ref_table.cpp @@ -4,14 +4,14 @@ /* Provided under MIT */ /***************************************************/ -#include "processor/siopm_ref_table.h" +#include "chip/siopm_ref_table.h" #include #include -#include "processor/wave/siopm_wave_pcm_table.h" -#include "processor/wave/siopm_wave_sampler_data.h" -#include "processor/wave/siopm_wave_sampler_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/wave/siopm_wave_pcm_table.h" +#include "chip/wave/siopm_wave_sampler_data.h" +#include "chip/wave/siopm_wave_sampler_table.h" +#include "chip/wave/siopm_wave_table.h" #include "sequencer/simml_voice.h" using namespace godot; diff --git a/src/processor/siopm_ref_table.h b/src/chip/siopm_ref_table.h similarity index 100% rename from src/processor/siopm_ref_table.h rename to src/chip/siopm_ref_table.h diff --git a/src/processor/siopm_module.cpp b/src/chip/siopm_sound_chip.cpp similarity index 74% rename from src/processor/siopm_module.cpp rename to src/chip/siopm_sound_chip.cpp index 0525774..d47a8c6 100644 --- a/src/processor/siopm_module.cpp +++ b/src/chip/siopm_sound_chip.cpp @@ -4,36 +4,36 @@ /* Provided under MIT */ /***************************************************/ -#include "siopm_module.h" +#include "siopm_sound_chip.h" -#include "processor/channels/siopm_channel_manager.h" -#include "processor/siopm_operator_params.h" -#include "processor/siopm_stream.h" +#include "chip/channels/siopm_channel_manager.h" +#include "chip/siopm_operator_params.h" +#include "chip/siopm_stream.h" -Vector SiOPMModule::get_output_buffer() const { +Vector SiOPMSoundChip::get_output_buffer() const { return output_stream->get_buffer(); } -void SiOPMModule::set_output_buffer(Vector p_buffer) { +void SiOPMSoundChip::set_output_buffer(Vector p_buffer) { output_stream->set_buffer(p_buffer); } -int SiOPMModule::get_channel_count() const { +int SiOPMSoundChip::get_channel_count() const { return output_stream->get_channel_count(); } -SinglyLinkedList *SiOPMModule::get_pipe(int p_pipe_num, int p_index) { +SinglyLinkedList *SiOPMSoundChip::get_pipe(int p_pipe_num, int p_index) { ERR_FAIL_INDEX_V(p_pipe_num, _pipe_buffer_pager.size(), nullptr); ERR_FAIL_INDEX_V(p_index, _pipe_buffer_pager[p_pipe_num].size(), nullptr); return _pipe_buffer_pager[p_pipe_num][p_index]; } -void SiOPMModule::begin_process() { +void SiOPMSoundChip::begin_process() { output_stream->clear(); } -void SiOPMModule::end_process() { +void SiOPMSoundChip::end_process() { // Limit output level in the range between -1 ~ 1. output_stream->limit(); if (_bitrate != 0) { @@ -43,7 +43,7 @@ void SiOPMModule::end_process() { // -void SiOPMModule::initialize(int p_channel_count, int p_bitrate, int p_buffer_length) { +void SiOPMSoundChip::initialize(int p_channel_count, int p_bitrate, int p_buffer_length) { _bitrate = p_bitrate; // Reset stream slot. @@ -73,11 +73,11 @@ void SiOPMModule::initialize(int p_channel_count, int p_bitrate, int p_buffer_le SiOPMChannelManager::initialize_all_channels(); } -void SiOPMModule::reset() { +void SiOPMSoundChip::reset() { SiOPMChannelManager::reset_all_channels(); } -SiOPMModule::SiOPMModule() { +SiOPMSoundChip::SiOPMSoundChip() { init_operator_params = memnew(SiOPMOperatorParams); output_stream = memnew(SiOPMStream); diff --git a/src/processor/siopm_module.h b/src/chip/siopm_sound_chip.h similarity index 93% rename from src/processor/siopm_module.h rename to src/chip/siopm_sound_chip.h index 31a8b8a..c2e485c 100644 --- a/src/processor/siopm_module.h +++ b/src/chip/siopm_sound_chip.h @@ -4,8 +4,8 @@ /* Provided under MIT */ /***************************************************/ -#ifndef SIOPM_MODULE_H -#define SIOPM_MODULE_H +#ifndef SIOPM_SOUND_CHIP_H +#define SIOPM_SOUND_CHIP_H #include #include @@ -16,7 +16,7 @@ using namespace godot; class SiOPMOperatorParams; class SiOPMStream; -class SiOPMModule { +class SiOPMSoundChip { SiOPMOperatorParams *init_operator_params = nullptr; SinglyLinkedList *zero_buffer = nullptr; @@ -64,8 +64,8 @@ class SiOPMModule { void initialize(int p_channel_count, int p_bitrate, int p_buffer_length); void reset(); - SiOPMModule(); - ~SiOPMModule() {} + SiOPMSoundChip(); + ~SiOPMSoundChip() {} }; -#endif // SIOPM_MODULE_H +#endif // SIOPM_SOUND_CHIP_H diff --git a/src/processor/siopm_stream.cpp b/src/chip/siopm_stream.cpp similarity index 99% rename from src/processor/siopm_stream.cpp rename to src/chip/siopm_stream.cpp index bb5b9ad..b28b211 100644 --- a/src/processor/siopm_stream.cpp +++ b/src/chip/siopm_stream.cpp @@ -6,7 +6,7 @@ #include "siopm_stream.h" -#include "processor/siopm_ref_table.h" +#include "chip/siopm_ref_table.h" void SiOPMStream::resize(int p_length) { buffer.resize_zeroed(p_length); diff --git a/src/processor/siopm_stream.h b/src/chip/siopm_stream.h similarity index 100% rename from src/processor/siopm_stream.h rename to src/chip/siopm_stream.h diff --git a/src/processor/wave/SCsub b/src/chip/wave/SCsub similarity index 100% rename from src/processor/wave/SCsub rename to src/chip/wave/SCsub diff --git a/src/processor/wave/siopm_wave_base.cpp b/src/chip/wave/siopm_wave_base.cpp similarity index 100% rename from src/processor/wave/siopm_wave_base.cpp rename to src/chip/wave/siopm_wave_base.cpp diff --git a/src/processor/wave/siopm_wave_base.h b/src/chip/wave/siopm_wave_base.h similarity index 100% rename from src/processor/wave/siopm_wave_base.h rename to src/chip/wave/siopm_wave_base.h diff --git a/src/processor/wave/siopm_wave_pcm_data.cpp b/src/chip/wave/siopm_wave_pcm_data.cpp similarity index 99% rename from src/processor/wave/siopm_wave_pcm_data.cpp rename to src/chip/wave/siopm_wave_pcm_data.cpp index 308531a..b421367 100644 --- a/src/processor/wave/siopm_wave_pcm_data.cpp +++ b/src/chip/wave/siopm_wave_pcm_data.cpp @@ -8,7 +8,7 @@ #include #include "sion_enums.h" -#include "processor/siopm_ref_table.h" +#include "chip/siopm_ref_table.h" #include "utils/transformer_util.h" using namespace godot; diff --git a/src/processor/wave/siopm_wave_pcm_data.h b/src/chip/wave/siopm_wave_pcm_data.h similarity index 97% rename from src/processor/wave/siopm_wave_pcm_data.h rename to src/chip/wave/siopm_wave_pcm_data.h index 88c2ceb..ff5f118 100644 --- a/src/processor/wave/siopm_wave_pcm_data.h +++ b/src/chip/wave/siopm_wave_pcm_data.h @@ -9,7 +9,7 @@ #include #include -#include "processor/wave/siopm_wave_base.h" +#include "chip/wave/siopm_wave_base.h" using namespace godot; diff --git a/src/processor/wave/siopm_wave_pcm_table.cpp b/src/chip/wave/siopm_wave_pcm_table.cpp similarity index 99% rename from src/processor/wave/siopm_wave_pcm_table.cpp rename to src/chip/wave/siopm_wave_pcm_table.cpp index 8b3ff06..43bddd5 100644 --- a/src/processor/wave/siopm_wave_pcm_table.cpp +++ b/src/chip/wave/siopm_wave_pcm_table.cpp @@ -7,7 +7,7 @@ #include "siopm_wave_pcm_table.h" #include "sion_enums.h" -#include "processor/siopm_ref_table.h" +#include "chip/siopm_ref_table.h" SiOPMWavePCMData *SiOPMWavePCMTable::get_note_data(int p_note) const { ERR_FAIL_INDEX_V_MSG(p_note, _note_data_map.size(), nullptr, vformat("SiOPMWavePCMData: Trying to access note data for a note that doesn't exist (%d).", p_note)); diff --git a/src/processor/wave/siopm_wave_pcm_table.h b/src/chip/wave/siopm_wave_pcm_table.h similarity index 93% rename from src/processor/wave/siopm_wave_pcm_table.h rename to src/chip/wave/siopm_wave_pcm_table.h index 2ff146c..a880d3f 100644 --- a/src/processor/wave/siopm_wave_pcm_table.h +++ b/src/chip/wave/siopm_wave_pcm_table.h @@ -8,8 +8,8 @@ #define SIOPM_WAVE_PCM_TABLE_H #include -#include "processor/wave/siopm_wave_base.h" -#include "processor/wave/siopm_wave_pcm_data.h" +#include "chip/wave/siopm_wave_base.h" +#include "chip/wave/siopm_wave_pcm_data.h" using namespace godot; diff --git a/src/processor/wave/siopm_wave_sampler_data.cpp b/src/chip/wave/siopm_wave_sampler_data.cpp similarity index 100% rename from src/processor/wave/siopm_wave_sampler_data.cpp rename to src/chip/wave/siopm_wave_sampler_data.cpp diff --git a/src/processor/wave/siopm_wave_sampler_data.h b/src/chip/wave/siopm_wave_sampler_data.h similarity index 97% rename from src/processor/wave/siopm_wave_sampler_data.h rename to src/chip/wave/siopm_wave_sampler_data.h index 28af773..bb7c8c3 100644 --- a/src/processor/wave/siopm_wave_sampler_data.h +++ b/src/chip/wave/siopm_wave_sampler_data.h @@ -9,7 +9,7 @@ #include #include -#include "processor/wave/siopm_wave_base.h" +#include "chip/wave/siopm_wave_base.h" using namespace godot; diff --git a/src/processor/wave/siopm_wave_sampler_table.cpp b/src/chip/wave/siopm_wave_sampler_table.cpp similarity index 98% rename from src/processor/wave/siopm_wave_sampler_table.cpp rename to src/chip/wave/siopm_wave_sampler_table.cpp index ba7c702..c4985af 100644 --- a/src/processor/wave/siopm_wave_sampler_table.cpp +++ b/src/chip/wave/siopm_wave_sampler_table.cpp @@ -7,7 +7,7 @@ #include "siopm_wave_sampler_table.h" #include "sion_enums.h" -#include "processor/siopm_ref_table.h" +#include "chip/siopm_ref_table.h" SiOPMWaveSamplerData *SiOPMWaveSamplerTable::get_sample(int p_sample_number) const { if (_stencil && _stencil->_table[p_sample_number]) { diff --git a/src/processor/wave/siopm_wave_sampler_table.h b/src/chip/wave/siopm_wave_sampler_table.h similarity index 92% rename from src/processor/wave/siopm_wave_sampler_table.h rename to src/chip/wave/siopm_wave_sampler_table.h index e6e5696..6140992 100644 --- a/src/processor/wave/siopm_wave_sampler_table.h +++ b/src/chip/wave/siopm_wave_sampler_table.h @@ -8,8 +8,8 @@ #define SIOPM_WAVE_SAMPLER_TABLE_H #include -#include "processor/wave/siopm_wave_base.h" -#include "processor/wave/siopm_wave_sampler_data.h" +#include "chip/wave/siopm_wave_base.h" +#include "chip/wave/siopm_wave_sampler_data.h" using namespace godot; diff --git a/src/processor/wave/siopm_wave_table.cpp b/src/chip/wave/siopm_wave_table.cpp similarity index 97% rename from src/processor/wave/siopm_wave_table.cpp rename to src/chip/wave/siopm_wave_table.cpp index bb91c94..4e5cd25 100644 --- a/src/processor/wave/siopm_wave_table.cpp +++ b/src/chip/wave/siopm_wave_table.cpp @@ -8,7 +8,7 @@ #include #include "sion_enums.h" -#include "processor/siopm_ref_table.h" +#include "chip/siopm_ref_table.h" using namespace godot; diff --git a/src/processor/wave/siopm_wave_table.h b/src/chip/wave/siopm_wave_table.h similarity index 96% rename from src/processor/wave/siopm_wave_table.h rename to src/chip/wave/siopm_wave_table.h index 3f73e0c..618f1e7 100644 --- a/src/processor/wave/siopm_wave_table.h +++ b/src/chip/wave/siopm_wave_table.h @@ -10,7 +10,7 @@ #include #include #include "sion_enums.h" -#include "processor/wave/siopm_wave_base.h" +#include "chip/wave/siopm_wave_base.h" using namespace godot; diff --git a/src/effector/filters/si_controllable_filter_high_pass.cpp b/src/effector/filters/si_controllable_filter_high_pass.cpp index b6432b4..0a3d1f8 100644 --- a/src/effector/filters/si_controllable_filter_high_pass.cpp +++ b/src/effector/filters/si_controllable_filter_high_pass.cpp @@ -6,7 +6,7 @@ #include "si_controllable_filter_high_pass.h" -#include "processor/siopm_ref_table.h" +#include "chip/siopm_ref_table.h" void SiControllableFilterHighPass::_process_lfo(Vector *r_buffer, int p_start_index, int p_length) { double cutoff = SiOPMRefTable::get_instance()->filter_cutoff_table[_cutoff_index]; diff --git a/src/effector/filters/si_controllable_filter_low_pass.cpp b/src/effector/filters/si_controllable_filter_low_pass.cpp index ba267ee..4a1acac 100644 --- a/src/effector/filters/si_controllable_filter_low_pass.cpp +++ b/src/effector/filters/si_controllable_filter_low_pass.cpp @@ -6,7 +6,7 @@ #include "si_controllable_filter_low_pass.h" -#include "processor/siopm_ref_table.h" +#include "chip/siopm_ref_table.h" void SiControllableFilterLowPass::_process_lfo(Vector *r_buffer, int p_start_index, int p_length) { double cutoff = SiOPMRefTable::get_instance()->filter_cutoff_table[_cutoff_index]; diff --git a/src/effector/si_effect_stream.cpp b/src/effector/si_effect_stream.cpp index 3805ac1..8b7148b 100644 --- a/src/effector/si_effect_stream.cpp +++ b/src/effector/si_effect_stream.cpp @@ -8,9 +8,9 @@ #include #include -#include "effector/si_effector_module.h" -#include "processor/siopm_module.h" -#include "processor/siopm_stream.h" +#include "chip/siopm_sound_chip.h" +#include "chip/siopm_stream.h" +#include "effector/si_effector.h" int SiEffectStream::get_pan() const { return _pan - 64; @@ -25,13 +25,13 @@ bool SiEffectStream::is_outputting_directly() const { } void SiEffectStream::set_all_stream_send_levels(Vector p_param) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { int value = p_param[i]; _volumes.write[i] = value == INT32_MIN ? 0 : (value * 0.0078125); } _has_effect_send = false; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { _has_effect_send = true; } @@ -50,7 +50,7 @@ void SiEffectStream::set_stream_send(int p_stream_num, double p_volume) { } _has_effect_send = false; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { _has_effect_send = true; } @@ -90,11 +90,11 @@ int SiEffectStream::process(int p_start_idx, int p_length, bool p_write_in_strea if (p_write_in_stream) { if (_has_effect_send) { - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_volumes[i] > 0) { SiOPMStream *stream = _output_streams[i]; if (!stream) { - stream = _module->get_stream_slot(i); + stream = _sound_chip->get_stream_slot(i); } if (stream) { stream->write_from_vector(buffer, p_start_idx, p_start_idx, p_length, _volumes[i], _pan, 2); @@ -104,7 +104,7 @@ int SiEffectStream::process(int p_start_idx, int p_length, bool p_write_in_strea } else { SiOPMStream *stream = _output_streams[0]; if (!stream) { - stream = _module->get_output_stream(); + stream = _sound_chip->get_output_stream(); } stream->write_from_vector(buffer, p_start_idx, p_start_idx, p_length, _volumes[0], _pan, 2); } @@ -120,7 +120,7 @@ void SiEffectStream::_connect_effect(String p_cmd, Vector p_args, int p_ return; } - Ref effect = SiEffectorModule::get_effector_instance(p_cmd); + Ref effect = SiEffector::get_effect_instance(p_cmd); if (effect.is_valid()) { effect->set_by_mml(p_args); _chain.push_back(effect); @@ -141,8 +141,8 @@ void SiEffectStream::_set_volume(int p_slot, String p_cmd, Vector p_args set_stream_send(0, CLAMP(value, 0, 1)); int max_count = p_argc; - if ((max_count + p_slot) >= SiOPMModule::STREAM_SEND_SIZE) { - max_count = SiOPMModule::STREAM_SEND_SIZE - p_slot - 1; + if ((max_count + p_slot) >= SiOPMSoundChip::STREAM_SEND_SIZE) { + max_count = SiOPMSoundChip::STREAM_SEND_SIZE - p_slot - 1; } for (int i = 1; i < max_count; i++) { @@ -226,7 +226,7 @@ void SiEffectStream::initialize(int p_depth) { free(); reset(); - for (int i = 0; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 0; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { _volumes.write[i] = 0; _output_streams.write[i] = nullptr; } @@ -238,7 +238,7 @@ void SiEffectStream::initialize(int p_depth) { } void SiEffectStream::reset() { - _stream->resize(_module->get_buffer_length() << 1); + _stream->resize(_sound_chip->get_buffer_length() << 1); _stream->clear(); } @@ -249,14 +249,14 @@ void SiEffectStream::free() { _chain.clear(); } -SiEffectStream::SiEffectStream(SiOPMModule *p_module, SiOPMStream *p_stream) { - _module = p_module; +SiEffectStream::SiEffectStream(SiOPMSoundChip *p_chip, SiOPMStream *p_stream) { + _sound_chip = p_chip; if (p_stream) { _stream = p_stream; } else { _stream = memnew(SiOPMStream); } - _volumes.resize_zeroed(SiOPMModule::STREAM_SEND_SIZE); - _output_streams.resize_zeroed(SiOPMModule::STREAM_SEND_SIZE); + _volumes.resize_zeroed(SiOPMSoundChip::STREAM_SEND_SIZE); + _output_streams.resize_zeroed(SiOPMSoundChip::STREAM_SEND_SIZE); } diff --git a/src/effector/si_effect_stream.h b/src/effector/si_effect_stream.h index 65f87e1..1bdc666 100644 --- a/src/effector/si_effect_stream.h +++ b/src/effector/si_effect_stream.h @@ -14,12 +14,12 @@ using namespace godot; -class SiOPMModule; +class SiOPMSoundChip; class SiOPMStream; class SiEffectStream { - SiOPMModule *_module = nullptr; + SiOPMSoundChip *_sound_chip = nullptr; List> _chain; SiOPMStream *_stream = nullptr; @@ -61,8 +61,8 @@ class SiEffectStream { void reset(); void free(); - // Prefer creating effect streams via SiEffectModule. - SiEffectStream(SiOPMModule *p_module, SiOPMStream *p_stream = nullptr); + // Prefer creating effect streams via SiEffector. + SiEffectStream(SiOPMSoundChip *p_chip, SiOPMStream *p_stream = nullptr); ~SiEffectStream() {} }; diff --git a/src/effector/si_effector_module.cpp b/src/effector/si_effector.cpp similarity index 54% rename from src/effector/si_effector_module.cpp rename to src/effector/si_effector.cpp index a2530ac..630e43d 100644 --- a/src/effector/si_effector_module.cpp +++ b/src/effector/si_effector.cpp @@ -4,12 +4,12 @@ /* Provided under MIT */ /***************************************************/ -#include "si_effector_module.h" +#include "si_effector.h" #include +#include "chip/siopm_sound_chip.h" +#include "chip/siopm_stream.h" #include "effector/si_effect_stream.h" -#include "processor/siopm_module.h" -#include "processor/siopm_stream.h" #include "templates/type_constraints.h" #include "effector/effects/si_effect_autopan.h" @@ -35,20 +35,20 @@ #include "effector/filters/si_filter_peak.h" #include "effector/filters/si_filter_vowel.h" -HashMap>> SiEffectorModule::_effect_instances; +HashMap>> SiEffector::_effect_instances; // Effects. template -void SiEffectorModule::register_effector(const String &p_name) { +void SiEffector::register_effect(const String &p_name) { derived_from(); // Compile-time check: Only accept SiEffectBase derivatives. // We don't actually use the type here, as that would make it incompatible with the collection. _effect_instances[p_name] = List>(); } -Ref SiEffectorModule::get_effector_instance(const String &p_name) { - ERR_FAIL_COND_V_MSG(!_effect_instances.has(p_name), Ref(), vformat("SiEffectorModule: Effect called '%s' does not exist.", p_name)); +Ref SiEffector::get_effect_instance(const String &p_name) { + ERR_FAIL_COND_V_MSG(!_effect_instances.has(p_name), Ref(), vformat("SiEffector: Effect called '%s' does not exist.", p_name)); List> instances = _effect_instances[p_name]; @@ -66,46 +66,46 @@ Ref SiEffectorModule::get_effector_instance(const String &p_name) // Failing above we allocate a new one. // FIXME: Maybe there is a better way to do it, but templates, the most obvious choice, didn't prove to be helpful. -#define CREATE_EFFECTOR(m_type, m_name) \ - if (p_name == m_name) { \ - Ref effect = create_effector_instance(); \ - instances.push_back(effect); \ - return effect; \ +#define CREATE_EFFECT(m_type, m_name) \ + if (p_name == m_name) { \ + Ref effect = create_effect_instance(); \ + instances.push_back(effect); \ + return effect; \ } - CREATE_EFFECTOR(SiEffectAutopan, "autopan"); - CREATE_EFFECTOR(SiEffectCompressor, "comp"); - CREATE_EFFECTOR(SiEffectDistortion, "dist"); - CREATE_EFFECTOR(SiEffectDownsampler, "ds"); - CREATE_EFFECTOR(SiEffectEqualizer, "eq"); - CREATE_EFFECTOR(SiEffectSpeakerSimulator, "speaker"); - CREATE_EFFECTOR(SiEffectStereoChorus, "chorus"); - CREATE_EFFECTOR(SiEffectStereoDelay, "delay"); - CREATE_EFFECTOR(SiEffectStereoExpander, "stereo"); - CREATE_EFFECTOR(SiEffectStereoReverb, "reverb"); - CREATE_EFFECTOR(SiEffectWaveShaper, "ws"); - - CREATE_EFFECTOR(SiFilterAllPass, "af"); - CREATE_EFFECTOR(SiFilterBandPass, "bf"); - CREATE_EFFECTOR(SiFilterHighBoost, "hb"); - CREATE_EFFECTOR(SiFilterHighPass, "hf"); - CREATE_EFFECTOR(SiFilterLowBoost, "lb"); - CREATE_EFFECTOR(SiFilterLowPass, "lf"); - CREATE_EFFECTOR(SiFilterNotch, "nf"); - CREATE_EFFECTOR(SiFilterPeak, "pf"); - CREATE_EFFECTOR(SiFilterVowel, "vowel"); - - CREATE_EFFECTOR(SiControllableFilterHighPass, "nhf"); - CREATE_EFFECTOR(SiControllableFilterLowPass, "nlf"); - -#undef CREATE_EFFECTOR - - // This should only be possible if custom effectors are registered outside of the class. + CREATE_EFFECT(SiEffectAutopan, "autopan"); + CREATE_EFFECT(SiEffectCompressor, "comp"); + CREATE_EFFECT(SiEffectDistortion, "dist"); + CREATE_EFFECT(SiEffectDownsampler, "ds"); + CREATE_EFFECT(SiEffectEqualizer, "eq"); + CREATE_EFFECT(SiEffectSpeakerSimulator, "speaker"); + CREATE_EFFECT(SiEffectStereoChorus, "chorus"); + CREATE_EFFECT(SiEffectStereoDelay, "delay"); + CREATE_EFFECT(SiEffectStereoExpander, "stereo"); + CREATE_EFFECT(SiEffectStereoReverb, "reverb"); + CREATE_EFFECT(SiEffectWaveShaper, "ws"); + + CREATE_EFFECT(SiFilterAllPass, "af"); + CREATE_EFFECT(SiFilterBandPass, "bf"); + CREATE_EFFECT(SiFilterHighBoost, "hb"); + CREATE_EFFECT(SiFilterHighPass, "hf"); + CREATE_EFFECT(SiFilterLowBoost, "lb"); + CREATE_EFFECT(SiFilterLowPass, "lf"); + CREATE_EFFECT(SiFilterNotch, "nf"); + CREATE_EFFECT(SiFilterPeak, "pf"); + CREATE_EFFECT(SiFilterVowel, "vowel"); + + CREATE_EFFECT(SiControllableFilterHighPass, "nhf"); + CREATE_EFFECT(SiControllableFilterLowPass, "nlf"); + +#undef CREATE_EFFECT + + // This should only be possible if custom effects are registered outside of the class. return Ref(); } template -Ref SiEffectorModule::create_effector_instance() { +Ref SiEffector::create_effect_instance() { Ref effect; effect.instantiate(); @@ -116,44 +116,44 @@ Ref SiEffectorModule::create_effector_instance() { // Slots and connections. -SiEffectStream *SiEffectorModule::_get_global_effector(int p_slot) { +SiEffectStream *SiEffector::_get_global_stream(int p_slot) { if (_global_effects[p_slot] == nullptr) { SiEffectStream *effect = _alloc_stream(0); _global_effects.write[p_slot] = effect; - _module->set_stream_slot(p_slot, effect->get_stream()); + _sound_chip->set_stream_slot(p_slot, effect->get_stream()); _global_effect_count++; } return _global_effects[p_slot]; } -SiEffectStream *SiEffectorModule::_alloc_stream(int p_depth) { +SiEffectStream *SiEffector::_alloc_stream(int p_depth) { SiEffectStream *effect = nullptr; if (!_free_effect_streams.is_empty()) { effect = _free_effect_streams.front()->get(); _free_effect_streams.pop_front(); } else { - effect = memnew(SiEffectStream(_module)); + effect = memnew(SiEffectStream(_sound_chip)); } effect->initialize(p_depth); return effect; } -List> SiEffectorModule::get_slot_effect_list(int p_slot) const { +List> SiEffector::get_slot_effect_list(int p_slot) const { if (!_global_effects[p_slot]) { return List>(); } return _global_effects[p_slot]->get_chain(); } -void SiEffectorModule::set_slot_effect_list(int p_slot, List> p_effects) { - SiEffectStream *effect = _get_global_effector(p_slot); +void SiEffector::set_slot_effect_list(int p_slot, List> p_effects) { + SiEffectStream *effect = _get_global_stream(p_slot); effect->set_chain(p_effects); effect->prepare_process(); } -void SiEffectorModule::clear_slot(int p_slot) { +void SiEffector::clear_slot(int p_slot) { if (p_slot == 0) { _master_effect->initialize(0); } else { @@ -165,13 +165,13 @@ void SiEffectorModule::clear_slot(int p_slot) { } } -void SiEffectorModule::connect_effector(int p_slot, const Ref &p_effector) { - SiEffectStream *effect = _get_global_effector(p_slot); - effect->get_chain().push_back(p_effector); - p_effector->prepare_process(); +void SiEffector::connect_effect(int p_slot, const Ref &p_effect) { + SiEffectStream *effect = _get_global_stream(p_slot); + effect->get_chain().push_back(p_effect); + p_effect->prepare_process(); } -SiEffectStream *SiEffectorModule::create_local_effect(int p_depth, List> p_effects) { +SiEffectStream *SiEffector::create_local_effect(int p_depth, List> p_effects) { SiEffectStream *effect = _alloc_stream(p_depth); effect->set_chain(p_effects); effect->prepare_process(); @@ -192,30 +192,30 @@ SiEffectStream *SiEffectorModule::create_local_effect(int p_depth, Listfree(); _free_effect_streams.push_back(p_effect); } -void SiEffectorModule::parse_global_effect_mml(int p_slot, String p_mml, String p_postfix) { - SiEffectStream *effect = _get_global_effector(p_slot); +void SiEffector::parse_global_effect_mml(int p_slot, String p_mml, String p_postfix) { + SiEffectStream *effect = _get_global_stream(p_slot); effect->parse_mml(p_slot, p_mml, p_postfix); } // Processing. -void SiEffectorModule::prepare_process() { +void SiEffector::prepare_process() { // Do nothing with local effects. _global_effect_count = 0; - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { - _module->set_stream_slot(i, nullptr); // Reset module's stream slot. + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { + _sound_chip->set_stream_slot(i, nullptr); // Reset sound chip's stream slot. if (_global_effects[i] != nullptr) { int channel_count = _global_effects[i]->prepare_process(); if (channel_count > 0) { - _module->set_stream_slot(i, _global_effects[i]->get_stream()); + _sound_chip->set_stream_slot(i, _global_effects[i]->get_stream()); _global_effect_count++; } } @@ -224,54 +224,54 @@ void SiEffectorModule::prepare_process() { _master_effect->prepare_process(); } -void SiEffectorModule::begin_process() { +void SiEffector::begin_process() { // Do nothing with the master effect. for (SiEffectStream *effect : _local_effects) { effect->get_stream()->clear(); } - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_global_effects[i] != nullptr) { _global_effects[i]->get_stream()->clear(); } } } -void SiEffectorModule::end_process() { +void SiEffector::end_process() { for (SiEffectStream *effect : _local_effects) { - effect->process(0, _module->get_buffer_length()); + effect->process(0, _sound_chip->get_buffer_length()); } - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_global_effects[i] != nullptr) { SiEffectStream *effect = _global_effects[i]; if (effect->is_outputting_directly()) { - effect->process(0, _module->get_buffer_length(), false); + effect->process(0, _sound_chip->get_buffer_length(), false); // TODO: Is this the best way to do this — to copy the buffer over? Vector buffer = effect->get_stream()->get_buffer(); - Vector output = _module->get_output_buffer(); + Vector output = _sound_chip->get_output_buffer(); for (int j = 0; j < output.size(); j++) { output.write[j] += buffer[j]; } - _module->set_output_buffer(output); + _sound_chip->set_output_buffer(output); } else { - effect->process(0, _module->get_buffer_length(), true); + effect->process(0, _sound_chip->get_buffer_length(), true); } } } - _master_effect->process(0, _module->get_buffer_length(), false); + _master_effect->process(0, _sound_chip->get_buffer_length(), false); } -void SiEffectorModule::reset() { +void SiEffector::reset() { for (SiEffectStream *effect : _local_effects) { effect->reset(); } - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_global_effects[i] != nullptr) { _global_effects[i]->reset(); } @@ -284,16 +284,16 @@ void SiEffectorModule::reset() { // // This function is called from SiONDriver::play() when its 2nd argument is set to true. -// If you want to connect effectors by code, you have to call this first, then call connect(), +// If you want to connect effects by code, you have to call this first, then call connect_effect(), // and then SiONDriver::play() with the 2nd argument set to false. -void SiEffectorModule::initialize() { +void SiEffector::initialize() { for (SiEffectStream *effect : _local_effects) { effect->free(); _free_effect_streams.push_back(effect); } _local_effects.clear(); - for (int i = 1; i < SiOPMModule::STREAM_SEND_SIZE; i++) { + for (int i = 1; i < SiOPMSoundChip::STREAM_SEND_SIZE; i++) { if (_global_effects[i] != nullptr) { _global_effects[i]->free(); _free_effect_streams.push_back(_global_effects[i]); @@ -306,38 +306,38 @@ void SiEffectorModule::initialize() { _global_effects.write[0] = _master_effect; } -SiEffectorModule::SiEffectorModule(SiOPMModule *p_module) { - _module = p_module; +SiEffector::SiEffector(SiOPMSoundChip *p_chip) { + _sound_chip = p_chip; - _master_effect = memnew(SiEffectStream(_module, _module->get_output_stream())); - _global_effects.resize_zeroed(SiOPMModule::STREAM_SEND_SIZE); + _master_effect = memnew(SiEffectStream(_sound_chip, _sound_chip->get_output_stream())); + _global_effects.resize_zeroed(SiOPMSoundChip::STREAM_SEND_SIZE); _global_effects.write[0] = _master_effect; // Register default effect instances. // FIXME: Implement all effects and filters. - register_effector("autopan"); - register_effector("comp"); - register_effector("dist"); - register_effector("ds"); - register_effector("eq"); - register_effector("speaker"); - register_effector("chorus"); - register_effector("delay"); - register_effector("stereo"); - register_effector("reverb"); - register_effector("ws"); - - register_effector("af"); - register_effector("bf"); - register_effector("hb"); - register_effector("hf"); - register_effector("lb"); - register_effector("lf"); - register_effector("nf"); - register_effector("pf"); - register_effector("vowel"); - - register_effector("nhf"); - register_effector("nlf"); + register_effect("autopan"); + register_effect("comp"); + register_effect("dist"); + register_effect("ds"); + register_effect("eq"); + register_effect("speaker"); + register_effect("chorus"); + register_effect("delay"); + register_effect("stereo"); + register_effect("reverb"); + register_effect("ws"); + + register_effect("af"); + register_effect("bf"); + register_effect("hb"); + register_effect("hf"); + register_effect("lb"); + register_effect("lf"); + register_effect("nf"); + register_effect("pf"); + register_effect("vowel"); + + register_effect("nhf"); + register_effect("nlf"); } diff --git a/src/effector/si_effector_module.h b/src/effector/si_effector.h similarity index 79% rename from src/effector/si_effector_module.h rename to src/effector/si_effector.h index 8fa87fd..d1b889e 100644 --- a/src/effector/si_effector_module.h +++ b/src/effector/si_effector.h @@ -4,8 +4,8 @@ /* Provided under MIT */ /***************************************************/ -#ifndef SI_EFFECTOR_MODULE_H -#define SI_EFFECTOR_MODULE_H +#ifndef SI_EFFECTOR_H +#define SI_EFFECTOR_H #include #include @@ -15,22 +15,22 @@ using namespace godot; class SiEffectStream; -class SiOPMModule; +class SiOPMSoundChip; -class SiEffectorModule { +class SiEffector { static HashMap>> _effect_instances; - SiOPMModule *_module = nullptr; + SiOPMSoundChip *_sound_chip = nullptr; SiEffectStream *_master_effect = nullptr;; List _free_effect_streams; Vector _local_effects; - // Expected to be SiOPMModule::STREAM_SEND_SIZE at most. + // Expected to be SiOPMSoundChip::STREAM_SEND_SIZE at most. Vector _global_effects; int _global_effect_count = 0; - SiEffectStream *_get_global_effector(int p_slot); + SiEffectStream *_get_global_stream(int p_slot); SiEffectStream *_alloc_stream(int p_depth); public: @@ -39,10 +39,10 @@ class SiEffectorModule { int get_global_effect_count() const { return _global_effect_count; } template - static void register_effector(const String &p_name); - static Ref get_effector_instance(const String &p_name); + static void register_effect(const String &p_name); + static Ref get_effect_instance(const String &p_name); template - static Ref create_effector_instance(); + static Ref create_effect_instance(); // Slots and connections. @@ -59,7 +59,7 @@ class SiEffectorModule { void set_slot_effect_list(int p_slot, List> p_effects); void clear_slot(int p_slot); - void connect_effector(int p_slot, const Ref &p_effector); + void connect_effect(int p_slot, const Ref &p_effect); SiEffectStream *create_local_effect(int p_depth, List> p_effects); void delete_local_effect(SiEffectStream *p_effect); @@ -77,8 +77,8 @@ class SiEffectorModule { void initialize(); - SiEffectorModule(SiOPMModule *p_module); - ~SiEffectorModule() {} + SiEffector(SiOPMSoundChip *p_chip); + ~SiEffector() {} }; -#endif // SI_EFFECTOR_MODULE_H +#endif // SI_EFFECTOR_H diff --git a/src/events/sion_track_event.cpp b/src/events/sion_track_event.cpp index 544e8d9..ad59833 100644 --- a/src/events/sion_track_event.cpp +++ b/src/events/sion_track_event.cpp @@ -8,7 +8,7 @@ #include "sion_data.h" #include "sion_driver.h" -#include "processor/channels/siopm_channel_base.h" +#include "chip/channels/siopm_channel_base.h" #include "sequencer/simml_track.h" #include "sequencer/simml_sequencer.h" diff --git a/src/register_types.cpp b/src/register_types.cpp index 116bf69..8323ce9 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -14,6 +14,19 @@ #include "sion_driver.h" #include "sion_voice.h" +#include "chip/channels/siopm_channel_base.h" +#include "chip/channels/siopm_channel_fm.h" +#include "chip/channels/siopm_channel_ks.h" +#include "chip/channels/siopm_channel_pcm.h" +#include "chip/channels/siopm_channel_sampler.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_ref_table.h" +#include "chip/wave/siopm_wave_base.h" +#include "chip/wave/siopm_wave_pcm_data.h" +#include "chip/wave/siopm_wave_pcm_table.h" +#include "chip/wave/siopm_wave_sampler_data.h" +#include "chip/wave/siopm_wave_sampler_table.h" +#include "chip/wave/siopm_wave_table.h" #include "effector/effects/si_effect_autopan.h" #include "effector/effects/si_effect_compressor.h" #include "effector/effects/si_effect_distortion.h" @@ -42,19 +55,6 @@ #include "effector/si_effect_composite.h" #include "events/sion_event.h" #include "events/sion_track_event.h" -#include "processor/channels/siopm_channel_base.h" -#include "processor/channels/siopm_channel_fm.h" -#include "processor/channels/siopm_channel_ks.h" -#include "processor/channels/siopm_channel_pcm.h" -#include "processor/channels/siopm_channel_sampler.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_base.h" -#include "processor/wave/siopm_wave_pcm_data.h" -#include "processor/wave/siopm_wave_pcm_table.h" -#include "processor/wave/siopm_wave_sampler_data.h" -#include "processor/wave/siopm_wave_sampler_table.h" -#include "processor/wave/siopm_wave_table.h" #include "sequencer/base/beats_per_minute.h" #include "sequencer/base/mml_data.h" #include "sequencer/base/mml_event.h" diff --git a/src/sequencer/base/mml_executor_connector.cpp b/src/sequencer/base/mml_executor_connector.cpp index f807073..59ed00f 100644 --- a/src/sequencer/base/mml_executor_connector.cpp +++ b/src/sequencer/base/mml_executor_connector.cpp @@ -8,7 +8,7 @@ #include #include -#include "processor/channels/siopm_channel_base.h" +#include "chip/channels/siopm_channel_base.h" #include "sequencer/base/mml_event.h" #include "sequencer/base/mml_sequence.h" #include "sequencer/base/mml_sequence_group.h" diff --git a/src/sequencer/simml_channel_settings.cpp b/src/sequencer/simml_channel_settings.cpp index 5283495..7302927 100644 --- a/src/sequencer/simml_channel_settings.cpp +++ b/src/sequencer/simml_channel_settings.cpp @@ -6,10 +6,10 @@ #include "simml_channel_settings.h" -#include "processor/channels/siopm_channel_base.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/channels/siopm_channel_base.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_ref_table.h" +#include "chip/wave/siopm_wave_table.h" #include "sequencer/base/mml_sequence.h" #include "sequencer/simml_ref_table.h" #include "sequencer/simml_track.h" diff --git a/src/sequencer/simml_channel_settings.h b/src/sequencer/simml_channel_settings.h index bc9abdc..3d5954d 100644 --- a/src/sequencer/simml_channel_settings.h +++ b/src/sequencer/simml_channel_settings.h @@ -9,7 +9,7 @@ #include #include "sion_enums.h" -#include "processor/channels/siopm_channel_manager.h" +#include "chip/channels/siopm_channel_manager.h" using namespace godot; diff --git a/src/sequencer/simml_data.cpp b/src/sequencer/simml_data.cpp index f6e6625..5486203 100644 --- a/src/sequencer/simml_data.cpp +++ b/src/sequencer/simml_data.cpp @@ -6,10 +6,10 @@ #include "simml_data.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_pcm_table.h" -#include "processor/wave/siopm_wave_sampler_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/siopm_ref_table.h" +#include "chip/wave/siopm_wave_pcm_table.h" +#include "chip/wave/siopm_wave_sampler_table.h" +#include "chip/wave/siopm_wave_table.h" #include "sequencer/simml_envelope_table.h" #include "sequencer/simml_ref_table.h" #include "sequencer/simml_voice.h" diff --git a/src/sequencer/simml_ref_table.cpp b/src/sequencer/simml_ref_table.cpp index e63435d..9d7cd88 100644 --- a/src/sequencer/simml_ref_table.cpp +++ b/src/sequencer/simml_ref_table.cpp @@ -10,10 +10,10 @@ #include #include "sion_enums.h" #include "sion_voice.h" -#include "processor/channels/siopm_channel_manager.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_operator_params.h" -#include "processor/siopm_ref_table.h" +#include "chip/channels/siopm_channel_manager.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_operator_params.h" +#include "chip/siopm_ref_table.h" #include "sequencer/simml_channel_settings.h" #include "sequencer/simml_envelope_table.h" #include "sequencer/simulator/simml_simulator_base.h" diff --git a/src/sequencer/simml_sequencer.cpp b/src/sequencer/simml_sequencer.cpp index 0c3886b..4164885 100644 --- a/src/sequencer/simml_sequencer.cpp +++ b/src/sequencer/simml_sequencer.cpp @@ -11,13 +11,13 @@ #include #include #include "sion_enums.h" -#include "processor/channels/siopm_channel_base.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_module.h" -#include "processor/siopm_operator_params.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_base.h" -#include "processor/wave/siopm_wave_pcm_table.h" +#include "chip/channels/siopm_channel_base.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_operator_params.h" +#include "chip/siopm_ref_table.h" +#include "chip/siopm_sound_chip.h" +#include "chip/wave/siopm_wave_base.h" +#include "chip/wave/siopm_wave_pcm_table.h" #include "sequencer/base/mml_executor.h" #include "sequencer/base/mml_executor_connector.h" #include "sequencer/base/mml_parser.h" @@ -367,7 +367,7 @@ void SiMMLSequencer::_on_tempo_changed(double p_tempo_ratio) { } void SiMMLSequencer::process_dummy(int p_sample_count) { - int buffer_count = p_sample_count / _module->get_buffer_length(); + int buffer_count = p_sample_count / _sound_chip->get_buffer_length(); if (buffer_count == 0) { return; } @@ -458,7 +458,7 @@ void SiMMLSequencer::process() { _bpm = _adjustible_bpm; _current_track = nullptr; - _processed_sample_count += _module->get_buffer_length(); + _processed_sample_count += _sound_chip->get_buffer_length(); _is_sequence_finished = finished; } @@ -1251,7 +1251,7 @@ MMLEvent *SiMMLSequencer::_on_mml_volume_shift(MMLEvent *p_event) { } MMLEvent *SiMMLSequencer::_on_mml_volume_setting(MMLEvent *p_event) { - GET_EV_PARAMS(SiOPMModule::STREAM_SEND_SIZE); + GET_EV_PARAMS(SiOPMSoundChip::STREAM_SEND_SIZE); BIND_EV_PARAM(velocity_mode, 0, 0); BIND_EV_PARAM(velocity_shift, 1, 4); @@ -1283,7 +1283,7 @@ MMLEvent *SiMMLSequencer::_on_mml_expression_setting(MMLEvent *p_event) { } MMLEvent *SiMMLSequencer::_on_mml_master_volume(MMLEvent *p_event) { - GET_EV_PARAMS(SiOPMModule::STREAM_SEND_SIZE); + GET_EV_PARAMS(SiOPMSoundChip::STREAM_SEND_SIZE); if (_current_track->get_event_mask() & SiMMLTrack::MASK_VOLUME) { return next_event->next; // Check the mask. @@ -1639,7 +1639,7 @@ void SiMMLSequencer::_register_event_listeners() { } void SiMMLSequencer::_reset_initial_operator_params() { - SiOPMOperatorParams *op_params = _module->get_init_operator_params(); + SiOPMOperatorParams *op_params = _sound_chip->get_init_operator_params(); op_params->set_attack_rate(63); op_params->set_decay_rate(0); @@ -1735,10 +1735,10 @@ void SiMMLSequencer::_bind_methods() { ClassDB::bind_method(D_METHOD("_on_mml_register_update", "event"), &SiMMLSequencer::_on_mml_register_update); } -SiMMLSequencer::SiMMLSequencer(SiOPMModule *p_module) : +SiMMLSequencer::SiMMLSequencer(SiOPMSoundChip *p_chip) : MMLSequencer() { _table = SiMMLRefTable::get_instance(); - _module = p_module; + _sound_chip = p_chip; _connector = memnew(MMLExecutorConnector); _macro_strings.resize_zeroed(MACRO_SIZE); diff --git a/src/sequencer/simml_sequencer.h b/src/sequencer/simml_sequencer.h index 6442366..35df321 100644 --- a/src/sequencer/simml_sequencer.h +++ b/src/sequencer/simml_sequencer.h @@ -18,9 +18,9 @@ class MMLSequenceGroup; class SiMMLRefTable; class SiMMLTrack; class SiOPMChannelParams; -class SiOPMModule; +class SiOPMSoundChip; -// The SiMMLSequencer operates SiOPMModule by MML. +// The SiMMLSequencer operates SiOPMSoundChip by MML. // SiMMLSequencer -> SiMMLTrack -> SiOPMChannelFM -> SiOPMOperator. (-> means "operates") class SiMMLSequencer : public MMLSequencer { GDCLASS(SiMMLSequencer, MMLSequencer) @@ -30,7 +30,7 @@ class SiMMLSequencer : public MMLSequencer { static const int DEFAULT_MAX_TRACK_COUNT = 128; SiMMLRefTable *_table = nullptr; - SiOPMModule *_module = nullptr; + SiOPMSoundChip *_sound_chip = nullptr; MMLExecutorConnector *_connector = nullptr; String _title; @@ -236,7 +236,7 @@ class SiMMLSequencer : public MMLSequencer { // - SiMMLSequencer(SiOPMModule *p_module = nullptr); + SiMMLSequencer(SiOPMSoundChip *p_chip = nullptr); ~SiMMLSequencer() {} }; diff --git a/src/sequencer/simml_track.cpp b/src/sequencer/simml_track.cpp index f661b91..2fe6358 100644 --- a/src/sequencer/simml_track.cpp +++ b/src/sequencer/simml_track.cpp @@ -8,10 +8,10 @@ #include #include "sion_enums.h" -#include "processor/channels/siopm_channel_base.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_sampler_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/channels/siopm_channel_base.h" +#include "chip/siopm_ref_table.h" +#include "chip/wave/siopm_wave_sampler_table.h" +#include "chip/wave/siopm_wave_table.h" #include "sequencer/base/mml_executor.h" #include "sequencer/base/mml_sequence.h" #include "sequencer/simml_channel_settings.h" diff --git a/src/sequencer/simml_voice.cpp b/src/sequencer/simml_voice.cpp index c057c3a..4d4cb24 100644 --- a/src/sequencer/simml_voice.cpp +++ b/src/sequencer/simml_voice.cpp @@ -11,13 +11,13 @@ #include #include "sion_enums.h" -#include "processor/channels/siopm_channel_base.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_operator_params.h" -#include "processor/wave/siopm_wave_pcm_data.h" -#include "processor/wave/siopm_wave_pcm_table.h" -#include "processor/wave/siopm_wave_sampler_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/channels/siopm_channel_base.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_operator_params.h" +#include "chip/wave/siopm_wave_pcm_data.h" +#include "chip/wave/siopm_wave_pcm_table.h" +#include "chip/wave/siopm_wave_sampler_table.h" +#include "chip/wave/siopm_wave_table.h" #include "sequencer/simml_envelope_table.h" #include "sequencer/simml_ref_table.h" #include "sequencer/simml_track.h" diff --git a/src/sequencer/simulator/simml_simulator_base.cpp b/src/sequencer/simulator/simml_simulator_base.cpp index d5b9040..8955a54 100644 --- a/src/sequencer/simulator/simml_simulator_base.cpp +++ b/src/sequencer/simulator/simml_simulator_base.cpp @@ -7,8 +7,8 @@ #include "simml_simulator_base.h" #include "sion_enums.h" -#include "processor/channels/siopm_channel_base.h" -#include "processor/channels/siopm_channel_manager.h" +#include "chip/channels/siopm_channel_base.h" +#include "chip/channels/siopm_channel_manager.h" #include "sequencer/base/mml_sequence.h" #include "sequencer/simml_track.h" #include "sequencer/simulator/simml_simulator_voice.h" diff --git a/src/sequencer/simulator/simml_simulator_base_fm.cpp b/src/sequencer/simulator/simml_simulator_base_fm.cpp index b48aab5..6f95a99 100644 --- a/src/sequencer/simulator/simml_simulator_base_fm.cpp +++ b/src/sequencer/simulator/simml_simulator_base_fm.cpp @@ -6,8 +6,8 @@ #include "simml_simulator_base_fm.h" -#include "processor/channels/siopm_channel_base.h" -#include "processor/siopm_channel_params.h" +#include "chip/channels/siopm_channel_base.h" +#include "chip/siopm_channel_params.h" #include "sequencer/base/mml_sequence.h" #include "sequencer/simml_track.h" #include "sequencer/simml_voice.h" diff --git a/src/sequencer/simulator/simml_simulator_pcm.cpp b/src/sequencer/simulator/simml_simulator_pcm.cpp index 2c664dc..aef53af 100644 --- a/src/sequencer/simulator/simml_simulator_pcm.cpp +++ b/src/sequencer/simulator/simml_simulator_pcm.cpp @@ -7,7 +7,7 @@ #include "simml_simulator_pcm.h" #include "sion_enums.h" -#include "processor/channels/siopm_channel_manager.h" +#include "chip/channels/siopm_channel_manager.h" SiMMLSimulatorPCM::SiMMLSimulatorPCM() : SiMMLSimulatorBase(MT_PCM, 1, memnew(SiMMLSimulatorVoiceSet(SiOPMChannelManager::CT_CHANNEL_PCM, 1, PG_PCM)), false) { diff --git a/src/sequencer/simulator/simml_simulator_sampler.cpp b/src/sequencer/simulator/simml_simulator_sampler.cpp index 4d8d5b9..3107451 100644 --- a/src/sequencer/simulator/simml_simulator_sampler.cpp +++ b/src/sequencer/simulator/simml_simulator_sampler.cpp @@ -7,7 +7,7 @@ #include "simml_simulator_sampler.h" #include "sion_enums.h" -#include "processor/channels/siopm_channel_manager.h" +#include "chip/channels/siopm_channel_manager.h" SiMMLSimulatorSampler::SiMMLSimulatorSampler() : SiMMLSimulatorBase(MT_SAMPLE, 1, memnew(SiMMLSimulatorVoiceSet(SiOPMChannelManager::CT_CHANNEL_SAMPLER, 1, 0)), false) { diff --git a/src/sequencer/simulator/simml_simulator_voice_set.cpp b/src/sequencer/simulator/simml_simulator_voice_set.cpp index 2505abe..0406ce3 100644 --- a/src/sequencer/simulator/simml_simulator_voice_set.cpp +++ b/src/sequencer/simulator/simml_simulator_voice_set.cpp @@ -6,8 +6,8 @@ #include "simml_simulator_voice_set.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/siopm_ref_table.h" +#include "chip/wave/siopm_wave_table.h" #include "sequencer/simml_channel_settings.h" int SiMMLSimulatorVoiceSet::get_voices_amount() const { diff --git a/src/sion_data.cpp b/src/sion_data.cpp index 248cbce..de6e56a 100644 --- a/src/sion_data.cpp +++ b/src/sion_data.cpp @@ -7,11 +7,11 @@ #include "sion_data.h" #include "sion_voice.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_pcm_data.h" -#include "processor/wave/siopm_wave_pcm_table.h" -#include "processor/wave/siopm_wave_sampler_data.h" -#include "processor/wave/siopm_wave_sampler_table.h" +#include "chip/siopm_ref_table.h" +#include "chip/wave/siopm_wave_pcm_data.h" +#include "chip/wave/siopm_wave_pcm_table.h" +#include "chip/wave/siopm_wave_sampler_data.h" +#include "chip/wave/siopm_wave_sampler_table.h" SiOPMWavePCMData *SiONData::set_pcm_wave(int p_index, const Variant &p_data, double p_sampling_note, int p_key_range_from, int p_key_range_to, int p_src_channel_count, int p_channel_count) { SiOPMWavePCMTable *pcm_table = (SiOPMWavePCMTable *)(get_pcm_voice(p_index)->get_wave_data()); diff --git a/src/sion_driver.cpp b/src/sion_driver.cpp index dda444c..784c496 100644 --- a/src/sion_driver.cpp +++ b/src/sion_driver.cpp @@ -12,17 +12,17 @@ #include "sion_data.h" #include "sion_enums.h" #include "sion_voice.h" -#include "effector/si_effector_module.h" +#include "chip/channels/siopm_channel_base.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_ref_table.h" +#include "chip/siopm_sound_chip.h" +#include "chip/wave/siopm_wave_pcm_data.h" +#include "chip/wave/siopm_wave_pcm_table.h" +#include "chip/wave/siopm_wave_sampler_data.h" +#include "chip/wave/siopm_wave_table.h" +#include "effector/si_effector.h" #include "events/sion_event.h" #include "events/sion_track_event.h" -#include "processor/channels/siopm_channel_base.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_module.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_pcm_data.h" -#include "processor/wave/siopm_wave_pcm_table.h" -#include "processor/wave/siopm_wave_sampler_data.h" -#include "processor/wave/siopm_wave_table.h" #include "sequencer/base/mml_event.h" #include "sequencer/base/mml_executor.h" #include "sequencer/base/mml_parser.h" @@ -376,11 +376,11 @@ void SiONDriver::_prepare_render(const Variant &p_data, Vector p_render_ bool SiONDriver::_rendering() { // Processing. - module->begin_process(); + sound_chip->begin_process(); effector->begin_process(); sequencer->process(); effector->end_process(); - module->end_process(); + sound_chip->end_process(); bool finished = false; @@ -399,7 +399,7 @@ bool SiONDriver::_rendering() { } // Copy the output. - Vector output_buffer = module->get_output_buffer(); + Vector output_buffer = sound_chip->get_output_buffer(); if (_render_buffer_channel_count == 2) { for (int i = 0, j = _render_buffer_index; i < rendering_length; i++, j++) { @@ -449,11 +449,11 @@ void SiONDriver::_streaming() { int start_time = Time::get_singleton()->get_ticks_msec(); // Processing. - module->begin_process(); + sound_chip->begin_process(); effector->begin_process(); sequencer->process(); effector->end_process(); - module->end_process(); + sound_chip->end_process(); // Calculate an average processing time. _performance_stats.streaming_time = start_time; @@ -464,7 +464,7 @@ void SiONDriver::_streaming() { _performance_stats.average_processing_time = _performance_stats.total_processing_time * _performance_stats.total_processing_time_ratio; // Write samples. - Vector output_buffer = module->get_output_buffer(); + Vector output_buffer = sound_chip->get_output_buffer(); for (int i = 0; i < output_buffer.size(); i += 2) { stream_buffer.push_back(Vector2(output_buffer[i], output_buffer[i + 1])); } @@ -862,8 +862,8 @@ void SiONDriver::_prepare_process(const Variant &p_data, bool p_reset_effector) // Order of operations below is critical. - module->initialize(_channel_count, _bitrate, _buffer_length); // Initialize DSP. - module->reset(); // Reset all channels. + sound_chip->initialize(_channel_count, _bitrate, _buffer_length); // Initialize DSP. + sound_chip->reset(); // Reset all channels. if (p_reset_effector) { // Initialize or reset effectors. effector->initialize(); @@ -871,7 +871,7 @@ void SiONDriver::_prepare_process(const Variant &p_data, bool p_reset_effector) effector->reset(); } - sequencer->prepare_process(_data, _sample_rate, _buffer_length); // Set sequencer tracks (should be called after module::reset()). + sequencer->prepare_process(_data, _sample_rate, _buffer_length); // Set sequencer tracks (should be called after sound_chip::reset()). if (_data.is_valid()) { _parse_system_command(_data->get_system_commands()); // Parse #EFFECT command (should be called after effector::reset()). } @@ -1304,9 +1304,9 @@ SiONDriver::SiONDriver(int p_buffer_length, int p_channel_count, int p_sample_ra ERR_FAIL_COND_MSG((p_channel_count != 1 && p_channel_count != 2), "SiONDriver: Channel count can only be 1 (mono) or 2 (stereo)."); ERR_FAIL_COND_MSG((p_sample_rate != 44100), "SiONDriver: Sampling rate can only be 44100."); - module = memnew(SiOPMModule); - effector = memnew(SiEffectorModule(module)); - sequencer = memnew(SiMMLSequencer(module)); + sound_chip = memnew(SiOPMSoundChip); + effector = memnew(SiEffector(sound_chip)); + sequencer = memnew(SiMMLSequencer(sound_chip)); sequencer->set_note_on_callback(Callable(this, "_note_on_callback")); sequencer->set_note_off_callback(Callable(this, "_note_off_callback")); sequencer->set_tempo_changed_callback(Callable(this, "_tempo_changed_callback")); diff --git a/src/sion_driver.h b/src/sion_driver.h index 19e97bf..6d119fd 100644 --- a/src/sion_driver.h +++ b/src/sion_driver.h @@ -27,12 +27,12 @@ class FaderUtil; class MIDIModule; class MMLEvent; class MMLSequence; -class SiEffectorModule; +class SiEffector; class SiMMLSequencer; class SiMMLTrack; class SiONData; class SiONDataConverterSMF; -class SiOPMModule; +class SiOPMSoundChip; class SiOPMWaveTable; class SiOPMWavePCMData; class SiOPMWaveSamplerData; @@ -69,8 +69,8 @@ class SiONDriver : public Node { static SiONDriver *_mutex; static bool _allow_multiple_drivers; - SiOPMModule *module = nullptr; - SiEffectorModule *effector = nullptr; + SiOPMSoundChip *sound_chip = nullptr; + SiEffector *effector = nullptr; SiMMLSequencer *sequencer = nullptr; // Data. diff --git a/src/sion_voice.cpp b/src/sion_voice.cpp index 3ee3e58..3396773 100644 --- a/src/sion_voice.cpp +++ b/src/sion_voice.cpp @@ -11,14 +11,14 @@ #include #include "sion_enums.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_operator_params.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_pcm_data.h" -#include "processor/wave/siopm_wave_pcm_table.h" -#include "processor/wave/siopm_wave_sampler_data.h" -#include "processor/wave/siopm_wave_sampler_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_operator_params.h" +#include "chip/siopm_ref_table.h" +#include "chip/wave/siopm_wave_pcm_data.h" +#include "chip/wave/siopm_wave_pcm_table.h" +#include "chip/wave/siopm_wave_sampler_data.h" +#include "chip/wave/siopm_wave_sampler_table.h" +#include "chip/wave/siopm_wave_table.h" #include "utils/translator_util.h" const char *SiONVoice::CHIPTYPE_AUTO = ""; diff --git a/src/utils/sion_voice_preset_util.cpp b/src/utils/sion_voice_preset_util.cpp index 2ed0abf..505c8e0 100644 --- a/src/utils/sion_voice_preset_util.cpp +++ b/src/utils/sion_voice_preset_util.cpp @@ -9,9 +9,9 @@ #include #include "sion_enums.h" #include "sion_voice.h" -#include "processor/siopm_channel_params.h" -#include "processor/siopm_operator_params.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_operator_params.h" +#include "chip/wave/siopm_wave_table.h" void SiONVoicePresetUtil::_generate_default_voices() { // 16 default voices. diff --git a/src/utils/transformer_util.cpp b/src/utils/transformer_util.cpp index 1a11625..9bd344e 100644 --- a/src/utils/transformer_util.cpp +++ b/src/utils/transformer_util.cpp @@ -6,8 +6,8 @@ #include "transformer_util.h" -#include "processor/siopm_ref_table.h" -#include "processor/wave/siopm_wave_table.h" +#include "chip/siopm_ref_table.h" +#include "chip/wave/siopm_wave_table.h" void TransformerUtil::_amplify_log_data(Vector *r_src, int p_gain) { int gain = p_gain & ~1; diff --git a/src/utils/translator_util.cpp b/src/utils/translator_util.cpp index 4aeee13..9dd2d27 100644 --- a/src/utils/translator_util.cpp +++ b/src/utils/translator_util.cpp @@ -10,9 +10,9 @@ #include #include #include -#include "processor/siopm_channel_params.h" -#include "processor/siopm_operator_params.h" -#include "processor/siopm_ref_table.h" +#include "chip/siopm_channel_params.h" +#include "chip/siopm_operator_params.h" +#include "chip/siopm_ref_table.h" #include "sequencer/simml_ref_table.h" #include "utils/godot_util.h"