Package net.paulhertz.pixelaudio.io
Class AudioBrushSessionLoader
java.lang.Object
net.paulhertz.pixelaudio.io.AudioBrushSessionLoader
Read AudioBrush session data from JSON files.
Used in the example sketch
Bagatelle.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classData loaded for a single brush.static enumSupported AudioBrush JSON file categories.static classResult of loading a gesture, configuration, or session file. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetectType(processing.data.JSONObject root) Detects the AudioBrush JSON file type from its header format field.Loads a gesture, configuration, or session JSON file.private static AudioBrushSessionLoader.LoadResultloadSession(File sessionFile, processing.data.JSONObject root) private static AudioBrushSessionLoader.LoadResultloadSingleFromConfig(File configFile, processing.data.JSONObject root) private static AudioBrushSessionLoader.LoadResultloadSingleFromGesture(File gestureFile, processing.data.JSONObject root) static processing.data.JSONObjectReads a JSON file into a ProcessingJSONObject.
-
Constructor Details
-
AudioBrushSessionLoader
private AudioBrushSessionLoader()
-
-
Method Details
-
load
Loads a gesture, configuration, or session JSON file.- Parameters:
chosenFile- JSON file to load- Returns:
- load result for the detected file type
- Throws:
IOException- if the file cannot be read or its type is unsupported
-
readRoot
Reads a JSON file into a ProcessingJSONObject.- Parameters:
file- JSON file to read- Returns:
- parsed root object
- Throws:
IOException- if the file cannot be read
-
detectType
Detects the AudioBrush JSON file type from its header format field.- Parameters:
root- parsed JSON root object- Returns:
- detected file type, or
AudioBrushSessionLoader.JsonFileType.UNKNOWN
-
loadSingleFromGesture
private static AudioBrushSessionLoader.LoadResult loadSingleFromGesture(File gestureFile, processing.data.JSONObject root) throws IOException - Throws:
IOException
-
loadSingleFromConfig
private static AudioBrushSessionLoader.LoadResult loadSingleFromConfig(File configFile, processing.data.JSONObject root) throws IOException - Throws:
IOException
-
loadSession
private static AudioBrushSessionLoader.LoadResult loadSession(File sessionFile, processing.data.JSONObject root) throws IOException - Throws:
IOException
-