Trying to add a Volume Bar to Control Pages based on Airfoil

Posted on
Sun Jan 10, 2016 12:59 pm
bosstdh offline
Posts: 12
Joined: Jan 10, 2016

Trying to add a Volume Bar to Control Pages based on Airfoil

Hello this is my first post and i have a question about control pages. I am looking to add a volume variable image that changes according to the current volume of an AIRFOIL speaker.
I have attached an image so you can see the GUI i am working on.

So from the attached screenshot when the east garage volume is increased i want the volume image to change. I have created 15 versions of the volume slider. Looking through the posts i know how to get the current volume of the airfoil speaker:

tell application "Airfoil"
volume of speaker "East Garage"
end tell

I think what i need to do is write the above result to a variable (VolEastGarage) and then place a variable image on the control page that relates to this value and based on the changes the volume slider image change on the control page. Please Help!
Attachments
volume.png
volume.png (19.05 KiB) Viewed 2963 times
screenshot.png
screenshot.png (213.84 KiB) Viewed 2963 times

Posted on
Mon Jan 11, 2016 5:02 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Trying to add a Volume Bar to Control Pages based on Air

Hi.

You're on exactly the right lines.

Take a look at image heuristics here: http://wiki.indigodomo.com/doku.php?id=cp_custom_images

You'd name your images say Volume+.png Volume+1.png Volume+2.png etc up to 100 (or only store your volumes in multiples of 10)

Then set the image source to be variable VolEastGarage and display as image and pick "Volume" from the list; Indigo will then display the right image according to the variable value.

I might have missed one or two finer details but you should get there with this.

Peter


Sent from my iPhone using Tapatalk

Posted on
Thu Jan 14, 2016 9:34 pm
bosstdh offline
Posts: 12
Joined: Jan 10, 2016

Re: Trying to add a Volume Bar to Control Pages based on Air

Hey peter thanks for the response.

So i changed to volume images to volume+.png, volume+5.png, volume+10.png, etc.
I added the element to the control page as a VARIABLE IMAGE, selected the correct Variable under the FOR drop down and selected AS IMAGE selecting volume+.png

when i change the volume the image does not change?
when i check the volume settings using the applescript code: tell application "Airfoil" volume of speaker "East Garage" end tell

the volume result goes from the smallest 0.1 to a maximum of 1.0
i even tried adding decimals to the volume filenames - still they are not changing. Any ideas?

Posted on
Fri Jan 15, 2016 1:05 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Trying to add a Volume Bar to Control Pages based on Air

Hi Boss.

Have you implemented any code to set the value of the variable?

I'm not familiar with AppleScript but you need your above code combined with something like "tell indigoserver to set value of VolEastGarage to current volume of airfoil speaker multiplied by 10"

That will (ish) get the variable value to 0-10.

I *think* I recall image numbers can round-up so 2-5 will use your 5.png, 6-10 will use 10.png

If you therefore number them 1-10 instead of 1-15 (you might need to redo the actual image to only hold 10 increments) then you should I think make progress.

See how you go.


Sent from my iPhone using Tapatalk

Posted on
Fri Jan 15, 2016 8:31 am
bosstdh offline
Posts: 12
Joined: Jan 10, 2016

Re: Trying to add a Volume Bar to Control Pages based on Air

Yes ok makes sense i just don't know how to write the applescript this is what i have thus far:

tell application "IndigoServer"
set value of variable "VolumeMasterBedroom" to volume of airfoil speaker "Master_Bedroom"
end tell

from what you said i then need to multiply this number by 10 and then i should be good.

Just need help with above code?

Posted on
Fri Jan 15, 2016 10:13 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Trying to add a Volume Bar to Control Pages based on Air

Yeah - any AppleScripters reading this thread?


Sent from my iPhone using Tapatalk

Posted on
Mon Feb 01, 2016 7:35 am
supergolfstick offline
Posts: 1
Joined: Jan 20, 2016

Re: Trying to add a Volume Bar to Control Pages based on Air

bosstdh-

would you be willing to send your control page templates. I am terrible at UI/UX work and have just completed a new house build that I am trying to get this completed on. Any help would be greatly appreciated
:lol:

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests