MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / play

Method play

Audio/AudioPlayback.cpp:79–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79void
80PlaybackWorker::play(void)
81{
82 float *buffer;
83 unsigned int i;
84
85 while (this->player != nullptr && (buffer = this->instance->next()) != nullptr) {
86 bool ok;
87
88 for (i = 0; i < this->bufferSize; ++i)
89 buffer[i] *= this->gain;
90
91 ok = this->player->write(buffer, this->bufferSize);
92
93 // Done with this buffer, mark as free.
94 this->instance->release();
95
96 if (!ok) {
97 this->stopPlayback();
98 emit error("Playback error");
99 }
100
101 // Process pending events
102 QCoreApplication::processEvents();
103 }
104
105 if (this->player != nullptr)
106 emit starving();
107}
108
109void
110PlaybackWorker::startPlayback()

Callers

nothing calls this directly

Calls 4

stopPlaybackMethod · 0.95
nextMethod · 0.80
releaseMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected