2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FMediaIAudioOutEventListener.h
20 * @brief This is the header file for the %IAudioOutEventListener interface.
22 * This header file contains the declarations of the %IAudioOutEventListener interface.
25 #ifndef _FMEDIA_IAUDIO_OUT_EVENT_LISTENER_H_
26 #define _FMEDIA_IAUDIO_OUT_EVENT_LISTENER_H_
28 #include <FBaseRtIEventListener.h>
30 namespace Tizen { namespace Media
34 * @interface IAudioOutEventListener
35 * @brief This interface represents a listener that receives the AudioOut related events.
39 * @remarks OnAudioOutInterrupted() is called when the application is interrupted by another application and OnAudioOutReleased() event can be called at the end of interruption.
40 * OnAudioOutAudioFocusChanged() is called when the application is interrupted by another application but the end of interruption is not notified.
41 * So, the application should handle both events to work properly on various sound scenarios between applications.
43 * The %IAudioOutEventListener interface represents a listener that receives the AudioOut related events. The %AudioOut class works in asynchronous mode, and when the application plays audio data with the %AudioOut class,
44 * the caller must implement this interface to receive an event from %AudioOut.
46 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/media/playing_pcm_audio.htm">Playing PCM Audio</a>.
49 class _OSP_EXPORT_ IAudioOutEventListener
50 : virtual public Tizen::Base::Runtime::IEventListener
55 * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
59 virtual ~IAudioOutEventListener(void) {}
62 * Called when the device has written a buffer completely.
66 * @param[in] src An instance of AudioOut that fires the event
68 virtual void OnAudioOutBufferEndReached(Tizen::Media::AudioOut& src) = 0;
71 * Called when the output device is interrupted by a task of higher priority than AudioOut.
75 * @param[in] src An instance of AudioOut that fires the event
77 virtual void OnAudioOutInterrupted(Tizen::Media::AudioOut& src) = 0;
80 * Called when the interrupted output device is released.
84 * @param[in] src An instance of AudioOut that fires the event
86 virtual void OnAudioOutReleased(Tizen::Media::AudioOut& src) = 0;
89 * Called when an audio playback focus is changed to another application.
93 * @param[in] src An instance of AudioOut that fires the event
95 * - After the audio focus is being changed, the playback is stopped and the state of this instance is changed to ::AUDIOOUT_STATE_STOPPED.
96 * - User interaction with the device is required for an application in @c AUDIOOUT_STATE_STOPPED state to resume playing.
97 * This is to avoid the occurrence of a race condition among applications that try to start without user interaction.
98 * - An application cannot start playback again even in the state of @c AUDIOOUT_STATE_STOPPED due to other applications which have a higher priority.
100 virtual void OnAudioOutAudioFocusChanged(Tizen::Media::AudioOut& src) {}
103 // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
105 // This method is reserved and may change its name at any time without prior notice.
109 virtual void IAudioOutEventListener_Reserved1(void){}
112 // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
114 // This method is reserved and may change its name at any time without prior notice.
118 virtual void IAudioOutEventListener_Reserved2(void){}