From 99069c412f2485115b63be8fd42fbc3b069fd0b3 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Wed, 26 Jun 2024 21:24:21 +0200 Subject: [PATCH] Document the extension and improve exposed API This also adds some minor fixes and validity checks where appropriate. Some bigger changes have been identified which will come in follow-up commits. Closes #3. --- .gitignore | 1 + README.md | 4 +- SConstruct | 8 + doc_classes/BeatsPerMinute.xml | 11 + doc_classes/MMLData.xml | 11 + doc_classes/MMLEvent.xml | 11 + doc_classes/MMLSequencer.xml | 11 + doc_classes/MMLSystemCommand.xml | 11 + doc_classes/SiControllableFilterBase.xml | 30 ++ doc_classes/SiControllableFilterHighPass.xml | 11 + doc_classes/SiControllableFilterLowPass.xml | 11 + doc_classes/SiEffectAutopan.xml | 20 + doc_classes/SiEffectBase.xml | 10 + doc_classes/SiEffectComposite.xml | 31 ++ doc_classes/SiEffectCompressor.xml | 24 + doc_classes/SiEffectDistortion.xml | 22 + doc_classes/SiEffectDownsampler.xml | 21 + doc_classes/SiEffectEqualizer.xml | 23 + doc_classes/SiEffectSpeakerSimulator.xml | 19 + doc_classes/SiEffectStereoChorus.xml | 24 + doc_classes/SiEffectStereoDelay.xml | 22 + doc_classes/SiEffectStereoExpander.xml | 21 + doc_classes/SiEffectStereoReverb.xml | 22 + doc_classes/SiEffectWaveShaper.xml | 20 + doc_classes/SiEffector.xml | 44 ++ doc_classes/SiFilterAllPass.xml | 20 + doc_classes/SiFilterBandPass.xml | 20 + doc_classes/SiFilterBase.xml | 10 + doc_classes/SiFilterHighBoost.xml | 21 + doc_classes/SiFilterHighPass.xml | 20 + doc_classes/SiFilterLowBoost.xml | 21 + doc_classes/SiFilterLowPass.xml | 20 + doc_classes/SiFilterNotch.xml | 20 + doc_classes/SiFilterPeak.xml | 21 + doc_classes/SiFilterVowel.xml | 79 +++ doc_classes/SiMMLData.xml | 11 + doc_classes/SiMMLSequencer.xml | 12 + doc_classes/SiMMLTrack.xml | 26 + doc_classes/SiMMLVoice.xml | 48 ++ doc_classes/SiONData.xml | 11 + doc_classes/SiONDriver.xml | 500 +++++++++++++++++++ doc_classes/SiONEvent.xml | 36 ++ doc_classes/SiONTrackEvent.xml | 43 ++ doc_classes/SiONVoice.xml | 222 ++++++++ doc_classes/SiONVoicePresetUtil.xml | 65 +++ doc_classes/SiOPMChannelBase.xml | 12 + doc_classes/SiOPMChannelFM.xml | 14 + doc_classes/SiOPMChannelKS.xml | 11 + doc_classes/SiOPMChannelPCM.xml | 11 + doc_classes/SiOPMChannelParams.xml | 92 ++++ doc_classes/SiOPMChannelSampler.xml | 11 + doc_classes/SiOPMSoundChip.xml | 17 + doc_classes/SiOPMWaveBase.xml | 11 + doc_classes/SiOPMWavePCMData.xml | 11 + doc_classes/SiOPMWavePCMTable.xml | 11 + doc_classes/SiOPMWaveSamplerData.xml | 11 + doc_classes/SiOPMWaveSamplerTable.xml | 11 + doc_classes/SiOPMWaveTable.xml | 11 + src/chip/siopm_channel_params.cpp | 48 ++ src/chip/siopm_sound_chip.cpp | 5 + src/chip/siopm_sound_chip.h | 2 +- src/effector/si_effect_composite.cpp | 21 +- src/effector/si_effect_composite.h | 4 +- src/effector/si_effector.cpp | 12 + src/events/sion_event.cpp | 1 + src/sequencer/simml_ref_table.cpp | 30 +- src/sequencer/simml_track.cpp | 3 + src/sion_driver.cpp | 48 +- src/sion_enums.h | 22 +- 69 files changed, 2035 insertions(+), 64 deletions(-) create mode 100644 doc_classes/BeatsPerMinute.xml create mode 100644 doc_classes/MMLData.xml create mode 100644 doc_classes/MMLEvent.xml create mode 100644 doc_classes/MMLSequencer.xml create mode 100644 doc_classes/MMLSystemCommand.xml create mode 100644 doc_classes/SiControllableFilterBase.xml create mode 100644 doc_classes/SiControllableFilterHighPass.xml create mode 100644 doc_classes/SiControllableFilterLowPass.xml create mode 100644 doc_classes/SiEffectAutopan.xml create mode 100644 doc_classes/SiEffectBase.xml create mode 100644 doc_classes/SiEffectComposite.xml create mode 100644 doc_classes/SiEffectCompressor.xml create mode 100644 doc_classes/SiEffectDistortion.xml create mode 100644 doc_classes/SiEffectDownsampler.xml create mode 100644 doc_classes/SiEffectEqualizer.xml create mode 100644 doc_classes/SiEffectSpeakerSimulator.xml create mode 100644 doc_classes/SiEffectStereoChorus.xml create mode 100644 doc_classes/SiEffectStereoDelay.xml create mode 100644 doc_classes/SiEffectStereoExpander.xml create mode 100644 doc_classes/SiEffectStereoReverb.xml create mode 100644 doc_classes/SiEffectWaveShaper.xml create mode 100644 doc_classes/SiEffector.xml create mode 100644 doc_classes/SiFilterAllPass.xml create mode 100644 doc_classes/SiFilterBandPass.xml create mode 100644 doc_classes/SiFilterBase.xml create mode 100644 doc_classes/SiFilterHighBoost.xml create mode 100644 doc_classes/SiFilterHighPass.xml create mode 100644 doc_classes/SiFilterLowBoost.xml create mode 100644 doc_classes/SiFilterLowPass.xml create mode 100644 doc_classes/SiFilterNotch.xml create mode 100644 doc_classes/SiFilterPeak.xml create mode 100644 doc_classes/SiFilterVowel.xml create mode 100644 doc_classes/SiMMLData.xml create mode 100644 doc_classes/SiMMLSequencer.xml create mode 100644 doc_classes/SiMMLTrack.xml create mode 100644 doc_classes/SiMMLVoice.xml create mode 100644 doc_classes/SiONData.xml create mode 100644 doc_classes/SiONDriver.xml create mode 100644 doc_classes/SiONEvent.xml create mode 100644 doc_classes/SiONTrackEvent.xml create mode 100644 doc_classes/SiONVoice.xml create mode 100644 doc_classes/SiONVoicePresetUtil.xml create mode 100644 doc_classes/SiOPMChannelBase.xml create mode 100644 doc_classes/SiOPMChannelFM.xml create mode 100644 doc_classes/SiOPMChannelKS.xml create mode 100644 doc_classes/SiOPMChannelPCM.xml create mode 100644 doc_classes/SiOPMChannelParams.xml create mode 100644 doc_classes/SiOPMChannelSampler.xml create mode 100644 doc_classes/SiOPMSoundChip.xml create mode 100644 doc_classes/SiOPMWaveBase.xml create mode 100644 doc_classes/SiOPMWavePCMData.xml create mode 100644 doc_classes/SiOPMWavePCMTable.xml create mode 100644 doc_classes/SiOPMWaveSamplerData.xml create mode 100644 doc_classes/SiOPMWaveSamplerTable.xml create mode 100644 doc_classes/SiOPMWaveTable.xml diff --git a/.gitignore b/.gitignore index 0de70fc..04a2cfc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ bin/* !bin/*.gdextension example/bin/ example/export/ +src/**/*.gen.cpp ### Godot project development ### diff --git a/README.md b/README.md index 1c7cc10..5373a63 100644 --- a/README.md +++ b/README.md @@ -36,14 +36,14 @@ If you need the most recent fixes, you can also download the _[latest unstable]( 4. Restart the editor, and start using the synth! > [!TIP] -> You can type "SiON" in the search bar of the editor's built-in help to find available classes. Complete class and method descriptions are coming once _Godot 4.3_ reaches a more stable state (the ability to create class reference has been added very recently). +> You can type "SiON" in the search bar of the editor's built-in help to find available classes. ## Usage First, you need to create a `SiONDriver` instance and add it to the scene tree. **Only one driver** can exist at the same time. (Some internal global objects are stateful and having multiple drivers can lead to conflicts.) ```gdscript -var driver := SiONDriver.new() +var driver := SiONDriver.create() add_child(driver) ``` diff --git a/SConstruct b/SConstruct index 2e61b27..28c14f3 100644 --- a/SConstruct +++ b/SConstruct @@ -45,8 +45,16 @@ def _register_library(name, path): env.Append(CPPPATH=["#{}/".format(path)]) env.library_sources = [] + # Recursively iterate through sub configs in source folders and perform steps defined there. SConscript("{}/SCsub".format(path)) + # Add documentation to the list of sources as well. + if env["target"] in ["editor", "template_debug"]: + doc_data = env.GodotCPPDocData("{}/gen/doc_data.gen.cpp".format(path), source=Glob("doc_classes/*.xml")) + env.library_sources.append(doc_data) + + # Finally, register the library to be built. + if env["platform"] == "macos": library = env.SharedLibrary( "{}/{}.{}.{}.framework/{}.{}.{}".format( diff --git a/doc_classes/BeatsPerMinute.xml b/doc_classes/BeatsPerMinute.xml new file mode 100644 index 0000000..18ba950 --- /dev/null +++ b/doc_classes/BeatsPerMinute.xml @@ -0,0 +1,11 @@ + + + + Helper class for manipulating BPM data. + + + [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]! + + + + diff --git a/doc_classes/MMLData.xml b/doc_classes/MMLData.xml new file mode 100644 index 0000000..5782c3f --- /dev/null +++ b/doc_classes/MMLData.xml @@ -0,0 +1,11 @@ + + + + Container for the state data of the internal processing. Base class of [SiMMLData] and [SiONData]. + + + [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]! + + + + diff --git a/doc_classes/MMLEvent.xml b/doc_classes/MMLEvent.xml new file mode 100644 index 0000000..dbc2169 --- /dev/null +++ b/doc_classes/MMLEvent.xml @@ -0,0 +1,11 @@ + + + + Container for event information of the internal sequencer. + + + [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]! + + + + diff --git a/doc_classes/MMLSequencer.xml b/doc_classes/MMLSequencer.xml new file mode 100644 index 0000000..6a363ad --- /dev/null +++ b/doc_classes/MMLSequencer.xml @@ -0,0 +1,11 @@ + + + + Internal sequencer. Base class of [SiMMLSequencer]. + + + [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]! + + + + diff --git a/doc_classes/MMLSystemCommand.xml b/doc_classes/MMLSystemCommand.xml new file mode 100644 index 0000000..8a3ef79 --- /dev/null +++ b/doc_classes/MMLSystemCommand.xml @@ -0,0 +1,11 @@ + + + + Container for system commands of the internal sequencer. + + + [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]! + + + + diff --git a/doc_classes/SiControllableFilterBase.xml b/doc_classes/SiControllableFilterBase.xml new file mode 100644 index 0000000..9be245d --- /dev/null +++ b/doc_classes/SiControllableFilterBase.xml @@ -0,0 +1,30 @@ + + + + Base class for all controllable filters. + + + Controllable filters allow to set their parameters directly without preprocessing. + + + + + + + + + + + Sets filter parameters. + + + + + + + + Sets filter parameters directly. + + + + diff --git a/doc_classes/SiControllableFilterHighPass.xml b/doc_classes/SiControllableFilterHighPass.xml new file mode 100644 index 0000000..188e984 --- /dev/null +++ b/doc_classes/SiControllableFilterHighPass.xml @@ -0,0 +1,11 @@ + + + + Controllable version of the high pass filter. + + + See also [SiFilterHighPass]. + + + + diff --git a/doc_classes/SiControllableFilterLowPass.xml b/doc_classes/SiControllableFilterLowPass.xml new file mode 100644 index 0000000..974dfc9 --- /dev/null +++ b/doc_classes/SiControllableFilterLowPass.xml @@ -0,0 +1,11 @@ + + + + Controllable version of the low pass filter. + + + See also [SiFilterLowPass]. + + + + diff --git a/doc_classes/SiEffectAutopan.xml b/doc_classes/SiEffectAutopan.xml new file mode 100644 index 0000000..4527926 --- /dev/null +++ b/doc_classes/SiEffectAutopan.xml @@ -0,0 +1,20 @@ + + + + Automatic panning effect. + + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffectBase.xml b/doc_classes/SiEffectBase.xml new file mode 100644 index 0000000..91c672e --- /dev/null +++ b/doc_classes/SiEffectBase.xml @@ -0,0 +1,10 @@ + + + + Base class for all effects and filters. + + + + + + diff --git a/doc_classes/SiEffectComposite.xml b/doc_classes/SiEffectComposite.xml new file mode 100644 index 0000000..af5195c --- /dev/null +++ b/doc_classes/SiEffectComposite.xml @@ -0,0 +1,31 @@ + + + + Composite effect built from other effects and filters. + + + A composite effect can have up to [code]8[/code] slots, each containing a chain of effects. Slot at the index [code]0[/code] has a special meaning as the master slot. + When processing, first secondary slots are calculated and mixed, and then the master slot is calculated and mixed. + + + + + + + + + + Sets a collection of effects for the given slot, overriding existing effects. + + + + + + + + + Sets send and mix levels for the given slot. + + + + diff --git a/doc_classes/SiEffectCompressor.xml b/doc_classes/SiEffectCompressor.xml new file mode 100644 index 0000000..a948139 --- /dev/null +++ b/doc_classes/SiEffectCompressor.xml @@ -0,0 +1,24 @@ + + + + Compressor effect. + + + + + + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffectDistortion.xml b/doc_classes/SiEffectDistortion.xml new file mode 100644 index 0000000..0f3aa68 --- /dev/null +++ b/doc_classes/SiEffectDistortion.xml @@ -0,0 +1,22 @@ + + + + Distortion effect. + + + + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffectDownsampler.xml b/doc_classes/SiEffectDownsampler.xml new file mode 100644 index 0000000..46df7f9 --- /dev/null +++ b/doc_classes/SiEffectDownsampler.xml @@ -0,0 +1,21 @@ + + + + Downsampler effect. + + + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffectEqualizer.xml b/doc_classes/SiEffectEqualizer.xml new file mode 100644 index 0000000..e8effdc --- /dev/null +++ b/doc_classes/SiEffectEqualizer.xml @@ -0,0 +1,23 @@ + + + + Equalizer effect. + + + + + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffectSpeakerSimulator.xml b/doc_classes/SiEffectSpeakerSimulator.xml new file mode 100644 index 0000000..b1a741f --- /dev/null +++ b/doc_classes/SiEffectSpeakerSimulator.xml @@ -0,0 +1,19 @@ + + + + Piezoelectric speaker simulator effect. + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffectStereoChorus.xml b/doc_classes/SiEffectStereoChorus.xml new file mode 100644 index 0000000..21b3af3 --- /dev/null +++ b/doc_classes/SiEffectStereoChorus.xml @@ -0,0 +1,24 @@ + + + + Stereo chorus effect. + + + + + + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffectStereoDelay.xml b/doc_classes/SiEffectStereoDelay.xml new file mode 100644 index 0000000..f8f2507 --- /dev/null +++ b/doc_classes/SiEffectStereoDelay.xml @@ -0,0 +1,22 @@ + + + + Stereo delay effect. + + + + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffectStereoExpander.xml b/doc_classes/SiEffectStereoExpander.xml new file mode 100644 index 0000000..1adccb9 --- /dev/null +++ b/doc_classes/SiEffectStereoExpander.xml @@ -0,0 +1,21 @@ + + + + Stereo expander effect. + + + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffectStereoReverb.xml b/doc_classes/SiEffectStereoReverb.xml new file mode 100644 index 0000000..a026d46 --- /dev/null +++ b/doc_classes/SiEffectStereoReverb.xml @@ -0,0 +1,22 @@ + + + + Stereo reverb effect. + + + + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffectWaveShaper.xml b/doc_classes/SiEffectWaveShaper.xml new file mode 100644 index 0000000..0ab690b --- /dev/null +++ b/doc_classes/SiEffectWaveShaper.xml @@ -0,0 +1,20 @@ + + + + Wave shaper effect. + + + + + + + + + + + + Sets effect parameters. + + + + diff --git a/doc_classes/SiEffector.xml b/doc_classes/SiEffector.xml new file mode 100644 index 0000000..e309be0 --- /dev/null +++ b/doc_classes/SiEffector.xml @@ -0,0 +1,44 @@ + + + + Internal effector module. + + + It is responsible for management of various effects and filters applied globally to the entire generated sound wave. + Effects can populate up to [constant SiOPMSoundChip.STREAM_SEND_SIZE] slots. Slot [code]0[/code] has a special meaning as the master slot. + + + + + + + + + + Appends a new effect to the given slot. Effects in each slot are chained together and processed in the assignment order. + + + + + + + Clears all effects assigned to the given slot. + + + + + + + Returns all effects assigned to the given slot. + + + + + + + + Sets a collection of effects to the given slot, overriding existing effects. + + + + diff --git a/doc_classes/SiFilterAllPass.xml b/doc_classes/SiFilterAllPass.xml new file mode 100644 index 0000000..7ac3b49 --- /dev/null +++ b/doc_classes/SiFilterAllPass.xml @@ -0,0 +1,20 @@ + + + + All pass filter. + + + + + + + + + + + + Sets filter parameters. + + + + diff --git a/doc_classes/SiFilterBandPass.xml b/doc_classes/SiFilterBandPass.xml new file mode 100644 index 0000000..a753840 --- /dev/null +++ b/doc_classes/SiFilterBandPass.xml @@ -0,0 +1,20 @@ + + + + Band pass filter. + + + + + + + + + + + + Sets filter parameters. + + + + diff --git a/doc_classes/SiFilterBase.xml b/doc_classes/SiFilterBase.xml new file mode 100644 index 0000000..a31f47f --- /dev/null +++ b/doc_classes/SiFilterBase.xml @@ -0,0 +1,10 @@ + + + + Base class for all filters. + + + + + + diff --git a/doc_classes/SiFilterHighBoost.xml b/doc_classes/SiFilterHighBoost.xml new file mode 100644 index 0000000..b8c7723 --- /dev/null +++ b/doc_classes/SiFilterHighBoost.xml @@ -0,0 +1,21 @@ + + + + High boost filter. + + + + + + + + + + + + + Sets filter parameters. + + + + diff --git a/doc_classes/SiFilterHighPass.xml b/doc_classes/SiFilterHighPass.xml new file mode 100644 index 0000000..31ddb24 --- /dev/null +++ b/doc_classes/SiFilterHighPass.xml @@ -0,0 +1,20 @@ + + + + High pass filter. + + + + + + + + + + + + Sets filter parameters. + + + + diff --git a/doc_classes/SiFilterLowBoost.xml b/doc_classes/SiFilterLowBoost.xml new file mode 100644 index 0000000..bb1986d --- /dev/null +++ b/doc_classes/SiFilterLowBoost.xml @@ -0,0 +1,21 @@ + + + + Low boost filter. + + + + + + + + + + + + + Sets filter parameters. + + + + diff --git a/doc_classes/SiFilterLowPass.xml b/doc_classes/SiFilterLowPass.xml new file mode 100644 index 0000000..100ea65 --- /dev/null +++ b/doc_classes/SiFilterLowPass.xml @@ -0,0 +1,20 @@ + + + + Low pass filter. + + + + + + + + + + + + Sets filter parameters. + + + + diff --git a/doc_classes/SiFilterNotch.xml b/doc_classes/SiFilterNotch.xml new file mode 100644 index 0000000..a22a506 --- /dev/null +++ b/doc_classes/SiFilterNotch.xml @@ -0,0 +1,20 @@ + + + + Notch filter. + + + + + + + + + + + + Sets filter parameters. + + + + diff --git a/doc_classes/SiFilterPeak.xml b/doc_classes/SiFilterPeak.xml new file mode 100644 index 0000000..28df635 --- /dev/null +++ b/doc_classes/SiFilterPeak.xml @@ -0,0 +1,21 @@ + + + + Peaking equalizer filter. + + + + + + + + + + + + + Sets filter parameters. + + + + diff --git a/doc_classes/SiFilterVowel.xml b/doc_classes/SiFilterVowel.xml new file mode 100644 index 0000000..1760851 --- /dev/null +++ b/doc_classes/SiFilterVowel.xml @@ -0,0 +1,79 @@ + + + + Vowel filter. + + + A combination of 6 peaking filters (formants). Note that each formant has different defaults. + + + + + + + + + + + Sets parameters for the 1st formant (peaking filter). + + + + + + + + + Sets parameters for the 2nd formant (peaking filter). + + + + + + + + + Sets parameters for the 3rd formant (peaking filter). + + + + + + + + + Sets parameters for the 4th formant (peaking filter). + + + + + + + + + Sets parameters for the 5th formant (peaking filter). + + + + + + + + + Sets parameters for the 6th formant (peaking filter). + + + + + + + + + + + + Sets 1st and 2nd formants with a delay. + + + + diff --git a/doc_classes/SiMMLData.xml b/doc_classes/SiMMLData.xml new file mode 100644 index 0000000..f9ea54e --- /dev/null +++ b/doc_classes/SiMMLData.xml @@ -0,0 +1,11 @@ + + + + Container for the state data of the internal processing. Base class of [SiONData]. + + + [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]! + + + + diff --git a/doc_classes/SiMMLSequencer.xml b/doc_classes/SiMMLSequencer.xml new file mode 100644 index 0000000..68420e3 --- /dev/null +++ b/doc_classes/SiMMLSequencer.xml @@ -0,0 +1,12 @@ + + + + Internal sequencer module. + + + It is responsible for creating a sequence of commands which control the sound generation. You can think of it as a parsed and expanded representation of an MML string. + [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]! + + + + diff --git a/doc_classes/SiMMLTrack.xml b/doc_classes/SiMMLTrack.xml new file mode 100644 index 0000000..c9eddbf --- /dev/null +++ b/doc_classes/SiMMLTrack.xml @@ -0,0 +1,26 @@ + + + + Track of the internal sequencer. + + + Sequencers contain a collection of tracks to be able to process multiple overlapping commands at the same time. Tracks are used as they are needed by the sequence, and then become reserved for future reuse. + [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]! + + + + + + + + Returns the track ID component of the internal ID. + + + + + + Returns the track type component of the internal ID. + + + + diff --git a/doc_classes/SiMMLVoice.xml b/doc_classes/SiMMLVoice.xml new file mode 100644 index 0000000..02fbb4b --- /dev/null +++ b/doc_classes/SiMMLVoice.xml @@ -0,0 +1,48 @@ + + + + Container for the simulated instrument voice configuration. Base class for [SiONVoice]. + + + + + + + + + + Returns a reference to the [SiOPMChannelParams] instance used by this voice. + + + + + + Expression component of the volume. + + + Expression to level conversion table mode. Can be set by an expression mode MML command ([code]%x[/code]). See also [member velocity_mode]. + + + Flag that determines whether tracks and their channels should be updated according to this voice. + + + Flag that determines whether velocity and expression of tracks should be updated according to this voice. + + + Velocity component of the volume. + + + Velocity to level conversion table mode. Can be set by a velocity mode MML command ([code]%v[/code]). + [codeblock lang=text] + 0 - linear scale. + 1 - log scale; dynamic range = 96dB; total level based. + 2 - log scale; dynamic range = 64dB; fmp7 based. + 3 - log scale; dynamic range = 48dB; PSG volume based. + 4 - log scale; dynamic range = 32dB; based on N88 basic v command. + [/codeblock] + + + Velocity shift amount. Can be set by a velocity mode MML command ([code]%v[/code]). + + + diff --git a/doc_classes/SiONData.xml b/doc_classes/SiONData.xml new file mode 100644 index 0000000..b262003 --- /dev/null +++ b/doc_classes/SiONData.xml @@ -0,0 +1,11 @@ + + + + Container for the state data of the internal processing. + + + [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]! + + + + diff --git a/doc_classes/SiONDriver.xml b/doc_classes/SiONDriver.xml new file mode 100644 index 0000000..87f7e08 --- /dev/null +++ b/doc_classes/SiONDriver.xml @@ -0,0 +1,500 @@ + + + + Main GDSiON class for configuration and control of the synthesizer. + + + The driver is your main tool for controlling the GDSiON synthesizer. It exposes methods to initialize streaming or rendering of the output buffer, to get internal components and modules, and to configure high level properties. + A new instance can be created using the factory method [method create]. Note, that [SiONDriver] is a node and must be added to the scene tree. + [codeblocks] + [gdscript] + var driver := SiONDriver.create() + add_child(driver) + [/gdscript] + [/codeblocks] + Using the class constructor creates an instance with every parameter set to default, which may not be desirable. Only one driver instance can exist at the same time. + + + + + + + + + + + + Creates a new instance of [SiONDriver]. Prefer using this method instead of the class constructor. + Use [param buffer_size] to control the size of the generated buffer. Bigger size is more demanding on your hardware. Supported values are [code]2048[/code], [code]4096[/code], [code]8192[/code]. + Use [param channel_num] to configure the number of output channels. Can only be [code]1[/code] for mono and [code]2[/code] for stereo. + Use [param sample_rate] to control the sample rate. Only [code]44100[/code] is supported at this time. + Use [param bitrate] to enable quantization. + + + + + + Returns a reference to the [SiEffector] instance. You can use it to control global effects and filters. + + + + + + Returns a reference to the [SiMMLSequencer] instance. + + + + + + Returns a reference to the [SiOPMSoundChip] instance. + + + + + + Returns the current version number as a string. + + + + + + Returns the flavor of the current version, e.g. "stable" or "beta1". + + + + + + + + + + + Executes a note off event for all matching tracks (see also [method SiMMLTrack.get_track_id]). Returns affected tracks. + [param delay] and [param quantize] must be in 1/16th of a beat. + [b]Note:[/b] Streaming must be initialized before this method is called (see [method play]). + + + + + + + + + + + + + Executes a note on event using the given voice. Returns the affected, or newly created, track (see also [method SiMMLTrack.get_track_id]). + [param length], [param delay], and [param quantize] must be in 1/16th of a beat. + Use [param disposable] to control whether the track can be freed after being used. Making a track non-disposable must be treated with care as it can lead to performance penalties. + [b]Note:[/b] Streaming must be initialized before this method is called (see [method play]). + + + + + + Pauses streaming initialized by [method play]. + + + + + + + + Starts streaming using the data provided, which is played immediately. Stops existing streaming, if it exists (see [method stop]). Does nothing when streaming is paused (see [method pause]). + Empty data can be provided to this method to simply initialize streaming without playing anything immediately. See also [method note_on], [method note_off], [method sequence_on], and [method sequence_off]. + + + + + + + + + + + + Plays the sound for the given sample number. Returns the affected, or newly created, track (see also [method SiMMLTrack.get_track_id]). + [param length], [param delay], and [param quantize] must be in 1/16th of a beat. + Use [param disposable] to control whether the track can be freed after being used. Making a track non-disposable must be treated with care as it can lead to performance penalties. + [b]Note:[/b] Streaming must be initialized before this method is called (see [method play]). + + + + + + Resets all available tracks in the sequencer. + + + + + + Resumes streaming previously paused by [method pause]. + + + + + + + + + + Stops execution of sequences for all matching tracks (see also [method SiMMLTrack.get_track_id]). Returns affected tracks. + [param delay] and [param quantize] must be in 1/16th of a beat. + [b]Note:[/b] Streaming must be initialized before this method is called (see [method play]). + + + + + + + + + + + + + Executes a sequence, or sequences, provided by the given data and using the given voice. Returns affected, or newly created, tracks (see also [method SiMMLTrack.get_track_id]). + [param length], [param delay], and [param quantize] must be in 1/16th of a beat. + Use [param disposable] to control whether the track can be freed after being used. Making a track non-disposable must be treated with care as it can lead to performance penalties. + [b]Note:[/b] Streaming must be initialized before this method is called (see [method play]). + + + + + + + Sets an interval for the beat track event, in 1/16ths of a beat. Only power-of-two values are allowed. + + + + + + + Enables or disables reporting of the beat track event. Beat events are fired at a quick pace, so handling of them can become a performance bottleneck. + + + + + + + Sets the beats per minute tempo. + + + + + + + Enables or disables reporting of the fading track event. + + + + + + + Enables or disables reporting of the stream track event. + + + + + + + Sets an interval for the integrated timer, in 1/16ths of a beat. This can be used as a metronome for the purposes of synchronizing note on/off events. Setting this interval to [code]0[/code] disables the timer. + + + + + + Stops streaming initialized by [method play]. Attempts to stop gracefully if triggered while processing. + + + + + + + + Emitted when tempo/beats per minute changes in the sequencer. This can be triggered by a command in the parsed MML string. + + + + + + Emitted if the fader is used and after the fading in has finished. + + + + + + Emitted if the fader is used and after the fading out has finished. + + + + + + Emitted if the fader is used and while the fading is happening. + + + + + + Emitted after the note off event is triggered in the sequencer when the event trigger type is "frame" (meaning delayed dispatch). This can be triggered by a command in the parsed MML string. + + + + + + Emitted after the note off event is triggered in the sequencer when the event trigger type is "stream" (meaning immediate dispatch). This can be triggered by a command in the parsed MML string. + + + + + + Emitted after the note on event is triggered in the sequencer when the event trigger type is "frame" (meaning delayed dispatch). This can be triggered by a command in the parsed MML string. + + + + + + Emitted after the note on event is triggered in the sequencer when the event trigger type is "stream" (meaning immediate dispatch). This can be triggered by a command in the parsed MML string. + + + + + + Emitted when the execution/rendering queue is cancelled. + + + + + + Emitted when the execution/rendering queue is completed. + + + + + + Emitted when the execution/rendering queue is being processed. + + + + + + Emitted when an individual sequence has finished during streaming. + + + + + + Emitted after streaming has started. + + + + + + Emitted after streaming has stopped. + + + + + + Emitted during streaming when a portion of the buffer is ready. See also [method set_stream_event_enabled]. + + + + + + Emitted at regular intervals by the sequencer. See also [method set_beat_event_enabled]. + + + + + Emitted at regular intervals by the internal timer. See also [method set_timer_interval]. + + + + + + Emitted when a user defined event occurs. + + + + + + PSG module type. + + + FC pAPU module type. + + + Noise wave module type. + + + MA3 module type. + + + SCC / custom wave table module type. + + + Any pulse generator module type. + + + FM module type. + + + PCM module type. + + + Pulse wave module type. + + + Ramp wave module type. + + + Sampler module type. + + + Karplus-Strong module type. + + + GameBoy-like module type. + + + VRC6 module type. + + + SID module type. + + + YM2151 module type (unused). + + + YM2203 module type (unused). + + + YM2608 module type (unused). + + + YM2413 module type (unused). + + + YM3812 module type (unused). + + + YMU762 module type (unused). + + + Total number of available module types. + + + OPM pitch table type. + + + PCM pitch table type. + + + PSG pitch table type. + + + OPM noise pitch table type. + + + PSG noise pitch table type. + + + APU noise pitch table type. + + + GameBoy-like noise pitch table type. + + + Total number of available pitch table types. + + + Sine wave pulse generator. + + + Upwards saw wave pulse generator. + + + Downwards saw wave pulse generator. + + + Triangle wave pulse generator quantized by 4 bit. + + + Triangle wave pulse generator. + + + Square wave pulse generator. + + + 32k white noise pulse generator. + + + KNMBSMM pulse generator. + + + Low frequency pseudo sync pulse generator. + + + High frequency pseudo sync pulse generator. + + + Offset pulse generator. + + + VC6 saw pulse generator (32 samples saw). + + + 16k white noise pulse generator. + + + 16k pulse noise pulse generator. + + + FC short noise pulse generator. + + + FC high pass noise pulse generator. + + + Pink noise pulse generator. + + + GameBoy-like short noise pulse generator. + + + Pitch-controllable periodic noise pulse generator. + + + Pitch-controllable 93-byte noise pulse generator. + + + Pitch-controllable pulse noise with OPM noise table pulse generator. + + + This and the next [code]32[/code] values are MA3 waveform pulse generators. + + + This and the next [code]16[/code] values are square pulse wave pulse generators. + + + This and the next [code]16[/code] values are square pulse wave with spike pulse generators. + + + This and the next [code]128[/code] values are ramp wave pulse generators. + + + This and the next [code]128[/code] values are custom wave table pulse generators. + + + This and the next [code]128[/code] values are PCM data pulse generators. + + + User registered custom wave table pulse generator. + + + User registered PCM data pulse generator. + + + diff --git a/doc_classes/SiONEvent.xml b/doc_classes/SiONEvent.xml new file mode 100644 index 0000000..f5b456e --- /dev/null +++ b/doc_classes/SiONEvent.xml @@ -0,0 +1,36 @@ + + + + Generic container for event data for GDSiON events. + + + + + + + + + + Returns a reference to the [SiONData] instance involved in the event. + + + + + + Returns a reference to the [SiONDriver] instance. + + + + + + Returns the type of the event, as a string. + + + + + + Returns a stream buffer involved in the event. The buffer is always provided in stereo, with the [code]x[/code] aspect representing the left channel, and the [code]y[/code] aspect representing the right channel. + + + + diff --git a/doc_classes/SiONTrackEvent.xml b/doc_classes/SiONTrackEvent.xml new file mode 100644 index 0000000..30b98f1 --- /dev/null +++ b/doc_classes/SiONTrackEvent.xml @@ -0,0 +1,43 @@ + + + + Container for [SiMMLTrack] related events. + + + Some events may not have a [SiMMLTrack] instance associated with them. In these cases data is provided by the sender. If there is a track, event data is taken from the track directly. + + + + + + + + Returns the buffer index. + + + + + + Returns the trigger ID of the event. + + + + + + Returns the trigger delay in frames. + + + + + + Returns the note involved in the event, if available. + + + + + + Returns a reference to the [SiMMLTrack] instance involved in the event. + + + + diff --git a/doc_classes/SiONVoice.xml b/doc_classes/SiONVoice.xml new file mode 100644 index 0000000..da55876 --- /dev/null +++ b/doc_classes/SiONVoice.xml @@ -0,0 +1,222 @@ + + + + Container for the configuration of a synthesized voice. + + + A new voice can be created using the factory method [method create]. + [codeblocks] + [gdscript] + var voice := SiONVoice.create() + voice.name = "My Instrument" + [/gdscript] + [/codeblocks] + Using the class constructor creates a voice with every parameter set to default, which is not desirable most of the time. + A large number of preconfigured voices can be accessed via [SiONVoicePresetUtil]. + + + + + + + + + + + + + + + + Creates a new instance of [SiONVoice]. Prefer using this method instead of the class constructor. + + + + + + + + + Returns a configuration of this voice as an MML string. This string can be then passed back to the driver for playback, alongside a melody. + Use [param index] to specify an internal index for this voice, which can then be referenced elsewhere in your MML string. + Use [param chip_type] to force the type used when generating voice configuration. By default voice's actual chip type is used. + Use [param append_postfix] to include additional configuration for this voice, such as filter and modulation settings from the channel. + + + + + + Returns a configuration of this voice as an array of integers. The voice is treated as a SiOPM voice. + + + + + + Returns a configuration of this voice as an array of integers. The voice is treated as an AL voice. + + + + + + Returns a configuration of this voice as an array of integers. The voice is treated as an MA3 voice. + + + + + + Returns a configuration of this voice as an array of integers. The voice is treated as an OPL voice. + + + + + + Returns a configuration of this voice as an array of integers. The voice is treated as an OPM voice. + + + + + + Returns a configuration of this voice as an array of integers. The voice is treated as an OPN voice. + + + + + + Returns a configuration of this voice as an array of integers. The voice is treated as an OPX voice. + + + + + + + + + + Sets amplitude modulation parameters. + + + + + + + + + + + Sets analoge-like parameters. + + + + + + + Sets this voice by an MML string. + + + + + + + + + + + + Sets envelope parameters. + + + + + + + + + + + + + + + + + Sets filter envelope parameters. + + + + + + + Sets the configuration of this voice as an array of integers. The voice is treated as a SiOPM voice. + + + + + + + Sets the configuration of this voice as an array of integers. The voice is treated as an AL voice. + + + + + + + Sets the configuration of this voice as an array of integers. The voice is treated as an MA3 voice. + + + + + + + Sets the configuration of this voice as an array of integers. The voice is treated as an OPL voice. + + + + + + + Sets the configuration of this voice as an array of integers. The voice is treated as an OPM voice. + + + + + + + Sets the configuration of this voice as an array of integers. The voice is treated as an OPN voice. + + + + + + + Sets the configuration of this voice as an array of integers. The voice is treated as an OPX voice. + + + + + + + + + + Sets pitch modulation parameters. + + + + + + + + + + + + Sets PMS guitar parameters. + + + + + + Human-readable name associated with this voice. + + + diff --git a/doc_classes/SiONVoicePresetUtil.xml b/doc_classes/SiONVoicePresetUtil.xml new file mode 100644 index 0000000..62de494 --- /dev/null +++ b/doc_classes/SiONVoicePresetUtil.xml @@ -0,0 +1,65 @@ + + + + Utility for generating [SiONVoice] presets. + + + Voice presets are a good way to quickly get started with GDSiON before diving deeper into fine tuning the synthesizer to your needs. [SiONVoicePresetUtil] can produce hundreds of preconfigured instrument voices in different categories. + To begin, simply instantiate the utility: + [codeblocks] + [gdscript] + var preset_util := SiONVoicePresetUtil.new() + print(preset_util.get_voice_preset_keys()) # Prints all available voice presets by their key. + [/gdscript] + [/codeblocks] + Alternatively, you can use [method generate_voices] to only generate a subset of available voices (see [enum GeneratorFlags]). To get the voice that you need, pass its key to [method get_voice_preset]. + Preset keys are static and will remain compatible with future version, unless stated otherwise in release notes. This means you can rely on them and hardcode them. + + + + + + + + + Regenerates voice presets for the given set of flags (see [enum GeneratorFlags]). Multiple flags can be selected using bitwise operators. + + + + + + + Returns a voice for the given key. See also [method get_voice_preset_keys]. + + + + + + Returns a list of all generated voices by they key. + + + + + + Generate generic voices. + + + Generate valsound voices. + + + Generate MIDI voices. + + + Generate MIDI drums. + + + Generate wave table voices. + + + Generate single drums. + + + Generate everything, including potential future additions. + + + diff --git a/doc_classes/SiOPMChannelBase.xml b/doc_classes/SiOPMChannelBase.xml new file mode 100644 index 0000000..4a35ae1 --- /dev/null +++ b/doc_classes/SiOPMChannelBase.xml @@ -0,0 +1,12 @@ + + + + Base class for all specific channel implementations. + + + Channels are responsible for synthesizing sound waves based on given parameters using low-frequency oscillation and pulse generation. + [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]! + + + + diff --git a/doc_classes/SiOPMChannelFM.xml b/doc_classes/SiOPMChannelFM.xml new file mode 100644 index 0000000..41207e4 --- /dev/null +++ b/doc_classes/SiOPMChannelFM.xml @@ -0,0 +1,14 @@ + + + + Frequency modulation channel implementation. + + + This implementation is based on OPM emulation, referenced from sources of mame, fmgen, and x68sound. + It also introduces a few extensions to simulate several other FM sound modules (OPNA, OPLL, OPL2, OPL3, OPX, MA3, MA5, MA7, TSS, and DX7), including: + - stereo output (from TSS, DX7)[br]- key scale level (from OPL3, OPX, MAx)[br]- phase selection (from TSS)[br]- fixed frequency (from MAx)[br]- SSG envelope control (from OPNA)[br]- wave shape selection (from OPX, MAx, TSS)[br]- custom wave shapes (from MAx)[br]- more supported algorithms (from OPLx, OPX, MAx, DX7)[br]- decimal multiple (from p-TSS)[br]- feedback from operators 1-3 (from DX7)[br]- channel independent LFO (from TSS)[br]- low-pass filter envelope (from MAx)[br]- flexible FM connections (from TSS)[br]- ring modulation (from C64?) + [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]! + + + + diff --git a/doc_classes/SiOPMChannelKS.xml b/doc_classes/SiOPMChannelKS.xml new file mode 100644 index 0000000..c3218d4 --- /dev/null +++ b/doc_classes/SiOPMChannelKS.xml @@ -0,0 +1,11 @@ + + + + Variant of [SiOPMChannelFM] using the Karplus-Strong algorithm. + + + [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]! + + + + diff --git a/doc_classes/SiOPMChannelPCM.xml b/doc_classes/SiOPMChannelPCM.xml new file mode 100644 index 0000000..fb830c7 --- /dev/null +++ b/doc_classes/SiOPMChannelPCM.xml @@ -0,0 +1,11 @@ + + + + Pulse code modulation channel implementation. + + + [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]! + + + + diff --git a/doc_classes/SiOPMChannelParams.xml b/doc_classes/SiOPMChannelParams.xml new file mode 100644 index 0000000..ff15a5c --- /dev/null +++ b/doc_classes/SiOPMChannelParams.xml @@ -0,0 +1,92 @@ + + + + Container for channel parameters passed from and to [SiMMLVoice] and [SiONVoice] voices. + + + + + + + + + + + Returns the master value of the volume at the given index. There are no more than [constant SiOPMSoundChip.STREAM_SEND_SIZE] volume slots. + + + + + + + + Sets the master value for the volume at the given index. There are no more than [constant SiOPMSoundChip.STREAM_SEND_SIZE] volume slots. + + + + + + Algorithm used by the voice. + + + Amplitude modulation depth. Value of [code]0[/code] disables amplitude modulation. + + + Frequency ratio used in envelopes. + + + Feedback strength of the voice. + + + Feedback connection strength of the voice. + + + Attack rate applied as a filter (see also [member filter_type]). Can be set by a filter MML command ([code]@f[/code]). + + + Cutoff applied as a filter (see also [member filter_type]). Can be set by a filter MML command ([code]@f[/code]). + + + Decay offset 1 applied as a filter (see also [member filter_type]). Can be set by a filter MML command ([code]@f[/code]). + + + Decay offset 2 applied as a filter (see also [member filter_type]). Can be set by a filter MML command ([code]@f[/code]). + + + Decay rate 1 applied as a filter (see also [member filter_type]). Can be set by a filter MML command ([code]@f[/code]). + + + Decay rate 2 applied as a filter (see also [member filter_type]). Can be set by a filter MML command ([code]@f[/code]). + + + Release offset applied as a filter (see also [member filter_type]). Can be set by a filter MML command ([code]@f[/code]). + + + Release rate applied as a filter (see also [member filter_type]). Can be set by a filter MML command ([code]@f[/code]). + + + Resonance applied as a filter (see also [member filter_type]). Can be set by a filter MML command ([code]@f[/code]). + + + Sustain offset applied as a filter (see also [member filter_type]). Can be set by a filter MML command ([code]@f[/code]). + + + Filter type. Can be set by a filter mode MML command ([code]%f[/code]). + + + Frequency step of the low-frequency oscillator. + + + Wave shape of the low-frequency oscillator. + + + Number of processing operators used by the channel. Valid values are between [code]0[/code] and [code]5[/code]. Setting it to [code]0[/code] disables all operator parameters. The value of [code]5[/code] sets an analog-like mode. + + + Panning strength. Can be set by a pan MML command ([code]p[/code] or [code]@p[/code]) + + + Pitch modulation depth. Value of [code]0[/code] disables pitch modulation. + + + diff --git a/doc_classes/SiOPMChannelSampler.xml b/doc_classes/SiOPMChannelSampler.xml new file mode 100644 index 0000000..772ff30 --- /dev/null +++ b/doc_classes/SiOPMChannelSampler.xml @@ -0,0 +1,11 @@ + + + + Sampler pad channel implementation. + + + [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]! + + + + diff --git a/doc_classes/SiOPMSoundChip.xml b/doc_classes/SiOPMSoundChip.xml new file mode 100644 index 0000000..6a41e28 --- /dev/null +++ b/doc_classes/SiOPMSoundChip.xml @@ -0,0 +1,17 @@ + + + + Internal sound chip module. + + + It is responsible for maintaining output buffers and pipes, populated by channels and effectors and consumed by the driver. + [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]! + + + + + + Maximum number of stream buffers used by various components and modules. + + + diff --git a/doc_classes/SiOPMWaveBase.xml b/doc_classes/SiOPMWaveBase.xml new file mode 100644 index 0000000..9100e44 --- /dev/null +++ b/doc_classes/SiOPMWaveBase.xml @@ -0,0 +1,11 @@ + + + + Base class for all wave data containers and tables. + + + [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]! + + + + diff --git a/doc_classes/SiOPMWavePCMData.xml b/doc_classes/SiOPMWavePCMData.xml new file mode 100644 index 0000000..ef38b0c --- /dev/null +++ b/doc_classes/SiOPMWavePCMData.xml @@ -0,0 +1,11 @@ + + + + PCM wave data container. + + + [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]! + + + + diff --git a/doc_classes/SiOPMWavePCMTable.xml b/doc_classes/SiOPMWavePCMTable.xml new file mode 100644 index 0000000..0afd187 --- /dev/null +++ b/doc_classes/SiOPMWavePCMTable.xml @@ -0,0 +1,11 @@ + + + + Table of [SiOPMWavePCMData]. + + + [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]! + + + + diff --git a/doc_classes/SiOPMWaveSamplerData.xml b/doc_classes/SiOPMWaveSamplerData.xml new file mode 100644 index 0000000..e338fa2 --- /dev/null +++ b/doc_classes/SiOPMWaveSamplerData.xml @@ -0,0 +1,11 @@ + + + + Wave data container for samples. + + + [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]! + + + + diff --git a/doc_classes/SiOPMWaveSamplerTable.xml b/doc_classes/SiOPMWaveSamplerTable.xml new file mode 100644 index 0000000..47c078f --- /dev/null +++ b/doc_classes/SiOPMWaveSamplerTable.xml @@ -0,0 +1,11 @@ + + + + Table of [SiOPMWaveSamplerData]. + + + [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]! + + + + diff --git a/doc_classes/SiOPMWaveTable.xml b/doc_classes/SiOPMWaveTable.xml new file mode 100644 index 0000000..68c21b4 --- /dev/null +++ b/doc_classes/SiOPMWaveTable.xml @@ -0,0 +1,11 @@ + + + + Generic wave data container. + + + [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]! + + + + diff --git a/src/chip/siopm_channel_params.cpp b/src/chip/siopm_channel_params.cpp index 5b577af..0a94567 100644 --- a/src/chip/siopm_channel_params.cpp +++ b/src/chip/siopm_channel_params.cpp @@ -248,6 +248,39 @@ void SiOPMChannelParams::copy_from(SiOPMChannelParams *p_params) { } void SiOPMChannelParams::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_operator_count"), &SiOPMChannelParams::get_operator_count); + ClassDB::bind_method(D_METHOD("set_operator_count", "value"), &SiOPMChannelParams::set_operator_count); + + 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); + + ClassDB::bind_method(D_METHOD("get_master_volume", "index"), &SiOPMChannelParams::get_master_volume); + ClassDB::bind_method(D_METHOD("set_master_volume", "index", "value"), &SiOPMChannelParams::set_master_volume); + + ClassDB::bind_method(D_METHOD("get_pan"), &SiOPMChannelParams::get_pan); + ClassDB::bind_method(D_METHOD("set_pan", "value"), &SiOPMChannelParams::set_pan); + 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); @@ -281,6 +314,21 @@ void SiOPMChannelParams::_bind_methods() { 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::INT, "algorithm"), "set_algorithm", "get_algorithm"); + ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "feedback"), "set_feedback", "get_feedback"); + ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "feedback_connection"), "set_feedback_connection", "get_feedback_connection"); + ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "envelope_frequency_ratio"), "set_envelope_frequency_ratio", "get_envelope_frequency_ratio"); + + ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "lfo_wave_shape"), "set_lfo_wave_shape", "get_lfo_wave_shape"); + ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "lfo_frequency_step"), "set_lfo_frequency_step", "get_lfo_frequency_step"); + + ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "amplitude_modulation_depth"), "set_amplitude_modulation_depth", "get_amplitude_modulation_depth"); + ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "pitch_modulation_depth"), "set_pitch_modulation_depth", "get_pitch_modulation_depth"); + + ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "pan"), "set_pan", "get_pan"); + ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "filter_type"), "set_filter_type", "get_filter_type"); ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "filter_cutoff"), "set_filter_cutoff", "get_filter_cutoff"); ClassDB::add_property("SiOPMChannelParams", PropertyInfo(Variant::INT, "filter_resonance"), "set_filter_resonance", "get_filter_resonance"); diff --git a/src/chip/siopm_sound_chip.cpp b/src/chip/siopm_sound_chip.cpp index 60b13c6..88ffd38 100644 --- a/src/chip/siopm_sound_chip.cpp +++ b/src/chip/siopm_sound_chip.cpp @@ -6,6 +6,7 @@ #include "siopm_sound_chip.h" +#include #include "chip/channels/siopm_channel_manager.h" #include "chip/siopm_operator_params.h" #include "chip/siopm_stream.h" @@ -73,6 +74,10 @@ void SiOPMSoundChip::reset() { SiOPMChannelManager::reset_all_channels(); } +void SiOPMSoundChip::_bind_methods() { + BIND_CONSTANT(STREAM_SEND_SIZE); +} + SiOPMSoundChip::SiOPMSoundChip() { init_operator_params = memnew(SiOPMOperatorParams); diff --git a/src/chip/siopm_sound_chip.h b/src/chip/siopm_sound_chip.h index 96ca3d1..97b65e6 100644 --- a/src/chip/siopm_sound_chip.h +++ b/src/chip/siopm_sound_chip.h @@ -37,7 +37,7 @@ class SiOPMSoundChip : public Object { Vector *>> _pipe_buffer_pager; protected: - static void _bind_methods() {} + static void _bind_methods(); public: static const int STREAM_SEND_SIZE = 8; diff --git a/src/effector/si_effect_composite.cpp b/src/effector/si_effect_composite.cpp index 6920657..151a282 100644 --- a/src/effector/si_effect_composite.cpp +++ b/src/effector/si_effect_composite.cpp @@ -17,20 +17,20 @@ void SiEffectComposite::_set_slot_effects_bind(int p_slot, TypedArray> p_effects) { - ERR_FAIL_INDEX(p_slot, 8); + ERR_FAIL_INDEX(p_slot, SLOTS_MAX); _slots[p_slot].effects = p_effects; } void SiEffectComposite::set_slot_levels(int p_slot, double p_send_level, double p_mix_level) { - ERR_FAIL_INDEX(p_slot, 8); + ERR_FAIL_INDEX(p_slot, SLOTS_MAX); _slots[p_slot].send_level = p_send_level; _slots[p_slot].mix_level = p_mix_level; } int SiEffectComposite::prepare_process() { - for (int i = 0; i < 8; i++) { + for (int i = 0; i < SLOTS_MAX; i++) { for (Ref effect : _slots[i].effects) { effect->prepare_process(); } @@ -40,25 +40,26 @@ int SiEffectComposite::prepare_process() { } int SiEffectComposite::process(int p_channels, Vector *r_buffer, int p_start_index, int p_length) { - for (int i = 0; i < 8; i++) { + for (int i = 1; i < SLOTS_MAX; i++) { if (_slots[i].effects.is_empty()) { continue; } - Vector slot_buffer = _slots[i].buffer; - if (slot_buffer.size() < r_buffer->size()) { - slot_buffer.resize_zeroed(r_buffer->size()); + Vector *slot_buffer = &_slots[i].buffer; + if (slot_buffer->size() < r_buffer->size()) { + slot_buffer->resize_zeroed(r_buffer->size()); } for (int j = p_start_index; j < (p_start_index + p_length); j++) { - slot_buffer.write[j] = (*r_buffer)[j] * _slots[i].send_level; + slot_buffer->write[j] = (*r_buffer)[j] * _slots[i].send_level; } } for (int j = p_start_index; j < (p_start_index + p_length); j++) { r_buffer->write[j] *= _slots[0].send_level; } - for (int i = 1; i < 8; i++) { + + for (int i = 1; i < SLOTS_MAX; i++) { if (_slots[i].effects.is_empty()) { continue; } @@ -90,7 +91,7 @@ int SiEffectComposite::process(int p_channels, Vector *r_buffer, int p_s } void SiEffectComposite::reset() { - for (int i = 0; i < 8; i++) { + for (int i = 0; i < SLOTS_MAX; i++) { _slots[i].effects.clear(); _slots[i].buffer.clear(); _slots[i].send_level = 1; diff --git a/src/effector/si_effect_composite.h b/src/effector/si_effect_composite.h index 8fd8d54..786978f 100644 --- a/src/effector/si_effect_composite.h +++ b/src/effector/si_effect_composite.h @@ -15,6 +15,8 @@ using namespace godot; class SiEffectComposite : public SiEffectBase { GDCLASS(SiEffectComposite, SiEffectBase) + static const int SLOTS_MAX = 8; + struct SlottedEffect { Vector> effects; Vector buffer; @@ -22,7 +24,7 @@ class SiEffectComposite : public SiEffectBase { double mix_level = 1; }; - SlottedEffect _slots[8]; + SlottedEffect _slots[SLOTS_MAX]; void _set_slot_effects_bind(int p_slot, TypedArray p_effects); diff --git a/src/effector/si_effector.cpp b/src/effector/si_effector.cpp index 34b23cf..969ac05 100644 --- a/src/effector/si_effector.cpp +++ b/src/effector/si_effector.cpp @@ -38,6 +38,8 @@ HashMap>> SiEffector::_effect_instances; SiEffectStream *SiEffector::_get_global_stream(int p_slot) { + ERR_FAIL_INDEX_V(p_slot, SiOPMSoundChip::STREAM_SEND_SIZE, nullptr); + if (_global_effects[p_slot] == nullptr) { SiEffectStream *stream = _alloc_stream(0); _global_effects.write[p_slot] = stream; @@ -141,6 +143,8 @@ Ref SiEffector::create_effect_instance() { // Slots and connections. TypedArray SiEffector::get_slot_effects(int p_slot) const { + ERR_FAIL_INDEX_V_MSG(p_slot, SiOPMSoundChip::STREAM_SEND_SIZE, TypedArray(), "SiEffector: Invalid effect slot index."); + if (!_global_effects[p_slot]) { return TypedArray(); } @@ -156,12 +160,16 @@ TypedArray SiEffector::get_slot_effects(int p_slot) const { } void SiEffector::add_slot_effect(int p_slot, const Ref &p_effect) { + ERR_FAIL_INDEX_MSG(p_slot, SiOPMSoundChip::STREAM_SEND_SIZE, "SiEffector: Invalid effect slot index."); + SiEffectStream *stream = _get_global_stream(p_slot); stream->add_to_chain(p_effect); p_effect->prepare_process(); } void SiEffector::set_slot_effects(int p_slot, const TypedArray &p_effects) { + ERR_FAIL_INDEX_MSG(p_slot, SiOPMSoundChip::STREAM_SEND_SIZE, "SiEffector: Invalid effect slot index."); + List> chained_effects; for (int i = 0; i < p_effects.size(); i++) { Ref effect = p_effects[i]; @@ -174,6 +182,8 @@ void SiEffector::set_slot_effects(int p_slot, const TypedArray &p_ } void SiEffector::clear_slot_effects(int p_slot) { + ERR_FAIL_INDEX_MSG(p_slot, SiOPMSoundChip::STREAM_SEND_SIZE, "SiEffector: Invalid effect slot index."); + if (p_slot == 0) { _master_effect->initialize(0); } else { @@ -213,6 +223,8 @@ void SiEffector::delete_local_effect(SiEffectStream *p_effect) { } void SiEffector::parse_global_effect_mml(int p_slot, String p_mml, String p_postfix) { + ERR_FAIL_INDEX_MSG(p_slot, SiOPMSoundChip::STREAM_SEND_SIZE, "SiEffector: Invalid effect slot index."); + SiEffectStream *stream = _get_global_stream(p_slot); stream->parse_mml(p_slot, p_mml, p_postfix); } diff --git a/src/events/sion_event.cpp b/src/events/sion_event.cpp index ffbcf0e..6fa3b60 100644 --- a/src/events/sion_event.cpp +++ b/src/events/sion_event.cpp @@ -30,6 +30,7 @@ Ref SiONEvent::get_data() const { // void SiONEvent::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_event_type"), &SiONEvent::get_event_type); ClassDB::bind_method(D_METHOD("get_driver"), &SiONEvent::get_driver); ClassDB::bind_method(D_METHOD("get_data"), &SiONEvent::get_data); ClassDB::bind_method(D_METHOD("get_stream_buffer"), &SiONEvent::get_stream_buffer); diff --git a/src/sequencer/simml_ref_table.cpp b/src/sequencer/simml_ref_table.cpp index f474bb8..df6425b 100644 --- a/src/sequencer/simml_ref_table.cpp +++ b/src/sequencer/simml_ref_table.cpp @@ -194,21 +194,21 @@ SiMMLRefTable::SiMMLRefTable() { // Channel module settings map. { - channel_settings_map[MT_PSG] = memnew(SiMMLChannelSettings(MT_PSG, PG_SQUARE, 3, 1, 4)); // PSG - channel_settings_map[MT_APU] = memnew(SiMMLChannelSettings(MT_APU, PG_PULSE, 11, 2, 4)); // FC pAPU - channel_settings_map[MT_NOISE] = memnew(SiMMLChannelSettings(MT_NOISE, PG_NOISE_WHITE, 16, 1, 16)); // noise - channel_settings_map[MT_MA3] = memnew(SiMMLChannelSettings(MT_MA3, PG_MA3_WAVE, 32, 1, 32)); // MA3 - channel_settings_map[MT_CUSTOM] = memnew(SiMMLChannelSettings(MT_CUSTOM, PG_CUSTOM, 256, 1, 256)); // SCC / custom wave table - channel_settings_map[MT_ALL] = memnew(SiMMLChannelSettings(MT_ALL, PG_SINE, 512, 1, 512)); // all pgTypes - channel_settings_map[MT_FM] = memnew(SiMMLChannelSettings(MT_FM, PG_SINE, 1, 1, 1)); // FM sound module - channel_settings_map[MT_PCM] = memnew(SiMMLChannelSettings(MT_PCM, PG_PCM, 128, 1, 128)); // PCM - channel_settings_map[MT_PULSE] = memnew(SiMMLChannelSettings(MT_PULSE, PG_PULSE, 32, 1, 32)); // pulse - channel_settings_map[MT_RAMP] = memnew(SiMMLChannelSettings(MT_RAMP, PG_RAMP, 128, 1, 128)); // ramp - channel_settings_map[MT_SAMPLE] = memnew(SiMMLChannelSettings(MT_SAMPLE, PG_SINE, 4, 1, 4)); // sampler. this is based on SiOPMChannelSampler - channel_settings_map[MT_KS] = memnew(SiMMLChannelSettings(MT_KS, PG_SINE, 3, 1, 3)); // karplus strong (0-2 to choose seed generator algrithm) - channel_settings_map[MT_GB] = memnew(SiMMLChannelSettings(MT_GB, PG_PULSE, 11, 2, 4)); // Gameboy - channel_settings_map[MT_VRC6] = memnew(SiMMLChannelSettings(MT_VRC6, PG_PULSE, 9, 1, 3)); // VRC6 - channel_settings_map[MT_SID] = memnew(SiMMLChannelSettings(MT_SID, PG_PULSE, 12, 1, 3)); // SID + channel_settings_map[MT_PSG] = memnew(SiMMLChannelSettings(MT_PSG, PG_SQUARE, 3, 1, 4)); + channel_settings_map[MT_APU] = memnew(SiMMLChannelSettings(MT_APU, PG_PULSE, 11, 2, 4)); + channel_settings_map[MT_NOISE] = memnew(SiMMLChannelSettings(MT_NOISE, PG_NOISE_WHITE, 16, 1, 16)); + channel_settings_map[MT_MA3] = memnew(SiMMLChannelSettings(MT_MA3, PG_MA3_WAVE, 32, 1, 32)); + channel_settings_map[MT_CUSTOM] = memnew(SiMMLChannelSettings(MT_CUSTOM, PG_CUSTOM, 256, 1, 256)); + channel_settings_map[MT_ALL] = memnew(SiMMLChannelSettings(MT_ALL, PG_SINE, 512, 1, 512)); + channel_settings_map[MT_FM] = memnew(SiMMLChannelSettings(MT_FM, PG_SINE, 1, 1, 1)); + channel_settings_map[MT_PCM] = memnew(SiMMLChannelSettings(MT_PCM, PG_PCM, 128, 1, 128)); + channel_settings_map[MT_PULSE] = memnew(SiMMLChannelSettings(MT_PULSE, PG_PULSE, 32, 1, 32)); + channel_settings_map[MT_RAMP] = memnew(SiMMLChannelSettings(MT_RAMP, PG_RAMP, 128, 1, 128)); + channel_settings_map[MT_SAMPLE] = memnew(SiMMLChannelSettings(MT_SAMPLE, PG_SINE, 4, 1, 4)); + channel_settings_map[MT_KS] = memnew(SiMMLChannelSettings(MT_KS, PG_SINE, 3, 1, 3)); + channel_settings_map[MT_GB] = memnew(SiMMLChannelSettings(MT_GB, PG_PULSE, 11, 2, 4)); + channel_settings_map[MT_VRC6] = memnew(SiMMLChannelSettings(MT_VRC6, PG_PULSE, 9, 1, 3)); + channel_settings_map[MT_SID] = memnew(SiMMLChannelSettings(MT_SID, PG_PULSE, 12, 1, 3)); // PSG settings. { diff --git a/src/sequencer/simml_track.cpp b/src/sequencer/simml_track.cpp index 2b73b35..2b64987 100644 --- a/src/sequencer/simml_track.cpp +++ b/src/sequencer/simml_track.cpp @@ -1006,6 +1006,9 @@ void SiMMLTrack::initialize(MMLSequence *p_sequence, int p_fps, int p_internal_t void SiMMLTrack::_bind_methods() { // To be used as callables. ClassDB::bind_method(D_METHOD("_default_update_register", "address", "data"), &SiMMLTrack::_default_update_register); + + ClassDB::bind_method(D_METHOD("get_track_id"), &SiMMLTrack::get_track_id); + ClassDB::bind_method(D_METHOD("get_track_type_id"), &SiMMLTrack::get_track_type_id); } SiMMLTrack::SiMMLTrack() { diff --git a/src/sion_driver.cpp b/src/sion_driver.cpp index 914c8a0..1559dda 100644 --- a/src/sion_driver.cpp +++ b/src/sion_driver.cpp @@ -1090,7 +1090,7 @@ void SiONDriver::_publish_note_event(SiMMLTrack *p_track, int p_type, String p_f return; } - // Sound event; dispatch immediately. + // Stream event; dispatch immediately. if (p_type & 2) { Ref event = memnew(SiONTrackEvent(p_stream_event, this, p_track)); _dispatch_event(event); @@ -1212,11 +1212,11 @@ void SiONDriver::_bind_methods() { ClassDB::bind_method(D_METHOD("pause"), &SiONDriver::pause); ClassDB::bind_method(D_METHOD("resume"), &SiONDriver::resume); - ClassDB::bind_method(D_METHOD("play_sound", "sample_number", "length", "delay", "quant", "track_id", "disposable"), &SiONDriver::play_sound, DEFVAL(0), DEFVAL(0), DEFVAL(0), DEFVAL(0), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("note_on", "note", "voice", "length", "delay", "quant", "track_id", "disposable"), &SiONDriver::note_on, DEFVAL((Object *)nullptr), DEFVAL(0), DEFVAL(0), DEFVAL(0), DEFVAL(0), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("note_off", "note", "track_id", "delay", "quant", "stop_immediately"), &SiONDriver::note_off, DEFVAL(0), DEFVAL(0), DEFVAL(0), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("sequence_on", "data", "voice", "length", "delay", "quant", "track_id", "disposable"), &SiONDriver::sequence_on, DEFVAL((Object *)nullptr), DEFVAL(0), DEFVAL(0), DEFVAL(1), DEFVAL(0), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("sequence_off", "track_id", "delay", "quant", "stop_with_reset"), &SiONDriver::sequence_off, DEFVAL(0), DEFVAL(1), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("play_sound", "sample_number", "length", "delay", "quantize", "track_id", "disposable"), &SiONDriver::play_sound, DEFVAL(0), DEFVAL(0), DEFVAL(0), DEFVAL(0), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("note_on", "note", "voice", "length", "delay", "quantize", "track_id", "disposable"), &SiONDriver::note_on, DEFVAL((Object *)nullptr), DEFVAL(0), DEFVAL(0), DEFVAL(0), DEFVAL(0), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("note_off", "note", "track_id", "delay", "quantize", "stop_immediately"), &SiONDriver::note_off, DEFVAL(0), DEFVAL(0), DEFVAL(0), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("sequence_on", "data", "voice", "length", "delay", "quantize", "track_id", "disposable"), &SiONDriver::sequence_on, DEFVAL((Object *)nullptr), DEFVAL(0), DEFVAL(0), DEFVAL(1), DEFVAL(0), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("sequence_off", "track_id", "delay", "quantize", "stop_with_reset"), &SiONDriver::sequence_off, DEFVAL(0), DEFVAL(1), DEFVAL(false)); // Sub-module access. @@ -1226,24 +1226,24 @@ void SiONDriver::_bind_methods() { ADD_SIGNAL(MethodInfo("timer_interval")); - ADD_SIGNAL(MethodInfo(SiONEvent::QUEUE_EXECUTING, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONEvent::QUEUE_COMPLETED, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONEvent::QUEUE_CANCELLED, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONEvent::STREAMING, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONEvent::STREAM_STARTED, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONEvent::STREAM_STOPPED, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONEvent::SEQUENCE_FINISHED, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONEvent::FADING, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONEvent::FADE_IN_COMPLETED, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONEvent::FADE_OUT_COMPLETED, PropertyInfo(Variant::OBJECT, "event"))); - - ADD_SIGNAL(MethodInfo(SiONTrackEvent::NOTE_ON_STREAM, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONTrackEvent::NOTE_OFF_STREAM, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONTrackEvent::NOTE_ON_FRAME, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONTrackEvent::NOTE_OFF_FRAME, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONTrackEvent::STREAMING_BEAT, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONTrackEvent::BPM_CHANGED, PropertyInfo(Variant::OBJECT, "event"))); - ADD_SIGNAL(MethodInfo(SiONTrackEvent::USER_DEFINED, PropertyInfo(Variant::OBJECT, "event"))); + ADD_SIGNAL(MethodInfo(SiONEvent::QUEUE_EXECUTING, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONEvent"))); + ADD_SIGNAL(MethodInfo(SiONEvent::QUEUE_COMPLETED, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONEvent"))); + ADD_SIGNAL(MethodInfo(SiONEvent::QUEUE_CANCELLED, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONEvent"))); + ADD_SIGNAL(MethodInfo(SiONEvent::STREAMING, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONEvent"))); + ADD_SIGNAL(MethodInfo(SiONEvent::STREAM_STARTED, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONEvent"))); + ADD_SIGNAL(MethodInfo(SiONEvent::STREAM_STOPPED, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONEvent"))); + ADD_SIGNAL(MethodInfo(SiONEvent::SEQUENCE_FINISHED, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONEvent"))); + ADD_SIGNAL(MethodInfo(SiONEvent::FADING, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONEvent"))); + ADD_SIGNAL(MethodInfo(SiONEvent::FADE_IN_COMPLETED, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONEvent"))); + ADD_SIGNAL(MethodInfo(SiONEvent::FADE_OUT_COMPLETED, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONEvent"))); + + ADD_SIGNAL(MethodInfo(SiONTrackEvent::NOTE_ON_STREAM, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONTrackEvent"))); + ADD_SIGNAL(MethodInfo(SiONTrackEvent::NOTE_OFF_STREAM, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONTrackEvent"))); + ADD_SIGNAL(MethodInfo(SiONTrackEvent::NOTE_ON_FRAME, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONTrackEvent"))); + ADD_SIGNAL(MethodInfo(SiONTrackEvent::NOTE_OFF_FRAME, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONTrackEvent"))); + ADD_SIGNAL(MethodInfo(SiONTrackEvent::STREAMING_BEAT, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONTrackEvent"))); + ADD_SIGNAL(MethodInfo(SiONTrackEvent::BPM_CHANGED, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONTrackEvent"))); + ADD_SIGNAL(MethodInfo(SiONTrackEvent::USER_DEFINED, PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "SiONTrackEvent"))); // diff --git a/src/sion_enums.h b/src/sion_enums.h index ae3d080..15cf042 100644 --- a/src/sion_enums.h +++ b/src/sion_enums.h @@ -10,21 +10,21 @@ #include enum SiONModuleType : unsigned int { - MT_PSG = 0, // PSG(DCSG) + MT_PSG = 0, // PSG (DCSG) MT_APU = 1, // FC pAPU - MT_NOISE = 2, // noise wave + MT_NOISE = 2, // Noise wave MT_MA3 = 3, // MA3 wave form MT_CUSTOM = 4, // SCC / custom wave table - MT_ALL = 5, // all pgTypes + MT_ALL = 5, // All PG types MT_FM = 6, // FM sound module MT_PCM = 7, // PCM - MT_PULSE = 8, // pulse wave - MT_RAMP = 9, // ramp wave - MT_SAMPLE = 10, // sampler - MT_KS = 11, // karplus strong - MT_GB = 12, // gameboy - MT_VRC6 = 13, // vrc6 - MT_SID = 14, // sid + MT_PULSE = 8, // Pulse wave + MT_RAMP = 9, // Ramp wave + MT_SAMPLE = 10, // Sampler + MT_KS = 11, // Karplus-Strong + MT_GB = 12, // GameBoy-like + MT_VRC6 = 13, // VRC6 + MT_SID = 14, // SID MT_FM_OPM = 15, // YM2151 MT_FM_OPN = 16, // YM2203 MT_FM_OPNA = 17, // YM2608 @@ -76,7 +76,7 @@ enum SiONPulseGeneratorType : int { // ( 96-127) reserved PG_RAMP = 128, // (128-255) ramp wave. PG_RAMP+[0,127] PG_CUSTOM = 256, // (256-383) custom wave table. PG_CUSTOM+[0,127] - PG_PCM = 384, // (384-511) PCM data. PG_PCM+[0,128] + PG_PCM = 384, // (384-511) PCM data. PG_PCM+[0,127] PG_USER_CUSTOM = -1, // User registered custom wave table. PG_USER_PCM = -2, // User registered PCM data.