CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
CriAtomExPlayback Struct Reference

Playback sound object More...

Classes

struct  TrackInfo
 Playback Track information More...
 

Public Types

enum  Status { Prep = 1, Playing, Removed }
 Playback status More...
 

Public Member Functions

void Stop (bool ignoresReleaseTime)
 Stops the playback sound More...
 
void Pause ()
 Pauses playback sound More...
 
void Resume (CriAtomEx.ResumeMode mode)
 Unpauses the playback sound More...
 
bool IsPaused ()
 Gets pausing status of the playback sound More...
 
bool GetFormatInfo (out CriAtomEx.FormatInfo info)
 Gets the playback sound format information More...
 
Status GetStatus ()
 Gets the playback status More...
 
long GetTime ()
 Gets the playback time More...
 
long GetTimeSyncedWithAudio ()
 Gets the playback time synchronized with sound More...
 
bool GetNumPlayedSamples (out long numSamples, out int samplingRate)
 Gets the number of playback samples More...
 
long GetSequencePosition ()
 Gets the Sequence playback position More...
 
int GetCurrentBlockIndex ()
 Gets the current Block index of the playback sound More...
 
bool GetTrackInfo (out TrackInfo info)
 Gets the playback Track information More...
 
bool GetBeatSyncInfo (out CriAtomExBeatSync.Info info)
 Gets beat synchronization information More...
 
void SetNextBlockIndex (int index)
 Block transition of playback sound More...
 
bool SetBeatSyncOffset (short timeMs)
 Beat synchronization offset setting More...
 

Detailed Description

Playback sound object

Description:
The object returned when the CriWare.CriAtomExPlayer::Start function is executed.
This object is used to change parameters or acquire the status of each voice (instead of the whole player) played by the CriWare.CriAtomExPlayer::Start function.
See also
CriAtomExPlayer::Start

Member Enumeration Documentation

enum Status
strong

Playback status

Description:
Status of the sound that has been played on the AtomExPlayer.
It can be obtained by using the CriWare.CriAtomExPlayback::GetStatus function.

The playback status usually changes in the following order.
  1. Prep
  2. Playing
  3. Removed .
Note:
Status indicates the status of the sound that was played ( CriWare.CriAtomExPlayer::Start function was called) by the AtomExPlayer instead of the status of the player.

The sound resource being played is discarded when the playback is stopped.
Therefore, the status of the playback sound changes to Removed in the following cases.
  • When playback is complete.
  • When the sound being played is stopped using the Stop function.
  • When a Voice being played is stolen by a high priority playback request.
  • When an error occurred during playback. .
See also
CriAtomExPlayer::Start, CriAtomExPlayback::GetStatus, CriAtomExPlayback::Stop
Enumerator
Prep 

Preparing for playback

Playing 

Playing

Removed 

Removed

Member Function Documentation

void Stop ( bool  ignoresReleaseTime)
inline

Stops the playback sound

Parameters
ignoresReleaseTimeWhether to ignore release time (False = perform release process, True = ignore release time and stop immediately)
Description:
Stops for each played sound.
By using this function, it is possible to pause the sound played for each individual sound on the player.
Note:
If you want to stop all the sounds played back by the AtomExPlayer, use the CriWare.CriAtomExPlayer::Stop function instead of this function.
(The CriWare.CriAtomExPlayer::Stop function stops all the sounds being played by the player.)
Note:
When the playback sound is stopped using this function, the status of the sound being played changes to Removed.
Since the Voice resource is also discarded when stopped, it will not be possible to acquire information from the playback object that changed to Removed state.
See also
CriAtomExPlayer::Stop, CriAtomExPlayback::GetStatus
void Pause ( )
inline

Pauses playback sound

Description:
Pauses for each played sound.

By using this function, it is possible to pause the sound played for each individual sound on the player.
Note:
If you want to pause all the sounds played back by the player, use the CriWare.CriAtomExPlayer::Pause function instead of this function.
See also
CriAtomExPlayback::IsPaused, CriAtomExPlayer::Pause, CriAtomExPlayback::Resume
void Resume ( CriAtomEx.ResumeMode  mode)
inline

Unpauses the playback sound

