📄 tts_client.cpp
字号:
/////////////////////////////////////////////////////////////////////////////
// $Id: tts_client.cpp,v 1.2 2001/09/11 12:02:57 rosimildo Exp $
//
// Copyright (c) 2001 Exor International Inc. All rights reserved.
//
// MODULE DESCRIPTION:
// A simple example to show how to transfer binary information using
// the eSoap kit. This example target interop. It imports the TTSService
// from Object Space and generate the stubs for it.
//
// MODIFICATION/HISTORY:
//
// $Log: tts_client.cpp,v $
// Revision 1.2 2001/09/11 12:02:57 rosimildo
// changed copyright from Technopoint to Exit; updated version to 0.9
//
// Revision 1.1 2001/09/09 22:44:59 rosimildo
// Added TTS example.
//
//
// Created 2001/09/10 Rosimildo da Silva, ConnectTel Inc.
// [rdasilva@connecttel.com]
//
/////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <assert.h>
#include <windows.h>
#include "TTSService_proxy.h"
#define ESOAP_SERVER_URL "http://testvger.objectspace.com/soap/servlet/rpcrouter"
static void writeImage( char *filename, char *input, size_t len )
{
FILE *fp = fopen( filename, "wb" );
assert( fp );
fwrite( input, 1, len, fp );
fclose( fp );
}
const char *temp_wave = "myWave.wav";
const char *msg = "Embedded SOAP is the best SOAP toolkit around, it \
brings to your embedded device, the power of open standards.";
int main(int argc, char **argv)
{
TTSService::TTSService_Proxy proxy( ESOAP_SERVER_URL, 30 );
try
{
printf( "calling getBase64Wave(), plase wait..." );
// Input:
// Text String. The text that you want to use for TTS wave file generation.
// Speed float. The speed of the generated sound. Range: 1 to 100.
// Pitch float. The pitch of the sound. Range: 1 to 100.
// Volume float. The volume of the wave file. Range: 1 to 100.
// esoap::Packet image = proxy.getBase64Wave( msg );
esoap::Packet image = proxy.getBase64Wave( msg, 40, 50, 90 );
printf( " done.\n" );
writeImage( (char *)temp_wave, image.c_str(), image.size() );
PlaySound( temp_wave, 0, SND_SYNC );
}
catch( esoap::SoapException & e )
{
printf( "SOAP Fault: Code=%s, String=%s\n",
e.getCode().c_str(), e.getString().c_str() );
}
catch( ... )
{
printf( "Weird C++ error. Please fix your code. :-)\n" );
}
// just to cleanup the memory...
delete esoap::ParameterFactory::setInstance( 0 );
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -