| 77 | } |
| 78 | |
| 79 | void |
| 80 | PlaybackWorker::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 | |
| 109 | void |
| 110 | PlaybackWorker::startPlayback() |
nothing calls this directly
no test coverage detected