Mercurial > hg > cmdp
view src/uk/ac/qmul/eecs/depic/daw/Sound.java @ 4:473da40f3d39 tip
added html formatting to Daw/package-info.java
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Thu, 25 Feb 2016 17:50:09 +0000 |
parents | 629262395647 |
children |
line wrap: on
line source
/* Cross-Modal DAW Prototype - Prototype of a simple Cross-Modal Digital Audio Workstation. Copyright (C) 2015 Queen Mary University of London (http://depic.eecs.qmul.ac.uk/) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package uk.ac.qmul.eecs.depic.daw; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; /** * * a sound played by the Sonification * */ public class Sound { private Enum<?> type; private float pan; private float pitch; private float gain; private Object soundSource; private PropertyChangeSupport changeSupport; public Sound(Enum<?> type) { this.type= type; gain = 1.0f; pan = 0.0f; pitch = 440.0f; changeSupport = new PropertyChangeSupport(this); } public void addPropertyChangeListener(PropertyChangeListener listener) { changeSupport.addPropertyChangeListener(listener); } public void removePropertyChangeListener(PropertyChangeListener listener) { changeSupport.removePropertyChangeListener(listener); } public Enum<?> getType(){ return type; } public float getPitch() { return pitch; } public Sound setPitch(float pitch) { float oldPitch = this.pitch; this.pitch = pitch; changeSupport.firePropertyChange("pitch", oldPitch, pitch); return this; } public float getGain() { return gain; } public Sound setGain(float gain) { float oldGain = this.gain; this.gain = gain; changeSupport.firePropertyChange("gain", oldGain, gain); return this; } public Sound setPan(float pan){ float oldPan = this.pan; this.pan = pan; changeSupport.firePropertyChange("pan", oldPan, pan); return this; } public float getPan(){ return pan; } public Object getSource(){ return soundSource; } @Override public String toString(){ return "Sound type:"+getType(); } }