From: Seungbae Shin Date: Tue, 25 Oct 2016 06:26:42 +0000 (+0900) Subject: [ACR-1434] Extend channel and format parameters X-Git-Tag: submit/tizen/20190812.051439^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27827eedcd10f54d0d04b850ab7c9bff3effa6d8;p=platform%2Fcore%2Fapi%2Faudio-io.git [ACR-1434] Extend channel and format parameters - support multi-channels (3~8) for recording only - support S32LE format type Change-Id: I5b31a7db0cfecec1d118621ed1ef4014805b6334 --- diff --git a/include/CAudioInfo.h b/include/CAudioInfo.h index ac75c64..39b051b 100644 --- a/include/CAudioInfo.h +++ b/include/CAudioInfo.h @@ -37,6 +37,12 @@ namespace tizen_media_audio { enum class EChannel : unsigned int { CHANNEL_MONO = 1, /**< 1 channel, mono */ CHANNEL_STEREO, /**< 2 channel, stereo */ + CHANNEL_MULTI_3, /**< 3 channel */ + CHANNEL_MULTI_4, /**< 4 channel */ + CHANNEL_MULTI_5, /**< 5 channel */ + CHANNEL_MULTI_6, /**< 6 channel */ + CHANNEL_MULTI_7, /**< 7 channel */ + CHANNEL_MULTI_8, /**< 8 channel */ CHANNEL_MAX }; @@ -45,6 +51,7 @@ namespace tizen_media_audio { SAMPLE_TYPE_S16_LE, /**< Signed 16-bit audio samples */ SAMPLE_TYPE_S24_LE, /**< Signed 24-bit audio samples */ SAMPLE_TYPE_S24_32_LE, /**< Signed 24-bit packed in 32-bit audio samples */ + SAMPLE_TYPE_S32_LE, /**< Signed 32-bit audio samples */ SAMPLE_TYPE_MAX }; diff --git a/include/audio_io.h b/include/audio_io.h index 85ea8cb..9e8ff66 100644 --- a/include/audio_io.h +++ b/include/audio_io.h @@ -74,6 +74,7 @@ typedef enum { AUDIO_SAMPLE_TYPE_S16_LE, /**< Signed 16-bit audio samples */ AUDIO_SAMPLE_TYPE_S24_LE, /**< Signed 24-bit audio samples (Since 5.0) */ AUDIO_SAMPLE_TYPE_S24_32_LE, /**< Signed 24-bit (packed in 32-bit) audio samples (Since 5.0) */ + AUDIO_SAMPLE_TYPE_S32_LE, /**< Signed 32-bit audio samples (Since 5.5) */ } audio_sample_type_e; /** @@ -81,8 +82,14 @@ typedef enum { * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { - AUDIO_CHANNEL_MONO = 0x80, /**< 1 channel, mono */ - AUDIO_CHANNEL_STEREO, /**< 2 channel, stereo */ + AUDIO_CHANNEL_MONO = 0x80, /**< 1 channel, mono */ + AUDIO_CHANNEL_STEREO, /**< 2 channels, stereo */ + AUDIO_CHANNEL_MULTI_3, /**< 3 channels (Since 5.5) */ + AUDIO_CHANNEL_MULTI_4, /**< 4 channels (Since 5.5) */ + AUDIO_CHANNEL_MULTI_5, /**< 5 channels (Since 5.5) */ + AUDIO_CHANNEL_MULTI_6, /**< 6 channels (Since 5.5) */ + AUDIO_CHANNEL_MULTI_7, /**< 7 channels (Since 5.5) */ + AUDIO_CHANNEL_MULTI_8, /**< 8 channels (Since 5.5) */ } audio_channel_e; /** @@ -129,7 +136,7 @@ typedef enum { * * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * - * @remarks @a use audio_in_peek() to get audio in data inside callback, use audio_in_drop() after use of peeked data. + * @remarks Use audio_in_peek() to get audio in data inside callback, use audio_in_drop() after use of peeked data. * * @param[in] handle The handle to the audio input * @param[in] nbytes The amount of available audio in data which can be peeked. @@ -165,10 +172,18 @@ typedef void (*audio_in_state_changed_cb)(audio_in_h handle, audio_io_state_e pr * @privilege %http://tizen.org/privilege/recorder * * @remarks @a input must be released using audio_in_destroy(). - * - * @param[in] sample_rate The audio sample rate in 8000[Hz] ~ 48000[Hz] (Before 5.0), 8000[Hz] ~ 192000[Hz] (Since 5.0) - * @param[in] channel The audio channel type (mono or stereo) - * @param[in] type The type of audio sample (8- or 16-bit) + * If the channel count of the requested @a channel is different from the system's supported channel count, then channel remapping will be processed internally. + * + * @param[in] sample_rate The audio sample rate \n + * Before 5.0: 8000[Hz] ~ 48000[Hz] \n + * Since 5.0: 8000[Hz] ~ 192000[Hz] + * @param[in] channel The audio channel type \n + * Before 5.5: Mono or stereo \n + * Since 5.5: Mono, stereo or multi-channels + * @param[in] type The type of audio sample \n + * Before 5.0: 8 or 16-bit \n + * Since 5.0: 8, 16 or 24-bit \n + * Since 5.5: 8, 16, 24 or 32-bit * @param[out] input An audio input handle is created on success * @return @c 0 on success, * otherwise a negative error value @@ -208,7 +223,7 @@ int audio_in_destroy(audio_in_h input); * * @since_tizen 3.0 * - * @remarks @a the sound stream information includes audio routing and volume type. + * @remarks The sound stream information includes audio routing and volume type. * For more details, you can refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE * System, Alarm, Notification, Emergency, Voice Information, Ringtone VOIP and Ringtone Call stream types are not supported in this API. * @@ -364,7 +379,9 @@ int audio_in_get_buffer_size(audio_in_h input, int *size); * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] input The handle to the audio input - * @param[out] sample_rate The audio sample rate in Hertz (8000 ~ 48000) (Before 5.0), (8000 ~ 192000) (Since 5.0) + * @param[out] sample_rate The audio sample rate \n + * Before 5.0: 8000[Hz] ~ 48000[Hz] \n + * Since 5.0: 8000[Hz] ~ 192000[Hz] * @return @c 0 on success, * otherwise a negative error value * @retval #AUDIO_IO_ERROR_NONE Successful @@ -376,12 +393,12 @@ int audio_in_get_sample_rate(audio_in_h input, int *sample_rate); /** * @brief Gets the channel type of the audio input data stream. * - * @details The audio channel type defines whether the audio is mono or stereo. - * * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] input The handle to the audio input - * @param[out] channel The audio channel type + * @param[out] channel The audio channel type \n + * Before 5.5: Mono or stereo \n + * Since 5.5: Mono, stereo or multi-channels * @return @c 0 on success, * otherwise a negative error value * @retval #AUDIO_IO_ERROR_NONE Successful @@ -391,12 +408,15 @@ int audio_in_get_sample_rate(audio_in_h input, int *sample_rate); int audio_in_get_channel(audio_in_h input, audio_channel_e *channel); /** - * @brief Gets the sample audio format (8-bit or 16-bit) of the audio input data stream. + * @brief Gets the sample audio format of the audio input data stream. * * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] input The handle to the audio input - * @param[out] type The audio sample type + * @param[out] type The type of audio sample \n + * Before 5.0: 8 or 16-bit \n + * Since 5.0: 8, 16 or 24-bit \n + * Since 5.5: 8, 16, 24 or 32-bit * @return @c 0 on success, * otherwise a negative error value * @retval #AUDIO_IO_ERROR_NONE Successful @@ -410,7 +430,7 @@ int audio_in_get_sample_type(audio_in_h input, audio_sample_type_e *type); * * @details @a callback will be called when you can read a PCM data. * It might cause dead lock if change the state of audio handle in callback. - * (ex: audio_in_destroy, audio_in_prepare, audio_in_unprepare) + * (ex: audio_in_destroy(), audio_in_prepare(), audio_in_unprepare()) * Recommend to use as a VOIP only. * Recommend not to hold callback too long.(it affects latency) * @@ -452,13 +472,13 @@ int audio_in_set_stream_cb(audio_in_h input, audio_in_stream_cb callback, void* int audio_in_unset_stream_cb(audio_in_h input); /** - * @brief peek from audio in buffer + * @brief peeks from audio in buffer. * * @details This function works correctly only with read, write callback. Otherwise it won't operate as intended. * * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * - * @remarks @a Works only in asynchronous(event) mode. This will just retrieve buffer pointer from audio in buffer. Drop after use. + * @remarks Works only in asynchronous(event) mode. This will just retrieve buffer pointer from audio in buffer. Drop after use. * * @param[in] input The handle to the audio input * @param[out] buffer start buffer pointer of peeked audio in data @@ -477,13 +497,13 @@ int audio_in_unset_stream_cb(audio_in_h input); int audio_in_peek(audio_in_h input, const void **buffer, unsigned int *length); /** - * @brief drop peeked audio buffer. + * @brief Drops peeked audio buffer. * * @details This function works correctly only with read, write callback. Otherwise it won't operate as intended. * * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * - * @remarks @a Works only in asynchronous(event) mode. This will remove audio in data from actual stream buffer. Use this if peeked data is not needed anymore. + * @remarks Works only in asynchronous(event) mode. This will remove audio in data from actual stream buffer. Use this if peeked data is not needed anymore. * * @param[in] input The handle to the audio input * @return 0 on success, otherwise a negative error value @@ -548,7 +568,7 @@ int audio_in_unset_state_changed_cb(audio_in_h input); * * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * - * @remarks @a use audio_out_write() to write pcm data inside this callback. + * @remarks Use audio_out_write() to write pcm data inside this callback. * @param[in] handle The handle to the audio output * @param[in] nbytes The amount of audio in data which can be written. * @param[in] user_data The user data passed from the callback registration function @@ -582,10 +602,16 @@ typedef void (*audio_out_state_changed_cb)(audio_out_h handle, audio_io_state_e * * @remarks @a output must be released by audio_out_destroy(). * It is recommended to call audio_out_set_sound_stream_info() after this API. + * Multi-channel playback is not supported. * - * @param[in] sample_rate The audio sample rate in 8000[Hz] ~ 48000[Hz] (Before 5.0), 8000[Hz] ~ 192000[Hz] (Since 5.0) + * @param[in] sample_rate The audio sample rate \n + * Before 5.0: 8000[Hz] ~ 48000[Hz] \n + * Since 5.0: 8000[Hz] ~ 192000[Hz] * @param[in] channel The audio channel type (mono or stereo) - * @param[in] type The type of audio sample (8-bit or 16-bit) + * @param[in] type The type of audio sample \n + * Before 5.0: 8 or 16-bit \n + * Since 5.0: 8, 16 or 24-bit \n + * Since 5.5: 8, 16, 24 or 32-bit * @param[out] output An audio output handle is created on success * @return @c 0 on success, * otherwise a negative error value @@ -623,7 +649,7 @@ int audio_out_destroy(audio_out_h output); * * @since_tizen 3.0 * - * @remarks @a the sound stream information includes audio routing and volume type. + * @remarks The sound stream information includes audio routing and volume type. * For more details, you can refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE * Voice Recognition and Loopback stream types are not supported in this API. * @@ -792,7 +818,9 @@ int audio_out_get_buffer_size(audio_out_h output, int *size); * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] output The handle to the audio output - * @param[out] sample_rate The audio sample rate in Hertz (8000 ~ 48000) (Before 5.0), (8000 ~ 192000) (Since 5.0) + * @param[out] sample_rate The audio sample rate \n + * Before 5.0: 8000[Hz] ~ 48000[Hz] \n + * Since 5.0: 8000[Hz] ~ 192000[Hz] * @return @c 0 on success, * otherwise a negative error value * @retval #AUDIO_IO_ERROR_NONE Successful @@ -803,12 +831,10 @@ int audio_out_get_sample_rate(audio_out_h output, int *sample_rate); /** * @brief Gets the channel type of the audio output data stream. * - * @details The audio channel type defines whether the audio is mono or stereo. - * * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] output The handle to the audio output - * @param[out] channel The audio channel type + * @param[out] channel The audio channel type (mono or stereo) * @return @c 0 on success, * otherwise a negative error value * @retval #AUDIO_IO_ERROR_NONE Successful @@ -817,12 +843,15 @@ int audio_out_get_sample_rate(audio_out_h output, int *sample_rate); int audio_out_get_channel(audio_out_h output, audio_channel_e *channel); /** - * @brief Gets the sample audio format (8-bit or 16-bit) of the audio output data stream. + * @brief Gets the sample audio format of the audio output data stream. * * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] output The handle to the audio output - * @param[out] type The audio sample type + * @param[out] type The type of audio sample \n + * Before 5.0: 8 or 16-bit \n + * Since 5.0: 8, 16 or 24-bit \n + * Since 5.5: 8, 16, 24 or 32-bit * @return @c 0 on success, * otherwise a negative error value * @retval #AUDIO_IO_ERROR_NONE Successful @@ -849,7 +878,7 @@ int audio_out_get_sound_type(audio_out_h output, sound_type_e *type); * * @details @a callback will be called when you can write a PCM data. * It might cause dead lock if change the state of audio handle in callback. - * (ex: audio_out_destroy, audio_out_prepare, audio_out_unprepare) + * (ex: audio_out_destroy(), audio_out_prepare(), audio_out_unprepare()) * Recommend to use as a VOIP only. * Recommend not to hold callback too long.(it affects latency) * diff --git a/src/cpp/CAudioInfo.cpp b/src/cpp/CAudioInfo.cpp index c02f0f4..997348f 100644 --- a/src/cpp/CAudioInfo.cpp +++ b/src/cpp/CAudioInfo.cpp @@ -90,7 +90,6 @@ void CAudioInfo::setAudioIndex(int audioIndex) { int CAudioInfo::getSampleSize() { int bytes_in_sample = 0; - int number_of_channel = 0; switch (__mSampleType) { case ESampleType::SAMPLE_TYPE_U8: @@ -103,6 +102,7 @@ int CAudioInfo::getSampleSize() { bytes_in_sample = 3; break; case ESampleType::SAMPLE_TYPE_S24_32_LE: + case ESampleType::SAMPLE_TYPE_S32_LE: bytes_in_sample = 4; break; default: @@ -111,20 +111,7 @@ int CAudioInfo::getSampleSize() { break; } - switch (__mChannel) { - case EChannel::CHANNEL_MONO: - number_of_channel = 1; - break; - case EChannel::CHANNEL_STEREO: - number_of_channel = 2; - break; - default: - AUDIO_IO_LOGW("As unrecognized channel %d, let's assume STEREO", static_cast(__mChannel)); - number_of_channel = 2; - break; - } - - return bytes_in_sample * number_of_channel; + return bytes_in_sample * static_cast(__mChannel); } void CAudioInfo::convertAudioType2StreamType(CAudioInfo::EAudioType audioType, char **streamType) { diff --git a/src/cpp/CPulseStreamSpec.cpp b/src/cpp/CPulseStreamSpec.cpp index 2702130..def1833 100644 --- a/src/cpp/CPulseStreamSpec.cpp +++ b/src/cpp/CPulseStreamSpec.cpp @@ -74,16 +74,7 @@ void CPulseStreamSpec::__adjustSpec() { __mSampleSpec.rate = __mAudioInfo.getSampleRate(); // Convert channels for PA - switch (__mAudioInfo.getChannel()) { - case CAudioInfo::EChannel::CHANNEL_MONO: - __mSampleSpec.channels = 1; - break; - - case CAudioInfo::EChannel::CHANNEL_STEREO: - default: - __mSampleSpec.channels = 2; - break; - } + __mSampleSpec.channels = static_cast(__mAudioInfo.getChannel()); // Convert format for PA switch (__mAudioInfo.getSampleType()) { @@ -103,13 +94,17 @@ void CPulseStreamSpec::__adjustSpec() { __mSampleSpec.format = PA_SAMPLE_S24_32LE; break; + case CAudioInfo::ESampleType::SAMPLE_TYPE_S32_LE: + __mSampleSpec.format = PA_SAMPLE_S32LE; + break; + default: __mSampleSpec.format = PA_SAMPLE_S16LE; break; } // Sets channelmap - pa_channel_map_init_auto(&__mChannelMap, __mSampleSpec.channels, PA_CHANNEL_MAP_ALSA); + pa_channel_map_init_extend(&__mChannelMap, __mSampleSpec.channels, PA_CHANNEL_MAP_ALSA); // Sets stream name switch (__mLatency) { diff --git a/src/cpp/cpp_audio_io.cpp b/src/cpp/cpp_audio_io.cpp index 3115fda..d23f26f 100644 --- a/src/cpp/cpp_audio_io.cpp +++ b/src/cpp/cpp_audio_io.cpp @@ -144,6 +144,24 @@ static void __convert_channel_2_audio_info_channel(const audio_channel_e& src_ch case AUDIO_CHANNEL_STEREO: dst_channel = CAudioInfo::EChannel::CHANNEL_STEREO; break; + case AUDIO_CHANNEL_MULTI_3: + dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_3; + break; + case AUDIO_CHANNEL_MULTI_4: + dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_4; + break; + case AUDIO_CHANNEL_MULTI_5: + dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_5; + break; + case AUDIO_CHANNEL_MULTI_6: + dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_6; + break; + case AUDIO_CHANNEL_MULTI_7: + dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_7; + break; + case AUDIO_CHANNEL_MULTI_8: + dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_8; + break; default: dst_channel = CAudioInfo::EChannel::CHANNEL_MONO; break; @@ -159,6 +177,24 @@ static void __convert_audio_info_channel_2_channel(const CAudioInfo::EChannel& s case CAudioInfo::EChannel::CHANNEL_STEREO: dst_channel = AUDIO_CHANNEL_STEREO; break; + case CAudioInfo::EChannel::CHANNEL_MULTI_3: + dst_channel = AUDIO_CHANNEL_MULTI_3; + break; + case CAudioInfo::EChannel::CHANNEL_MULTI_4: + dst_channel = AUDIO_CHANNEL_MULTI_4; + break; + case CAudioInfo::EChannel::CHANNEL_MULTI_5: + dst_channel = AUDIO_CHANNEL_MULTI_5; + break; + case CAudioInfo::EChannel::CHANNEL_MULTI_6: + dst_channel = AUDIO_CHANNEL_MULTI_6; + break; + case CAudioInfo::EChannel::CHANNEL_MULTI_7: + dst_channel = AUDIO_CHANNEL_MULTI_7; + break; + case CAudioInfo::EChannel::CHANNEL_MULTI_8: + dst_channel = AUDIO_CHANNEL_MULTI_8; + break; default: dst_channel = AUDIO_CHANNEL_MONO; break; @@ -180,6 +216,9 @@ static void __convert_sample_type_2_audio_info_sample_type(const audio_sample_ty case AUDIO_SAMPLE_TYPE_S24_32_LE: dst_type = CAudioInfo::ESampleType::SAMPLE_TYPE_S24_32_LE; break; + case AUDIO_SAMPLE_TYPE_S32_LE: + dst_type = CAudioInfo::ESampleType::SAMPLE_TYPE_S32_LE; + break; default: dst_type = CAudioInfo::ESampleType::SAMPLE_TYPE_U8; break; @@ -201,6 +240,9 @@ static void __convert_audio_info_sample_type_2_sample_type(const CAudioInfo::ESa case CAudioInfo::ESampleType::SAMPLE_TYPE_S24_32_LE: dst_type = AUDIO_SAMPLE_TYPE_S24_32_LE; break; + case CAudioInfo::ESampleType::SAMPLE_TYPE_S32_LE: + dst_type = AUDIO_SAMPLE_TYPE_S32_LE; + break; default: dst_type = AUDIO_SAMPLE_TYPE_U8; break; @@ -294,27 +336,20 @@ static audio_io_state_e __convert_state_type(const CAudioInfo::EAudioIOState src return dst_state; } -static void __check_audio_param(int sample_rate, audio_channel_e channel, audio_sample_type_e type) { - if (sample_rate < 0) +static void __check_audio_param(int sample_rate, audio_channel_e channel, audio_sample_type_e type, bool is_output) { + if (sample_rate < static_cast(CAudioInfo::MIN_SYSTEM_SAMPLERATE) || + sample_rate > static_cast(CAudioInfo::MAX_SYSTEM_SAMPLERATE)) THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Invalid sample rate :%d", sample_rate); - if (channel != AUDIO_CHANNEL_MONO && channel != AUDIO_CHANNEL_STEREO) + if (channel < AUDIO_CHANNEL_MONO || + channel > ((is_output) ? AUDIO_CHANNEL_STEREO : AUDIO_CHANNEL_MULTI_8)) THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Invalid channel :%d", channel); - if (type != AUDIO_SAMPLE_TYPE_U8 && - type != AUDIO_SAMPLE_TYPE_S16_LE && - type != AUDIO_SAMPLE_TYPE_S24_LE && - type != AUDIO_SAMPLE_TYPE_S24_32_LE) + if (type < AUDIO_SAMPLE_TYPE_U8 || + type > AUDIO_SAMPLE_TYPE_S32_LE) THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Invalid sample type :%d", type); } -static void __check_audio_param(int sample_rate, audio_channel_e channel, audio_sample_type_e type, sound_type_e sound_type) { - __check_audio_param(sample_rate, channel, type); - - if (sound_type < SOUND_TYPE_SYSTEM || sound_type > SOUND_TYPE_VOICE) - THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Invalid sound type : %d", sound_type); -} - static CAudioInfo __generate_audio_input_info(int sampleRate, audio_channel_e channel, audio_sample_type_e sample_type) { CAudioInfo::EChannel dstChannel; CAudioInfo::ESampleType dstSampleType; @@ -366,7 +401,7 @@ int cpp_audio_in_create(int sample_rate, audio_channel_e channel, audio_sample_t "Parameters are NULL input:%p", input); } - __check_audio_param(sample_rate, channel, type); + __check_audio_param(sample_rate, channel, type, false); AUDIO_IO_LOGD("samplerate:[%d] channel:[0x%x] sample_type:[0x%x]", sample_rate, channel, type); @@ -856,7 +891,7 @@ int cpp_audio_out_create_new(int sample_rate, audio_channel_e channel, audio_sam THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameters are NULL output:%p", output); - __check_audio_param(sample_rate, channel, type, SOUND_TYPE_SYSTEM /*default check */); + __check_audio_param(sample_rate, channel, type, true); AUDIO_IO_LOGD("samplerate:[%d] channel:[0x%x] sample_type:[0x%x]", sample_rate, channel, type); CAudioInfo audioInfo = __generate_audio_output_info(sample_rate, channel, type, SOUND_TYPE_MEDIA); diff --git a/test/audio_io_test.c b/test/audio_io_test.c index 81e7230..be3946c 100644 --- a/test/audio_io_test.c +++ b/test/audio_io_test.c @@ -34,7 +34,9 @@ typedef struct { } test_wav_t; test_wav_t test_wav; -static int ch_table[3] = { 0, AUDIO_CHANNEL_MONO, AUDIO_CHANNEL_STEREO }; +static int ch_table[] = { 0, AUDIO_CHANNEL_MONO, AUDIO_CHANNEL_STEREO, + AUDIO_CHANNEL_MULTI_3, AUDIO_CHANNEL_MULTI_4, AUDIO_CHANNEL_MULTI_5, + AUDIO_CHANNEL_MULTI_6, AUDIO_CHANNEL_MULTI_7, AUDIO_CHANNEL_MULTI_8 }; static char *state_str[] = { "IDLE", "RUNNING", "PAUSED" }; static void _audio_in_state_cb(audio_in_h handle, audio_io_state_e previous, audio_io_state_e current, @@ -723,7 +725,7 @@ int main(int argc, char **argv) audio_io_async_test(atoi(argv[2])); } else if (argc == 4) { int channel_idx = atoi(argv[3]); - if (channel_idx < 0 || channel_idx > 2) { + if (channel_idx < 0 || channel_idx > 8) { printf("Invalid channel\n"); return 0; }