FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SAPI : change Voice
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: SAPI : change Voice
Posted: Sun Jan 28, 2024 09:58 AM

I just replaced

\harbour\lib\win\bcc\hbwin.lib

with the new hbwin.lib.

Now it is working for me.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: SAPI : change Voice
Posted: Sun Jan 28, 2024 09:14 PM
hi,

i have try to change hbwin.LIB in my working Environment
but than i got this Errors
Error: Unresolved external '_hb_iswinsp' referenced from C:\HARBOUR\LIB\WIN\BCC\HBWIN.LIB|win_osc
Error: Unresolved external '_HB_FUN_HB_OSISWIN7' referenced from C:\HARBOUR\LIB\WIN\BCC\HBWIN.LIB|win_os
i use FWH 23.07 and harbour 3.2.0 Dev (r1801051438)
where do i get latest harbour Version :?:
greeting,

Jimmy
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: SAPI : change Voice
Posted: Mon Jan 29, 2024 01:21 AM
hi Antonio,

have installed harbour Version, which was include in my harbour_win32_bcc_2020_10_19.zip, and override hbwin.LIB
now it work without Error and i can change "Voice" of SpVoice. :D

thx again for your GREAT help.
greeting,

Jimmy
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: SAPI : change Voice
Posted: Mon Jan 29, 2024 05:52 AM
Dear Jimmy,

Thanks to you for your great feedback :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: SAPI : change Voice
Posted: Wed Jan 31, 2024 03:39 PM
Simpler fix thanks to Bruno Cantero:
Code (fw): Select all Collapse
 聽 聽 聽 聽 lOleError = HB_VTBL( pDisp )->Invoke( HB_THIS_(pDisp) dispid, HB_ID_REF(IID_NULL),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽LOCALE_USER_DEFAULT,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽( V_VT( dispparam.rgvarg ) == VT_DISPATCH ) ? DISPATCH_PROPERTYPUTREF : DISPATCH_PROPERTYPUT,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽&dispparam, NULL, &excep, &uiArgErr );
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: SAPI : change Voice
Posted: Thu Feb 01, 2024 06:13 AM
Dear Jimmy,

I have reviewed the topic at https://hmgforum.com/viewtopic.php?t=7505 I have requested to join the forums so maybe we can solve it together.

I have been trying to use the events and it seems as something is missing:
Code (fw): Select all Collapse
function main() 

聽 聽local oVoice := CreateObject( "Sapi.SPVoice", "WithEvents" ) 
聽 聽
聽 聽// oVoice:WithEvents = .T.
聽 聽oVoice:EventInterests = 327679
聽 聽oVoice:__hSink := __axRegisterHandler( oVoice:__hObj, { | ... | QOut( ... ) } )

聽 聽// oVoice:voice = oVoice:GetVoices():Item( 0 )
聽 聽oVoice:Speak( "harbour and xharbour" ) 
聽 聽oVoice:Speak( "another" ) 

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 34
Joined: Tue Mar 20, 2012 11:06 PM
Re: SAPI : change Voice
Posted: Tue Feb 06, 2024 01:42 PM
Antonio Linares wrote:Dear Jimmy,

I have reviewed the topic at https://hmgforum.com/viewtopic.php?t=7505 I have requested to join the forums so maybe we can solve it together.

I have been trying to use the events and it seems as something is missing:
Code (fw): Select all Collapse
function main() 

聽 聽local oVoice := CreateObject( "Sapi.SPVoice", "WithEvents" ) 
聽 聽
聽 聽// oVoice:WithEvents = .T.
聽 聽oVoice:EventInterests = 327679
聽 聽oVoice:__hSink := __axRegisterHandler( oVoice:__hObj, { | ... | QOut( ... ) } )

聽 聽// oVoice:voice = oVoice:GetVoices():Item( 0 )
聽 聽oVoice:Speak( "harbour and xharbour" ) 
聽 聽oVoice:Speak( "another" ) 

return nil
Hola Antonio Linares con su permiso voy a responder en espa帽ol , no recordaba estar registrado en su sitio y lo abr茅 hecho para leer el foro.
con respecto al bug que encontr贸 en olecore.c todavia no pude corregir el mismo, si tuviera la amabilidad de enviarme el fuente de olecore.c se lo agradeceria muchisimo.
todos los dias leo el changelog.txt en github de harbour para ver si se hiceron las modificaciones pero todavia no sucedi贸.. le comento que el uso de SapiVoice era una inclusi贸n para un ejemplo de una aplicacion de Bingo en www.hmgforum.com y not茅 que habia mas narradores en windows y que se podia elegir pero no llegamos poder utilizarlos por este BUG.
otra cosa mas que vi en SapiVoice es la posibilidad de usar Eventos pero lo iba a usar cuando este funcional el poder elegir los narradores de microsoft
desde ya mucha gracias
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: SAPI : change Voice
Posted: Tue Feb 06, 2024 02:03 PM
Estimado Daniel,

