/[svn]/jlscp/trunk/src/org/linuxsampler/lscp/AudioOutputDevice.java
ViewVC logotype

Annotation of /jlscp/trunk/src/org/linuxsampler/lscp/AudioOutputDevice.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1139 - (hide annotations) (download)
Mon Apr 2 20:43:58 2007 UTC (17 years, 1 month ago) by iliev
File size: 4297 byte(s)
* upgraded to version 0.4a

1 iliev 596 /*
2     * jlscp - a java LinuxSampler control protocol API
3     *
4 iliev 1139 * Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com>
5 iliev 596 *
6     * This file is part of jlscp.
7     *
8     * jlscp is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License version 2
10     * as published by the Free Software Foundation.
11     *
12     * jlscp is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with jlscp; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20     * MA 02111-1307 USA
21     */
22    
23     package org.linuxsampler.lscp;
24    
25     /**
26     * Provides information about the current settings of a specific audio output device.
27     * @author Grigor Iliev
28     */
29     public class AudioOutputDevice extends AbstractDevice {
30     private Parameter<Integer> channels = null;
31     private Parameter<Integer> samplerate = null;
32    
33 iliev 784 private AudioOutputChannel[] audioChannels = new AudioOutputChannel[0];
34 iliev 596
35 iliev 784
36 iliev 596 /** Creates a new instance of AudioOutputDevice */
37     public
38     AudioOutputDevice() {
39    
40     }
41    
42     /**
43     * Gets the amount of audio output channels this device currently offers.
44     * @return The amount of audio output channels this device currently offers.
45     */
46     public int
47     getChannelCount() { return channels == null ? 0 : channels.getValue(); }
48    
49     /**
50     * Gets the <code>CHANNELS</code> parameter.
51     * @return A <code>Parameter<Integer></code> instance.
52     */
53     public Parameter<Integer>
54     getChannelsParameter() { return channels; }
55    
56     /**
57     * Sets the <code>CHANNELS</code> parameter.
58     * @param channels The new <code>CHANNELS</code> parameter.
59     */
60     public void
61     setChannelsParameter(Parameter<Integer> channels) { this.channels = channels; }
62    
63     /**
64     * Gets the sample rate this device uses.
65     * @return The sample rate this device uses.
66     */
67     public int
68     getSampleRate() { return samplerate == null ? 0 : samplerate.getValue(); }
69    
70     /**
71     * Gets the <code>SAMPLERATE</code> parameter.
72     * @return A <code>Parameter<Integer></code> instance.
73     */
74     public Parameter<Integer>
75     getSampleRateParameter() { return samplerate; }
76    
77     /**
78     * Sets the <code>SAMPLERATE</code> parameter.
79     * @param samplerate The new <code>SAMPLERATE</code> parameter.
80     */
81     public void
82     setSampleRateParameter(Parameter<Integer> samplerate) { this.samplerate = samplerate; }
83 iliev 784
84     /**
85     * Gets the current non-<code>null</code>
86     * list of audio channels this device offers.
87     * @return An <code>AudioOutputChannel</code> array
88     * providing all audio channels this device offers.
89     */
90     public AudioOutputChannel[]
91     getAudioChannels() { return audioChannels; }
92    
93     /**
94     * Sets the current list of audio output channels.
95     * @param channels The new list of audio output channels.
96     * @throws IllegalArgumentException If <code>channels</code> is <code>null</code>.
97     */
98     public void
99     setAudioChannels(AudioOutputChannel[] channels) {
100     if(channels == null)
101     throw new IllegalArgumentException("channels must be non null");
102     audioChannels = channels;
103     }
104    
105     /**
106     * Gets the audio output channel at the specified index.
107     * @param index The index of the audio output channel to be retrieved.
108     */
109     public AudioOutputChannel
110     getAudioChannel(int index) { return audioChannels[index]; }
111    
112     /**
113     * Gets the current number of audio output channels this device offers.
114     * @return The current number of audio output channels this device offers.
115     */
116     public int
117     getAudioChannelCount() { return audioChannels.length; }
118 iliev 1139
119     /**
120     * Gets a <code>Parameter</code> array providing all parameters
121     * of this audio output device (including <code>ACTIVE</code>,
122     * <code>CHANNELS</code> and <code>SAMPLERATE</code> parameters).
123     * @return A <code>Parameter</code> array providing all parameters
124     * of this MIDI port.
125     */
126     public Parameter[]
127     getAllParameters() {
128     Parameter[] ap = getAdditionalParameters();
129     Parameter[] params = new Parameter[ap.length + 3];
130     params[0] = getActiveParameter();
131     params[1] = channels;
132     params[2] = samplerate;
133    
134     for(int i = 0; i < ap.length; i++) params[i + 3] = ap[i];
135    
136     return params;
137     }
138 iliev 596 }

  ViewVC Help
Powered by ViewVC