moutend / go-wca

Pure golang bindings for Windows Core Audio API. The `cgo` is not required.
MIT License
111 stars 28 forks source link

> Figure out how to handle IMMNotificationClient #2

Closed ik5 closed 4 years ago

ik5 commented 4 years ago

Figure out how to handle IMMNotificationClient

from some testing, the code itself seems to work on some events:

I changed the code a bit, waiting 10 minutes using time.After with select.

I think that maybe the issue that the sound card does not detect the changes, but still investigating that idea.

ik5 commented 4 years ago

@moutend following additional testings:

  1. On a usb headphones it did work well
  2. On AUX it does not identify the new headphones both insert and removed - I think it's a hardware + driver issue.

Waiting for testing it on different hardware to know for sure. If it works, when I think that from todo you can set it as an example in the code.

Cheers :)

moutend commented 4 years ago

@ik5 Thank you for suggestions. The go-wca project is not developed actively for now, but I'll implement the IMMNotificationClient in future version.

Although I'm learning Windows internals in deep because lacks of my knowledge, I can't say when the future version will be released. :cry:

omriharel commented 4 years ago

@ik5, would you mind expanding on how you managed to use the existing go-wca code to receive "default device changed" notifications in your own code?

I've been trying to do this in my project and can't figure out how to do it without the IMMNotificationClient interface's full implementation.

Thank you!

edit: I've just looked in the TODO file you mentioned and now it's clear! :)

moutend commented 4 years ago

Hi everyone. I released go-wca v0.2.0, it supports IMMNotificationClient. Check the _example/DeviceEvents.

omriharel commented 4 years ago

@moutend awesome to hear, thank you very much! I'm using your wonderful library in my project.

I was wondering if you would also add similar support for IAudioSessionNotification.

As a side note, the struct seems to have a pointer to IAudioSessionEventsVtbl instead of the IAudioSessionNotificationVtbl declared below it. Once I changed it locally and did something similar to what you did here, I did manage to receive OnSessionCreated callbacks with it :)

moutend commented 4 years ago

@omriharel Enjoy!

Anyway, I'm also planning that support such features. I'll implement that in this week or next week.

ik5 commented 4 years ago

@moutend I haven't tested it yet, but if it works, it will be on many machines in the following months ;-)