X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2FCAudioInfo.h;h=3a86f07083be95fbf924f5e2a081ecff40d51d8f;hb=refs%2Ftags%2Faccepted%2Ftizen%2Funified%2F20231101.174518;hp=39b051b7ce7259fc3522d439d0d365a3e8cd3f34;hpb=27827eedcd10f54d0d04b850ab7c9bff3effa6d8;p=platform%2Fcore%2Fapi%2Faudio-io.git diff --git a/include/CAudioInfo.h b/include/CAudioInfo.h index 39b051b..3a86f07 100644 --- a/include/CAudioInfo.h +++ b/include/CAudioInfo.h @@ -21,6 +21,12 @@ #ifdef __cplusplus #include +#include +#include +#include + +#include +#include namespace tizen_media_audio { @@ -43,6 +49,14 @@ namespace tizen_media_audio { CHANNEL_MULTI_6, /**< 6 channel */ CHANNEL_MULTI_7, /**< 7 channel */ CHANNEL_MULTI_8, /**< 8 channel */ + CHANNEL_MULTI_9, /**< 9 channel */ + CHANNEL_MULTI_10, /**< 10 channel */ + CHANNEL_MULTI_11, /**< 11 channel */ + CHANNEL_MULTI_12, /**< 12 channel */ + CHANNEL_MULTI_13, /**< 13 channel */ + CHANNEL_MULTI_14, /**< 14 channel */ + CHANNEL_MULTI_15, /**< 15 channel */ + CHANNEL_MULTI_16, /**< 16 channel */ CHANNEL_MAX }; @@ -111,25 +125,39 @@ namespace tizen_media_audio { AUDIO_DIRECTION_MAX }; - const static unsigned int MIN_SYSTEM_SAMPLERATE = 8000; - const static unsigned int MAX_SYSTEM_SAMPLERATE = 192000; + static constexpr auto MIN_SYSTEM_SAMPLERATE = 8000; + static constexpr auto MAX_SYSTEM_SAMPLERATE = 192000; + + static constexpr auto MIN_RECORD_VOLUME = 0.0; + static constexpr auto MAX_RECORD_VOLUME = 2.0; + static constexpr auto DEFAULT_RECORD_VOLUME = 1.0; - /* Constructors */ - CAudioInfo(); + /* Constructor & Destructor */ CAudioInfo(unsigned int sampleRate, EChannel channel, ESampleType sampleType, EAudioType audioType, int audioIndex); + virtual ~CAudioInfo() = default; + + /* Audio Specification */ + std::tuple getSpec() const noexcept; + int getSampleSize() const noexcept; + + /* Stream Properties */ + void setAudioIndex(int audioIndex) noexcept; + void setAudioTypeByInputStreamType(const char* streamType); + void setAudioTypeByOutputStreamType(const char* streamType); + EAudioType getAudioType() const noexcept; + std::pair getStreamProperties() const; - /* Setter & Getter */ - unsigned int getSampleRate(); - EChannel getChannel(); - ESampleType getSampleType(); - EAudioType getAudioType(); - void setAudioType(EAudioType audioType); - int getAudioIndex(); - void setAudioIndex(int audioIndex); - void convertAudioType2StreamType(CAudioInfo::EAudioType audioType, char **streamType); - void convertInputStreamType2AudioType(char *streamType, CAudioInfo::EAudioType *audioType); - void convertOutputStreamType2AudioType(char *streamType, CAudioInfo::EAudioType *audioType); - int getSampleSize(); + /* Effect */ + void setEffectMethod(int method) noexcept; + std::string getEffectNoiseSuppressionMethod() const noexcept; + std::string getEffectAutomaticGainControlMethod() const noexcept; + + void setEffectMethodWithReference(sound_effect_method_with_reference_e method, int id) noexcept; + std::pair getEffectMethodWithReference() const noexcept; + + /* Utilities */ + size_t msToBytes(size_t milliseconds) const noexcept; + size_t bytesToMs(size_t bytes) const noexcept; private: const char *__STREAM_TYPE_TABLE[(unsigned int)EAudioType::AUDIO_TYPE_MAX] = { @@ -172,11 +200,19 @@ namespace tizen_media_audio { "network-source-media", /**< AUDIO_OUT_TYPE_MEDIA_NETWORK_SOURCE */ }; - unsigned int __mSampleRate; - EChannel __mChannel; - ESampleType __mSampleType; - EAudioType __mAudioType; - int __mAudioIndex; + EAudioType convertInputStreamTypeToAudioType(const char *streamType); + EAudioType convertOutputStreamTypeToAudioType(const char *streamType); + + unsigned int __mSampleRate { MAX_SYSTEM_SAMPLERATE }; + EChannel __mChannel { EChannel::CHANNEL_MAX }; + ESampleType __mSampleType { ESampleType::SAMPLE_TYPE_MAX }; + EAudioType __mAudioType { EAudioType::AUDIO_TYPE_MAX }; + int __mAudioIndex { -1 }; + + std::optional + __mEffectMethodWithReference; + int __mEffectMethodReferenceDeviceId { 0 }; + int __mEffectMethod { 0 }; };