1 #ifndef DALI_INTERNAL_FEEDBACK_PLAYER_H
2 #define DALI_INTERNAL_FEEDBACK_PLAYER_H
5 * Copyright (c) 2021 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 #include <dali/public-api/object/base-object.h>
26 #include <dali/devel-api/adaptor-framework/feedback-player.h>
27 #include <dali/internal/haptics/common/feedback-plugin-proxy.h>
35 class FeedbackPluginProxy;
38 * Plays haptic effects.
40 class FeedbackPlayer : public Dali::BaseObject
44 * Create a FeedbackPlayer.
45 * This should only be called once by the Adaptor class.
46 * @return A newly created FeedbackPlayer.
48 static Dali::FeedbackPlayer New();
51 * Retrieve a handle to the FeedbackPlayer. This creates an instance if none has been created.
52 * @return A handle to the FeedbackPlayer.
54 static Dali::FeedbackPlayer Get();
57 * @copydoc Dali::FeedbackPlayer::PlayMonotone()
59 void PlayMonotone(unsigned int duration);
62 * @copydoc Dali::FeedbackPlayer::PlayFile()
64 void PlayFile(const std::string& filePath);
67 * @copydoc Dali::FeedbackPlayer::Stop()
72 * @copydoc Dali::FeedbackPlayer::PlaySound()
74 int PlaySound(const std::string& fileName);
77 * @copydoc Dali::FeedbackPlayer::StopSound()
79 void StopSound(int handle);
82 * @copydoc Dali::FeedbackPlayer::PlayFeedbackPattern()
84 void PlayFeedbackPattern(int type, int pattern);
87 * @copydoc Dali::FeedbackPlayer::LoadFile()
89 bool LoadFile(const std::string& filename, std::string& data);
93 * Private Constructor; see also FeedbackPlayer::New()
100 ~FeedbackPlayer() override;
103 FeedbackPlayer(const FeedbackPlayer&);
106 FeedbackPlayer& operator=(FeedbackPlayer&);
109 FeedbackPluginProxy mPlugin;
112 } // namespace Adaptor
114 } // namespace Internal
116 // Helpers for public-api forwarding methods
118 inline Internal::Adaptor::FeedbackPlayer& GetImplementation(Dali::FeedbackPlayer& player)
120 DALI_ASSERT_ALWAYS(player && "FeedbackPlayer handle is empty");
122 BaseObject& handle = player.GetBaseObject();
124 return static_cast<Internal::Adaptor::FeedbackPlayer&>(handle);
127 inline const Internal::Adaptor::FeedbackPlayer& GetImplementation(const Dali::FeedbackPlayer& player)
129 DALI_ASSERT_ALWAYS(player && "FeedbackPlayer handle is empty");
131 const BaseObject& handle = player.GetBaseObject();
133 return static_cast<const Internal::Adaptor::FeedbackPlayer&>(handle);
138 #endif // DALI_INTERNAL_FEEDBACK_PLAYER_H