SetTime

This function will set the time a source is playing at.

Syntax

Parameters

Remarks

This function will increment the reference count of the new sound and decrement the reference count of the old sound (if they exist).

Example

#include "Leadwerks.h"

using namespace Leadwerks;

Source* source = NULL;

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

source = Source::Create();
source->SetSound(sound);
sound->Release();
source->SetLoopMode(true);
source->Play();

while (true)
{
//Press space key to pause/resume sound
if (window->KeyHit(Key::Space))
{
if (source->GetState() == Source::Paused)
{
source->Resume();
}
else
{
source->Pause();
}
}

if (window->Closed() || window->KeyDown(Key::Escape)) return false;
Leadwerks::Time::Update();
context->SetColor(0,0,0,0);
context->Clear();

context->SetColor(1,1,1,0);
context->SetBlendMode(Blend::Alpha);
context->DrawText("Time: "+String(source->GetTime()),2,2);
}
return 0;
}