directX audio, I don't want echos!

This topic is 4836 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I've implemented a simple sound playing class using directX audio. But when I play my sounds they've got echos on them. I don't want that and I never specified any effects. I don't set any audiopath or anything. This is how I load my sounds:
void DirectAudio::LoadSound(WCHAR *filename, int soundNr)
{
// Create segment
m_pSegments[soundNr] = NULL;
CoCreateInstance(CLSID_DirectMusicSegment, NULL, CLSCTX_INPROC, IID_IDirectMusicSegment8, (void**) &m_pSegments[soundNr]);

}

And this is how I play it:
void DirectAudio::Play(int soundNr)
{
m_pPerformance->PlaySegment(m_pSegments[soundNr], NULL, 0, NULL);
}

[Edited by - Sepultang on August 21, 2005 12:30:40 PM]

Share on other sites
Does your soundcard have something like the EAX console of the sound blaster audigy platinum 2 cards? If so, check to make sure that all effects are turned off. That could be causing your echo.

Share on other sites
I've got a sounblaster live! yes. But I have no effects on (everything else sounds ok on my computer), also I've tried my code on other people's computers as well.

Share on other sites
Could be happening: Are you sure you call play only once or everytime basically restarting the sound again and again?

Share on other sites
I play the sound just once at a time.

Share on other sites
Don't be so sure about that. Lets say you play the sound by pressing a key. I'm guessing your checking if the file is already playing with IsPlaying or whatever its called. There is a delay between when you press the key and when DX actually plays the audio. Thus on the next loop when your still pressing the key, it sends the signal to play again. Thus an echo occurs. That would be my guess as to what is happening (since we have so little code to go by).

Share on other sites
I've got a simple application playing no sounds at all at first, but when I press a key I play a wave-file.

When I start my app I init directAudio and load my sound with LoadSound(WCHAR *filename, int soundNr) and when I push a key I call Play(int soundNr). The functions are included in my first message.

Thats the only thing I do.

I'm not checking if IsPlaying is true or false, but I'm only calling my Play-function once. (I've made a keyIsDownOnce-function...)

Share on other sites
Well then there is either errors in the rest of your code, an error on the system (not likely), its loading a different file with an echo effect (also not likely), or you tore a hole in the fabric of time and space causing the sounds to play in a different time than when you press the button. As such in the future it may not work at all as the sound was actually sent to the past... So kudos if its the last one. :)

Actually it looks like your loading the file correctly and since I haven't used PlaySegment (PlaySegmentEx has a lot more options) in a while, I believe that everything your sending it works fine. Its playing with no flags, immediately, and your not getting a pointer to the segment's state. My guess is that its an error in other portions of your code (probably something small).

Share on other sites
It turned out I was an idiot after all.

When initing the performance object I sat DefaultPathType to DMUS_APATH_SHARED_STEREOPLUSREVERB...
So the mystery is solved.

My guess is, as you said TheFez6255, that I tore a hole in the fabric of time when pressing space, and that caused my code I wrote yesterday to change to something I will write in the future.

Anyway, thanks all for your help.

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 18
• 19
• 12
• 14
• 9
• Forum Statistics

• Total Topics
633363
• Total Posts
3011509
• Who's Online (See full list)

There are no registered users currently online

×