001/* Class representing an audio parameter change of LiveSound.
002
003 Copyright (c) 1998-2013 The Regents of the University of California.
004 All rights reserved.
005 Permission is hereby granted, without written agreement and without
006 license or royalty fees, to use, copy, modify, and distribute this
007 software and its documentation for any purpose, provided that the above
008 copyright notice and the following two paragraphs appear in all copies
009 of this software.
010
011 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
012 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
013 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
014 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
015 SUCH DAMAGE.
016
017 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
018 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
019 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
020 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
021 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
022 ENHANCEMENTS, OR MODIFICATIONS.
023
024 PT_COPYRIGHT_VERSION_2
025 COPYRIGHTENDKEY
026
027 */
028package ptolemy.media.javasound;
029
030///////////////////////////////////////////////////////////////////
031//// LiveSoundEvent
032
033/**
034 A LiveSoundEvent represents a change in an audio parameter of
035 LiveSound.  This event will be generated by LiveSound when an
036 audio parameter change (e.g., a change in the sample rate)
037 occurs, and is passed to the live sound event listeners to
038 notify them about the change.
039
040 @author Brian K. Vogel
041 @version $Id$
042 @since Ptolemy II 1.0
043 @Pt.ProposedRating Red (vogel)
044 @Pt.AcceptedRating Red
045 @see LiveSoundListener
046 */
047public class LiveSoundEvent {
048    /** Construct a LiveSoundEvent, with the specified parameter.
049     *
050     *  @param parameter The audio parameter of LiveSound that
051     *   has changed. The value of parameter should be one of
052     *   LiveSoundEvent.SAMPLE_RATE, LiveSoundEvent.CHANNELS,
053     *   LiveSoundEvent.BUFFER_SIZE, or
054     *   LiveSoundEvent.BITS_PER_SAMPLE.
055     */
056    public LiveSoundEvent(int parameter) {
057        // FIXME: Should check that the value is parameter is legal.
058        _parameter = parameter;
059    }
060
061    ///////////////////////////////////////////////////////////////////
062    ////                         public methods                    ////
063
064    /** Return the parameter of LiveSound that has changed. The
065     *  corresponding method of LiveSound may then be invoked do
066     *  discover the new value of the parameter. For example, if
067     *  a sample rate change occurs, then this method will return
068     *  LiveSoundEvent.SAMPLE_RATE. The getSampleRate() method of
069     *  LiveSound may then be invoked to discover the new value
070     *  of the sample rate.
071     *
072     *  @return SAMPLE_RATE, CHANNELS, BUFFER_SIZE, or BITS_PER_SAMPLE.
073     */
074    public int getSoundParameter() {
075        return _parameter;
076    }
077
078    ///////////////////////////////////////////////////////////////////
079    ////                         public members                    ////
080
081    /** The value indicates a sample rate change event.
082     */
083    public static final int SAMPLE_RATE = 0;
084
085    /** The value indicates a channel number change event.
086     */
087    public static final int CHANNELS = 1;
088
089    /** The value indicates a buffer size change event.
090     */
091    public static final int BUFFER_SIZE = 2;
092
093    /** The value indicates a bits per channel change event.
094     */
095    public static final int BITS_PER_SAMPLE = 3;
096
097    ///////////////////////////////////////////////////////////////////
098    ////                       private fields                    ////
099    private int _parameter;
100}