Final Platform Layer 0.9.8-beta
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
Audio functions

This category contains functions for start/stop playing audio and retrieving/changing some audio-related settings. More...

Typedefs

typedef enum fplAudioResultType fplAudioResultType
 An enumeration of audio results.
 

Enumerations

enum  fplAudioResultType {
  fplAudioResultType_None , fplAudioResultType_Success , fplAudioResultType_DeviceNotInitialized , fplAudioResultType_DeviceAlreadyStopped ,
  fplAudioResultType_DeviceAlreadyStarted , fplAudioResultType_DeviceBusy , fplAudioResultType_NoDeviceFound , fplAudioResultType_ApiFailed ,
  fplAudioResultType_PlatformNotInitialized , fplAudioResultType_BackendAlreadyInitialized , fplAudioResultType_UnsetAudioFormat , fplAudioResultType_UnsetAudioChannels ,
  fplAudioResultType_UnsetAudioSampleRate , fplAudioResultType_UnsetAudioBufferSize , fplAudioResultType_Failed , fplAudioResultType_First ,
  fplAudioResultType_Last
}
 An enumeration of audio results. More...
 

Functions

fpl_common_api void fplConvertAudioTargetFormatToDeviceFormat (const fplAudioTargetFormat *inFormat, fplAudioDeviceFormat *outFormat)
 Converts a fplAudioTargetFormat into a fplAudioDeviceFormat structure.
 
fpl_common_api const char * fplGetAudioBackendName (fplAudioBackendType backendType)
 Gets the string that represents the given audio backend type.
 
fpl_common_api fplAudioBackendType fplGetAudioBackendType ()
 Gets the current audio backend type.
 
fpl_common_api uint32_t fplGetAudioBufferSizeInBytes (const fplAudioFormatType format, const uint32_t channelCount, const uint32_t frameCount)
 Computes the total number of bytes for the buffer and the given parameters.
 
fpl_common_api uint32_t fplGetAudioBufferSizeInFrames (uint32_t sampleRate, uint32_t bufferSizeInMilliSeconds)
 Computes the total number of frames for given sample rate and buffer size.
 
fpl_common_api uint32_t fplGetAudioBufferSizeInMilliseconds (uint32_t sampleRate, uint32_t frameCount)
 Computes the duration in milliseconds for the given sample rate and frame count.
 
fpl_common_api uint32_t fplGetAudioDevices (fplAudioDeviceInfo *devices, uint32_t maxDeviceCount)
 Retrieves all playback audio devices.
 
fpl_common_api const char * fplGetAudioFormatName (const fplAudioFormatType format)
 Gets the string that represents the given audio format type.
 
fpl_common_api uint32_t fplGetAudioFrameSizeInBytes (const fplAudioFormatType format, const uint32_t channelCount)
 Computes the number of bytes required for one interleaved audio frame - containing all the channels.
 
fpl_common_api bool fplGetAudioHardwareFormat (fplAudioDeviceFormat *outFormat)
 Retrieves the native format for the current audio device.
 
fpl_common_api uint32_t fplGetAudioSampleSizeInBytes (const fplAudioFormatType format)
 Computes the number of bytes required to write one sample with one channel.
 
fpl_common_api fplAudioResultType fplPlayAudio ()
 Start playing asynchronous audio.
 
fpl_common_api bool fplSetAudioClientReadCallback (fpl_audio_client_read_callback *newCallback, void *userData)
 Overwrites the audio client read callback.
 
fpl_common_api fplAudioResultType fplStopAudio ()
 Stop playing asynchronous audio.
 

Detailed Description

This category contains functions for start/stop playing audio and retrieving/changing some audio-related settings.

Enumeration Type Documentation

◆ fplAudioResultType

An enumeration of audio results.

Enumerator
fplAudioResultType_None 

No result.

fplAudioResultType_Success 

Success.

fplAudioResultType_DeviceNotInitialized 

The audio device is not initialized.

fplAudioResultType_DeviceAlreadyStopped 

The audio device is already stopped.

fplAudioResultType_DeviceAlreadyStarted 

The audio device is already started.

fplAudioResultType_DeviceBusy 

The audio device is busy/waiting.

fplAudioResultType_NoDeviceFound 

No audio device is found.

fplAudioResultType_ApiFailed 

Failed to load the audio api.

fplAudioResultType_PlatformNotInitialized 

The platform is not initialized.

fplAudioResultType_BackendAlreadyInitialized 

The audio backend is already initialized.

fplAudioResultType_UnsetAudioFormat 

The fplAudioFormatType is not set.

fplAudioResultType_UnsetAudioChannels 

The number of audio channels is not set.

fplAudioResultType_UnsetAudioSampleRate 

The sample rate is not set.

fplAudioResultType_UnsetAudioBufferSize 

The audio buffer size is not set.

fplAudioResultType_Failed 

