mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-23 00:35:36 +00:00
Merge branch 'pulseaudio' of https://github.com/0joshuaolson1/libsoundio into v2
closes #96
This commit is contained in:
commit
369181fb9c
|
@ -23,7 +23,12 @@ set(LIBSOUNDIO_VERSION_PATCH 0)
|
|||
set(LIBSOUNDIO_VERSION "${LIBSOUNDIO_VERSION_MAJOR}.${LIBSOUNDIO_VERSION_MINOR}.${LIBSOUNDIO_VERSION_PATCH}")
|
||||
message("Configuring libsoundio version ${LIBSOUNDIO_VERSION}")
|
||||
|
||||
if(NOT SOUNDIO_STATIC_LIBNAME)
|
||||
set(SOUNDIO_STATIC_LIBNAME soundio)
|
||||
endif()
|
||||
|
||||
option(BUILD_STATIC_LIBS "Build static libraries" ON)
|
||||
option(BUILD_DYNAMIC_LIBS "Build dynamic libraries" ON)
|
||||
option(BUILD_EXAMPLE_PROGRAMS "Build example programs" ON)
|
||||
option(BUILD_TESTS "Build tests" ON)
|
||||
option(ENABLE_JACK "Enable JACK backend" ON)
|
||||
|
@ -218,22 +223,23 @@ configure_file(
|
|||
${DOXYGEN_CONF_FILE}
|
||||
)
|
||||
|
||||
add_library(libsoundio_shared SHARED ${LIBSOUNDIO_SOURCES})
|
||||
set_target_properties(libsoundio_shared PROPERTIES
|
||||
OUTPUT_NAME soundio
|
||||
SOVERSION ${LIBSOUNDIO_VERSION_MAJOR}
|
||||
VERSION ${LIBSOUNDIO_VERSION}
|
||||
COMPILE_FLAGS ${LIB_CFLAGS}
|
||||
LINKER_LANGUAGE C
|
||||
)
|
||||
target_link_libraries(libsoundio_shared LINK_PUBLIC ${LIBSOUNDIO_LIBS})
|
||||
install(TARGETS libsoundio_shared DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
if(BUILD_DYNAMIC_LIBS)
|
||||
add_library(libsoundio_shared SHARED ${LIBSOUNDIO_SOURCES})
|
||||
set_target_properties(libsoundio_shared PROPERTIES
|
||||
OUTPUT_NAME soundio
|
||||
SOVERSION ${LIBSOUNDIO_VERSION_MAJOR}
|
||||
VERSION ${LIBSOUNDIO_VERSION}
|
||||
COMPILE_FLAGS ${LIB_CFLAGS}
|
||||
LINKER_LANGUAGE C
|
||||
)
|
||||
target_link_libraries(libsoundio_shared LINK_PUBLIC ${LIBSOUNDIO_LIBS})
|
||||
install(TARGETS libsoundio_shared DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
if(BUILD_STATIC_LIBS)
|
||||
add_library(libsoundio_static STATIC ${LIBSOUNDIO_SOURCES})
|
||||
set_target_properties(libsoundio_static PROPERTIES
|
||||
OUTPUT_NAME soundio
|
||||
OUTPUT_NAME ${SOUNDIO_STATIC_LIBNAME}
|
||||
COMPILE_FLAGS ${LIB_CFLAGS}
|
||||
LINKER_LANGUAGE C
|
||||
)
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
# WASAPI_FOUND
|
||||
# AUDIOCLIENT_H
|
||||
|
||||
if (WIN32)
|
||||
include(CheckIncludeFile)
|
||||
check_include_file(audioclient.h AUDIOCLIENT_H)
|
||||
if(WIN32)
|
||||
include(CheckIncludeFile)
|
||||
check_include_file(audioclient.h AUDIOCLIENT_H)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(WASAPI DEFAULT_MSG AUDIOCLIENT_H)
|
||||
mark_as_advanced(AUDIOCLIENT_H)
|
||||
|
|
|
@ -22,6 +22,8 @@ static enum SoundIoFormat prioritized_formats[] = {
|
|||
SoundIoFormatS32FE,
|
||||
SoundIoFormatS24NE,
|
||||
SoundIoFormatS24FE,
|
||||
SoundIoFormatS24PackedNE,
|
||||
SoundIoFormatS24PackedFE,
|
||||
SoundIoFormatS16NE,
|
||||
SoundIoFormatS16FE,
|
||||
SoundIoFormatFloat64NE,
|
||||
|
@ -30,6 +32,8 @@ static enum SoundIoFormat prioritized_formats[] = {
|
|||
SoundIoFormatU32FE,
|
||||
SoundIoFormatU24NE,
|
||||
SoundIoFormatU24FE,
|
||||
SoundIoFormatU24PackedNE,
|
||||
SoundIoFormatU24PackedFE,
|
||||
SoundIoFormatU16NE,
|
||||
SoundIoFormatU16FE,
|
||||
SoundIoFormatS8,
|
||||
|
|
|
@ -25,6 +25,8 @@ static enum SoundIoFormat prioritized_formats[] = {
|
|||
SoundIoFormatS32FE,
|
||||
SoundIoFormatS24NE,
|
||||
SoundIoFormatS24FE,
|
||||
SoundIoFormatS24PackedNE,
|
||||
SoundIoFormatS24PackedFE,
|
||||
SoundIoFormatS16NE,
|
||||
SoundIoFormatS16FE,
|
||||
SoundIoFormatFloat64NE,
|
||||
|
@ -33,6 +35,8 @@ static enum SoundIoFormat prioritized_formats[] = {
|
|||
SoundIoFormatU32FE,
|
||||
SoundIoFormatU24NE,
|
||||
SoundIoFormatU24FE,
|
||||
SoundIoFormatU24PackedNE,
|
||||
SoundIoFormatU24PackedFE,
|
||||
SoundIoFormatU16NE,
|
||||
SoundIoFormatU16FE,
|
||||
SoundIoFormatS8,
|
||||
|
|
|
@ -234,24 +234,28 @@ enum SoundIoDeviceAim {
|
|||
/// which point to the respective SoundIoFormat values.
|
||||
enum SoundIoFormat {
|
||||
SoundIoFormatInvalid,
|
||||
SoundIoFormatS8, ///< Signed 8 bit
|
||||
SoundIoFormatU8, ///< Unsigned 8 bit
|
||||
SoundIoFormatS16LE, ///< Signed 16 bit Little Endian
|
||||
SoundIoFormatS16BE, ///< Signed 16 bit Big Endian
|
||||
SoundIoFormatU16LE, ///< Unsigned 16 bit Little Endian
|
||||
SoundIoFormatU16BE, ///< Unsigned 16 bit Little Endian
|
||||
SoundIoFormatS24LE, ///< Signed 24 bit Little Endian using low three bytes in 32-bit word
|
||||
SoundIoFormatS24BE, ///< Signed 24 bit Big Endian using low three bytes in 32-bit word
|
||||
SoundIoFormatU24LE, ///< Unsigned 24 bit Little Endian using low three bytes in 32-bit word
|
||||
SoundIoFormatU24BE, ///< Unsigned 24 bit Big Endian using low three bytes in 32-bit word
|
||||
SoundIoFormatS32LE, ///< Signed 32 bit Little Endian
|
||||
SoundIoFormatS32BE, ///< Signed 32 bit Big Endian
|
||||
SoundIoFormatU32LE, ///< Unsigned 32 bit Little Endian
|
||||
SoundIoFormatU32BE, ///< Unsigned 32 bit Big Endian
|
||||
SoundIoFormatFloat32LE, ///< Float 32 bit Little Endian, Range -1.0 to 1.0
|
||||
SoundIoFormatFloat32BE, ///< Float 32 bit Big Endian, Range -1.0 to 1.0
|
||||
SoundIoFormatFloat64LE, ///< Float 64 bit Little Endian, Range -1.0 to 1.0
|
||||
SoundIoFormatFloat64BE, ///< Float 64 bit Big Endian, Range -1.0 to 1.0
|
||||
SoundIoFormatS8, ///< Signed 8 bit
|
||||
SoundIoFormatU8, ///< Unsigned 8 bit
|
||||
SoundIoFormatS16LE, ///< Signed 16 bit Little Endian
|
||||
SoundIoFormatS16BE, ///< Signed 16 bit Big Endian
|
||||
SoundIoFormatU16LE, ///< Unsigned 16 bit Little Endian
|
||||
SoundIoFormatU16BE, ///< Unsigned 16 bit Little Endian
|
||||
SoundIoFormatS24LE, ///< Signed 24 bit Little Endian using low three bytes in 32-bit word
|
||||
SoundIoFormatS24BE, ///< Signed 24 bit Big Endian using low three bytes in 32-bit word
|
||||
SoundIoFormatU24LE, ///< Unsigned 24 bit Little Endian using low three bytes in 32-bit word
|
||||
SoundIoFormatU24BE, ///< Unsigned 24 bit Big Endian using low three bytes in 32-bit word
|
||||
SoundIoFormatS24PackedLE, ///< Signed 24 bit Little Endian using three bytes
|
||||
SoundIoFormatS24PackedBE, ///< Signed 24 bit Big Endian using three bytes
|
||||
SoundIoFormatU24PackedLE, ///< Unsigned 24 bit Little Endian using three bytes
|
||||
SoundIoFormatU24PackedBE, ///< Unsigned 24 bit Big Endian using three bytes
|
||||
SoundIoFormatS32LE, ///< Signed 32 bit Little Endian
|
||||
SoundIoFormatS32BE, ///< Signed 32 bit Big Endian
|
||||
SoundIoFormatU32LE, ///< Unsigned 32 bit Little Endian
|
||||
SoundIoFormatU32BE, ///< Unsigned 32 bit Big Endian
|
||||
SoundIoFormatFloat32LE, ///< Float 32 bit Little Endian, Range -1.0 to 1.0
|
||||
SoundIoFormatFloat32BE, ///< Float 32 bit Big Endian, Range -1.0 to 1.0
|
||||
SoundIoFormatFloat64LE, ///< Float 64 bit Little Endian, Range -1.0 to 1.0
|
||||
SoundIoFormatFloat64BE, ///< Float 64 bit Big Endian, Range -1.0 to 1.0
|
||||
};
|
||||
|
||||
#if defined(SOUNDIO_OS_BIG_ENDIAN)
|
||||
|
@ -259,6 +263,8 @@ enum SoundIoFormat {
|
|||
#define SoundIoFormatU16NE SoundIoFormatU16BE
|
||||
#define SoundIoFormatS24NE SoundIoFormatS24BE
|
||||
#define SoundIoFormatU24NE SoundIoFormatU24BE
|
||||
#define SoundIoFormatS24PackedNE SoundIoFormatS24PackedBE
|
||||
#define SoundIoFormatU24PackedNE SoundIoFormatU24PackedBE
|
||||
#define SoundIoFormatS32NE SoundIoFormatS32BE
|
||||
#define SoundIoFormatU32NE SoundIoFormatU32BE
|
||||
#define SoundIoFormatFloat32NE SoundIoFormatFloat32BE
|
||||
|
@ -268,6 +274,8 @@ enum SoundIoFormat {
|
|||
#define SoundIoFormatU16FE SoundIoFormatU16LE
|
||||
#define SoundIoFormatS24FE SoundIoFormatS24LE
|
||||
#define SoundIoFormatU24FE SoundIoFormatU24LE
|
||||
#define SoundIoFormatS24PackedFE SoundIoFormatS24PackedLE
|
||||
#define SoundIoFormatU24PackedFE SoundIoFormatU24PackedLE
|
||||
#define SoundIoFormatS32FE SoundIoFormatS32LE
|
||||
#define SoundIoFormatU32FE SoundIoFormatU32LE
|
||||
#define SoundIoFormatFloat32FE SoundIoFormatFloat32LE
|
||||
|
@ -283,6 +291,8 @@ enum SoundIoFormat {
|
|||
#define SoundIoFormatU16NE SoundIoFormatU16LE
|
||||
#define SoundIoFormatS24NE SoundIoFormatS24LE
|
||||
#define SoundIoFormatU24NE SoundIoFormatU24LE
|
||||
#define SoundIoFormatS24PackedNE SoundIoFormatS24PackedLE
|
||||
#define SoundIoFormatU24PackedNE SoundIoFormatU24PackedLE
|
||||
#define SoundIoFormatS32NE SoundIoFormatS32LE
|
||||
#define SoundIoFormatU32NE SoundIoFormatU32LE
|
||||
#define SoundIoFormatFloat32NE SoundIoFormatFloat32LE
|
||||
|
@ -292,6 +302,8 @@ enum SoundIoFormat {
|
|||
#define SoundIoFormatU16FE SoundIoFormatU16BE
|
||||
#define SoundIoFormatS24FE SoundIoFormatS24BE
|
||||
#define SoundIoFormatU24FE SoundIoFormatU24BE
|
||||
#define SoundIoFormatS24PackedFE SoundIoFormatS24PackedBE
|
||||
#define SoundIoFormatU24PackedFE SoundIoFormatU24PackedBE
|
||||
#define SoundIoFormatS32FE SoundIoFormatS32BE
|
||||
#define SoundIoFormatU32FE SoundIoFormatU32BE
|
||||
#define SoundIoFormatFloat32FE SoundIoFormatFloat32BE
|
||||
|
@ -946,7 +958,6 @@ SOUNDIO_EXPORT void soundio_outstream_destroy(struct SoundIoOutStream *outstream
|
|||
/// * #SoundIoErrorBackendDisconnected
|
||||
/// * #SoundIoErrorSystemResources
|
||||
/// * #SoundIoErrorNoSuchClient - when JACK returns `JackNoSuchClient`
|
||||
/// * #SoundIoErrorOpeningDevice
|
||||
/// * #SoundIoErrorIncompatibleBackend - SoundIoOutStream::channel_count is
|
||||
/// greater than the number of channels the backend can handle.
|
||||
/// * #SoundIoErrorIncompatibleDevice - stream parameters requested are not
|
||||
|
|
14
src/alsa.c
14
src/alsa.c
|
@ -236,6 +236,10 @@ static snd_pcm_format_t to_alsa_fmt(enum SoundIoFormat fmt) {
|
|||
case SoundIoFormatS24BE: return SND_PCM_FORMAT_S24_BE;
|
||||
case SoundIoFormatU24LE: return SND_PCM_FORMAT_U24_LE;
|
||||
case SoundIoFormatU24BE: return SND_PCM_FORMAT_U24_BE;
|
||||
case SoundIoFormatS24PackedLE: return SND_PCM_FORMAT_S24_3LE;
|
||||
case SoundIoFormatS24PackedBE: return SND_PCM_FORMAT_S24_3BE;
|
||||
case SoundIoFormatU24PackedLE: return SND_PCM_FORMAT_U24_3LE;
|
||||
case SoundIoFormatU24PackedBE: return SND_PCM_FORMAT_U24_3BE;
|
||||
case SoundIoFormatS32LE: return SND_PCM_FORMAT_S32_LE;
|
||||
case SoundIoFormatS32BE: return SND_PCM_FORMAT_S32_BE;
|
||||
case SoundIoFormatU32LE: return SND_PCM_FORMAT_U32_LE;
|
||||
|
@ -350,6 +354,10 @@ static int probe_open_device(struct SoundIoDevice *device, snd_pcm_t *handle, in
|
|||
snd_pcm_format_mask_set(fmt_mask, SND_PCM_FORMAT_S24_BE);
|
||||
snd_pcm_format_mask_set(fmt_mask, SND_PCM_FORMAT_U24_LE);
|
||||
snd_pcm_format_mask_set(fmt_mask, SND_PCM_FORMAT_U24_BE);
|
||||
snd_pcm_format_mask_set(fmt_mask, SND_PCM_FORMAT_S24_3LE);
|
||||
snd_pcm_format_mask_set(fmt_mask, SND_PCM_FORMAT_S24_3BE);
|
||||
snd_pcm_format_mask_set(fmt_mask, SND_PCM_FORMAT_U24_3LE);
|
||||
snd_pcm_format_mask_set(fmt_mask, SND_PCM_FORMAT_U24_3BE);
|
||||
snd_pcm_format_mask_set(fmt_mask, SND_PCM_FORMAT_S32_LE);
|
||||
snd_pcm_format_mask_set(fmt_mask, SND_PCM_FORMAT_S32_BE);
|
||||
snd_pcm_format_mask_set(fmt_mask, SND_PCM_FORMAT_U32_LE);
|
||||
|
@ -364,7 +372,7 @@ static int probe_open_device(struct SoundIoDevice *device, snd_pcm_t *handle, in
|
|||
|
||||
if (!device->formats) {
|
||||
snd_pcm_hw_params_get_format_mask(hwparams, fmt_mask);
|
||||
device->formats = ALLOCATE(enum SoundIoFormat, 18);
|
||||
device->formats = ALLOCATE(enum SoundIoFormat, 22);
|
||||
if (!device->formats)
|
||||
return SoundIoErrorNoMem;
|
||||
|
||||
|
@ -379,6 +387,10 @@ static int probe_open_device(struct SoundIoDevice *device, snd_pcm_t *handle, in
|
|||
test_fmt_mask(device, fmt_mask, SoundIoFormatS24BE);
|
||||
test_fmt_mask(device, fmt_mask, SoundIoFormatU24LE);
|
||||
test_fmt_mask(device, fmt_mask, SoundIoFormatU24BE);
|
||||
test_fmt_mask(device, fmt_mask, SoundIoFormatS24PackedLE);
|
||||
test_fmt_mask(device, fmt_mask, SoundIoFormatS24PackedBE);
|
||||
test_fmt_mask(device, fmt_mask, SoundIoFormatU24PackedLE);
|
||||
test_fmt_mask(device, fmt_mask, SoundIoFormatU24PackedBE);
|
||||
test_fmt_mask(device, fmt_mask, SoundIoFormatS32LE);
|
||||
test_fmt_mask(device, fmt_mask, SoundIoFormatS32BE);
|
||||
test_fmt_mask(device, fmt_mask, SoundIoFormatU32LE);
|
||||
|
|
22
src/dummy.c
22
src/dummy.c
|
@ -380,7 +380,7 @@ static int instream_get_latency_dummy(struct SoundIoPrivate *si, struct SoundIoI
|
|||
}
|
||||
|
||||
static int set_all_device_formats(struct SoundIoDevice *device) {
|
||||
device->format_count = 18;
|
||||
device->format_count = 22;
|
||||
device->formats = ALLOCATE(enum SoundIoFormat, device->format_count);
|
||||
if (!device->formats)
|
||||
return SoundIoErrorNoMem;
|
||||
|
@ -395,14 +395,18 @@ static int set_all_device_formats(struct SoundIoDevice *device) {
|
|||
device->formats[7] = SoundIoFormatS24FE;
|
||||
device->formats[8] = SoundIoFormatU24NE;
|
||||
device->formats[9] = SoundIoFormatU24FE;
|
||||
device->formats[10] = SoundIoFormatFloat64NE;
|
||||
device->formats[11] = SoundIoFormatFloat64FE;
|
||||
device->formats[12] = SoundIoFormatS16NE;
|
||||
device->formats[13] = SoundIoFormatS16FE;
|
||||
device->formats[14] = SoundIoFormatU16NE;
|
||||
device->formats[15] = SoundIoFormatU16FE;
|
||||
device->formats[16] = SoundIoFormatS8;
|
||||
device->formats[17] = SoundIoFormatU8;
|
||||
device->formats[10] = SoundIoFormatS24PackedNE;
|
||||
device->formats[11] = SoundIoFormatS24PackedFE;
|
||||
device->formats[12] = SoundIoFormatU24PackedNE;
|
||||
device->formats[13] = SoundIoFormatU24PackedFE;
|
||||
device->formats[14] = SoundIoFormatFloat64NE;
|
||||
device->formats[15] = SoundIoFormatFloat64FE;
|
||||
device->formats[16] = SoundIoFormatS16NE;
|
||||
device->formats[17] = SoundIoFormatS16FE;
|
||||
device->formats[18] = SoundIoFormatU16NE;
|
||||
device->formats[19] = SoundIoFormatU16FE;
|
||||
device->formats[20] = SoundIoFormatS8;
|
||||
device->formats[21] = SoundIoFormatU8;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -101,13 +101,13 @@ static enum SoundIoFormat from_pulseaudio_format(pa_sample_spec sample_spec) {
|
|||
case PA_SAMPLE_S32BE: return SoundIoFormatS32BE;
|
||||
case PA_SAMPLE_S24_32LE: return SoundIoFormatS24LE;
|
||||
case PA_SAMPLE_S24_32BE: return SoundIoFormatS24BE;
|
||||
case PA_SAMPLE_S24LE: return SoundIoFormatS24PackedLE;
|
||||
case PA_SAMPLE_S24BE: return SoundIoFormatS24PackedBE;
|
||||
|
||||
case PA_SAMPLE_MAX:
|
||||
case PA_SAMPLE_INVALID:
|
||||
case PA_SAMPLE_ALAW:
|
||||
case PA_SAMPLE_ULAW:
|
||||
case PA_SAMPLE_S24LE:
|
||||
case PA_SAMPLE_S24BE:
|
||||
return SoundIoFormatInvalid;
|
||||
}
|
||||
return SoundIoFormatInvalid;
|
||||
|
@ -183,7 +183,7 @@ static int set_all_device_channel_layouts(struct SoundIoDevice *device) {
|
|||
}
|
||||
|
||||
static int set_all_device_formats(struct SoundIoDevice *device) {
|
||||
device->format_count = 9;
|
||||
device->format_count = 11;
|
||||
device->formats = ALLOCATE(enum SoundIoFormat, device->format_count);
|
||||
if (!device->formats)
|
||||
return SoundIoErrorNoMem;
|
||||
|
@ -196,6 +196,8 @@ static int set_all_device_formats(struct SoundIoDevice *device) {
|
|||
device->formats[6] = SoundIoFormatS32BE;
|
||||
device->formats[7] = SoundIoFormatS24LE;
|
||||
device->formats[8] = SoundIoFormatS24BE;
|
||||
device->formats[9] = SoundIoFormatS24PackedLE;
|
||||
device->formats[10] = SoundIoFormatS24PackedBE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -513,15 +515,17 @@ static void force_device_scan_pa(struct SoundIoPrivate *si) {
|
|||
|
||||
static pa_sample_format_t to_pulseaudio_format(enum SoundIoFormat format) {
|
||||
switch (format) {
|
||||
case SoundIoFormatU8: return PA_SAMPLE_U8;
|
||||
case SoundIoFormatS16LE: return PA_SAMPLE_S16LE;
|
||||
case SoundIoFormatS16BE: return PA_SAMPLE_S16BE;
|
||||
case SoundIoFormatS24LE: return PA_SAMPLE_S24_32LE;
|
||||
case SoundIoFormatS24BE: return PA_SAMPLE_S24_32BE;
|
||||
case SoundIoFormatS32LE: return PA_SAMPLE_S32LE;
|
||||
case SoundIoFormatS32BE: return PA_SAMPLE_S32BE;
|
||||
case SoundIoFormatFloat32LE: return PA_SAMPLE_FLOAT32LE;
|
||||
case SoundIoFormatFloat32BE: return PA_SAMPLE_FLOAT32BE;
|
||||
case SoundIoFormatU8: return PA_SAMPLE_U8;
|
||||
case SoundIoFormatS16LE: return PA_SAMPLE_S16LE;
|
||||
case SoundIoFormatS16BE: return PA_SAMPLE_S16BE;
|
||||
case SoundIoFormatS24LE: return PA_SAMPLE_S24_32LE;
|
||||
case SoundIoFormatS24BE: return PA_SAMPLE_S24_32BE;
|
||||
case SoundIoFormatS24PackedLE: return PA_SAMPLE_S24LE;
|
||||
case SoundIoFormatS24PackedBE: return PA_SAMPLE_S24BE;
|
||||
case SoundIoFormatS32LE: return PA_SAMPLE_S32LE;
|
||||
case SoundIoFormatS32BE: return PA_SAMPLE_S32BE;
|
||||
case SoundIoFormatFloat32LE: return PA_SAMPLE_FLOAT32LE;
|
||||
case SoundIoFormatFloat32BE: return PA_SAMPLE_FLOAT32BE;
|
||||
|
||||
case SoundIoFormatInvalid:
|
||||
case SoundIoFormatS8:
|
||||
|
@ -529,6 +533,8 @@ static pa_sample_format_t to_pulseaudio_format(enum SoundIoFormat format) {
|
|||
case SoundIoFormatU16BE:
|
||||
case SoundIoFormatU24LE:
|
||||
case SoundIoFormatU24BE:
|
||||
case SoundIoFormatU24PackedLE:
|
||||
case SoundIoFormatU24PackedBE:
|
||||
case SoundIoFormatU32LE:
|
||||
case SoundIoFormatU32BE:
|
||||
case SoundIoFormatFloat64LE:
|
||||
|
|
|
@ -97,24 +97,28 @@ const char *soundio_strerror(int error) {
|
|||
|
||||
int soundio_get_bytes_per_sample(enum SoundIoFormat format) {
|
||||
switch (format) {
|
||||
case SoundIoFormatU8: return 1;
|
||||
case SoundIoFormatS8: return 1;
|
||||
case SoundIoFormatS16LE: return 2;
|
||||
case SoundIoFormatS16BE: return 2;
|
||||
case SoundIoFormatU16LE: return 2;
|
||||
case SoundIoFormatU16BE: return 2;
|
||||
case SoundIoFormatS24LE: return 4;
|
||||
case SoundIoFormatS24BE: return 4;
|
||||
case SoundIoFormatU24LE: return 4;
|
||||
case SoundIoFormatU24BE: return 4;
|
||||
case SoundIoFormatS32LE: return 4;
|
||||
case SoundIoFormatS32BE: return 4;
|
||||
case SoundIoFormatU32LE: return 4;
|
||||
case SoundIoFormatU32BE: return 4;
|
||||
case SoundIoFormatFloat32LE: return 4;
|
||||
case SoundIoFormatFloat32BE: return 4;
|
||||
case SoundIoFormatFloat64LE: return 8;
|
||||
case SoundIoFormatFloat64BE: return 8;
|
||||
case SoundIoFormatU8: return 1;
|
||||
case SoundIoFormatS8: return 1;
|
||||
case SoundIoFormatS16LE: return 2;
|
||||
case SoundIoFormatS16BE: return 2;
|
||||
case SoundIoFormatU16LE: return 2;
|
||||
case SoundIoFormatU16BE: return 2;
|
||||
case SoundIoFormatS24LE: return 4;
|
||||
case SoundIoFormatS24BE: return 4;
|
||||
case SoundIoFormatU24LE: return 4;
|
||||
case SoundIoFormatU24BE: return 4;
|
||||
case SoundIoFormatS24PackedLE: return 3;
|
||||
case SoundIoFormatS24PackedBE: return 3;
|
||||
case SoundIoFormatU24PackedLE: return 3;
|
||||
case SoundIoFormatU24PackedBE: return 3;
|
||||
case SoundIoFormatS32LE: return 4;
|
||||
case SoundIoFormatS32BE: return 4;
|
||||
case SoundIoFormatU32LE: return 4;
|
||||
case SoundIoFormatU32BE: return 4;
|
||||
case SoundIoFormatFloat32LE: return 4;
|
||||
case SoundIoFormatFloat32BE: return 4;
|
||||
case SoundIoFormatFloat64LE: return 8;
|
||||
case SoundIoFormatFloat64BE: return 8;
|
||||
|
||||
case SoundIoFormatInvalid: return -1;
|
||||
}
|
||||
|
@ -123,24 +127,28 @@ int soundio_get_bytes_per_sample(enum SoundIoFormat format) {
|
|||
|
||||
const char * soundio_format_string(enum SoundIoFormat format) {
|
||||
switch (format) {
|
||||
case SoundIoFormatS8: return "signed 8-bit";
|
||||
case SoundIoFormatU8: return "unsigned 8-bit";
|
||||
case SoundIoFormatS16LE: return "signed 16-bit LE";
|
||||
case SoundIoFormatS16BE: return "signed 16-bit BE";
|
||||
case SoundIoFormatU16LE: return "unsigned 16-bit LE";
|
||||
case SoundIoFormatU16BE: return "unsigned 16-bit LE";
|
||||
case SoundIoFormatS24LE: return "signed 24-bit LE";
|
||||
case SoundIoFormatS24BE: return "signed 24-bit BE";
|
||||
case SoundIoFormatU24LE: return "unsigned 24-bit LE";
|
||||
case SoundIoFormatU24BE: return "unsigned 24-bit BE";
|
||||
case SoundIoFormatS32LE: return "signed 32-bit LE";
|
||||
case SoundIoFormatS32BE: return "signed 32-bit BE";
|
||||
case SoundIoFormatU32LE: return "unsigned 32-bit LE";
|
||||
case SoundIoFormatU32BE: return "unsigned 32-bit BE";
|
||||
case SoundIoFormatFloat32LE: return "float 32-bit LE";
|
||||
case SoundIoFormatFloat32BE: return "float 32-bit BE";
|
||||
case SoundIoFormatFloat64LE: return "float 64-bit LE";
|
||||
case SoundIoFormatFloat64BE: return "float 64-bit BE";
|
||||
case SoundIoFormatS8: return "signed 8-bit";
|
||||
case SoundIoFormatU8: return "unsigned 8-bit";
|
||||
case SoundIoFormatS16LE: return "signed 16-bit LE";
|
||||
case SoundIoFormatS16BE: return "signed 16-bit BE";
|
||||
case SoundIoFormatU16LE: return "unsigned 16-bit LE";
|
||||
case SoundIoFormatU16BE: return "unsigned 16-bit LE";
|
||||
case SoundIoFormatS24LE: return "signed 24-bit LE";
|
||||
case SoundIoFormatS24BE: return "signed 24-bit BE";
|
||||
case SoundIoFormatU24LE: return "unsigned 24-bit LE";
|
||||
case SoundIoFormatU24BE: return "unsigned 24-bit BE";
|
||||
case SoundIoFormatS24PackedLE: return "signed 24-bit packed LE";
|
||||
case SoundIoFormatS24PackedBE: return "signed 24-bit packed BE";
|
||||
case SoundIoFormatU24PackedLE: return "unsigned 24-bit packed LE";
|
||||
case SoundIoFormatU24PackedBE: return "unsigned 24-bit packed BE";
|
||||
case SoundIoFormatS32LE: return "signed 32-bit LE";
|
||||
case SoundIoFormatS32BE: return "signed 32-bit BE";
|
||||
case SoundIoFormatU32LE: return "unsigned 32-bit LE";
|
||||
case SoundIoFormatU32BE: return "unsigned 32-bit BE";
|
||||
case SoundIoFormatFloat32LE: return "float 32-bit LE";
|
||||
case SoundIoFormatFloat32BE: return "float 32-bit BE";
|
||||
case SoundIoFormatFloat64LE: return "float 64-bit LE";
|
||||
case SoundIoFormatFloat64BE: return "float 64-bit BE";
|
||||
|
||||
case SoundIoFormatInvalid:
|
||||
return "(invalid sample format)";
|
||||
|
|
|
@ -21,6 +21,8 @@ static enum SoundIoFormat prioritized_formats[] = {
|
|||
SoundIoFormatS32FE,
|
||||
SoundIoFormatS24NE,
|
||||
SoundIoFormatS24FE,
|
||||
SoundIoFormatS24PackedNE,
|
||||
SoundIoFormatS24PackedFE,
|
||||
SoundIoFormatS16NE,
|
||||
SoundIoFormatS16FE,
|
||||
SoundIoFormatFloat64NE,
|
||||
|
@ -29,6 +31,8 @@ static enum SoundIoFormat prioritized_formats[] = {
|
|||
SoundIoFormatU32FE,
|
||||
SoundIoFormatU24NE,
|
||||
SoundIoFormatU24FE,
|
||||
SoundIoFormatU24PackedNE,
|
||||
SoundIoFormatU24PackedFE,
|
||||
SoundIoFormatU16NE,
|
||||
SoundIoFormatU16FE,
|
||||
SoundIoFormatS8,
|
||||
|
|
Loading…
Reference in a new issue