Package org.xjge.core

Class Song

java.lang.Object
org.xjge.core.Song

public final class Song
extends java.lang.Object
Represents a musical composition, may or may not contain an intro which is played once before entering a looping body section. All Sound objects used by this object should be formatted as 16-bit stereo.
Since:
2.0.0
  • Constructor Summary

    Constructors
    Constructor Description
    Song​(java.lang.String filename)
    Creates a new song object using the audio file specified.
    Song​(java.lang.String introFilename, java.lang.String bodyFilename)
    Creates a new song object using the audio files specified.
  • Method Summary

    Modifier and Type Method Description
    void freeSong()
    Frees the audio data buffer used by this object.

    Methods inherited from class java.lang.Object

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

    • Song

      public Song​(java.lang.String filename)
      Creates a new song object using the audio file specified. The file provided should be formatted in 16-bit stereo.
      Parameters:
      filename - the name of the file to load. Expects the file extension to be included.
    • Song

      public Song​(java.lang.String introFilename, java.lang.String bodyFilename)
      Creates a new song object using the audio files specified. The files provided should be formatted in 16-bit stereo. Creating a song with this constructor ensures that an intro sequence plays before subsequently looping a body section indefinitely until stopped.
      Parameters:
      introFilename - the name of the file to load for the intro section. Expects the file extension to be included.
      bodyFilename - the name of the file to load for the body section. Expects the file extension to be included.
      See Also:
      Audio.playMusic(Song)
  • Method Details

    • freeSong

      public void freeSong()
      Frees the audio data buffer used by this object.