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/system.rb
CHANGED
@@ -1,20 +1,80 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
module FMOD
|
4
|
+
|
5
|
+
##
|
6
|
+
# The primary central class of FMOD. This class acts as a factory for creation
|
7
|
+
# of other core FMOD objects, and a centralized control interface. All core
|
8
|
+
# FMOD objects belong to a System object.
|
4
9
|
class System < Handle
|
5
10
|
|
11
|
+
##
|
12
|
+
# Contains values for describing the current CPU time used by FMOD.
|
13
|
+
#
|
14
|
+
# @attr dsp [Float] The current DSP mixing engine CPU usage. Result will be
|
15
|
+
# from 0.0 to 100.0.
|
16
|
+
# @attr stream [Float] The current streaming engine CPU usage. Result will
|
17
|
+
# be from 0.0 to 100.0.
|
18
|
+
# @attr geometry [Float] The current geometry engine CPU usage. Result will
|
19
|
+
# be from 0.0 to 100.0.
|
20
|
+
# @attr update [Float] The current System::update CPU usage. Result will be
|
21
|
+
# from 0.0 to 100.0.
|
22
|
+
# @attr total [Float] The current total CPU usage. Result will be from 0 to
|
23
|
+
# 100.0.
|
6
24
|
CpuUsage = Struct.new(:dsp, :stream, :geometry, :update, :total)
|
7
25
|
|
26
|
+
##
|
27
|
+
# Contains the amount of dedicated sound ram available if the platform
|
28
|
+
# supports it.
|
29
|
+
# @attr current [Integer] The currently allocated sound RAM memory at time
|
30
|
+
# of call.
|
31
|
+
# @attr max [Integer] The maximum allocated sound RAM memory since the
|
32
|
+
# System was created.
|
33
|
+
# @attr total [Integer] The total amount of sound RAM available on this
|
34
|
+
# device.
|
8
35
|
RamUsage = Struct.new(:current, :max, :total)
|
9
36
|
|
37
|
+
##
|
38
|
+
# Contains information about file reads by FMOD.
|
39
|
+
# @attr sample [Integer] The total bytes read from file for loading
|
40
|
+
# sample data.
|
41
|
+
# @attr stream [Integer] The total bytes read from file for streaming
|
42
|
+
# sounds.
|
43
|
+
# @attr other [Integer] The total bytes read for non-audio data such
|
44
|
+
# as FMOD Studio banks.
|
10
45
|
FileUsage = Struct.new(:sample, :stream, :other)
|
11
46
|
|
47
|
+
# Represents a logical position of a speaker.
|
48
|
+
# @attr index [Integer] The index of the speaker.
|
49
|
+
# @attr x [Float] The x-coordinate of the speaker.
|
50
|
+
# @attr y [Float] The y-coordinate of the speaker.
|
51
|
+
# @attr active [Boolean] +true+ if speaker will be enabled,
|
52
|
+
# otherwise +false+.
|
12
53
|
Speaker = Struct.new(:index, :x, :y, :active)
|
13
54
|
|
55
|
+
##
|
56
|
+
# Defines the information to display for the selected plugin.
|
57
|
+
# @attr handle [Integer] The plugin handle.
|
58
|
+
# @attr type [Integer] The type of the plugin.
|
59
|
+
# @attr name [String] The name of the plugin.
|
60
|
+
# @attr version [Integer] The version number set by the plugin.
|
14
61
|
Plugin = Struct.new(:handle, :type, :name, :version)
|
15
62
|
|
63
|
+
# Describes the output format for the software mixer.
|
64
|
+
# @attr sample_rate [Integer] The rate in Hz, that the software mixer will
|
65
|
+
# run at. Specify values between 8000 and 192000.
|
66
|
+
# @attr speaker_mode [Integer] Speaker setup for the software mixer.
|
67
|
+
# @attr raw_channels [Integer] Number of output channels / speakers to
|
68
|
+
# initialize the sound card to in raw speaker mode.
|
16
69
|
SoftwareFormat = Struct.new(:sample_rate, :speaker_mode, :raw_channels)
|
17
70
|
|
71
|
+
##
|
72
|
+
# The buffer size settings for the FMOD software mixing engine.
|
73
|
+
# @attr size [Integer] The mixer engine block size in samples. Default is
|
74
|
+
# 1024. (milliseconds = 1024 at 48khz = 1024 / 48000 * 1000 = 10.66ms).
|
75
|
+
# @attr count [Integer] The mixer engine number of buffers used. Default is
|
76
|
+
# 4. To get the total buffer size multiply the buffer length by the number
|
77
|
+
# of buffers. By default this would be 4*1024.
|
18
78
|
DspBuffer = Struct.new(:size, :count)
|
19
79
|
|
20
80
|
##
|
@@ -28,7 +88,10 @@ module FMOD
|
|
28
88
|
# @see TimeUnit
|
29
89
|
StreamBuffer = Struct.new(:size, :type)
|
30
90
|
|
31
|
-
|
91
|
+
##
|
92
|
+
# @param address [Pointer, Integer, String] The address of a native FMOD
|
93
|
+
# pointer.
|
94
|
+
def initialize(address)
|
32
95
|
super
|
33
96
|
@rolloff_callbacks = []
|
34
97
|
sig = [TYPE_VOIDP, TYPE_FLOAT]
|
@@ -43,6 +106,13 @@ module FMOD
|
|
43
106
|
FMOD.invoke(:System_Set3DRolloffCallback, self, cb)
|
44
107
|
end
|
45
108
|
|
109
|
+
##
|
110
|
+
# When FMOD wants to calculate 3D volume for a channel, this callback can be
|
111
|
+
# used to override the internal volume calculation based on distance.
|
112
|
+
#
|
113
|
+
# @param proc [Proc] Proc to call. Optional, must give block if nil.
|
114
|
+
# @yield [index] The block to call when rolloff is calculated.
|
115
|
+
# @return [void]
|
46
116
|
def on_rolloff(proc = nil, &block)
|
47
117
|
cb = proc || block
|
48
118
|
raise LocalJumpError, "No block given." if cb.nil?
|
@@ -877,41 +947,10 @@ module FMOD
|
|
877
947
|
|
878
948
|
# @!endgroup
|
879
949
|
|
950
|
+
# @!group Network
|
880
951
|
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
952
|
+
# @!attribute network_proxy
|
953
|
+
# @return [String] proxy server to use for internet connections.
|
915
954
|
|
916
955
|
def network_proxy
|
917
956
|
buffer = "\0" * 512
|
@@ -925,128 +964,12 @@ module FMOD
|
|
925
964
|
FMOD.invoke(:System_SetNetworkProxy, self, url.encode(Encoding::UTF_8))
|
926
965
|
end
|
927
966
|
|
967
|
+
# @!attribute network_timeout
|
968
|
+
# @return [Integer] the timeout, in milliseconds, for network streams.
|
928
969
|
integer_reader(:network_timeout, :System_GetNetworkTimeout)
|
929
970
|
integer_writer(:network_timeout=, :System_SetNetworkTimeout)
|
930
971
|
|
931
|
-
|
932
|
-
integer_writer(:software_channels=, :System_SetSoftwareChannels, 0, 64)
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
def master_channel_group
|
937
|
-
FMOD.invoke(:System_GetMasterChannelGroup, self, group = int_ptr)
|
938
|
-
ChannelGroup.new(group)
|
939
|
-
end
|
940
|
-
|
941
|
-
def master_sound_group
|
942
|
-
FMOD.invoke(:System_GetMasterSoundGroup, self, group = int_ptr)
|
943
|
-
SoundGroup.new(group)
|
944
|
-
end
|
945
|
-
|
946
|
-
|
947
|
-
def update
|
948
|
-
FMOD.invoke(:System_Update, self)
|
949
|
-
end
|
950
|
-
|
951
|
-
##
|
952
|
-
# Closes the {System} object without freeing the object's memory, so the
|
953
|
-
# system handle will still be valid.
|
954
|
-
#
|
955
|
-
# Closing the output renders objects created with this system object
|
956
|
-
# invalid. Make sure any sounds, channel groups, geometry and DSP objects
|
957
|
-
# are released before closing the system object.
|
958
|
-
#
|
959
|
-
# @return [void]
|
960
|
-
def close
|
961
|
-
FMOD.invoke(:System_Close, self)
|
962
|
-
end
|
963
|
-
|
964
|
-
##
|
965
|
-
# @!attribute [r] version
|
966
|
-
# @return [String] the current version of FMOD being used.
|
967
|
-
def version
|
968
|
-
FMOD.invoke(:System_GetVersion, self, version = "\0" * SIZEOF_INT)
|
969
|
-
FMOD.uint2version(version)
|
970
|
-
end
|
971
|
-
|
972
|
-
##
|
973
|
-
# Plays a sound object on a particular channel and {ChannelGroup}.
|
974
|
-
#
|
975
|
-
# When a sound is played, it will use the sound's default frequency and
|
976
|
-
# priority.
|
977
|
-
#
|
978
|
-
# A sound defined as {Mode::THREE_D} will by default play at the position of
|
979
|
-
# the listener.
|
980
|
-
#
|
981
|
-
# Channels are reference counted. If a channel is stolen by the FMOD
|
982
|
-
# priority system, then the handle to the stolen voice becomes invalid, and
|
983
|
-
# Channel based commands will not affect the new sound playing in its place.
|
984
|
-
# If all channels are currently full playing a sound, FMOD will steal a
|
985
|
-
# channel with the lowest priority sound. If more channels are playing than
|
986
|
-
# are currently available on the sound-card/sound device or software mixer,
|
987
|
-
# then FMOD will "virtualize" the channel. This type of channel is not
|
988
|
-
# heard, but it is updated as if it was playing. When its priority becomes
|
989
|
-
# high enough or another sound stops that was using a real hardware/software
|
990
|
-
# channel, it will start playing from where it should be. This technique
|
991
|
-
# saves CPU time (thousands of sounds can be played at once without actually
|
992
|
-
# being mixed or taking up resources), and also removes the need for the
|
993
|
-
# user to manage voices themselves. An example of virtual channel usage is a
|
994
|
-
# dungeon with 100 torches burning, all with a looping crackling sound, but
|
995
|
-
# with a sound-card that only supports 32 hardware voices. If the 3D
|
996
|
-
# positions and priorities for each torch are set correctly, FMOD will play
|
997
|
-
# all 100 sounds without any 'out of channels' errors, and swap the real
|
998
|
-
# voices in and out according to which torches are closest in 3D space.
|
999
|
-
# Priority for virtual channels can be changed in the sound's defaults, or
|
1000
|
-
# at runtime with {Channel.priority}.
|
1001
|
-
#
|
1002
|
-
# @param sound [Sound] The sound to play.
|
1003
|
-
# @param group [ChannelGroup] The {ChannelGroup} become a member of. This is
|
1004
|
-
# more efficient than using {Channel.group}, as it does it during the
|
1005
|
-
# channel setup, rather than connecting to the master channel group, then
|
1006
|
-
# later disconnecting and connecting to the new {ChannelGroup} when
|
1007
|
-
# specified. Specify +nil+ to ignore (use master {ChannelGroup}).
|
1008
|
-
# @param paused [Boolean] flag to specify whether to start the channel
|
1009
|
-
# paused or not. Starting a channel paused allows the user to alter its
|
1010
|
-
# attributes without it being audible, and un-pausing with
|
1011
|
-
# ChannelControl.resume actually starts the sound.
|
1012
|
-
#
|
1013
|
-
# @return [Channel] the newly playing channel.
|
1014
|
-
def play_sound(sound, group = nil, paused = false)
|
1015
|
-
FMOD.type?(sound, Sound)
|
1016
|
-
channel = int_ptr
|
1017
|
-
FMOD.invoke(:System_PlaySound, self, sound, group, paused.to_i, channel)
|
1018
|
-
Channel.new(channel)
|
1019
|
-
end
|
1020
|
-
|
1021
|
-
def play_dsp(dsp, group = nil, paused = false)
|
1022
|
-
FMOD.type?(dsp, Dsp)
|
1023
|
-
channel = int_ptr
|
1024
|
-
FMOD.invoke(:System_PlayDSP, self, dsp, group, paused.to_i, channel)
|
1025
|
-
Channel.new(channel)
|
1026
|
-
end
|
1027
|
-
|
1028
|
-
def [](index)
|
1029
|
-
reverb = Reverb.new
|
1030
|
-
FMOD.invoke(:System_GetReverbProperties, self, index, reverb)
|
1031
|
-
reverb
|
1032
|
-
end
|
1033
|
-
|
1034
|
-
def []=(index, reverb)
|
1035
|
-
FMOD.type?(reverb, Reverb)
|
1036
|
-
FMOD.invoke(:System_SetReverbProperties, self, index, reverb)
|
1037
|
-
end
|
1038
|
-
|
1039
|
-
def mixer_suspend
|
1040
|
-
FMOD.invoke(:System_MixerSuspend, self)
|
1041
|
-
if block_given?
|
1042
|
-
yield
|
1043
|
-
FMOD.invoke(:System_MixerResume, self)
|
1044
|
-
end
|
1045
|
-
end
|
1046
|
-
|
1047
|
-
def mixer_resume
|
1048
|
-
FMOD.invoke(:System_MixerResume, self)
|
1049
|
-
end
|
972
|
+
# @!endgroup
|
1050
973
|
|
1051
974
|
##
|
1052
975
|
# Route the signal from a channel group into a separate audio port on the
|
@@ -1213,6 +1136,215 @@ module FMOD
|
|
1213
1136
|
FMOD.invoke(:System_GetSoftwareFormat, self, *format.values)
|
1214
1137
|
end
|
1215
1138
|
|
1139
|
+
##
|
1140
|
+
# Retrieves the internal master channel group. This is the default channel
|
1141
|
+
# group that all channels play on.
|
1142
|
+
#
|
1143
|
+
# This channel group can be used to do things like set the master volume for
|
1144
|
+
# all playing sounds. See the ChannelGroup API for more functionality.
|
1145
|
+
# @return [ChannelGroup] the internal master channel group.
|
1146
|
+
def master_channel_group
|
1147
|
+
FMOD.invoke(:System_GetMasterChannelGroup, self, group = int_ptr)
|
1148
|
+
ChannelGroup.new(group)
|
1149
|
+
end
|
1150
|
+
|
1151
|
+
##
|
1152
|
+
# @@return [SoundGroup] the default sound group, where all sounds are placed
|
1153
|
+
# when they are created.
|
1154
|
+
def master_sound_group
|
1155
|
+
FMOD.invoke(:System_GetMasterSoundGroup, self, group = int_ptr)
|
1156
|
+
SoundGroup.new(group)
|
1157
|
+
end
|
1158
|
+
|
1159
|
+
##
|
1160
|
+
# Closes the {System} object without freeing the object's memory, so the
|
1161
|
+
# system handle will still be valid.
|
1162
|
+
#
|
1163
|
+
# Closing the output renders objects created with this system object
|
1164
|
+
# invalid. Make sure any sounds, channel groups, geometry and DSP objects
|
1165
|
+
# are released before closing the system object.
|
1166
|
+
#
|
1167
|
+
# @return [void]
|
1168
|
+
def close
|
1169
|
+
FMOD.invoke(:System_Close, self)
|
1170
|
+
end
|
1171
|
+
|
1172
|
+
##
|
1173
|
+
# @!attribute [r] version
|
1174
|
+
# @return [String] the current version of FMOD being used.
|
1175
|
+
def version
|
1176
|
+
FMOD.invoke(:System_GetVersion, self, version = "\0" * SIZEOF_INT)
|
1177
|
+
FMOD.uint2version(version)
|
1178
|
+
end
|
1179
|
+
|
1180
|
+
##
|
1181
|
+
# Plays a sound object on a particular channel and {ChannelGroup}.
|
1182
|
+
#
|
1183
|
+
# When a sound is played, it will use the sound's default frequency and
|
1184
|
+
# priority.
|
1185
|
+
#
|
1186
|
+
# A sound defined as {Mode::THREE_D} will by default play at the position of
|
1187
|
+
# the listener.
|
1188
|
+
#
|
1189
|
+
# Channels are reference counted. If a channel is stolen by the FMOD
|
1190
|
+
# priority system, then the handle to the stolen voice becomes invalid, and
|
1191
|
+
# Channel based commands will not affect the new sound playing in its place.
|
1192
|
+
# If all channels are currently full playing a sound, FMOD will steal a
|
1193
|
+
# channel with the lowest priority sound. If more channels are playing than
|
1194
|
+
# are currently available on the sound-card/sound device or software mixer,
|
1195
|
+
# then FMOD will "virtualize" the channel. This type of channel is not
|
1196
|
+
# heard, but it is updated as if it was playing. When its priority becomes
|
1197
|
+
# high enough or another sound stops that was using a real hardware/software
|
1198
|
+
# channel, it will start playing from where it should be. This technique
|
1199
|
+
# saves CPU time (thousands of sounds can be played at once without actually
|
1200
|
+
# being mixed or taking up resources), and also removes the need for the
|
1201
|
+
# user to manage voices themselves. An example of virtual channel usage is a
|
1202
|
+
# dungeon with 100 torches burning, all with a looping crackling sound, but
|
1203
|
+
# with a sound-card that only supports 32 hardware voices. If the 3D
|
1204
|
+
# positions and priorities for each torch are set correctly, FMOD will play
|
1205
|
+
# all 100 sounds without any 'out of channels' errors, and swap the real
|
1206
|
+
# voices in and out according to which torches are closest in 3D space.
|
1207
|
+
# Priority for virtual channels can be changed in the sound's defaults, or
|
1208
|
+
# at runtime with {Channel.priority}.
|
1209
|
+
#
|
1210
|
+
# @param sound [Sound] The sound to play.
|
1211
|
+
# @param group [ChannelGroup] The {ChannelGroup} become a member of. This is
|
1212
|
+
# more efficient than using {Channel.group}, as it does it during the
|
1213
|
+
# channel setup, rather than connecting to the master channel group, then
|
1214
|
+
# later disconnecting and connecting to the new {ChannelGroup} when
|
1215
|
+
# specified. Specify +nil+ to ignore (use master {ChannelGroup}).
|
1216
|
+
# @param paused [Boolean] flag to specify whether to start the channel
|
1217
|
+
# paused or not. Starting a channel paused allows the user to alter its
|
1218
|
+
# attributes without it being audible, and un-pausing with
|
1219
|
+
# ChannelControl.resume actually starts the sound.
|
1220
|
+
#
|
1221
|
+
# @return [Channel] the newly playing channel.
|
1222
|
+
def play_sound(sound, group = nil, paused = false)
|
1223
|
+
FMOD.type?(sound, Sound)
|
1224
|
+
channel = int_ptr
|
1225
|
+
FMOD.invoke(:System_PlaySound, self, sound, group, paused.to_i, channel)
|
1226
|
+
Channel.new(channel)
|
1227
|
+
end
|
1228
|
+
|
1229
|
+
##
|
1230
|
+
# Plays a sound object on a particular channel and {ChannelGroup}.
|
1231
|
+
#
|
1232
|
+
# When a sound is played, it will use the sound's default frequency and
|
1233
|
+
# priority.
|
1234
|
+
#
|
1235
|
+
# A sound defined as {Mode::THREE_D} will by default play at the position of
|
1236
|
+
# the listener.
|
1237
|
+
#
|
1238
|
+
# Channels are reference counted. If a channel is stolen by the FMOD
|
1239
|
+
# priority system, then the handle to the stolen voice becomes invalid, and
|
1240
|
+
# Channel based commands will not affect the new sound playing in its place.
|
1241
|
+
# If all channels are currently full playing a sound, FMOD will steal a
|
1242
|
+
# channel with the lowest priority sound. If more channels are playing than
|
1243
|
+
# are currently available on the sound-card/sound device or software mixer,
|
1244
|
+
# then FMOD will "virtualize" the channel. This type of channel is not
|
1245
|
+
# heard, but it is updated as if it was playing. When its priority becomes
|
1246
|
+
# high enough or another sound stops that was using a real hardware/software
|
1247
|
+
# channel, it will start playing from where it should be. This technique
|
1248
|
+
# saves CPU time (thousands of sounds can be played at once without actually
|
1249
|
+
# being mixed or taking up resources), and also removes the need for the
|
1250
|
+
# user to manage voices themselves. An example of virtual channel usage is a
|
1251
|
+
# dungeon with 100 torches burning, all with a looping crackling sound, but
|
1252
|
+
# with a sound-card that only supports 32 hardware voices. If the 3D
|
1253
|
+
# positions and priorities for each torch are set correctly, FMOD will play
|
1254
|
+
# all 100 sounds without any 'out of channels' errors, and swap the real
|
1255
|
+
# voices in and out according to which torches are closest in 3D space.
|
1256
|
+
# Priority for virtual channels can be changed in the sound's defaults, or
|
1257
|
+
# at runtime with {Channel.priority}.
|
1258
|
+
#
|
1259
|
+
# @param dsp [Dsp] The DSP to play.
|
1260
|
+
# @param group [ChannelGroup] The {ChannelGroup} become a member of. This is
|
1261
|
+
# more efficient than using {Channel.group}, as it does it during the
|
1262
|
+
# channel setup, rather than connecting to the master channel group, then
|
1263
|
+
# later disconnecting and connecting to the new {ChannelGroup} when
|
1264
|
+
# specified. Specify +nil+ to ignore (use master {ChannelGroup}).
|
1265
|
+
# @param paused [Boolean] flag to specify whether to start the channel
|
1266
|
+
# paused or not. Starting a channel paused allows the user to alter its
|
1267
|
+
# attributes without it being audible, and un-pausing with
|
1268
|
+
# ChannelControl.resume actually starts the sound.
|
1269
|
+
#
|
1270
|
+
# @return [Channel] the newly playing channel.
|
1271
|
+
def play_dsp(dsp, group = nil, paused = false)
|
1272
|
+
FMOD.type?(dsp, Dsp)
|
1273
|
+
channel = int_ptr
|
1274
|
+
FMOD.invoke(:System_PlayDSP, self, dsp, group, paused.to_i, channel)
|
1275
|
+
Channel.new(channel)
|
1276
|
+
end
|
1277
|
+
|
1278
|
+
##
|
1279
|
+
# Suspend mixer thread and relinquish usage of audio hardware while
|
1280
|
+
# maintaining internal state.
|
1281
|
+
#
|
1282
|
+
# @overload mixer_suspend
|
1283
|
+
# When called with a block, automatically resumes the mixer when the block
|
1284
|
+
# exits.
|
1285
|
+
# @yield Yields control back to receiver.
|
1286
|
+
# @overload mixer_suspend
|
1287
|
+
# When called without a block, user must call {#mixer_resume}.
|
1288
|
+
#
|
1289
|
+
# @return [void]
|
1290
|
+
# @see mixer_resume
|
1291
|
+
def mixer_suspend
|
1292
|
+
FMOD.invoke(:System_MixerSuspend, self)
|
1293
|
+
if block_given?
|
1294
|
+
yield
|
1295
|
+
FMOD.invoke(:System_MixerResume, self)
|
1296
|
+
end
|
1297
|
+
end
|
1298
|
+
|
1299
|
+
##
|
1300
|
+
# Resume mixer thread and reacquire access to audio hardware.
|
1301
|
+
# @return [void]
|
1302
|
+
# @see mixer_suspend
|
1303
|
+
def mixer_resume
|
1304
|
+
FMOD.invoke(:System_MixerResume, self)
|
1305
|
+
end
|
1306
|
+
|
1307
|
+
##
|
1308
|
+
# Retrieves the current reverb environment for the specified reverb
|
1309
|
+
# instance.
|
1310
|
+
#
|
1311
|
+
# @param index [Integer] Index of the particular reverb instance to target,
|
1312
|
+
# from 0 to {FMOD::MAX_REVERB} inclusive.
|
1313
|
+
#
|
1314
|
+
# @return [Reverb] The specified Reverb instance.
|
1315
|
+
def [](index)
|
1316
|
+
reverb = Reverb.new
|
1317
|
+
FMOD.invoke(:System_GetReverbProperties, self, index, reverb)
|
1318
|
+
reverb
|
1319
|
+
end
|
1320
|
+
|
1321
|
+
##
|
1322
|
+
# Sets parameters for the global reverb environment.
|
1323
|
+
#
|
1324
|
+
# @param index [Integer] Index of the particular reverb instance to target,
|
1325
|
+
# from 0 to {FMOD::MAX_REVERB} inclusive.
|
1326
|
+
# @param reverb [Reverb] A structure which defines the attributes for the
|
1327
|
+
# reverb. Passing {FMOD::NULL} or +nil+ to this function will delete the
|
1328
|
+
# physical reverb.
|
1329
|
+
#
|
1330
|
+
# @return [Reverb] the specified reverb.
|
1331
|
+
def []=(index, reverb)
|
1332
|
+
FMOD.type?(reverb, Reverb)
|
1333
|
+
FMOD.invoke(:System_SetReverbProperties, self, index, reverb)
|
1334
|
+
end
|
1335
|
+
|
1336
|
+
alias_method :get_reverb, :[]
|
1337
|
+
alias_method :set_reverb, :[]=
|
1338
|
+
|
1339
|
+
##
|
1340
|
+
# @!attribute software_channels
|
1341
|
+
# @return [Integer] the maximum number of software mixed channels possible.
|
1342
|
+
integer_reader(:software_channels, :System_GetSoftwareChannels)
|
1343
|
+
integer_writer(:software_channels=, :System_SetSoftwareChannels, 0, 64)
|
1344
|
+
|
1345
|
+
##
|
1346
|
+
# @!attribute stream_buffer
|
1347
|
+
# @return [StreamBuffer] the internal buffer-size for streams.
|
1216
1348
|
def stream_buffer
|
1217
1349
|
size, type = "\0" * SIZEOF_INT, "\0" * SIZEOF_INT
|
1218
1350
|
FMOD.invoke(:System_GetStreamBufferSize, self, size, type)
|
@@ -1225,6 +1357,9 @@ module FMOD
|
|
1225
1357
|
FMOD.invoke(:System_SetStreamBufferSize, self, *buffer.values)
|
1226
1358
|
end
|
1227
1359
|
|
1360
|
+
##
|
1361
|
+
# @!attribute stream_buffer
|
1362
|
+
# @return [DspBuffer] the internal buffer-size for DSP units.
|
1228
1363
|
def dsp_buffer
|
1229
1364
|
size, count = "\0" * SIZEOF_INT, "\0" * SIZEOF_INT
|
1230
1365
|
FMOD.invoke(:System_GetDSPBufferSize, self, size, count)
|
@@ -1236,6 +1371,18 @@ module FMOD
|
|
1236
1371
|
raise RangeError, "size must be greater than 0" unless buffer.size > 0
|
1237
1372
|
FMOD.invoke(:System_SetDSPBufferSize, self, *buffer.values)
|
1238
1373
|
end
|
1374
|
+
|
1375
|
+
##
|
1376
|
+
# Updates the FMOD system. This should be called once per "game tick", or
|
1377
|
+
# once per frame in your application.
|
1378
|
+
#
|
1379
|
+
# @note Various callbacks are driven from this function, and it must be
|
1380
|
+
# called for them to be invoked.
|
1381
|
+
#
|
1382
|
+
# @return [void]
|
1383
|
+
def update
|
1384
|
+
FMOD.invoke(:System_Update, self)
|
1385
|
+
end
|
1239
1386
|
end
|
1240
1387
|
end
|
1241
1388
|
|