Package edu.cornell.gdiac.assets
Class SoundParser
java.lang.Object
edu.cornell.gdiac.assets.SoundParser
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if o is another SoundParserClass<com.badlogic.gdx.audio.Sound>getType()Returns the asset type generated by this parserbooleanhasNext()Returns true if there are still assets left to generatevoidprocessNext(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 managervoidreset(com.badlogic.gdx.utils.JsonValue directory) Resets the parser iterator for the given directory.
-
Constructor Details
-
SoundParser
public SoundParser()
-
-
Method Details
-
getType
Returns the asset type generated by this parser- Specified by:
getTypein interfaceAssetParser<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:
resetin interfaceAssetParser<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:
hasNextin interfaceAssetParser<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 managerSoundobjects have no additional loader properties. They are specified key : filename.This method fails silently if there are no available assets to process.
- Specified by:
processNextin interfaceAssetParser<com.badlogic.gdx.audio.Sound>- Parameters:
manager- The asset manager to load an assetkeymap- The mapping of JSON keys to asset file names
-
equals
Returns true if o is another SoundParser
-