-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio Status #63
Comments
No, I haven't had anyone asking for audio status, so I haven't looked into it. If you can explain briefly what you're trying to do, I might be able to help. |
Audio status is only loosely implemented in the HDMI-CEC specification itself. It rarely (never?) works on TV's and only works on things like sound bars. We need better implementation in the HDMI spec itself before it can really be implemented in an API like this IMHO. |
I know this is an old thread but I'd love to get an absolute volume reading. From what I have gathered the code that i need to evaluate is 15:71 (recorder to audio): "Give Audio Status" This would be amazing to have because for my application I need an absolute volume scale. @trainman419 I have been able to do this using cec-client but I am not able to drive this from python...so this is where your python package came in ;) |
I poked around a little bit on this issue. You can add a wrapper for the libcec "GetAudioStatus" function without too much trouble, but as discussed here, libcec caches the first result and keeps returning it forever. The path of least resistance is probably to ask the audio system for the audio status directly, add a handler to grab the response, and cast the resulting parameter from bytes to int. For example, when I run the following... # audio_status_test.py
import time
import cec
audio = cec.CECDEVICE_AUDIOSYSTEM
op_give = cec.CEC_OPCODE_GIVE_AUDIO_STATUS
op_report = cec.CEC_OPCODE_REPORT_AUDIO_STATUS
recvd = False
def cb(event, *args):
print('event: ', event, ', data: ', args)
par = args[0]
init = par['initiator']
comm = par['opcode']
if init == audio and comm == op_report:
byte_result = par['parameters']
print(f'\n\nAudio Status: {int.from_bytes(byte_result,"big")}')
global recvd
recvd = True
cec.add_callback(cb, cec.EVENT_COMMAND)
cec.init()
cec.transmit(audio,op_give)
while not recvd:
time.sleep(0.1) ...I get the following output.
|
Yuk. That really sucks that libcec does that. I like your implementation of asking the device directly. Thank you! |
Has there been any progress on implementing the get audio status functionality?
The text was updated successfully, but these errors were encountered: