mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-11-22 13:01:00 -05:00
...and more AudioThread cleanup.
This commit is contained in:
parent
14d1b5fd72
commit
03dfd2b48e
1 changed files with 14 additions and 13 deletions
|
|
@ -102,23 +102,24 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t run() {
|
msg_t run() {
|
||||||
bool success = true;
|
auto fifo = reinterpret_cast<FIFO<uint8_t>*>(shared_memory.FIFO_HACK);
|
||||||
while( success && !chThdShouldTerminate() ) {
|
if( !fifo ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamOutput stream { fifo };
|
||||||
|
|
||||||
|
while( !chThdShouldTerminate() ) {
|
||||||
chEvtWaitAny(EVT_FIFO_HIGHWATER);
|
chEvtWaitAny(EVT_FIFO_HIGHWATER);
|
||||||
|
|
||||||
auto fifo = reinterpret_cast<FIFO<uint8_t>*>(shared_memory.FIFO_HACK);
|
while( stream.available() >= write_buffer->size() ) {
|
||||||
if( !fifo ) {
|
if( !transfer(stream, write_buffer.get()) ) {
|
||||||
break;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamOutput stream { fifo };
|
|
||||||
|
|
||||||
while( success && (stream.available() >= write_buffer->size()) ) {
|
|
||||||
success = transfer(stream, write_buffer.get());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool transfer(StreamOutput& stream, std::array<uint8_t, write_size>* const write_buffer) {
|
bool transfer(StreamOutput& stream, std::array<uint8_t, write_size>* const write_buffer) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue