Release AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output
#57
(2015-03-01, 15:14)henricos Wrote: Hello marv_el,

First of all, great job!!

Believe it or not… I also tried to create a similar add-on last year (May 2014).

Image

The source code is here: https://github.com/henricos/script.quick.audio.switch/ (you can check the commit dates)

It was working on Gotham but may need some adjustments on the addon.xml to work on Helix.

It is only a “manual” switcher but it was created to be “generic” (not only music/video scenario)

So, I’m writing here to publicly ask:

1) Do you mind if I release my add-on now? They are similar but not exactly the same. I can recommend using yours for automatic/music/video in my release

or

2) Are you interested in “merge” some functionalities from mine to create a more “generic” add-on ?

If you don’t want 1 and 2, I can still use mine only to myself. No problem!


Quote:If you want to know, here is my story (very similar to yours):

I’ve always wanted a script to switch audio settings with “one key press” and since I didn’t find any, I decided to write one myself (at least try to). I’ve never coded in python before and this seemed like a good challenge.

In my case, I only wanted to switch “manually” because most of the time I use HDMI (stereo) to TV and a few times I user SPDIF (multichannel) to my receiver. I know there are other users that constantly switch between HDMI and Headphones (Analog).

Basically, my idea was:

Step 1: The user configures audio “profiles” (initially 2 but it could be more) in the add-on settings using tabs that where “exact copies” of the audio settings page, with some additional fields like profile name and enable/disable.

Image

Step 2: The user runs the add-on using a command mapped to a key or from “Programs” section. The script automatically sets the audio with the next profile (cycling) and shows a notification with the name of the profile that was applied.

Although I managed to make it work, I was never satisfied with step 1. The thing is that to perfectly reproduce the audio setting GUI, I needed to dynamically enable/disable some items, based on values of other items. And there is no documentation on how this works. For example: if you choose an HDMI output, some items became enabled that are not enabled when the output is Analog. I had to hardcode this behavior based on tests but, since I don’t have all kinds of audio devices, I was not sure it was correct to all scenarios.

I also wanted to better document the code and finish translations… Then… many things happened after that and I never got any more time to work on the script and never shared it with anyone…

Comparing both solutions, here is what I think is better in each one:

Yours (script.audioswitch):
- Automatic switch (amazing!!)
- Can set volume
- Script “reads” current audio configuration to create config files

My addon (script.quick.audio.switch):
- Can be used in any scenario where the user wants to switch audio settings (more generic), not only music/video switching.
- User can “see” the settings of each profile

So, if you agree to merge our solutions, here is my suggestion:

Use the “generic profiles” approach to expand the use of the add-on to more scenarios and change the way the settings are saved. Instead of play a song and play a video, use the add-on settings

For example:

Create 4 profile tabs, where the user can name the profile, and with a button, “load” the current audio settings (instead of fill each item).

Then, on a general tab you can put all other settings and 3 of them could be:
- Default profile for music
- Default profile for video
- Default profile for navigation

And then the automatic service uses this information to switch between music/video



Again... this is just a suggestion.


Take care

Henrico

hi henrico,

you don't need my permission if you want to release your addon ;-).
i appreciate your work and i think all solutions have their pros and cons. i am certainly gonna take a peek at your source how you manage to implement the device name in the settings.
so maybe, when i find the time, i will improve my addon by learning (and copying) from you. :-p

thanks for sharing your addon!
Reply


Messages In This Thread
RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - by marv_el - 2015-03-04, 21:22
Logout Mark Read Team Forum Stats Members Help
AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output1