Class ClipCache


  • public class ClipCache
    extends java.lang.Object
    Allocates new sound clips.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @Nullable javax.sound.sampled.DataLine allocateClip​(@Nullable java.lang.String name, @NotNull java.lang.String action)
      Allocates a new clip.
      void freeClip​(@NotNull javax.sound.sampled.Line clip)
      Deallocates a clip.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClipCache

        public ClipCache​(@NotNull
                         @NotNull AudioFileLoader audioFileLoader,
                         @Nullable
                         @Nullable DebugWriter debugSound)
        Creates a new instance.
        Parameters:
        audioFileLoader - the audio file loader for loading audio files
        debugSound - the writer for logging sound related information or null to not log
    • Method Detail

      • freeClip

        public void freeClip​(@NotNull
                             @NotNull javax.sound.sampled.Line clip)
        Deallocates a clip.
        Parameters:
        clip - the clip to deallocate
      • allocateClip

        @Nullable
        public @Nullable javax.sound.sampled.DataLine allocateClip​(@Nullable
                                                                   @Nullable java.lang.String name,
                                                                   @NotNull
                                                                   @NotNull java.lang.String action)
        Allocates a new clip.
        Parameters:
        name - an optional prefix for the action name
        action - the action name of the clip to allocate
        Returns:
        the new clip, or null if an error occurs