<Compile Include="examples\sibling-order-test.cs" />\r
<Compile Include="examples\test1.cs" />\r
<Compile Include="examples\text-test.cs" />\r
+ <Compile Include="examples\ttsplayer-test.cs" />\r
<Compile Include="examples\user-alphafunction.cs" />\r
<Compile Include="examples\view-navi-property.cs" />\r
<Compile Include="examples\date-picker-using-json\ViewRegistryHelper.cs" />\r
--- /dev/null
+/*
+* Copyright (c) 2016 Samsung Electronics Co., Ltd.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+using System;
+using Tizen.NUI;
+
+namespace TTSPlayerTest
+{
+ class Example : NUIApplication
+ {
+ public Example() : base()
+ {
+ }
+
+ public Example(string stylesheet) : base(stylesheet)
+ {
+ }
+
+ public Example(string stylesheet, WindowMode windowMode) : base(stylesheet, windowMode)
+ {
+ }
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+ Initialize();
+ }
+
+ public void Initialize()
+ {
+ Window window = Window.Instance;
+ window.BackgroundColor = Color.White;
+
+ TTSPlayer ttsPlayer = TTSPlayer.Get(TTSPlayer.TTSMode.Default);
+ ttsPlayer.Play("tts player test");
+
+ ttsPlayer.StateChanged += (s, e) =>
+ {
+ Tizen.Log.Debug("TTS state changed!!!");
+ };
+ ttsPlayer.Pause();
+ ttsPlayer.Resume();
+ ttsPlayer.Stop();
+ Tizen.Log.Debug("TTS state: " + ttsPlayer.GetState());
+ }
+
+ [STAThread]
+ static void _Main(string[] args)
+ {
+ Example example = new Example();
+ example.Run(args);
+ }
+ }
+}
<Compile Include="src\internal\SlotObserver.cs" />\r
<Compile Include="src\internal\SnapType.cs" />\r
<Compile Include="src\internal\StageWheelSignal.cs" />\r
+ <Compile Include="src\internal\StateChangedSignalType.cs" />\r
<Compile Include="src\internal\StencilFunctionType.cs" />\r
<Compile Include="src\internal\StencilOperationType.cs" />\r
<Compile Include="src\internal\StringValuePair.cs" />\r
<Compile Include="src\public\TapGesture.cs" />\r
<Compile Include="src\public\Timer.cs" />\r
<Compile Include="src\public\Touch.cs" />\r
+ <Compile Include="src\public\TTSPlayer.cs" />\r
<Compile Include="src\public\BaseComponents\ImageView.cs" />\r
<Compile Include="src\public\BaseComponents\TextEditor.cs" />\r
<Compile Include="src\public\BaseComponents\TextField.cs" />\r
</FlavorProperties>\r
</VisualStudio>\r
</ProjectExtensions>\r
-</Project>
\ No newline at end of file
+</Project>\r
[global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_HIDDENINPUT_PROPERTY_SHOW_DURATION_get")]
public static extern int HIDDENINPUT_PROPERTY_SHOW_DURATION_get();
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_SWIGUpcast")]
+ public static extern global::System.IntPtr TtsPlayer_SWIGUpcast(global::System.IntPtr jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TtsPlayer__SWIG_0")]
+ public static extern global::System.IntPtr new_TtsPlayer__SWIG_0();
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Get__SWIG_0")]
+ public static extern global::System.IntPtr TtsPlayer_Get__SWIG_0(int jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Get__SWIG_1")]
+ public static extern global::System.IntPtr TtsPlayer_Get__SWIG_1();
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TtsPlayer")]
+ public static extern void delete_TtsPlayer(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TtsPlayer__SWIG_1")]
+ public static extern global::System.IntPtr new_TtsPlayer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Assign")]
+ public static extern global::System.IntPtr TtsPlayer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Play")]
+ public static extern void TtsPlayer_Play(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Stop")]
+ public static extern void TtsPlayer_Stop(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Pause")]
+ public static extern void TtsPlayer_Pause(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Resume")]
+ public static extern void TtsPlayer_Resume(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_GetState")]
+ public static extern int TtsPlayer_GetState(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_StateChangedSignal")]
+ public static extern global::System.IntPtr TtsPlayer_StateChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StateChangedSignalType_Empty")]
+ public static extern bool StateChangedSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StateChangedSignalType_GetConnectionCount")]
+ public static extern uint StateChangedSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StateChangedSignalType_Connect")]
+ public static extern void StateChangedSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StateChangedSignalType_Disconnect")]
+ public static extern void StateChangedSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StateChangedSignalType_Emit")]
+ public static extern void StateChangedSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_StateChangedSignalType")]
+ public static extern global::System.IntPtr new_StateChangedSignalType();
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_StateChangedSignalType")]
+ public static extern void delete_StateChangedSignalType(global::System.Runtime.InteropServices.HandleRef jarg1);
+
}
}
--- /dev/null
+//------------------------------------------------------------------------------
+// <auto-generated />
+//
+// This file was automatically generated by SWIG (http://www.swig.org).
+// Version 3.0.12
+//
+// Do not make changes to this file unless you know what you are doing--modify
+// the SWIG interface file instead.
+//------------------------------------------------------------------------------
+
+namespace Tizen.NUI
+{
+ internal class StateChangedSignalType : global::System.IDisposable
+ {
+ private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+ protected bool swigCMemOwn;
+
+ internal StateChangedSignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
+ {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(StateChangedSignalType obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ }
+
+ //A Flag to check who called Dispose(). (By User or DisposeQueue)
+ private bool isDisposeQueued = false;
+ //A Flat to check if it is already disposed.
+ protected bool disposed = false;
+
+ ~StateChangedSignalType()
+ {
+ if (!isDisposeQueued)
+ {
+ isDisposeQueued = true;
+ DisposeQueue.Instance.Add(this);
+ }
+ }
+
+ public void Dispose()
+ {
+ //Throw excpetion if Dispose() is called in separate thread.
+ if (!Window.IsInstalled())
+ {
+ throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
+ }
+
+ if (isDisposeQueued)
+ {
+ Dispose(DisposeTypes.Implicit);
+ }
+ else
+ {
+ Dispose(DisposeTypes.Explicit);
+ System.GC.SuppressFinalize(this);
+ }
+ }
+
+ protected virtual void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+
+ //Release your own unmanaged resources here.
+ //You should not access any managed member here except static instance.
+ //because the execution order of Finalizes is non-deterministic.
+
+ if (swigCPtr.Handle != global::System.IntPtr.Zero)
+ {
+ if (swigCMemOwn)
+ {
+ swigCMemOwn = false;
+ NDalicManualPINVOKE.delete_StateChangedSignalType(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+
+ disposed = true;
+ }
+
+ public bool Empty()
+ {
+ bool ret = NDalicManualPINVOKE.StateChangedSignalType_Empty(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public uint GetConnectionCount()
+ {
+ uint ret = NDalicManualPINVOKE.StateChangedSignalType_GetConnectionCount(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public void Connect(System.Delegate func)
+ {
+ System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
+ {
+ NDalicManualPINVOKE.StateChangedSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+
+ public void Disconnect(System.Delegate func)
+ {
+ System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
+ {
+ NDalicManualPINVOKE.StateChangedSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+
+ public void Emit(TTSPlayer.TTSState arg1, TTSPlayer.TTSState arg2)
+ {
+ NDalicManualPINVOKE.StateChangedSignalType_Emit(swigCPtr, (int)arg1, (int)arg2);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public StateChangedSignalType() : this(NDalicManualPINVOKE.new_StateChangedSignalType(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ }
+
+}
--- /dev/null
+//------------------------------------------------------------------------------
+// <auto-generated />
+//
+// This file was automatically generated by SWIG (http://www.swig.org).
+// Version 3.0.12
+//
+// Do not make changes to this file unless you know what you are doing--modify
+// the SWIG interface file instead.
+//------------------------------------------------------------------------------
+
+namespace Tizen.NUI
+{
+ using System;
+ using System.Runtime.InteropServices;
+
+ /// <summary>
+ /// The Text-to-speech (TTS) Player.
+ /// </summary>
+ public class TTSPlayer : BaseHandle
+ {
+ private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+
+ internal TTSPlayer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.TtsPlayer_SWIGUpcast(cPtr), cMemoryOwn)
+ {
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TTSPlayer obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ }
+
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+
+ //Release your own unmanaged resources here.
+ //You should not access any managed member here except static instance.
+ //because the execution order of Finalizes is non-deterministic.
+
+ if (swigCPtr.Handle != global::System.IntPtr.Zero)
+ {
+ if (swigCMemOwn)
+ {
+ swigCMemOwn = false;
+ NDalicManualPINVOKE.delete_TtsPlayer(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+
+ base.Dispose(type);
+ }
+
+ internal TTSPlayer() : this(NDalicManualPINVOKE.new_TtsPlayer__SWIG_0(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Gets the singleton of the TtsPlayer for the given mode.
+ /// </summary>
+ /// <param name="mode"> The mode of tts-player. </param>
+ /// <returns> A handle of the Ttsplayer for the given mode. </returns>
+ public static TTSPlayer Get(TTSMode mode)
+ {
+ TTSPlayer ret = new TTSPlayer(NDalicManualPINVOKE.TtsPlayer_Get__SWIG_0((int)mode), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Gets the singleton of the TtsPlayer for the default mode..
+ /// </summary>
+ /// <returns> A handle of the Ttsplayer for the default mode. </returns>
+ public static TTSPlayer Get()
+ {
+ TTSPlayer ret = new TTSPlayer(NDalicManualPINVOKE.TtsPlayer_Get__SWIG_1(), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal TTSPlayer(TTSPlayer handle) : this(NDalicManualPINVOKE.new_TtsPlayer__SWIG_1(TTSPlayer.getCPtr(handle)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal TTSPlayer Assign(TTSPlayer rhs)
+ {
+ TTSPlayer ret = new TTSPlayer(NDalicManualPINVOKE.TtsPlayer_Assign(swigCPtr, TTSPlayer.getCPtr(rhs)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Starts playing the audio data synthesized from the specified text.
+ /// </summary>
+ /// <param name="text"> The text to play. </param>
+ /// <remarks>The TtsPlayer needs to be initialized.</remarks>
+ public void Play(string text)
+ {
+ NDalicManualPINVOKE.TtsPlayer_Play(swigCPtr, text);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Stops playing the utterance.
+ /// </summary>
+ /// <remarks>The TtsPlayer needs to be initialized.</remarks>
+ public void Stop()
+ {
+ NDalicManualPINVOKE.TtsPlayer_Stop(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Pauses the currently playing utterance.
+ /// </summary>
+ /// <remarks>The TtsPlayer needs to be initialized.</remarks>
+ public void Pause()
+ {
+ NDalicManualPINVOKE.TtsPlayer_Pause(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Resumes the previously paused utterance.
+ /// </summary>
+ /// <remarks>The TtsPlayer needs to be initialized.</remarks>
+ public void Resume()
+ {
+ NDalicManualPINVOKE.TtsPlayer_Resume(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Gets the current state of the player.
+ /// </summary>
+ /// <returns> The current TTS state. </returns>
+ /// <remarks>The TtsPlayer needs to be initialized.</remarks>
+ public TTSState GetState()
+ {
+ TTSState ret = (TTSState)NDalicManualPINVOKE.TtsPlayer_GetState(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// State changed argument.
+ /// </summary>
+ public class StateChangedEventArgs : EventArgs
+ {
+ public TTSState PrevState
+ {
+ get;
+ set;
+ }
+
+ public TTSState NextState
+ {
+ get;
+ set;
+ }
+ }
+
+ private StateChangedEventCallbackType _stateChangedEventCallback;
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void StateChangedEventCallbackType(TTSState prevState, TTSState nextState);
+ private event EventHandler<StateChangedEventArgs> _stateChangedEventHandler;
+
+ /// <summary>
+ /// State changed event.
+ /// </summary>
+ public event EventHandler<StateChangedEventArgs> StateChanged
+ {
+ add
+ {
+ if (_stateChangedEventHandler == null)
+ {
+ _stateChangedEventCallback = OnStateChanged;
+ StateChangedSignal().Connect(_stateChangedEventCallback);
+ }
+
+ _stateChangedEventHandler += value;
+ }
+ remove
+ {
+ _stateChangedEventHandler -= value;
+
+ if (_stateChangedEventHandler == null && StateChangedSignal().Empty() == false && _stateChangedEventCallback != null)
+ {
+ StateChangedSignal().Disconnect(_stateChangedEventCallback);
+ }
+ }
+ }
+
+ private void OnStateChanged(TTSState prevState, TTSState nextState)
+ {
+ StateChangedEventArgs e = new StateChangedEventArgs();
+
+ e.PrevState = prevState;
+ e.NextState = nextState;
+
+ if (_stateChangedEventHandler != null)
+ {
+ _stateChangedEventHandler(this, e);
+ }
+ }
+
+ internal StateChangedSignalType StateChangedSignal()
+ {
+ StateChangedSignalType ret = new StateChangedSignalType(NDalicManualPINVOKE.TtsPlayer_StateChangedSignal(swigCPtr), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Enumeration for the instance of TTS mode.
+ /// </summary>
+ public enum TTSMode
+ {
+ /// <summary>
+ /// Default mode for normal application.
+ /// </summary>
+ Default = 0,
+ /// <summary>
+ /// Notification mode, such as playing utterance is started or completed.
+ /// </summary>
+ Notification,
+ /// <summary>
+ /// Screen reader mode. <br>
+ /// To help visually impaired users interact with their devices, <br>
+ /// screen reader reads text or graphic elements on the screen using the TTS engine.
+ /// </summary>
+ ScreenReader,
+ /// <summary>
+ /// Number of Mode.
+ /// </summary>
+ ModeNum
+ }
+
+ /// <summary>
+ /// Enumeration for the instance of TTS state.
+ /// </summary>
+ public enum TTSState
+ {
+ /// <summary>
+ /// Player is not available.
+ /// </summary>
+ Unavailable = 0,
+ /// <summary>
+ /// Player is ready to play.
+ /// </summary>
+ Ready,
+ /// <summary>
+ /// Player is playing.
+ /// </summary>
+ Playing,
+ /// <summary>
+ /// Player is paused.
+ /// </summary>
+ Paused
+ }
+
+ }
+
+}