Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
purpleSloth
PpS_TTS
Commits
23cdeab2
Commit
23cdeab2
authored
May 26, 2019
by
Ben Huber
Browse files
language select in demo scene
parent
a4a56f6e
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Assets/ButtonScript.cs
deleted
100644 → 0
View file @
a4a56f6e
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
ButtonScript
:
MonoBehaviour
{
public
InputField
input
;
public
void
OnBtnPressed
()
{
PurpleSloth
.
TextToSpeech
.
Say
(
input
.
text
);
input
.
text
=
""
;
foreach
(
var
v
in
PurpleSloth
.
TextToSpeech
.
AvailableVoices
())
{
Debug
.
Log
(
v
);
input
.
text
+=
v
;
}
}
}
Assets/PurpleSloth/Assets/Plugins/TextToSpeech.jslib
View file @
23cdeab2
...
...
@@ -27,8 +27,13 @@ mergeInto(LibraryManager.library, {
ans = "";
for(i = 0; i < voices.length ; i++) {
ans += voices[i].name + ' (' + voices[i].lang + ');';
ans += voices[i].name + ' (' + voices[i].lang + ')';
if (voices[i].default) {
ans += ' [default]';
}
ans += ';';
}
ans = ans.substring(0, ans.length-1);
var bufferSize = lengthBytesUTF8(ans) + 1;
var buffer = _malloc(bufferSize);
...
...
Assets/PurpleSloth/Demo.meta
0 → 100644
View file @
23cdeab2
fileFormatVersion: 2
guid: 39ec677b905ffc8fba14341080fee380
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/PurpleSloth/Demo/SampleScene.unity
0 → 100644
View file @
23cdeab2
This diff is collapsed.
Click to expand it.
Assets/PurpleSloth/SampleScene.unity.meta
→
Assets/PurpleSloth/
Demo/
SampleScene.unity.meta
View file @
23cdeab2
File moved
Assets/PurpleSloth/Demo/Scripts.meta
0 → 100644
View file @
23cdeab2
fileFormatVersion: 2
guid: a483ece5b0dac0179b7001be19d0b5c6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/PurpleSloth/Demo/Scripts/ButtonScript.cs
0 → 100644
View file @
23cdeab2
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
ButtonScript
:
MonoBehaviour
{
public
InputField
inputText
;
public
InputField
inputLang
;
public
InputField
inputRate
;
public
InputField
inputPitch
;
public
Dropdown
voiceSelection
;
private
void
Awake
()
{
inputLang
.
text
=
"en-US"
;
inputRate
.
text
=
"1.0"
;
inputPitch
.
text
=
"1.0"
;
}
public
void
OnBtnPressed
()
{
// transfer options from input fields to TTS settings
PurpleSloth
.
TextToSpeech
.
language
=
inputLang
.
text
;
PurpleSloth
.
TextToSpeech
.
pitch
=
float
.
Parse
(
inputPitch
.
text
);
PurpleSloth
.
TextToSpeech
.
rate
=
float
.
Parse
(
inputRate
.
text
);
if
(
voiceSelection
.
options
.
Count
==
0
)
{
// if we have no initialized voice list yet simply use the default voice
PurpleSloth
.
TextToSpeech
.
Say
(
inputText
.
text
);
}
else
{
PurpleSloth
.
TextToSpeech
.
Say
(
inputText
.
text
,
voiceSelection
.
value
);
}
}
}
Assets/ButtonScript.cs.meta
→
Assets/
PurpleSloth/Demo/Scripts/
ButtonScript.cs.meta
View file @
23cdeab2
File moved
Assets/PurpleSloth/Demo/Scripts/FillVoicesList.cs
0 → 100644
View file @
23cdeab2
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Linq
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
FillVoicesList
:
MonoBehaviour
{
void
Update
()
{
// we don't know exactly when the browser fills the list of available voices
// so we simply request it until we receive a non-empty result
var
voices
=
PurpleSloth
.
TextToSpeech
.
AvailableVoices
();
if
(
voices
.
Length
==
0
)
return
;
Dropdown
list
=
GetComponent
<
Dropdown
>();
list
.
AddOptions
(
voices
.
Select
(
v
=>
new
Dropdown
.
OptionData
(
v
)).
ToList
());
this
.
enabled
=
false
;
// no need to execute this script anymore
}
}
Assets/PurpleSloth/Demo/Scripts/FillVoicesList.cs.meta
0 → 100644
View file @
23cdeab2
fileFormatVersion: 2
guid: 2b2012dc0e1eac6728750ecd6a273b58
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/PurpleSloth/SampleScene.unity
deleted
100644 → 0
View file @
a4a56f6e
This diff is collapsed.
Click to expand it.
ProjectSettings/EditorBuildSettings.asset
View file @
23cdeab2
...
...
@@ -6,6 +6,6 @@ EditorBuildSettings:
serializedVersion
:
2
m_Scenes
:
-
enabled
:
1
path
:
Assets/PurpleSloth/SampleScene.unity
path
:
Assets/PurpleSloth/
Demo/
SampleScene.unity
guid
:
2cda990e2423bbf4892e6590ba056729
m_configObjects
:
{}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment