1 #ifndef __DALI_INTERNAL_SOUND_PLAYER_H__
2 #define __DALI_INTERNAL_SOUND_PLAYER_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <dali/public-api/object/base-object.h>
26 #include <sound-player.h>
27 #include <feedback/feedback-plugin-proxy.h>
39 * Plays haptic effects.
41 class SoundPlayer : public Dali::BaseObject
46 typedef Dali::SoundPlayer::SoundPlayFinishedSignalV2 SoundPlayFinishedSignalV2;
49 * Create a SoundPlayer.
50 * @return A newly created SoundPlayer.
52 static Dali::SoundPlayer New();
55 * Retrieve a handle to the SoundPlayer. This creates an instance if none has been created.
56 * @return A handle to the SoundPlayer.
58 static Dali::SoundPlayer Get();
61 * @copydoc Dali::SoundPlayer::PlaySound()
63 int PlaySound(const std::string fileName);
66 * @copydoc Dali::SoundPlayer::Stop()
68 void Stop(int handle);
71 * @copydoc Dali::SoundPlayer::SoundPlayFinishedSignal()
73 SoundPlayFinishedSignalV2& SoundPlayFinishedSignal();
76 * Connects a callback function with the object's signals.
77 * @param[in] object The object providing the signal.
78 * @param[in] tracker Used to disconnect the signal.
79 * @param[in] signalName The signal to connect to.
80 * @param[in] functor A newly allocated FunctorDelegate.
81 * @return True if the signal was connected.
82 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
84 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
89 * Private Constructor; see also soundPlayer::New()
90 * @param[in] soundPlayer The public sound player class
97 virtual ~SoundPlayer();
100 * Emits the SoundPlayFinished signal.
102 void EmitSoundPlayFinishedSignal();
105 SoundPlayer(const SoundPlayer&);
108 SoundPlayer& operator=(SoundPlayer&);
112 FeedbackPluginProxy mPlugin;
113 SoundPlayFinishedSignalV2 mSoundPlayFinishedSignalV2;
116 } // namespace Adaptor
118 } // namespace Internal
121 // Helpers for public-api forwarding methods
123 inline Internal::Adaptor::SoundPlayer& GetImplementation(Dali::SoundPlayer& player)
125 DALI_ASSERT_ALWAYS( player && "SoundPlayer handle is empty" );
127 BaseObject& handle = player.GetBaseObject();
129 return static_cast<Internal::Adaptor::SoundPlayer&>(handle);
132 inline const Internal::Adaptor::SoundPlayer& GetImplementation(const Dali::SoundPlayer& player)
134 DALI_ASSERT_ALWAYS( player && "SoundPlayer handle is empty" );
136 const BaseObject& handle = player.GetBaseObject();
138 return static_cast<const Internal::Adaptor::SoundPlayer&>(handle);
143 #endif // __DALI_INTERNAL_SOUND_PLAYER_H__