jmri.jmrit.audio
Interface AudioBuffer

All Superinterfaces:
Audio, NamedBean
All Known Implementing Classes:
AbstractAudioBuffer, JavaSoundAudioBuffer, JoalAudioBuffer, NullAudioBuffer

public interface AudioBuffer
extends Audio

Represent an AudioBuffer, a place to store or control sound information.

The AbstractAudio class contains a basic implementation of the state and messaging code, and forms a useful start for a system-specific implementation. Specific implementations in the jmrix package, e.g. for LocoNet and NCE, will convert to and from the layout commands.

The states and names are Java Bean parameters, so that listeners can be registered to be notified of any changes.

Each AudioBuffer object has a two names. The "user" name is entirely free form, and can be used for any purpose. The "system" name is provided by the system-specific implementations, and provides a unique mapping to the layout control system (e.g. LocoNet, NCE, etc) and address within that system.


This file is part of JMRI.

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.

Author:
Matthew Harris copyright (c) 2009, 2011

Field Summary
static int FORMAT_16BIT_5DOT1
          Definition of 16-bit 5.1 multi-channel audio format.
static int FORMAT_16BIT_6DOT1
          Definition of 16-bit 6.1 multi-channel audio format.
static int FORMAT_16BIT_7DOT1
          Definition of 16-bit 7.1 multi-channel audio format.
static int FORMAT_16BIT_MONO
          Definition of 16-bit mono audio format
static int FORMAT_16BIT_QUAD
          Definition of 16-bit quad multi-channel audio format.
static int FORMAT_16BIT_STEREO
          Definition of 16-bit stereo audio format
static int FORMAT_8BIT_5DOT1
          Definition of 8-bit 5.1 multi-channel audio format.
static int FORMAT_8BIT_6DOT1
          Definition of 8-bit 6.1 multi-channel audio format.
static int FORMAT_8BIT_7DOT1
          Definition of 8-bit 7.1 multi-channel audio format.
static int FORMAT_8BIT_MONO
          Definition of 8-bit mono audio format
static int FORMAT_8BIT_QUAD
          Definition of 8-bit quad multi-channel audio format.
static int FORMAT_8BIT_STEREO
          Definition of 8-bit stereo audio format
static int FORMAT_UNKNOWN
          Definition of unknown audio format
 
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
 
Method Summary
 long getEndLoopPoint()
          Retrieves the end loop point of the sound sample stored in this buffer Applies only to sub-types: Buffer
 int getFormat()
          Retrieves the format 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
 int getFrequency()
          Retrieves the frequency of the sound sample stored in this buffer Applies only to sub-types: Buffer
 long getLength()
          Retrieves the length of the sound sample 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
 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.
 void setEndLoopPoint(long endLoopPoint)
          Sets the end loop point of the sound sample stored in this buffer Applies only to sub-types: Buffer
 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
 void setStreamed(boolean streamed)
          Sets that this buffer is to be streamed as opposed to loaded in full.
 void setURL(String pUrl)
          Sets the url of the sound sample Applies only to sub-types: Buffer
 
Methods inherited from interface jmri.Audio
getSubType, stateChanged
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, dispose, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getState, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setState, setUserName, updateListenerRef
 

Field Detail

FORMAT_UNKNOWN

static final int FORMAT_UNKNOWN
Definition of unknown audio format

See Also:
Constant Field Values

FORMAT_8BIT_MONO

static final int FORMAT_8BIT_MONO
Definition of 8-bit mono audio format

See Also:
Constant Field Values

FORMAT_16BIT_MONO

static final int FORMAT_16BIT_MONO
Definition of 16-bit mono audio format

See Also:
Constant Field Values

FORMAT_8BIT_STEREO

static final int FORMAT_8BIT_STEREO
Definition of 8-bit stereo audio format

See Also:
Constant Field Values

FORMAT_16BIT_STEREO

static final int FORMAT_16BIT_STEREO
Definition of 16-bit stereo audio format

See Also:
Constant Field Values

FORMAT_8BIT_QUAD

static final int FORMAT_8BIT_QUAD
Definition of 8-bit quad multi-channel audio format.

These formats are only supported by certain OpenAL implementations and support is determined at runtime.

JavaSound and Null implementations do not support these formats.

See Also:
Constant Field Values

FORMAT_16BIT_QUAD

static final int FORMAT_16BIT_QUAD
Definition of 16-bit quad multi-channel audio format.

These formats are only supported by certain OpenAL implementations and support is determined at runtime.

JavaSound and Null implementations do not support these formats.

