libctru
v2.4.1
|
MIC (Microphone) service. More...
Go to the source code of this file.
Enumerations | |
enum | MICU_Encoding { MICU_ENCODING_PCM8 = 0 , MICU_ENCODING_PCM16 = 1 , MICU_ENCODING_PCM8_SIGNED = 2 , MICU_ENCODING_PCM16_SIGNED = 3 } |
Microphone audio encodings. More... | |
enum | MICU_SampleRate { MICU_SAMPLE_RATE_32730 = 0 , MICU_SAMPLE_RATE_16360 = 1 , MICU_SAMPLE_RATE_10910 = 2 , MICU_SAMPLE_RATE_8180 = 3 } |
Microphone audio sampling rates. More... | |
Functions | |
Result | micInit (u8 *buffer, u32 bufferSize) |
Initializes MIC. More... | |
void | micExit (void) |
Exits MIC. | |
u32 | micGetSampleDataSize (void) |
Gets the size of the sample data area within the shared memory buffer. More... | |
u32 | micGetLastSampleOffset (void) |
Gets the offset within the shared memory buffer of the last sample written. More... | |
Result | MICU_MapSharedMem (u32 size, Handle handle) |
Maps MIC shared memory. More... | |
Result | MICU_UnmapSharedMem (void) |
Unmaps MIC shared memory. | |
Result | MICU_StartSampling (MICU_Encoding encoding, MICU_SampleRate sampleRate, u32 offset, u32 size, bool loop) |
Begins sampling microphone input. More... | |
Result | MICU_AdjustSampling (MICU_SampleRate sampleRate) |
Adjusts the configuration of the current sampling session. More... | |
Result | MICU_StopSampling (void) |
Stops sampling microphone input. | |
Result | MICU_IsSampling (bool *sampling) |
Gets whether microphone input is currently being sampled. More... | |
Result | MICU_GetEventHandle (Handle *handle) |
Gets an event handle triggered when the shared memory buffer is full. More... | |
Result | MICU_SetGain (u8 gain) |
Sets the microphone's gain. More... | |
Result | MICU_GetGain (u8 *gain) |
Gets the microphone's gain. More... | |
Result | MICU_SetPower (bool power) |
Sets whether the microphone is powered on. More... | |
Result | MICU_GetPower (bool *power) |
Gets whether the microphone is powered on. More... | |
Result | MICU_SetClamp (bool clamp) |
Sets whether to clamp microphone input. More... | |
Result | MICU_GetClamp (bool *clamp) |
Gets whether to clamp microphone input. More... | |
Result | MICU_SetAllowShellClosed (bool allowShellClosed) |
Sets whether to allow sampling when the shell is closed. More... | |
MIC (Microphone) service.
enum MICU_Encoding |
enum MICU_SampleRate |
u32 micGetLastSampleOffset | ( | void | ) |
Gets the offset within the shared memory buffer of the last sample written.
u32 micGetSampleDataSize | ( | void | ) |
Gets the size of the sample data area within the shared memory buffer.
Initializes MIC.
size | Shared memory buffer to write audio data to. Must be aligned to 0x1000 bytes. |
handle | Size of the shared memory buffer. |
Result MICU_AdjustSampling | ( | MICU_SampleRate | sampleRate | ) |
Adjusts the configuration of the current sampling session.
sampleRate | Sample rate of outputted audio. |
Result MICU_GetClamp | ( | bool * | clamp | ) |
Gets whether to clamp microphone input.
clamp | Pointer to output the clamp state to. |
Gets an event handle triggered when the shared memory buffer is full.
handle | Pointer to output the event handle to. |
Gets the microphone's gain.
gain | Pointer to output the current gain to. |
Result MICU_GetPower | ( | bool * | power | ) |
Gets whether the microphone is powered on.
power | Pointer to output the power state to. |
Result MICU_IsSampling | ( | bool * | sampling | ) |
Gets whether microphone input is currently being sampled.
sampling | Pointer to output the sampling state to. |
Maps MIC shared memory.
size | Size of the shared memory. |
handle | Handle of the shared memory. |
Result MICU_SetAllowShellClosed | ( | bool | allowShellClosed | ) |
Sets whether to allow sampling when the shell is closed.
allowShellClosed | Whether to allow sampling when the shell is closed. |
Result MICU_SetClamp | ( | bool | clamp | ) |
Sets whether to clamp microphone input.
clamp | Whether to clamp microphone input. |
Result MICU_SetPower | ( | bool | power | ) |
Sets whether the microphone is powered on.
power | Whether the microphone is powered on. |
Result MICU_StartSampling | ( | MICU_Encoding | encoding, |
MICU_SampleRate | sampleRate, | ||
u32 | offset, | ||
u32 | size, | ||
bool | loop | ||
) |
Begins sampling microphone input.
encoding | Encoding of outputted audio. |
sampleRate | Sample rate of outputted audio. |
sharedMemAudioOffset | Offset to write audio data to in the shared memory buffer. |
sharedMemAudioSize | Size of audio data to write to the shared memory buffer. This should be at most "bufferSize - 4". |
loop | Whether to loop back to the beginning of the buffer when the end is reached. |