Hi,

Im trying to make a sysmple program that plays different .wav files when an appropiate key is pressed. Its going to be keyboard drumkit kind of thing,

anyway, ive got it to play the sounds, but they always seem to have a short delay, from when the key is pressed to when the sound is played. Ive checked the wav file in audacity, and theres no delay at the start, the sound plays right off,

could any give any ideas on how to solve this, ive also tryed this program with a Beep(1000,50); function, and it works perfectly, the exact speedy responce im after.

but the wav file is just very slow at responding,

heres the code, and also the wav file, please help!!

#include <iostream>
#include <windows.h>   
#include <TCHAR.H>
#include <conio.h>


int main()
{

    while(1)
    {

    if(getch()=='w')
        {
         //Beep(1000,50);  
        PlaySound(_T("kick.wav"),NULL,SND_ASYNC|SND_FILENAME);

        
        }
        
    }

  return 0;

}
Attachments

Hi, sorry, but im still learning so your going to have to explain more,

from reading this page,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_playing_wave_resources.asp

i take it, all i have to to, is to write the following in the resource script,
soundName WAVE c:\sounds\kick.wav

and then access it as normal via

PlaySound(_T("kick.wav"),NULL,SND_MEMORY);

how do i access the resource script, the only thing i can find is a file called test.exe.embed.manifest, in the debug folder, in my project folder, and when i open it, its in hex, so how do i write that line up the top?

This article has been dead for over six months. Start a new discussion instead.