Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Playing WAV files 1998-01-24 -- Russ Eggen Here is a simple Clarion source file that will do this (thanks to Alexey for providing it):
PROGRAM
OMIT('--- 16 bit', _WIDTH32_)
SndPlayProc EQUATE('SNDPLAYSOUND')
! --- 16 bit
COMPILE('--- 32 bit', _WIDTH32_)
SndPlayProc EQUATE('SNDPLAYSOUNDA')
! --- 32 bit
MAP
MODULE('WIN%S%.LIB')
Snd:PlaySound(*CSTRING,UNSIGNED),BOOL,PROC,RAW,PASCAL,NAME(SndPlayProc)
END
END
SoundFile CSTRING(256)
CODE
LOOP WHILE FILEDIALOG ('Choose Sound File', SoundFile, 'WAV Files|*.WAV',
0)
Snd:PlaySound (SoundFile, 0)
END
Brad Silverman adds:
PLAYING .WAV FILES IN C4B
EMBED POINTS
UNDER MODULE TAB - DEFAULT PROGRAM - EMBEDS
AFTER GLOBAL INCLUDES
Omit('*** 16 Bit',_Width32_)
SndPlayProc equate('SndPlaySound')
!*** 16 Bit
Compile('*** 32 Bit',_Width32_)
SndPlayProc equate('SndPlaySoundA')
!*** 32 Bit
GLOBAL - EMBEDS
INSIDE THE GLOBAL MAP
MODULE('Win%S%.lib')
Snd:PlaySound(*cString,Unsigned),Bool,Proc,Raw,Pascal,Name(SndPlayProc)
END
GLOBAL - EMBEDS
GLOBAL DATA
SoundFile Cstring(256)
ASSUME A PUSH BUTTON CONTROL
EMBEDS-CONTROL EVENT HANDLING - ACCEPTED
your code to set--
SoundFile = 'Path to wav file'
(Variable string or constant as needed)
Snd:PlaySound(SoundFile,0)
I don't understand everything that going on but it works on my system
(Win98)
Today is December 3, 2024, 12:11 pm This article has been viewed 35202 times.
|
|