AYUDA CON PROGRAMA
Publicado por ANTONIO (36 intervenciones) el 04/03/2008 10:52:55
Hola a todos:
Este programa saca una lista de ficherso wav y los reproduce segun los seleccionemos:
a ver si alguno me puede ayudar a que solo reproduzca el que se le pase y no saque ninguna lista.
o sea si tengo un fichero llamaso sonido.wav solo reprodizca este sin nada mas.
Gracias anticipadas.
#include "inkey.ch"
#include "directry.ch"
#include "dll.ch"
***********************
// flags for PlaySound
#define SND_SYNC 0
#define SND_ASYNC 1
#define SND_FILENAME 131072
#define SND_PURGE 64
// flags for MessageBeep
#define MB_ICONHAND 16
#define MB_OK 0
#define MB_DEFAULT -1
***********************
PROCEDURE MAIN()
LOCAL cLookupDir
LOCAL aPlayField
LOCAL i, lRun, nSelect
LOCAL aSize
CLS
cLookupDir := GetEnv( "WINDIR") + "MEDIA"
@ 1, 2 SAY "PLAYSND - play all the system sounds. Press Esc to quit."
@ 3, 2 SAY "Available sounds from " + cLookupDir + ":"
/* get all files from the default sound directory */
aPlayField := Directory( cLookupDir + "*.wav")
IF len(aPlayField) = 0
MessageBeep( MB_ICONHAND)
Alert( "Error: No wave files found in "+ cLookupDir )
QUIT
ENDIF
AEval( aPlayField, {|x,i| x := ConvToOemCp(x[F_NAME])},,,.T.)
aPlayField := ASort( aPlayField )
lRun := .T.
nSelect := 1
IF waveOutGetNumDevs() = 0
MessageBeep( MB_ICONHAND)
Alert( "Error: No waveform output devices found!" )
ENDIF
SetMouse(.T.)
SetColor("N/G,N/W")
aSize := SetAppWindow():setMode()
DO WHILE lRun
nSelect := AChoice( 5,2,aSize[1]-4,40, aPlayField,,,nSelect, 8)
IF nSelect > 0
StopSound()
PlayWaveFile( cLookupDir + "" + ConvToAnsiCp(aPlayField[nSelect]))
ELSE
IF LASTKEY()==K_ESC
lRun := .F.
ENDIF
ENDIF
ENDDO
SetColor("W/N/,W/N")
CLS
RETURN
***********************
PROCEDURE StopSound()
#ifdef __WIN32__
/* stops waveform sound */
DllCall("WINMM.DLL",DLL_STDCALL,"PlaySoundA",0,0,0)
/* stops non-waveform sound */
DllCall("WINMM.DLL",DLL_STDCALL,"PlaySoundA",0,0,SND_PURGE)
#endif
RETURN
**************************
PROCEDURE PlayWaveFile(cFilename)
DllCall("WINMM.DLL",DLL_STDCALL,"PlaySoundA",cFileName,0, SND_FILENAME + SND_ASYNC)
RETURN
************
DLLFUNCTION MessageBeep(nMsgType) USING STDCALL FROM "USER32.DLL"
DLLFUNCTION waveOutGetNumDevs() USING STDCALL FROM "WINMM.DLL"
RETURN iif( rc == 0,1,0)
********************
Este programa saca una lista de ficherso wav y los reproduce segun los seleccionemos:
a ver si alguno me puede ayudar a que solo reproduzca el que se le pase y no saque ninguna lista.
o sea si tengo un fichero llamaso sonido.wav solo reprodizca este sin nada mas.
Gracias anticipadas.
#include "inkey.ch"
#include "directry.ch"
#include "dll.ch"
***********************
// flags for PlaySound
#define SND_SYNC 0
#define SND_ASYNC 1
#define SND_FILENAME 131072
#define SND_PURGE 64
// flags for MessageBeep
#define MB_ICONHAND 16
#define MB_OK 0
#define MB_DEFAULT -1
***********************
PROCEDURE MAIN()
LOCAL cLookupDir
LOCAL aPlayField
LOCAL i, lRun, nSelect
LOCAL aSize
CLS
cLookupDir := GetEnv( "WINDIR") + "MEDIA"
@ 1, 2 SAY "PLAYSND - play all the system sounds. Press Esc to quit."
@ 3, 2 SAY "Available sounds from " + cLookupDir + ":"
/* get all files from the default sound directory */
aPlayField := Directory( cLookupDir + "*.wav")
IF len(aPlayField) = 0
MessageBeep( MB_ICONHAND)
Alert( "Error: No wave files found in "+ cLookupDir )
QUIT
ENDIF
AEval( aPlayField, {|x,i| x := ConvToOemCp(x[F_NAME])},,,.T.)
aPlayField := ASort( aPlayField )
lRun := .T.
nSelect := 1
IF waveOutGetNumDevs() = 0
MessageBeep( MB_ICONHAND)
Alert( "Error: No waveform output devices found!" )
ENDIF
SetMouse(.T.)
SetColor("N/G,N/W")
aSize := SetAppWindow():setMode()
DO WHILE lRun
nSelect := AChoice( 5,2,aSize[1]-4,40, aPlayField,,,nSelect, 8)
IF nSelect > 0
StopSound()
PlayWaveFile( cLookupDir + "" + ConvToAnsiCp(aPlayField[nSelect]))
ELSE
IF LASTKEY()==K_ESC
lRun := .F.
ENDIF
ENDIF
ENDDO
SetColor("W/N/,W/N")
CLS
RETURN
***********************
PROCEDURE StopSound()
#ifdef __WIN32__
/* stops waveform sound */
DllCall("WINMM.DLL",DLL_STDCALL,"PlaySoundA",0,0,0)
/* stops non-waveform sound */
DllCall("WINMM.DLL",DLL_STDCALL,"PlaySoundA",0,0,SND_PURGE)
#endif
RETURN
**************************
PROCEDURE PlayWaveFile(cFilename)
DllCall("WINMM.DLL",DLL_STDCALL,"PlaySoundA",cFileName,0, SND_FILENAME + SND_ASYNC)
RETURN
************
DLLFUNCTION MessageBeep(nMsgType) USING STDCALL FROM "USER32.DLL"
DLLFUNCTION waveOutGetNumDevs() USING STDCALL FROM "WINMM.DLL"
RETURN iif( rc == 0,1,0)
********************
Valora esta pregunta


0