0

I am fairly new to c++, just want to get that out there. I'm trying to play a sound before the program continues. Irrklang says it loads the file right but I can't hear anything. I have tested irrklang itself which works perfectly fine in this project and directory. Some of the code I am using is from the irrklang api itself(using sound events): api. I have also done a lot of browsing here on stack overflow and others, such as: 1, 2, 3, 4. Also, my next step will be to replace "getout.ogg" with a string converted to a const char* (str.c_str()). It doesn't give me an error when I use a const char * but I don't know if it will work. My app is a console application but I made sure it stays open until I close it, if that helps. Any help is appreciated.

void Test() {
        std::cout << "\n";
        std::string str = "A.wav";
        ISoundEngine* engine = createIrrKlangDevice();
        SoundEndReceiver* endR = new SoundEndReceiver();
        //char const * sound = "";  //this is needed for conversions


        
            
            //str.c_str()
        irrklang::ISound* snd = engine->play2D("getout.ogg", false, false, true);
        if (snd) {
            snd->setSoundStopEventReceiver(endR);
        }

    }
Sean Kuehl
  • 11
  • 2

1 Answers1

0

I found a solution for the most part. I needed to put it in a do while(_getch() != q); loop.

Sean Kuehl
  • 11
  • 2