view src/uk/ac/qmul/eecs/depic/daw/SoundWaveEvent.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.util.EventObject;

/**
 * 
 * An event observed by SoundWaveListeners 
 *
 */
public class SoundWaveEvent extends EventObject {
	private static final long serialVersionUID = 1L;
	private Object args;
	private String type;
	
	/**
	 * Creates a new Sound event with no argument 
	 * @param soundWave
	 * @param type
	 */
	public SoundWaveEvent(SoundWave soundWave, String type){
		super(soundWave);
		this.type = type;
	}
	
	public SoundWaveEvent(SoundWave soundWave, String type, Object args){
		super(soundWave);
		this.type = type;
		setArgs(args);
	}
	
	/**
	 * Returns a reference to the sound wave this event originated from
	 * 
	 *  @return the sound wave this event originated from
	 */
	@Override
	public SoundWave getSource(){
		return (SoundWave)super.getSource();
	}
	
	public String getType(){
		return type;
	}

	/**
	 * Returns the arguments of this event. 
	 * 
	 * Different types of event require different type of arguments. See the static event 
	 * types to know which argument they come with. 
	 * 
	 * @return the argument object or {@code null} if this event was constructed with 
	 * no arguments. 
	 */
	public Object getArgs() {
		return args;
	}

	public void setArgs(Object args) {
		this.args = args;
	}
	
	/**
	 * Event generated when an audio file is open and a new sound wave is created.
	 */
	public static final String OPEN = "OPEN";
	/**
	 * /**
	 * Event generated when the sound wave is closed and all the related resources
	 * (sound file descriptors etc.) disposed.
	 */
	public static final String CLOSE = "CLOSE";
	/**
	 * Event generated when the sound wave selection changes.
	 * 
	 * The event argument is a {@code Selection} object with the new selection. 
	 */
	public static final String SELECTION_CHANGED = "SELECTION_CHANGED";
	/**
	 * Event generated when the sound wave's cursor position changes as a 
	 * consequence of scrubbing through the sound wave. 
	 * 
	 * The argument is an open {@code Selection}, normalized to {@code SoundWave}'s current scale factor, 
	 * whose start value is the new position.  
	 * 
	 *  @see Selection#convertFactor(Selection, int)
	 */
	public static final String POSITION_CHANGED = "POSITION_CHANGED";
	/**
	 * Event generated when the sound wave playback is started.
	 */
	public static final String START = "START";
	/**
	 * Event generated when the sound wave playback is stopped.
	 */
	public static final String STOP = "STOP";
	/**
	 * Event generated when the sound wave playback is paused.
	 */
	public static final String PAUSE = "PAUSE";
	/**
	 * Event generated when an automation is changed. 
	 * 
	 * The argument of this event is the new {@code Automation} object which has been set as current 
	 * for the sound wave. If the automation was of String {@code NONE}, then the argument will be {@code null}
	 */
	public static final String AUTOMATION_CHANGED = "AUTOMATION_CHANGED";
	
	public static final String CUT = "CUT";
	
	public static final String COPY = "COPY";

	public static final String PASTE = "PASTE";
	
	public static final String INSERT = "INSERT";
	
	public static final String PEAK_METER = "VIEW_CHANGED";
	
	/**
	 * argument is the scanning poistion 
	 */
	public static final String SCAN = "SCAN";
	
	/**
	 * Event generated when the current zoom factor of the {@code SoundWave} is changed.
	 * 
	 * 
	 */
	public static final String SCALE_FACTOR_CHANGED = "SCALE_FACTOR_CHANGED";
		

}