Parameters
modeUnpausing target
Description:
Unpauses for each played sound.
When this function is called by specifying PausedPlayback in the argument (mode), the playback of the sound paused by the user using the CriWare.CriAtomExPlayer::Pause function (or the CriWare.CriAtomExPlayback::Pause function) is resumed.
When this function is called by specifying PreparedPlayback in the argument (mode), the playback of the sound prepared by the user using the CriWare.CriAtomExPlayer::Prepare starts.
Note:
If the player paused by the CriWare.CriAtomExPlayer::Pause function is prepared for playback with the CriWare.CriAtomExPlayer::Prepare function, the playback will not start until the unpausing processing triggered by both PausedPlayback and PreparedPlayback is completed.

To always start playback, even if the player is processed by the CriWare.CriAtomExPlayer::Pause or CriWare.CriAtomExPlayer::Prepare functions, please call this function with the "mode" argument set to "AllPlayback".
See also
CriAtomExPlayback::IsPaused, CriAtomExPlayer::Resume, CriAtomExPlayer::Pause
bool IsPaused ( )
inline

Gets pausing status of the playback sound

Returns
Whether the playback is paused (False = not paused, True = paused)
Description:
Returns whether or not the sound being played is paused.
See also
CriAtomExPlayback::Pause
bool GetFormatInfo ( out CriAtomEx.FormatInfo  info)
inline

Gets the playback sound format information

Parameters
infoFormat information
Returns
Whether the information can be acquired (True = could be acquired, False = could not be acquired)
Description:
Gets information about the format of the audio played by the CriWare.CriAtomExPlayer::Start function.

If the format information can be obtained, this function returns true.
If the specified voice has already been removed, this function returns false.
Note:
When playing a Cue that contains multiple sound data, the information on the first sound data found is returned.
Note:
This function can get the format information only during sound playback.
If the Voice is deleted by Voice control during playback preparation or after the playback, acquisition of format information fails.
See also
CriAtomExPlayer::Start, CriAtomExPlayer::GetStatus
Status GetStatus ( )
inline

Gets the playback status

Returns
Playback status
Description:
Gets the status of the audio played by the CriWare.CriAtomExPlayer::Start function.
Note:
This function returns the playing status of an individual voice (unlike the CriWare.CriAtomExPlayer::GetStatus function which returns the status of the AtomExPlayer).

The Voice resource associated with the audio being played will be disposed in the following cases:
  • The playback is complete.
  • The audio being played is stopped by the Stop function.
  • The Voice used has been reclaimed by another playback request of higher priority.
  • An error occured during playback.
Therefore, regardless of whether the playback was explicitly stopped by using the CriWare.CriAtomExPlayback::Stop function or for other reasons, the status of the playback will transit to "Removed".
(To detect an error, check the status of the AtomExPlayer with the CriWare.CriAtomExPlayer::GetStatus function instead of using this function.)
See also
CriAtomExPlayer::Start, CriAtomExPlayer::GetStatus, CriAtomExPlayback::Stop
long GetTime ( )
inline

Gets the playback time

Returns
Playback time (in milliseconds)
Description:
Obtains the playback time of the audio played by the CriWare.CriAtomExPlayer::Start function.

If the playback time can be obtained, this function returns a value greater than 0.
If the specified voice has already been removed, this function returns a negative value.
Note:
The playback time returned by this function is "the elapsed time from the start of playback".
The time does not rewind depending on the playback position, even during loop playback or seamless linked playback.

When the playback is paused using the CriWare.CriAtomExPlayer::Pause function, the playback time count-up also stops.
(If you unpause the playback, the count-up resumes.)
The accuracy of the time that can be obtained by this function depends on the frequency of the server processing.
(The time is updated for each server process.)
If you need to get more accurate time, use the CriWare.CriAtomExPlayback::GetNumPlayedSamples function instead of this function to get the number of samples played.
Note:
The return type is long, but currently there is no precision over 32bit.
When performing control based on the playback time, it should be noted that the playback time becomes incorrect in about 24 days.
(The playback time overflows and becomes a negative value when it exceeds 2147483647 milliseconds.)

This function can get the time only during sound playback.
(Unlike the CriWare.CriAtomExPlayer::GetTime function, this function can get the time for each sound being played, but it cannot get the playback end time.)
Getting the playback time fails after the playback ends or when the Voice is erased by the Voice control.
(Negative value is returned.)

