Bart Aimar ha scritto:
[...]
REM ***** BASIC *****
My God!
(lo sapevo che mi dovevo stare zitto e comprarmi un decoder...)
è da una mezzora che sto guardando il codice... ma ancora non ho capito
quale sia la "sub main" ....
Quella non serve, cmq colgo l'occasione per correggere alcuni errori che
ho notato nella versione precedente.
Copia il codice in un modulo della tua libreria, poi potrai usare le sub
di questo modulo per suonare i file audio in windows, es:
per suonare il file C:\Blabla\Pippo.wav
PlayBack(ConvertToUrl("C:\Blabla\Pippo.wav"))
Per fermare la riproduzione di un file audio
PlayBackStop()
per riprodurre il file C:\Blabla\Pippo.wav in modalità loop:
PlayBackLoop(ConvertToUrl("C:\Blabla\Pippo.wav"))
Non ho provato nulla e non so se il codice funziona, raccomando prudenza!!!
ciao
PaoloM
-----------------------------------------------------------------
REM ***** BASIC *****
'_____________________________________________
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
'_____________________________________________
'Sound constants
Private Const SND_SYNC = &H0
Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2
Private Const SND_LOOP = &H8
Private Const SND_NOSTOP = &H10
'_____________________________________________
Sub PlayBack(AudioFileUrl)
WAVPlay ConvertFromUrl(AudioFileUrl)
End Sub
'_____________________________________________
Sub PlayBackLoop(AudioFileUrl)
WAVLoop ConvertFromUrl(AudioFileUrl)
End Sub
'_____________________________________________
Sub PlayBackStop()
Call WAVPlay("")
End Sub
'_____________________________________________
Sub WAVLoop(File As String)
Dim SoundName As String
Dim wFlags As Long
Dim x As Long
SoundName = File
wFlags = SND_ASYNC Or SND_LOOP
x = sndPlaySound(SoundName, wFlags)
If x = 0 Then MsgBox "Can't play the audio file. ", 16, "Error"
End Sub
'_____________________________________________
Sub WAVPlay(File As String)
Dim SoundName As String
Dim wFlags As Long
Dim x As Long
SoundName = File
wFlags = SND_ASYNC Or SND_NODEFAULT
x = sndPlaySound(SoundName, wFlags)
If x = 0 Then MsgBox "Can't play the audio file. ", 16, "Error"
End Sub
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]