Throw invalid operation error when unprepare() is called at inside of pulse-thread
[platform/core/api/audio-io.git] / include / IAudioSessionEventListener.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_IAUDIO_SESSION_EVENT_LISTENER_H__
18 #define __TIZEN_MEDIA_AUDIO_IO_IAUDIO_SESSION_EVENT_LISTENER_H__
19
20
21 #ifdef __cplusplus
22
23
24 #include <mm_sound.h>
25 #include <mm_sound_focus.h>
26
27
28 namespace tizen_media_audio {
29
30
31     /**
32      * Called by ASM Thread
33      */
34     class CAudioSessionHandler;
35     class IAudioSessionEventListener {
36     public:
37         enum class EInterruptCode : unsigned int {
38             INTERRUPT_COMPLETED = 0,         /**< Interrupt completed */
39             INTERRUPT_BY_MEDIA,              /**< Interrupted by a media application */
40             INTERRUPT_BY_CALL,               /**< Interrupted by an incoming call */
41             INTERRUPT_BY_EARJACK_UNPLUG,     /**< Interrupted by unplugging headphones */
42             INTERRUPT_BY_RESOURCE_CONFLICT,  /**< Interrupted by a resource conflict */
43             INTERRUPT_BY_ALARM,              /**< Interrupted by an alarm */
44             INTERRUPT_BY_EMERGENCY,          /**< Interrupted by an emergency */
45             INTERRUPT_BY_NOTIFICATION,       /**< Interrupted by a notification */
46             INTERRUPT_MAX
47         };
48
49         static EInterruptCode convertInterruptedCode(int code, const char *reason_for_change);
50         virtual void onInterrupt(CAudioSessionHandler* pHandler, int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info) = 0;
51         virtual void onSignal(CAudioSessionHandler* pHandler, mm_sound_signal_name_t signal, int value) = 0;
52     };
53
54
55 } /* namespace tizen_media_audio */
56
57 #endif
58 #endif /* __TIZEN_MEDIA_AUDIO_IO_IAUDIO_SESSION_EVENT_LISTENER_H__ */