Haiku c++ BFileGameSound audio. Dig Haiku
BFileGameSound is a c++ class of haiku api that can load, decode and play an audio file.
Start playing the sound. Stop playing the sound.
Judge if the playing is not stopped.
pause
#include <FileGameSound.h> #include <iostream> #include <thread> int main() { BFileGameSound snd{"audio.wav", false}; snd.StartPlaying(); while (true) { std::this_thread::sleep_for(std::chrono::milliseconds(300)); std::cout << "Oh! ... " << std::flush; if (! snd.IsPlaying()) { std::cout << "\n\nPlaying is finished." << std::endl; break; } } }
Compile & Run:
~> g++ app.cpp -std=c++23 -o app -lgame ~> ./app Oh! ... Oh! ... Oh! ... Oh! ... Oh! ... Playing is finished.
Haiku API Docs https://api.haiku-os.org
Haiku Home - Haiku OS
Back Index - Dig Haiku OS c++
c++ std::exception:
std::cout.write(err.data(), err.size());
std::cout << std::endl;
caught:
================================================== # The c++ programming language. # # # # Home: cppfx.xyz # # E # # Join c++ Discord: yZcauUAUyC # # Deck # ==================================================