Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TextToSpeech
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Accelerators
System
TextToSpeech
Commits
2b2665d8
Commit
2b2665d8
authored
7 years ago
by
Stuart Mark James
Browse files
Options
Downloads
Patches
Plain Diff
Clean result queue, some logging upped to Info level
parent
b109f109
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
TextToSpeech.cpp
+4
-0
4 additions, 0 deletions
TextToSpeech.cpp
tts_library/TTSRunner.cpp
+17
-9
17 additions, 9 deletions
tts_library/TTSRunner.cpp
with
21 additions
and
9 deletions
TextToSpeech.cpp
+
4
−
0
View file @
2b2665d8
...
...
@@ -167,7 +167,10 @@ void TextToSpeech::delete_device()
// join the debug thread
if
(
debug_and_states_handler
.
joinable
())
{
result_queue
.
clear
();
debug_and_states_handler
.
join
();
}
CORBA
::
string_free
(
*
attr_text_to_talk_read
);
...
...
@@ -939,6 +942,7 @@ void TextToSpeech::dev_clear()
// clear the queue then stop the current playback
tts_runner
.
clearAllRequests
();
tts_runner
.
stopPlayback
();
result_queue
.
clear
();
}
catch
(
const
exception
&
e
)
{
...
...
This diff is collapsed.
Click to expand it.
tts_library/TTSRunner.cpp
+
17
−
9
View file @
2b2665d8
...
...
@@ -50,7 +50,7 @@ TTSRunner::~TTSRunner()
void
TTSRunner
::
initialise
()
{
TRACE_LOGGER
;
LOG
(
Debug
)
<<
"Initialising the TTS Runner and its worker thread"
<<
endl
;
LOG
(
Info
)
<<
"Initialising the TTS Runner and its worker thread"
<<
endl
;
// allocate all the various sub systems and bring them up
_polly_driver
=
new
PollyTTSDriver
();
...
...
@@ -91,7 +91,7 @@ void TTSRunner::initialise()
void
TTSRunner
::
initialiseCache
(
const
std
::
string
&
cache_location
)
{
TRACE_LOGGER
;
LOG
(
Debug
)
<<
"Initialising the caching system"
<<
endl
;
LOG
(
Info
)
<<
"Initialising the caching system"
<<
endl
;
checkInitState
();
lock_guard
<
mutex
>
lock
(
_access_mutex
);
_audio_cache
=
new
FileTTSCache
(
cache_location
,
true
);
...
...
@@ -102,7 +102,7 @@ void TTSRunner::initialiseCache(const std::string &cache_location)
void
TTSRunner
::
initialiseJingle
(
const
std
::
string
&
jingle_location
)
{
TRACE_LOGGER
;
LOG
(
Debug
)
<<
"Initialising the jingle system"
<<
endl
;
LOG
(
Info
)
<<
"Initialising the jingle system"
<<
endl
;
checkInitState
();
lock_guard
<
mutex
>
lock
(
_access_mutex
);
_jingle_mgr
=
new
JingleMgr
(
jingle_location
);
...
...
@@ -113,7 +113,7 @@ void TTSRunner::initialiseJingle(const std::string &jingle_location)
void
TTSRunner
::
destroy
()
{
TRACE_LOGGER
;
LOG
(
Debug
)
<<
"Destroying the TTS Runner and joining its worker thread"
<<
endl
;
LOG
(
Info
)
<<
"Destroying the TTS Runner and joining its worker thread"
<<
endl
;
if
(
_worker_thread
.
joinable
())
{
...
...
@@ -156,7 +156,7 @@ void TTSRunner::destroy()
future
<
bool
>
TTSRunner
::
addRequest
(
const
TTSRequest
&
request
)
{
TRACE_LOGGER
;
LOG
(
Debug
)
<<
"Pushing request to speak text: "
<<
request
.
_text
<<
", voice: "
<<
request
.
_voice
<<
endl
;
LOG
(
Info
)
<<
"Pushing request to speak text: "
<<
request
.
_text
<<
", voice: "
<<
request
.
_voice
<<
endl
;
checkInitState
();
// wrap the request inside an internal structure for conviences
...
...
@@ -177,7 +177,7 @@ future<bool> TTSRunner::addRequest(const TTSRequest &request)
void
TTSRunner
::
stopPlayback
()
{
TRACE_LOGGER
;
LOG
(
Debug
)
<<
"Requesting any current audio message playback is stopped"
<<
endl
;
LOG
(
Info
)
<<
"Requesting any current audio message playback is stopped"
<<
endl
;
checkInitState
();
// we do not need to lock these calls, since pulse audio has its own locking
...
...
@@ -195,7 +195,7 @@ void TTSRunner::stopPlayback()
void
TTSRunner
::
clearAllRequests
()
{
TRACE_LOGGER
;
LOG
(
Debug
)
<<
"Clearing any queued message requests"
<<
endl
;
LOG
(
Info
)
<<
"Clearing any queued message requests"
<<
endl
;
checkInitState
();
_request_queue
.
clear
();
}
...
...
@@ -344,7 +344,7 @@ void TTSRunner::checkInitState() const
void
TTSRunner
::
mainLoop
()
{
TRACE_LOGGER
;
LOG
(
Debug
)
<<
"Starting main worker
loop
"
<<
endl
;
LOG
(
Info
)
<<
"Starting main
loop
worker
thread
"
<<
endl
;
try
{
...
...
@@ -412,18 +412,21 @@ void TTSRunner::mainLoop()
buffer
=
_polly_driver
->
getSpeechBuffer
(
text
,
voice
);
_audio_cache
->
cache
(
text
,
buffer
,
voice
);
_polly_requests
++
;
LOG
(
Info
)
<<
"Looked up <"
<<
text
<<
"> speech buffer from polly due to cache failure"
<<
endl
;
}
else
{
// valid cache hit, increment the stats
_cache_hits
++
;
LOG
(
Info
)
<<
"Using cached <"
<<
text
<<
"> speech buffer"
<<
endl
;
}
}
else
{
// no caching, always try to get it from amazon
buffer
=
_polly_driver
->
getSpeechBuffer
(
text
,
voice
);
_polly_requests
++
;
_polly_requests
++
;
LOG
(
Info
)
<<
"Looked up <"
<<
text
<<
"> speech buffer from polly"
<<
endl
;
}
return
buffer
;
...
...
@@ -457,6 +460,7 @@ void TTSRunner::mainLoop()
// something went wrong, or the playback was aborted, skip
// the rest of this tts
lock
.
unlock
();
LOG
(
Info
)
<<
"Speech request broken (possible exit request)"
<<
endl
;
req
.
_result
.
set_value
(
false
);
continue
;
}
...
...
@@ -474,6 +478,7 @@ void TTSRunner::mainLoop()
// check no exit request before blocking on speech
if
(
_exit_thread
)
{
LOG
(
Info
)
<<
"Speech request broken (exit request)"
<<
endl
;
req
.
_result
.
set_value
(
false
);
continue
;
}
...
...
@@ -483,6 +488,7 @@ void TTSRunner::mainLoop()
// if we reached this far, chances are the audio was played, so
// trigger the future with an indication of success
LOG
(
Info
)
<<
"Speech request successful"
<<
endl
;
req
.
_result
.
set_value
(
true
);
}
catch
(
const
exception
&
e
)
...
...
@@ -509,5 +515,7 @@ void TTSRunner::mainLoop()
// then pick them up and report them up to the user
ExceptionQueue
.
push
(
current_exception
());
}
LOG
(
Info
)
<<
"Exciting mainloop worker thread"
<<
endl
;
}
}
// TTSLibrary
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment