Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Using OSD and display current volume level [SOLVED]

If you have a question or need help, this is the place to be.
User avatar
InterlinkKnight
Posts: 29
Joined: Mon Sep 13, 2010 1:17 am
Contact:

Using OSD and display current volume level [SOLVED]

Post by InterlinkKnight »

Thanks to the users "jonib" and "olurz", I can now give an easy-to-understand instructions to display the current volume in percentage or bar and the MUTE state (if the sound is ON or OFF):

Image
Image
Image

1. Go to one of your volume macros (example: UP) and add "Show OSD" action (right-click -> Add Action... -> EventGhost -> Show OSD) and introduce this code (where it say: "Text to display"):

Code: Select all

Volume {int(round(eg.result))}%
or if you want the volume bar insert this code insted:

Code: Select all

Volume {'|'*int(round(eg.result))+'.'*(100-int(round(eg.result)))} {int(round(eg.result))}%
Note: You need to place the "Show OSD" before the "Autorepeat current macro" (if you have one).


2. Repeat the process for the other volume macro (example: DOWN) or just copy that previous action to the other macro.

3. The last thing you should want to do is to display the Mute condition. For that, go to your Mute macro (Toggle Mute) and add "Show OSD" action (right-click -> Add Action... -> EventGhost -> Show OSD) and introduce this code:

Code: Select all

Mute {("Off", "On")[eg.result]}
Or you can choose to display the revert situation, showing "Sound On" or "Sound Off". For that use this code:

Code: Select all

Sound {("On", "Off")[eg.result]}
You can adjust the position, font, color, time, etc. in the settings of the "Show OSD" event (double-click the "Show OSD" event).

I attach a screenshot of my settings. Yours should be looking something like this:
Image

I make a video tutorial showing how to use EventGhost, including how to make display the current volume. Here's the video: http://www.youtube.com/watch?v=xnMzu1h1gxc


P.S. English is not my primary language so be understandable about my bad english.

If you are lost (or lazy), here is the entire code of the configuration file

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1544" Guid="{93CA3DF2-7148-4B9C-9F06-FB3D578935B9}" Time="1327405609.27">
    <Autostart Name="Autostart" Expanded="True">
        <Plugin Identifier="Lirc" Guid="{17A77662-BB69-4C37-AA43-71213958C5C4}" File="Lirc">
            gAIoWAkAAAAxMjcuMC4wLjFxAE09IomJiUsAS8iIS0BLCnRxAS4=
        </Plugin>
    </Autostart>
    <Folder Name="Change Volume">
        <Macro Name="Volume Up">
            <Event Name="Lirc.vol+" />
            <Action>
                System.ChangeMasterVolumeBy(1.0, 0)
            </Action>
            <Action>
                EventGhost.ShowOSD(u'Volumen {int(round(eg.result))}%', u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 5, (0, 100), 0, 3.0, True)
            </Action>
            <Action>
                EventGhost.AutoRepeat(0.5, 0.20000000000000001, 0.029999999999999999, 0.0)
            </Action>
        </Macro>
        <Macro Name="Volume Down">
            <Event Name="Lirc.vol-" />
            <Action>
                System.ChangeMasterVolumeBy(-1.0, 0)
            </Action>
            <Action>
                EventGhost.ShowOSD(u'Volumen {int(round(eg.result))}%', u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 5, (0, 100), 0, 3.0, True)
            </Action>
            <Action>
                EventGhost.AutoRepeat(0.5, 0.20000000000000001, 0.029999999999999999, 0.0)
            </Action>
        </Macro>
        <Macro Name="Mute" Expanded="True">
            <Event Name="Lirc.mute" />
            <Action>
                System.ToggleMute()
            </Action>
            <Action>
                EventGhost.ShowOSD(u'Mute {("Off", "On")[eg.result]}', u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 5, (0, 100), 0, 3.0, True)
            </Action>
        </Macro>
    </Folder>
</EventGhost>

The user bskchaos submit another way to show a volume bar and mute.

Image
Image
Image

