fmod 0.9.1 → 0.9.2
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 +4 -4
- data/HISTORY.txt +23 -1
- data/README.md +1 -3
- data/Rakefile +2 -1
- data/bin/console +1 -0
- data/fmod.gemspec +1 -2
- data/lib/fmod/channel_control.rb +47 -0
- data/lib/fmod/core.rb +1 -0
- data/lib/fmod/core/bool_description.rb +9 -4
- data/lib/fmod/core/channel_mask.rb +61 -0
- data/lib/fmod/core/data_description.rb +44 -0
- data/lib/fmod/core/dsp_description.rb +172 -1
- data/lib/fmod/core/dsp_index.rb +13 -0
- data/lib/fmod/core/dsp_type.rb +154 -0
- data/lib/fmod/core/extensions.rb +19 -0
- data/lib/fmod/core/file_system.rb +1 -0
- data/lib/fmod/core/filter_type.rb +62 -0
- data/lib/fmod/core/float_description.rb +38 -0
- data/lib/fmod/core/guid.rb +27 -0
- data/lib/fmod/core/init_flags.rb +66 -0
- data/lib/fmod/core/integer_description.rb +22 -2
- data/lib/fmod/core/output_type.rb +81 -2
- data/lib/fmod/core/parameter_info.rb +36 -0
- data/lib/fmod/core/parameter_type.rb +15 -0
- data/lib/fmod/core/reverb.rb +113 -2
- data/lib/fmod/core/reverb_index.rb +105 -0
- data/lib/fmod/core/sound_ex_info.rb +4 -0
- data/lib/fmod/core/sound_group_behavior.rb +14 -0
- data/lib/fmod/core/sound_type.rb +1 -0
- data/lib/fmod/core/spectrum_data.rb +35 -0
- data/lib/fmod/core/structures.rb +10 -4
- data/lib/fmod/core/tag.rb +72 -11
- data/lib/fmod/core/tag_data_type.rb +30 -0
- data/lib/fmod/core/tag_type.rb +55 -0
- data/lib/fmod/core/time_unit.rb +3 -0
- data/lib/fmod/core/vector.rb +40 -3
- data/lib/fmod/core/window_type.rb +46 -0
- data/lib/fmod/dsp.rb +427 -98
- data/lib/fmod/dsp_connection.rb +3 -0
- data/lib/fmod/effects.rb +51 -37
- data/lib/fmod/error.rb +3 -0
- data/lib/fmod/geometry.rb +7 -0
- data/lib/fmod/handle.rb +82 -0
- data/lib/fmod/reverb3D.rb +25 -26
- data/lib/fmod/sound.rb +21 -1
- data/lib/fmod/sound_group.rb +79 -3
- data/lib/fmod/system.rb +301 -154
- data/lib/fmod/version.rb +4 -1
- metadata +6 -3
data/lib/fmod/core/dsp_index.rb
CHANGED
@@ -1,8 +1,21 @@
|
|
1
1
|
module FMOD
|
2
2
|
module Core
|
3
|
+
|
4
|
+
##
|
5
|
+
# Strongly-typed index values to denote special types of node within a DSP
|
6
|
+
# chain.
|
3
7
|
module DspIndex
|
8
|
+
|
9
|
+
##
|
10
|
+
# Head of the DSP chain. Equivalent of index 0.
|
4
11
|
HEAD = -1
|
12
|
+
|
13
|
+
##
|
14
|
+
# Built in fader DSP.
|
5
15
|
FADER = -2
|
16
|
+
|
17
|
+
##
|
18
|
+
# Tail of the DSP chain. Equivalent of the number of DSPs minus 1.
|
6
19
|
TAIL = -3
|
7
20
|
end
|
8
21
|
end
|
data/lib/fmod/core/dsp_type.rb
CHANGED
@@ -1,42 +1,196 @@
|
|
1
1
|
module FMOD
|
2
2
|
module Core
|
3
|
+
|
4
|
+
##
|
5
|
+
# These definitions can be used for creating FMOD defined special effects or
|
6
|
+
# DSP units.
|
3
7
|
module DspType
|
8
|
+
|
9
|
+
##
|
10
|
+
# This unit was created via a non FMOD plugin so has an unknown purpose.
|
4
11
|
UNKNOWN = 0
|
12
|
+
|
13
|
+
##
|
14
|
+
# This unit does nothing but take inputs and mix them together then feed
|
15
|
+
# the result to the sound card unit.
|
5
16
|
MIXER = 1
|
17
|
+
|
18
|
+
##
|
19
|
+
# This unit generates sine/square/saw/triangle or noise tones.
|
6
20
|
OSCILLATOR = 2
|
21
|
+
|
22
|
+
##
|
23
|
+
# @deprecated Deprecated and will be removed in a future release
|
24
|
+
# (see MULTIBAND_EQ for alternatives).
|
25
|
+
# This unit filters sound using a high quality, resonant low-pass filter
|
26
|
+
# algorithm but consumes more CPU time.
|
7
27
|
LOW_PASS = 3
|
28
|
+
|
29
|
+
deprecate_constant :LOW_PASS
|
30
|
+
|
31
|
+
##
|
32
|
+
# This unit filters sound using a resonant low-pass filter algorithm that
|
33
|
+
# is used in Impulse Tracker, but with limited cutoff range (0 to 8060hz).
|
8
34
|
IT_LOW_PASS = 4
|
35
|
+
|
36
|
+
##
|
37
|
+
# @deprecated Deprecated and will be removed in a future release
|
38
|
+
# (see MULTIBAND_EQ for alternatives).
|
39
|
+
# This unit filters sound using a resonant high-pass filter algorithm.
|
9
40
|
HIGH_PASS = 5
|
41
|
+
|
42
|
+
deprecate_constant :HIGH_PASS
|
43
|
+
|
44
|
+
##
|
45
|
+
# This unit produces an echo on the sound and fades out at the desired
|
46
|
+
# rate.
|
10
47
|
ECHO = 6
|
48
|
+
|
49
|
+
##
|
50
|
+
# This unit pans and scales the volume of a unit.
|
11
51
|
FADER = 7
|
52
|
+
|
53
|
+
##
|
54
|
+
# This unit produces a flange effect on the sound.
|
12
55
|
FLANGE = 8
|
56
|
+
|
57
|
+
##
|
58
|
+
# This unit distorts the sound.
|
13
59
|
DISTORTION = 9
|
60
|
+
|
61
|
+
##
|
62
|
+
# This unit normalizes or amplifies the sound to a certain level.
|
14
63
|
NORMALIZE = 10
|
64
|
+
|
65
|
+
##
|
66
|
+
# This unit limits the sound to a certain level.
|
15
67
|
LIMITER = 11
|
68
|
+
|
69
|
+
##
|
70
|
+
# @deprecated Deprecated and will be removed in a future release
|
71
|
+
# (see MULTIBAND_EQ for alternatives).
|
72
|
+
# This unit attenuates or amplifies a selected frequency range.
|
16
73
|
PARAM_EQ = 12
|
74
|
+
|
75
|
+
##
|
76
|
+
# This unit bends the pitch of a sound without changing the speed of
|
77
|
+
# playback.
|
17
78
|
PITCH_SHIFT = 13
|
79
|
+
|
80
|
+
##
|
81
|
+
# This unit produces a chorus effect on the sound.
|
18
82
|
CHORUS = 14
|
83
|
+
|
84
|
+
##
|
85
|
+
# This unit allows the use of Steinberg VST plugins.
|
19
86
|
VST_PLUGIN = 15
|
87
|
+
|
88
|
+
##
|
89
|
+
# This unit allows the use of Nullsoft Winamp plugins.
|
20
90
|
WINAMP_PLUGIN = 16
|
91
|
+
|
92
|
+
##
|
93
|
+
# This unit produces an echo on the sound and fades out at the desired
|
94
|
+
# rate as is used in Impulse Tracker.
|
21
95
|
IT_ECHO = 17
|
96
|
+
|
97
|
+
##
|
98
|
+
# This unit implements dynamic compression (linked/unlinked multichannel,
|
99
|
+
# wide-band)
|
22
100
|
COMPRESSOR = 18
|
101
|
+
|
102
|
+
##
|
103
|
+
# This unit implements SFX reverb.
|
23
104
|
SFX_REVERB = 19
|
105
|
+
|
106
|
+
##
|
107
|
+
# @deprecated Deprecated and will be removed in a future release
|
108
|
+
# (see MULTIBAND_EQ for alternatives).
|
109
|
+
# This unit filters sound using a simple low-pass with no resonance, but
|
110
|
+
# has flexible cutoff and is fast.
|
24
111
|
LOW_PASS_SIMPLE = 20
|
112
|
+
|
113
|
+
deprecate_constant :LOW_PASS_SIMPLE
|
114
|
+
|
115
|
+
##
|
116
|
+
# This unit produces different delays on individual channels of the sound.
|
25
117
|
DELAY = 21
|
118
|
+
|
119
|
+
##
|
120
|
+
# This unit produces a tremolo / chopper effect on the sound.
|
26
121
|
TREMOLO = 22
|
122
|
+
|
123
|
+
##
|
124
|
+
# @deprecated Do not use, no longer supported.
|
125
|
+
# Unsupported / Deprecated.
|
27
126
|
LADSPA_PLUGIN = 23
|
127
|
+
|
128
|
+
deprecate_constant :LADSPA_PLUGIN
|
129
|
+
|
130
|
+
##
|
131
|
+
# This unit sends a copy of the signal to a return DSP anywhere in the DSP
|
132
|
+
# tree.
|
28
133
|
SEND = 24
|
134
|
+
|
135
|
+
##
|
136
|
+
# This unit receives signals from a number of send DSPs.
|
29
137
|
RETURN = 25
|
138
|
+
|
139
|
+
##
|
140
|
+
# @deprecated Deprecated and will be removed in a future release
|
141
|
+
# (see MULTIBAND_EQ for alternatives).
|
142
|
+
# This unit filters sound using a simple high-pass with no resonance, but
|
143
|
+
# has flexible cutoff and is fast.
|
30
144
|
HIGH_PASS_SIMPLE = 26
|
145
|
+
|
146
|
+
deprecate_constant :HIGH_PASS_SIMPLE
|
147
|
+
|
148
|
+
##
|
149
|
+
# This unit pans the signal, possibly up-mixing or down-mixing as well.
|
31
150
|
PAN = 27
|
151
|
+
|
152
|
+
##
|
153
|
+
# This unit is a three-band equalizer.
|
32
154
|
THREE_EQ = 28
|
155
|
+
|
156
|
+
##
|
157
|
+
# This unit simply analyzes the signal and provides spectrum information
|
158
|
+
# back through its parameter.
|
33
159
|
FFT = 29
|
160
|
+
|
161
|
+
##
|
162
|
+
# This unit analyzes the loudness and true peak of the signal.
|
34
163
|
LOUDNESS_METER = 30
|
164
|
+
|
165
|
+
##
|
166
|
+
# This unit tracks the envelope of the input/sidechain signal. Deprecated
|
167
|
+
# and will be removed in a future release.
|
35
168
|
ENVELOPE_FOLLOWER = 31
|
169
|
+
|
170
|
+
##
|
171
|
+
# This unit implements convolution reverb.
|
36
172
|
CONVOLUTION_REVERB = 32
|
173
|
+
|
174
|
+
##
|
175
|
+
# This unit provides per signal channel gain, and output channel mapping
|
176
|
+
# to allow 1 multichannel signal made up of many groups of signals to map
|
177
|
+
# to a single output signal.
|
37
178
|
CHANNEL_MIX = 33
|
179
|
+
|
180
|
+
##
|
181
|
+
# This unit "sends" and "receives" from a selection of up to 32 different
|
182
|
+
# slots. It is like a send/return but it uses global slots rather than
|
183
|
+
# returns as the destination. It also has other features. Multiple
|
184
|
+
# transceivers can receive from a single channel, or multiple transceivers
|
185
|
+
# can send to a single channel, or a combination of both.
|
38
186
|
TRANSCEIVER = 34
|
187
|
+
|
188
|
+
##
|
189
|
+
# This unit sends the signal to a 3d object encoder like Dolby Atmos.
|
39
190
|
OBJECT_PAN = 35
|
191
|
+
|
192
|
+
##
|
193
|
+
# This unit is a flexible five band parametric equalizer.
|
40
194
|
MULTIBAND_EQ = 36
|
41
195
|
end
|
42
196
|
end
|
data/lib/fmod/core/extensions.rb
CHANGED
@@ -1,13 +1,22 @@
|
|
1
1
|
|
2
|
+
##
|
3
|
+
# Extensions to Numeric.
|
2
4
|
class Numeric
|
3
5
|
|
6
|
+
##
|
7
|
+
# @return [Numeric] the value clamped between a minimum and maximum value.
|
8
|
+
# @param min [Numeric] The minimum permitted value.
|
9
|
+
# @param max [Numeric] The maximum permitted value.
|
4
10
|
def clamp(min, max)
|
5
11
|
[min, self, max].sort[1]
|
6
12
|
end
|
7
13
|
end
|
8
14
|
|
15
|
+
##
|
16
|
+
# Extensions to String.
|
9
17
|
class String
|
10
18
|
|
19
|
+
# Not defined until Ruby 2.4.0
|
11
20
|
unless method_defined?(:unpack1)
|
12
21
|
def unpack1(format)
|
13
22
|
unpack(format).first
|
@@ -15,13 +24,23 @@ class String
|
|
15
24
|
end
|
16
25
|
end
|
17
26
|
|
27
|
+
##
|
28
|
+
# Extensions to TrueClass.
|
18
29
|
class TrueClass
|
30
|
+
|
31
|
+
##
|
32
|
+
# @return [Integer] the object as an Integer (1).
|
19
33
|
def to_i
|
20
34
|
1
|
21
35
|
end
|
22
36
|
end
|
23
37
|
|
38
|
+
##
|
39
|
+
# Extensions to FalseClass.
|
24
40
|
class FalseClass
|
41
|
+
|
42
|
+
##
|
43
|
+
# @return [Integer] the object as an Integer (0).
|
25
44
|
def to_i
|
26
45
|
0
|
27
46
|
end
|
@@ -1,18 +1,80 @@
|
|
1
1
|
module FMOD
|
2
2
|
module Core
|
3
|
+
|
4
|
+
##
|
5
|
+
# Filter types to be used with the MultiBandEQ DSP.
|
3
6
|
module FilterType
|
7
|
+
|
8
|
+
##
|
9
|
+
# Disabled filter, no processing.
|
4
10
|
DISABLED = 0
|
11
|
+
|
12
|
+
##
|
13
|
+
# Resonant low-pass filter, attenuates frequencies (12dB per octave) above
|
14
|
+
# a given point (with specified resonance) while allowing the rest to
|
15
|
+
# pass.
|
5
16
|
LOW_PASS_12DB = 1
|
17
|
+
|
18
|
+
##
|
19
|
+
# Resonant low-pass filter, attenuates frequencies (24dB per octave) above
|
20
|
+
# a given point (with specified resonance) while allowing the rest to
|
21
|
+
# pass.
|
6
22
|
LOW_PASS_24DB = 2
|
23
|
+
|
24
|
+
##
|
25
|
+
# Resonant low-pass filter, attenuates frequencies (48dB per octave) above
|
26
|
+
# a given point (with specified resonance) while allowing the rest to
|
27
|
+
# pass.
|
7
28
|
LOW_PASS_48DB = 3
|
29
|
+
|
30
|
+
##
|
31
|
+
# Resonant low-pass filter, attenuates frequencies (12dB per octave) below
|
32
|
+
# a given point (with specified resonance) while allowing the rest to
|
33
|
+
# pass.
|
8
34
|
HIGH_PASS_12DB = 4
|
35
|
+
|
36
|
+
##
|
37
|
+
# Resonant low-pass filter, attenuates frequencies (24dB per octave) below
|
38
|
+
# a given point (with specified resonance) while allowing the rest to
|
39
|
+
# pass.
|
9
40
|
HIGH_PASS_24DB = 5
|
41
|
+
|
42
|
+
##
|
43
|
+
# Resonant low-pass filter, attenuates frequencies (48dB per octave) below
|
44
|
+
# a given point (with specified resonance) while allowing the rest to
|
45
|
+
# pass.
|
10
46
|
HIGH_PASS_48DB = 6
|
47
|
+
|
48
|
+
##
|
49
|
+
# Low-shelf filter, boosts or attenuates frequencies (with specified gain)
|
50
|
+
# below a given point while allowing the rest to pass.
|
11
51
|
LOW_SHELF = 7
|
52
|
+
|
53
|
+
##
|
54
|
+
# High-shelf filter, boosts or attenuates frequencies (with specified
|
55
|
+
# gain) above a given point while allowing the rest to pass.
|
12
56
|
HIGH_SHELF = 8
|
57
|
+
|
58
|
+
##
|
59
|
+
# Peaking filter, boosts or attenuates frequencies (with specified gain)
|
60
|
+
# at a given point (with specified bandwidth) while allowing the rest to
|
61
|
+
# pass.
|
13
62
|
PEAKING = 9
|
63
|
+
|
64
|
+
##
|
65
|
+
# Band-pass filter, allows frequencies at a given point (with specified
|
66
|
+
# bandwidth) to pass while attenuating frequencies outside this range.
|
14
67
|
BANDPASS = 10
|
68
|
+
|
69
|
+
##
|
70
|
+
# Notch or band-reject filter, attenuates frequencies at a given point
|
71
|
+
# (with specified bandwidth) while allowing frequencies outside this
|
72
|
+
# range to pass.
|
15
73
|
NOTCH = 11
|
74
|
+
|
75
|
+
##
|
76
|
+
# All-pass filter, allows all frequencies to pass, but changes the phase
|
77
|
+
# response at a given point (with specified sharpness).
|
16
78
|
ALL_PASS = 12
|
17
79
|
end
|
18
80
|
end
|
@@ -1,13 +1,51 @@
|
|
1
1
|
module FMOD
|
2
2
|
module Core
|
3
|
+
|
4
|
+
##
|
5
|
+
# Structure describing a float parameter for a DSP unit.
|
3
6
|
class FloatDescription < Structure
|
4
7
|
|
8
|
+
##
|
9
|
+
# Values mapped linearly across range.
|
10
|
+
LINEAR = 0
|
11
|
+
|
12
|
+
##
|
13
|
+
# A mapping is automatically chosen based on range and units.
|
14
|
+
AUTO = 1
|
15
|
+
|
16
|
+
##
|
17
|
+
# Values mapped in a piecewise linear fashion.
|
18
|
+
PIECEWISE_LINEAR = 2
|
19
|
+
|
20
|
+
##
|
21
|
+
# @param address [Pointer, Integer, String, nil] The address in memory
|
22
|
+
# where the structure will be created from. If no address is given, new
|
23
|
+
# memory will be allocated.
|
5
24
|
def initialize(address = nil)
|
6
25
|
types = [TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT, TYPE_INT]
|
7
26
|
members = [:min, :max, :default, :mapping]
|
8
27
|
super(address, types, members)
|
9
28
|
end
|
10
29
|
|
30
|
+
# @!attribute min
|
31
|
+
# @return [Float] the minimum parameter value.
|
32
|
+
|
33
|
+
# @!attribute max
|
34
|
+
# @return [Float] the maximum parameter value.
|
35
|
+
|
36
|
+
# @!attribute default
|
37
|
+
# @return [Float] the default parameter value.
|
38
|
+
|
39
|
+
# @!attribute mapping
|
40
|
+
# Value indicating how the values are distributed across dials and
|
41
|
+
# automation curves (e.g. linearly, exponentially etc).
|
42
|
+
#
|
43
|
+
# Will be one of the following values:
|
44
|
+
# * {LINEAR}
|
45
|
+
# * {AUTO}
|
46
|
+
# * {PIECEWISE_LINEAR}
|
47
|
+
# @return [Integer] the mapping type.
|
48
|
+
|
11
49
|
[:min, :max, :default, :mapping].each do |symbol|
|
12
50
|
define_method(symbol) { self[symbol] }
|
13
51
|
end
|
data/lib/fmod/core/guid.rb
CHANGED
@@ -2,30 +2,52 @@
|
|
2
2
|
|
3
3
|
module FMOD
|
4
4
|
module Core
|
5
|
+
|
6
|
+
##
|
7
|
+
# Structure describing a globally unique identifier.
|
5
8
|
class Guid < Structure
|
6
9
|
|
10
|
+
##
|
11
|
+
# @param address [Pointer, Integer, String, nil] The address in memory
|
12
|
+
# where the structure will be created from. If no address is given, new
|
13
|
+
# memory will be allocated.
|
7
14
|
def initialize(address = nil)
|
8
15
|
types = [TYPE_INT, TYPE_SHORT, TYPE_SHORT, [TYPE_CHAR, 8]]
|
9
16
|
members = [:data1, :data2, :data3, :data4]
|
10
17
|
super(address, types, members)
|
11
18
|
end
|
12
19
|
|
20
|
+
##
|
21
|
+
# @return [Integer] the first 8 hexadecimal digits of the GUID.
|
13
22
|
def data1
|
14
23
|
[self[:data1]].pack('l').unpack1('L')
|
15
24
|
end
|
16
25
|
|
26
|
+
##
|
27
|
+
# @return [Integer] the first group of 4 hexadecimal digits.
|
17
28
|
def data2
|
18
29
|
[self[:data2]].pack('s').unpack1('S')
|
19
30
|
end
|
20
31
|
|
32
|
+
##
|
33
|
+
# @return [Integer] the second group of 4 hexadecimal digits.
|
21
34
|
def data3
|
22
35
|
[self[:data3]].pack('s').unpack1('S')
|
23
36
|
end
|
24
37
|
|
38
|
+
##
|
39
|
+
# Array of 8 bytes. The first 2 bytes contain the third group of 4
|
40
|
+
# hexadecimal digits. The remaining 6 bytes contain the final 12.
|
41
|
+
#
|
42
|
+
# hexadecimal digits.
|
43
|
+
# @return [Array<Integer>] the last part if the GUID.
|
25
44
|
def data4
|
26
45
|
self[:data4].pack('c*').unpack('C*')
|
27
46
|
end
|
28
47
|
|
48
|
+
##
|
49
|
+
# @return [Boolean] +true+ if objects are equal, otherwise +false+.
|
50
|
+
# @param obj [Object] The object to compare.
|
29
51
|
def eql?(obj)
|
30
52
|
if obj.is_a?(Guid)
|
31
53
|
return false unless data1 == obj.data1
|
@@ -36,10 +58,15 @@ module FMOD
|
|
36
58
|
to_s.tr('-', '').casecmp(obj.to_s.tr('-', '')).zero?
|
37
59
|
end
|
38
60
|
|
61
|
+
##
|
62
|
+
# @return [Boolean] +true+ if objects are equal, otherwise +false+.
|
63
|
+
# @param obj [Object] The object to compare.
|
39
64
|
def ==(obj)
|
40
65
|
eql?(obj)
|
41
66
|
end
|
42
67
|
|
68
|
+
##
|
69
|
+
# @return [String] the string representation of the GUID.
|
43
70
|
def to_s
|
44
71
|
d4 = data4
|
45
72
|
last = d4[2, 6].map { |byte| "%02X" % byte }.join
|