CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
CriAtomSource Class Reference

A component that plays sound. More...

Inheritance diagram for CriAtomSource:
CriAtomSourceBase

Public Types

enum  Status {
  Stop, Prep, Playing, PlayEnd,
  Error
}
 A value indicating the playback status of CriAtomSource. More...
 

Public Member Functions

override CriAtomExPlayback Play ()
 Starts playing the Cue that is set. More...
 
CriAtomExPlayback Play (string cueName)
 Starts playing the Cue with the specified Cue name. More...
 
CriAtomExPlayback Play (int cueId)
 Starts playing the Cue with the specified Cue ID. More...
 
void Stop ()
 Stops playback. More...
 
void Pause (bool sw)
 Pauses/resumes. More...
 
bool IsPaused ()
 Gets the posing status. More...
 
void SetBusSendLevel (string busName, float level)
 Set the Bus Send Level by specifying the bus name. More...
 
void SetBusSendLevel (int busId, float level)
 
void SetBusSendLevelOffset (string busName, float levelOffset)
 Set the Bus Send Level by specifying the bus name and offset. More...
 
void SetBusSendLevelOffset (int busId, float levelOffset)
 
void SetAisacControl (string controlName, float value)
 Sets the AISAC control value by specifying the AISAC control name.
 
void SetAisacControl (uint controlId, float value)
 Sets the AISAC control value by specifying the AISAC control name.
 
void SetAisac (string controlName, float value)
 
void SetAisac (uint controlId, float value)
 
void AttachToAnalyzer (CriAtomExOutputAnalyzer analyzer)
 Attach to the output data analysis module.
 
void DetachFromAnalyzer (CriAtomExOutputAnalyzer analyzer)
 Detaches from the output data analysis module.
 

Protected Member Functions

override void PlayOnStart ()
 Starts playing the Cue that is set. More...
 

Properties

string cueName [get, set]
 Sets/gets the name of the Cue to be played. More...
 
string cueSheet [get, set]
 Sets/gets the Cue Sheet name. More...
 
CriAtomExPlayer player [get, protected set]
 The CriAtomExPlayer used internally. More...
 
CriAtomEx3dSource source [get, protected set]
 This is the CriAtomEx3dSource used internally. More...
 
bool playOnStart [get, set]
 Sets/gets whether to play at the start of execution. More...
 
bool use3dPositioning [get, set]
 Sets whether to use the 3D Positioning. More...
 
bool freezeOrientation [get, set]
 Sets whether to fix the orientation of the 3D sound source. More...
 
bool use3dRandomization [get, set]
 Sets whether to use randomization of the position of the 3D sound source. More...
 
uint randomPositionListMaxLength [get, set]
 Sets the maximum number of elements that can be in the coordinates list used for position randomization of a 3D sound source More...
 
CriAtomRegion region3d [get, set]
 Sets/gets 3D region of the sound source More...
 
CriAtomListener listener [get, set]
 Gets and sets the listener of the sound source More...
 
CriAtomRegion regionOnStart [get, set]
 Sets the initial region. More...
 
CriAtomListener listenerOnStart [get, set]
 Sets the initial listener. More...
 
bool loop [get, set]
 Switches on/off the loop playback More...
 
float volume [get, set]
 Sets/gets the volume. More...
 
float pitch [get, set]
 Sets/gets the pitch. More...
 
float pan3dAngle [get, set]
 Sets/gets the Panning 3D angle. More...
 
float pan3dDistance [get, set]
 Sets/gets the Panning 3D distance. More...
 
int startTime [get, set]
 Sets/gets the playback start position. More...
 
long time [get]
 Gets the playback time (in milliseconds). More...
 
Status status [get]
 Gets the status. More...
 
bool attenuationDistanceSetting [get, set]
 Sets/gets if the distance attenuation is enabled. More...
 
bool androidUseLowLatencyVoicePool [get, set]
 Sets/gets whether to play sound from the low delay playback Voice Pool. More...
 

Detailed Description

A component that plays sound.

Description:
Used by attaching to any GameObject.
If the Cue to be played is set to do 3D Positioning, 3D playback is performed. In this case, it is necessary to attach CriWare.CriAtomListener to the camera or main character since the localization is calculated with the position of the GameObject to which CriWare.CriAtomListener is attached.
Public variables are basically set on UnityEditor.

Member Enumeration Documentation

enum Status
stronginherited

A value indicating the playback status of CriAtomSource.

Description:
Information can be obtained using the CriAtomSource::status property.
Enumerator
Stop 

Stopped

Prep 

Preparing for playback

Playing 

Playing

PlayEnd 

Playback completed

Error 

Error occurred

Member Function Documentation

