Play

This function plays a sound once.

Syntax

Example

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
Sound* sound = Sound::Load("Sound/Music/menutheme.wav");
sound->Play();

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
context->SetColor(0, 0, 0, 0);
context->Clear();

context->SetColor(1, 1, 1, 0);
context->SetBlendMode(Blend::Alpha);
context->DrawText("Sound length: " + String(sound->GetLength()) + " seconds", 2, 2);
context->SetBlendMode(Blend::Solid);

context->Sync();
}
return 0;
}