• 1
  • 2(current)
  • 3
  • 4
  • 5
  • 9
Release AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output
#16
(2014-10-06, 13:30)Baptizt Wrote:
(2014-10-05, 21:18)wilaim555 Wrote: You can hear anything in two audio output in same time, one must be speakers and second is your choice.. Look this trick http://www.addictivetips.com/windows-tip...windows-7/
Work on all windows (7 and 8 x64 and x86)

That would a good solution.
But i dont have the extender options in my audio setting.

Do you set speakers as default playback device, because only then I have stereo mixer as disabled recording device..?
Reply
#17
Hi marv_el,

I'm actually trying to modify your script in order to set the volume to the maximum (100%) every time the audio device is changed, but actually I didn't have success.

In particular, looking at the manualswitch.py script (that I suppose is the one that is called to change the device) I tried to put the following command in several places:

Code:
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Application.SetVolume", "params": {"volume": %d}, "id": 1}' % 100)

but the command is never executed...I don't know if is a sintax problem, the position in which I have tried, or both!

Would you be so kind to give it a try and let me know please?

Two additional questions/thoughts:

- For what the default.py script is used? Maybe I have to make some modifications there?
- To minimize the situations during which the delay in changing the audio device afflicts the music playback, it could be a solution to run your script when entering the music menu (MyMusicNav.xml) and not when the album is going to be played...what do you think? The only time when the delay will impact the song playback will be when playing the album from the "recently added" widget in the home menu (therefore not passing through the music menu).

Looking forward for your kind help!
Light IMDb Ratings Update - Keep updated the IMDb ratings for your movies and TV shows.
In case you found useful my work, feel free to offer me a cappuccino!
Reply
#18
(2014-10-05, 15:55)Baptizt Wrote: Just what i was looking for.
But... Smile
Not working for me. (on xmbc 13.2)
When i try step 4 nothing is happening.
I tried playing a mp3 file.

When i select a video file (mkv) i do get a notification popup.
After setting this, i do get another popup for setting Music.
But again no popup after playing a mp3 (or airplay) file.

I must be doing something wrong?

Same issue for me! Sad

In fact, untill now, I was using this addon on my laptop just as a field for some experiments (see the post above) and I had no issues in the configuration procedure.

Few minutes ago I instead tried to configure it on my HTPC and the same issue reported by Baptizt has happened. In particular, it seems that the service is not able to "detect" the WASAPI Optical S/PIDF device...as soon as I try another device, the procedure finishes correctly.

marv_el, can you take a look also to this? Do you need some logs on my side? Just tell me what you want...I will be happy to help you as usual!

Cheers!
Light IMDb Ratings Update - Keep updated the IMDb ratings for your movies and TV shows.
In case you found useful my work, feel free to offer me a cappuccino!
Reply
#19
hi,

i suspect an encoding issue ( "/" seems to make problems), which is on my todo list for improvements. i try to fix it soon!

axlt, what do you want to achieve with the volume setting?
i can try to implement an option in the settings to set different volume levels for each audio device. would this help you?

unfortunately i have no idea how to prevent the audio device switching delay. xbmc/kodi fires an event when playback starts which i can use to figure out which device is needed. i can not grab the information before the playback starts. at least i have no idea yet.
Reply
#20
(2014-10-07, 19:44)marv_el Wrote: i suspect an encoding issue ( "/" seems to make problems), which is on my todo list for improvements. i try to fix it soon!

Ok, I can provide you the correct string that is used by XBMC in order to facilitate the bug discovery... Cool

Edit: Yes, I can confirm that the issue could be the "/"...I'm really looking forward for your solution! ;-)

(2014-10-07, 19:44)marv_el Wrote: axlt, what do you want to achieve with the volume setting?
i can try to implement an option in the settings to set different volume levels for each audio device. would this help you?

Yes, it would be great!

Since I would like to have a perfect bitstreaming for music (that is why for music I set the WASAPI on S/PDIF), I would avoid to change manually the volume to 100% in case this has been modified, for example, while watching a movie just before... Wink

Did you find anyway some errors in the code line that I posted?

(2014-10-07, 19:44)marv_el Wrote: unfortunately i have no idea how to prevent the audio device switching delay. xbmc/kodi fires an event when playback starts which i can use to figure out which device is needed. i can not grab the information before the playback starts. at least i have no idea yet.

