Class: FMOD::Sound
Constant Summary
Constants included from Enums
Enums::FMOD_CHANNELINDEX, Enums::FMOD_DSP_TYPE, Enums::FMOD_RESULT
Constants included from Constants
Constants::FMOD_2D, Constants::FMOD_3D, Constants::FMOD_3D_CUSTOMROLLOFF, Constants::FMOD_3D_HEADRELATIVE, Constants::FMOD_3D_IGNOREGEOMETRY, Constants::FMOD_3D_LINEARROLLOFF, Constants::FMOD_3D_LOGROLLOFF, Constants::FMOD_3D_WORLDRELATIVE, Constants::FMOD_ACCURATETIME, Constants::FMOD_CDDA_FORCEASPI, Constants::FMOD_CDDA_JITTERCORRECT, Constants::FMOD_CREATECOMPRESSEDSAMPLE, Constants::FMOD_CREATESAMPLE, Constants::FMOD_CREATESTREAM, Constants::FMOD_DEFAULT, Constants::FMOD_HARDWARE, Constants::FMOD_IGNORETAGS, Constants::FMOD_INIT_3D_RIGHTHANDED, Constants::FMOD_INIT_DISABLE_MYEARS, Constants::FMOD_INIT_DSOUND_HRTFFULL, Constants::FMOD_INIT_DSOUND_HRTFLIGHT, Constants::FMOD_INIT_DSOUND_HRTFNONE, Constants::FMOD_INIT_DTS_NEURALSURROUND, Constants::FMOD_INIT_ENABLE_PROFILE, Constants::FMOD_INIT_GEOMETRY_USECLOSEST, Constants::FMOD_INIT_NORMAL, Constants::FMOD_INIT_PS2_DISABLECORE0REVERB, Constants::FMOD_INIT_PS2_DISABLECORE1REVERB, Constants::FMOD_INIT_PS2_DONTUSESCRATCHPAD, Constants::FMOD_INIT_PS2_SWAPDMACHANNELS, Constants::FMOD_INIT_PS3_FORCE2CHLPCM, Constants::FMOD_INIT_PS3_PREFERDTS, Constants::FMOD_INIT_SOFTWARE_DISABLE, Constants::FMOD_INIT_SOFTWARE_HRTF, Constants::FMOD_INIT_SOFTWARE_OCCLUSION, Constants::FMOD_INIT_SOFTWARE_REVERB_LOWMEM, Constants::FMOD_INIT_STREAM_FROM_UPDATE, Constants::FMOD_INIT_SYNCMIXERWITHUPDATE, Constants::FMOD_INIT_SYSTEM_MUSICMUTENOTPAUSE, Constants::FMOD_INIT_VOL0_BECOMES_VIRTUAL, Constants::FMOD_INIT_WASAPI_EXCLUSIVE, Constants::FMOD_INIT_XBOX_REMOVEHEADROOM, Constants::FMOD_LOADSECONDARYRAM, Constants::FMOD_LOOP_BIDI, Constants::FMOD_LOOP_NORMAL, Constants::FMOD_LOOP_OFF, Constants::FMOD_LOWMEM, Constants::FMOD_MPEGSEARCH, Constants::FMOD_NONBLOCKING, Constants::FMOD_OPENMEMORY, Constants::FMOD_OPENMEMORY_POINT, Constants::FMOD_OPENONLY, Constants::FMOD_OPENRAW, Constants::FMOD_OPENUSER, Constants::FMOD_SOFTWARE, Constants::FMOD_TIMEUNIT_BUFFERED, Constants::FMOD_TIMEUNIT_MODORDER, Constants::FMOD_TIMEUNIT_MODPATTERN, Constants::FMOD_TIMEUNIT_MODROW, Constants::FMOD_TIMEUNIT_MS, Constants::FMOD_TIMEUNIT_PCM, Constants::FMOD_TIMEUNIT_PCMBYTES, Constants::FMOD_TIMEUNIT_RAWBYTES, Constants::FMOD_TIMEUNIT_SENTENCE, Constants::FMOD_TIMEUNIT_SENTENCE_MS, Constants::FMOD_TIMEUNIT_SENTENCE_PCM, Constants::FMOD_TIMEUNIT_SENTENCE_PCMBYTES, Constants::FMOD_TIMEUNIT_SENTENCE_SUBSOUND, Constants::FMOD_UNICODE, Constants::FMOD_UNIQUE, Constants::FMOD_VIRTUAL_PLAYFROMSTART
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
Instance Method Summary collapse
-
#initialize(file, options = {}) ⇒ Sound
constructor
A new instance of Sound.
- #play ⇒ Object
- #play_sound ⇒ Object
- #play_stream ⇒ Object
Methods included from Functions
Constructor Details
#initialize(file, options = {}) ⇒ Sound
6 7 8 9 10 |
# File 'lib/fmod/sound.rb', line 6 def initialize(file, = {}) @system_pointer = FMOD.system.pointer @channel = [:channel] || Channel.new @file = file end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
4 5 6 |
# File 'lib/fmod/sound.rb', line 4 def channel @channel end |
Instance Method Details
#play ⇒ Object
12 13 14 |
# File 'lib/fmod/sound.rb', line 12 def play play_stream end |
#play_sound ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/fmod/sound.rb', line 16 def play_sound sound_ptr = FFI::MemoryPointer.new(:pointer) # FMOD_RESULT = FMOD_System_CreateStream(system, "wave.mp3", FMOD_DEFAULT, 0, &sound); error_check FMOD_System_CreateStream(@system_pointer.read_pointer, @file, FMOD_DEFAULT, 0, sound_ptr); # FMOD_RESULT = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, 0, &channel); error_check FMOD_System_PlaySound(@system_pointer.read_pointer, FMOD_CHANNELINDEX[:FMOD_CHANNEL_FREE], sound_ptr.read_pointer, 0, @channel.pointer); true end |
#play_stream ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/fmod/sound.rb', line 26 def play_stream sound_ptr = FFI::MemoryPointer.new(:pointer) # FMOD_RESULT = FMOD_System_CreateSound(system, "drumloop.wav", FMOD_SOFTWARE, 0, &sound); error_check FMOD_System_CreateSound(@system_pointer.read_pointer, @file, FMOD_DEFAULT, 0, sound_ptr); # FMOD_RESULT = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, 0, &channel); error_check FMOD_System_PlaySound(@system_pointer.read_pointer, FMOD_CHANNELINDEX[:FMOD_CHANNEL_FREE], sound_ptr.read_pointer, 0, @channel.pointer); true end |