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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2190 - (hide annotations) (download)
Fri Jun 24 20:18:03 2011 UTC (12 years, 10 months ago) by iliev
File size: 3224 byte(s)
* Added support for send effects

1 iliev 2190 /*
2     * jlscp - a java LinuxSampler control protocol API
3     *
4     * Copyright (C) 2011 Grigor Iliev <grigor@grigoriliev.com>
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     * @author Grigor Iliev
30     */
31     public class EffectInstance extends Effect {
32     private int instanceId = -1;
33     private int parameterCount = -1;
34    
35     private final Vector<EffectParameter> prmList = new Vector<EffectParameter>();
36    
37     /** Creates a new instance of <code>EffectInstance</code> */
38     public
39     EffectInstance() { }
40    
41     /**
42     * Creates a new instance of <code>EffectInstance</code> and parses the information
43     * about a specific effect instance described by <code>resultSet</code>.
44     * @param resultSet An array with information categories about an effect entity.
45     * @throws LscpException If the parse fail.
46     */
47     public
48     EffectInstance(String[] resultSet) throws LscpException {
49     for(String s : resultSet)
50     if(!parse(s)) Client.getLogger().info(LscpI18n.getLogMsg("unknownLine", s));
51     }
52    
53     /**
54     * Gets the numerical ID of this effect instance.
55     * @return The numerical ID of this effect instance
56     * or -1 if the effect instance ID is not set.
57     */
58     public int
59     getInstanceId() { return instanceId; }
60    
61     /**
62     * Sets the numerical ID of this effect instance.
63     * @param id The new effect instance ID.
64     */
65     public void
66     setInstanceId(int id) { instanceId = id; }
67    
68     /**
69     * Gets the number of parameters (input controls) the effect instance provides,
70     * to allow controlling the effect parameters in realtime.
71     * @return The number of parameters the effect instance provides.
72     */
73     public int
74     getParameterCount() { return parameterCount; }
75    
76     /**
77     * Adds effect parameter.
78     * @param prm The effect parameter to be added.
79     */
80     public void
81     addParameter(EffectParameter prm) { prmList.add(prm); }
82    
83     /**
84     * Gets all parameters available for this effect.
85     * @return <code>FloatParameter</code> array with all parameters available for this effect.
86     */
87     public EffectParameter[]
88     getParameters() { return prmList.toArray(new EffectParameter[prmList.size()]); }
89    
90     /**
91     * Parses a line of text.
92     * @param s The string to be parsed.
93     * @return <code>true</code> if the line has been processed, <code>false</code> otherwise.
94     * @throws LscpException If some error occurs.
95     */
96     public boolean
97     parse(String s) throws LscpException {
98     if(super.parse(s)) return true;
99    
100     if(s.startsWith("INPUT_CONTROLS: ")) {
101     s = s.substring("INPUT_CONTROLS: ".length());
102     parameterCount = Parser.parseInt(s);
103     } else return false;
104    
105     return true;
106     }
107     }

  ViewVC Help
Powered by ViewVC