I mean, the delay is not a big issue at all...it happens just the first time you change to music AND only for the first song AND in case such song has no a fade-in start...I think that I can live with that! Nod
Light IMDb Ratings Update - Keep updated the IMDb ratings for your movies and TV shows.
In case you found useful my work, feel free to offer me a cappuccino!
Reply
#21
I've tried to play a little bit with the script to implement the volume change...but not success at all!

Hereafter what I have done inside manualswitch.py

Code:
def set_audiodevice(dev,pt,ch):
       xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.audiodevice","value":"%s"},"id":1}' % dev)
       xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.passthrough","value":%s}, "id":1}' % pt)
       xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.channels","value":%s}, "id":1}' % ch)
       xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method": "Application.SetVolume", "params": {"volume": 100}, "id": 1}')

where the last command is the one that I have added. What is strange is that such command works perfectly if launched from the browser (I have enabled the HTTP service in XBMC) and the volume is correctly set! I can not figure out why it doesn't work in the script...
Light IMDb Ratings Update - Keep updated the IMDb ratings for your movies and TV shows.
In case you found useful my work, feel free to offer me a cappuccino!
Reply
#22
Another step!

I found that the correct file to modify was the script default.py (in the meanwhile I also learned that the number of spaces are fundamental when writing code in python!).

So now the voulme is correclty set to 100! The only remaining issue is that the volume bar appears on the screen...I would prefer having it hide...

Let me think about that...

- - - Edit - -

Even better with the following:

Code:
def set_audiodevice(dev,pt,ch):
       xbmc.executebuiltin("SetVolume(100)")
       xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.audiodevice","value":"%s"},"id":1}' % dev)
       xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.passthrough","value":%s}, "id":1}' % pt)
       xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.channels","value":%s}, "id":1}' % ch)

the volume is set before changing the audio device and the bar is not displayed on the screen! Cool

Sorry for boring you guys, but I think that is always a good thing to share the information (even if ofr someone could be quite simple...)!
Light IMDb Ratings Update - Keep updated the IMDb ratings for your movies and TV shows.
In case you found useful my work, feel free to offer me a cappuccino!
Reply
#23
(2014-10-07, 21:53)axlt2002 Wrote:
(2014-10-07, 19:44)marv_el Wrote: i suspect an encoding issue ( "/" seems to make problems), which is on my todo list for improvements. i try to fix it soon!

Ok, I can provide you the correct string that is used by XBMC in order to facilitate the bug discovery... Cool

Edit: Yes, I can confirm that the issue could be the "/"...I'm really looking forward for your solution! ;-)

Found a workaround while waiting your upadate...

In the XBMC log file it is possible to find the list of the audio device:

