Java Code Examples for java.applet.AudioClip#stop()
The following examples show how to use
java.applet.AudioClip#stop() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutoCloseTimeCheck.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Checks that after small period of non-activity the clip will not be * closed and the "Direct Clip" thread will alive. */ private static void testSmallDelay(final File file) throws IOException { AudioClip clip = (AudioClip) file.toURL().getContent(); long threadID = 0; // Will run the test no more than 15 seconds long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(15); while (endtime - System.nanoTime() > 0) { clip.loop(); sleep(500); long data = count(); if (data != threadID) { System.out.println("Playing on new thread: " + data + " at " + new java.util.Date()); if (threadID == 0) { threadID = data; } else { throw new RuntimeException("Thread was changed"); } } clip.stop(); sleep(500); } }
Example 2
Source File: AutoCloseTimeCheck.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Checks that after small period of non-activity the clip will not be * closed and the "Direct Clip" thread will alive. */ private static void testSmallDelay(final File file) throws IOException { AudioClip clip = (AudioClip) file.toURL().getContent(); long threadID = 0; // Will run the test no more than 15 seconds long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(15); while (endtime - System.nanoTime() > 0) { clip.loop(); sleep(500); long data = count(); if (data != threadID) { System.out.println("Playing on new thread: " + data + " at " + new java.util.Date()); if (threadID == 0) { threadID = data; } else { throw new RuntimeException("Thread was changed"); } } clip.stop(); sleep(500); } }
Example 3
Source File: AutoCloseTimeCheck.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Checks that after small period of non-activity the clip will not be * closed and the "Direct Clip" thread will alive. */ private static void testSmallDelay(final File file) throws IOException { AudioClip clip = (AudioClip) file.toURL().getContent(); long threadID = 0; // Will run the test no more than 15 seconds long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(15); while (endtime - System.nanoTime() > 0) { clip.loop(); sleep(500); long data = count(); if (data != threadID) { System.out.println("Playing on new thread: " + data + " at " + new java.util.Date()); if (threadID == 0) { threadID = data; } else { throw new RuntimeException("Thread was changed"); } } clip.stop(); sleep(500); } }
Example 4
Source File: AutoCloseTimeCheck.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Checks that after small period of non-activity the clip will not be * closed and the "Direct Clip" thread will alive. */ private static void testSmallDelay(final File file) throws IOException { AudioClip clip = (AudioClip) file.toURL().getContent(); long threadID = 0; // Will run the test no more than 15 seconds long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(15); while (endtime - System.nanoTime() > 0) { clip.loop(); sleep(500); long data = count(); if (data != threadID) { System.out.println("Playing on new thread: " + data + " at " + new java.util.Date()); if (threadID == 0) { threadID = data; } else { throw new RuntimeException("Thread was changed"); } } clip.stop(); sleep(500); } }
Example 5
Source File: AutoCloseTimeCheck.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Checks that after a big period of non-activity the clip will be closed * and the "Direct Clip" thread will stop. */ private static void testBigDelay(final File file) throws Exception { AudioClip clip = (AudioClip) file.toURL().getContent(); clip.loop(); clip.stop(); sleep(20000); // 20 sec for slow systems if (count() != 0) { throw new RuntimeException("Thread was found"); } }
Example 6
Source File: AutoCloseTimeCheck.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Checks that after a big period of non-activity the clip will be closed * and the "Direct Clip" thread will stop. */ private static void testBigDelay(final File file) throws Exception { AudioClip clip = (AudioClip) file.toURL().getContent(); clip.loop(); clip.stop(); sleep(20000); // 20 sec for slow systems if (count() != 0) { throw new RuntimeException("Thread was found"); } }
Example 7
Source File: AutoCloseTimeCheck.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Checks that after a big period of non-activity the clip will be closed * and the "Direct Clip" thread will stop. */ private static void testBigDelay(final File file) throws Exception { AudioClip clip = (AudioClip) file.toURL().getContent(); clip.loop(); clip.stop(); sleep(20000); // 20 sec for slow systems if (count() != 0) { throw new RuntimeException("Thread was found"); } }
Example 8
Source File: AutoCloseTimeCheck.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Checks that after a big period of non-activity the clip will be closed * and the "Direct Clip" thread will stop. */ private static void testBigDelay(final File file) throws Exception { AudioClip clip = (AudioClip) file.toURL().getContent(); clip.loop(); clip.stop(); sleep(20000); // 20 sec for slow systems if (count() != 0) { throw new RuntimeException("Thread was found"); } }
Example 9
Source File: AlertManager.java From Spark with Apache License 2.0 | 4 votes |
public void stopAlert(String alertResourceName) { AudioClip alertClip = getAlertClip(alertResourceName, false); if (alertClip != null) { alertClip.stop(); } }