I found a problem when re-plug the USB audio device.
Posted by dbckdrb
on 07/19/2004 08:14am
If you have a USB audio device, then you can make the same situations.
Here is a steps.
1. Load a wave files.
2. Unplug the USB audio device while playing
3. Wait while play stops.
4. Plug the USB audio device.
5. Check! Is that mixer device list up? (My system can't shows the mixer but shows device)
Is this problem out of bound of this program? (maybe)
Is there a way to convert the Level value return by the Mixer into dB ?
is very easy
Posted by alainstgt
on 12/07/2005 11:10am
the dB value is 10*log10(level/reference level).
In acoustics the refence sound pressure is 0.00002 Pa (Pascal), the reference level the square of that value.
Since an addition is performed much faster than a division, you can change the formula like following: 10*(log10(level)-log10(reference level)). With rhe previous mentioned value, you get log10(reference level)= 93,9794 dB, which is usually rounded to 94 dB.
So thr formula to get the dB level is:
dB = 10*log10(sound pressure level) - 94!
Note that what is commonly named the level, is in a strenght way not the level, but I used your terminology to not confuse.
Hi would you be able to describe in words the algorithm for mixing the waves. The one I am using at home is to add the samples and devide by the number of tracks. This works although the volume seems to be belong unity level.
I see that you created your project with Visual C++ 6, but I'm trying to build in VC++ 7 and getting an error: "error C3803: 'bool:Property::AsString()': property has a type which is incompatible with one of its accessors 'CString&Property::asstring(void)'. The problem is on line 56 of "Property.h". I am very new to windows programming - any clue how to fix this error? Thanks.
Thanks for your short tutorial on compiling.
A few days ago you replied to my request for help on the filterstream(echoes) & I hope you can help me once again.
I wanted to create an echo that is one second later. So I altered the getbuffer virtual method of wavestream by reading data from the audio file twice & putting them in 2 different buffers:
1)fread from file into buffer.data (of wavebuffer buffer)
2)fseek -11*RequestSize from SEEK_CUR (1 sec offset)
- fread from file into buffer1.data(of wavebuffer buffer1)
3)fseek 10*RequestSize from SEEK_CUR(return to original pos)
4)return buffer2 (which mixes buffer & buffer1)
I have created 3 buffers- buffer which contains the current audio data, and buffer 1 which contains audio data 1 secs back. buffer 2 is supposed to be a mix of the 2 buffers.
I have read how u mix the streams in the mixer & frankly it was difficult for me to understand (I am still a beginner). Do you mind giving me advice on how I can combine the 2 buffers' data & store them into buffer2 ?
So sorry to trouble you. Previously I was doing a project using your audio classes. What I did was just copy the header files for the various classes into my external dependencies & the dAudiolib.lib.It worked. However I find I have trouble trying to add more functions to the program.
I was trying to add the function waveOutSetPitch in Player.cpp but cannot find it in my project directories. So I copy it over & edited it. However there is a "unexpected end of file while looking for precompiled header directive" problem when I was compiling Player.cpp. I tried compiling your original player.cpp in your demo project, & the same thing happens.
Am I missing out on something here? Did I forgot to do something.
I am trying to find a way to add some other functions to the conversion stream. Anybody knows of any examples (such as adding echoes, reverberation or audio filters) that can manipulate the buffers in the stream.