Code:
00:31:00 T:4492  NOTICE: Found 2 Lists of Devices
00:31:00 T:4492  NOTICE: Enumerated DIRECTSOUND devices:
00:31:00 T:4492  NOTICE:     Device 1
00:31:00 T:4492  NOTICE:         m_deviceName      : {1F8B6FEC-BA46-4F5E-B4D3-0A14322A9DA6}
00:31:00 T:4492  NOTICE:         m_displayName     : HDMI - Audio digitale (HDMI) (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_displayNameExtra: DIRECTSOUND: Audio digitale (HDMI) (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_deviceType      : AE_DEVTYPE_HDMI
00:31:00 T:4492  NOTICE:         m_channels        : FL,FR
00:31:00 T:4492  NOTICE:         m_sampleRates     : 44100
00:31:00 T:4492  NOTICE:         m_dataFormats     : AE_FMT_FLOAT,AE_FMT_AC3,AE_FMT_DTS
00:31:00 T:4492  NOTICE:     Device 2
00:31:00 T:4492  NOTICE:         m_deviceName      : {25068C7E-F2D9-44C3-835D-7ADA30911F2F}
00:31:00 T:4492  NOTICE:         m_displayName     : Speakers - Altoparlanti (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_displayNameExtra: DIRECTSOUND: Altoparlanti (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
00:31:00 T:4492  NOTICE:         m_channels        : FL,FR
00:31:00 T:4492  NOTICE:         m_sampleRates     : 44100
00:31:00 T:4492  NOTICE:         m_dataFormats     : AE_FMT_FLOAT
00:31:00 T:4492  NOTICE:     Device 3
00:31:00 T:4492  NOTICE:         m_deviceName      : default
00:31:00 T:4492  NOTICE:         m_displayName     : default
00:31:00 T:4492  NOTICE:         m_displayNameExtra:
00:31:00 T:4492  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
00:31:00 T:4492  NOTICE:         m_channels        : FL,FR
00:31:00 T:4492  NOTICE:         m_sampleRates     : 44100
00:31:00 T:4492  NOTICE:         m_dataFormats     : AE_FMT_FLOAT
00:31:00 T:4492  NOTICE:     Device 4
00:31:00 T:4492  NOTICE:         m_deviceName      : {2A8C3828-A828-4E27-ACCB-7F78CB931806}
00:31:00 T:4492  NOTICE:         m_displayName     : SPDIF - Audio digitale (S/PDIF) (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_displayNameExtra: DIRECTSOUND: Audio digitale (S/PDIF) (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_deviceType      : AE_DEVTYPE_IEC958
00:31:00 T:4492  NOTICE:         m_channels        : FL,FR
00:31:00 T:4492  NOTICE:         m_sampleRates     : 44100
00:31:00 T:4492  NOTICE:         m_dataFormats     : AE_FMT_FLOAT,AE_FMT_AC3,AE_FMT_DTS
00:31:00 T:4492  NOTICE: Enumerated WASAPI devices:
00:31:00 T:4492  NOTICE:     Device 1
00:31:00 T:4492  NOTICE:         m_deviceName      : {1F8B6FEC-BA46-4F5E-B4D3-0A14322A9DA6}
00:31:00 T:4492  NOTICE:         m_displayName     : HDMI - Audio digitale (HDMI) (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_displayNameExtra: WASAPI: Audio digitale (HDMI) (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_deviceType      : AE_DEVTYPE_HDMI
00:31:00 T:4492  NOTICE:         m_channels        : FL,FR
00:31:00 T:4492  NOTICE:         m_sampleRates     : 192000,48000,44100
00:31:00 T:4492  NOTICE:         m_dataFormats     : AE_FMT_DTSHD,AE_FMT_TRUEHD,AE_FMT_EAC3,AE_FMT_DTS,AE_FMT_AC3,AE_FMT_AAC,AE_FMT_S16NE,AE_FMT_S16LE,AE_FMT_S16BE,AE_FMT_LPCM
00:31:00 T:4492  NOTICE:     Device 2
00:31:00 T:4492  NOTICE:         m_deviceName      : {25068C7E-F2D9-44C3-835D-7ADA30911F2F}
00:31:00 T:4492  NOTICE:         m_displayName     : Speakers - Altoparlanti (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_displayNameExtra: WASAPI: Altoparlanti (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
00:31:00 T:4492  NOTICE:         m_channels        : FL,FR
00:31:00 T:4492  NOTICE:         m_sampleRates     : 192000,96000,48000,44100
00:31:00 T:4492  NOTICE:         m_dataFormats     : AE_FMT_S24NE4,AE_FMT_S24LE4,AE_FMT_S24BE4,AE_FMT_S16NE,AE_FMT_S16LE,AE_FMT_S16BE
00:31:00 T:4492  NOTICE:     Device 3
00:31:00 T:4492  NOTICE:         m_deviceName      : default
00:31:00 T:4492  NOTICE:         m_displayName     : default
00:31:00 T:4492  NOTICE:         m_displayNameExtra:
00:31:00 T:4492  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
00:31:00 T:4492  NOTICE:         m_channels        : FL,FR
00:31:00 T:4492  NOTICE:         m_sampleRates     : 192000,96000,48000,44100
00:31:00 T:4492  NOTICE:         m_dataFormats     : AE_FMT_S24NE4,AE_FMT_S24LE4,AE_FMT_S24BE4,AE_FMT_S16NE,AE_FMT_S16LE,AE_FMT_S16BE
00:31:00 T:4492  NOTICE:     Device 4
00:31:00 T:4492  NOTICE:         m_deviceName      : {2A8C3828-A828-4E27-ACCB-7F78CB931806}
00:31:00 T:4492  NOTICE:         m_displayName     : SPDIF - Audio digitale (S/PDIF) (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_displayNameExtra: WASAPI: Audio digitale (S/PDIF) (Dispositivo High Definition Audio)
00:31:00 T:4492  NOTICE:         m_deviceType      : AE_DEVTYPE_IEC958
00:31:00 T:4492  NOTICE:         m_channels        : FL,FR
00:31:00 T:4492  NOTICE:         m_sampleRates     : 192000,96000,88200,48000,44100
00:31:00 T:4492  NOTICE:         m_dataFormats     : AE_FMT_DTS,AE_FMT_AC3,AE_FMT_AAC,AE_FMT_S24NE4,AE_FMT_S24LE4,AE_FMT_S24BE4,AE_FMT_S32NE,AE_FMT_S32LE,AE_FMT_S32BE,AE_FMT_S16NE,AE_FMT_S16LE,AE_FMT_S16BE

therefore I just changed manually the file device_audio.cfg replacing the device name of the S/PDIF (e.g. {2A8C3828-A828-4E27-ACCB-7F78CB931806})! Wink Cool
Light IMDb Ratings Update - Keep updated the IMDb ratings for your movies and TV shows.
In case you found useful my work, feel free to offer me a cappuccino!
Reply
#24
Laugh great you figured it out.
i will fix it in the evening! thx
Reply
#25
(2014-10-08, 09:36)marv_el Wrote: Laugh great you figured it out.
i will fix it in the evening! thx

It was really a pleasure to help! Wink

My modification to the volume set is hard coded...as you suggested it would be nice to have it more flexible by input two different values for the two audio devices through the addon GUI.

I can not wait for the new release! Cool
Light IMDb Ratings Update - Keep updated the IMDb ratings for your movies and TV shows.
In case you found useful my work, feel free to offer me a cappuccino!
Reply
#26
axlt, please test the new version
https://www.dropbox.com/s/c4zrg6l4y0a5gb...2.zip?dl=0

problems with spdif devices should be fixed and the ability to set volume levels in the settings are added.
thanks for your support!
Reply
#27
(2014-10-08, 22:00)marv_el Wrote: axlt, please test the new version
https://www.dropbox.com/s/c4zrg6l4y0a5gb...2.zip?dl=0

problems with spdif devices should be fixed and the ability to set volume levels in the settings are added.
thanks for your support!

Hi marv_el,

First of all thanks again for your effort! Blush

Unfotunately it seems that there is some kind of bug that makes the confguration process entering in a loop: the addon continues to configure music and video alternately without any end...

Let me know if you need some log. Wink

Cheers!
Light IMDb Ratings Update - Keep updated the IMDb ratings for your movies and TV shows.
In case you found useful my work, feel free to offer me a cappuccino!
Reply
#28
Found the bug! Big Grin

At the beginning of the function

Code:
setUP_audio()

you have removed (for cleanup purposes I suppose) the three lines related to video parameters configuration. In particular the line

Code:
vid = get_audio("device video.cfg")

is needed since a little bit later there is the following control:

Code:
if vid == "":
            ok = dialog.ok('Initial Setup', __setupVIDEO__)
            xbmc.executebuiltin("PlayerControl(Stop)")
else:
            __addon__.setSetting("setup", "false")
            ok = dialog.ok('DONE!', 'Configuration is now DONE!')
            setup_ready = False

and therefore, without that line you have deleted, there si no variable to be checked and I suppose that the if-else code is simply jumped (I'm not an exeprt of python).

The same applies, specularly, for the function

Code:
setUP_video()

I have made the changes and now all is working perfect!

Please find at the following link the new deafault.py: https://copy.com/8Eh0txTP9x2m. There is also a small addition that stops the playback after the configuration is completed.

I hope you will appreciate my help! Wink
Light IMDb Ratings Update - Keep updated the IMDb ratings for your movies and TV shows.
In case you found useful my work, feel free to offer me a cappuccino!
Reply
#29
thanks...i fixed it right now. haven't seen your post before, but you are totally right!

here's the corrected version:
https://www.dropbox.com/s/bee136o36cw1k2...1.zip?dl=0

it seems you are getting into python as well ;-)
appreciate your support!
Reply
#30
(2014-10-09, 19:42)marv_el Wrote: thanks...i fixed it right now. haven't seen your post before, but you are totally right!

here's the corrected version:
https://www.dropbox.com/s/bee136o36cw1k2...1.zip?dl=0

it seems you are getting into python as well ;-)
appreciate your support!

It was a pleaure to help and to start to understand python! Laugh

I have one more "feature" request (shouldn't be complicated): it would be nice to have added in the audio settings page of the addon the current audio device configured for music and video (just on top of passthrough, channels and volume level parameters). This would help as a reminder, I'm not asking to configure it from there as the other parameters. Wink

Do you think it is possible? Nod
Light IMDb Ratings Update - Keep updated the IMDb ratings for your movies and TV shows.
In case you found useful my work, feel free to offer me a cappuccino!
Reply
  • 1
  • 2(current)
  • 3
  • 4
  • 5
  • 9

Logout Mark Read Team Forum Stats Members Help
AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output1