Firelight Technologies FMOD Studio API

Sound::lock

Returns a pointer to the beginning of the sample data for a sound.

C++ Syntax

FMOD_RESULT Sound::lock(
  unsigned int offset,
  unsigned int length,
  void **ptr1,
  void **ptr2,
  unsigned int *len1,
  unsigned int *len2
);

C Syntax

FMOD_RESULT FMOD_Sound_Lock(
  FMOD_SOUND *sound,
  unsigned int offset,
  unsigned int length,
  void **ptr1,
  void **ptr2,
  unsigned int *len1,
  unsigned int *len2
);

Parameters

offset
Offset in bytes to the position you want to lock in the sample buffer.
length
Number of bytes you want to lock in the sample buffer.
ptr1
Address of a pointer that will point to the first part of the locked data.
ptr2
Address of a pointer that will point to the second part of the locked data. This will be null if the data locked hasn't wrapped at the end of the buffer.
len1
Length of data in bytes that was locked for ptr1.
len2
Length of data in bytes that was locked for ptr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.

Return Values

If the function succeeds then the return value is FMOD_OK.
If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.

Remarks

You must always unlock the data again after you have finished with it, using Sound::unlock.
With this function you get access to the RAW audio data, for example 8, 16, 24 or 32bit PCM data, mono or stereo data, and on consoles, vag, xadpcm or gcadpcm compressed data. You must take this into consideration when processing the data within the pointer.

See Also




Version 1.03.06 Built on Apr 17, 2014