Unknown error.

fplAudioResultType_First 

First fplAudioResultType.

fplAudioResultType_Last 

Last fplAudioResultType.

Definition at line 6773 of file final_platform_layer.h.

Function Documentation

◆ fplConvertAudioTargetFormatToDeviceFormat()

fpl_common_api void fplConvertAudioTargetFormatToDeviceFormat ( const fplAudioTargetFormat inFormat,
fplAudioDeviceFormat outFormat 
)

Converts a fplAudioTargetFormat into a fplAudioDeviceFormat structure.

Parameters
inFormatThe input format
outFormatThe output format

◆ fplGetAudioBackendName()

fpl_common_api const char * fplGetAudioBackendName ( fplAudioBackendType  backendType)

Gets the string that represents the given audio backend type.

Parameters
backendTypeThe audio backend type fplAudioBackendType
Returns
Returns a string for the given audio backend type

◆ fplGetAudioBackendType()

fpl_common_api fplAudioBackendType fplGetAudioBackendType ( )

Gets the current audio backend type.

Returns
Returns the current audio backend type fplAudioBackendType

◆ fplGetAudioBufferSizeInBytes()

fpl_common_api uint32_t fplGetAudioBufferSizeInBytes ( const fplAudioFormatType  format,
const uint32_t  channelCount,
const uint32_t  frameCount 
)

Computes the total number of bytes for the buffer and the given parameters.

Parameters
formatThe audio format
channelCountThe number of channels
frameCountThe number of frames
Returns
Returns the total number of bytes for the buffer

◆ fplGetAudioBufferSizeInFrames()

fpl_common_api uint32_t fplGetAudioBufferSizeInFrames ( uint32_t  sampleRate,
uint32_t  bufferSizeInMilliSeconds 
)

Computes the total number of frames for given sample rate and buffer size.

Parameters
sampleRateThe sample rate in Hz
bufferSizeInMilliSecondsThe buffer size in milliseconds
Returns
Returns the total number of frames for given sample rate and buffer size

◆ fplGetAudioBufferSizeInMilliseconds()

fpl_common_api uint32_t fplGetAudioBufferSizeInMilliseconds ( uint32_t  sampleRate,
uint32_t  frameCount 
)

Computes the duration in milliseconds for the given sample rate and frame count.

Parameters
sampleRateThe sample rate in Hz
frameCountThe number of frames
Returns
Returns the duration in milliseconds

◆ fplGetAudioDevices()

fpl_common_api uint32_t fplGetAudioDevices ( fplAudioDeviceInfo devices,
uint32_t  maxDeviceCount 
)

Retrieves all playback audio devices.

Parameters
devicesA array of audio device info fplAudioDeviceInfo
maxDeviceCountThe total number of devices available in the devices array.
Returns
Returns the number of devices found.

◆ fplGetAudioFormatName()

fpl_common_api const char * fplGetAudioFormatName ( const fplAudioFormatType  format)

Gets the string that represents the given audio format type.

Parameters
formatThe audio format type fplAudioFormatType
Returns
Returns a string for the given audio format type

◆ fplGetAudioFrameSizeInBytes()

fpl_common_api uint32_t fplGetAudioFrameSizeInBytes ( const fplAudioFormatType  format,
const uint32_t  channelCount 
)

Computes the number of bytes required for one interleaved audio frame - containing all the channels.

Parameters
formatThe audio format
channelCountThe number of channels
Returns
Returns the number of bytes for one frame in bytes

◆ fplGetAudioHardwareFormat()

fpl_common_api bool fplGetAudioHardwareFormat ( fplAudioDeviceFormat outFormat)

Retrieves the native format for the current audio device.

Parameters
outFormatThe pointer to the fplAudioDeviceFormat structure
Returns
Returns true when a hardware format was active, false otherwise.

◆ fplGetAudioSampleSizeInBytes()

fpl_common_api uint32_t fplGetAudioSampleSizeInBytes ( const fplAudioFormatType  format)

Computes the number of bytes required to write one sample with one channel.

Parameters
formatThe audio format type fplAudioFormatType
Returns
Returns the number of bytes for one sample with one channel

◆ fplPlayAudio()

Start playing asynchronous audio.

Returns
Returns the audio result fplAudioResultType

◆ fplSetAudioClientReadCallback()

fpl_common_api bool fplSetAudioClientReadCallback ( fpl_audio_client_read_callback newCallback,
void *  userData 
)

Overwrites the audio client read callback.

Parameters
newCallbackThe pointer to the fpl_audio_client_read_callback callback
userDataThe pointer to the client/user data
Returns
Returns true when an audio device is ready and the callback was set, false otherwise.
Note
This has no effect when audio is already playing, you have to call it when audio is in a stopped state!

◆ fplStopAudio()

Stop playing asynchronous audio.

Returns
Returns the audio result fplAudioResultType