override CriAtomExPlayback Play ( )
inlinevirtual

Starts playing the Cue that is set.

Returns
Playback ID
Description:
The Cue to be played must be set in advance to the CriWare.CriAtomSource.cueName property.

Implements CriAtomSourceBase.

override void PlayOnStart ( )
inlineprotectedvirtual

Starts playing the Cue that is set.

Description:
You must set the CriAtomSource::playOnStart, CriWare.CriAtomSource.cueName properties in advance.

Implements CriAtomSourceBase.

CriAtomExPlayback Play ( string  cueName)
inlineinherited

Starts playing the Cue with the specified Cue name.

Parameters
cueNameCue name
Returns
Playback ID
Description:
Plays the Cue with the name specified in this function, regardless of how the Cue is specified in the corresponding property.
CriAtomExPlayback Play ( int  cueId)
inlineinherited

Starts playing the Cue with the specified Cue ID.

Parameters
cueIdCue ID
Returns
Playback ID
Description:
Plays the Cue with the ID specified in this function, regardless of how the Cue is specified in the corresponding property.
void Stop ( )
inlineinherited

Stops playback.

Description:
If this function is called for the CriAtomSource component that is playing sound, the CriAtomSource component stops playing (stops reading files or playback), and transitions to the Stop state.
If this function is called for an CriAtomSource component that has already stopped (CriAtomSource component whose status is Playend or Error), the status of the CriAtomSource component is changed to Stop.
Note:
If this function is called for the CriAtomSource component that is playing sound, the status may not change to Stop immediately.
(It may take some time for it to change to Stop.)
void Pause ( bool  sw)
inlineinherited

Pauses/resumes.

Parameters
swTrue: Pause, False: Resume
Description:
Pauses/unpauses playback.
When this function is called by specifying True in sw, the CriAtomSource component pauses the sound being played.
When this function is called by specifying False in sw, the CriAtomSource component resumes the playback of paused sound.
bool IsPaused ( )
inlineinherited

Gets the posing status.

Returns
Pausing status
Description:
Gets the ON/OFF status of the pause.
See also
CriAtomSource::Pause
void SetBusSendLevel ( string  busName,
float  level 
)
inlineinherited

Set the Bus Send Level by specifying the bus name.

Note:
When playing a Cue, if this function is called when the Bus Send Level is set on the data, the value set on the data and the setting in this function is multiplied and the result is applied.
For example, if the Bus Send Level on the data is 0.8f and the Bus Send Level of the CriAtomSource is 0.5f, the Bus Send Level actually applied is 0.4f.
void SetBusSendLevel ( int  busId,
float  level 
)
inlineinherited
Deprecated:
This is a deprecated API that will be removed. Please consider using CriAtomSource.SetBusSendLevel(string, float) instead.
void SetBusSendLevelOffset ( string  busName,
float  levelOffset 
)
inlineinherited

Set the Bus Send Level by specifying the bus name and offset.

Description:
When playing a Cue, if this function is called when the Bus Send Level is set on the data, the value set on the data and the setting in this function is added and the result is applied.
For example, if the Bus Send Level on the data is 0.2f and the Bus Send Level of the CriAtomSource is 0.5f, the Bus Send Level actually applied is 0.7f.
void SetBusSendLevelOffset ( int  busId,
float  levelOffset 
)
inlineinherited
Deprecated:
This is a deprecated API that will be removed. Please consider using CriAtomSource.SetBusSendLevelOffset(string, float) instead.
void SetAisac ( string  controlName,
float  value 
)
inlineinherited
Deprecated:
This is a deprecated API that will be removed. Please consider using CriAtomSourceBase.SetAisacControl instead.
void SetAisac ( uint  controlId,
float  value 
)
inlineinherited
Deprecated:
This is a deprecated API that will be removed. Please consider using CriAtomSourceBase.SetAisacControl instead.

Property Documentation

string cueName
getset

Sets/gets the name of the Cue to be played.

Description:
When you call the CriAtomSource::Play() function or when you play sound at the start of execution by setting the CriAtomSource::playOnStart property, the Cue set by this property is played.
string cueSheet
getset

Sets/gets the Cue Sheet name.

Description:
The Cue specified in the CriAtomSource::Play function or CriWare.CriAtomSource.cueName property is searched from the Cue Sheet set in this property.
CriAtomExPlayer player
getprotected setinherited

The CriAtomExPlayer used internally.

Description:
If you want to control CriAtomExPlayer directly, get CriAtomExPlayer from this property.
CriAtomEx3dSource source
getprotected setinherited

This is the CriAtomEx3dSource used internally.

Description:
If you want to control CriAtomEx3dSource directly, please get the CriAtomEx3dSource handle from this property.
bool playOnStart
getsetinherited

