annotate 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
rev   line source
f@0 1 /*
f@0 2 Cross-Modal DAW Prototype - Prototype of a simple Cross-Modal Digital Audio Workstation.
f@0 3
f@0 4 Copyright (C) 2015 Queen Mary University of London (http://depic.eecs.qmul.ac.uk/)
f@0 5
f@0 6 This program is free software: you can redistribute it and/or modify
f@0 7 it under the terms of the GNU General Public License as published by
f@0 8 the Free Software Foundation, either version 3 of the License, or
f@0 9 (at your option) any later version.
f@0 10
f@0 11 This program is distributed in the hope that it will be useful,
f@0 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
f@0 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f@0 14 GNU General Public License for more details.
f@0 15
f@0 16 You should have received a copy of the GNU General Public License
f@0 17 along with this program. If not, see <http://www.gnu.org/licenses/>.
f@0 18 */
f@0 19 package uk.ac.qmul.eecs.depic.daw;
f@0 20
f@0 21 import java.beans.PropertyChangeListener;
f@0 22 import java.beans.PropertyChangeSupport;
f@0 23
f@1 24 /**
f@1 25 *
f@1 26 * a sound played by the Sonification
f@1 27 *
f@1 28 */
f@0 29 public class Sound {
f@0 30 private Enum<?> type;
f@0 31 private float pan;
f@0 32 private float pitch;
f@0 33 private float gain;
f@0 34 private Object soundSource;
f@0 35 private PropertyChangeSupport changeSupport;
f@0 36
f@0 37 public Sound(Enum<?> type) {
f@0 38 this.type= type;
f@0 39 gain = 1.0f;
f@0 40 pan = 0.0f;
f@0 41 pitch = 440.0f;
f@0 42 changeSupport = new PropertyChangeSupport(this);
f@0 43 }
f@0 44
f@0 45 public void addPropertyChangeListener(PropertyChangeListener listener) {
f@0 46 changeSupport.addPropertyChangeListener(listener);
f@0 47 }
f@0 48
f@0 49 public void removePropertyChangeListener(PropertyChangeListener listener) {
f@0 50 changeSupport.removePropertyChangeListener(listener);
f@0 51 }
f@0 52
f@0 53 public Enum<?> getType(){
f@0 54 return type;
f@0 55 }
f@0 56
f@0 57 public float getPitch() {
f@0 58 return pitch;
f@0 59 }
f@0 60
f@0 61 public Sound setPitch(float pitch) {
f@0 62 float oldPitch = this.pitch;
f@0 63 this.pitch = pitch;
f@0 64 changeSupport.firePropertyChange("pitch", oldPitch, pitch);
f@0 65 return this;
f@0 66 }
f@0 67
f@0 68 public float getGain() {
f@0 69 return gain;
f@0 70 }
f@0 71
f@0 72 public Sound setGain(float gain) {
f@0 73 float oldGain = this.gain;
f@0 74 this.gain = gain;
f@0 75 changeSupport.firePropertyChange("gain", oldGain, gain);
f@0 76 return this;
f@0 77 }
f@0 78
f@0 79 public Sound setPan(float pan){
f@0 80 float oldPan = this.pan;
f@0 81 this.pan = pan;
f@0 82 changeSupport.firePropertyChange("pan", oldPan, pan);
f@0 83 return this;
f@0 84 }
f@0 85
f@0 86 public float getPan(){
f@0 87 return pan;
f@0 88 }
f@0 89
f@0 90 public Object getSource(){
f@0 91 return soundSource;
f@0 92 }
f@0 93
f@0 94 @Override
f@0 95 public String toString(){
f@0 96 return "Sound type:"+getType();
f@0 97 }
f@0 98 }