Changeset 13819 in josm
- Timestamp:
- 2018-05-22T22:38:21+02:00 (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r13794 r13819 20 20 <property name="test.dir" location="${base.dir}/test"/> 21 21 <property name="src.dir" location="${base.dir}/src"/> 22 <condition property="noJavaFX" value="${env.JOSM_NOJAVAFX}" else="0"> 22 <condition property="noJavaFX"> 23 <or> 23 24 <isset property="env.JOSM_NOJAVAFX"/> 25 <not> 26 <available classname="javafx.scene.media.Media"/> 27 </not> 28 </or> 24 29 </condition> 25 30 <property name="build.dir" location="${base.dir}/build"/> … … 370 375 <compilerarg value="-Xep:JdkObsolete:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/> 371 376 <compilerarg line="-Xmaxwarns 1000"/> 372 <exclude name="org/openstreetmap/josm/io/audio/ JavaFxMediaPlayer.java" if:set="noJavaFX"/>377 <exclude name="org/openstreetmap/josm/io/audio/fx/*.java" if:set="noJavaFX"/> 373 378 </javac> 374 379 … … 405 410 <arg value="--add-exports" if:set="isJava9" /> 406 411 <arg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" /> 412 <excludepackage name="org/openstreetmap/josm/io/audio/fx" if:set="noJavaFX" /> 407 413 </javadoc> 408 414 </target> -
trunk/src/org/openstreetmap/josm/io/audio/AudioListener.java
r12328 r13819 8 8 * @since 12328 9 9 */ 10 interface AudioListener { 10 public interface AudioListener { 11 11 12 12 /** -
trunk/src/org/openstreetmap/josm/io/audio/AudioPlayer.java
r13418 r13819 20 20 private static volatile AudioPlayer audioPlayer; 21 21 22 enum State { INITIALIZING, NOTPLAYING, PLAYING, PAUSED, INTERRUPTED } 23 24 enum Command { PLAY, PAUSE } 25 26 enum Result { WAITING, OK, FAILED } 22 /** 23 * Audio player state. 24 */ 25 public enum State { 26 /** Initializing */ 27 INITIALIZING, 28 /** Not playing */ 29 NOTPLAYING, 30 /** Playing */ 31 PLAYING, 32 /** Paused */ 33 PAUSED, 34 /** Interrupted */ 35 INTERRUPTED 36 } 37 38 /** 39 * Audio player command. 40 */ 41 public enum Command { /** Audio play */ PLAY, /** Audio pause */ PAUSE } 42 43 /** 44 * Audio player result. 45 */ 46 public enum Result { /** In progress */ WAITING, /** Success */ OK, /** Failure */ FAILED } 27 47 28 48 private State state; … … 33 53 * Passes information from the control thread to the playing thread 34 54 */ 35 class Execute { 55 public class Execute { 36 56 private Command command; 37 57 private Result result; … … 84 104 } 85 105 86 protected double offset() { 106 /** 107 * Returns the offset. 108 * @return the offset, in seconds 109 */ 110 public double offset() { 87 111 return offset; 88 112 } 89 113 90 protected double speed() { 114 /** 115 * Returns the speed. 116 * @return the speed (ratio) 117 */ 118 public double speed() { 91 119 return speed; 92 120 } 93 121 94 protected URL url() { 122 /** 123 * Returns the URL. 124 * @return The resource to play, which must be a WAV file or stream 125 */ 126 public URL url() { 95 127 return url; 96 128 } 97 129 98 protected Command command() { 130 /** 131 * Returns the command. 132 * @return the command 133 */ 134 public Command command() { 99 135 return command; 100 136 } … … 237 273 double calibration = Config.getPref().getDouble("audio.calibration", 1.0 /* default, ratio */); 238 274 try { 239 soundPlayer = (SoundPlayer) Class.forName("org.openstreetmap.josm.io.audio.JavaFxMediaPlayer") 275 soundPlayer = (SoundPlayer) Class.forName("org.openstreetmap.josm.io.audio.fx.JavaFxMediaPlayer") 240 276 .getDeclaredConstructor().newInstance(); 241 277 } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) { -
trunk/src/org/openstreetmap/josm/io/audio/SoundPlayer.java
r12328 r13819 12 12 * @since 12328 13 13 */ 14 interface SoundPlayer { 14 public interface SoundPlayer { 15 15 16 16 /** -
trunk/src/org/openstreetmap/josm/io/audio/fx/JavaFxMediaPlayer.java
r13818 r13819 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.io.audio; 2 package org.openstreetmap.josm.io.audio.fx; 3 3 4 4 import java.io.File; … … 9 9 import java.util.concurrent.CountDownLatch; 10 10 11 import org.openstreetmap.josm.io.audio.AudioException; 12 import org.openstreetmap.josm.io.audio.AudioListener; 11 13 import org.openstreetmap.josm.io.audio.AudioPlayer.Execute; 12 14 import org.openstreetmap.josm.io.audio.AudioPlayer.State; 15 import org.openstreetmap.josm.io.audio.SoundPlayer; 13 16 import org.openstreetmap.josm.tools.JosmRuntimeException; 14 17 import org.openstreetmap.josm.tools.ListenerList; … … 32 35 * @since 12328 33 36 */ 34 class JavaFxMediaPlayer implements SoundPlayer { 37 public class JavaFxMediaPlayer implements SoundPlayer { 35 38 36 39 private final ListenerList<AudioListener> listeners = ListenerList.create();
Note:
See TracChangeset
for help on using the changeset viewer.