Sets/gets whether to play at the start of execution.

Description:
If set to True, playback starts when starting the execution.
Note:
The timing when playback starts is when the MonoBehaviour::Start function is called.
Note:
Be sure to specify the Cue Sheet name when playing a Cue at the start of execution using this flag on a platform where asynchronous ACB loading is enabled such as WebGL.
If not specified, the playback of Cue fails since the system cannot identify the Cue Sheet for which it should wait for loading.
bool use3dPositioning
getsetinherited

Sets whether to use the 3D Positioning.

Description:

By default, the use of 3D Positioning is enabled.
This parameter can be switched at any time.
bool freezeOrientation
getsetinherited

Sets whether to fix the orientation of the 3D sound source.

Description:

By default, the orientation of the 3D sound source corresponds to the orientation of the GameObject.
If this parameter is set to true, the direction of the sound source will be fixed to the current value.
bool use3dRandomization
getsetinherited

Sets whether to use randomization of the position of the 3D sound source.

Description:

By default, the randomization of a sound source position is disabled.
This parameter can be switched at any time.
uint randomPositionListMaxLength
getsetinherited

Sets the maximum number of elements that can be in the coordinates list used for position randomization of a 3D sound source

Description:

By default, the maximum number of elements in the list is 0.
This parameter can only be changed before the Awake method of the CriAtomSource is executed.
CriAtomRegion region3d
getsetinherited

Sets/gets 3D region of the sound source

Note:
If the 3D Positioning is disabled, you cannot set the region.
CriAtomListener listener
getsetinherited

Gets and sets the listener of the sound source

Note:
The listener closest to the sound source will be used if no listener is specified.
Note:
If the 3D Positioning is disabled, you cannot set the listener.
CriAtomRegion regionOnStart
getsetinherited

Sets the initial region.

Description:
Set the region to be applied when Start is invoked.
Applied only when 3D Positioning is enabled.
It is not applied if empty (null).
CriAtomListener listenerOnStart
getsetinherited

Sets the initial listener.

Description:
Sets the listener to be applied when Start is executed.
Applies only when 3D positioning is enabled.
Does not apply if empty (null).
Note:
The listener closest to the sound source will be used if no listener is specified.
bool loop
getsetinherited

Switches on/off the loop playback

Parameters
loopLoop switch (True: loop mode, False: cancel loop mode)
Description:
Switches the loop playback ON/OFF for the waveform data that does not have a loop point.
By default, loop is OFF.
When loop playback is turned ON, the playback does not end at the end of the sound, and the playback is repeated from the beginning.
Note:
The setting in this function is applied to the waveform data.
When this function is called for Sequence data, the individual waveform data in the Sequence data is played back in a loop.

The specification by this function is valid only for waveform data that does not have loop points.
When playing back waveform data with loop points, loop playback is performed according to the loop position of the waveform data regardless of the specification of this function.

This function internally uses the seamless link playback feature.
Therefore, if you use a format that does not support seamless linked playback (such as HCA-MX), some amount of silence is inserted at the loop position.

This parameter is evaluated when the status of the CriAtomSource component is stopped and the CriAtomSource::Play function is called.
float volume
getsetinherited

Sets/gets the volume.

Description:
Sets/gets the volume of the output sound.
The volume value is a scale factor for the amplitude of the sound data (the unit is not decibel).
For example, if you specify 1.0f, the original sound is played at its unmodified volume.
If you specify 0.5f, the sound is played at the volume by halving the amplitude (-6dB) of the original waveform.
If you specify 0.0f, the sound is muted (silent).
The default value for volume is 1.0f.
Note:
When playing a Cue, if this function is called when the volume is set on the data, the value set on the data and the setting in this function is multiplied and the result is applied.
For example, if the volume on the data is 0.8f and the volume of CriAtomSource is 0.5f, the actual volume applied is 0.4f.
float pitch
getsetinherited

Sets/gets the pitch.

Description:
Sets/gets the pitch of the output sound.
The pitch is specified in cents.
One cent is 1/1200 of one octave. A semitone is 100 cents.
For example, if you specify 100.0f, the pitch increases by a semitone. If you specify -100.0f, the pitch decreases by a semitone.
The default pitch is 0.0f.
Note:
When playing a Cue, if this function is called when the pitch is set on the data, the value set on the data and the setting in this function is added and the result is applied.
For example, if the pitch on the data is -100.0f and the pitch of CriAtomSource is 200.0f, the actual pitch applied is 100.0f.
float pan3dAngle
getsetinherited

Sets/gets the Panning 3D angle.

