view src/uk/ac/qmul/eecs/depic/daw/SoundWave.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.io.File;
import java.util.List;

import javax.swing.JComponent;

/**
 * 
 * A sound wave, the usual artifact used to represent audio visually  
 *
 */
public interface SoundWave extends Wave {

	public static final String FILE_ERROR_PROPERTY = "FILE_ERROR_PROPERTY";
	public static final int FILE_LOAD_TOTAL_PROGRESS = 100;
	public static final int MIN_SUPPORTED_CHUNK_SIZE = 1;
	public static final int STOP_SCANNING = -100;

	

	/**
	 * Adds a {@code SoundWaveListener} to this {@code SoundWave}. 
	 * 
	 * The listener will be notified when a {@SoundWaveEvent} happens.
	 * Adding twice the same object (as per the {@code equals()}) as well as 
	 * adding {@code null} will have no effect.
	 * 
	 * @param l the listener to add to this {@code SoundWave}
	 * 
	 */
	public void addSoundWaveListener(SoundWaveListener l);

	/**
	 * Removes {@code l} from the listeners if it has been previously added.
	 *  
	 * @param l the listener to remove
	 */
	public void removeSoundWaveListener(SoundWaveListener l);

	
	/**
	 * 
	 * 
	 * @param stream a stream of audio data. The stream is wrapped with a {@code BufferedInputStream} before
	 * being used. 
	 * @param propertyChangelistener
	 */
	public void loadAudioData(File audioFile,PropertyChangeListener propertyChangelistener);

	public void stopLoading(boolean mayInterruptIfRunning);
	
	/**
	 * Disposes the current audio data. 
	 * 
	 * Registered {@code SoundWaveListener} objects are notified with a 
	 * {@code CLOSE} event. A call to this method has no effect if no audio data is loaded.
	 * 
	 */
	public void close();
	
	public DbWave getDbWave();
	
	public void generatePeakMeter(boolean generate);
	
	public TransportControl getTransportControl();
	
	public int getCurrentChunkPosition();
	
	public void scan(int position);
	
	public JComponent [] getPreferencesPanels();
	
	/**
	 * Sets a new selection for this sound wave.
	 * 
	 * Registered {@code SoundWaveListener} objects are notified with a 
	 * {@code SELECTION_CHANGED} event.
	 * 
	 * @param selection the new selection. Using {@code null} or {@code Selection.VOID_SELECTION} will remove the selection  
	 */
	public void setSelection(Selection selection);
	
	/**
	 * Sets a new position for this sound wave.
	 * 
	 * Registered {@code SoundWaveListener} objects are notified with a 
	 * {@code POSITION_CHANGED} event. The event argument is an open {@code Selection} 
	 * whose start is the new position and scale factor is 1. 
	 * 
	 * @param position the new position 
	 */
	public void setPosition(int position);

	
	/**
	 * 
	 * @param chuckPosition
	 * @param scaleFactor
	 * @return or {@code -1} if chunkPosition is greater than the chunk number to less than 0 
	 */
	public List<Integer> getFramesPositionAt(int chuckPosition);
	
	
	public SoundWaveEditor getEditor();
	
	/**
	 * The current Automation 
	 * 
	 * @return the current {@code Automation} object or {@code null} if no sample is loaded and 
	 */
	
	
	public ParametersControl getParametersControl();
	
	
	public interface TransportControl { 
		
		/**
		 * Plays the sound sample.
		 * 
		 *  Registered {@code SoundWaveListener} objects are notified with a 
		 * {@code START} event. 
		 * 
		 *  
		 */
		public void play();
		
		public void setLoop(boolean on);
		
		public boolean isLoopOn();
		
		public void stop();
		
		public void pause();
		
		public void rew(); 
		
		public void fwd();
		
		public float getPlayPosition();
	}

}