Playing wav files-edited topic

Started by
3 comments, last by Hermes 19 years, 7 months ago
Ok i've been thinking about my problem and i guess i've found it. Let's say I want a buffer to accomodate 4000ms(4 sec)of sound ,how can i determine the buffer's dimension? Do you know the approximate limitation of SRAM? I appreciate all your efforts,i'm really stuck [Edited by - Hermes on September 4, 2004 4:18:02 AM]
Advertisement
Just thought I might say this, since you're new. . .you won't have any luck with such a post. Generally, people on the boards like to see two things at least:

1. That you've been able to pinpoint a small amount of code where the problem lies.

2. That you've shown some effort to solve the problem, rather than simply coming to ask.

I really don't know much about sound, as I just let DirectX handle it all for me, but I thought I'd mention that, so that you will have better luck getting your question answered.

--Vic--
You should've used the following statement in Wave.cpp to allocate memory for CWave::data:

data=new char[###]

Substitute "###" for the size of the array.

In the destructor of the CWave class, you're gonna wanna use the following delete statement:

delete []data;

Since you're new, I'd recommend using new to allocate dynamic memory and delete to delete such memory. That malloc() you use in Wave.cpp and the free() you use in Player.cpp are sooo C-style.

In the constructor of the CWave class, you assign values like 0.0 and 0.0f to long variables. Don't.

I'm gonna agree with the previous poster on this one.

Well, it's late. You know what that means. :)







To determine the size of the buffer, you can get the average bandwidth of the stream from the WAVEFORMAT structure's nAvgBytesPerSec member.
.
yah,right i'm "smart" it seems so obvious now.
Thanks Mastaba!

This topic is closed to new replies.

Advertisement