If the sound data supply is temporarily interrupted due to device read retry processing, etc., the count-up of the playback time is not interrupted.
(The time progresses even if the playback is stopped due to the stop of data supply.)
Therefore, when synchronizing sound with the source video based on the time acquired by this function, the synchronization may be greatly deviated each time a read retry occurs.
If it is necessary to strictly synchronize the waveform data and video, use the CriWare.CriAtomExPlayback::GetNumPlayedSamples function instead of this function to synchronize with the number of played samples.
See also
CriAtomExPlayer::Start, CriAtomExPlayer::GetTime, CriAtomExPlayback::GetNumPlayedSamples
long GetTimeSyncedWithAudio ( )
inline

Gets the playback time synchronized with sound

Returns
Playback time (in milliseconds)
Description:
Obtains the playback time of the audio played by the CriWare.CriAtomExPlayer::Start function.

If the playback time can be obtained, this function returns a value greater than 0.
If the specified voice has already been removed, this function returns a negative value.
Note:
The playback time synchronized with the audio can be obtained with this function (unlike the CriWare.CriAtomExPlayback::GetTime function which returns the "elapsed time since the start of the playback").
If the audio data supply is interrupted and the playback is stopped due to trying to re-read the data etc., the playback time will stop being incremented.
Use this function to obtain the playback time in cases you need to perform processing that is strictly synchronized with the audio being played.
However, the time will not reset according to the playback position during loop playback or seamlessly concatenated playback.
In addition, the playback time cannot correctly be acquired for sequence Cues that have gaps between waveforms, or block sequence Cues that switch waveforms when playing.

When pausing the playback with the CriWare.CriAtomExPlayer::Pause function, the playback time incrementation will also be paused.
(It will resume once the playback is unpaused.)

To get the playback time using this function, use the CriWare.CriAtomExPlayer::CriAtomExPlayer(bool) function and set the argument to true to enable the audio synchronization timer when creating a player.
Note:
The return type is long, but currently there is no precision over 32bit.
When performing control based on the playback time, it should be noted that the playback time becomes incorrect in about 24 days.
(The playback time overflows and becomes a negative value when it exceeds 2147483647 milliseconds.)

This function can get the time only during sound playback.
(Unlike the CriWare.CriAtomExPlayer::GetTime function, this function can get the time for each sound being played, but it cannot get the playback end time.)
Getting the playback time fails after the playback ends or when the Voice is erased by the Voice control.
(Negative value is returned.)

This function calculates the time internally, so the processing load may be a problem depending on the platform. In addition, it returns the updated time with each call, even within the same frame of the application.
Although it depends on how the playback time is used by the application, basically use this function to get the time only once per frame.

See also
CriAtomExPlayer::Start, CriAtomExPlayback::GetTime, CriAtomExPlayback::GetNumPlayedSamples, CriAtomExPlayer::CriAtomExPlayer(bool)
bool GetNumPlayedSamples ( out long  numSamples,
out int  samplingRate 
)
inline

Gets the number of playback samples

Parameters
numSamplesThe number of played samples
samplingRateSampling rate
Returns
Whether the sample count can be acquired (True = could be acquired, False = could not be acquired)
Description:
Returns the number of samples and the sampling rate of the audio played by the CriWare.CriAtomExPlayer::Start function.

If the number of samples can be obtained, this function returns true.
If the specified voice has already been removed, this function returns false.
(In the event of an error, numSamples and samplingRate will be negative values.)
Note:
The accuracy of the number of samples played depends on the sound library in the platform SDK.
(The accuracy of the number of samples played depends on the platform.)

When playing a Cue that contains multiple sound data, the information on the first sound data found is returned.
Note:
If the sound data supply is interrupted due to device read retry processing, etc., the count-up of the number of playback samples stops.
(The count-up restarts when the data supply is resumed.)

This function can get the number of playback samples only while the sound is being played.
Getting the number of playback samples fails after the playback ends or when the Voice is erased by the Voice control.
See also
CriAtomExPlayer::Start
long GetSequencePosition ( )
inline

Gets the Sequence playback position

Returns
Sequence playback position (in milliseconds)
Description:
Gets the sequence playback position in the audio played by the CriWare.CriAtomExPlayer::Start function.

If the playback position can be obtained, this function returns a value greater than 0.
If the specified sequence has already been removed, etc., this function returns a negative value.
Note:
The playback time returned by this function is the "playback position on the Sequence data".
When a Sequence loop or Block transition was performed, the rewound value is returned.

