829N/A/*
6321N/A * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
829N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
829N/A *
829N/A * This code is free software; you can redistribute it and/or modify it
829N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
829N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
829N/A *
829N/A * This code is distributed in the hope that it will be useful, but WITHOUT
829N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
829N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
829N/A * version 2 for more details (a copy is included in the LICENSE file that
829N/A * accompanied this code).
829N/A *
829N/A * You should have received a copy of the GNU General Public License version
829N/A * 2 along with this work; if not, write to the Free Software Foundation,
829N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
829N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
829N/A */
829N/Apackage com.sun.media.sound;
829N/A
829N/A/**
829N/A * This class stores the identity of source and destinations in connection
829N/A * blocks, see ModelConnectionBlock.
829N/A *
829N/A * @author Karl Helgason
829N/A */
6321N/Apublic final class ModelIdentifier {
829N/A
829N/A /*
829N/A * Object Variable
829N/A * ------ --------
829N/A *
829N/A * // INPUT parameters
829N/A * noteon keynumber 7 bit midi value
829N/A * velocity 7 bit midi vale
829N/A * on 1 or 0
829N/A *
829N/A * midi pitch 14 bit midi value
829N/A * channel_pressure 7 bit midi value
829N/A * poly_pressure 7 bit midi value
829N/A *
829N/A * midi_cc 0 (midi control #0 7 bit midi value
829N/A * 1 (midi control #1 7 bit midi value
829N/A * ...
829N/A * 127 (midi control #127 7 bit midi value
829N/A *
829N/A * midi_rpn 0 (midi rpn control #0) 14 bit midi value
829N/A * 1 (midi rpn control #1) 14 bit midi value
829N/A * ....
829N/A *
829N/A * // DAHDSR envelope generator
829N/A * eg (null)
829N/A * delay timecent
829N/A * attack timecent
829N/A * hold timecent
829N/A * decay timecent
829N/A * sustain 0.1 %
829N/A * release timecent
829N/A *
829N/A * // Low frequency oscillirator (sine wave)
829N/A * lfo (null)
829N/A * delay timcent
829N/A * freq cent
829N/A *
829N/A * // Resonance LowPass Filter 6dB slope
829N/A * filter (null) (output/input)
829N/A * freq cent
829N/A * q cB
829N/A *
829N/A * // The oscillator with preloaded wavetable data
829N/A * osc (null)
829N/A * pitch cent
829N/A *
829N/A * // Output mixer pins
829N/A * mixer gain cB
829N/A * pan 0.1 %
829N/A * reverb 0.1 %
829N/A * chorus 0.1 %
829N/A *
829N/A */
829N/A private String object = null;
829N/A private String variable = null;
829N/A private int instance = 0;
829N/A
829N/A public ModelIdentifier(String object) {
829N/A this.object = object;
829N/A }
829N/A
829N/A public ModelIdentifier(String object, int instance) {
829N/A this.object = object;
829N/A this.instance = instance;
829N/A }
829N/A
829N/A public ModelIdentifier(String object, String variable) {
829N/A this.object = object;
829N/A this.variable = variable;
829N/A
829N/A }
829N/A
829N/A public ModelIdentifier(String object, String variable, int instance) {
829N/A this.object = object;
829N/A this.variable = variable;
829N/A this.instance = instance;
829N/A
829N/A }
829N/A
829N/A public int getInstance() {
829N/A return instance;
829N/A }
829N/A
829N/A public void setInstance(int instance) {
829N/A this.instance = instance;
829N/A }
829N/A
829N/A public String getObject() {
829N/A return object;
829N/A }
829N/A
829N/A public void setObject(String object) {
829N/A this.object = object;
829N/A }
829N/A
829N/A public String getVariable() {
829N/A return variable;
829N/A }
829N/A
829N/A public void setVariable(String variable) {
829N/A this.variable = variable;
829N/A }
829N/A
829N/A public int hashCode() {
829N/A int hashcode = instance;
829N/A if(object != null) hashcode |= object.hashCode();
829N/A if(variable != null) hashcode |= variable.hashCode();
829N/A return hashcode;
829N/A }
829N/A
829N/A public boolean equals(Object obj) {
829N/A if (!(obj instanceof ModelIdentifier))
829N/A return false;
829N/A
829N/A ModelIdentifier mobj = (ModelIdentifier)obj;
829N/A if ((object == null) != (mobj.object == null))
829N/A return false;
829N/A if ((variable == null) != (mobj.variable == null))
829N/A return false;
829N/A if (mobj.getInstance() != getInstance())
829N/A return false;
829N/A if (!(object == null || object.equals(mobj.object)))
829N/A return false;
829N/A if (!(variable == null || variable.equals(mobj.variable)))
829N/A return false;
829N/A return true;
829N/A }
829N/A
829N/A public String toString() {
829N/A if (variable == null) {
829N/A return object + "[" + instance + "]";
829N/A } else {
829N/A return object + "[" + instance + "]" + "." + variable;
829N/A }
829N/A }
829N/A}