Use in-class initializer for class members
[platform/core/api/audio-io.git] / include / CAudioInput.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __TIZEN_MEDIA_AUDIO_IO_CAUDIO_INPUT_H__
18 #define __TIZEN_MEDIA_AUDIO_IO_CAUDIO_INPUT_H__
19
20
21 #ifdef __cplusplus
22
23
24 namespace tizen_media_audio {
25
26
27     /**
28      * A class CAudioInput that inherited from CAudioIO
29      */
30     class CAudioInput : public CAudioIO {
31     public:
32         /* Constructor & Destructor */
33         explicit CAudioInput(CAudioInfo& info);
34         ~CAudioInput() = default;
35
36         /* Overridden Handler */
37         void onStream(CPulseAudioClient* pClient, size_t length) override;
38
39         /* Implemented Methods */
40         void initialize() override;
41         void finalize() override;
42
43         void prepare() override;
44         void unprepare() override;
45
46         void pause() override;
47         void resume() override;
48
49         void flush() override;
50
51         int  getBufferSize() override;
52
53         /* Overridden Methods */
54         void setStreamCallback(SStreamCallback callback) override;
55
56         /* Methods */
57         size_t read(void* buffer, size_t length);
58         int peek(const void** buffer, size_t* length);
59         int drop();
60
61         void setVolume(double volume);
62         double getVolume();
63
64     private:
65         /* Private Methods */
66         void __setInit(bool flag) noexcept;
67         bool __IsInit() noexcept;
68         bool __IsReady() noexcept;
69
70         bool __mIsUsedSyncRead { true };
71         bool __mIsInit {};
72
73         double __mVolume { CAudioInfo::DEFAULT_RECORD_VOLUME };
74     };
75
76
77 } /* namespace tizen_media_audio */
78
79 #endif
80 #endif /* __TIZEN_MEDIA_AUDIO_IO_CAUDIO_INPUT_H__ */