Is more complicated to setup, so I better publish the entire code of the settings:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1540">
    <Folder Name="Volume Control" Expanded="True">
        <Macro Name="Decrease Volume" Expanded="True">
            <Event Name="X10.VolumeDown" />
            <Event Name="ErgoMouse.Button.234" />
            <Event Name="HID.Button.3" />
            <Action>
                System.ChangeMasterVolumeBy(-5.0, 0)
            </Action>
            <Action id="762">
                EventGhost.ShowOSD(u'{"c" *int(round(eg.result) * 0.20) + "g" *int(round(100-(eg.result)) * 0.20)}', u'0;-12;0;0;0;400;0;0;0;2;3;2;1;18;Webdings', (255, 255, 255), (0, 0, 0), 3, (8, 48), 0, 2.0, True)
            </Action>
            <Action>
                EventGhost.AutoRepeat(0.40000000000000002, 0.050000000000000003, 0.01, 0.40000000000000002)
            </Action>
        </Macro>
        <Macro Name="Increase Volume" Expanded="True">
            <Event Name="X10.VolumeUp" />
            <Event Name="ErgoMouse.Button.233" />
            <Event Name="HID.Button.4" />
            <Action>
                System.ChangeMasterVolumeBy(5.0, 0)
            </Action>
            <Action id="770">
                EventGhost.ShowOSD(u'{"c" *int(round(eg.result) * 0.20) + "g" *int(round(100-(eg.result)) * 0.20)}', u'0;-12;0;0;0;400;0;0;0;2;3;2;1;18;Webdings', (255, 255, 255), (0, 0, 0), 3, (8, 48), 0, 2.0, True)
            </Action>
            <Action>
                EventGhost.AutoRepeat(0.40000000000000002, 0.050000000000000003, 0.01, 0.40000000000000002)
            </Action>
        </Macro>
        <Macro Name="Mute Sound Card" Expanded="True">
            <Event Name="X10.Mute" />
            <Action>
                System.ToggleMute(0)
            </Action>
            <Action>
                EventGhost.NewJumpIf(XmlIdLink(777), 0, False)
            </Action>
            <Action>
                EventGhost.ShowOSD(u'X\xf0', u'0;-64;0;0;0;400;0;0;0;2;3;2;1;18;Webdings', (255, 255, 255), (0, 0, 0), 3, (16, 56), 0, 2.0, True)
            </Action>
        </Macro>
        <Macro Name="Show OSD: Mute ON" id="777" Expanded="True">
            <Action>
                EventGhost.ShowOSD(u'Xr', u'0;-64;0;0;0;400;0;0;0;2;3;2;1;18;Webdings', (255, 255, 255), (0, 0, 0), 3, (16, 56), 0, 0.0, True)
            </Action>
        </Macro>
    </Folder>
</EventGhost>







*************************************************************************************************************
******************************This is my original post asking for help*********************************
*************************************************************************************************************
I am new with EventGhost but I've manage to get it working great.

I try many kind of applications to control the computer with my remote control using WinLIRC. EventGhost is the best because is easy to understand and setup. But the only thing I find horrible about EventGhost is that is too difficult to make the simple thing of displaying the volume (OSD).

In Girder is easy to make it work; in uICE can't be easier; in EventGhost, well I've been learning a lot about the program and I didn't know it was even possible to show the current volume. I don't even know how to show anything (like when I press a button, display for 2 seconds the name of the button).

I read some post on this forums and everything looks so complicated, using lines of text that I don't understand.

What I want is a simple instructions (from scratch) to make display:
- The name of the button is press it, for 2 seconds
- The current volume when the volume state change

How to do it? How to customize?

Why is not a simple way to do this things on EventGhost?

Please help. All the post I've read explain things like everyone already know what are you talking about. Is like you need to understand a millions things before you can get this simple thing to work. Like this post: http://www.eventghost.org/forum/viewtopic.php?f=2&t=685

Can anyone help me?

BTW I am going to make a video showing how to use EventGhost (a tutorial) and upload it on youtube, so if you help me I will also show this part on the video. I want to everyone be able to learn this things easily.

*************************************************************************************************************
*************************************************************************************************************
*************************************************************************************************************
Last edited by InterlinkKnight on Tue Jan 24, 2012 12:00 pm, edited 13 times in total.
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Using OSD and display current volume level

Post by jonib »

InterlinkKnight wrote:- The name of the button is press it, for 2 seconds
I can think of two ways, I don't know if they are what you want:
First is to make a macro(rightclick Add Macro...) EventGhost\Show OSD and then add a event from your remote control. Configure the event and change the button name part to *. I had to change HauppaugeIR.Play that I get from my remote to HauppaugeIR.*. Now configure the Show OSD action and add this {eg.eventString} to Text to display. This should show the button event for any remote button you press(depending on what events the remote control plugin generates).
EGButton.PNG
EGButton.PNG (4.26 KiB) Viewed 18623 times
Second is to create a macro for every remote button, adding the specific button event. and the using Show OSD configured to show that button name. A bit more work but you can put in the real button name in Show OSD.
EGButton2.PNG
EGButton2.PNG (3.64 KiB) Viewed 18623 times
jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
User avatar
InterlinkKnight
Posts: 29
Joined: Mon Sep 13, 2010 1:17 am
Contact:

