I want the use wave files

User avatar
HATHAL
Posts: 77
Joined: Tue Nov 15, 2005 3:38 pm
Location: The Kingdom Saudi Arabia -Riyadh
Contact:

I want the use wave files

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: I want the use wave files

Post 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
User avatar
HATHAL
Posts: 77
Joined: Tue Nov 15, 2005 3:38 pm
Location: The Kingdom Saudi Arabia -Riyadh
Contact:

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

You may try using MCI but I don't know if it is implemented in WinCE and how.

EMG
User avatar
Carles
Posts: 937
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona
Contact:

Post by Carles »

Hi Enrico,

Do you have implemented SndPlayResource() ?

Thanks.
C.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 );
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
Salvador
Posts: 142
Joined: Sun Dec 18, 2005 3:18 pm
Location: España

Post 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.
Saludos
Salvador
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Salvador
Posts: 142
Joined: Sun Dec 18, 2005 3:18 pm
Location: España

Post 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
Saludos
Salvador
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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.
regards, saludos

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

Post 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 );
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
Salvador
Posts: 142
Joined: Sun Dec 18, 2005 3:18 pm
Location: España

Post 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.
Saludos
Salvador
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Salvador,

Te acabo de contestar en esa conversación, gracias
regards, saludos

Antonio Linares
www.fivetechsoft.com
Salvador
Posts: 142
Joined: Sun Dec 18, 2005 3:18 pm
Location: España

Post by Salvador »

En cuanto a SNDPLAYRESOURCE la aplicación me genera este error:

not implemented yet
LockResource( )

Garcias por tu paciencia :)
Saludos
Salvador
Post Reply