SAPI : change Voice

Re: SAPI : change Voice

Postby nageswaragunupudi » Sun Jan 28, 2024 9: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
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: SAPI : change Voice

Postby Jimmy » Sun Jan 28, 2024 9: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
User avatar
Jimmy
 
Posts: 1584
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: SAPI : change Voice

Postby Jimmy » Mon Jan 29, 2024 1: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
User avatar
Jimmy
 
Posts: 1584
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: SAPI : change Voice

Postby Antonio Linares » Mon Jan 29, 2024 5:52 am

Dear Jimmy,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: SAPI : change Voice

Postby Antonio Linares » Wed Jan 31, 2024 3:39 pm

Simpler fix thanks to Bruno Cantero:
Code: Select all  Expand view
        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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: SAPI : change Voice

Postby Antonio Linares » Thu Feb 01, 2024 6: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: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: SAPI : change Voice

Postby Danielmaximiliano » Tue Feb 06, 2024 1: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: Select all  Expand view
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
Danielmaximiliano
 
Posts: 17
Joined: Tue Mar 20, 2012 11:06 pm

Re: SAPI : change Voice

Postby Antonio Linares » Tue Feb 06, 2024 2:03 pm

Estimado Daniel,

En harbour/contrib/hbwin/olecore.c busca esta función:
Code: Select all  Expand view

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: Select all  Expand view
        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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: SAPI : change Voice

Postby Danielmaximiliano » Tue Feb 06, 2024 9: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
Danielmaximiliano
 
Posts: 17
Joined: Tue Mar 20, 2012 11:06 pm

Re: SAPI : change Voice

Postby Antonio Linares » 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: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: SAPI : change Voice

Postby Danielmaximiliano » 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: Select all  Expand view
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
Danielmaximiliano
 
Posts: 17
Joined: Tue Mar 20, 2012 11:06 pm

Re: SAPI : change Voice

Postby Antonio Linares » Thu Feb 08, 2024 12:23 pm

Daniel,

Este ejemplo es Harbour, no usa FWH :-)
Code: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: SAPI : change Voice

Postby Enrico Maria Giordano » Thu Feb 08, 2024 1:15 pm

I get this error:

Code: Select all  Expand view
test.prg(7) Error E0030  Syntax error "syntax error at '...'"
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: SAPI : change Voice

Postby Antonio Linares » Thu Feb 08, 2024 1: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: SAPI : change Voice

Postby Enrico Maria Giordano » Thu Feb 08, 2024 2:03 pm

I compiled your sample with latest Harbour, not xHarbour.
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Otto and 78 guests

cron