Re: Using OSD and display current volume level

Post by InterlinkKnight »

Thanks jonib. At least I am understanding a little bit more about it.

But my big question is still there. How to show the volume? You know, the horizontal bar that show the percentage of the current master volume, like a TV, uICE, Girder, etc.

Not only I am asking how to do it, I am also asking why is so complicated?

I am disappointed. No documentation/tutorial about this (the volume thing)? Especially for starters with EventGhost. Is like EventGhost is made to be used only for experts.

That's why I am going to make a video tutorial on youtube (BTW there's not even one video tutorial for EventGhost). But first, I need to solve this.
User avatar
jinxdone
Plugin Developer
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: Using OSD and display current volume level

Post by jinxdone »

Some of the default actions return data in the eg.result variable, such as the change volume actions return the current volume in percentage 0-100. You can read what is in the variable with {eg.result}.

To display that percentage as a nice graphical slider you need a 'slider OSD' plugin, which doesn't exist at the moment.

I was working on an improved OSD plugin almost a year ago now, which would let you generate graphical OSD windows like sliders. I got it up to a stage that the most critical "under-the-hood" pieces are there, but I'm not happy with the graphics generation routines, which need a complete overhaul. I just havn't had the time to work on it lately. :(
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Using OSD and display current volume level

Post by jonib »

InterlinkKnight wrote:Not only I am asking how to do it, I am also asking why is so complicated?

I am disappointed. No documentation/tutorial about this (the volume thing)? Especially for starters with EventGhost. Is like EventGhost is made to be used only for experts.
The problem Isn't that EventGhost is only made for experts, it's just not finished, so it's not fully documented and a lot of functionality is less user friendly sometimes.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
User avatar
InterlinkKnight
Posts: 29
Joined: Mon Sep 13, 2010 1:17 am
Contact:

Re: Using OSD and display current volume level

Post by InterlinkKnight »

jinxdone wrote:Some of the default actions return data in the eg.result variable, such as the change volume actions return the current volume in percentage 0-100. You can read what is in the variable with {eg.result}.
I read this post http://www.eventghost.org/forum/viewtopic.php?f=2&t=685 about how to show current volume in percentage 0-100, but I don't understand it. I try to replicated what I understand but doesn't work.

I mean I try adding a Python Command:

Code: Select all

eg.WinAPI.SoundMixer.GetMasterVolume()
And then adding a Show OSD with:

Code: Select all

Volume: ({int(eg.result)}%)
It doesn't work. What I miss? :?
Image

jinxdone wrote:To display that percentage as a nice graphical slider you need a 'slider OSD' plugin, which doesn't exist at the moment.

I was working on an improved OSD plugin almost a year ago now, which would let you generate graphical OSD windows like sliders. I got it up to a stage that the most critical "under-the-hood" pieces are there, but I'm not happy with the graphics generation routines, which need a complete overhaul. I just havn't had the time to work on it lately.
In the case of the bars, then I need to wait until the plugin is finished. I'm glad that at least people like you is working on it. Good luck. :D

EventGhost is really great in many ways.
Attachments
VolumeDown.jpg
VolumeDown.jpg (6.17 KiB) Viewed 18607 times
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Using OSD and display current volume level

Post by jonib »

InterlinkKnight wrote:It doesn't work. What I miss? :?
How doesn't it work? do you get an error or nothing happens.

Unfortunately my sound drivers drivers are weird so the sound stuff in EventGhost don't work for me, but I think you need to use this:

Code: Select all

eg.WinApi.SoundMixer.GetMasterVolume()
And you should be able to put it directly in an Show OSD with the below code

Code: Select all

{eg.WinApi.SoundMixer.GetMasterVolume()}
jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
User avatar
InterlinkKnight
Posts: 29
Joined: Mon Sep 13, 2010 1:17 am
Contact:

Re: Using OSD and display current volume level

Post by InterlinkKnight »

jonib wrote:How doesn't it work? do you get an error or nothing happens.
I was getting an error, but it doesn't matter because the codes you give me works! Thank you so much. :D

The last thing I want to know is how to remove the fractions. Example: the volume show 71.9996948196

How do a make to show just 71 (natural numbers only)?
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Using OSD and display current volume level

Post by jonib »

InterlinkKnight wrote:The last thing I want to know is how to remove the fractions. Example: the volume show 71.9996948196

How do a make to show just 71 (natural numbers only)?
Try this.

Code: Select all

{int(round(eg.WinApi.SoundMixer.GetMasterVolume()))}
jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
User avatar
InterlinkKnight
Posts: 29
Joined: Mon Sep 13, 2010 1:17 am
Contact:

Re: Using OSD and display current volume level

Post by InterlinkKnight »

Yes, it works! I really appreciate your help jonib.

I was writing the instructions to publish it here (for other users to read) but then I realize that the last thing to do is to show the Mute ON or OFF state.

First I just simply make a Show OSD with the text MUTE, but obviously that doesnÔÇÖt work because that only show when you press the button, but the Mute state (on or off) is not shown.

You know what I mean right? Is possible? How?
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Using OSD and display current volume level

Post by jonib »

InterlinkKnight wrote:First I just simply make a Show OSD with the text MUTE, but obviously that doesnÔÇÖt work because that only show when you press the button, but the Mute state (on or off) is not shown.
Try this

Code: Select all

{eg.WinApi.SoundMixer.GetMute()}
I don't know what it returns so we might need to tweak it(if it works at all).

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
User avatar
InterlinkKnight
Posts: 29
Joined: Mon Sep 13, 2010 1:17 am
Contact:

Re: Using OSD and display current volume level

Post by InterlinkKnight »

jonib wrote:I don't know what it returns so we might need to tweak it(if it works at all).
Is funny, shows "1" when the sound is OFF (MUTE is ON) and "0" when the sound is ON (MUTE is OFF).

You are close jonib, but we need a "tweak" to convert those numbers to text.
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Using OSD and display current volume level

Post by jonib »

InterlinkKnight wrote:Is funny, shows "1" when the sound is OFF (MUTE is ON) and "0" when the sound is ON (MUTE is OFF).
Try this.

Code: Select all

{("Off", "On")[eg.WinApi.SoundMixer.GetMute()]}
jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
User avatar
InterlinkKnight
Posts: 29
Joined: Mon Sep 13, 2010 1:17 am
Contact:

Instructions to display Current Volume level and Mute status

Post by InterlinkKnight »

Thanks to the user jonib, I can now give an easy-to-understand instructions to display the current volume in percentage and the MUTE state (if the sound is ON or OFF):

1. Go to one of your volume macros (example: UP) and add "Show OSD" action (right-click -> Add Action... -> EventGhost -> Show OSD) and introduce this code (where it say: "Text to display"):

Code: Select all

Volume {int(round(eg.result))}%
or if you want the volume bar insert this code insted:

Code: Select all

Volume {'|'*int(round(eg.result))+'.'*(100-int(round(eg.result)))} {int(round(eg.result))}%
Note: You need to place the "Show OSD" before the "Autorepeat current macro" (if you have one).


2. Repeat the process for the other volume macro (example: DOWN) or just copy that previous action to the other macro.

3. The last thing you should want to do is to display the Mute condition. For that, go to your Mute macro (Toggle Mute) and add "Show OSD" action (right-click -> Add Action... -> EventGhost -> Show OSD) and introduce this code:

Code: Select all

Mute {("Off", "On")[eg.result]}
Or you can choose to display the revert situation, showing "Sound On" or "Sound Off". For that use this code:

Code: Select all

Sound {("On", "Off")[eg.result]}
You can adjust the position, font, color, time, etc. in the settings of the "Show OSD" event (double-click the "Show OSD" event).

I attach a screenshot of my settings. Yours should be looking something like this:

I make a video tutorial showing how to use EventGhost, including how to make display the current volume. Here's the video: http://www.youtube.com/watch?v=xnMzu1h1gxc


P.S. English is not my primary language so be understandable about my bad english.
Attachments
ScreenShot - EventGhost - Display Current Volume.jpg
ScreenShot - EventGhost - Display Current Volume.jpg (91.38 KiB) Viewed 18264 times
ScreenShot - EventGhost - Display Current Volume - Result.jpg
ScreenShot - EventGhost - Display Current Volume - Result.jpg (10.98 KiB) Viewed 18608 times
ScreenShot - EventGhost - Display Mute Status - Result (Mute On).jpg
ScreenShot - EventGhost - Display Mute Status - Result (Mute On).jpg (7.98 KiB) Viewed 18608 times
Last edited by InterlinkKnight on Tue Aug 16, 2011 8:06 pm, edited 5 times in total.
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Using OSD and display current volume level

Post by jonib »

Nice :D

You could put these instructions in your first post in this thread, so anybody searching would find them directly.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
Post Reply