1. Sound in Euphoria Programs for Beginners
- Posted by han45 Nov 26, 2014
- 1195 views
Hello fellows , Hello all Data jugglers ,
may i ask a simple question ?
How about to simple add some sound ( mp3 or wav files )
to a small program in euphoria 4.0 under Windows.
Are the topics described in the tutorial?
Hans
2. Re: Sound in Euphoria Programs for Beginners
- Posted by ChrisB (moderator) Nov 26, 2014
- 1209 views
Hi
Look these up in the archive
BASS
BASSMOD
FMOD
Musubi
Should be enough to get you started!
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=sound
Will give even more examples
Chris
3. Re: Sound in Euphoria Programs for Beginners
- Posted by evanmars Nov 26, 2014
- 1172 views
Assuming you have a .wav file called "shot.wav" (change that to whatever your .wav is called) this would play that every time you pressed the ENTER key:
include std/machine.e --for allocate_string include std/dll.e --for open_dll include std/get.e constant SND_ASYNC = #1, NULL = 0 function link_c_func(atom dll, sequence name, sequence args, atom result) -- dynamically link a C routine as an Euphoria function integer handle handle = define_c_func(dll, name, args, result) if handle = -1 then puts(1,"Couldn't find PlaySound\n") else return handle end if end function atom winmm = open_dll("winmm.dll") --PlaySound is located in this dll if winmm = 0 then puts(1,"Couldn't open winmm.dll\n") end if atom PlaySound = link_c_func(winmm, "PlaySound", {C_POINTER,C_INT,C_DOUBLE},C_INT) atom Shot = allocate_string("shot.wav") while 1 do if getc(0) then c_func(PlaySound,{Shot,NULL,SND_ASYNC}) end if end while
Not being a professional (or even semi-professional) programmer, this probably isn't best practice, but it'll get the job done.