Configuring HDMI Audio via command line
I was using the tool wrong. The correct way to do it was pactl set-card-profile 0 output:hdmi-audio
. You can get a list of avilable profile names by running pacmd list-cards
.
Related videos on Youtube
Andreas Reiff
Updated on September 18, 2022Comments
-
Andreas Reiff over 1 year
I want to get the window handle of some controls to do some stuff with it (requiring a handle). The controls are in a different application.
Strangely enough; I found out that many controls don't have a windows handle, like the buttons in the toolbar (?) in Windows Explorer. Just try to get a handle to the Folder/Search/(etc) buttons. It just gives me 0.
So.. first question: how come that some controls have no windows handle? Aren't all controls windows, in their hearts? (Just talking about standard controls, like I would expect them in Windows Explorer, nothing customdrawn on a pane or the like.)
Which brings me to my second question: how to work with them (like using EnableWindow) if you cannot get their handle?
Many thanks for any inputs!
EDIT (ADDITIONAL INFORMATION):
Windows Explorer is just an example. I have the problem frequently - and in a different application (the one I am really interested in, a proprietary one). I have "physical" controls (since I can get an AutomationElement of those controls), but they have no windows handle. Also, I am trying to send a message (SendMessage) to get the button state, trying to find out whether it is pushed or not (it is a standard button that seems to exhibit that behaviour only through that message - at least as far as I have seen. Also, the pushed state can last a lot longer on that button than you would expect on a standard button, though the Windows Explorer buttons show a similar behaviour, acting like button-style checkboxes, though they are (push)buttons). SendMessage requires a window handle.
Does a ToolBar in some way change the behaviour of its child elements? Taking away their window handle or something similar? (Using parent handle/control id for identification??) But then how to use functions on those controls that require a windows handle?
-
Takkat over 12 yearsThis answer may help you.
-
-
Andreas Reiff almost 13 yearsI tried to be generic and then give a specific example that actually has nothing to do with what I want to do - my fault, sorry. I actually have completely different buttons in a completely different application that also do not have a window handle. Or is that a specific feature of a Toolbar they are part of? Also, the function I want to use is something like int res = SendMessage(realHwnd, BM_GETSTATE, 0, 0); to find out whether the button is pushed or not.
-
Cody Gray almost 13 years@Andreas: Yes, partially my fault, too. I've spent too long reading Raymond Chen's blog and answering questions on here, both of which have probably made me bitter about people trying to reverse engineer Windows. As far as what the other app's doing, it's hard to say. There are a lot of possible scenarios. If you have a copy of Visual Studio, you should have a little utility called Spy++. Use that to figure out what control actually houses those buttons. If it's indeed a toolbar (
ToolbarWindow32
or something like that), then you can use one of the toolbar manipulation functions. -
Cody Gray almost 13 yearsSpecifically, you'll need to detect one of the toolbar button states, defined by the
TBSTATE_*
values. A pushed (or checked) button will have theTBSTATE_CHECKED
state flag set (you probably don't wantTBSTATE_PRESSED
, as that indicates the user is currently clicking the button). TheTB_GETSTATE
message is how you determine which state a particular button has. -
Andreas Reiff almost 13 yearsThanks for your added info! (feels like a chat here ;) ) So the ToolBar really changes the behaviour of its "children", since the TB_GETSTATE message is different (taking command id as added parameter) to the BM_GETSTATE message. I might have to go back to my application - it only runs on dedicated hardware, so I have been examining Windows Explorer whenever I found a similarity, since it is so much easier to use - and available on my developer machine. Are there other controls, too, that have handle-less children, apart from the ToolBar?
-
Andreas Reiff almost 13 yearsIt seems like a control/(embedded)elements construct that I never thought about when creating GUIs myself. Now, using GUIs in this way, I am astonished how much more there is to know and learn (and also take into account).
-
Cody Gray almost 13 years@Andreas: Yes, there are others, but it depends very much on the GUI toolset that you're using. There are a lot more of them in .NET WinForms, for example. In the straight Win32 API, probably only the ToolBar (and its brother like the ReBar) and the StatusBar are like that. But it's a fairly common general pattern to have the parent manage the state of child controls. Each control having its own handle starts to get expensive in terms of resources and such, so it was avoided, especially in the early days when the ToolBar was invented. You'll really have to see what control you're dealing with.
-
Daenyth over 12 yearsI'm not looking to edit mixer levels, I'm looking to configure the audio to use HDMI. I also said I'm not looking for a GUI tool, I need something that I can automate.
-
Daenyth over 12 yearsIt needs to be from the command line.
-
Nomad almost 12 yearsalsamixergui solution by @decent worked for me on Nvidia ION with 10.04 and now with 12.04, I just launched the command and unmute the channel IEC 958 1 now I have audio...
-
Elvis over 11 yearsthe 2nd argument (0) is the index of the card (>>> 1 card(s) available. index: 0). the 3rd argument (output:hdmi-audio) is the part before the second semicolon under "profiles:" (e.g. it's "output:hdmi-stereo" from the line output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5400))
-
int_ua over 9 yearsit's
pactl list cards
at least inpulseaudio-utils 1:4.0-0ubuntu22
-
FeRD over 8 years@int_ua:
pactl list cards
andpacmd list-cards
are both correct, the two tools use different syntax but provide most of the same functionality. In theory, the command to change the output profile could bepacmd set-card-profile 0 output:hdmi-audio
(or... output:hdmi-stereo
or whatever), either will work.