Interface AudioBackend
- All Superinterfaces:
AlgorithmProvider, AudioAlgorithmProvider<AudioBuffer>, Backend, ComputeBackend
- All Known Implementing Classes:
JavaCVMediaBackend, JavaSoundAudioBackend, MinimAudioBackend, MulticoreAudioBackend, NativeJavaCVMediaBackend, NativeMiniAudioBackend, TarsosAudioBackend, VLCJMediaBackend
Universal interface for audio backends (standard, scientific, creative).
Extends ComputeBackend to integrate with the standard backend discovery
system (BackendDiscovery).
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptiondefault AudioBufferapply(AudioBuffer audio, AudioOp<AudioBuffer> op) Applies an operation to audio data.default AudioBuffercreateAudio(Object data, int channels, int sampleRate) default ObjectCreates and returns the backend instance (or returns self if it is the backend).default ExecutionContextCreates an execution context for running operations.default HardwareAcceleratorReturns the type of hardware accelerator used by this backend.Returns the friendly name of this backend instance.default StringReturns a description of the backend.doubledefault StringgetId()Returns the unique identifier for this backend (e.g., "javafx", "jmol", "cuda").default StringgetName()Returns the display name for UI presentation.default intReturns the priority for auto-selection (higher = preferred).float[]Returns the current frequency spectrum.doublegetTime()default StringgetType()Returns the backend type category (e.g., "plotting", "molecular", "tensor", "math").default booleanChecks if this backend is currently available (libraries loaded, etc.).voidLoads an audio resource.voidpause()voidplay()default voidshutdown()Called when the application is shutting down or the backend is being replaced.voidstop()Methods inherited from interface AlgorithmProvider
description, getMetadata, scoreMethods inherited from interface AudioAlgorithmProvider
getAlgorithmTypeMethods inherited from interface Backend
getAlgorithmProviders, getStatusMessage, isExplicitlyDisabledMethods inherited from interface ComputeBackend
supportsComplexNumbers, supportsFloatingPoint, supportsParallelOps
-
Method Details
-
getType
-
createContext
Description copied from interface:ComputeBackendCreates an execution context for running operations.The context should be used within a try-with-resources block to ensure proper cleanup of resources.
- Specified by:
createContextin interfaceComputeBackend- Returns:
- new execution context
-
getAcceleratorType
Description copied from interface:ComputeBackendReturns the type of hardware accelerator used by this backend.- Specified by:
getAcceleratorTypein interfaceComputeBackend- Returns:
- the accelerator type
-
getId
-
getName
Description copied from interface:BackendReturns the display name for UI presentation.- Specified by:
getNamein interfaceAlgorithmProvider- Specified by:
getNamein interfaceAudioAlgorithmProvider<AudioBuffer>- Specified by:
getNamein interfaceBackend
-
getDescription
Description copied from interface:BackendReturns a description of the backend.- Specified by:
getDescriptionin interfaceBackend- Specified by:
getDescriptionin interfaceComputeBackend
-
isAvailable
default boolean isAvailable()Description copied from interface:BackendChecks if this backend is currently available (libraries loaded, etc.).Default implementation checks
Backend.isExplicitlyDisabled()and returns false if it is.- Specified by:
isAvailablein interfaceAlgorithmProvider- Specified by:
isAvailablein interfaceBackend
-
getPriority
default int getPriority()Description copied from interface:BackendReturns the priority for auto-selection (higher = preferred). Used when multiple backends are available.- Specified by:
getPriorityin interfaceAlgorithmProvider- Specified by:
getPriorityin interfaceBackend
-
shutdown
default void shutdown()Description copied from interface:BackendCalled when the application is shutting down or the backend is being replaced. Use this to release hardware resources, close file handles, or stop background threads.- Specified by:
shutdownin interfaceAlgorithmProvider- Specified by:
shutdownin interfaceBackend
-
createBackend
Description copied from interface:BackendCreates and returns the backend instance (or returns self if it is the backend).- Specified by:
createBackendin interfaceBackend- Specified by:
createBackendin interfaceComputeBackend- Returns:
- The backend implementation object
-
load
-
play
void play() -
pause
void pause() -
stop
void stop() -
getTime
double getTime() -
getDuration
double getDuration() -
getSpectrum
float[] getSpectrum()Returns the current frequency spectrum.- Returns:
- Array of magnitudes (usually 128 or 256 bands)
-
getBackendName
String getBackendName()Returns the friendly name of this backend instance. -
apply
Description copied from interface:AudioAlgorithmProviderApplies an operation to audio data.- Specified by:
applyin interfaceAudioAlgorithmProvider<AudioBuffer>
-
createAudio
- Specified by:
createAudioin interfaceAudioAlgorithmProvider<AudioBuffer>
-