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 package com.sun.media.sound; 26 27 /** 28 * This class is used to identify sources in connection blocks, 29 * see ModelConnectionBlock. 30 * 31 * @author Karl Helgason 32 */ 33 public final class ModelSource { 34 35 public static final ModelIdentifier SOURCE_NONE = null; 36 public static final ModelIdentifier SOURCE_NOTEON_KEYNUMBER = 37 new ModelIdentifier("noteon", "keynumber"); // midi keynumber 38 public static final ModelIdentifier SOURCE_NOTEON_VELOCITY = 39 new ModelIdentifier("noteon", "velocity"); // midi velocity 40 public static final ModelIdentifier SOURCE_EG1 = 41 new ModelIdentifier("eg", null, 0); 42 public static final ModelIdentifier SOURCE_EG2 = 43 new ModelIdentifier("eg", null, 1); 44 public static final ModelIdentifier SOURCE_LFO1 = 45 new ModelIdentifier("lfo", null, 0); 46 public static final ModelIdentifier SOURCE_LFO2 = 47 new ModelIdentifier("lfo", null, 1); 48 public static final ModelIdentifier SOURCE_MIDI_PITCH = 49 new ModelIdentifier("midi", "pitch", 0); // (0..16383) 50 public static final ModelIdentifier SOURCE_MIDI_CHANNEL_PRESSURE = 51 new ModelIdentifier("midi", "channel_pressure", 0); // (0..127) 52 // public static final ModelIdentifier SOURCE_MIDI_MONO_PRESSURE = 53 // new ModelIdentifier("midi","mono_pressure",0); // (0..127) 54 public static final ModelIdentifier SOURCE_MIDI_POLY_PRESSURE = 55 new ModelIdentifier("midi", "poly_pressure", 0); // (0..127) 56 public static final ModelIdentifier SOURCE_MIDI_CC_0 = 57 new ModelIdentifier("midi_cc", "0", 0); // (0..127) 58 public static final ModelIdentifier SOURCE_MIDI_RPN_0 = 59 new ModelIdentifier("midi_rpn", "0", 0); // (0..16383) 60 private ModelIdentifier source = SOURCE_NONE; 61 private ModelTransform transform; 62 63 public ModelSource() { 64 this.transform = new ModelStandardTransform(); 65 } 66 67 public ModelSource(ModelIdentifier id) { 68 source = id; 69 this.transform = new ModelStandardTransform(); 70 } 71 72 public ModelSource(ModelIdentifier id, boolean direction) { 73 source = id; 74 this.transform = new ModelStandardTransform(direction); 75 } 76 77 public ModelSource(ModelIdentifier id, boolean direction, boolean polarity) { 78 source = id; 79 this.transform = new ModelStandardTransform(direction, polarity); 80 } 81 82 public ModelSource(ModelIdentifier id, boolean direction, boolean polarity, 83 int transform) { 84 source = id; 85 this.transform = 86 new ModelStandardTransform(direction, polarity, transform); 87 } 88 89 public ModelSource(ModelIdentifier id, ModelTransform transform) { 90 source = id; 91 this.transform = transform; 92 } 93 94 public ModelIdentifier getIdentifier() { 95 return source; 96 } 97 98 public void setIdentifier(ModelIdentifier source) { 99 this.source = source; 100 } 101 102 public ModelTransform getTransform() { 103 return transform; 104 } 105 106 public void setTransform(ModelTransform transform) { 107 this.transform = transform; 108 } 109 }