• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Echoes in Directsound

## Recommended Posts

Hi all... Does anyone know a way to make a sound buffer start to echo, as though you were in a cave or something? -- Goodlife ----------------------------- Think of your mind as a door on a house. Leave the door always closed, and it's not a house, it's a prison. Leave the door always open, and it's not a house, it's a wilderness-- all the vermin creep in.

#### Share this post

##### Share on other sites
I think I have an idea but I didn''t try it. You could make another buffer with the same sound (uplicate it), play the first buffer and then after an interval (something like 1 second) play the second buffer with the volume lower than the first one.
How I said I didn''t test this so it might not work.

Bye

Octavian
e-mail: octavsoft@octavsoft.freeservers.com
webpag: octavsoft.freeservers.com

#### Share this post

##### Share on other sites
There is a command (or a flag) to set reverb. I know you can do it in DirectMusic and I''m guessing you can do it in DirectSound aswell. I don''t know the exact code, but check the DirectX example programs.

#### Share this post

##### Share on other sites
Acually, the reverb feature is only availible in DirectSound .
But, you can modify the sound data yourself, like so (pseudo-code):

// fade (float):   set to about 2// delay (int):    in samples, (i.e. 44khz, 44100=1 second)for (pos = delay; pos < sound_buffer_size; pos++)   sound_buffer[pos] += (sound_buffer[pos - delay] / fade);

But of course you''d have to modify depending on the wave format, and use signed variables for the buffers (or do something similar).

• ### Forum Statistics

• Total Topics
628285
• Total Posts
2981836

• 10
• 10
• 10
• 11
• 17