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.util.EventObject;
|
f@0
|
22
|
f@1
|
23 /**
|
f@1
|
24 *
|
f@1
|
25 * An event observed by SoundWaveListeners
|
f@1
|
26 *
|
f@1
|
27 */
|
f@0
|
28 public class SoundWaveEvent extends EventObject {
|
f@0
|
29 private static final long serialVersionUID = 1L;
|
f@0
|
30 private Object args;
|
f@0
|
31 private String type;
|
f@0
|
32
|
f@0
|
33 /**
|
f@0
|
34 * Creates a new Sound event with no argument
|
f@0
|
35 * @param soundWave
|
f@0
|
36 * @param type
|
f@0
|
37 */
|
f@0
|
38 public SoundWaveEvent(SoundWave soundWave, String type){
|
f@0
|
39 super(soundWave);
|
f@0
|
40 this.type = type;
|
f@0
|
41 }
|
f@0
|
42
|
f@0
|
43 public SoundWaveEvent(SoundWave soundWave, String type, Object args){
|
f@0
|
44 super(soundWave);
|
f@0
|
45 this.type = type;
|
f@0
|
46 setArgs(args);
|
f@0
|
47 }
|
f@0
|
48
|
f@0
|
49 /**
|
f@0
|
50 * Returns a reference to the sound wave this event originated from
|
f@0
|
51 *
|
f@0
|
52 * @return the sound wave this event originated from
|
f@0
|
53 */
|
f@0
|
54 @Override
|
f@0
|
55 public SoundWave getSource(){
|
f@0
|
56 return (SoundWave)super.getSource();
|
f@0
|
57 }
|
f@0
|
58
|
f@0
|
59 public String getType(){
|
f@0
|
60 return type;
|
f@0
|
61 }
|
f@0
|
62
|
f@0
|
63 /**
|
f@0
|
64 * Returns the arguments of this event.
|
f@0
|
65 *
|
f@0
|
66 * Different types of event require different type of arguments. See the static event
|
f@0
|
67 * types to know which argument they come with.
|
f@0
|
68 *
|
f@0
|
69 * @return the argument object or {@code null} if this event was constructed with
|
f@0
|
70 * no arguments.
|
f@0
|
71 */
|
f@0
|
72 public Object getArgs() {
|
f@0
|
73 return args;
|
f@0
|
74 }
|
f@0
|
75
|
f@0
|
76 public void setArgs(Object args) {
|
f@0
|
77 this.args = args;
|
f@0
|
78 }
|
f@0
|
79
|
f@0
|
80 /**
|
f@0
|
81 * Event generated when an audio file is open and a new sound wave is created.
|
f@0
|
82 */
|
f@0
|
83 public static final String OPEN = "OPEN";
|
f@0
|
84 /**
|
f@0
|
85 * /**
|
f@0
|
86 * Event generated when the sound wave is closed and all the related resources
|
f@0
|
87 * (sound file descriptors etc.) disposed.
|
f@0
|
88 */
|
f@0
|
89 public static final String CLOSE = "CLOSE";
|
f@0
|
90 /**
|
f@0
|
91 * Event generated when the sound wave selection changes.
|
f@0
|
92 *
|
f@0
|
93 * The event argument is a {@code Selection} object with the new selection.
|
f@0
|
94 */
|
f@0
|
95 public static final String SELECTION_CHANGED = "SELECTION_CHANGED";
|
f@0
|
96 /**
|
f@0
|
97 * Event generated when the sound wave's cursor position changes as a
|
f@0
|
98 * consequence of scrubbing through the sound wave.
|
f@0
|
99 *
|
f@0
|
100 * The argument is an open {@code Selection}, normalized to {@code SoundWave}'s current scale factor,
|
f@0
|
101 * whose start value is the new position.
|
f@0
|
102 *
|
f@0
|
103 * @see Selection#convertFactor(Selection, int)
|
f@0
|
104 */
|
f@0
|
105 public static final String POSITION_CHANGED = "POSITION_CHANGED";
|
f@0
|
106 /**
|
f@0
|
107 * Event generated when the sound wave playback is started.
|
f@0
|
108 */
|
f@0
|
109 public static final String START = "START";
|
f@0
|
110 /**
|
f@0
|
111 * Event generated when the sound wave playback is stopped.
|
f@0
|
112 */
|
f@0
|
113 public static final String STOP = "STOP";
|
f@0
|
114 /**
|
f@0
|
115 * Event generated when the sound wave playback is paused.
|
f@0
|
116 */
|
f@0
|
117 public static final String PAUSE = "PAUSE";
|
f@0
|
118 /**
|
f@0
|
119 * Event generated when an automation is changed.
|
f@0
|
120 *
|
f@0
|
121 * The argument of this event is the new {@code Automation} object which has been set as current
|
f@0
|
122 * for the sound wave. If the automation was of String {@code NONE}, then the argument will be {@code null}
|
f@0
|
123 */
|
f@0
|
124 public static final String AUTOMATION_CHANGED = "AUTOMATION_CHANGED";
|
f@0
|
125
|
f@0
|
126 public static final String CUT = "CUT";
|
f@0
|
127
|
f@0
|
128 public static final String COPY = "COPY";
|
f@0
|
129
|
f@0
|
130 public static final String PASTE = "PASTE";
|
f@0
|
131
|
f@0
|
132 public static final String INSERT = "INSERT";
|
f@0
|
133
|
f@0
|
134 public static final String PEAK_METER = "VIEW_CHANGED";
|
f@0
|
135
|
f@0
|
136 /**
|
f@0
|
137 * argument is the scanning poistion
|
f@0
|
138 */
|
f@0
|
139 public static final String SCAN = "SCAN";
|
f@0
|
140
|
f@0
|
141 /**
|
f@0
|
142 * Event generated when the current zoom factor of the {@code SoundWave} is changed.
|
f@0
|
143 *
|
f@0
|
144 *
|
f@0
|
145 */
|
f@0
|
146 public static final String SCALE_FACTOR_CHANGED = "SCALE_FACTOR_CHANGED";
|
f@0
|
147
|
f@0
|
148
|
f@0
|
149 }
|