Sound::lock

FMOD Studio API

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
);

C# Syntax

RESULT Sound.lock(
  uint offset,
  uint length,
  out IntPtr ptr1,
  out IntPtr ptr2,
  out uint len1,
  out uint len2
);

JavaScript Syntax

Sound.lock(
  offset,                          
  length,                          
  ptr1,                            // writes value to ptr1.val
  ptr2,                            // writes value to ptr2.val
  len1,                            // writes value to len1.val
  len2                             // writes value to len2.val
);

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. You must take this into consideration when processing the data within the pointer.

See Also




Version 1.10.03 Built on Feb 1, 2018