April 26, 2024, 12:54:22 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


WAV file play...

Started by J B Wood (Zumwalt), November 27, 2006, 12:01:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ionic Wind Support Team

Try this:

command="Open \"" + GetStartPath()+ "snd\\LevelStart.wav\" Type WaveAudio alias lvlStart";

If the path has spaces it has to be enclosed in quotes, otherwise MCI cannot parse the string.

Not to dissapoint you but MCI can't play more than one wave file per device either.  You can play a midi file and a wave file at the same time with MCI, but not two wave files unless you have two WaveAudio devices.  As I mentioned in a PM Windows does not have a built-in facility for mixing waveform audio simply.  You either have to mix the wave data yourself before sending to the device driver, or mix them before storing in a DirectSound buffer.  Mixing involves addition and averaging of the raw wavefrom data, which is stored in 16 bit words per sample. 

That is one of the big things I miss about computers like the Amiga.  The Amiga had dedicated sound on the motherboard for 4 channel waveform audio.  You just filled up buffers and initiated playback with pointers to those buffers.  The hardware abstraction of Windows makes that impossible without using DirectSound as the layer between your data and the sound card.  Since each sound card handles I/O differently.  Back in the DOS days we had to code for each available card on the market, SB being the most common.

Paul.

Ionic Wind Support Team

Steven Picard

Jonathon's sample code worked for me after I put in a messagebox to let the sound play.  However, I did change the filename to hit a wav file on my computer for testing.  I didn't even think to see if his path was correct.

J B Wood (Zumwalt)

Going to pull out my Amiga 500 that is sitting on the shelf at the house and just gauk at its abilities.
That machine rocks hard, still does. I love paying games on it.
MOD files played on Amiga's are killer..

but I digress

Thanks for the heads on on MCI Paul, I thought maybe it would do more than 1 and figured that was the mechanism you were talking about in the PM. I'll just stick to what you told me in the PM and then update the code later to manipulate the sound.

All I am needing to do, or wanting to do is something like:

int return=sound.load(file,bufferid)
return would be any error code.
This would load the sound into some sort of sound buffer or sound cache, with an id that I can call later like:

bool status=sound.play(bufferid)
status would be success play ro fail play
this way, anywhere in the code I could just pass in the sound object, play by the id, and never have to reload the sound into the cache, increased game load time, but good use if you ask me

Steven Picard

Quote from: Jonathan (zumwalt) Wood on November 30, 2006, 06:25:16 AM
Going to pull out my Amiga 500 that is sitting on the shelf at the house and just gauk at its abilities.
That machine rocks hard, still does. I love paying games on it.
MOD files played on Amiga's are killer..

The Amiga is still my all-time favorite computer.... sigh...