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.io.File;
|
f@0
|
23 import java.util.List;
|
f@0
|
24
|
f@0
|
25 import javax.swing.JComponent;
|
f@0
|
26
|
f@1
|
27 /**
|
f@1
|
28 *
|
f@1
|
29 * A sound wave, the usual artifact used to represent audio visually
|
f@1
|
30 *
|
f@1
|
31 */
|
f@0
|
32 public interface SoundWave extends Wave {
|
f@0
|
33
|
f@0
|
34 public static final String FILE_ERROR_PROPERTY = "FILE_ERROR_PROPERTY";
|
f@0
|
35 public static final int FILE_LOAD_TOTAL_PROGRESS = 100;
|
f@0
|
36 public static final int MIN_SUPPORTED_CHUNK_SIZE = 1;
|
f@0
|
37 public static final int STOP_SCANNING = -100;
|
f@0
|
38
|
f@0
|
39
|
f@0
|
40
|
f@0
|
41 /**
|
f@0
|
42 * Adds a {@code SoundWaveListener} to this {@code SoundWave}.
|
f@0
|
43 *
|
f@0
|
44 * The listener will be notified when a {@SoundWaveEvent} happens.
|
f@0
|
45 * Adding twice the same object (as per the {@code equals()}) as well as
|
f@0
|
46 * adding {@code null} will have no effect.
|
f@0
|
47 *
|
f@0
|
48 * @param l the listener to add to this {@code SoundWave}
|
f@0
|
49 *
|
f@0
|
50 */
|
f@0
|
51 public void addSoundWaveListener(SoundWaveListener l);
|
f@0
|
52
|
f@0
|
53 /**
|
f@0
|
54 * Removes {@code l} from the listeners if it has been previously added.
|
f@0
|
55 *
|
f@0
|
56 * @param l the listener to remove
|
f@0
|
57 */
|
f@0
|
58 public void removeSoundWaveListener(SoundWaveListener l);
|
f@0
|
59
|
f@0
|
60
|
f@0
|
61 /**
|
f@0
|
62 *
|
f@0
|
63 *
|
f@0
|
64 * @param stream a stream of audio data. The stream is wrapped with a {@code BufferedInputStream} before
|
f@0
|
65 * being used.
|
f@0
|
66 * @param propertyChangelistener
|
f@0
|
67 */
|
f@0
|
68 public void loadAudioData(File audioFile,PropertyChangeListener propertyChangelistener);
|
f@0
|
69
|
f@0
|
70 public void stopLoading(boolean mayInterruptIfRunning);
|
f@0
|
71
|
f@0
|
72 /**
|
f@0
|
73 * Disposes the current audio data.
|
f@0
|
74 *
|
f@0
|
75 * Registered {@code SoundWaveListener} objects are notified with a
|
f@0
|
76 * {@code CLOSE} event. A call to this method has no effect if no audio data is loaded.
|
f@0
|
77 *
|
f@0
|
78 */
|
f@0
|
79 public void close();
|
f@0
|
80
|
f@0
|
81 public DbWave getDbWave();
|
f@0
|
82
|
f@0
|
83 public void generatePeakMeter(boolean generate);
|
f@0
|
84
|
f@0
|
85 public TransportControl getTransportControl();
|
f@0
|
86
|
f@0
|
87 public int getCurrentChunkPosition();
|
f@0
|
88
|
f@0
|
89 public void scan(int position);
|
f@0
|
90
|
f@0
|
91 public JComponent [] getPreferencesPanels();
|
f@0
|
92
|
f@0
|
93 /**
|
f@0
|
94 * Sets a new selection for this sound wave.
|
f@0
|
95 *
|
f@0
|
96 * Registered {@code SoundWaveListener} objects are notified with a
|
f@0
|
97 * {@code SELECTION_CHANGED} event.
|
f@0
|
98 *
|
f@0
|
99 * @param selection the new selection. Using {@code null} or {@code Selection.VOID_SELECTION} will remove the selection
|
f@0
|
100 */
|
f@0
|
101 public void setSelection(Selection selection);
|
f@0
|
102
|
f@0
|
103 /**
|
f@0
|
104 * Sets a new position for this sound wave.
|
f@0
|
105 *
|
f@0
|
106 * Registered {@code SoundWaveListener} objects are notified with a
|
f@0
|
107 * {@code POSITION_CHANGED} event. The event argument is an open {@code Selection}
|
f@0
|
108 * whose start is the new position and scale factor is 1.
|
f@0
|
109 *
|
f@0
|
110 * @param position the new position
|
f@0
|
111 */
|
f@0
|
112 public void setPosition(int position);
|
f@0
|
113
|
f@0
|
114
|
f@0
|
115 /**
|
f@0
|
116 *
|
f@0
|
117 * @param chuckPosition
|
f@0
|
118 * @param scaleFactor
|
f@0
|
119 * @return or {@code -1} if chunkPosition is greater than the chunk number to less than 0
|
f@0
|
120 */
|
f@0
|
121 public List<Integer> getFramesPositionAt(int chuckPosition);
|
f@0
|
122
|
f@0
|
123
|
f@0
|
124 public SoundWaveEditor getEditor();
|
f@0
|
125
|
f@0
|
126 /**
|
f@0
|
127 * The current Automation
|
f@0
|
128 *
|
f@0
|
129 * @return the current {@code Automation} object or {@code null} if no sample is loaded and
|
f@0
|
130 */
|
f@0
|
131
|
f@0
|
132
|
f@0
|
133 public ParametersControl getParametersControl();
|
f@0
|
134
|
f@0
|
135
|
f@0
|
136 public interface TransportControl {
|
f@0
|
137
|
f@0
|
138 /**
|
f@0
|
139 * Plays the sound sample.
|
f@0
|
140 *
|
f@0
|
141 * Registered {@code SoundWaveListener} objects are notified with a
|
f@0
|
142 * {@code START} event.
|
f@0
|
143 *
|
f@0
|
144 *
|
f@0
|
145 */
|
f@0
|
146 public void play();
|
f@0
|
147
|
f@0
|
148 public void setLoop(boolean on);
|
f@0
|
149
|
f@0
|
150 public boolean isLoopOn();
|
f@0
|
151
|
f@0
|
152 public void stop();
|
f@0
|
153
|
f@0
|
154 public void pause();
|
f@0
|
155
|
f@0
|
156 public void rew();
|
f@0
|
157
|
f@0
|
158 public void fwd();
|
f@0
|
159
|
f@0
|
160 public float getPlayPosition();
|
f@0
|
161 }
|
f@0
|
162
|
f@0
|
163 } |