Channel::setPosition

FMOD Studio API

Firelight Technologies FMOD Studio API

Channel::setPosition

Sets the playback position for the currently playing sound to the specified offset.

C++ Syntax

FMOD_RESULT Channel::setPosition(
  unsigned int position,
  FMOD_TIMEUNIT postype
);

C Syntax

FMOD_RESULT FMOD_Channel_SetPosition(
  FMOD_CHANNEL *channel,
  unsigned int position,
  FMOD_TIMEUNIT postype
);

C# Syntax

RESULT Channel.setPosition(
  uint position,
  TIMEUNIT postype
);

JavaScript Syntax

Channel.setPosition(
  position,                        
  postype                          
);

Parameters

position
Position of the channel to set in units specified in the 'postype' parameter.
postype
Time unit to set the channel position by. See FMOD_TIMEUNIT.

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

Certain timeunits do not work depending on the file format. For example FMOD_TIMEUNIT_MODORDER will not work with an MP3 file.

If you are calling this function on a stream, it has to possibly reflush its buffer to get zero latency playback when it resumes playing, therefore it could potentially cause a stall or take a small amount of time to do this.

If you are using FMOD_NONBLOCKING, note that a stream will go into FMOD_OPENSTATE_SETPOSITION state (see Sound::getOpenState) and sound commands will return FMOD_ERR_NOTREADY. Channel::getPosition will also not update until this non-blocking setposition operation has completed.

Warning! Using a VBR source that does not have an associated seek table or seek information (such as MP3 or MOD/S3M/XM/IT) may cause inaccurate seeking if you specify FMOD_TIMEUNIT_MS or FMOD_TIMEUNIT_PCM. If you want FMOD to create a PCM vs bytes seek table so that seeking is accurate, you will have to specify FMOD_ACCURATETIME when loading or opening the sound. This means there is a slight delay as FMOD scans the whole file when loading the sound to create this table.

See Also




Version 1.10.03 Built on Feb 1, 2018