En harbour/contrib/hbwin/olecore.c busca esta funci贸n:
Code (fw): Select all Collapse
HB_FUNC( WIN_OLEAUTO___ONERROR )
{
聽 聽IDispatch * 聽pDisp;
聽 聽const char * szMethod;
聽 聽wchar_t 聽 聽 聽szMethodWide[ HB_SYMBOL_NAME_LEN + 1 ];
聽 聽OLECHAR * 聽 聽pMemberArray;
聽 聽DISPID 聽 聽 聽 dispid;
聽 聽DISPPARAMS 聽 dispparam;
聽 聽VARIANTARG 聽 variant;
聽 聽EXCEPINFO 聽 聽excep;
聽 聽UINT 聽 聽 聽 聽 uiArgErr;
聽 聽HRESULT 聽 聽 聽lOleError;
聽 聽HB_USHORT 聽 聽uiClass;
聽 聽int 聽 聽 聽 聽 聽iPCount;

聽 聽hb_oleInit();

聽 聽uiClass = hb_objGetClass( hb_stackSelfItem() );
聽 聽if( uiClass == 0 )
聽 聽 聽 return;

聽 聽/* Get object handle */
聽 聽hb_vmPushDynSym( s_pDyns_hObjAccess );
聽 聽hb_vmPush( hb_stackSelfItem() );
聽 聽hb_vmSend( 0 );

聽 聽pDisp = hb_oleParam( -1 );
聽 聽if( ! pDisp )
聽 聽 聽 return;

聽 聽iPCount = hb_pcount();

聽 聽szMethod = hb_itemGetSymbol( hb_stackBaseItem() )->szName;
聽 聽AnsiToWideBuffer( szMethod, szMethodWide, ( int ) HB_SIZEOFARRAY( szMethodWide ) );

聽 聽/* Try property put */

聽 聽if( szMethod[ 0 ] == '_' && iPCount >= 1 )
聽 聽{
聽 聽 聽 pMemberArray = &szMethodWide[ 1 ];
聽 聽 聽 lOleError = HB_VTBL( pDisp )->GetIDsOfNames( HB_THIS_( pDisp ) HB_ID_REF( IID_NULL ), &pMemberArray,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽1, LOCALE_USER_DEFAULT, &dispid );

聽 聽 聽 if( lOleError == S_OK )
聽 聽 聽 {
聽 聽 聽 聽 聽DISPID lPropPut = DISPID_PROPERTYPUT;

聽 聽 聽 聽 聽memset( &excep, 0, sizeof( excep ) );
聽 聽 聽 聽 聽GetParams( &dispparam, 0, HB_FALSE, 0, NULL, NULL );
聽 聽 聽 聽 聽dispparam.rgdispidNamedArgs = &lPropPut;
聽 聽 聽 聽 聽dispparam.cNamedArgs = 1;

聽 聽 聽 聽 聽lOleError = HB_VTBL(pDisp)->Invoke(HB_THIS_(pDisp) dispid, HB_ID_REF(IID_NULL),
聽 聽 聽 聽 聽 聽 聽LOCALE_USER_DEFAULT,
聽 聽 聽 聽 聽 聽 聽(V_VT(dispparam.rgvarg) == VT_DISPATCH) ? DISPATCH_PROPERTYPUTREF : DISPATCH_PROPERTYPUT,
聽 聽 聽 聽 聽 聽 聽&dispparam, NULL, &excep, &uiArgErr);

聽 聽 聽 聽 聽FreeParams( &dispparam );
Ahi tienes el fix:
Code (fw): Select all Collapse
 聽 聽 聽 聽 lOleError = HB_VTBL(pDisp)->Invoke(HB_THIS_(pDisp) dispid, HB_ID_REF(IID_NULL),
聽 聽 聽 聽 聽 聽 聽LOCALE_USER_DEFAULT,
聽 聽 聽 聽 聽 聽 聽(V_VT(dispparam.rgvarg) == VT_DISPATCH) ? DISPATCH_PROPERTYPUTREF : DISPATCH_PROPERTYPUT,
聽 聽 聽 聽 聽 聽 聽&dispparam, NULL, &excep, &uiArgErr);
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 34
Joined: Tue Mar 20, 2012 11:06 PM
Re: SAPI : change Voice
Posted: Tue Feb 06, 2024 09:06 PM

Hola Antonio Linares:

con su invalorable ayuda pude despues de estudiar y modificar olecore.c el cual me costo entender el fix pude compilar la libreria Contrib de HBWIN que descargue desde el repositio de Harbour en GITHUB mediante el bin HBMK2 y el compilador MinGW.

desde ya quedo muy agradecido como muchos otros de la comunidad HMGForum un saludo y abrazo a la distancia

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: SAPI : change Voice
Posted: Tue Feb 06, 2024 10:30 PM
Estimado Daniel,

Lo que no hemos conseguido que funcione son los eventos.

A ver si entre todos descubrimos como hacerlo funcionar:
Code (fw): Select all Collapse
function main()

聽 聽local oVoice := CreateObject( "Sapi.SPVoice", "WithEvents" )
聽 聽
聽 聽// oVoice:WithEvents = .T.
聽 聽oVoice:EventInterests = 327679
聽 聽oVoice:__hSink := __axRegisterHandler( oVoice:__hObj, { | ... | QOut( ... ) } )

聽 聽// oVoice:voice = oVoice:GetVoices():Item( 0 )
聽 聽oVoice:Speak( "harbour and xharbour" )
聽 聽oVoice:Speak( "another" )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 34
Joined: Tue Mar 20, 2012 11:06 PM
Re: SAPI : change Voice
Posted: Thu Feb 08, 2024 12:11 PM
Antonio Linares wrote:Estimado Daniel,

Lo que no hemos conseguido que funcione son los eventos.

A ver si entre todos descubrimos como hacerlo funcionar:
Code (fw): Select all Collapse
function main()

聽 聽local oVoice := CreateObject( "Sapi.SPVoice", "WithEvents" )
Hola Antonio Linares :
estuve leyendo Voice Events en https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms723602(v=vs.85)
Eventos de voz

A medida que una voz habla texto, puede generar eventos cuando detecta ciertas condiciones en el flujo de entrada. Estos eventos est谩n contenidos en la enumeraci贸n SpeechVoiceEvents. Ejemplos de estos eventos son la finalizaci贸n de fonemas, palabras u oraciones, as铆 como cambios de voz o la presencia de marcadores. La gama de condiciones que SpeechVoiceEvents puede informar es lo suficientemente amplia como para que la mayor铆a de las aplicaciones utilicen s贸lo algunas de ellas. Para evitar que el motor TTS genere eventos que la aplicaci贸n ignorar谩, utilice la propiedad EventInterests para especificar los eventos de inter茅s. S贸lo se plantear谩n estos eventos.

El punto en el flujo de texto de entrada en el que se ha completado un evento potencial se denomina l铆mite de evento. En cada l铆mite de evento, el tipo de evento se compara con los EventInterests actuales. Si el tipo de evento es de inter茅s, se genera un evento de ese tipo. Los eventos de voz devuelven el n煤mero de flujo de entrada para asociarlos con el flujo apropiado.
voy a ver como hacer un ejemplo en Harbour/HMG que es lo que utilizo, ya que nunca utilize FiveWin que es su producto.
SLDS
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: SAPI : change Voice
Posted: Thu Feb 08, 2024 12:23 PM
Daniel,

Este ejemplo es Harbour, no usa FWH :-)
Code (fw): Select all Collapse
function main()

聽 聽local oVoice := TOleAuto():New( "Sapi.SPVoice" )
聽 聽
聽 聽// oVoice:WithEvents = .T.
聽 聽oVoice:EventInterests = 327679
聽 聽oVoice:__hSink := __axRegisterHandler( oVoice:__hObj, { | ... | QOut( ... ) } )

聽 聽oVoice:Speak( "harbour and xharbour" )
聽 聽oVoice:Speak( "another" )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: SAPI : change Voice
Posted: Thu Feb 08, 2024 01:15 PM
I get this error:
Code (fw): Select all Collapse
test.prg(7) Error E0030 聽Syntax error "syntax error at '...'"
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: SAPI : change Voice
Posted: Thu Feb 08, 2024 01:23 PM

Dear Enrico,

xHarbour does not support "..." syntax, so such line should be:

oVoice:__hSink := __axRegisterHandler( oVoice:__hObj, { | x, y | QOut( x, y ) } )

but function __axRegisterHandler() is available in Harbour and not in xHarbour, if I am correct

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: SAPI : change Voice
Posted: Thu Feb 08, 2024 02:03 PM

I compiled your sample with latest Harbour, not xHarbour.