🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Listen to this...

posted in noaktree leaves
Published May 24, 2005
Advertisement
The sound library is complete. It has support for sounds (wav, etc) using direct sound. It can also play midi files. It is made of 3 classes but will eventually consist of 4 when the mixer is implemented ( ok so it's almost done [smile] ).

Sound lib classes...
  • DESoundDevice
    • Houses the performance and loader objects which are used by sound and midi channels.
  • DESoundChannel
    • Uses a direct music segment to play digital audio using any direct music supported audio files. Includes loop controls, stop, play, etc.
  • DEMIDIChannel
    • Uses a dm segment to play midi files with similar controls to the sound channel.

I'll probably make a base class for the two channels at some point. The sound mixer class will allow easy management of multiple sound channels. It'll be implemented when I need it.

What this means...

Now I can move on to the Resource Packer. I wanted to get the sound library to a point where it could load and play all of the files from disk because once the packing library is implemented every function that loads from file will need to have an overloaded version to load from the packed resource. Now I'll be able to do all of them in one swoop.

Tomorrow I'll get started on the packing library. I've never made one before but I think it should be quite easy. Hope everyone has a good day!
0 likes 6 comments

Comments

Rob Loach
I find sound libraries are fun and interesting to create as you pretty much have instant satisfaction with them. As for packing libraries, you might want to check out PhysicsFS before you start the design of yours. I haven't really done much using it, but Evolutional lives by it.
May 24, 2005 02:38 PM
EDI
Are you going to implement sampled audio streaming?

It is pretty handy if you want to play sampled audio music which can be very large if you open them all into memory at once.
May 24, 2005 03:12 PM
noaktree
Thanks Rob. I don't think I'll use it because of the license and I don't need all of the file formats that it supports etiher. Also I'll be using the packer to protect my resources from crooked fingers so I'd rather keep the implementation to myself.
May 24, 2005 03:25 PM
noaktree
Quote: Are you going to implement sampled audio streaming?
It is pretty handy if you want to play sampled audio music which can be very large if you open them all into memory at once.
I hadn't considered streaming and I probably won't until I need to. [smile] Do you know of any articles that cover directx and streaming?
May 24, 2005 03:34 PM
EDI
not off the top of my head =/
it is pretty complicated =(

the basic idea is that you:

1. open a file stream via your favorite file io method
2. create a 2 second(or more) sound buffer
3. set notification points (and the EVENT objects) at half and end
4. create a thread which waits on the events
5. fill the entire buffer
6. play the buffer
7. wait until it reaches half spot, then fill the first half again with new data
8. wait until it reaches end spot then fill the second half with new data
9. continue doing this until you are out of data

This way you only have 2 seconds of audio in ram at any one time.

DirectSound (at least in version 7) seemed to like you to use threads and HEVENT objects, which can make the programming tricky.

it also requires that you have a loader which can properly give you n-bytes of data on demand from disk.

I think with some work you can get a 'polling' system working just as well, which would allow you to drop the threads and etc.


May 24, 2005 04:05 PM
noaktree
Well thanks for the outline. I'm not going to be using heavy sounds anyway. If I want something that advanced then I'll just use an existing sound library instead of trying to create one. Sound is just something I really don't like programming.

[edit]So why do I keep reading over your entry? hmmmm I wonder if...
No! Must keep schedule. Maybe I'll come back to it.
May 24, 2005 05:53 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement