-
Notifications
You must be signed in to change notification settings - Fork 13
Manual Audio Initialization
Finalspace edited this page May 29, 2026
·
1 revision
If you want to initialize and release the audio system yourself, you can call fplAudioInit() and fplAudioRelease() respectively.
In addition you can set fplAudioSettings::manualLoad to true, so that fplPlatformInit() won't do any audio backend initialization.
audioSettings;
fplDefaultAudioSettings(&audioSettings);
settings = ;
fplDefaultSettings(&settings);
settings.. = true;
const char *newMediaFilePath = ;
// Initialize
if ((, &settings)) {
// Main loop
bool isAppRunning = true;
while (isAppRunning) {
// Use case: Loading media file from a request
MediaFormat mediaFormat = ;
if (newMediaFilePath != && MyMediaLoad(newMediaFilePath, &mediaFormat)) {
newAudioSettings;
fplDefaultAudioSettings(&newAudioSettings);
newAudioSettings.channels = mediaFormat.channels;
newAudioSettings.format = mediaFormat.type;
newAudioSettings.sampleRate = mediaFormat.sampleRate;
// Manual initialize the audio system
resultType = (&newAudioSettings);
if (resultType != newAudioSettings_Success) {
// Handle error
// No need to stop or release the audio system, this is done automatically
} else {
// Success, you can start the playback now
();
}
}
}
// Manually release the audio system
();
// Release the platform
();
}Warning: Do not remove the
fplInitFlags_Audio from
fplPlatformInit() , otherwise the audio system initialization in
fplAudioInit() will always fail!
- Assertion & Debug
- Atomic operations
- Audio functions
- Clipboard functions
- Console functions
- Constants
- Display/Monitor functions
- Dynamic library loading
- Error Handling
- Files/IO functions
- Function macros
- Hardware Infos
- Input types and functions
- Localization functions
- Logging
- Memory Macros
- Memory functions
- Operating system Infos
- Path functions
- Platform functions
- Session Infos
- Settings & Configurations
- Storage class identifiers
- String functions
- Threading and synchronizations routines
- Timing functions
- Video functions
- Window events
- Window functions
- fplARMCPUCapabilities
- fplAudioChannelMap
- fplAudioDeviceID
- fplAudioDeviceInfo
- fplAudioFormat
- fplAudioSettings
- fplColor32
- fplConditionVariable
- fplConsoleSettings
- fplCPUCapabilities
- fplCPUIDLeaf
- fplDateTime
- fplDateTimeCreationResult
- fplDateTimeResult
- fplDisplayInfo
- fplDisplayMode
- fplDynamicLibraryHandle
- fplEndianess
- fplEvent
- fplFileEntry
- fplFileHandle
- fplFilePermissions
- fplFileTimeStamps
- fplGamepadButton
- fplGamepadData
- fplGamepadEvent
- fplGamepadInfo
- fplGamepadInputBinding
- fplGamepadMapping
- fplGamepadSettings
- fplGamepadState
- fplGamepadStates
- fplGraphicsApiSettings
- fplImageSource
- fplInputBackendMask
- fplInputBackendSupport
- fplInputDevice
- fplInputDeviceGuid
- fplInputSettings
- fplInternalConditionVariable
- fplInternalDynamicLibraryHandle
- fplInternalFileEntryHandle
- fplInternalFileHandle
- fplInternalFileRootInfo
- fplInternalMutexHandle
- fplInternalSemaphoreHandle
- fplInternalSignalHandle
- fplInternalThreadHandle
- fplKeyboardEvent
- fplKeyboardState
- fplLogSettings
- fplLogWriter
- fplLogWriterConsole
- fplLogWriterCustom
- fplMemoryAllocationSettings
- fplMemoryBlock
- fplMemoryInfos
- fplMemorySettings
- fplMouseEvent
- fplMouseState
- fplMutexHandle
- fplOpenGLSettings
- fplOSVersionInfos
- fplSemaphoreHandle
- fplSettings
- fplSignalHandle
- fplSpecificAudioSettings
- fplThreadHandle
- fplThreadParameters
- fplTimestamp
- fplVersionInfo
- fplVideoBackBuffer
- fplVideoRect
- fplVideoRequirements
- fplVideoRequirementsVulkan
- fplVideoSettings
- fplVideoSurface
- fplVideoSurfaceOpenGL
- fplVideoSurfaceVulkan
- fplVideoWindow
- fplVulkanSettings
- fplWindowCallbacks
- fplWindowDropFiles
- fplWindowEvent
- fplWindowPosition
- fplWindowSettings
- fplWindowSize
- fplX86CPUCapabilities