fmod 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +5 -0
- data/.yardopts +2 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +96 -0
- data/Rakefile +1 -0
- data/bin/console +28 -0
- data/bin/setup +8 -0
- data/ext/fmod.dll +0 -0
- data/ext/fmod64.dll +0 -0
- data/ext/libfmod.dylib +0 -0
- data/ext/llbfmod.zip +0 -0
- data/extras/FMOD Studio Programmers API for Windows.chm +0 -0
- data/fmod.gemspec +58 -0
- data/lib/fmod.rb +564 -0
- data/lib/fmod/channel.rb +151 -0
- data/lib/fmod/channel_control.rb +821 -0
- data/lib/fmod/channel_group.rb +61 -0
- data/lib/fmod/core.rb +35 -0
- data/lib/fmod/core/bool_description.rb +18 -0
- data/lib/fmod/core/channel_mask.rb +24 -0
- data/lib/fmod/core/data_description.rb +14 -0
- data/lib/fmod/core/driver.rb +59 -0
- data/lib/fmod/core/dsp_description.rb +7 -0
- data/lib/fmod/core/dsp_index.rb +9 -0
- data/lib/fmod/core/dsp_type.rb +43 -0
- data/lib/fmod/core/extensions.rb +28 -0
- data/lib/fmod/core/file_system.rb +86 -0
- data/lib/fmod/core/filter_type.rb +19 -0
- data/lib/fmod/core/float_description.rb +16 -0
- data/lib/fmod/core/guid.rb +50 -0
- data/lib/fmod/core/init_flags.rb +19 -0
- data/lib/fmod/core/integer_description.rb +26 -0
- data/lib/fmod/core/mode.rb +36 -0
- data/lib/fmod/core/output_type.rb +30 -0
- data/lib/fmod/core/parameter_info.rb +41 -0
- data/lib/fmod/core/parameter_type.rb +10 -0
- data/lib/fmod/core/result.rb +88 -0
- data/lib/fmod/core/reverb.rb +217 -0
- data/lib/fmod/core/sound_ex_info.rb +7 -0
- data/lib/fmod/core/sound_format.rb +30 -0
- data/lib/fmod/core/sound_group_behavior.rb +9 -0
- data/lib/fmod/core/sound_type.rb +80 -0
- data/lib/fmod/core/speaker_index.rb +18 -0
- data/lib/fmod/core/speaker_mode.rb +16 -0
- data/lib/fmod/core/spectrum_data.rb +12 -0
- data/lib/fmod/core/structure.rb +23 -0
- data/lib/fmod/core/structures.rb +41 -0
- data/lib/fmod/core/tag.rb +51 -0
- data/lib/fmod/core/tag_data_type.rb +14 -0
- data/lib/fmod/core/time_unit.rb +40 -0
- data/lib/fmod/core/vector.rb +42 -0
- data/lib/fmod/core/window_type.rb +12 -0
- data/lib/fmod/dsp.rb +510 -0
- data/lib/fmod/dsp_connection.rb +113 -0
- data/lib/fmod/effects.rb +38 -0
- data/lib/fmod/effects/channel_mix.rb +101 -0
- data/lib/fmod/effects/chorus.rb +30 -0
- data/lib/fmod/effects/compressor.rb +52 -0
- data/lib/fmod/effects/convolution_reverb.rb +31 -0
- data/lib/fmod/effects/delay.rb +44 -0
- data/lib/fmod/effects/distortion.rb +16 -0
- data/lib/fmod/effects/dsps.rb +10 -0
- data/lib/fmod/effects/echo.rb +37 -0
- data/lib/fmod/effects/envelope_follower.rb +31 -0
- data/lib/fmod/effects/fader.rb +16 -0
- data/lib/fmod/effects/fft.rb +38 -0
- data/lib/fmod/effects/flange.rb +37 -0
- data/lib/fmod/effects/high_pass.rb +24 -0
- data/lib/fmod/effects/high_pass_simple.rb +25 -0
- data/lib/fmod/effects/it_echo.rb +56 -0
- data/lib/fmod/effects/it_lowpass.rb +36 -0
- data/lib/fmod/effects/ladspa_plugin.rb +14 -0
- data/lib/fmod/effects/limiter.rb +32 -0
- data/lib/fmod/effects/loudness_meter.rb +19 -0
- data/lib/fmod/effects/low_pass.rb +25 -0
- data/lib/fmod/effects/low_pass_simple.rb +26 -0
- data/lib/fmod/effects/mixer.rb +11 -0
- data/lib/fmod/effects/multiband_eq.rb +153 -0
- data/lib/fmod/effects/normalize.rb +47 -0
- data/lib/fmod/effects/object_pan.rb +62 -0
- data/lib/fmod/effects/oscillator.rb +52 -0
- data/lib/fmod/effects/pan.rb +166 -0
- data/lib/fmod/effects/param_eq.rb +36 -0
- data/lib/fmod/effects/pitch_shift.rb +47 -0
- data/lib/fmod/effects/return.rb +18 -0
- data/lib/fmod/effects/send.rb +21 -0
- data/lib/fmod/effects/sfx_reverb.rb +87 -0
- data/lib/fmod/effects/three_eq.rb +41 -0
- data/lib/fmod/effects/transceiver.rb +57 -0
- data/lib/fmod/effects/tremolo.rb +67 -0
- data/lib/fmod/effects/vst_plugin.rb +12 -0
- data/lib/fmod/effects/winamp_plugin.rb +12 -0
- data/lib/fmod/error.rb +108 -0
- data/lib/fmod/geometry.rb +380 -0
- data/lib/fmod/handle.rb +129 -0
- data/lib/fmod/reverb3D.rb +98 -0
- data/lib/fmod/sound.rb +810 -0
- data/lib/fmod/sound_group.rb +54 -0
- data/lib/fmod/system.rb +1242 -0
- data/lib/fmod/version.rb +3 -0
- metadata +220 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
module FMOD
|
|
3
|
+
module Effects
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# @deprecated Deprecated and will be removed in a future release.
|
|
7
|
+
#
|
|
8
|
+
# This unit tracks the envelope of the input/side-chain signal.
|
|
9
|
+
#
|
|
10
|
+
# @attr attack [Float] Attack time (milliseconds).
|
|
11
|
+
# * *Minimum:* 0.1
|
|
12
|
+
# * *Maximum:* 1000.0
|
|
13
|
+
# * *Default:* 20.0
|
|
14
|
+
# @attr release [Float] Release time (milliseconds).
|
|
15
|
+
# * *Minimum:* 10.0
|
|
16
|
+
# * *Maximum:* 5000.0
|
|
17
|
+
# * *Default:* 100.0
|
|
18
|
+
# @attr_reader envelope [Float] Current value of the envelope.
|
|
19
|
+
# * *Minimum:* 0.0
|
|
20
|
+
# * *Maximum:* 1.0
|
|
21
|
+
# @attr side_chain [Fiddle::Pointer|String] Whether to analyse the
|
|
22
|
+
# side-chain signal instead of the input signal.
|
|
23
|
+
# @note This unit does not affect the incoming signal.
|
|
24
|
+
class EnvelopeFollower < Dsp
|
|
25
|
+
float_param(0, :attack, min: 0.1, max: 1000.0)
|
|
26
|
+
float_param(1, :release, min: 10.0, max: 5000.0)
|
|
27
|
+
float_param(2, :envelope, readonly: true)
|
|
28
|
+
data_param(3, :side_chain)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
module FMOD
|
|
3
|
+
module Effects
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# This unit pans and scales the volume of a unit.
|
|
7
|
+
#
|
|
8
|
+
# @attr gain [Float] Signal gain in dB.
|
|
9
|
+
# * *Minimum:* -80.0
|
|
10
|
+
# * *Maximum:* 10.0
|
|
11
|
+
# * *Default:* 0.0
|
|
12
|
+
class Fader < Dsp
|
|
13
|
+
float_param(0, :gain, min: -80.0, max: 10.0)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module FMOD
|
|
2
|
+
module Effects
|
|
3
|
+
|
|
4
|
+
##
|
|
5
|
+
# This unit simply analyzes the signal and provides spectrum information.
|
|
6
|
+
#
|
|
7
|
+
# Set the attributes for the spectrum analysis with {#window_size} and
|
|
8
|
+
# {#window_type}, and retrieve the results with {#spectrum} and
|
|
9
|
+
# {#dominant_frequency}.
|
|
10
|
+
#
|
|
11
|
+
# @attr window_size [Integer] The size of the FFT window. Must be a power of
|
|
12
|
+
# 2.
|
|
13
|
+
# * *Minimum:* 128
|
|
14
|
+
# * *Maximum:* 16384
|
|
15
|
+
# * *Default:* 2048
|
|
16
|
+
# * *Valid:* 128, 256, 512, 1024, 2048, 4096, 8192, 16384
|
|
17
|
+
# @attr window_type [Integer] The shape of the FFT window.
|
|
18
|
+
# * *Minimum:* 0
|
|
19
|
+
# * *Maximum:* 5
|
|
20
|
+
# * *Default:* {WindowType::HAMMING}
|
|
21
|
+
# @see WindowType
|
|
22
|
+
# @attr_reader spectrum [Pointer] Retrieves a pointer to the current
|
|
23
|
+
# spectrum values between 0 and 1 for each "FFT bin".
|
|
24
|
+
# @attr_reader dominant_frequency [Float] The dominant frequencies for each
|
|
25
|
+
# channel.
|
|
26
|
+
#
|
|
27
|
+
# @see SpectrumData
|
|
28
|
+
class FFT < Dsp
|
|
29
|
+
integer_param(0, :window_size, min: 128, max: 16384)
|
|
30
|
+
integer_param(1, :window_type, min: 0, max: 5)
|
|
31
|
+
data_param(2, :spectrum, readonly: true)
|
|
32
|
+
float_param(3, :dominant_frequency, readonly: true)
|
|
33
|
+
|
|
34
|
+
# TODO Get SpectrumData structs
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
module FMOD
|
|
3
|
+
module Effects
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# This unit produces a flange effect on the sound.
|
|
7
|
+
#
|
|
8
|
+
# Flange is an effect where the signal is played twice at the same time, and
|
|
9
|
+
# one copy slides back and forth creating a whooshing or flanging effect.
|
|
10
|
+
#
|
|
11
|
+
# As there are 2 copies of the same signal, by default each signal is given
|
|
12
|
+
# 50% mix, so that the total is not louder than the original unaffected
|
|
13
|
+
# signal.
|
|
14
|
+
#
|
|
15
|
+
# Flange depth is a percentage of a 10ms shift from the original signal.
|
|
16
|
+
# Anything above 10ms is not considered flange because to the ear it begins
|
|
17
|
+
# to "echo" so 10ms is the highest value possible.
|
|
18
|
+
#
|
|
19
|
+
# @attr mix [Float] Percentage of wet signal in mix.
|
|
20
|
+
# * *Minimum:* 0.0
|
|
21
|
+
# * *Maximum:* 100.0
|
|
22
|
+
# * *Default:* 50.0
|
|
23
|
+
# @attr depth [Float] Flange depth (percentage of 40ms delay).
|
|
24
|
+
# * *Minimum:* 0.01
|
|
25
|
+
# * *Maximum:* 1.0
|
|
26
|
+
# * *Default:* 1.0
|
|
27
|
+
# @attr rate [Float] Flange speed in Hz.
|
|
28
|
+
# * *Minimum:* 0.0
|
|
29
|
+
# * *Maximum:* 20.0
|
|
30
|
+
# * *Default:* 0.1
|
|
31
|
+
class Flange < Dsp
|
|
32
|
+
float_param(0, :mix, min: 0.0, max: 100.0)
|
|
33
|
+
float_param(1, :depth, min: 0.01, max: 1.0)
|
|
34
|
+
float_param(2, :rate, min: 0.0, max: 20.0)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
module FMOD
|
|
3
|
+
module Effects
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# @deprecated Will be removed in a future FMOD version. See {MultibandEq}
|
|
7
|
+
# for alternatives.
|
|
8
|
+
#
|
|
9
|
+
# This unit filters sound using a resonant high-pass filter algorithm.
|
|
10
|
+
#
|
|
11
|
+
# @attr cutoff [Float] High-pass cutoff frequency in Hz.
|
|
12
|
+
# * *Minimum:* 1.0
|
|
13
|
+
# * *Maximum:* 22000.0
|
|
14
|
+
# * *Default:* 5000.0
|
|
15
|
+
# @attr resonance [Float] High-pass resonance Q value.
|
|
16
|
+
# * *Minimum:* 1.0
|
|
17
|
+
# * *Maximum:* 10.0
|
|
18
|
+
# * *Default:* 1.0
|
|
19
|
+
class HighPass < Dsp
|
|
20
|
+
float_param(0, :cutoff, min: 1.0, max: 22000.0)
|
|
21
|
+
float_param(1, :resonance, min: 1.0, max: 10.0)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
module FMOD
|
|
3
|
+
module Effects
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# @deprecated Will be removed in a future FMOD version. See {MultibandEq}
|
|
7
|
+
# for alternatives.
|
|
8
|
+
#
|
|
9
|
+
# This unit filters sound using a simple high-pass with no resonance, but
|
|
10
|
+
# has flexible cutoff and is fast.
|
|
11
|
+
#
|
|
12
|
+
# This is a very simple single-order high pass filter.
|
|
13
|
+
#
|
|
14
|
+
# The emphasis is on speed rather than accuracy, so this should not be used
|
|
15
|
+
# for task requiring critical filtering.
|
|
16
|
+
#
|
|
17
|
+
# @attr cutoff [Float] High-pass cutoff frequency in Hz.
|
|
18
|
+
# * *Minimum:* 10.0
|
|
19
|
+
# * *Maximum:* 22000.0
|
|
20
|
+
# * *Default:* 1000.0
|
|
21
|
+
class HighPassSimple < Dsp
|
|
22
|
+
float_param(0, :cutoff, min: 10.0, max: 22000.0)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
module FMOD
|
|
3
|
+
module Effects
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# This unit produces an echo on the sound and fades out at the desired rate
|
|
7
|
+
# as is used in Impulse Tracker.
|
|
8
|
+
#
|
|
9
|
+
# This is effectively a software based echo filter that emulates the DirectX
|
|
10
|
+
# DMO echo effect. Impulse tracker files can support this, and FMOD will
|
|
11
|
+
# produce the effect on ANY platform, not just those that support DirectX
|
|
12
|
+
# effects!
|
|
13
|
+
#
|
|
14
|
+
# @note Every time the delay is changed, the plugin re-allocates the echo
|
|
15
|
+
# buffer. This means the echo will disappear at that time while it refills
|
|
16
|
+
# its new buffer.
|
|
17
|
+
#
|
|
18
|
+
# Larger echo delays result in larger amounts of memory allocated.
|
|
19
|
+
#
|
|
20
|
+
# As this is a stereo filter made mainly for IT playback, it is targeted
|
|
21
|
+
# for stereo signals. With mono signals only the {#left_delay} is used.
|
|
22
|
+
#
|
|
23
|
+
# For multichannel signals (>2) there will be no echo on those channels.
|
|
24
|
+
# @attr wet_dry_mix [Float] Ratio of wet (processed) signal to dry
|
|
25
|
+
# (unprocessed) signal.
|
|
26
|
+
# * *Minimum:* 0.0 (all dry)
|
|
27
|
+
# * *Maximum:* 100.0 (all wet)
|
|
28
|
+
# * *Default:* 50.0
|
|
29
|
+
# @attr feedback [Float] Percentage of output fed back into input.
|
|
30
|
+
# * *Minimum:* 0.0
|
|
31
|
+
# * *Maximum:* 100.0
|
|
32
|
+
# * *Default:* 50.0
|
|
33
|
+
# @attr left_delay [Float] Delay for left channel, in milliseconds.
|
|
34
|
+
# * *Minimum:* 1.0
|
|
35
|
+
# * *Maximum:* 2000.0
|
|
36
|
+
# * *Default:* 500.0
|
|
37
|
+
# @attr right_delay [Float] Delay for right channel, in milliseconds.
|
|
38
|
+
# * *Minimum:* 1.0
|
|
39
|
+
# * *Maximum:* 2000.0
|
|
40
|
+
# * *Default:* 500.0
|
|
41
|
+
# @attr pan_delay [Float] Value that specifies whether to swap left and
|
|
42
|
+
# right delays with each successive echo. Ranges from 0.0 (equivalent to
|
|
43
|
+
# +false+) to 1.0 (equivalent to +true+), meaning no swap.
|
|
44
|
+
# @note Currently not supported within the FMOD API.
|
|
45
|
+
# * *Minimum:* 0.0
|
|
46
|
+
# * *Maximum:* 1.0
|
|
47
|
+
# * *Default:* 0.0
|
|
48
|
+
class ITEcho < Dsp
|
|
49
|
+
float_param(0, :wet_dry_mix, min: 0.0, max: 100.0)
|
|
50
|
+
float_param(1, :feedback, min: 0.0, max: 100.0)
|
|
51
|
+
float_param(2, :left_delay, min: 1.0, max: 2000.0)
|
|
52
|
+
float_param(3, :right_delay, min: 1.0, max: 2000.0)
|
|
53
|
+
float_param(4, :pan_delay , min: 0.0, max: 1.0)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
module FMOD
|
|
4
|
+
module Effects
|
|
5
|
+
|
|
6
|
+
##
|
|
7
|
+
# This unit filters sound using a resonant low-pass filter algorithm that is
|
|
8
|
+
# used in Impulse Tracker, but with limited cutoff range (0 to 8060hz).
|
|
9
|
+
#
|
|
10
|
+
# This is different to the default {LowPass} filter in that it uses a
|
|
11
|
+
# different quality algorithm and is the filter used to produce the correct
|
|
12
|
+
# sounding playback in .IT files.
|
|
13
|
+
#
|
|
14
|
+
# FMOD Studio's .IT playback uses this filter.
|
|
15
|
+
#
|
|
16
|
+
# @note This filter actually has a limited cutoff frequency below the
|
|
17
|
+
# specified maximum, due to its limited design, so for a more open range
|
|
18
|
+
# filter use {LowPass} or if you don't mind not having resonance,
|
|
19
|
+
# {LowPassSimple}.
|
|
20
|
+
#
|
|
21
|
+
# The effective maximum cutoff is about 8060hz.
|
|
22
|
+
#
|
|
23
|
+
# @attr cutoff [Float] Low-pass cutoff frequency in Hz.
|
|
24
|
+
# * *Minimum:* 1.0
|
|
25
|
+
# * *Maximum:* 22000.0
|
|
26
|
+
# * *Default:* 5000.0
|
|
27
|
+
# @attr resonance [Float] Low-pass resonance Q value.
|
|
28
|
+
# * *Minimum:* 0.0
|
|
29
|
+
# * *Maximum:* 127.0
|
|
30
|
+
# * *Default:* 1.0
|
|
31
|
+
class ITLowPass < Dsp
|
|
32
|
+
float_param(0, :cutoff, min: 1.0, max: 22000.0)
|
|
33
|
+
float_param(1, :resonance, min: 0.0, max: 127.0)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
module FMOD
|
|
3
|
+
module Effects
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# This unit limits the sound to a certain level.
|
|
7
|
+
#
|
|
8
|
+
# @attr release_time [Float] Time to ramp the silence to full in ms.
|
|
9
|
+
# * *Minimum:* 1.0
|
|
10
|
+
# * *Maximum:* 1000.0
|
|
11
|
+
# * *Default:* 10.0
|
|
12
|
+
# @attr ceiling [Float] Maximum level of the output signal in dB.
|
|
13
|
+
# * *Minimum:* -12.0
|
|
14
|
+
# * *Maximum:* 0.0
|
|
15
|
+
# * *Default:* 0.0
|
|
16
|
+
# @attr max_gain [Float] Maximum amplification allowed in dB. Higher values
|
|
17
|
+
# allow more boost.
|
|
18
|
+
# * *Minimum:* 0.0 (no amplification)
|
|
19
|
+
# * *Maximum:* 12.0
|
|
20
|
+
# * *Default:* 0.0
|
|
21
|
+
# @attr mode [Float] Channel processing mode. 0 or 1.
|
|
22
|
+
# * *Minimum:* 0.0 (independent, limiter per channel)
|
|
23
|
+
# * *Maximum:* 1.0 (linked)
|
|
24
|
+
# * *Default:* 0.0
|
|
25
|
+
class Limiter < Dsp
|
|
26
|
+
float_param(0, :release_time, min: 1.0, max: 1000.0)
|
|
27
|
+
float_param(1, :ceiling, min: -12.0, max: 0.0)
|
|
28
|
+
float_param(2, :max_gain, min: 0.0, max: 12.0)
|
|
29
|
+
float_param(3, :mode, min: 0.0, max: 1.0)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module FMOD
|
|
2
|
+
module Effects
|
|
3
|
+
|
|
4
|
+
##
|
|
5
|
+
# This unit analyzes the loudness and true peak of the signal.
|
|
6
|
+
# @note This DSP is not intended for public use.
|
|
7
|
+
# @attr state [Integer] Integration state
|
|
8
|
+
# * *Minimum:* -3
|
|
9
|
+
# * *Maximum:* 1
|
|
10
|
+
# @attr weights [Pointer] Channel weightings for loudness.
|
|
11
|
+
# @attr loudness [Pointer] Loudness info and maximum true peak level.
|
|
12
|
+
# @api private
|
|
13
|
+
class LoudnessMeter < Dsp
|
|
14
|
+
integer_param(0, :state, min: -3, max: 1)
|
|
15
|
+
data_param(1, :weights)
|
|
16
|
+
data_param(2, :loudness)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
module FMOD
|
|
3
|
+
module Effects
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# @deprecated Will be removed in a future FMOD version. See {MultibandEq}
|
|
7
|
+
# for alternatives.
|
|
8
|
+
#
|
|
9
|
+
# This unit filters sound using a high quality, resonant low-pass filter
|
|
10
|
+
# algorithm but consumes more CPU time.
|
|
11
|
+
#
|
|
12
|
+
# @attr cutoff [Float] Low-pass cutoff frequency in Hz.
|
|
13
|
+
# * *Minimum:* 10.0
|
|
14
|
+
# * *Maximum:* 22000.0
|
|
15
|
+
# * *Default:* 5000.0
|
|
16
|
+
# @attr resonance [Float] Low-pass resonance Q value.
|
|
17
|
+
# * *Minimum:* 1.0
|
|
18
|
+
# * *Maximum:* 10.0
|
|
19
|
+
# * *Default:* 1.0
|
|
20
|
+
class LowPass < Dsp
|
|
21
|
+
float_param(0, :cutoff, min: 10.0, max: 22000.0)
|
|
22
|
+
float_param(1, :resonance, min: 1.0, max: 10.0)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
module FMOD
|
|
3
|
+
module Effects
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# @deprecated Will be removed in a future FMOD version. See {MultibandEq}
|
|
7
|
+
# for alternatives.
|
|
8
|
+
#
|
|
9
|
+
# This unit filters sound using a simple low-pass with no resonance, but has
|
|
10
|
+
# flexible cutoff and is fast.
|
|
11
|
+
#
|
|
12
|
+
# This is a very simple low pass filter, based on two single-pole RC
|
|
13
|
+
# time-constant modules.
|
|
14
|
+
#
|
|
15
|
+
# The emphasis is on speed rather than accuracy, so this should not be used
|
|
16
|
+
# for task requiring critical filtering.
|
|
17
|
+
#
|
|
18
|
+
# @attr cutoff [Float] Low-pass cutoff frequency in Hz.
|
|
19
|
+
# * *Minimum:* 10.0
|
|
20
|
+
# * *Maximum:* 22000.0
|
|
21
|
+
# * *Default:* 1000.0
|
|
22
|
+
class LowPassSimple < Dsp
|
|
23
|
+
float_param(0, :cutoff, min: 10.0, max: 22000.0)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
module FMOD
|
|
2
|
+
module Effects
|
|
3
|
+
|
|
4
|
+
##
|
|
5
|
+
# This unit is a flexible five band parametric equalizer.
|
|
6
|
+
#
|
|
7
|
+
# See detailed description of each parameter to determine its effect with
|
|
8
|
+
# each type of filter.
|
|
9
|
+
class MultibandEq < Dsp
|
|
10
|
+
|
|
11
|
+
##
|
|
12
|
+
# Valid bands used for the equalizer.
|
|
13
|
+
BANDS = [:a, :b, :c, :d, :e].freeze
|
|
14
|
+
|
|
15
|
+
##
|
|
16
|
+
# Retrieves the filter used for the specified band. The filter determines
|
|
17
|
+
# the behavior of the other parameters.
|
|
18
|
+
#
|
|
19
|
+
# @param band [Symbol] The band.
|
|
20
|
+
# @return [Integer] The current filter.
|
|
21
|
+
# @see BANDS
|
|
22
|
+
# @see FilterType
|
|
23
|
+
def get_filter(band)
|
|
24
|
+
index = BANDS.index(band) * 4
|
|
25
|
+
get_integer(index)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
##
|
|
29
|
+
# Retrieves the frequency for the specified band. This value has different
|
|
30
|
+
# effects determined by the current filter.
|
|
31
|
+
#
|
|
32
|
+
# * *Low-pass/High-pass/Low-shelf/High-shelf:* Significant frequency in
|
|
33
|
+
# Hz, cutoff
|
|
34
|
+
# * *Notch/Peaking/Band-pass:* Center
|
|
35
|
+
# * *All-pass:* Phase transition point
|
|
36
|
+
# @param band [Symbol] The band.
|
|
37
|
+
# @return [Float]
|
|
38
|
+
# @see BANDS
|
|
39
|
+
# @see FilterType
|
|
40
|
+
def get_frequency(band)
|
|
41
|
+
index = (BANDS.index(band) * 4) + 1
|
|
42
|
+
get_float(index)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
##
|
|
46
|
+
# Retrieves the quality factor for the specified band. This value has
|
|
47
|
+
# different effects determined by the current filter.
|
|
48
|
+
#
|
|
49
|
+
# * *Low-pass/High-pass:* Quality factor, resonance
|
|
50
|
+
# * *Notch/Peaking/Band-pass:* Bandwidth
|
|
51
|
+
# * *All-pass:* Phase transition sharpness
|
|
52
|
+
# * *Low-shelf/High-shelf:* Unused
|
|
53
|
+
# @param band [Symbol] The band.
|
|
54
|
+
# @return [Float]
|
|
55
|
+
# @see BANDS
|
|
56
|
+
# @see FilterType
|
|
57
|
+
def get_quality(band)
|
|
58
|
+
index = (BANDS.index(band) * 4) + 2
|
|
59
|
+
get_float(index)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
##
|
|
63
|
+
# Retrieves the gain for the specified band.
|
|
64
|
+
#
|
|
65
|
+
# @note Peaking/Low-shelf/High-shelf only.
|
|
66
|
+
# @param band [Symbol] The band.
|
|
67
|
+
# @return [Float]
|
|
68
|
+
# @see BANDS
|
|
69
|
+
# @see FilterType
|
|
70
|
+
def get_gain(band)
|
|
71
|
+
index = (BANDS.index(band) * 4) + 3
|
|
72
|
+
get_float(index)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
##
|
|
76
|
+
# Sets the filter used for the specified band.
|
|
77
|
+
#
|
|
78
|
+
# The filter determines the behavior of the other parameters.
|
|
79
|
+
# @param band [Symbol] The band.
|
|
80
|
+
# @param filter [Integer] The filter to set, a {FilterType} value.
|
|
81
|
+
# @return [self]
|
|
82
|
+
# @see BANDS
|
|
83
|
+
# @see FilterType
|
|
84
|
+
def set_filter(band, filter)
|
|
85
|
+
index = BANDS.index(band) * 4
|
|
86
|
+
set_integer(index, filter.clamp(0, 12))
|
|
87
|
+
self
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
##
|
|
91
|
+
# Sets the frequency for the specified band. This value has different
|
|
92
|
+
# effects determined by the current filter.
|
|
93
|
+
#
|
|
94
|
+
# * *Low-pass/High-pass/Low-shelf/High-shelf:* Significant frequency in
|
|
95
|
+
# Hz, cutoff
|
|
96
|
+
# * *Notch/Peaking/Band-pass:* Center
|
|
97
|
+
# * *All-pass:* Phase transition point
|
|
98
|
+
# @param band [Symbol] The band.
|
|
99
|
+
# @param frequency [Float] The frequency to set.
|
|
100
|
+
# * *Minimum:* 20.0
|
|
101
|
+
# * *Maximum:* 22000.0
|
|
102
|
+
# * *Default:* 8000.0
|
|
103
|
+
# @return [self]
|
|
104
|
+
# @see BANDS
|
|
105
|
+
# @see FilterType
|
|
106
|
+
def set_frequency(band, frequency)
|
|
107
|
+
index = (BANDS.index(band) * 4) + 1
|
|
108
|
+
set_float(index, frequency.clamp(20.0, 22000.0))
|
|
109
|
+
self
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
##
|
|
113
|
+
# Set the quality factor for the specified band. This value has different
|
|
114
|
+
# effects determined by the current filter.
|
|
115
|
+
#
|
|
116
|
+
# * *Low-pass/High-pass:* Quality factor, resonance
|
|
117
|
+
# * *Notch/Peaking/Band-pass:* Bandwidth
|
|
118
|
+
# * *All-pass:* Phase transition sharpness
|
|
119
|
+
# * *Low-shelf/High-shelf:* Unused
|
|
120
|
+
# @param band [Symbol] The band.
|
|
121
|
+
# @param quality [Float] The quality factor.
|
|
122
|
+
# * *Minimum:* 0.1
|
|
123
|
+
# * *Maximum:* 10.0
|
|
124
|
+
# * *Default:* 0.707
|
|
125
|
+
# @return [self]
|
|
126
|
+
# @see BANDS
|
|
127
|
+
# @see FilterType
|
|
128
|
+
def set_quality(band, quality)
|
|
129
|
+
index = (BANDS.index(band) * 4) + 2
|
|
130
|
+
set_float(index, quality.clamp(0.1, 10.0))
|
|
131
|
+
self
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
##
|
|
135
|
+
# Sets the gain for the specified band.
|
|
136
|
+
#
|
|
137
|
+
# @note Peaking/Low-shelf/High-shelf only.
|
|
138
|
+
# @param band [Symbol] The band.
|
|
139
|
+
# @param gain [Float] The boost or attenuation in dB.
|
|
140
|
+
# * *Minimum:* -30.0
|
|
141
|
+
# * *Maximum:* 30.0
|
|
142
|
+
# * *Default:* 0.0
|
|
143
|
+
# @return [self]
|
|
144
|
+
# @see BANDS
|
|
145
|
+
# @see FilterType
|
|
146
|
+
def set_gain(band, gain)
|
|
147
|
+
index = (BANDS.index(band) * 4) + 3
|
|
148
|
+
set_float(index, gain.clamp(-30.0, 30.0))
|
|
149
|
+
self
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|