I want the use wave files
- HATHAL
- Posts: 77
- Joined: Tue Nov 15, 2005 3:38 pm
- Location: The Kingdom Saudi Arabia -Riyadh
- Contact:
I want the use wave files
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
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
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: I want the use wave files
This is a sample of SndPlaySound() usage:
EMG
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
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Carles,
We have not tested it yet, but this may be the code for it:
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 );
}
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.
--------------------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.
Saludos
Salvador
Salvador
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Salvador,
Pruébala así:
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
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
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
Saludos
Salvador
Salvador
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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.
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.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Salvador,
Una solución temporal podría ser esta:
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 );
}
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.
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.
Saludos
Salvador
Salvador
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: