Use in-class initializer for class members
[platform/core/api/audio-io.git] / include / CAudioInfo.h
index 5ee60e1..1214bf1 100644 (file)
@@ -24,6 +24,7 @@
 #include <string>
 #include <sound_manager.h>
 #include <sound_manager_internal.h>
+#include <optional>
 
 namespace tizen_media_audio {
 
@@ -129,28 +130,27 @@ namespace tizen_media_audio {
         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;
 
         /* Setter & Getter */
-        unsigned int getSampleRate() noexcept;
-        EChannel getChannel() noexcept;
-        ESampleType getSampleType() noexcept;
-        EAudioType getAudioType() noexcept;
-        int getAudioIndex() noexcept;
+        unsigned int getSampleRate() const noexcept;
+        EChannel getChannel() const noexcept;
+        ESampleType getSampleType() const noexcept;
+        EAudioType getAudioType() const noexcept;
+        int getAudioIndex() const noexcept;
         void setAudioIndex(int audioIndex) noexcept;
-        int getSampleSize() noexcept;
+        int getSampleSize() const noexcept;
 
+        /* Effect */
         void setEffectMethod(int method) noexcept;
-        std::string getEffectMethod() noexcept;
-
+        std::string getEffectMethod() const noexcept;
         void setEffectMethodWithReference(sound_effect_method_with_reference_e method, int id) noexcept;
-        std::pair<std::string, int> getEffectMethodWithReference() noexcept;
+        std::pair<std::string, int> getEffectMethodWithReference() const noexcept;
 
         /* Setter & Getter Utilities */
-        const char* getConvertedStreamType();
+        const char* getConvertedStreamType() const;
         void setAudioTypeByInputStreamType(const char* streamType);
         void setAudioTypeByOutputStreamType(const char* streamType);
 
@@ -198,16 +198,16 @@ namespace tizen_media_audio {
         EAudioType convertInputStreamTypeToAudioType(const char *streamType);
         EAudioType convertOutputStreamTypeToAudioType(const char *streamType);
 
-        unsigned int __mSampleRate;
-        EChannel     __mChannel;
-        ESampleType  __mSampleType;
-        EAudioType   __mAudioType;
-        int          __mAudioIndex;
-
-        sound_effect_method_with_reference_e    __mEffectMethodWithReference;
-        int                                     __mEffectMethodReferenceDeviceId;
-        int                                     __mEffectMethod;
+        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<sound_effect_method_with_reference_e>
+                     __mEffectMethodWithReference;
+        int          __mEffectMethodReferenceDeviceId { 0 };
+        int          __mEffectMethod { 0 };
     };