adding .paused() as a property

I have just added .paused() as a property to SampleController because it has .finished(), to tell if it's been stopped, but it has none to tell if it has been paused
This commit is contained in:
Murilo Miranda 2021-05-26 00:37:53 -03:00 committed by GitHub
parent 9dd0a00f08
commit cc055e4c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -213,6 +213,11 @@ interface SampleController {
If the sample has finished playing. Happens when it runs out or if it is stopped. If the sample has finished playing. Happens when it runs out or if it is stopped.
+/ +/
bool finished(); bool finished();
/++
If the sample has beend paused.
+/
bool paused();
} }
private class DummySample : SampleController { private class DummySample : SampleController {
@ -221,19 +226,21 @@ private class DummySample : SampleController {
void stop() {} void stop() {}
float position() { return float.init; } float position() { return float.init; }
bool finished() { return true; } bool finished() { return true; }
bool paused() { return true; }
} }
private class SampleControlFlags : SampleController { private class SampleControlFlags : SampleController {
void pause() { paused = true; } void pause() { paused_ = true; }
void resume() { paused = false; } void resume() { paused_ = false; }
void stop() { paused = false; stopped = true; } void stop() { paused_ = false; stopped = true; }
bool paused; bool paused_;
bool stopped; bool stopped;
bool finished_; bool finished_;
float position() { return currentPosition; } float position() { return currentPosition; }
bool finished() { return finished_; } bool finished() { return finished_; }
bool paused() { return paused_; }
float currentPosition = 0.0; float currentPosition = 0.0;
} }