Changeset 11746 in josm for trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
- Timestamp:
- 2017-03-19T02:26:34+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r11472 r11746 58 58 * Called to execute the commands in the other thread 59 59 */ 60 protected void play(URL url, double offset, double speed) throws Exception {60 protected void play(URL url, double offset, double speed) throws InterruptedException, IOException { 61 61 this.url = url; 62 62 this.offset = offset; … … 67 67 } 68 68 69 protected void pause() throws Exception {69 protected void pause() throws InterruptedException, IOException { 70 70 command = Command.PAUSE; 71 71 send(); 72 72 } 73 73 74 private void send() throws Exception {74 private void send() throws InterruptedException, IOException { 75 75 result = Result.WAITING; 76 76 interrupt(); … … 79 79 } 80 80 if (result == Result.FAILED) 81 throw exception;81 throw new IOException(exception); 82 82 } 83 83 … … 121 121 * start at the beginning of the stream 122 122 * @param url The resource to play, which must be a WAV file or stream 123 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 124 */ 125 public static void play(URL url) throws Exception { 123 * @throws InterruptedException thread interrupted 124 * @throws IOException audio fault exception, e.g. can't open stream, unhandleable audio format 125 */ 126 public static void play(URL url) throws InterruptedException, IOException { 126 127 AudioPlayer instance = AudioPlayer.getInstance(); 127 128 if (instance != null) … … 133 134 * @param url The resource to play, which must be a WAV file or stream 134 135 * @param seconds The number of seconds into the audio to start playing 135 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 136 */ 137 public static void play(URL url, double seconds) throws Exception { 136 * @throws InterruptedException thread interrupted 137 * @throws IOException audio fault exception, e.g. can't open stream, unhandleable audio format 138 */ 139 public static void play(URL url, double seconds) throws InterruptedException, IOException { 138 140 AudioPlayer instance = AudioPlayer.getInstance(); 139 141 if (instance != null) … … 146 148 * @param seconds The number of seconds into the audio to start playing 147 149 * @param speed Rate at which audio playes (1.0 = real time, > 1 is faster) 148 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 149 */ 150 public static void play(URL url, double seconds, double speed) throws Exception { 150 * @throws InterruptedException thread interrupted 151 * @throws IOException audio fault exception, e.g. can't open stream, unhandleable audio format 152 */ 153 public static void play(URL url, double seconds, double speed) throws InterruptedException, IOException { 151 154 AudioPlayer instance = AudioPlayer.getInstance(); 152 155 if (instance != null) … … 156 159 /** 157 160 * Pauses the currently playing audio stream. Does nothing if nothing playing. 158 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 159 */ 160 public static void pause() throws Exception { 161 * @throws InterruptedException thread interrupted 162 * @throws IOException audio fault exception, e.g. can't open stream, unhandleable audio format 163 */ 164 public static void pause() throws InterruptedException, IOException { 161 165 AudioPlayer instance = AudioPlayer.getInstance(); 162 166 if (instance != null) … … 220 224 audioPlayer = new AudioPlayer(); 221 225 return audioPlayer; 222 } catch ( RuntimeException ex) {226 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException ex) { 223 227 Main.error(ex); 224 228 return null; … … 233 237 try { 234 238 pause(); 235 } catch ( Exception e) {239 } catch (InterruptedException | IOException e) { 236 240 Main.warn(e); 237 241 }
Note:
See TracChangeset
for help on using the changeset viewer.