I
I
Ivan Ivanov2014-03-29 13:18:30
C++ / C#
Ivan Ivanov, 2014-03-29 13:18:30

Why doesn't PlaySound() play sound?

PlaySound()plays standard system sound instead of .wav file. Here is a listing of the function where it is used:

void Scene1()
{
            if(SelectNumber == 1) //Rock
      cout << "You played Rock and Computer played Rock. It's Draw ;|" << endl;
               else if(SelectNumber == 2) //Paper
         {
        cout << "You played Paper and Computer played Rock. Paper covers a Rock. You WIN ;)" << endl;
      LPWSTR win = L"D:\c++_progs\testing\Release\winsound.wav";
      PlaySound(win,NULL,SND_ASYNC);
         }
               else if(SelectNumber == 3) //Scissors
         {
        cout << "You played Scissors and Computer played Rock. Rock smashes Scissors. You Lose ;(" << endl;
      LPWSTR lose = L"D:\c++_progs\testing\Release\losesound.wav";
      PlaySound(lose,NULL,SND_ASYNC);
         }

Herself PlaySound():
LPWSTR win = L"D:\c++_progs\testing\Release\winsound.wav";
PlaySound(win,NULL,SND_ASYNC);

I connected Winmm.lib, tried it earlier on other projects - it worked. Now I'm doing something wrong.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question