Class AudioSystemClipImpl

  • All Implemented Interfaces:
    SCAudioClip

    public class AudioSystemClipImpl
    extends AbstractSCAudioClip
    Implementation of SCAudioClip using PortAudio.
    Author:
    Damyian Minkov, Lyubomir Marinov
    • Constructor Detail

      • AudioSystemClipImpl

        public AudioSystemClipImpl​(String url,
                                   AudioNotifierService audioNotifier,
                                   AudioSystem audioSystem,
                                   boolean playback)
                            throws IOException
        Creates the audio clip and initializes the listener used from the loop timer.
        Parameters:
        url - the URL pointing to the audio file
        audioNotifier - the audio notify service
        playback - to use playback or notification device
        Throws:
        IOException - cannot audio clip with supplied URL.
    • Method Detail

      • enterRunInPlayThread

        protected void enterRunInPlayThread()
        Notifies this instance that its execution in its background/separate thread dedicated to the playback of this audio is about to start playing this audio for the first time. Regardless of whether this instance is to be played once or multiple times in a loop, the method is called once in order to allow extenders/implementers to perform one-time initialization before this audio starts playing. The AbstractSCAudioClip implementation does nothing.
        Overrides:
        enterRunInPlayThread in class AbstractSCAudioClip
      • exitRunInPlayThread

        protected void exitRunInPlayThread()
        Notifies this instance that its execution in its background/separate thread dedicated to the playback of this audio is about to stop playing this audio once. Regardless of whether this instance is to be played once or multiple times in a loop, the method is called once in order to allow extenders/implementers to perform one-time cleanup after this audio stops playing. The AbstractSCAudioClip implementation does nothing.
        Overrides:
        exitRunInPlayThread in class AbstractSCAudioClip
      • exitRunOnceInPlayThread

        protected void exitRunOnceInPlayThread()
        Notifies this instance that its execution in its background/separate thread dedicated to the playback of this audio is about to stop playing this audio. If this audio is to be played in a loop, the method is called at the end of each iteration of the loop. Allows extenders/implementers to perform per-loop iteraction cleanup. The AbstractSCAudioClip implementation does nothing.
        Overrides:
        exitRunOnceInPlayThread in class AbstractSCAudioClip
      • runOnceInPlayThread

        protected boolean runOnceInPlayThread()
        Plays this audio once.
        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.