Does anyone know if it’s possible to create a listener to detect when a Macs system volume changes? If so do you know where I can find an example on how to accomplish this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Concept
So, hopefully there’s a better way to deal with this, but this is a concept:
Spin off a new thread to watch the volume attribute found in
AudioToolbox. Then have it call a callback of some kind.If this seems to be an approach you’d like, you might want to consider setting up an object with a delegate callback or a block or something.
Caveat
This solution requires a single background thread to watch for changes constantly. It should be pretty low-key, because it’s such a simple check, but it bears mentioning.