mirror of
https://github.com/switchbrew/libnx.git
synced 2025-12-29 14:29:11 +01:00
50 lines
1.5 KiB
C
50 lines
1.5 KiB
C
/**
|
|
* @file audout.h
|
|
* @brief Audio output service.
|
|
* @author hexkyz
|
|
* @copyright libnx Authors
|
|
*/
|
|
#pragma once
|
|
|
|
#include "../types.h"
|
|
|
|
typedef enum {
|
|
PcmFormat_Invalid = 0,
|
|
PcmFormat_INT8 = 1,
|
|
PcmFormat_INT16 = 2,
|
|
PcmFormat_INT24 = 3,
|
|
PcmFormat_INT32 = 4,
|
|
PcmFormat_FLOAT = 5,
|
|
PcmFormat_ADPCM = 6,
|
|
} PcmFormat;
|
|
|
|
typedef enum {
|
|
AudioOutState_Started = 0,
|
|
AudioOutState_Stopped = 1,
|
|
} AudioOutState;
|
|
|
|
/// audio output buffer format
|
|
typedef struct AudioOutBuffer AudioOutBuffer;
|
|
|
|
struct AudioOutBuffer
|
|
{
|
|
AudioOutBuffer* next; ///< Next buffer.
|
|
void* buffer; ///< Sample buffer.
|
|
u64 buffer_size; ///< Sample buffer size.
|
|
u64 data_size; ///< Size of data inside the buffer.
|
|
u64 data_offset; ///< Offset of data inside the buffer.
|
|
};
|
|
|
|
Result audoutInitialize(void);
|
|
void audoutExit(void);
|
|
|
|
Result audoutListAudioOuts(char *DeviceNames, u32 *DeviceNamesCount);
|
|
Result audoutOpenAudioOut(const char *DeviceNameIn, char *DeviceNameOut, u32 SampleRateIn, u32 ChannelCountIn, u32 *SampleRateOut, u32 *ChannelCountOut, PcmFormat *Format, AudioOutState *State);
|
|
Result audoutGetAudioOutState(AudioOutState *State);
|
|
Result audoutStartAudioOut(void);
|
|
Result audoutStopAudioOut(void);
|
|
Result audoutAppendAudioOutBuffer(AudioOutBuffer *Buffer);
|
|
Result audoutRegisterBufferEvent(Handle *BufferEvent);
|
|
Result audoutGetReleasedAudioOutBuffer(AudioOutBuffer *Buffer, u32 *ReleasedBuffersCount);
|
|
Result audoutContainsAudioOutBuffer(AudioOutBuffer *Buffer, bool *ContainsBuffer);
|