Thread View: borland.public.cppbuilder.nativeapi
19 messages
19 total messages
Started by Marc
Sat, 17 Nov 2007 10:10
Startup help with SAPI
Author: Marc
Date: Sat, 17 Nov 2007 10:10
Date: Sat, 17 Nov 2007 10:10
9 lines
1113 bytes
1113 bytes
Hi all I try to implement a simple SAPI application that reads back a phone number. I downloaded the SDK 5.1 from Microsoft and had a look at the samples... and did not quite got into it. Does someone has a simple sample in BCB that just shows how to speak a number? Rds Marc
Re: Startup help with SAPI
Author: JohnC
Date: Sat, 17 Nov 2007 13:13
Date: Sat, 17 Nov 2007 13:13
84 lines
3247 bytes
3247 bytes
The following will "speak" anything - numbers as well as words.
John
//---------------------------------------------------------------------------
#ifndef JMCSpeechH
#define JMCSpeechH
#include <sapi.h> //For ISp definitions - part of SDK
//---------------------------------------------------------------------------
//Speech Utilities:
//This object instantiates the COM Object SpVoice and gives us an easy
//function call in order to speak a string.
class TJMCSpeech
{
public:
TJMCSpeech(); //Constructor
~TJMCSpeech(); //Destructor
void Speak(String Words); //Speak the input words in the string.
private:
HRESULT hr;
ISpVoice* pVoice;
};
#endif
-------------------
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "JMCSpeech.h"
//#include "SUTIL.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//Constructor
TJMCSpeech::TJMCSpeech()
{
hr = S_OK;
pVoice = NULL;
::CoInitialize(NULL);
//Create a SAPI voice:
hr = CoCreateInstance( CLSID_SpVoice,NULL,CLSCTX_ALL,IID_ISpVoice,
(void**)&pVoice);
}
//Destructor
TJMCSpeech::~TJMCSpeech()
{
if(SUCCEEDED(hr))
pVoice->Release();
::CoUninitialize();
}
//---------------------------------------------------------------------------
void TJMCSpeech::Speak(String Words)
{
if(SUCCEEDED(hr))
pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
}
//Note: I originally had:
// pVoice->Speak(TJMCSUtil::StrToBSTR(Words),SPF_DEFAULT,NULL);
//It was pointed out by Remy Lebeau (TeamB) <no.spam@no.spam.com>
//that this was a memory leak and that I should use the following:
// pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
//---------------------------------------------------------------------------
"Marc" <info@mawnet.com> wrote in message
news:473ebe39$1@newsgroups.borland.com...
> Hi all
>
> I try to implement a simple SAPI application that reads back a phone
> number. I downloaded the SDK 5.1 from Microsoft and had a look at the
> samples... and did not quite got into it. Does someone has a simple sample
> in BCB that just shows how to speak a number?
>
> Rds
> Marc
>
Re: Startup help with SAPI
Author: Marc
Date: Sat, 17 Nov 2007 13:57
Date: Sat, 17 Nov 2007 13:57
91 lines
3617 bytes
3617 bytes
Thanks!
"JohnC" <jcibulskis@sbcglobal.net> schrieb im Newsbeitrag
news:473ee927$1@newsgroups.borland.com...
> The following will "speak" anything - numbers as well as words.
> John
> //---------------------------------------------------------------------------
>
> #ifndef JMCSpeechH
> #define JMCSpeechH
>
> #include <sapi.h> //For ISp definitions - part of SDK
>
> //---------------------------------------------------------------------------
>
> //Speech Utilities:
> //This object instantiates the COM Object SpVoice and gives us an easy
> //function call in order to speak a string.
>
> class TJMCSpeech
> {
> public:
> TJMCSpeech(); //Constructor
> ~TJMCSpeech(); //Destructor
> void Speak(String Words); //Speak the input words in the string.
> private:
> HRESULT hr;
> ISpVoice* pVoice;
> };
>
>
> #endif
> -------------------
> //---------------------------------------------------------------------------
> #include <vcl.h>
> #pragma hdrstop
>
> #include "JMCSpeech.h"
> //#include "SUTIL.h"
> //---------------------------------------------------------------------------
>
> #pragma package(smart_init)
>
> //Constructor
> TJMCSpeech::TJMCSpeech()
> {
> hr = S_OK;
> pVoice = NULL;
> ::CoInitialize(NULL);
>
> //Create a SAPI voice:
> hr = CoCreateInstance( CLSID_SpVoice,NULL,CLSCTX_ALL,IID_ISpVoice,
> (void**)&pVoice);
> }
> //Destructor
> TJMCSpeech::~TJMCSpeech()
> {
> if(SUCCEEDED(hr))
> pVoice->Release();
>
> ::CoUninitialize();
> }
> //---------------------------------------------------------------------------
> void TJMCSpeech::Speak(String Words)
> {
> if(SUCCEEDED(hr))
> pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
> }
> //Note: I originally had:
> // pVoice->Speak(TJMCSUtil::StrToBSTR(Words),SPF_DEFAULT,NULL);
> //It was pointed out by Remy Lebeau (TeamB) <no.spam@no.spam.com>
> //that this was a memory leak and that I should use the following:
> // pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
> //---------------------------------------------------------------------------
>
>
> "Marc" <info@mawnet.com> wrote in message
> news:473ebe39$1@newsgroups.borland.com...
>> Hi all
>>
>> I try to implement a simple SAPI application that reads back a phone
>> number. I downloaded the SDK 5.1 from Microsoft and had a look at the
>> samples... and did not quite got into it. Does someone has a simple
>> sample in BCB that just shows how to speak a number?
>>
>> Rds
>> Marc
>>
>
>
Re: Startup help with SAPI
Author: Marc
Date: Sat, 17 Nov 2007 15:00
Date: Sat, 17 Nov 2007 15:00
105 lines
3964 bytes
3964 bytes
John
I tried this but hit a wall.
I used implib to create a BCB compatible library, but now I get the errors
[Linker Error] Unresolved external '_IID_ISpVoice' referenced from
T:\UNIT2.OBJ
[Linker Error] Unresolved external '_CLSID_SpVoice' referenced from
T:\UNIT2.OBJ
I found some references for this on Google, but no solution :-(
Rds
Marc
"JohnC" <jcibulskis@sbcglobal.net> schrieb im Newsbeitrag
news:473ee927$1@newsgroups.borland.com...
> The following will "speak" anything - numbers as well as words.
> John
> //---------------------------------------------------------------------------
>
> #ifndef JMCSpeechH
> #define JMCSpeechH
>
> #include <sapi.h> //For ISp definitions - part of SDK
>
> //---------------------------------------------------------------------------
>
> //Speech Utilities:
> //This object instantiates the COM Object SpVoice and gives us an easy
> //function call in order to speak a string.
>
> class TJMCSpeech
> {
> public:
> TJMCSpeech(); //Constructor
> ~TJMCSpeech(); //Destructor
> void Speak(String Words); //Speak the input words in the string.
> private:
> HRESULT hr;
> ISpVoice* pVoice;
> };
>
>
> #endif
> -------------------
> //---------------------------------------------------------------------------
> #include <vcl.h>
> #pragma hdrstop
>
> #include "JMCSpeech.h"
> //#include "SUTIL.h"
> //---------------------------------------------------------------------------
>
> #pragma package(smart_init)
>
> //Constructor
> TJMCSpeech::TJMCSpeech()
> {
> hr = S_OK;
> pVoice = NULL;
> ::CoInitialize(NULL);
>
> //Create a SAPI voice:
> hr = CoCreateInstance( CLSID_SpVoice,NULL,CLSCTX_ALL,IID_ISpVoice,
> (void**)&pVoice);
> }
> //Destructor
> TJMCSpeech::~TJMCSpeech()
> {
> if(SUCCEEDED(hr))
> pVoice->Release();
>
> ::CoUninitialize();
> }
> //---------------------------------------------------------------------------
> void TJMCSpeech::Speak(String Words)
> {
> if(SUCCEEDED(hr))
> pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
> }
> //Note: I originally had:
> // pVoice->Speak(TJMCSUtil::StrToBSTR(Words),SPF_DEFAULT,NULL);
> //It was pointed out by Remy Lebeau (TeamB) <no.spam@no.spam.com>
> //that this was a memory leak and that I should use the following:
> // pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
> //---------------------------------------------------------------------------
>
>
> "Marc" <info@mawnet.com> wrote in message
> news:473ebe39$1@newsgroups.borland.com...
>> Hi all
>>
>> I try to implement a simple SAPI application that reads back a phone
>> number. I downloaded the SDK 5.1 from Microsoft and had a look at the
>> samples... and did not quite got into it. Does someone has a simple
>> sample in BCB that just shows how to speak a number?
>>
>> Rds
>> Marc
>>
>
>
Re: Startup help with SAPI
Author: Marc
Date: Sat, 17 Nov 2007 16:54
Date: Sat, 17 Nov 2007 16:54
117 lines
4325 bytes
4325 bytes
I also tried to use coff2omf to convert the sapi.lib library, but the
resulting library is only 1Kb (the original sapi.lib has 39kB) and it gives
me the same error message....
What am I doing wrong here ?
Rds
Marc
"Marc" <info@mawnet.com> schrieb im Newsbeitrag
news:473f0239$1@newsgroups.borland.com...
> John
>
> I tried this but hit a wall.
> I used implib to create a BCB compatible library, but now I get the errors
>
> [Linker Error] Unresolved external '_IID_ISpVoice' referenced from
> T:\UNIT2.OBJ
> [Linker Error] Unresolved external '_CLSID_SpVoice' referenced from
> T:\UNIT2.OBJ
>
> I found some references for this on Google, but no solution :-(
>
> Rds
> Marc
>
>
>
> "JohnC" <jcibulskis@sbcglobal.net> schrieb im Newsbeitrag
> news:473ee927$1@newsgroups.borland.com...
>> The following will "speak" anything - numbers as well as words.
>> John
>> //---------------------------------------------------------------------------
>>
>> #ifndef JMCSpeechH
>> #define JMCSpeechH
>>
>> #include <sapi.h> //For ISp definitions - part of SDK
>>
>> //---------------------------------------------------------------------------
>>
>> //Speech Utilities:
>> //This object instantiates the COM Object SpVoice and gives us an easy
>> //function call in order to speak a string.
>>
>> class TJMCSpeech
>> {
>> public:
>> TJMCSpeech(); //Constructor
>> ~TJMCSpeech(); //Destructor
>> void Speak(String Words); //Speak the input words in the string.
>> private:
>> HRESULT hr;
>> ISpVoice* pVoice;
>> };
>>
>>
>> #endif
>> -------------------
>> //---------------------------------------------------------------------------
>> #include <vcl.h>
>> #pragma hdrstop
>>
>> #include "JMCSpeech.h"
>> //#include "SUTIL.h"
>> //---------------------------------------------------------------------------
>>
>> #pragma package(smart_init)
>>
>> //Constructor
>> TJMCSpeech::TJMCSpeech()
>> {
>> hr = S_OK;
>> pVoice = NULL;
>> ::CoInitialize(NULL);
>>
>> //Create a SAPI voice:
>> hr = CoCreateInstance( CLSID_SpVoice,NULL,CLSCTX_ALL,IID_ISpVoice,
>> (void**)&pVoice);
>> }
>> //Destructor
>> TJMCSpeech::~TJMCSpeech()
>> {
>> if(SUCCEEDED(hr))
>> pVoice->Release();
>>
>> ::CoUninitialize();
>> }
>> //---------------------------------------------------------------------------
>> void TJMCSpeech::Speak(String Words)
>> {
>> if(SUCCEEDED(hr))
>> pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
>> }
>> //Note: I originally had:
>> // pVoice->Speak(TJMCSUtil::StrToBSTR(Words),SPF_DEFAULT,NULL);
>> //It was pointed out by Remy Lebeau (TeamB) <no.spam@no.spam.com>
>> //that this was a memory leak and that I should use the following:
>> // pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
>> //---------------------------------------------------------------------------
>>
>>
>> "Marc" <info@mawnet.com> wrote in message
>> news:473ebe39$1@newsgroups.borland.com...
>>> Hi all
>>>
>>> I try to implement a simple SAPI application that reads back a phone
>>> number. I downloaded the SDK 5.1 from Microsoft and had a look at the
>>> samples... and did not quite got into it. Does someone has a simple
>>> sample in BCB that just shows how to speak a number?
>>>
>>> Rds
>>> Marc
>>>
>>
>>
>
>
Re: Startup help with SAPI: recreation of sapi.lib
Author: Marc
Date: Sat, 17 Nov 2007 17:57
Date: Sat, 17 Nov 2007 17:57
136 lines
5188 bytes
5188 bytes
I had to recreate the sapi.lib file using a hint I found under
http://groups.google.com/group/microsoft.public.sapi5.beta/browse_thread/thread/266dbd95a122f538/67583689d599d4fa?lnk=st&q=#67583689d599d4fa
>>>>>>>>>>
You were right, I only had to use MIDL with sapi.idl file, and
its /c_ext option. This running generated two files: sapi_i.c and
sapi_p.c. I've add the first one to my project and it works!!
>>>>>>>>>>
Now it works for me too :-)
Rds
Marc
"Marc" <info@mawnet.com> schrieb im Newsbeitrag
news:473f1d0a@newsgroups.borland.com...
>I also tried to use coff2omf to convert the sapi.lib library, but the
>resulting library is only 1Kb (the original sapi.lib has 39kB) and it gives
>me the same error message....
> What am I doing wrong here ?
>
> Rds
> Marc
>
> "Marc" <info@mawnet.com> schrieb im Newsbeitrag
> news:473f0239$1@newsgroups.borland.com...
>> John
>>
>> I tried this but hit a wall.
>> I used implib to create a BCB compatible library, but now I get the
>> errors
>>
>> [Linker Error] Unresolved external '_IID_ISpVoice' referenced from
>> T:\UNIT2.OBJ
>> [Linker Error] Unresolved external '_CLSID_SpVoice' referenced from
>> T:\UNIT2.OBJ
>>
>> I found some references for this on Google, but no solution :-(
>>
>> Rds
>> Marc
>>
>>
>>
>> "JohnC" <jcibulskis@sbcglobal.net> schrieb im Newsbeitrag
>> news:473ee927$1@newsgroups.borland.com...
>>> The following will "speak" anything - numbers as well as words.
>>> John
>>> //---------------------------------------------------------------------------
>>>
>>> #ifndef JMCSpeechH
>>> #define JMCSpeechH
>>>
>>> #include <sapi.h> //For ISp definitions - part of SDK
>>>
>>> //---------------------------------------------------------------------------
>>>
>>> //Speech Utilities:
>>> //This object instantiates the COM Object SpVoice and gives us an easy
>>> //function call in order to speak a string.
>>>
>>> class TJMCSpeech
>>> {
>>> public:
>>> TJMCSpeech(); //Constructor
>>> ~TJMCSpeech(); //Destructor
>>> void Speak(String Words); //Speak the input words in the string.
>>> private:
>>> HRESULT hr;
>>> ISpVoice* pVoice;
>>> };
>>>
>>>
>>> #endif
>>> -------------------
>>> //---------------------------------------------------------------------------
>>> #include <vcl.h>
>>> #pragma hdrstop
>>>
>>> #include "JMCSpeech.h"
>>> //#include "SUTIL.h"
>>> //---------------------------------------------------------------------------
>>>
>>> #pragma package(smart_init)
>>>
>>> //Constructor
>>> TJMCSpeech::TJMCSpeech()
>>> {
>>> hr = S_OK;
>>> pVoice = NULL;
>>> ::CoInitialize(NULL);
>>>
>>> //Create a SAPI voice:
>>> hr = CoCreateInstance( CLSID_SpVoice,NULL,CLSCTX_ALL,IID_ISpVoice,
>>> (void**)&pVoice);
>>> }
>>> //Destructor
>>> TJMCSpeech::~TJMCSpeech()
>>> {
>>> if(SUCCEEDED(hr))
>>> pVoice->Release();
>>>
>>> ::CoUninitialize();
>>> }
>>> //---------------------------------------------------------------------------
>>> void TJMCSpeech::Speak(String Words)
>>> {
>>> if(SUCCEEDED(hr))
>>> pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
>>> }
>>> //Note: I originally had:
>>> // pVoice->Speak(TJMCSUtil::StrToBSTR(Words),SPF_DEFAULT,NULL);
>>> //It was pointed out by Remy Lebeau (TeamB) <no.spam@no.spam.com>
>>> //that this was a memory leak and that I should use the following:
>>> // pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
>>> //---------------------------------------------------------------------------
>>>
>>>
>>> "Marc" <info@mawnet.com> wrote in message
>>> news:473ebe39$1@newsgroups.borland.com...
>>>> Hi all
>>>>
>>>> I try to implement a simple SAPI application that reads back a phone
>>>> number. I downloaded the SDK 5.1 from Microsoft and had a look at the
>>>> samples... and did not quite got into it. Does someone has a simple
>>>> sample in BCB that just shows how to speak a number?
>>>>
>>>> Rds
>>>> Marc
>>>>
>>>
>>>
>>
>>
>
>
Re: Startup help with SAPI: recreation of sapi.lib
Author: JohnC
Date: Sun, 18 Nov 2007 03:09
Date: Sun, 18 Nov 2007 03:09
154 lines
5857 bytes
5857 bytes
Marc:
Been out all day and just saw your notes.
I don't recall having any problem with the sapi files.
I'm running XP MediaCenter which is XP Pro with Media Center added.
I also installed the same program on a PC with Vista Home Basic and it
worked fine immediately on that computer.
What operating system are you using?
Then again, I'm using BDS 2006. What are you using?
Maybe we can get someone from the B Team to clear this up.
John
"Marc" <info@mawnet.com> wrote in message
news:473f2bc8$1@newsgroups.borland.com...
>I had to recreate the sapi.lib file using a hint I found under
> http://groups.google.com/group/microsoft.public.sapi5.beta/browse_thread/thread/266dbd95a122f538/67583689d599d4fa?lnk=st&q=#67583689d599d4fa
>
>>>>>>>>>>>
> You were right, I only had to use MIDL with sapi.idl file, and
> its /c_ext option. This running generated two files: sapi_i.c and
> sapi_p.c. I've add the first one to my project and it works!!
>>>>>>>>>>>
>
> Now it works for me too :-)
>
> Rds
> Marc
>
> "Marc" <info@mawnet.com> schrieb im Newsbeitrag
> news:473f1d0a@newsgroups.borland.com...
>>I also tried to use coff2omf to convert the sapi.lib library, but the
>>resulting library is only 1Kb (the original sapi.lib has 39kB) and it
>>gives me the same error message....
>> What am I doing wrong here ?
>>
>> Rds
>> Marc
>>
>> "Marc" <info@mawnet.com> schrieb im Newsbeitrag
>> news:473f0239$1@newsgroups.borland.com...
>>> John
>>>
>>> I tried this but hit a wall.
>>> I used implib to create a BCB compatible library, but now I get the
>>> errors
>>>
>>> [Linker Error] Unresolved external '_IID_ISpVoice' referenced from
>>> T:\UNIT2.OBJ
>>> [Linker Error] Unresolved external '_CLSID_SpVoice' referenced from
>>> T:\UNIT2.OBJ
>>>
>>> I found some references for this on Google, but no solution :-(
>>>
>>> Rds
>>> Marc
>>>
>>>
>>>
>>> "JohnC" <jcibulskis@sbcglobal.net> schrieb im Newsbeitrag
>>> news:473ee927$1@newsgroups.borland.com...
>>>> The following will "speak" anything - numbers as well as words.
>>>> John
>>>> //---------------------------------------------------------------------------
>>>>
>>>> #ifndef JMCSpeechH
>>>> #define JMCSpeechH
>>>>
>>>> #include <sapi.h> //For ISp definitions - part of SDK
>>>>
>>>> //---------------------------------------------------------------------------
>>>>
>>>> //Speech Utilities:
>>>> //This object instantiates the COM Object SpVoice and gives us an easy
>>>> //function call in order to speak a string.
>>>>
>>>> class TJMCSpeech
>>>> {
>>>> public:
>>>> TJMCSpeech(); //Constructor
>>>> ~TJMCSpeech(); //Destructor
>>>> void Speak(String Words); //Speak the input words in the string.
>>>> private:
>>>> HRESULT hr;
>>>> ISpVoice* pVoice;
>>>> };
>>>>
>>>>
>>>> #endif
>>>> -------------------
>>>> //---------------------------------------------------------------------------
>>>> #include <vcl.h>
>>>> #pragma hdrstop
>>>>
>>>> #include "JMCSpeech.h"
>>>> //#include "SUTIL.h"
>>>> //---------------------------------------------------------------------------
>>>>
>>>> #pragma package(smart_init)
>>>>
>>>> //Constructor
>>>> TJMCSpeech::TJMCSpeech()
>>>> {
>>>> hr = S_OK;
>>>> pVoice = NULL;
>>>> ::CoInitialize(NULL);
>>>>
>>>> //Create a SAPI voice:
>>>> hr = CoCreateInstance( CLSID_SpVoice,NULL,CLSCTX_ALL,IID_ISpVoice,
>>>> (void**)&pVoice);
>>>> }
>>>> //Destructor
>>>> TJMCSpeech::~TJMCSpeech()
>>>> {
>>>> if(SUCCEEDED(hr))
>>>> pVoice->Release();
>>>>
>>>> ::CoUninitialize();
>>>> }
>>>> //---------------------------------------------------------------------------
>>>> void TJMCSpeech::Speak(String Words)
>>>> {
>>>> if(SUCCEEDED(hr))
>>>> pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
>>>> }
>>>> //Note: I originally had:
>>>> // pVoice->Speak(TJMCSUtil::StrToBSTR(Words),SPF_DEFAULT,NULL);
>>>> //It was pointed out by Remy Lebeau (TeamB) <no.spam@no.spam.com>
>>>> //that this was a memory leak and that I should use the following:
>>>> // pVoice->Speak(WideString(Words),SPF_DEFAULT,NULL);
>>>> //---------------------------------------------------------------------------
>>>>
>>>>
>>>> "Marc" <info@mawnet.com> wrote in message
>>>> news:473ebe39$1@newsgroups.borland.com...
>>>>> Hi all
>>>>>
>>>>> I try to implement a simple SAPI application that reads back a phone
>>>>> number. I downloaded the SDK 5.1 from Microsoft and had a look at the
>>>>> samples... and did not quite got into it. Does someone has a simple
>>>>> sample in BCB that just shows how to speak a number?
>>>>>
>>>>> Rds
>>>>> Marc
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Re: Startup help with SAPI
Author: Darko Miletic
Date: Mon, 19 Nov 2007 16:28
Date: Mon, 19 Nov 2007 16:28
15 lines
1499 bytes
1499 bytes
Marc wrote: > Hi all > > I try to implement a simple SAPI application that reads back a phone number. > I downloaded the SDK 5.1 from Microsoft and had a look at the samples... and > did not quite got into it. Does someone has a simple sample in BCB that just > shows how to speak a number? > > Rds > Marc > > bccsdk contains everything you need to develop SAPI 5. 1 app's. There is even one example supplied there. You can get it from http://bccsdk.sf.net
Re: Startup help with SAPI
Author: Michael Harris
Date: Mon, 19 Nov 2007 16:49
Date: Mon, 19 Nov 2007 16:49
39 lines
1918 bytes
1918 bytes
"Marc" wrote in message news:473ebe39$1@newsgroups.borland.com...
...
> Does someone has a simple sample in BCB that just shows how to speak a
> number?
>
> Rds
> Marc
I went about it a little differently.
Import Type Library
// Type Lib: C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll
(1)
saved as \..\CBuilder5\Imports\SpeechLib_TLB.cpp
application.cpp
USEUNIT("..\..\CBuilder5\Imports\SpeechLib_TLB.cpp");
unit1.cpp
namespace { // anon
ISpeechVoicePtr VoicePtr;
SpeechVoiceSpeakFlags eSpeechVoiceSpeakFlags = SVSFDefault;
};
void __fastcall TfrmMain::Button1Click(TObject *Sender)
{
if (!VoicePtr)
VoicePtr = CoSpVoice::Create();
VoicePtr->Speak(WideString("Hello world"), eSpeechVoiceSpeakFlags);
// or
VoicePtr->Speak(WideString(Edit1->Text), eSpeechVoiceSpeakFlags);
}
worked fine.
--
Michael
Re: Startup help with SAPI
Author: Marc
Date: Wed, 21 Nov 2007 10:50
Date: Wed, 21 Nov 2007 10:50
25 lines
1734 bytes
1734 bytes
Hi Darko Thank you for your message. I downloaded bccsdk but could not find the SAPI sample :-( Rds Marc "Darko Miletic" <kiklop@fibertel.com.ar> schrieb im Newsbeitrag news:4741b9b4$1@newsgroups.borland.com... > Marc wrote: >> Hi all >> >> I try to implement a simple SAPI application that reads back a phone >> number. I downloaded the SDK 5.1 from Microsoft and had a look at the >> samples... and did not quite got into it. Does someone has a simple >> sample in BCB that just shows how to speak a number? >> >> Rds >> Marc > > bccsdk contains everything you need to develop SAPI 5. 1 app's. There is > even one example supplied there. You can get it from http://bccsdk.sf.net
Re: Startup help with SAPI
Author: Marc
Date: Wed, 21 Nov 2007 11:25
Date: Wed, 21 Nov 2007 11:25
49 lines
2520 bytes
2520 bytes
Hi all
With your help I managed to get my first "Hello World" through the
loud-speaker :-)
So now I try to implement a SpeakToFile call.
But here things get quite out of my hands (and competence).
When I include the "sphelper.h" needed for the SPBindToFile function, I get
plenty of errors in the *.h files.
IE if I set the _DEBUG option I get the error _CRTDBG_MODE_DEBUG not defined
in the SPDebug.h and many more errors complaining about missing definitions.
I searched my PC for a definition of _CRTDBG_MODE_DEBUG and could not find
it. Does anyone know in which file the definition is supposed to be ?
So I compiled without _DEBUG and now am stuck with an error in the
sphelper.h, on line 1858
HRESULT hr = ::CoCreateInstance(CLSID_SpStream, NULL, CLSCTX_ALL,
__uuidof(*ppStream), (void **)ppStream);
Error: Invalid use of __uuidof
I am using BCB professional, v6 (Build 10.161), OS on XP SP2
Does this version have any problems or missing files ?
I also tried with bccsdk of Darko Miletic, but no success neither.
Thank you for every idea to get me a step further !
Rds
Marc
"Marc" <info@mawnet.com> schrieb im Newsbeitrag
news:473ebe39$1@newsgroups.borland.com...
> Hi all
>
> I try to implement a simple SAPI application that reads back a phone
> number. I downloaded the SDK 5.1 from Microsoft and had a look at the
> samples... and did not quite got into it. Does someone has a simple sample
> in BCB that just shows how to speak a number?
>
> Rds
> Marc
>
Re: Startup help with SAPI
Author: JohnC
Date: Wed, 21 Nov 2007 11:37
Date: Wed, 21 Nov 2007 11:37
46 lines
2527 bytes
2527 bytes
I'm still trying to figure out why you are having trouble getting SAPI at all. As far as I can see, it comes with the operating system. Check your Control Panel / Speech and look at the Text To Speech tab. If you can see at least one voice in the list, you should have SAPI installed. Try selecting from the list (even if only one voice) or press the "Preview Voice" button. If you can hear a voice, then everything should be there. Now, if I'm all wet about this, I'd appreciate it if someone would let me know. I repeat: I've been using SAPI in both XP Media Center and Vista Home Basic and did nothing special to install SAPI. John "Marc" <info@mawnet.com> wrote in message news:47440db0$1@newsgroups.borland.com... > Hi Darko > > Thank you for your message. > I downloaded bccsdk but could not find the SAPI sample :-( > > Rds > Marc > > > > "Darko Miletic" <kiklop@fibertel.com.ar> schrieb im Newsbeitrag > news:4741b9b4$1@newsgroups.borland.com... >> Marc wrote: >>> Hi all >>> >>> I try to implement a simple SAPI application that reads back a phone >>> number. I downloaded the SDK 5.1 from Microsoft and had a look at the >>> samples... and did not quite got into it. Does someone has a simple >>> sample in BCB that just shows how to speak a number? >>> >>> Rds >>> Marc >> >> bccsdk contains everything you need to develop SAPI 5. 1 app's. There is >> even one example supplied there. You can get it from http://bccsdk.sf.net > >
Re: Startup help with SAPI
Author: JohnC
Date: Wed, 21 Nov 2007 11:41
Date: Wed, 21 Nov 2007 11:41
12 lines
1425 bytes
1425 bytes
I couldn't get the sphelper stuff to work at all - gave up and did things directly. John "Marc" <info@mawnet.com> wrote in message news:47441606$1@newsgroups.borland.com... > So I compiled without _DEBUG and now am stuck with an error in the > sphelper.h, on line 1858 > HRESULT hr = ::CoCreateInstance(CLSID_SpStream, NULL, CLSCTX_ALL, > __uuidof(*ppStream), (void **)ppStream); > > Error: Invalid use of __uuidof
Re: Startup help with SAPI
Author: Marc
Date: Wed, 21 Nov 2007 12:05
Date: Wed, 21 Nov 2007 12:05
64 lines
3066 bytes
3066 bytes
John SAPI works, this was not the problem. The issue I had was with the sapi.lib that came with the SAPI SDK. It was in a different format, so I had to recreate it. This did the trick and now I was able to use its functionality (at least partly... see below) Rds Marc "JohnC" <jcibulskis@sbcglobal.net> schrieb im Newsbeitrag news:47441868$1@newsgroups.borland.com... > I'm still trying to figure out why you are having trouble getting SAPI at > all. > As far as I can see, it comes with the operating system. > Check your Control Panel / Speech and look at the Text To Speech tab. > If you can see at least one voice in the list, you should have SAPI > installed. > Try selecting from the list (even if only one voice) or press the "Preview > Voice" button. > If you can hear a voice, then everything should be there. > > Now, if I'm all wet about this, I'd appreciate it if someone would let me > know. > I repeat: I've been using SAPI in both XP Media Center and Vista Home > Basic > and did nothing special to install SAPI. > John > > > "Marc" <info@mawnet.com> wrote in message > news:47440db0$1@newsgroups.borland.com... >> Hi Darko >> >> Thank you for your message. >> I downloaded bccsdk but could not find the SAPI sample :-( >> >> Rds >> Marc >> >> >> >> "Darko Miletic" <kiklop@fibertel.com.ar> schrieb im Newsbeitrag >> news:4741b9b4$1@newsgroups.borland.com... >>> Marc wrote: >>>> Hi all >>>> >>>> I try to implement a simple SAPI application that reads back a phone >>>> number. I downloaded the SDK 5.1 from Microsoft and had a look at the >>>> samples... and did not quite got into it. Does someone has a simple >>>> sample in BCB that just shows how to speak a number? >>>> >>>> Rds >>>> Marc >>> >>> bccsdk contains everything you need to develop SAPI 5. 1 app's. There is >>> even one example supplied there. You can get it from >>> http://bccsdk.sf.net >> >> > >
Re: Startup help with SAPI
Author: Marc
Date: Wed, 21 Nov 2007 12:12
Date: Wed, 21 Nov 2007 12:12
25 lines
1801 bytes
1801 bytes
John This could be an idea... Did you succeed in implementing a SpeakToFile solution? Where a WAV file is created rather than the text read through the loud speaker? Rds Marc "JohnC" <jcibulskis@sbcglobal.net> schrieb im Newsbeitrag news:4744194b$1@newsgroups.borland.com... >I couldn't get the sphelper stuff to work at all - gave up and did things >directly. > John > > "Marc" <info@mawnet.com> wrote in message > news:47441606$1@newsgroups.borland.com... >> So I compiled without _DEBUG and now am stuck with an error in the >> sphelper.h, on line 1858 >> HRESULT hr = ::CoCreateInstance(CLSID_SpStream, NULL, CLSCTX_ALL, >> __uuidof(*ppStream), (void **)ppStream); >> >> Error: Invalid use of __uuidof > >
Re: Startup help with SAPI
Author: JohnC
Date: Wed, 21 Nov 2007 12:46
Date: Wed, 21 Nov 2007 12:46
14 lines
1342 bytes
1342 bytes
Sorry, no. My application didn't need speech recognition. Good Luck, John "Marc" <info@mawnet.com> wrote in message news:474420da$1@newsgroups.borland.com... > John > > This could be an idea... > Did you succeed in implementing a SpeakToFile solution? Where a WAV file > is created rather than the text read through the loud speaker? > > Rds > Marc
Re: Startup help with SAPI
Author: Mark Jacobs
Date: Fri, 23 Nov 2007 09:39
Date: Fri, 23 Nov 2007 09:39
8 lines
1377 bytes
1377 bytes
I wonder if anything in this article may help you :- http://dn.codegear.com/article/29583 -- Mark Jacobs DK Computing http://www.dkcomputing.co.uk
Re: Startup help with SAPI
Author: Michael Harris
Date: Fri, 23 Nov 2007 20:56
Date: Fri, 23 Nov 2007 20:56
38 lines
1982 bytes
1982 bytes
Easy enough using COM interfaces...
sample program.
ISpeechVoicePtr VoicePtr;
ISpeechFileStreamPtr FileStream ;
WideString wsFile = "sample.wav";
SpeechVoiceSpeakFlags eSpeechVoiceSpeakFlags = SVSFDefault;
VoicePtr = CoSpVoice::Create();
FileStream = CoSpFileStream::Create();
if(FileStream->Open( wsFile, SSFMCreateForWrite, VARIANT_FALSE) == S_OK)
{ Label1->Caption = "file output ready...";
}
if(VoicePtr->_set_AudioOutputStream(FileStream) == S_OK)
{ Label2->Caption = "Using file output";
}
VoicePtr->Speak(WideString(Edit1->Text), eSpeechVoiceSpeakFlags);
FileStream->Close()
dumps 'sample.wav' at local dir.
--
Michael
> "Marc" > wrote in message
>>
>> This could be an idea...
>> Did you succeed in implementing a SpeakToFile solution? Where a WAV file
>> is created rather than the text read through the loud speaker?
>>
>> Rds
>> Marc
>
>
Re: Startup help with SAPI
Author: Marc
Date: Mon, 26 Nov 2007 14:18
Date: Mon, 26 Nov 2007 14:18
16 lines
1372 bytes
1372 bytes
Yes, this helps actually a lot! Rds Marc "Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> schrieb im Newsbeitrag news:47469fcb$1@newsgroups.borland.com... >I wonder if anything in this article may help you :- > > http://dn.codegear.com/article/29583 > > -- > Mark Jacobs > DK Computing > http://www.dkcomputing.co.uk >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads