Modify for replacing wearable version 2.4 with 3.0
[platform/core/api/audio-io.git] / include / CAudioIODef.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_DEF_H__
18 #define __TIZEN_MEDIA_AUDIO_IO_CAUDIO_DEF_H__
19
20
21 #ifdef __cplusplus
22
23
24 #include <stdio.h>
25 #include <dlog.h>
26 #include <vconf.h>
27
28 #include "CAudioError.h"
29 #include "CAudioInfo.h"
30 #include "IAudioSessionEventListener.h"
31 #include "CAudioSessionHandler.h"
32 #include "IPulseStreamListener.h"
33 #include "CPulseAudioVolume.h"
34 #include "CPulseAudioPolicy.h"
35 #include "CPulseStreamSpec.h"
36 #include "CPulseAudioClient.h"
37 #include "CAudioIO.h"
38 #include "CAudioInput.h"
39 #include "CAudioOutput.h"
40
41 //#define _AUDIO_IO_DEBUG_TIMING_
42
43 #ifdef LOG_TAG
44 #undef LOG_TAG
45 #endif
46 #define LOG_TAG "TIZEN_N_AUDIO_IO"
47
48 #define AUDIO_IO_LOGD(_fmt_, arg...) { \
49         LOGD(_fmt_, ##arg);      \
50 }
51
52 #define AUDIO_IO_LOGW(_fmt_, arg...) { \
53         LOGW(_fmt_, ##arg);      \
54 }
55
56 #define AUDIO_IO_LOGE(_fmt_, arg...) { \
57         LOGE(_fmt_, ##arg);      \
58 }
59
60 #define _AUDIO_IO_SHELL_COLOR_
61 #ifdef _AUDIO_IO_SHELL_COLOR_
62 #define COLOR_BLACK     "\033[0;30m"
63 #define COLOR_RED       "\033[0;31m"
64 #define COLOR_GREEN     "\033[0;32m"
65 #define COLOR_YELLOW    "\033[0;33m"
66 #define COLOR_BLUE      "\033[0;34m"
67 #define COLOR_MAGENTA   "\033[0;35m"
68 #define COLOR_CYAN      "\033[0;36m"
69 #define COLOR_GRAY      "\033[0;37m"
70 #define COLOR_WHITE     "\033[1;37m"
71 #define COLOR_END       "\033[0m"
72 #else
73 #define COLOR_BLACK
74 #define COLOR_RED
75 #define COLOR_GREEN
76 #define COLOR_BLUE
77 #define COLOR_YELLOW
78 #define COLOR_MAGENTA
79 #define COLOR_CYAN
80 #define COLOR_WHITE
81 #define COLOR_END
82 #endif
83
84
85 #define RET_ERROR(_x_)              {return CAudioError((_x_), __FILE__, __func__, __LINE__);};
86 #define RET_ERROR_MSG(_x_, _msg_)   {return CAudioError((_x_), (_msg_), __FILE__, __func__, __LINE__);};
87
88 #define RET_ERROR_MSG_FORMAT(_x_, _format_, ...) {                     \
89     char _msg_[CAudioError::MSG_LENGTH] = {0, };                       \
90     snprintf(_msg_, CAudioError::MSG_LENGTH, _format_, ##__VA_ARGS__); \
91     return CAudioError((_x_), (_msg_), __FILE__, __func__, __LINE__);  \
92 };
93
94
95 #define THROW_ERROR(_x_)            {throw  CAudioError((_x_), __FILE__, __func__, __LINE__);};
96 #define THROW_ERROR_MSG(_x_, _msg_) {throw  CAudioError((_x_), (_msg_), __FILE__, __func__, __LINE__);};
97
98 #define THROW_ERROR_MSG_FORMAT(_x_, _format_, ...) {                   \
99     char _msg_[CAudioError::MSG_LENGTH] = {0, };                       \
100     snprintf(_msg_, CAudioError::MSG_LENGTH, _format_, ##__VA_ARGS__); \
101     throw CAudioError((_x_), (_msg_), __FILE__,  __func__, __LINE__);  \
102 };
103
104 #define VALID_POINTER_START(_x_) { \
105     if ((_x_) != NULL) {
106 #define VALID_POINTER_END } \
107 }
108
109 #define SAFE_DELETE(_x_)   {if ((_x_)) {delete (_x_); (_x_) = NULL;}};
110 #define SAFE_FINALIZE(_x_) {if ((_x_)) {(_x_)->finalize();}};
111 #define SAFE_REMOVE(_x_)   {if ((_x_)) {(_x_)->finalize(); delete (_x_); (_x_) = NULL;}};
112
113
114 #endif
115 #endif /* __TIZEN_MEDIA_CPP_OBJECTS_IO_H__ */