|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.crickettechnology.audio.Sound
public final class Sound
A sound (either memory-resident or streamed).
| Field Summary | |
|---|---|
static float |
SOUND_SPEED_CENTIMETERS_PER_SECOND
The speed of sound in dry air at 20 degrees C, in centimeters per second. |
static float |
SOUND_SPEED_FEET_PER_SECOND
The speed of sound in dry air at 20 degrees C, in feet per second. |
static float |
SOUND_SPEED_INCHES_PER_SECOND
The speed of sound in dry air at 20 degrees C, in inches per second. |
static float |
SOUND_SPEED_METERS_PER_SECOND
The speed of sound in dry air at 20 degrees C, in meters per second. |
| Method Summary | |
|---|---|
void |
destroy()
Destroy this object. |
static void |
get3dAttenuation(ObjectRef<AttenuationMode> mode,
FloatRef nearDist,
FloatRef farDist,
FloatRef farVol)
Gets parameters used for 3D volume attenuation. |
static void |
get3dListenerPosition(FloatRef eyeX,
FloatRef eyeY,
FloatRef eyeZ,
FloatRef lookAtX,
FloatRef lookAtY,
FloatRef lookAtZ,
FloatRef upX,
FloatRef upY,
FloatRef upZ)
Gets the listener position and rotation in 3D space. |
static void |
get3dListenerVelocity(FloatRef x,
FloatRef y,
FloatRef z)
Gets the listener velocity in 3D space. |
void |
get3dPosition(FloatRef x,
FloatRef y,
FloatRef z)
Gets the position of the sound emitter in 3D space. |
static float |
get3dSoundSpeed()
Gets the speed of sound. |
void |
get3dVelocity(FloatRef x,
FloatRef y,
FloatRef z)
Gets the velocity of the sound emitter in 3D space. |
int |
getChannels()
Gets the number of channels in the sound (1 for mono, 2 for stereo). |
int |
getCurrentLoop()
Gets the number of the current loop. |
int |
getLength()
Gets the total duration of the sound, in sample frames. |
float |
getLengthMs()
Gets the total duration of the sound, in milliseconds. |
void |
getLoop(IntRef startFrame,
IntRef endFrame)
Get the loop start and end. |
int |
getLoopCount()
Gets the number of times the sound should loop. |
float |
getMixedVolume()
Gets the volume value used for mixing. |
Mixer |
getMixer()
Gets the mixer to which this sound is assigned. |
float |
getPan()
Gets the pan. |
void |
getPanMatrix(FloatRef ll,
FloatRef lr,
FloatRef rl,
FloatRef rr)
Gets the pan matrix. |
float |
getPitchShift()
Gets the pitch shift value, in half-steps. |
int |
getPlayPosition()
Get the current play position in the sound, in sample frames. |
float |
getPlayPositionMs()
Get the current play position in the sound, in milliseconds. |
int |
getSampleRate()
Gets the sample rate of the sound, in Hz. |
float |
getSpeed()
Gets the playback speed. |
float |
getVolume()
Gets the volume. |
boolean |
is3dEnabled()
Gets whether 3D positioning is enabled. |
boolean |
isFailed()
Returns true if an error occurred while creating the sound. |
boolean |
isPaused()
Gets whether the sound is paused. |
boolean |
isPlaying()
Gets whether the sound is playing. |
boolean |
isReady()
Returns true if the sound is ready. |
static Sound |
newBankSound(Bank bank,
int index)
Creates a sound from a bank. |
static Sound |
newBankSound(Bank bank,
java.lang.String name)
Creates a sound from a bank. |
static Sound |
newNetworkStreamSound(java.lang.String url)
Creates an HTTP network streaming sound |
static Sound |
newStreamSound(java.lang.String filename)
Creates a streaming sound from an asset in the .apk. |
static Sound |
newStreamSound(java.lang.String filename,
PathType pathType)
Creates a streaming sound. |
void |
play()
Play the sound. |
void |
releaseLoop()
Makes the current loop the last. |
static void |
set3dAttenuation(AttenuationMode mode,
float nearDist,
float farDist,
float farVol)
Sets parameters used for 3D volume attenuation. |
void |
set3dEnabled(boolean enabled)
Sets whether 3D positioning is enabled. |
static void |
set3dListenerPosition(float eyeX,
float eyeY,
float eyeZ,
float lookAtX,
float lookAtY,
float lookAtZ,
float upX,
float upY,
float upZ)
Sets the listener position and rotation in 3D space. |
static void |
set3dListenerVelocity(float x,
float y,
float z)
Sets the listener velocity in 3D space. |
void |
set3dPosition(float x,
float y,
float z)
Sets the position of the sound emitter in 3D space. |
static void |
set3dSoundSpeed(float speed)
Sets the speed of sound. |
void |
set3dVelocity(float x,
float y,
float z)
Sets the velocity of the sound emitter in 3D space. |
void |
setLoop(int startFrame,
int endFrame)
Set the loop start and end. |
void |
setLoopCount(int loopCount)
Sets the number of times the sound should loop. |
void |
setMixer(Mixer mixer)
Sets the mixer to which this sound is assigned. |
void |
setPan(float pan)
Sets the pan. |
void |
setPanMatrix(float ll,
float lr,
float rl,
float rr)
Sets the pan matrix explicitly. |
void |
setPaused(boolean paused)
Sets whether the sound is paused. |
void |
setPitchShift(float halfSteps)
Sets the pitch shift value, in half-steps. |
void |
setPlayPosition(int frame)
Set the play position in the sound, in sample frames. |
void |
setPlayPositionMs(float ms)
Set the play position in the sound, in milliseconds. |
void |
setSpeed(float speed)
Sets the playback speed. |
void |
setVolume(float volume)
Sets the volume. |
void |
stop()
Stop the sound. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final float SOUND_SPEED_CENTIMETERS_PER_SECOND
public static final float SOUND_SPEED_METERS_PER_SECOND
public static final float SOUND_SPEED_INCHES_PER_SECOND
public static final float SOUND_SPEED_FEET_PER_SECOND
| Method Detail |
|---|
public void setMixer(Mixer mixer)
public Mixer getMixer()
public boolean isReady()
public boolean isFailed()
public void play()
public void stop()
public boolean isPlaying()
public void setPaused(boolean paused)
public boolean isPaused()
public void setLoop(int startFrame,
int endFrame)
public void getLoop(IntRef startFrame,
IntRef endFrame)
public void setLoopCount(int loopCount)
public int getLoopCount()
public int getCurrentLoop()
public void releaseLoop()
public void setPlayPosition(int frame)
This is not supported for streams in formats other than .cks; use setPlayPositionMs() instead when possible.
public void setPlayPositionMs(float ms)
public int getPlayPosition()
This is not supported for streams in formats other than .cks; use getPlayPositionMs() instead when possible.
public float getPlayPositionMs()
public void setVolume(float volume)
public float getVolume()
public float getMixedVolume()
public void setPan(float pan)
public float getPan()
public void setPanMatrix(float ll,
float lr,
float rl,
float rr)
public void getPanMatrix(FloatRef ll,
FloatRef lr,
FloatRef rl,
FloatRef rr)
public void setPitchShift(float halfSteps)
This does not work for streams in formats other than .cks.
public float getPitchShift()
This does not work for streams in formats other than .cks.
public void setSpeed(float speed)
This does not work for streams in formats other than .cks.
public float getSpeed()
This does not work for streams in formats other than .cks.
public int getLength()
This does not work for streams in formats other than .cks; use getLengthMs() instead.
public float getLengthMs()
public int getSampleRate()
This does not work for streams in formats other than .cks.
public int getChannels()
public void set3dEnabled(boolean enabled)
public boolean is3dEnabled()
public void set3dPosition(float x,
float y,
float z)
public void get3dPosition(FloatRef x,
FloatRef y,
FloatRef z)
public void set3dVelocity(float x,
float y,
float z)
public void get3dVelocity(FloatRef x,
FloatRef y,
FloatRef z)
public static void set3dListenerPosition(float eyeX,
float eyeY,
float eyeZ,
float lookAtX,
float lookAtY,
float lookAtZ,
float upX,
float upY,
float upZ)
eyeX - The listener's position (x coordinate)eyeY - The listener's position (y coordinate)eyeZ - The listener's position (z coordinate)lookAtX - The listener's look-at point (x coordinate)lookAtY - The listener's look-at point (y coordinate)lookAtZ - The listener's look-at point (z coordinate)upX - The listener's up vector (x coordinate)upY - The listener's up vector (y coordinate)upZ - The listener's up vector (z coordinate)
public static void get3dListenerPosition(FloatRef eyeX,
FloatRef eyeY,
FloatRef eyeZ,
FloatRef lookAtX,
FloatRef lookAtY,
FloatRef lookAtZ,
FloatRef upX,
FloatRef upY,
FloatRef upZ)
eyeX - The listener's position (x coordinate)eyeY - The listener's position (y coordinate)eyeZ - The listener's position (z coordinate)lookAtX - The listener's look-at point (x coordinate)lookAtY - The listener's look-at point (y coordinate)lookAtZ - The listener's look-at point (z coordinate)upX - The listener's up vector (x coordinate)upY - The listener's up vector (y coordinate)upZ - The listener's up vector (z coordinate)
public static void set3dListenerVelocity(float x,
float y,
float z)
public static void get3dListenerVelocity(FloatRef x,
FloatRef y,
FloatRef z)
public static void set3dAttenuation(AttenuationMode mode,
float nearDist,
float farDist,
float farVol)
mode - The attenuation modenearDist - The near distance; sounds closer than this distance will not be attenuated.farDist - The far distance; sounds further than this will be at the far volume.farVol - The far volume; sounds further than farDist will be at this volume.
public static void get3dAttenuation(ObjectRef<AttenuationMode> mode,
FloatRef nearDist,
FloatRef farDist,
FloatRef farVol)
mode - The attenuation modenearDist - The near distance; sounds closer than this distance will not be attenuated.farDist - The far distance; sounds further than this will be at the far volume.farVol - The far volume; sounds further than farDist will be at this volume.public static void set3dSoundSpeed(float speed)
public static float get3dSoundSpeed()
public static Sound newBankSound(Bank bank,
int index)
bank - The bankindex - Index of the sound in the bank to create
public static Sound newBankSound(Bank bank,
java.lang.String name)
bank - The bank; if null, all loaded banks will be searched for a sound with a matching namename - Name of the sound in the bank to create; should be 31 characters or less
public static Sound newStreamSound(java.lang.String filename,
PathType pathType)
filename - Path to the file to stream.pathType - Indicates how the path is to be interpreted.
public static Sound newStreamSound(java.lang.String filename)
filename - Path to the file to stream.
public static Sound newNetworkStreamSound(java.lang.String url)
url - URL of the file to play
public void destroy()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||