Class JavaSoundClipImpl

  • All Implemented Interfaces:
    SCAudioClip

    public class JavaSoundClipImpl
    extends AbstractSCAudioClip
    Implementation of SCAudioClip.
    Author:
    Yana Stamcheva
    • Constructor Detail

      • JavaSoundClipImpl

        public JavaSoundClipImpl​(String uri,
                                 AudioNotifierService audioNotifier)
                          throws IOException
        Initializes a new JavaSoundClipImpl instance which is to play audio stored at a specific URL using java.applet.AudioClip.
        Parameters:
        uri - the URL at which the audio is stored and which the new instance is to load
        audioNotifier - the AudioNotifierService which is initializing the new instance and whose mute property/state is to be monitored by the new instance
        Throws:
        IOException - if a java.applet.AudioClip could not be initialized or the audio at the specified url could not be read
    • Method Detail

      • internalStop

        protected void internalStop()
        Stops this audio without setting the isLooping property in the case of a looping audio. The AudioNotifier uses this method to stop the audio when setMute(true) is invoked. This allows us to restore all looping audios when the sound is restored by calling setMute(false). Stops the java.applet.AudioClip wrapped by this instance.
        Overrides:
        internalStop in class AbstractSCAudioClip
      • runOnceInPlayThread

        protected boolean runOnceInPlayThread()
        Plays this audio once. Plays the java.applet.AudioClip wrapped by this instance.
        Specified by:
        runOnceInPlayThread in class AbstractSCAudioClip
        Returns:
        true if subsequent plays of this audio and, respectively, the method are to be invoked if this audio is to be played in a loop; otherwise, false. The value reflects an implementation-specific loop condition, is not dependent on loopInterval and loopCondition and is combined with the latter in order to determine whether there will be a subsequent iteration of the playback loop.