1 /*
2  * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package com.sun.media.sound;
27 
28 import java.util.ArrayList;
29 import java.util.List;
30 
31 /**
32  * This class is used to define how to synthesize audio in universal maner
33  * for both SF2 and DLS instruments.
34  *
35  * @author Karl Helgason
36  */
37 public final class ModelPerformer {
38 
39     private final List<ModelOscillator> oscillators = new ArrayList<>();
40     private List<ModelConnectionBlock> connectionBlocks = new ArrayList<>();
41 
42     private int keyFrom = 0;
43     private int keyTo = 127;
44     private int velFrom = 0;
45     private int velTo = 127;
46     private int exclusiveClass = 0;
47     private boolean releaseTrigger = false;
48     private boolean selfNonExclusive = false;
49     private Object userObject = null;
50     private boolean addDefaultConnections = true;
51     private String name = null;
52 
getName()53     public String getName() {
54         return name;
55     }
56 
setName(String name)57     public void setName(String name) {
58         this.name = name;
59     }
60 
getConnectionBlocks()61     public List<ModelConnectionBlock> getConnectionBlocks() {
62         return connectionBlocks;
63     }
64 
setConnectionBlocks(List<ModelConnectionBlock> connectionBlocks)65     public void setConnectionBlocks(List<ModelConnectionBlock> connectionBlocks) {
66         this.connectionBlocks = connectionBlocks;
67     }
68 
getOscillators()69     public List<ModelOscillator> getOscillators() {
70         return oscillators;
71     }
72 
getExclusiveClass()73     public int getExclusiveClass() {
74         return exclusiveClass;
75     }
76 
setExclusiveClass(int exclusiveClass)77     public void setExclusiveClass(int exclusiveClass) {
78         this.exclusiveClass = exclusiveClass;
79     }
80 
isSelfNonExclusive()81     public boolean isSelfNonExclusive() {
82         return selfNonExclusive;
83     }
84 
setSelfNonExclusive(boolean selfNonExclusive)85     public void setSelfNonExclusive(boolean selfNonExclusive) {
86         this.selfNonExclusive = selfNonExclusive;
87     }
88 
getKeyFrom()89     public int getKeyFrom() {
90         return keyFrom;
91     }
92 
setKeyFrom(int keyFrom)93     public void setKeyFrom(int keyFrom) {
94         this.keyFrom = keyFrom;
95     }
96 
getKeyTo()97     public int getKeyTo() {
98         return keyTo;
99     }
100 
setKeyTo(int keyTo)101     public void setKeyTo(int keyTo) {
102         this.keyTo = keyTo;
103     }
104 
getVelFrom()105     public int getVelFrom() {
106         return velFrom;
107     }
108 
setVelFrom(int velFrom)109     public void setVelFrom(int velFrom) {
110         this.velFrom = velFrom;
111     }
112 
getVelTo()113     public int getVelTo() {
114         return velTo;
115     }
116 
setVelTo(int velTo)117     public void setVelTo(int velTo) {
118         this.velTo = velTo;
119     }
120 
isReleaseTriggered()121     public boolean isReleaseTriggered() {
122         return releaseTrigger;
123     }
124 
setReleaseTriggered(boolean value)125     public void setReleaseTriggered(boolean value) {
126         this.releaseTrigger = value;
127     }
128 
getUserObject()129     public Object getUserObject() {
130         return userObject;
131     }
132 
setUserObject(Object object)133     public void setUserObject(Object object) {
134         userObject = object;
135     }
136 
isDefaultConnectionsEnabled()137     public boolean isDefaultConnectionsEnabled() {
138         return addDefaultConnections;
139     }
140 
setDefaultConnectionsEnabled(boolean addDefaultConnections)141     public void setDefaultConnectionsEnabled(boolean addDefaultConnections) {
142         this.addDefaultConnections = addDefaultConnections;
143     }
144 }
145