The Sequencer does not run if you performed non-Cue-specified playback. For playback other than Cue playback, this function returns a negative value.

When the playback is paused using the CriWare.CriAtomExPlayer::Pause function, the playback position also stops being updated.
(If you unpause, the update resumes.)
The accuracy of the time that can be obtained by this function depends on the frequency of the server processing.
(The time is updated for each server process.)
Note:
The return type is long, but currently there is no precision over 32bit.
When performing control based on the playback position, it should be noted that the playback position becomes incorrect in about 24 days for the data that has no settings such as Sequence loops.
(The playback position overflows and becomes a negative value when it exceeds 2147483647 milliseconds.)

This function can get the position only during sound playback.
After the end of playback, or when the Sequence was erased by Voice control, acquisition of the playback position fails.
(Negative value is returned.)
int GetCurrentBlockIndex ( )
inline

Gets the current Block index of the playback sound

Returns
Current Block index
Description:
Get the current block index in the block sequence played by the CriWare.CriAtomExPlayer::Start function.
Note:
Returns 0xFFFFFFFF if the data being played by the playback ID is not a Block Sequence.
See also
CriAtomExPlayer::Start, CriAtomExPlayer::SetFirstBlockIndex, CriAtomExPlayback::SetNextBlockIndex
bool GetTrackInfo ( out TrackInfo  info)
inline

Gets the playback Track information

Parameters
infoPlayback Track information
Returns
Whether the acquisition succeeded
Description:
Acquires the track information of the Cue played by the CriWare.CriAtomExPlayer::Start function.
Only the track information that is directly contained within the Cue can be acquired, i.e., information about sub-sequences or Cue links cannot be obtained.
Note:
An attempt to get the Track information fails if the following data is being played.
  • Data other than Cue is being played. (Since there is no Track information)
  • The Cue being played is a Polyphonic type or a selector-referenced switch type. (Since there may be multiple Track information)
  • The Cue being played is a Track Transition type. (Since the playback Track changes by transition)
See also
CriAtomExPlayer::Start
bool GetBeatSyncInfo ( out CriAtomExBeatSync.Info  info)
inline

Gets beat synchronization information

Parameters
infoBeat synchronization information
Returns
Whether the acquisition succeeded
Description:
Acquires the beat synchronization information of the Cue played by the CriWare.CriAtomExPlayer::Start function.
The current BPM, measure count, beat count, and beat progress percentage (from 0.0 to 1.0) can be obtained.
The Cue itself must have beat sync information set.
Information cannot be acquired for Cues started with from a Cue link or a Start Action.
Note:
An attempt to get the beat synchronization information fails if the following data is being played.
  • Data other than Cue is being played. (Since there is not beat synchronization information)
  • A Cue without beat synchronization information is being played.
  • A Cue with beat synchronization information is being played "indirectly". (Being played with Cue link or start action)
See also
CriAtomExPlayer::Start
void SetNextBlockIndex ( int  index)
inline

Block transition of playback sound

Parameters
indexBlock index
Description:
Block transition is performed for each played sound.
When this function is executed, if the Voice with the specified ID is a block sequence, It transitions the block according to the specified block sequence setting.
Note:
Use the CriWare.CriAtomExPlayer::SetFirstBlockIndex function to specify the playback start Block, and use the CriWare.CriAtomExPlayback::GetCurrentBlockIndex function to get the Block index during playback.
See also
CriAtomExPlayer::SetFirstBlockIndex, CriAtomExPlayback::GetCurrentBlockIndex
bool SetBeatSyncOffset ( short  timeMs)
inline

Beat synchronization offset setting

Parameters
timeMsOffset time (ms)
Returns
Whether the offset has been successfully set
Description:
Sets the beat sync offset for the Cue being played.
The Cue must have beat-sync information set.
It is not possible to get information for a Cue that is started by a Cue link or a Start Action.
Note:
If any of the following data is being played back, the beat sync offset setting will fail.
  • Data other than a Cue is being played back (since beat-synchronization information does not exist).
  • A Cue without synchronization information is being played back.
  • A Cue with beat-synchronization information is being "indirectly" played. (playback started by a Cue link or a Start Action).

The documentation for this struct was generated from the following file: