feat: audio - add concurrent mixing, output switching, and device-aware UI
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "Hci.hpp"
|
||||
#include "A2dp.hpp"
|
||||
#include "IntelFirmware.hpp"
|
||||
#include <Drivers/Audio/Mixer.hpp>
|
||||
#include <Drivers/USB/Xhci.hpp>
|
||||
#include <Drivers/USB/UsbDevice.hpp>
|
||||
#include <Fs/Vfs.hpp>
|
||||
@@ -419,10 +420,14 @@ namespace Drivers::USB::Bluetooth {
|
||||
void ServiceEvents() {
|
||||
if (!g_initialized) return;
|
||||
if (Xhci::InPollContext()) return; // never nest under PollEvents
|
||||
Xhci::PollEvents();
|
||||
Hci::DrainEvents();
|
||||
Hci::ProcessPendingCommands();
|
||||
A2dp::PumpMedia(); // feed queued media to the link (no-op when idle)
|
||||
A2dp::ServiceMedia(); // reap events and feed queued media
|
||||
Drivers::Audio::Mixer::OnBluetoothWritable();
|
||||
int requestedVolume;
|
||||
if (A2dp::ConsumeVolumeRequest(&requestedVolume))
|
||||
Drivers::Audio::Mixer::SetMasterVolume(requestedVolume);
|
||||
if (A2dp::ConsumeRouteChange())
|
||||
Drivers::Audio::Mixer::OnBluetoothStateChanged();
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -605,6 +610,7 @@ namespace Drivers::USB::Bluetooth {
|
||||
for (int k = 0; k < 200; k++) asm volatile("pause" ::: "memory");
|
||||
}
|
||||
A2dp::StartSource();
|
||||
Drivers::Audio::Mixer::OnBluetoothStateChanged();
|
||||
}
|
||||
// Persist any new link key now (process context), even if
|
||||
// the link later dropped, so the disk write never stalls
|
||||
|
||||
Reference in New Issue
Block a user