Package jmri.jmrit

Class Sound

java.lang.Object
jmri.jmrit.Sound

public class Sound
extends Object
Provide simple way to load and play sounds in JMRI.

This is placed in the jmri.jmrit package by process of elimination. It doesn't belong in the base jmri package, as it's not a basic interface. Nor is it a specific implementation of a basic interface, which would put it in jmri.jmrix. It seems most like a "tool using JMRI", or perhaps a tool for use with JMRI, so it was placed in jmri.jmrit.

See Also:
jmri.jmrit.sound
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    class  Sound.StreamingSound  
    static class  Sound.WavBuffer  
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static long LARGE_SIZE  
  • Constructor Summary

    Constructors 
    Constructor Description
    Sound​(File file)
    Create a Sound object using the media file
    Sound​(String path)
    Create a Sound object using the media file at path
    Sound​(URL url)
    Create a Sound object using the media URL
  • Method Summary

    Modifier and Type Method Description
    void close()
    Closes the sound.
    void finalize()
    boolean getAutoClose()
    Get if the clip is closed automatically.
    void loop()
    Play the sound as an endless loop
    void loop​(int count)
    Play the sound in a loop count times.
    void play()
    Play the sound once.
    static void playSoundBuffer​(byte[] wavData)
    Play a sound from a buffer
    void setAutoClose​(boolean autoClose)
    Set if the clip be closed automatically.
    void stop()
    Stop playing a loop.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait