🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #955

Re: BCB and SAPI v5

#955
From: Marc
Date: Wed, 21 Nov 2007 21:35
110 lines
4843 bytes
Gambit

> > Has anyone ever successfully used SAPI v5 with BCB6
>
> Yes.

At least this is comforting :-)


As for the code:
You are right, I made a mistake when I pasted my sample as I cleaned it for 
display purposes.
I attached it again, cAudioFmt is not declared as pointer and should be 
initialized, cpStream is now set to Null.  (I tried to implement the sample 
at
http://msdn2.microsoft.com/en-us/library/ms717065.aspx)

I still get the same problem though....



As for the compile errors, here they are (in German sorry):

[C++ Fehler] crtdbg.h(52): E2268 Aufruf der undefinierten Funktion '_T'
[C++ Fehler] crtdbg.h(52): E2034 Konvertierung von 'int' nach 'const char *' 
nicht m�glich
[C++ Fehler] crtdbg.h(52): E2340 Keine �bereinstimmung des Typs beim 
Parameter 2 ('const char *' erwartet, 'int' erhalten)
[C++ Fehler] SPDebug.h(337): E2303 Typname erwartet
[C++ Fehler] SPDebug.h(337): E2139 In Deklaration fehlt ;
[C++ Fehler] SPDebug.h(47): E2451 Undefiniertes Symbol 'm_hfilePrev'
[C++ Fehler] SPDebug.h(62): E2451 Undefiniertes Symbol '_CRT_WARN'
[C++ Fehler] SPDebug.h(69): E2451 Undefiniertes Symbol '_CRT_WARN'
[C++ Fehler] SPDebug.h(76): E2451 Undefiniertes Symbol '_CRT_WARN'
[C++ Fehler] SPDebug.h(86): E2451 Undefiniertes Symbol '_CRT_ASSERT'
[C++ Fehler] SPDebug.h(93): E2451 Undefiniertes Symbol '_CRT_WARN'
[C++ Fehler] SPDebug.h(177): E2451 Undefiniertes Symbol '_CRTDBG_MODE_DEBUG'
[C++ Fehler] SPDebug.h(185): E2451 Undefiniertes Symbol '_CRTDBG_MODE_WNDW'
[C++ Fehler] SPDebug.h(297): E2268 Aufruf der undefinierten Funktion 
'_CrtSetReportMode'
[C++ Fehler] SPDebug.h(298): E2451 Undefiniertes Symbol '_CRTDBG_MODE_FILE'
[C++ Fehler] SPDebug.h(309): E2451 Undefiniertes Symbol 'm_hfilePrev'
[C++ Fehler] SPDebug.h(309): E2379 In Anweisung fehlt ;
[C++ Fehler] SPDebug.h(320): E2268 Aufruf der undefinierten Funktion 
'_CrtSetReportMode'
[C++ Fehler] SPDebug.h(321): E2451 Undefiniertes Symbol '_CRTDBG_MODE_FILE'
[C++ Fehler] SPDebug.h(323): E2121 ) fehlt beim Funktionsaufruf
[C++ Fehler] SPDebug.h(371): E2268 Aufruf der undefinierten Funktion '_RPT1'
[C++ Fehler] SPDebug.h(371): E2451 Undefiniertes Symbol '_CRT_WARN'
[C++ Fehler] SPDebug.h(380): E2451 Undefiniertes Symbol '_CRT_WARN'
[C++ Fehler] SPDebug.h(380): E2268 Aufruf der undefinierten Funktion '_RPT1'
[C++ Fehler] sphelper.h(446): E2268 Aufruf der undefinierten Funktion 
'_RPT3'
[C++ Fehler] sphelper.h(446): E2228 Zu viele Fehlermeldungen oder Warnungen



What puzzels me is that when I search for _CRTDBG_MODE_DEBUG on my PC I 
never get actually a definition of it, hence I am wondering if I am missing 
some files...


Rds
Marc



//*******************************************************************
void TSpeech::SpeakToFile(String Words, String sFileName)
{

 HRESULT         hr = S_OK;
 ISpStream       *cpStream=NULL;
 ISpVoice        *cpVoice;
 CSpStreamFormat cAudioFmt;

 //Create a SAPI Voice
     hr = CoCreateInstance( CLSID_SpVoice,NULL,CLSCTX_ALL,IID_ISpVoice, 
(void**)&cpVoice);

 //Set the audio format
 if(SUCCEEDED(hr))
   hr = cAudioFmt.AssignFormat(SPSF_22kHz16BitMono);

 //Call SPBindToFile, a SAPI helper method,  to bind the audio stream to the 
file
 if(SUCCEEDED(hr))
    hr = SPBindToFile( L"c:\\ttstemp.wav",  SPFM_CREATE_ALWAYS, &cpStream, 
&cAudioFmt.FormatId(),cAudioFmt.WaveFormatExPtr());

 if (hr == E_INVALIDARG)
        MessageBox(NULL,"E_INVALIDARG","Error",MB_OK);

 //set the output to cpStream so that the output audio data will be stored 
in cpStream
 if(SUCCEEDED(hr))
   hr = cpVoice->SetOutput( cpStream, TRUE );

 //Speak the text �hello world� synchronously
 if(SUCCEEDED(hr))
   hr = cpVoice->Speak( L"Hello World",  SPF_DEFAULT, NULL );

 //close the stream
 if(SUCCEEDED(hr))
   hr = cpStream->Close();

 //Release the stream
 cpStream->Release ();
 cpVoice->Release();
}
Technical Details
Message-ID: <4744a4e3$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <47446f75$1@newsgroups.borland.com> <47449cae@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,67677465280073fd
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII
Reply-To: "Marc" <info@mawnet.com>
From: "Marc" <info@mawnet.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <47446f75$1@newsgroups.borland.com> <47449cae@newsgroups.borland.com>
Subject: Re: BCB and SAPI v5
Date: Wed, 21 Nov 2007 22:35:30 +0100
Lines: 114
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 83.76.7.81
Message-ID: <4744a4e3$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1195680995 83.76.7.81 (21 Nov 2007 13:36:35 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail