Class SoundParser

java.lang.Object
edu.cornell.gdiac.assets.SoundParser
All Implemented Interfaces:
AssetParser<com.badlogic.gdx.audio.Sound>

public class SoundParser extends Object implements AssetParser<com.badlogic.gdx.audio.Sound>
This class parses a JSON entry into a Sound object.

Sound assets do not have any properties other than the file name, due to the limitations of LibGDX audio.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if o is another SoundParser
    Class<com.badlogic.gdx.audio.Sound>
    Returns the asset type generated by this parser
    boolean
    Returns true if there are still assets left to generate
    void
    processNext(com.badlogic.gdx.assets.AssetManager manager, com.badlogic.gdx.utils.ObjectMap<String,String> keymap)
    Processes the next available sound object, loading it into the asset manager
    void
    reset(com.badlogic.gdx.utils.JsonValue directory)
    Resets the parser iterator for the given directory.

    Methods inherited from class java.lang.Object

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

    • SoundParser

      public SoundParser()
  • Method Details

    • getType

      public Class<com.badlogic.gdx.audio.Sound> getType()
      Returns the asset type generated by this parser
      Specified by:
      getType in interface AssetParser<com.badlogic.gdx.audio.Sound>
      Returns:
      the asset type generated by this parser
    • reset

      public void reset(com.badlogic.gdx.utils.JsonValue directory)
      Resets the parser iterator for the given directory.

      The value directory is assumed to be the root of a larger JSON structure. The individual assets are defined by subtrees in this structure.

      Specified by:
      reset in interface AssetParser<com.badlogic.gdx.audio.Sound>
      Parameters:
      directory - The JSON representation of the asset directory
    • hasNext

      public boolean hasNext()
      Returns true if there are still assets left to generate
      Specified by:
      hasNext in interface AssetParser<com.badlogic.gdx.audio.Sound>
      Returns:
      true if there are still assets left to generate
    • processNext

      public void processNext(com.badlogic.gdx.assets.AssetManager manager, com.badlogic.gdx.utils.ObjectMap<String,String> keymap)
      Processes the next available sound object, loading it into the asset manager

      Sound objects have no additional loader properties. They are specified key : filename.

      This method fails silently if there are no available assets to process.

      Specified by:
      processNext in interface AssetParser<com.badlogic.gdx.audio.Sound>
      Parameters:
      manager - The asset manager to load an asset
      keymap - The mapping of JSON keys to asset file names
    • equals

      public boolean equals(Object o)
      Returns true if o is another SoundParser
      Overrides:
      equals in class Object
      Returns:
      true if o is another SoundParser