/
p_speech.cc
99 lines (83 loc) · 2.44 KB
/
p_speech.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
* Player - One Hell of a Robot Server
* Copyright (C) 2004, 2005 Richard Vaughan
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/*
* Desc: Speech player driver
* Author: Pooya Karimian
* Date: 21 March 2006
* CVS: $Id$
*/
#include "p_driver.h"
using namespace Stg;
/** @addtogroup player
@par Speech interface
- PLAYER_SPEECH_CMD_SAY
*/
InterfaceSpeech::InterfaceSpeech( player_devaddr_t addr,
StgDriver* driver,
ConfigFile* cf,
int section )
: InterfaceModel( addr, driver, cf, section, "" )
{
// nothing to do
}
void InterfaceSpeech::Publish( void )
{
/*
speech_data_t* sdata = (speech_data_t*)mod->data;
assert(sdata);
player_speech_cmd_t pdata;
memset( &pdata, 0, sizeof(pdata) );
// Translate the Stage-formatted sdata into the Player-formatted pdata
// Publish it
this->driver->Publish(this->addr, NULL,
PLAYER_MSGTYPE_DATA,
PLAYER_SPEECH_CMD_SAY,
(void*)&pdata, sizeof(pdata), NULL);
*/
}
int InterfaceSpeech::ProcessMessage( QueuePointer & resp_queue,
player_msghdr_t* hdr,
void* data )
{
// PROCESS INCOMING REQUESTS HERE
if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD,
PLAYER_SPEECH_CMD_SAY,
this->addr))
{
// if( hdr->size == sizeof(player_speech_cmd_t) )
// {
player_speech_cmd_t* pcmd = (player_speech_cmd_t*)data;
// Pass it to stage:
mod->Say( pcmd->string );
return( 0 );
// }
// else
// {
// PRINT_ERR2( "wrong size speech command packet (%d/%d bytes)",
// (int)hdr->size, (int)sizeof(player_speech_cmd_t) );
//
// return( -1 );
// }
}
PRINT_WARN2( "stage speech doesn't support message id:%d/%d",
hdr->type, hdr->subtype );
return ( -1 );
}