How to use Index Marks in “speech-dispatcher”?

2019-06-01 08:19发布

问题:

So, question like in theme: "How to use Index Marks in speech-dispatcher?" I hear many about it but can't find any tutorial with how to use it in SPD_MODE_THREADED. The main problem is when you send "SPEAK" command, you can't change data mode to SPD_DATA_SSML. And I think I doing something wrong. So, who knows how to use this Index Marks, tutorials is very acceptable too. Thank you!

回答1:

Solved, this is the way to set index marks in speech-dispatcher:

pthread_mutex_lock( m_connection->ssip_mutex );

spd_execute_command_wo_mutex( m_connection, "SET SELF SSML_MODE on" );

spd_execute_command_wo_mutex( m_connection, "SPEAK" );

char * reply = spd_send_data_wo_mutex( m_connection, "<speak>Hello, <mark name=\"mark1\"/> how does it work?</speak>", SPD_NO_REPLY );
delete[] reply;

spd_execute_command_wo_mutex( m_connection, "\r\n." );

spd_execute_command_wo_mutex( m_connection, "SET SELF SSML_MODE off" );

pthread_mutex_unlock( m_connection->ssip_mutex );

Where <mark name=\"mark1\"/> is index mark. And mark1 is index mark name.

This docs is very useful for low level speech-dispatcher communication: http://cvs.freebsoft.org/doc/speechd/ssip.html#Top