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 FMediaITonePlayerEventListener.h
20 * @brief This is the header file for the %ITonePlayerEventListener interface.
22 * This header file contains the declarations of the %ITonePlayerEventListener interface.
25 #ifndef _FMEDIA_ITONE_PLAYER_EVENT_LISTENER_H_
26 #define _FMEDIA_ITONE_PLAYER_EVENT_LISTENER_H_
28 #include <FBaseRtIEventListener.h>
29 #include <FMediaTonePlayer.h>
31 namespace Tizen { namespace Media
35 * @interface ITonePlayerEventListener
36 * @brief This interface provides a listener for the tone player events.
40 * @remarks OnTonePlayerInterrupted() is called when the application is interrupted by another application and OnTonePlayerReleased() event can be called at the end of interruption.
41 * OnTonePlayerAudioFocusChanged() is called when the application is interrupted by another application but the end of interruption is not notified.
42 * So, the application should handle both events to work properly on various sound scenarios between applications.
44 * The %ITonePlayerEventListener interface specifies the methods used to notify the status of the tone player.
47 class _OSP_EXPORT_ ITonePlayerEventListener
48 : virtual public Tizen::Base::Runtime::IEventListener
52 * 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.
56 virtual ~ITonePlayerEventListener(void) {}
59 * Called when the tone player reaches the end of the tone or the end of the list of tones.
63 * @param[in] src An instance of TonePlayer that fires the event
66 virtual void OnTonePlayerEndOfTone(Tizen::Media::TonePlayer& src) = 0;
69 * Called when the tone player is interrupted by a task of higher priority than the tone player.
73 * @param[in] src An instance of TonePlayer that fires the event
76 virtual void OnTonePlayerInterrupted(Tizen::Media::TonePlayer& src) = 0;
79 * Called when the interrupted tone player is released.
83 * @param[in] src An instance of TonePlayer that fires the event
86 virtual void OnTonePlayerReleased(Tizen::Media::TonePlayer& src) = 0;
89 * Called to notify an application that an error has occurred while the tone is played.
93 * @param[in] src An instance of TonePlayer that fires the event
94 * @param[in] r The cause of the error
95 * @exception E_SYSTEM A system error has occurred.
97 virtual void OnTonePlayerErrorOccurred(Tizen::Media::TonePlayer& src, result r) = 0;
100 * Called when an audio playback focus is changed to another application.
104 * @param[in] src An instance of TonePlayer that fires the event
106 * - After the audio focus is being changed, the playback is paused and the state of this instance is changed to ::TONE_PLAYER_STATE_PAUSED.
107 * - User interaction with the device is required for an application in @c TONE_PLAYER_STATE_PAUSED state to resume playing.
108 * This is to avoid the occurrence of a race condition among applications that try to play without user interaction.
109 * - An application cannot start playback again even in the state of @c TONE_PLAYER_STATE_PAUSED due to other applications which have a higher priority.
111 virtual void OnTonePlayerAudioFocusChanged(Tizen::Media::TonePlayer& src) {}
115 // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
117 // This method is reserved and may change its name at any time without prior notice.
121 virtual void ITonePlayerEventListener_Reserved1(void) {}
124 // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
126 // This method is reserved and may change its name at any time without prior notice.
130 virtual void ITonePlayerEventListener_Reserved2(void) {}
133 // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
135 // This method is reserved and may change its name at any time without prior notice.
139 virtual void ITonePlayerEventListener_Reserved3(void) {}