|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.audio.Stream
public abstract class Stream
Stream a PCM audio file for playback OS 2.3
| Field Summary | |
|---|---|
static int |
MAX_SAMPLE_RATE
max sample rate = 48 kHz |
static int |
MIN_SAMPLE_RATE
min sample rate = 1 kHz |
static int |
SAMPLE_RATE_11K
|
static int |
SAMPLE_RATE_22K
|
static int |
SAMPLE_RATE_44K
|
static int |
SAMPLE_RATE_8K
common sample rates |
| Fields inherited from interface danger.media.PlayableMedia |
|---|
DEFAULT_PRIORITY, PRIORITY_1, PRIORITY_2, PRIORITY_3, PRIORITY_4, PRIORITY_5 |
| Constructor Summary | |
|---|---|
Stream()
|
|
| Method Summary | |
|---|---|
void |
destroy()
free internal resources for this object |
abstract void |
fadeFromToInTime(int sourceVolume,
int destVolume,
int timeInMiliseconds)
fade from source volume, to dest volume in time miliseconds. |
int |
framesToMicroseconds(int frames)
Given sample frames, return microseconds. |
int |
getCurrentLoopNumber()
Gets the number of times the looped media has looped back to the loop start. |
abstract int |
getLoopCount()
Gets the loop count; which is the total number of times an object is played. |
abstract int |
getLoops()
Deprecated. - use getLoopCount() instead. |
int |
getMarkerCount()
Gets the number of markers contained by the currently loaded media. |
int |
getMarkerID(int index)
Return the integer ID associated with the marker at the given index. |
String |
getMarkerName(int index)
Return the name associated with the marker at the given index. |
int |
getMarkerPosition(int index)
Return the position in milliseconds of the marker at the given index. |
int |
getMediaType()
Returns file type of media. |
int |
getMicrosecondLength()
Deprecated. - use getMillisecondLength() instead. |
int |
getMicrosecondPosition()
Deprecated. - use getMillisecondPosition() instead. |
abstract int |
getMillisecondLength()
get the length of the stream in milliseconds |
abstract int |
getMillisecondPosition()
get the current playback position of the stream in milliseconds |
abstract int |
getPlaybackLength()
get playback length in sample frames |
abstract int |
getPlaybackPosition()
Get the position in sample frames |
int |
getPlaybackRate()
Get the playback rate of the media. 100 is default rate. |
abstract int |
getPriority()
Get stream priority level. |
abstract int |
getRate()
|
int |
getStereoPosition()
Returns current stereo position. |
int |
getTranspose()
Return tuning in semitones. |
int |
getTuning()
Return tuning in cents (1200 is down an octave, -1200 is up an octave) This interacts with PlayableAudio.setTranspose(int) and PlayableAudio.getTranspose() |
int |
getUniqueID()
return runtime ID. |
abstract int |
getVolume()
Returns current volume in percent. |
int |
getVolumeClass()
Get the current volume class. |
abstract boolean |
isDone()
Returns true if done playing |
abstract boolean |
isLoaded()
is stream loaded |
boolean |
isLoopingEnabled()
Return whether looping is enabled (set by a call to PlayableMedia.setLoopingEnabled(boolean)). |
boolean |
isMuted()
Return true if the audio is muted |
abstract boolean |
isPaused()
pause, resume and test stream object |
boolean |
isPlaying()
Returns true if object is playing. |
static Stream |
load(byte[] data)
Given an array of bytes, try and load a Stream (Can be a WAV, AIF file) Will return null if data is invalid. |
static Stream |
load(byte[] data,
boolean autoDelete)
Given an array of bytes, try and load a Stream (Can be a WAV, AIF file) Will return null if data is invalid. |
static Stream |
load(File f)
Given a file, try and load a Stream. |
static Stream |
load(File f,
boolean autoDelete)
Given a file, try and load a Stream. |
static Stream |
load(int resourceID)
Given an resource ID, try and load a Stream (Can be a WAV, AIF file) Will return null if data is invalid. |
static Stream |
load(int resourceID,
boolean autoDelete)
Given an resource ID, try and load a Stream (Can be a WAV, AIF file) Will return null if data is invalid. |
abstract boolean |
loadFromFile(byte[] data)
pass in data formatted as a AIF, WAV, or au file. |
abstract boolean |
loadFromFileName(String fileName)
pass in filename as a string. |
boolean |
loadFromResource(int id)
pass and ID, and read data from the application resource file. |
boolean |
loadFromResource(int id,
Application app)
|
int |
microsecondsToFrames(int uSec)
Given microseconds, return sample frames. |
abstract void |
pause()
Will pause object |
void |
play()
Given a stream, start it playing, and auto delete it when done playing. |
static Stream |
play(byte[] data)
Given an array of bytes load a stream file, start it playing, and auto delete it when done playing. |
static Stream |
play(File f)
Given a file, try and load a Stream, start it playing, and auto delete it when done playing. |
static Stream |
play(File f,
boolean autoDelete)
Given a file, try and load a Stream, start it playing, and auto delete it when done playing if requested. |
static Stream |
play(int resourceID)
method to load a stream file from a resource, start it playing, and auto delete it when done playing. |
static Stream |
play(int resourceID,
int filter)
method to load a stream file from a resource, start it playing, and auto delete it when done playing. |
abstract void |
resume()
Will resume object if paused. |
abstract void |
setBuzzFlash(boolean buzzOn,
boolean flashOn)
Set auto generate buzz/flash on or off |
abstract void |
setBuzzFlashEnable(boolean buzzOn,
boolean flashOn)
Set buzz/flash enable or off. |
void |
setDoneCallbackEvent(Event done)
Set the event that is called when this media is finished. |
void |
setDoneCallbackEvent(Event done,
boolean doEventOnce)
Set the event that is called when this media is finished. |
abstract void |
setLoopCount(int loopCount)
Sets the loop count; which is the total number of times an object is played. |
void |
setLoopingEnabled(boolean on)
Enable looping. |
abstract void |
setLoops(int loops)
Deprecated. - use setLoopCount(int) instead. |
void |
setMicrosecondPosition(int uSec)
Deprecated. - use setMillisecondPosition(int) instead. |
abstract void |
setMillisecondPosition(int mSec)
set the current playback position of the stream in milliseconds |
void |
setMute(boolean mute)
Mute or unmute the audio. |
abstract void |
setPlaybackPosition(int sampleFrame)
Set the position in sample frames |
void |
setPlaybackRate(int newRate)
Set the playback rate of the media. |
void |
setPositionCallbackEvent(Event event,
int position)
Set an event that is called when this media reaches the given position during playback. |
void |
setPositionToMarker(int markerID)
Set the media playback position to the position associated with the marker with the given markerID |
abstract void |
setPriority(int priority)
Set stream priority level. |
abstract void |
setRate(int newRate)
get/set the sample rate of an object |
abstract void |
setRouteBus(int routeBus)
|
void |
setStereoPosition(int position)
Set the stereo position of sound. |
void |
setStoppedCallbackEvent(Event stopped)
Set the event that is called when this media is stopped by stop(). |
void |
setStoppedCallbackEvent(Event stopped,
boolean doEventOnce)
Set the event that is called when this media is stopped by stop(). |
void |
setTranspose(int semitones)
Set tuning in semitones. |
void |
setTuning(int cents)
Set tuning in cents (1200 is down an octave, -1200 is up an octave) This interacts with PlayableAudio.setTranspose(int) and PlayableAudio.getTranspose() |
abstract void |
setVolume(int volume)
get/set playback volume of object. |
void |
setVolumeClass(int volumeClass)
Set the volume class. |
boolean |
start()
start stream playing, will return false if failed to start |
boolean |
start(int sampleFrameStart)
start stream playing. |
boolean |
start(int sampleFrameStart,
int filter)
start a stream playing, but filter content types from ToneFilter. |
boolean |
startAtOffset(int startOffset)
|
boolean |
startDefault()
Start Stream with defaults Returns true if started NOTE: This is the same as start(). |
void |
startPlaying()
Start media playback with default attributes. |
void |
startPlaying(int attributes)
Start media playback with specified attributes. |
boolean |
startWithFilter(int filter)
Start Sound with a filter Returns true if started NOTE: This is implemented in Playable OS 2.3 |
void |
stop()
Will stop the object and reset to begining |
void |
stopPlaying()
Stop media playback |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MIN_SAMPLE_RATE
public static final int MAX_SAMPLE_RATE
public static final int SAMPLE_RATE_8K
public static final int SAMPLE_RATE_11K
public static final int SAMPLE_RATE_22K
public static final int SAMPLE_RATE_44K
| Constructor Detail |
|---|
public Stream()
| Method Detail |
|---|
public void destroy()
destroy in interface Playabledestroy in interface PlayableMedia
public static Stream load(byte[] data,
boolean autoDelete)
public static Stream load(byte[] data)
public static Stream play(byte[] data)
public static Stream load(int resourceID,
boolean autoDelete)
public static Stream load(int resourceID)
public static Stream play(int resourceID)
public static Stream play(int resourceID,
int filter)
public static Stream load(File f,
boolean autoDelete)
public static Stream load(File f)
public static Stream play(File f,
boolean autoDelete)
public static Stream play(File f)
public final void play()
public abstract boolean loadFromFile(byte[] data)
public abstract boolean loadFromFileName(String fileName)
public boolean loadFromResource(int id)
public boolean loadFromResource(int id,
Application app)
public abstract void setRouteBus(int routeBus)
public abstract void setVolume(int volume)
public abstract int getVolume()
Playable
public abstract void setPriority(int priority)
priority - - priority level for mediapublic abstract int getPriority()
public abstract int getPlaybackLength()
public abstract int getPlaybackPosition()
public abstract void setPlaybackPosition(int sampleFrame)
public int getMicrosecondLength()
getMillisecondLength() instead.
Playable
public void setMicrosecondPosition(int uSec)
setMillisecondPosition(int) instead.
Playable
public int getMicrosecondPosition()
getMillisecondPosition() instead.
Playable
public abstract int getMillisecondLength()
public abstract void setMillisecondPosition(int mSec)
mSec - - position in media to seek topublic abstract int getMillisecondPosition()
public int microsecondsToFrames(int uSec)
public int framesToMicroseconds(int frames)
public abstract boolean isDone()
public abstract void setLoops(int loops)
setLoopCount(int) instead.
public abstract int getLoops()
getLoopCount() instead.
public abstract void setLoopCount(int loopCount)
loopCount - - total number of times to play; 0 means loop forever.public abstract int getLoopCount()
public abstract void setRate(int newRate)
public abstract int getRate()
public boolean startDefault()
public boolean startWithFilter(int filter)
public boolean start()
public boolean start(int sampleFrameStart)
public boolean start(int sampleFrameStart,
int filter)
public abstract void setBuzzFlashEnable(boolean buzzOn,
boolean flashOn)
public abstract void setBuzzFlash(boolean buzzOn,
boolean flashOn)
public abstract void fadeFromToInTime(int sourceVolume,
int destVolume,
int timeInMiliseconds)
public abstract boolean isLoaded()
public abstract boolean isPaused()
public abstract void pause()
Playable
public abstract void resume()
Playable
public int getUniqueID()
Playable
getUniqueID in interface PlayablegetUniqueID in interface PlayableMediapublic int getMediaType()
PlayableMedia
getMediaType in interface PlayableMediapublic void setVolumeClass(int volumeClass)
PlayableAudio
setVolumeClass in interface PlayableAudiopublic int getVolumeClass()
PlayableAudio
getVolumeClass in interface PlayableAudiopublic void setLoopingEnabled(boolean on)
PlayableMediaPlayableMedia.setLoopCount(int) or is 0 (loop forever) by default.
setLoopingEnabled in interface PlayableMediaon - - enable or disable looping.public boolean isLoopingEnabled()
PlayableMediaPlayableMedia.setLoopingEnabled(boolean)).
isLoopingEnabled in interface PlayableMediapublic int getCurrentLoopNumber()
PlayableMedia
getCurrentLoopNumber in interface PlayableMediapublic int getMarkerCount()
PlayableMedia
getMarkerCount in interface PlayableMediapublic int getMarkerID(int index)
PlayableMedia
getMarkerID in interface PlayableMediapublic String getMarkerName(int index)
PlayableMedia
getMarkerName in interface PlayableMediapublic int getMarkerPosition(int index)
PlayableMedia
getMarkerPosition in interface PlayableMediapublic void setPositionToMarker(int markerID)
PlayableMedia
setPositionToMarker in interface PlayableMediamarkerID - - integer ID of the marker (retrieved via PlayableMedia.getMarkerID(int))public void setStereoPosition(int position)
PlayableAudio
setStereoPosition in interface PlayableAudiopublic int getStereoPosition()
PlayableAudio
getStereoPosition in interface PlayableAudiopublic void setMute(boolean mute)
PlayableAudio
setMute in interface PlayableAudiopublic boolean isMuted()
PlayableAudio
isMuted in interface PlayableAudiopublic void startPlaying()
PlayableMedia
startPlaying in interface PlayableMediapublic void startPlaying(int attributes)
PlayableMedia
startPlaying in interface PlayableMediaattributes - - class-specific attributes applied to this playbackpublic boolean isPlaying()
PlayableMedia
isPlaying in interface PlayableMediapublic void stopPlaying()
PlayableMedia
stopPlaying in interface PlayableMediapublic void setPlaybackRate(int newRate)
PlayableMedia
setPlaybackRate in interface PlayableMedianewRate - - new playback rate; 100 is default rate.public int getPlaybackRate()
PlayableMedia
getPlaybackRate in interface PlayableMediapublic void setTranspose(int semitones)
PlayableAudioPlayableAudio.setTuning(int) and PlayableAudio.getTuning()
setTranspose in interface PlayableAudiopublic int getTranspose()
PlayableAudioPlayableAudio.setTuning(int) has been called, This will truncate actual value to nearest 100 cents
getTranspose in interface PlayableAudiopublic void setTuning(int cents)
PlayableAudioPlayableAudio.setTranspose(int) and PlayableAudio.getTranspose()
setTuning in interface PlayableAudiopublic int getTuning()
PlayableAudioPlayableAudio.setTranspose(int) and PlayableAudio.getTranspose()
getTuning in interface PlayableAudio
public void setPositionCallbackEvent(Event event,
int position)
PlayableMedia
setPositionCallbackEvent in interface PlayableMediaevent - - event to be postedposition - - time in milliseconds at which the event should be postedpublic void setDoneCallbackEvent(Event done)
PlayableMedia
setDoneCallbackEvent in interface PlayableMediadone - - event to be posted
public void setDoneCallbackEvent(Event done,
boolean doEventOnce)
PlayableMedia
setDoneCallbackEvent in interface PlayableMediadone - - event to be posteddoEventOnce - - if true, callback only called once for a given playbackpublic void setStoppedCallbackEvent(Event stopped)
PlayableMedia
setStoppedCallbackEvent in interface PlayableMediastopped - - event to be posted
public void setStoppedCallbackEvent(Event stopped,
boolean doEventOnce)
PlayableMedia
setStoppedCallbackEvent in interface PlayableMediastopped - - event to be posteddoEventOnce - - if true, callback only called once for a given playbackpublic boolean startAtOffset(int startOffset)
public void stop()
Playable
stop in interface Playable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||