Package javafx.scene.media

Examples of javafx.scene.media.AudioClip


   *            the file path with file name
   * @return the audio clip
   */
  public static AudioClip audioClip(final String fileName) {
    try {
      return new AudioClip(RS.class.getResource(fileName).toExternalForm());
    } catch (final Throwable t) {
      log.error("Unable to get audio clip for resource named: " + fileName);
    }
    return null;
  }
View Full Code Here


        String uri = file.toURI().toString();
//        System.out.println("loading: " + file.toURI().toString() + " keyed as " + key);
        if (isMusic) {
            mediaMap.put(key, new Media(uri));
        } else {
            clipMap.put(key, new AudioClip(uri));
        }
    }
View Full Code Here

     *
     * @param key
     */
    public void playSoundFX(String key) {
        if (soundfxVolume > 0) {
            AudioClip temp = (clipMap.get(key));
            if (temp == null) {
                return;//track not found, continue current music selection
            }

            temp.play(soundfxVolume);
        }
    }
View Full Code Here

TOP

Related Classes of javafx.scene.media.AudioClip

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.