Use in-class initializer for class members
[platform/core/api/audio-io.git] / src / cpp / CAudioInfo.cpp
index 367fd4f..8a20199 100644 (file)
@@ -29,26 +29,12 @@ using namespace tizen_media_audio;
 /**
  * class CAudioInfo
  */
-CAudioInfo::CAudioInfo() :
-    __mSampleRate(MAX_SYSTEM_SAMPLERATE),
-    __mChannel(EChannel::CHANNEL_MONO),
-    __mSampleType(ESampleType::SAMPLE_TYPE_U8),
-    __mAudioType(EAudioType::AUDIO_IN_TYPE_MEDIA),
-    __mAudioIndex(-1),
-    __mEffectMethodWithReference((sound_effect_method_with_reference_e)0),
-    __mEffectMethodReferenceDeviceId(0),
-    __mEffectMethod(0) {
-}
-
 CAudioInfo::CAudioInfo(unsigned int sampleRate, EChannel channel, ESampleType sampleType, EAudioType audioType, int audioIndex) :
     __mSampleRate(sampleRate),
     __mChannel(channel),
     __mSampleType(sampleType),
     __mAudioType(audioType),
-    __mAudioIndex(audioIndex),
-    __mEffectMethodWithReference((sound_effect_method_with_reference_e)0),
-    __mEffectMethodReferenceDeviceId(0),
-    __mEffectMethod(0) {
+    __mAudioIndex(audioIndex) {
     // Check to invalid AudioInfo
     if (sampleRate < CAudioInfo::MIN_SYSTEM_SAMPLERATE ||
         sampleRate > CAudioInfo::MAX_SYSTEM_SAMPLERATE)
@@ -71,19 +57,19 @@ CAudioInfo::CAudioInfo(unsigned int sampleRate, EChannel channel, ESampleType sa
                                "The audioType is invalid [audioType:%u]", to_integral(audioType));
 }
 
-unsigned int CAudioInfo::getSampleRate() noexcept {
+unsigned int CAudioInfo::getSampleRate() const noexcept {
     return __mSampleRate;
 }
 
-CAudioInfo::EChannel CAudioInfo::getChannel() noexcept {
+CAudioInfo::EChannel CAudioInfo::getChannel() const noexcept {
     return __mChannel;
 }
 
-CAudioInfo::ESampleType CAudioInfo::getSampleType() noexcept {
+CAudioInfo::ESampleType CAudioInfo::getSampleType() const noexcept {
     return __mSampleType;
 }
 
-CAudioInfo::EAudioType CAudioInfo::getAudioType() noexcept {
+CAudioInfo::EAudioType CAudioInfo::getAudioType() const noexcept {
     return __mAudioType;
 }
 
@@ -95,7 +81,7 @@ void CAudioInfo::setAudioTypeByOutputStreamType(const char* streamType) {
     __mAudioType = convertOutputStreamTypeToAudioType(streamType);
 }
 
-int CAudioInfo::getAudioIndex() noexcept {
+int CAudioInfo::getAudioIndex() const noexcept {
     return __mAudioIndex;
 }
 
@@ -103,7 +89,7 @@ void CAudioInfo::setAudioIndex(int audioIndex) noexcept {
     __mAudioIndex = audioIndex;
 }
 
-int CAudioInfo::getSampleSize() noexcept {
+int CAudioInfo::getSampleSize() const noexcept {
     int bytes_in_sample = 0;
 
     switch (__mSampleType) {
@@ -133,7 +119,7 @@ void CAudioInfo::setEffectMethod(int method) noexcept {
     __mEffectMethod = method;
 }
 
-std::string CAudioInfo::getEffectMethod() noexcept {
+std::string CAudioInfo::getEffectMethod() const noexcept {
     std::string method;
 
     if (__mEffectMethod & SOUND_EFFECT_NOISE_SUPPRESSION_VOIP)
@@ -156,7 +142,7 @@ void CAudioInfo::setEffectMethodWithReference(sound_effect_method_with_reference
     __mEffectMethodReferenceDeviceId = id;
 }
 
-std::pair<std::string, int> CAudioInfo::getEffectMethodWithReference() noexcept {
+std::pair<std::string, int> CAudioInfo::getEffectMethodWithReference() const noexcept {
     std::string method;
 
     if (__mEffectMethodWithReference == SOUND_EFFECT_REFERENCE_COPY)
@@ -169,7 +155,7 @@ std::pair<std::string, int> CAudioInfo::getEffectMethodWithReference() noexcept
     return make_pair(method, __mEffectMethodReferenceDeviceId);
 }
 
-const char* CAudioInfo::getConvertedStreamType() {
+const char* CAudioInfo::getConvertedStreamType() const {
     if (__mAudioType < CAudioInfo::EAudioType::AUDIO_IN_TYPE_MEDIA ||
         __mAudioType >= CAudioInfo::EAudioType::AUDIO_TYPE_MAX)
         THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_SUPPORTED_TYPE,