1 #ifndef __DALI_SOUND_PLAYER_H__
2 #define __DALI_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.
22 * @addtogroup CAPI_DALI_ADAPTOR_MODULE
27 #include <dali/public-api/object/base-handle.h>
28 #include <dali/public-api/signals/dali-signal-v2.h>
30 namespace Dali DALI_IMPORT_API
33 namespace Internal DALI_INTERNAL
42 * @brief Plays sound effects.
44 class SoundPlayer : public BaseHandle
48 typedef SignalV2< void (SoundPlayer&) > SoundPlayFinishedSignalV2; ///< Sound play finished signal
51 static const char* const SIGNAL_SOUND_PLAY_FINISHED; ///< name "sound-play-finished"
56 * @brief Create an uninitialized handle.
58 * This can be initialized by calling SoundPlayer::Get().
63 * @brief Create an initialized handle to the SoundPlayer.
65 * @return A handle to a newly allocated Dali resource.
67 static SoundPlayer Get();
72 * This is non-virtual since derived Handle types must not contain data or virtual methods.
77 * @brief Plays a sound file.
79 * @pre The SoundPlayer needs to be initialized.
80 * @param[in] fileName Path to the sound file to play.
81 * @return a handle to the currently playing sound file which can be used to stop.
83 int PlaySound(const std::string fileName);
86 * @brief Stops the currently playing sound.
88 * @pre The SoundPlayer needs to be initialized.
91 void Stop(int handle);
94 * @brief This signal will be emitted after a given sound file is completely played.
96 * @pre The SoundPlayer needs to be initialized.
97 * @return The signal to connect to.
99 SoundPlayFinishedSignalV2& SoundPlayFinishedSignal();
101 public: // Not intended for application developers
104 * @brief This constructor is used by SoundPlayer::Get().
106 * @param[in] soundPlayer A pointer to the sound player.
108 SoundPlayer( Internal::Adaptor::SoundPlayer* soundPlayer );
116 #endif // __DALI_SOUND_PLAYER_H__