Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Listen to this...

Sign in to follow this  


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!
Sign in to follow this  


Recommended Comments

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.

Share this comment

Link to comment
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.

Share this comment

Link to comment
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.

Share this comment

Link to comment
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?

Share this comment

Link to comment
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.

Share this comment

Link to comment
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.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!