|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.implementation.AbstractNamedBean
jmri.implementation.AbstractAudio
jmri.jmrit.audio.AbstractAudioBuffer
public abstract class AbstractAudioBuffer
Base implementation of the AudioBuffer class.
Specific implementations will extend this base class.
JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
| Field Summary | |
|---|---|
protected static int |
LOOP_POINT_BOTH
Identifier of both loop points |
protected static int |
LOOP_POINT_END
Identifier of end loop point |
protected static int |
LOOP_POINT_START
Identifier of start loop point |
| Fields inherited from class jmri.implementation.AbstractNamedBean |
|---|
mSystemName, mUserName |
| Fields inherited from interface jmri.jmrit.audio.AudioBuffer |
|---|
FORMAT_16BIT_5DOT1, FORMAT_16BIT_6DOT1, FORMAT_16BIT_7DOT1, FORMAT_16BIT_MONO, FORMAT_16BIT_QUAD, FORMAT_16BIT_STEREO, FORMAT_8BIT_5DOT1, FORMAT_8BIT_6DOT1, FORMAT_8BIT_7DOT1, FORMAT_8BIT_MONO, FORMAT_8BIT_QUAD, FORMAT_8BIT_STEREO, FORMAT_UNKNOWN |
| Fields inherited from interface jmri.Audio |
|---|
AT, BUFFER, CMD_BIND_BUFFER, CMD_FADE_IN, CMD_FADE_OUT, CMD_INIT_FACTORY, CMD_LOAD_SOUND, CMD_PAUSE, CMD_PAUSE_TOGGLE, CMD_PLAY, CMD_PLAY_TOGGLE, CMD_RESET_POSITION, CMD_RESUME, CMD_REWIND, CMD_STOP, DECIMAL_PLACES, FADE_IN, FADE_NONE, FADE_OUT, LISTENER, MAX_DISTANCE, SOURCE, STATE_EMPTY, STATE_INITIAL, STATE_LOADED, STATE_MOVING, STATE_PLAYING, STATE_POSITIONED, STATE_STOPPED, UP |
| Fields inherited from interface jmri.NamedBean |
|---|
INCONSISTENT, UNKNOWN |
| Constructor Summary | |
|---|---|
AbstractAudioBuffer(String systemName)
Abstract constructor for new AudioBuffer with system name |
|
AbstractAudioBuffer(String systemName,
String userName)
Abstract constructor for new AudioBuffer with system name and user name |
|
| Method Summary | |
|---|---|
protected abstract void |
generateLoopBuffers(int which)
Method used to generate any necessary loop buffers. |
protected abstract boolean |
generateStreamingBuffers()
Internal method used to generate buffers for streaming |
long |
getEndLoopPoint()
Retrieves the end loop point of the sound sample stored in this buffer Applies only to sub-types: Buffer |
int |
getFrameSize()
Retrieves the length of a sound sample frame stored in this buffer Applies only to sub-types: Buffer |
long |
getStartLoopPoint()
Retrieves the start loop point of the sound sample stored in this buffer Applies only to sub-types: Buffer |
char |
getSubType()
An Audio object can represent one of a number of subtypes of object. |
String |
getURL()
Return the url of the sound sample Applies only to sub-types: Buffer |
boolean |
isStreamed()
Retrieves the current streaming setting of this buffer Applies only to sub-types: Buffer |
boolean |
isStreamedForced()
Determines if this buffer can be loaded in full or if it must be streamed from the file. |
protected abstract boolean |
loadBuffer()
Method used to load the actual sound data into the buffer |
protected abstract boolean |
loadBuffer(InputStream s)
Method used to load the actual sound data from an InputStream into the buffer |
protected abstract void |
removeStreamingBuffers()
Internal method used to remove streaming buffers |
void |
setEndLoopPoint(long endLoopPoint)
Sets the end loop point of the sound sample stored in this buffer Applies only to sub-types: Buffer |
protected void |
setEndLoopPoint(long endLoopPoint,
boolean generateLoopBuffers)
Internal method used to set the end loop point of this buffer with optional generation of loop buffers |
void |
setInputStream(InputStream stream)
Sets the input stream of the sound sample Applies only to sub-types: Buffer |
void |
setStartLoopPoint(long startLoopPoint)
Sets the start loop point of the sound sample stored in this buffer Applies only to sub-types: Buffer |
protected void |
setStartLoopPoint(long startLoopPoint,
boolean generateLoopBuffers)
Internal method used to set the start loop point of this buffer with optional generation of loop buffers |
void |
setStreamed(boolean streamed)
Sets that this buffer is to be streamed as opposed to loaded in full. |
protected void |
setStreamedForced(boolean streamedForced)
Protected method used internally to modify the forced streaming flag |
void |
setURL(String url)
Sets the url of the sound sample Applies only to sub-types: Buffer |
void |
stateChanged(int oldState)
Method used to update the current state of the Audio object |
| Methods inherited from class jmri.implementation.AbstractAudio |
|---|
cleanUp, getState, roundDecimal, roundDecimal, setState, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface jmri.jmrit.audio.AudioBuffer |
|---|
getFormat, getFrequency, getLength |
| Field Detail |
|---|
protected static final int LOOP_POINT_START
protected static final int LOOP_POINT_END
protected static final int LOOP_POINT_BOTH
| Constructor Detail |
|---|
public AbstractAudioBuffer(String systemName)
systemName - AudioBuffer object system name (e.g. IAB4)
public AbstractAudioBuffer(String systemName,
String userName)
systemName - AudioBuffer object system name (e.g. IAB4)userName - AudioBuffer object user name| Method Detail |
|---|
public char getSubType()
AudioThis method enables us to determine which of those subtypes this particular instance is and be able to process accordingly.
Current supported subtypes are:
getSubType in interface Audiopublic String getURL()
AudioBufferApplies only to sub-types:
getURL in interface AudioBufferpublic void setURL(String url)
AudioBufferApplies only to sub-types:
setURL in interface AudioBufferurl - URL for location containing sound sample datapublic void setInputStream(InputStream stream)
AudioBufferApplies only to sub-types:
setInputStream in interface AudioBufferstream - InputStream containing sound sample datapublic int getFrameSize()
AudioBufferApplies only to sub-types:
getFrameSize in interface AudioBufferprotected abstract boolean loadBuffer()
protected abstract boolean loadBuffer(InputStream s)
s - InputStream containing sound data
public void setStartLoopPoint(long startLoopPoint)
AudioBufferApplies only to sub-types:
setStartLoopPoint in interface AudioBufferstartLoopPoint - position of start loop point in samples
protected void setStartLoopPoint(long startLoopPoint,
boolean generateLoopBuffers)
startLoopPoint - position of start loop point in samplesgenerateLoopBuffers - True if loop buffers to be generatedpublic long getStartLoopPoint()
AudioBufferApplies only to sub-types:
getStartLoopPoint in interface AudioBufferpublic void setEndLoopPoint(long endLoopPoint)
AudioBufferApplies only to sub-types:
setEndLoopPoint in interface AudioBufferendLoopPoint - position of end loop point in samples
protected void setEndLoopPoint(long endLoopPoint,
boolean generateLoopBuffers)
endLoopPoint - position of end loop point in samplesgenerateLoopBuffers - True if loop buffers to be generatedpublic long getEndLoopPoint()
AudioBufferApplies only to sub-types:
getEndLoopPoint in interface AudioBufferpublic void setStreamed(boolean streamed)
AudioBufferisStreamedForced is not set.
Applies only to sub-types:
setStreamed in interface AudioBufferstreamed - buffer is streamed from file or loaded in fullAudioBuffer.isStreamedForced()public boolean isStreamed()
AudioBufferApplies only to sub-types:
isStreamed in interface AudioBufferprotected void setStreamedForced(boolean streamedForced)
streamedForced - True if required; False if notpublic boolean isStreamedForced()
AudioBufferApplies only to sub-types:
isStreamedForced in interface AudioBufferprotected abstract void generateLoopBuffers(int which)
which - the loop buffer to generate:
LOOP_POINT_START for the start loop buffer
LOOP_POINT_END for the end loop buffer
LOOP_POINT_BOTH for both loop buffersprotected abstract boolean generateStreamingBuffers()
protected abstract void removeStreamingBuffers()
public void stateChanged(int oldState)
Audio
stateChanged in interface Audio
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||