Page 1 of 2

I want the use wave files

Posted: Fri Jan 13, 2006 3:25 pm
by HATHAL
To all
I want the use wave files
From ( evc & borland c ) language
For work
Text-To-Speech for arabic language
i testing with funtion " playsound() "
She has tried with sources, but I did not succeed
And he happens dedication to the sound with the succession of the words
:(
regards
hathal

Re: I want the use wave files

Posted: Fri Jan 13, 2006 3:33 pm
by Enrico Maria Giordano
This is a sample of SndPlaySound() usage:

Code: Select all

#include "Fwce.ch"


FUNCTION MAIN()

    LOCAL oWnd

    DEFINE WINDOW oWnd

    @ 1, 1 BUTTON "Play";
           SIZE 60, 30;
           ACTION SNDPLAYSOUND( CURDIR() + "\TEST.WAV" )

    ACTIVATE WINDOW oWnd

    RETURN NIL


#pragma BEGINDUMP

#include "windows.h"
#include "mmsystem.h"
#include "hbapi.h"


LPWSTR AnsiToWide( LPSTR );


HB_FUNC( SNDPLAYSOUND )
{
    LPWSTR pW = AnsiToWide( hb_parc( 1 ) );
    hb_retnl( sndPlaySound( pW, hb_parni( 2 ) ) );
    hb_xfree( pW );
}

#pragma ENDDUMP
EMG

Posted: Mon Jan 16, 2006 3:28 am
by HATHAL
thank you EMG
She has pulled that but cutting off of the sound happens
I want function that reads the file from specific place and it ends in specific place
regards
hathal

Posted: Mon Jan 16, 2006 7:41 am
by Enrico Maria Giordano
You may try using MCI but I don't know if it is implemented in WinCE and how.

EMG

Posted: Wed Mar 01, 2006 8:09 am
by Carles
Hi Enrico,

Do you have implemented SndPlayResource() ?

Thanks.
C.

Posted: Wed Mar 01, 2006 8:23 am
by Enrico Maria Giordano
No, sorry.

EMG

Posted: Wed Mar 01, 2006 12:01 pm
by Antonio Linares
Carles,

We have not tested it yet, but this may be the code for it:

Code: Select all

HB_FUNC( SNDPLAYRESOURCE )
{
   LPWSTR pW1   = AnsiToWide( IF( ISNUM( 1 ), ( LPSTR ) hb_parnl( 1 ), hb_parc( 1 ) ) );
   LPWSTR pW2   = AnsiToWide( "WAVE" );	
   LPWSTR pW3;
   HGLOBAL hglb = LoadResource( GetResources(),
                     FindResource( GetResources(), pW1, pW2 ) );
        
   pW3 = AnsiToWide( ( LPSTR ) LockResource( hglb ) );  
   hb_retl( sndPlaySound( pW3, IF( PCOUNT() > 1, hb_parni( 2 ), SND_ASYNC ) | SND_MEMORY | SND_NODEFAULT ) );
   hb_xfree( pW1 );
   hb_xfree( pW2 );
   hb_xfree( pW3 );                     
  
   UnlockResource( hglb );
   FreeResource( hglb );
}

Posted: Mon Jul 28, 2008 9:12 pm
by Salvador
Antonio he probado SndPlayResource en mi aplicación pero genera estos errores:

--------------------Configuración: gestion - Debug--------------------
c:\propis\gestion\debug\suenawav.c(116) : warning C4129: 'p' : unrecognized character escape sequence
c:\propis\gestion\debug\suenawav.c(116) : warning C4129: 'G' : unrecognized character escape sequence
c:\propis\gestion\debug\suenawav.c(116) : warning C4129: 'S' : unrecognized character escape sequence
C:propisGestionSuenawav.prg(76) : warning C4013: 'IF' undefined; assuming extern returning int
C:propisGestionSuenawav.prg(76) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'int '
C:propisGestionSuenawav.prg(76) : warning C4024: 'AnsiToWide' : different types for formal and actual parameter 1
C:propisGestionSuenawav.prg(79) : warning C4013: 'GetResources' undefined; assuming extern returning int
C:propisGestionSuenawav.prg(79) : warning C4047: 'function' : 'struct HINSTANCE__ *' differs in levels of indirection from 'int '
C:propisGestionSuenawav.prg(79) : warning C4024: 'LoadResource' : different types for formal and actual parameter 1
C:propisGestionSuenawav.prg(80) : warning C4047: 'function' : 'struct HINSTANCE__ *' differs in levels of indirection from 'int '
C:propisGestionSuenawav.prg(80) : warning C4024: 'FindResourceW' : different types for formal and actual parameter 1
C:propisGestionSuenawav.prg(83) : warning C4013: 'PCOUNT' undefined; assuming extern returning int
C:propisGestionSuenawav.prg(88) : warning C4013: 'UnlockResource' undefined; assuming extern returning int
C:propisGestionSuenawav.prg(89) : warning C4013: 'FreeResource' undefined; assuming extern returning int
Creating library Gestion.lib and object Gestion.exp
Suenawav.obj : error LNK2019: unresolved external symbol FreeResource referenced in function HB_FUN_SNDPLAYRESOURCE
Suenawav.obj : error LNK2019: unresolved external symbol UnlockResource referenced in function HB_FUN_SNDPLAYRESOURCE
Suenawav.obj : error LNK2019: unresolved external symbol PCOUNT referenced in function HB_FUN_SNDPLAYRESOURCE
Suenawav.obj : error LNK2019: unresolved external symbol IF referenced in function HB_FUN_SNDPLAYRESOURCE

Creo que me falta algun fichero en el enlace, pero no se cual.

Gracias por adelantado.

Posted: Tue Jul 29, 2008 12:39 am
by Antonio Linares
Salvador,

Pruébala así:

Code: Select all

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>

LPWSTR AnsiToWide( char * );
HMODULE GetResources( void );

HB_FUNC( SNDPLAYRESOURCE ) 
{ 
   LPWSTR pW1   = AnsiToWide( ISNUM( 1 ) ? ( LPSTR ) hb_parnl( 1 ) : hb_parc( 1 ) ); 
   LPWSTR pW2   = AnsiToWide( "WAVE" );    
   LPWSTR pW3; 
   HGLOBAL hglb = LoadResource( GetResources(), 
                     FindResource( GetResources(), pW1, pW2 ) ); 
        
   pW3 = AnsiToWide( ( LPSTR ) LockResource( hglb ) );  
   hb_retl( sndPlaySound( pW3, ( ( hb_pcount() > 1 ) ? hb_parni( 2 ) : SND_ASYNC ) | SND_MEMORY | SND_NODEFAULT ) ); 
   hb_xfree( pW1 ); 
   hb_xfree( pW2 ); 
   hb_xfree( pW3 );                      
}

#pragma ENDDUMP

Posted: Tue Jul 29, 2008 7:59 am
by Salvador
Sigue dando estos errores:

Suenawav.obj : error LNK2019: unresolved external symbol "struct HINSTANCE__ * __cdecl GetResources(void)" (?GetResources@@YAPAUHINSTANCE__@@XZ) referenced in function HB_FUN_SNDPLAYRESOURCE
Suenawav.obj : error LNK2019: unresolved external symbol "unsigned short * __cdecl AnsiToWide(char *)" (?AnsiToWide@@YAPAGPAD@Z) referenced in function HB_FUN_SNDPLAYRESOURCE

Posted: Tue Jul 29, 2008 9:35 am
by Antonio Linares
Salvador,

Estas compilando en modo C++, de ahí esos errores. Revisa si usas el flag -Tp al llamar a clarm.exe

De todas formas, eso significaría que estás usando la versión inicial de FWPPC, que usaba el modo C++. Sería conveniente que te planteases actualizarte a la versión actual que no usa el modo C++, además de incorporar muchas ventajas sobre la versión que usas.

Posted: Tue Jul 29, 2008 10:35 am
by Antonio Linares
Salvador,

Una solución temporal podría ser esta:

Code: Select all

#include <windows.h>

extern "C"
{
   HINSTANCE GetResources( void );
   unsigned short * AnsiToWide( char * );
}; 

HINSTANCE GetResources( void )
{
   return ::GetResources();
}

unsigned short * AnsiToWide( char * p )
{
   return ::AnsiToWide( p );
}

Posted: Tue Jul 29, 2008 11:00 am
by Salvador
Mi versión es:
FWPPC 13/September/2007

Si usaba -TP, ahora no da error.
Gracias.

Sobre mi post:
http://www.fivetechsoft.com/forums/view ... hp?t=12018

Tienes alguna sugerencia. Es importante utilizar botones en esa aplicación.

Gracias de nuevo.

Posted: Tue Jul 29, 2008 5:35 pm
by Antonio Linares
Salvador,

Te acabo de contestar en esa conversación, gracias

Posted: Tue Jul 29, 2008 6:41 pm
by Salvador
En cuanto a SNDPLAYRESOURCE la aplicación me genera este error:

not implemented yet
LockResource( )

Garcias por tu paciencia :)