Class JoalAudioBuffer
- All Implemented Interfaces:
Comparable<NamedBean>,Audio,PropertyChangeProvider,AudioBuffer,NamedBean
For now, no system-specific implementations are forseen - this will remain
internal-only
This software is based on or using the JOAL Library available from http://jogamp.org/joal/www/
JOAL is released under the BSD license. The full license terms follow:
Copyright (c) 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistribution in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Sun Microsystems, Inc. or the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
This software is provided "AS IS," without a warranty of any kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
You acknowledge that this software is not designed or intended for use in the design, construction, operation or maintenance of any nuclear facility.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException -
Field Summary
Fields inherited from class jmri.jmrit.audio.AbstractAudioBuffer
LOOP_POINT_BOTH, LOOP_POINT_END, LOOP_POINT_STARTFields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, registerFields 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_QUEUE_BUFFERS, CMD_RESET_POSITION, CMD_RESUME, CMD_REWIND, CMD_STOP, CMD_UNQUEUE_BUFFERS, 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, UPFields 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_UNKNOWNFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN -
Constructor Summary
ConstructorsConstructorDescriptionJoalAudioBuffer(String systemName) Constructor for new JoalAudioBuffer with system nameJoalAudioBuffer(String systemName, String userName) Constructor for new JoalAudioBuffer with system name and user name -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcleanup()Abstract method that concrete classes will implement to perform necessary cleanup routines.protected voidgenerateLoopBuffers(int which) Method used to generate any necessary loop buffers.protected booleanInternal method used to generate buffers for streamingprotected int[]Return reference to the DataStorageBuffer integer arrayintRetrieves the format of the sound sample stored in this bufferintRetrieves the frequency of the sound sample stored in this bufferlongRetrieves the length of the sound sample stored in this bufferprotected booleanMethod used to load the actual sound data into the bufferprotected booleanloadBuffer(InputStream stream) Method used to load the actual sound data from an InputStream into the bufferbooleanloadBuffer(ByteBuffer b, int format, int freq) protected voidInternal method used to remove streaming buffersMethods inherited from class jmri.jmrit.audio.AbstractAudioBuffer
getEndLoopPoint, getFrameSize, getStartLoopPoint, getSubType, getURL, isStreamed, isStreamedForced, setEndLoopPoint, setEndLoopPoint, setInputStream, setStartLoopPoint, setStartLoopPoint, setStreamed, setStreamedForced, setURL, stateChangedMethods inherited from class jmri.implementation.AbstractAudio
dispose, getBeanType, getState, getUsageReport, roundDecimal, roundDecimal, setStateMethods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, toStringSuffix, updateListenerRef, vetoableChangeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, dispose, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getState, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setState, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Constructor Details
-
JoalAudioBuffer
Constructor for new JoalAudioBuffer with system name- Parameters:
systemName- AudioBuffer object system name (e.g. IAB4)
-
JoalAudioBuffer
Constructor for new JoalAudioBuffer with system name and user name- Parameters:
systemName- AudioBuffer object system name (e.g. IAB4)userName- AudioBuffer object user name
-
-
Method Details
-
getDataStorageBuffer
Return reference to the DataStorageBuffer integer arrayApplies only to sub-types:
- Buffer
- Returns:
- buffer[] reference to DataStorageBuffer
-
loadBuffer
Description copied from class:AbstractAudioBufferMethod used to load the actual sound data from an InputStream into the buffer- Specified by:
loadBufferin classAbstractAudioBuffer- Parameters:
stream- InputStream containing sound data- Returns:
- True if successful; False if not
-
loadBuffer
Description copied from class:AbstractAudioBufferMethod used to load the actual sound data into the buffer- Specified by:
loadBufferin classAbstractAudioBuffer- Returns:
- True if successful; False if not
-
loadBuffer
- Specified by:
loadBufferin interfaceAudioBuffer- Overrides:
loadBufferin classAbstractAudioBuffer
-
generateStreamingBuffers
Description copied from class:AbstractAudioBufferInternal method used to generate buffers for streaming- Specified by:
generateStreamingBuffersin classAbstractAudioBuffer- Returns:
- True if successful; False if not
-
removeStreamingBuffers
Description copied from class:AbstractAudioBufferInternal method used to remove streaming buffers- Specified by:
removeStreamingBuffersin classAbstractAudioBuffer
-
generateLoopBuffers
Description copied from class:AbstractAudioBufferMethod used to generate any necessary loop buffers.- Specified by:
generateLoopBuffersin classAbstractAudioBuffer- Parameters:
which- the loop buffer to generate:AbstractAudioBuffer.LOOP_POINT_STARTfor the start loop bufferAbstractAudioBuffer.LOOP_POINT_ENDfor the end loop bufferAbstractAudioBuffer.LOOP_POINT_BOTHfor both loop buffers
-
getFormat
Description copied from interface:AudioBufferRetrieves the format of the sound sample stored in this bufferApplies only to sub-types:
- Buffer
- Returns:
- constant representing format
-
getLength
Description copied from interface:AudioBufferRetrieves the length of the sound sample stored in this bufferApplies only to sub-types:
- Buffer
- Returns:
- length of sound sample in frames
- See Also:
-
getFrequency
Description copied from interface:AudioBufferRetrieves the frequency of the sound sample stored in this bufferApplies only to sub-types:
- Buffer
- Returns:
- frequency of sound sample in Hz
-
cleanup
Description copied from class:AbstractAudioAbstract method that concrete classes will implement to perform necessary cleanup routines.This method is now included in dispose(). The caller can call dispose() to cleanup and deregister an audio object.
- Specified by:
cleanupin classAbstractAudio
-