mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +00:00
LibCore: Convert CFile to ObjectPtr
This commit is contained in:
parent
31b38ed88f
commit
8d550c174e
30 changed files with 135 additions and 134 deletions
|
@ -27,16 +27,16 @@ int main(int argc, char** argv)
|
|||
window->set_icon(load_png("/res/icons/16x16/app-piano.png"));
|
||||
|
||||
LibThread::Thread sound_thread([piano_widget = piano_widget.ptr()] {
|
||||
CFile audio("/dev/audio");
|
||||
if (!audio.open(CIODevice::WriteOnly)) {
|
||||
dbgprintf("Can't open audio device: %s", audio.error_string());
|
||||
auto audio = CFile::construct("/dev/audio");
|
||||
if (!audio->open(CIODevice::WriteOnly)) {
|
||||
dbgprintf("Can't open audio device: %s", audio->error_string());
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
u8 buffer[4096];
|
||||
piano_widget->fill_audio_buffer(buffer, sizeof(buffer));
|
||||
audio.write(buffer, sizeof(buffer));
|
||||
audio->write(buffer, sizeof(buffer));
|
||||
GEventLoop::current().post_event(*piano_widget, make<CCustomEvent>(0));
|
||||
GEventLoop::wake();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue