/[svn]/jlscp/branches/jlscp_0_3a/src/org/linuxsampler/lscp/AudioOutputChannel.java
ViewVC logotype

Annotation of /jlscp/branches/jlscp_0_3a/src/org/linuxsampler/lscp/AudioOutputChannel.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 785 - (hide annotations) (download)
Mon Oct 10 14:55:45 2005 UTC (18 years, 6 months ago) by (unknown author)
File size: 5011 byte(s)
This commit was manufactured by cvs2svn to create branch 'jlscp_0_3a'.
1 iliev 596 /*
2     * jlscp - a java LinuxSampler control protocol API
3     *
4     * Copyright (C) 2005 Grigor Kirilov Iliev
5     *
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     import java.util.Vector;
26    
27    
28     /**
29     * This class provides detailed information about an audio output chanel.
30     * @author Grigor Iliev
31     */
32     public class AudioOutputChannel {
33 iliev 784 private Parameter<String> name;
34     private Parameter<Boolean> mixChannel;
35     private Parameter<Integer> mcDst;
36 iliev 596
37     private final Vector<Parameter> prmList = new Vector<Parameter>();
38    
39    
40     /** Creates a new instance of AudioOutputChannel */
41 iliev 784 public
42     AudioOutputChannel() {
43 iliev 596 }
44    
45     /**
46     * Gets the name of this audio output channel.
47     * @return The name of this audio output channel.
48     */
49     public String
50 iliev 784 getName() { return name == null ? null : name.getValue(); }
51 iliev 596
52     /**
53 iliev 784 * Gets the <code>NAME</code> parameter.
54     * @return A <code>Parameter<String></code> instance.
55 iliev 596 */
56 iliev 784 public Parameter<String>
57     getNameParameter() { return name; }
58    
59     /**
60     * Sets the <code>NAME</code> parameter.
61     * @param name A <code>Parameter<String></code> instance.
62     */
63 iliev 596 public void
64 iliev 784 setNameParameter(Parameter<String> name) { this.name = name; }
65 iliev 596
66     /**
67     * Determines whether this channel is a mix-channel.
68     * @return <code>true</code> if this is a mix-channel, <code>false</code> otherwise.
69     */
70     public boolean
71 iliev 784 isMixChannel() { return mixChannel == null ? false : mixChannel.getValue(); }
72 iliev 596
73     /**
74 iliev 784 * Gets the <code>IS_MIX_CHANNEL</code> parameter.
75     * @return A <code>Parameter<Integer></code> instance.
76     */
77     public Parameter<Boolean>
78     getMixChannelParameter() { return mixChannel; }
79    
80     /**
81 iliev 596 * Sets whether this channel is a mix-channel.
82     * @param mixChannel Specifies whether this channel is a mix-channel or not.
83     */
84     public void
85 iliev 784 setMixChannelParameter(Parameter<Boolean> mixChannel) {
86     this.mixChannel = mixChannel;
87     }
88 iliev 596
89     /**
90     * Gets the number of the real audio channel this mix channel refers to.
91     * @return The number of the real audio channel this mix channel refers to.
92     */
93     public int
94 iliev 784 getMixChannelDest() { return mcDst == null ? -1 : mcDst.getValue(); }
95 iliev 596
96     /**
97 iliev 784 * Gets the <code>MIX_CHANNEL_DESTINATION</code> parameter.
98     * @return The <code>MIX_CHANNEL_DESTINATION</code> parameter.
99 iliev 596 */
100 iliev 784 public Parameter<Integer>
101     getMixChannelDestParameter() { return mcDst; }
102    
103     /**
104     * Sets the <code>MIX_CHANNEL_DESTINATION</code> parameter.
105     * @param mcDst The new <code>MIX_CHANNEL_DESTINATION</code> parameter.
106     */
107 iliev 596 public void
108 iliev 784 setMixChannelDestParameter(Parameter<Integer> mcDst) { this.mcDst = mcDst; }
109 iliev 596
110     /**
111     * Adds additional parameter to this audio output channel.
112     * @param prm The additional parameter to be added.
113     */
114     public void
115     addParameter(Parameter prm) { prmList.add(prm); }
116    
117     /**
118 iliev 784 * Gets a <code>Parameter</code> array with the additional parameters
119 iliev 596 * of this audio output channel.
120 iliev 784 * @return A <code>Parameter</code> array with the additional parameters
121 iliev 596 * of this audio output channel.
122     */
123     public Parameter[]
124     getAdditionalParameters() {
125     return prmList.toArray(new Parameter[prmList.size()]);
126     }
127    
128     /**
129 iliev 784 * Gets a <code>Parameter</code> array providing all parameters
130     * of this audio output channel (including <code>NAME</code>,
131     * <code>IS_MIX_CHANNEL</code>, <code>MIX_CHANNEL_DESTINATION</code> parameters).
132     * @return A <code>Parameter</code> array providing all parameters
133     * of this audio output channel.
134     */
135     public Parameter[]
136     getAllParameters() {
137     Parameter[] params;
138    
139     if(getMixChannelDestParameter() != null) {
140     params = new Parameter[prmList.size() + 3];
141     params[2] = getMixChannelDestParameter();
142     for(int i = 0; i < prmList.size(); i++) params[i + 3] = prmList.get(i);
143     } else {
144     params = new Parameter[prmList.size() + 2];
145     for(int i = 0; i < prmList.size(); i++) params[i + 2] = prmList.get(i);
146     }
147    
148     params[0] = getNameParameter();
149     params[1] = getMixChannelParameter();
150    
151     return params;
152     }
153    
154     /**
155 iliev 596 * Determines whether this audio output channel has additional parameters.
156     * @return <code>true</code> if this audio output channel has additional parameters,
157     * <code>false</code> otherwise.
158     */
159     public boolean
160     hasAdditionalParameters() { return prmList.size() > 0; }
161    
162     /**
163     * Returns the name of this audio output chanel.
164     * @return The name of this audio output chanel.
165     */
166     public String
167     toString() { return getName(); }
168     }

  ViewVC Help
Powered by ViewVC