Changeset 14183 in josm
- Timestamp:
- 2018-08-27T13:17:01+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io/audio
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/audio/AudioPlayer.java
r14095 r14183 4 4 import java.io.IOException; 5 5 import java.net.URL; 6 import java.util.Objects; 6 7 7 8 import org.openstreetmap.josm.spi.preferences.Config; … … 47 48 48 49 private State state; 50 private static Class<? extends SoundPlayer> soundPlayerClass; 49 51 private SoundPlayer soundPlayer; 50 52 private URL playingUrl; … … 266 268 } 267 269 270 @SuppressWarnings("unchecked") 268 271 private AudioPlayer() { 269 272 state = State.INITIALIZING; … … 273 276 double calibration = Config.getPref().getDouble("audio.calibration", 1.0 /* default, ratio */); 274 277 try { 275 soundPlayer = (SoundPlayer) Class.forName("org.openstreetmap.josm.io.audio.fx.JavaFxMediaPlayer") 276 .getDeclaredConstructor().newInstance(); 278 if (soundPlayerClass == null) { 279 // To remove when switching to Java 11 280 soundPlayerClass = (Class<? extends SoundPlayer>) Class.forName( 281 "org.openstreetmap.josm.io.audio.fx.JavaFxMediaPlayer"); 282 } 283 soundPlayer = soundPlayerClass.getDeclaredConstructor().newInstance(); 277 284 } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) { 278 285 Logging.debug(e); … … 355 362 this.playingUrl = playingUrl; 356 363 } 364 365 /** 366 * Returns the custom sound player class, if any. 367 * @return the custom sound player class, or {@code null} 368 * @since 14183 369 */ 370 public static Class<? extends SoundPlayer> getSoundPlayerClass() { 371 return soundPlayerClass; 372 } 373 374 /** 375 * Sets the custom sound player class to override default core player. 376 * Must be called before the first audio method invocation. 377 * @param playerClass custom sound player class to override default core player 378 * @since 14183 379 */ 380 public static void setSoundPlayerClass(Class<? extends SoundPlayer> playerClass) { 381 if (audioPlayer != null) { 382 throw new IllegalStateException("Audio player already initialized"); 383 } 384 soundPlayerClass = Objects.requireNonNull(playerClass); 385 } 357 386 } -
trunk/src/org/openstreetmap/josm/io/audio/fx/JavaFxMediaPlayer.java
r13829 r14183 34 34 * </ul> 35 35 * @since 12328 36 * @deprecated MP3 support moved to openjfx plugin as JavaFX is gone with Java 11. 36 37 */ 38 @Deprecated 37 39 public class JavaFxMediaPlayer implements SoundPlayer { 38 40 -
trunk/src/org/openstreetmap/josm/io/audio/fx/package-info.java
r13819 r14183 4 4 * Provides the classes for Audio mapping features requiring JavaFX. 5 5 * The package is distinct to ease the decoupling between JOSM and JavaFX as an optional dependence. 6 * @deprecated MP3 support moved to openjfx plugin as JavaFX is gone with Java 11. 6 7 */ 7 8 package org.openstreetmap.josm.io.audio.fx;
Note:
See TracChangeset
for help on using the changeset viewer.