Release AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27) +---- Forum: Service Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=152) +---- Thread: Release AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output (/showthread.php?tid=201896) |
RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - wilaim555 - 2014-10-06 (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-tips/how-to-play-audio-through-hdmi-speakers-simultaneously-in-windows-7/ Do you set speakers as default playback device, because only then I have stereo mixer as disabled recording device..? RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - axlt2002 - 2014-10-07 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! RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - axlt2002 - 2014-10-07 (2014-10-05, 15:55)Baptizt Wrote: Just what i was looking for. Same issue for me! 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! RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - marv_el - 2014-10-07 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. RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - axlt2002 - 2014-10-07 (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... 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? 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... 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! RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - axlt2002 - 2014-10-07 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): 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... RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - axlt2002 - 2014-10-08 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): the volume is set before changing the audio device and the bar is not displayed on the screen! 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...)! RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - axlt2002 - 2014-10-08 (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! 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 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})! RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - marv_el - 2014-10-08 great you figured it out. i will fix it in the evening! thx RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - axlt2002 - 2014-10-08 (2014-10-08, 09:36)marv_el Wrote: great you figured it out. It was really a pleasure to help! 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! RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - marv_el - 2014-10-08 axlt, please test the new version https://www.dropbox.com/s/c4zrg6l4y0a5gbf/script.audioswitch.0.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! RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - axlt2002 - 2014-10-08 (2014-10-08, 22:00)marv_el Wrote: axlt, please test the new version Hi marv_el, First of all thanks again for your effort! 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. Cheers! RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - axlt2002 - 2014-10-09 Found the bug! 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 == "": 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! RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - marv_el - 2014-10-09 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/bee136o36cw1k2x/script.audioswitch.0.2.1.zip?dl=0 it seems you are getting into python as well ;-) appreciate your support! RE: AUTOMATIC (and/or manual) AUDIO SWITCHER for different Audio Output - axlt2002 - 2014-10-09 (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! It was a pleaure to help and to start to understand python! 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. Do you think it is possible? |