Mercurial > hg > cmdp
view src/uk/ac/qmul/eecs/depic/daw/AutomationValue.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 | 3074a84ef81e |
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 uk.ac.qmul.eecs.depic.patterns.Sequence; /** * * This class represent a value in an Automation. An automation is a set of line envelopes and * a value represent one end of an automation line. * * Therefore an automation value normally points to where the automation changes its slope. * * Since an automation is a 2D graph * * */ public abstract class AutomationValue implements Comparable<AutomationValue>, Sequence.Value { private float position; /* ranges from 0.0 to 1.0 */ private float value; public AutomationValue(float position, float value){ this.position = position; this.value = value; } public void setTimePosition(float position){ this.position = position; } /** * Returns the position of this automation value in milliseconds * * The position represents where this value is on time * * @return the position of this automation value in milliseconds */ public float getTimePosition() { return position; } public float getValue() { return value; } public void setValue(float value) { this.value = value; } public void setLocation(float position, float value){ setTimePosition(position); setValue(value); } /** * Returns the enclosing Automation. * * @return the enclosing Automation. */ public abstract Automation getAutomation(); @Override public int compareTo(AutomationValue v) { if(v == null) return 1; if(position < v.getTimePosition()) return -1; else if(position > v.getTimePosition()) return 1; else return 0; } @Override public String toString(){ return "Automation Value. position:"+position+" value:"+value; } }