Class: FMOD::Handle Abstract
- Inherits:
-
Fiddle::Pointer
- Object
- Fiddle::Pointer
- FMOD::Handle
- Includes:
- Core, Fiddle
- Defined in:
- lib/fmod/handle.rb
Overview
This class is abstract.
The superclass for all core FMOD classes.
Contains a reference handle to an unmanaged object, and as such it is crucial to call #release on any derived class to prevent memory leaks.
Direct Known Subclasses
ChannelControl, Dsp, DspConnection, Geometry, Reverb3D, Sound, SoundGroup, System
Instance Attribute Summary collapse
-
#user_data ⇒ Pointer
A user value stored within the object.
Instance Method Summary collapse
-
#initialize(address) ⇒ Handle
constructor
A new instance of Handle.
-
#int_ptr ⇒ String
An empty string buffer the size of the platforms pointer size.
-
#release ⇒ void
(also: #dispose)
Releases the native handle.
-
#to_s ⇒ String
The string representation of the object.
Constructor Details
Instance Attribute Details
#user_data ⇒ Pointer
Returns a user value stored within the object.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fmod/handle.rb', line 44 def user_data pointer = int_ptr case self when ChannelControl FMOD.invoke(:ChannelGroup_GetUserData, self, pointer) when Dsp FMOD.invoke(:DSP_GetUserData, self, pointer) when DspConnection FMOD.invoke(:DSPConnection_GetUserData, self, pointer) when Geometry FMOD.invoke(:Geometry_GetUserData, self, pointer) when Reverb3D FMOD.invoke(:Reverb3D_GetUserData, self, pointer) when Sound FMOD.invoke(:Sound_GetUserData, self, pointer) when SoundGroup FMOD.invoke(:SoundGroup_GetUserData, self, pointer) when System FMOD.invoke(:System_GetUserData, self, pointer) end Pointer.new(pointer.unpack1('J')) end |
Instance Method Details
#int_ptr ⇒ String
Returns an empty string buffer the size of the platforms pointer size.
98 99 100 |
# File 'lib/fmod/handle.rb', line 98 def int_ptr "\0" * SIZEOF_INTPTR_T end |
#release ⇒ void Also known as: dispose
This method returns an undefined value.
Releases the native handle. Failure to call this function may result in memory leaks.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fmod/handle.rb', line 27 def release case self when Sound then FMOD.invoke(:Sound_Release, self) when Dsp then FMOD.invoke(:DSP_Release, self) when ChannelGroup then FMOD.invoke(:ChannelGroup_Release, self) when Geometry then FMOD.invoke(:Geometry_Release, self) when Reverb3D then FMOD.invoke(:Reverb3D_Release, self) when SoundGroup then FMOD.invoke(:SoundGroup_Release, self) when System then FMOD.invoke(:System_Release, self) end end |
#to_s ⇒ String
Returns the string representation of the object.
91 92 93 |
# File 'lib/fmod/handle.rb', line 91 def to_s inspect # TODO end |