Helpers to convert audio.
More...
|
| void | cloudx1_AudioConvertFrom (const uint8_t *payload, float *output, size_t nSpl, enum cloudx1_SampleFormat fmt) |
| |
| void | cloudx1_AudioConvertTo (const float *input, uint8_t *payload, size_t nSpl, enum cloudx1_SampleFormat fmt) |
| |
| void | cloudx1_StereoToMono (const float *input, float *output, size_t nFrame) |
| |
| void | cloudx1_MonoToStereo (const float *input, float *output, size_t nFrame) |
| |
| void | cloudx1_StereoToMono_Planar (const float *inputL, const float *inputR, float *output, size_t nFrame) |
| |
| void | cloudx1_MonoToStereo_Planar (const float *input, float *outputL, float *outputR, size_t nFrame) |
| |
| void | cloudx1_AudioMonoFromLiveStereo (const uint8_t *payload, float *output) |
| |
| void | cloudx1_AudioMonoToLiveStereo (const float *input, uint8_t *payload) |
| |
| struct cloudx1_CAudioConverter * | cloudx1_GetAudioConverter (enum cloudx1_SampleFormat fmt, size_t nFrame, size_t payl_ch, size_t payl_ch_offset, enum cloudx1_ConverterTargetMode target_mode) |
| |
| void | cloudx1_FreeAudioConverter (struct cloudx1_CAudioConverter *converter) |
| |
| void | cloudx1_AudioConverter_From (struct cloudx1_CAudioConverter *converter, const uint8_t *payload, float *output) |
| |
| void | cloudx1_AudioConverter_To (struct cloudx1_CAudioConverter *converter, const float *input, uint8_t *payload) |
| |
Helpers to convert audio in an optimized way
◆ cloudx1_ConverterTargetMode
Kind of process-side samples for CAudioConverter
| Enumerator |
|---|
| ConverterTargetMode_AsInput | Same channels as input (no extract/insert)
|
| ConverterTargetMode_Mono | Mono process (using mono extract/payload)
|
| ConverterTargetMode_Stereo | Stereo process (using stereo extract/payload)
|
| ConverterTargetMode_StereoToMono | Mono process, using stereo extract/payload (converts stereo to mono)
|
| ConverterTargetMode_MonoToStereo | Stereo process, using mono extract/payload (converts mono to stereo)
|
Definition at line 1083 of file sound4.x1.cloud.h.
◆ cloudx1_AudioConverter_From()
| void cloudx1_AudioConverter_From |
( |
struct cloudx1_CAudioConverter * |
converter, |
|
|
const uint8_t * |
payload, |
|
|
float * |
output |
|
) |
| |
Convert the payload to floating-point array, using a predefined converter.
- Warning
- Output buffer must be 64-byte aligned
- Parameters
-
| converter | a converter created with cloudx1_GetAudioConverter |
| payload | the binary raw audio buffer |
| output | audio output buffer (64 byte aligned) |
◆ cloudx1_AudioConverter_To()
| void cloudx1_AudioConverter_To |
( |
struct cloudx1_CAudioConverter * |
converter, |
|
|
const float * |
input, |
|
|
uint8_t * |
payload |
|
) |
| |
Convert floating-point array to payload, using a predefined converter.
- Warning
- Input buffer must be 64-byte aligned
- Parameters
-
| converter | a converter created with cloudx1_GetAudioConverter |
| input | audio input buffer (64 byte aligned) |
| payload | the binary raw audio buffer |
◆ cloudx1_AudioConvertFrom()
| void cloudx1_AudioConvertFrom |
( |
const uint8_t * |
payload, |
|
|
float * |
output, |
|
|
size_t |
nSpl, |
|
|
enum cloudx1_SampleFormat |
fmt |
|
) |
| |
Convert the payload to floating-point array
- Warning
- Output buffer must be 64-byte aligned
- Parameters
-
| payload | the binary raw audio buffer |
| output | audio output buffer (64 byte aligned) |
| nSpl | the number of samples (not frames) |
| fmt | the format of the payload |
◆ cloudx1_AudioConvertTo()
| void cloudx1_AudioConvertTo |
( |
const float * |
input, |
|
|
uint8_t * |
payload, |
|
|
size_t |
nSpl, |
|
|
enum cloudx1_SampleFormat |
fmt |
|
) |
| |
Convert floating-point array to payload
- Warning
- Input buffer must be 64-byte aligned
- Parameters
-
| input | audio input buffer (64 byte aligned) |
| payload | the binary raw audio buffer |
| nSpl | the number of samples (not frames) |
| fmt | the format of the payload |
◆ cloudx1_AudioMonoFromLiveStereo()
| void cloudx1_AudioMonoFromLiveStereo |
( |
const uint8_t * |
payload, |
|
|
float * |
output |
|
) |
| |
Convert Livewire Livestereo payload to floating-point Mono (12 samples)
- Parameters
-
| payload | Livewire Live Stereo raw buffer |
| output | audio output mono buffer (64 byte aligned) |
◆ cloudx1_AudioMonoToLiveStereo()
| void cloudx1_AudioMonoToLiveStereo |
( |
const float * |
input, |
|
|
uint8_t * |
payload |
|
) |
| |
Convert floating-point Mono (12 samples) to Livewire Livestereo payload
- Parameters
-
| input | audio input mono buffer (64 byte aligned) |
| payload | Livewire Live Stereo raw buffer |
◆ cloudx1_FreeAudioConverter()
◆ cloudx1_GetAudioConverter()
Prepare an audio converter for extract/insert and convert.
This helps to extract/insert a subset of channels from/to the payload, and convert it to floating-point format.
The floating-point channels count depends on target_mode. It can be the same as payload, or fixed to mono or stereo.
It can be used with cloudx1_AudioConverter_From and cloudx1_AudioConverter_To.
The converter will have to be freed with cloudx1_FreeAudioConverter.
- Parameters
-
| fmt | the format of the payload |
| nFrame | the number of frames per packet |
| payl_ch | the number of channels in the payload |
| payl_ch_offset | the offset of the first channel to extract/insert in the payload [must be <= (payload_channels-output_channels)] |
| target_mode | defines the number of channels in process, and the number of channels to extract from payload for mono<->stereo conversion |
- Returns
- The converter or null if not possible
- Note
- The converter is not multithread-safe, it uses internal cache buffers.
◆ cloudx1_MonoToStereo()
| void cloudx1_MonoToStereo |
( |
const float * |
input, |
|
|
float * |
output, |
|
|
size_t |
nFrame |
|
) |
| |
Convert floating-point Mono to Stereo (L,L)
- Warning
- Buffers must be 64-byte aligned
- Parameters
-
| input | audio input mono buffer (64 byte aligned) |
| output | audio output stereo buffer (64 byte aligned) |
| nFrame | the number of frames |
◆ cloudx1_MonoToStereo_Planar()
| void cloudx1_MonoToStereo_Planar |
( |
const float * |
input, |
|
|
float * |
outputL, |
|
|
float * |
outputR, |
|
|
size_t |
nFrame |
|
) |
| |
Convert floating-point Mono to Stereo (planar) (L,L)
- Warning
- Buffers must be 64-byte aligned
- Parameters
-
| input | audio input mono buffer (64 byte aligned) |
| outputL | audio output left buffer (64 byte aligned) |
| outputR | audio output right buffer (64 byte aligned) |
| nFrame | the number of frames |
◆ cloudx1_StereoToMono()
| void cloudx1_StereoToMono |
( |
const float * |
input, |
|
|
float * |
output, |
|
|
size_t |
nFrame |
|
) |
| |
Convert floating-point Stereo to Mono (L+R)/2
- Warning
- Buffers must be 64-byte aligned
- Parameters
-
| input | audio input stereo buffer (64 byte aligned) |
| output | audio output mono buffer (64 byte aligned) |
| nFrame | the number of frames |
◆ cloudx1_StereoToMono_Planar()
| void cloudx1_StereoToMono_Planar |
( |
const float * |
inputL, |
|
|
const float * |
inputR, |
|
|
float * |
output, |
|
|
size_t |
nFrame |
|
) |
| |
Convert floating-point Stereo (planar) to Mono (L+R)/2
- Warning
- Buffers must be 64-byte aligned
- Parameters
-
| inputL | audio input left buffer (64 byte aligned) |
| inputR | audio input right buffer (64 byte aligned) |
| output | audio output mono buffer (64 byte aligned) |
| nFrame | the number of frames |