Description:
Sets/gets the Panning 3D angle.
The angle is specified in degrees.
With front being 0 degree, you can set up to 180.0f in the right direction (clockwise) and -180.0f in the left direction (counterclockwise).
For example, if you specify 45.0f, the localization will be 45 degrees to the front right. If you specify -45.0f, the localization will be 45 degree to the front left.
Note:
When playing a Cue, if this function is called when the Panning 3D angle is set on the data, the value set on the data and the setting in this function is added and the result is applied.
For example, if the Panning 3D angle on the data is 15.0f and the Panning 3D angle on CriAtomSource is 30.0f, the actual Panning 3D angle applied will be 45.0f.
If the actual applied Panning 3D angle exceeds 180.0f, -360.0f is added to the value so that it is within the range.
Similarly, if the actual applied volume value is less than -180.0f, +360.0f is add so that it is within the range.
(Since the localization does not change even when +360.0f, or -360.0f is added, you can effectively set a value outside the range of -180.0f to 180.0f.)
float pan3dDistance
getsetinherited

Sets/gets the Panning 3D distance.

Description:
Sets/gets the distance when doing the interior Panning with Panning 3D.
The distance is specified in the range of -1.0f to 1.0f, with the listener position being 0.0f and the circumference of the speaker position being 1.0f.
If you specify a negative value, the Panning 3D angle inverts 180 degrees and the localization is reversed.
Note:
When playing a Cue, if this function is called when the Panning 3D distance is set on the data, the value set on the data and the setting in this function is multiplied and the result is applied.
For example, if the Panning 3D distance on the data is 0.8f and the Panning 3D distance on CriAtomSource is 0.5f, the actual Panning 3D distance applied will be 0.4f.
If the actual applied Panning 3D distance exceeds 1.0f, the value is clipped to 1.0f.
Similarly, if the actual applied Panning 3D distance is smaller than -1.0f, the value is clipped to -1.0f.
int startTime
getsetinherited

Sets/gets the playback start position.

Description:
Sets/gets the position to start playback. By setting the playback start position, you can play the sound data halfway.
The playback start position is specified in milliseconds. For example, if you set 10000, the sound data to be played next is played from the position at 10 seconds.
Note:
When playing a sound from the middle of the data, the play timing delays compared to when playing it from the beginning.
This is because the system must analyze the header of the sound data, jump to the specified position, and rereads the data to start playback.
Note:
If a start position is specified before playing the sequence, waveform data placed before that position will not be played.
(Individual waveforms within the sequence will not be played from the middle.)
long time
getinherited

Gets the playback time (in milliseconds).

Description:
If the playback time can be acquired, this property indicates a value of 0 or bigger.
This function indicates a negative value when the playback time cannot be get (when the Voice cannot be get).
Note:
Indicates the time of the "last" sound played when multiple sounds are played by the same CriAtomSource component.
If you need to check the playback time for multiple sounds, create as many CriAtomSource components as the number of sounds to play.

The playback time indicated by this property 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 CriAtomSource::Pause function, the playback time count-up also stops.
(If you unpause the playback, the count-up resumes.)
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.)

If the Voice being played is erased by the Voice control, the playback time count-up also stops at that point.
In addition, if no Voice is allocated by the Voice control at the start of playback, this function does not return the correct time.
(Negative value is returned.)

Even if the sound data supply is temporarily interrupted due to a delay in reading the file etc., the playback time count-up 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 data supply shortage occurs.
Status status
getinherited

Gets the status.

Description:
Gets the status of the CriAtomSource component.
The status is one of following 5 values indicating the playback status of the CriAtomSource component.
  1. Stop
  2. Prep
  3. Playing
  4. Playend
  5. Error


When the CriAtomSource component is created, the status of the CriAtomSource component is Stop.
When you start playback using the CriAtomSource.Play function etc., the status of the CriAtomSource component changes to Prep.
(Prep is the status waiting for the data to be supplied or start of decoding.)
When enough data is supplied for starting playback, the CriAtomSource component changes the status to Playing.
If an error occurs during playback, CriAtomSource component changes the status to Error.

By checking the status of CriAtomSource component and switching the processing depending on the status, it is possible to create a program linked to the sound playback status.
bool attenuationDistanceSetting
getsetinherited

Sets/gets if the distance attenuation is enabled.

Description:
Sets/gets whether to enable or disable the volume variation by distance attenuation.
The default is enabled.
bool androidUseLowLatencyVoicePool
getsetinherited

Sets/gets whether to play sound from the low delay playback Voice Pool.

Description:
If set to True, playback starts using the low latency playback Voice Pool.
Note:
To enable this flag, it is necessary to set the number of low delay playback Voice Pools of CriWareInitializer.

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