See Also:
Constant Field Values

FORMAT_8BIT_5DOT1

static final int FORMAT_8BIT_5DOT1
Definition of 8-bit 5.1 multi-channel audio format.

These formats are only supported by certain OpenAL implementations and support is determined at runtime.

JavaSound and Null implementations do not support these formats.

See Also:
Constant Field Values

FORMAT_16BIT_5DOT1

static final int FORMAT_16BIT_5DOT1
Definition of 16-bit 5.1 multi-channel audio format.

These formats are only supported by certain OpenAL implementations and support is determined at runtime.

JavaSound and Null implementations do not support these formats.

See Also:
Constant Field Values

FORMAT_8BIT_6DOT1

static final int FORMAT_8BIT_6DOT1
Definition of 8-bit 6.1 multi-channel audio format.

These formats are only supported by certain OpenAL implementations and support is determined at runtime.

JavaSound and Null implementations do not support these formats.

See Also:
Constant Field Values

FORMAT_16BIT_6DOT1

static final int FORMAT_16BIT_6DOT1
Definition of 16-bit 6.1 multi-channel audio format.

These formats are only supported by certain OpenAL implementations and support is determined at runtime.

JavaSound and Null implementations do not support these formats.

See Also:
Constant Field Values

FORMAT_8BIT_7DOT1

static final int FORMAT_8BIT_7DOT1
Definition of 8-bit 7.1 multi-channel audio format.

These formats are only supported by certain OpenAL implementations and support is determined at runtime.

JavaSound and Null implementations do not support these formats.

See Also:
Constant Field Values

FORMAT_16BIT_7DOT1

static final int FORMAT_16BIT_7DOT1
Definition of 16-bit 7.1 multi-channel audio format.

These formats are only supported by certain OpenAL implementations and support is determined at runtime.

JavaSound and Null implementations do not support these formats.

See Also:
Constant Field Values
Method Detail

getURL

String getURL()
Return the url of the sound sample

Applies only to sub-types:

Returns:
url

setURL

void setURL(String pUrl)
Sets the url of the sound sample

Applies only to sub-types:

Parameters:
pUrl - URL for location containing sound sample data

setInputStream

void setInputStream(InputStream stream)
Sets the input stream of the sound sample

Applies only to sub-types:

Parameters:
stream - InputStream containing sound sample data

getFormat

int getFormat()
Retrieves the format of the sound sample stored in this buffer

Applies only to sub-types:

Returns:
constant representing format

getLength

long getLength()
Retrieves the length of the sound sample stored in this buffer

Applies only to sub-types:

Returns:
length of sound sample in frames
See Also:
getFrameSize()

getFrequency

int getFrequency()
Retrieves the frequency of the sound sample stored in this buffer

Applies only to sub-types:

Returns:
frequency of sound sample in Hz

getFrameSize

int getFrameSize()
Retrieves the length of a sound sample frame stored in this buffer

Applies only to sub-types:

Returns:
length of sound sample frame in bytes

setStartLoopPoint

void setStartLoopPoint(long startLoopPoint)
Sets the start loop point of the sound sample stored in this buffer

Applies only to sub-types:

Parameters:
startLoopPoint - position of start loop point in samples

getStartLoopPoint

long getStartLoopPoint()
Retrieves the start loop point of the sound sample stored in this buffer

Applies only to sub-types:

Returns:
position of start loop point in samples

setEndLoopPoint

void setEndLoopPoint(long endLoopPoint)
Sets the end loop point of the sound sample stored in this buffer

Applies only to sub-types:

Parameters:
endLoopPoint - position of end loop point in samples

getEndLoopPoint

long getEndLoopPoint()
Retrieves the end loop point of the sound sample stored in this buffer

Applies only to sub-types:

Returns:
position of end loop point in samples

setStreamed

void setStreamed(boolean streamed)
Sets that this buffer is to be streamed as opposed to loaded in full. Can only be turned off when isStreamedForced is not set.

Applies only to sub-types:

Parameters:
streamed - buffer is streamed from file or loaded in full
See Also:
isStreamedForced()

isStreamed

boolean isStreamed()
Retrieves the current streaming setting of this buffer

Applies only to sub-types:

Returns:
current streaming setting

isStreamedForced

boolean isStreamedForced()
Determines if this buffer can be loaded in full or if it must be streamed from the file. Forced streaming is usually restricted to larger sound samples that are otherwise too large to fit directly into memory.

Applies only to sub-types:

Returns:
True if buffer must be streamed; False it can be loaded in full


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads