Method: FMOD::Sound#lock
- Defined in:
- lib/fmod/sound.rb
#lock(offset, length) {|ptr1, ptr2| ... } ⇒ self #lock(offset, length) ⇒ Array(Pointer, Pointer)
Returns a pointer to the beginning of the sample data for a sound.
With this function you get access to the RAW audio data, for example 8, 16, 24 or 32-bit PCM data, mono or stereo data. You must take this into consideration when processing the data within the pointer.
317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/fmod/sound.rb', line 317 def lock(offset, length) p1, p2, s1, s2 = int_ptr, int_ptr, "\0" * TYPE_INT, "\0" * TYPE_INT FMOD.invoke(:Sound_Lock, self, offset, length, p1, p2, s1, s2) ptr1 = Pointer.new(p1.unpack1('J'), s1.unpack1('L')) ptr2 = Pointer.new(p2.unpack1('J'), s2.unpack1('L')) if block_given? yield ptr1, ptr2 FMOD.invoke(:Sound_Unlock, self, ptr1, ptr2, ptr1.size, ptr2.size) return self end [ptr1, ptr2] end |