Closed vittorioromeo closed 1 month ago
BTW, using the device name is not an option as there could be multiple devices with the same name.
memcmp(&id0, &id1, sizeof(ma_device_id))
should do the job. I thought I actually had a function for comparing device IDs, but looking now it appears that no such function exists. Probably worth adding that. In any case, ma_device_id
is explicitly a fixed sized struct, no matter what backends are enabled/disabled, and it should be padded with zeros, so it should be reliable. If I add a function to compare IDs, memcmp()
is how I'd be doing it.
I added ma_device_id_equal() to the dev branch.
I am trying to compare to
ma_device_id
objects to figure out if they refer to the same hardware device. I couldn't find any API function to comparema_device_id
objects, and I considered usingstd::memcmp
, but I am not sure if thema_device_id
object is intended to be compared that way.Is there a way to reliably compare two
ma_device_id
for equality, or -- more generally -- check if two hardware devices detected throughminiaudio
are the same?