Author Topic: Playing Music !  (Read 4692 times)

pscammp

  • Guest
Playing Music !
« on: April 08, 2018, 09:28:23 AM »
Hello all,

I set up a new command to fire up VLC to play some music and all seemed great, it would play the music, do the 'next track' thing etc.

The problem I have is when trying it when elite dangerous is running in VR. When I scream the command to play blah blah the Elite window is the selected window and my HOTAS is working fine, when VLC opens up on the command, the playlist fires up but then VLC becomes the active window so my HOTAS no longer works in elite.

How do I set it up so the command runs the VLC playlist but then makes elite the active window after the VLC application has been started   ???

This is whats in the 'Run an Application' box as an example, no parameters or target dir:

G:\iTunes\Music\David Bowie\Best Of 1969-1974\Best%20Of%201969-1974.xspf

Cheers
Paul
 
« Last Edit: April 08, 2018, 09:32:11 AM by pscammp »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Playing Music !
« Reply #1 on: April 08, 2018, 01:24:22 PM »
You can use the "Perform a Window Function" action to change application focus back to Elite. You can try "Normal" or "Show", though neither will likely work well if the game's running fullscreen.

You may also want to use the "{WINDOWEXISTS:}" token, as I believe the "Wait until launched application is started before continuing" option of the "Run an Application" action will only check whether the process is running; As focus is changed by the window rather than than the process, this could mean it switches to early that way.

E.G.
Code: [Select]
Run application 'G:\iTunes\Music\David Bowie\Best Of 1969-1974\Best%20Of%201969-1974.xspf'
Start Loop While : [{WINDOWEXISTS:*VLC*}] Equals '0'
End Loop
Display window 'Elite Dangerous' as [Normal]

If VLC fails to start the command would keep running, so you could add a timeout:
Code: [Select]
Run application 'G:\iTunes\Music\David Bowie\Best Of 1969-1974\Best%20Of%201969-1974.xspf'
Set date [~startTime] to [~startTime] plus [10] seconds
Start Loop While : ([{WINDOWEXISTS:*VLC*}] Equals '0' AND [~startTime] Is Greater Than Current Date/Time)
End Loop
Display window 'Elite Dangerous' as [Normal]

pscammp

  • Guest
Re: Playing Music !
« Reply #2 on: April 09, 2018, 05:59:25 AM »
pFeil,
    Thanks for that, got it going, slightly differently but your advice helped me get it done.

So now I just have one last problem to complete my functionality with my music if you wouldn't mind ?

When VLC fires up loading 'x' music playlist and it's playing, I could say 'Next Track' and Astra would
acknowledge and move it on to the next track for me (same with previous track, pause and play). This
obviously had the VLC window as the active window for it to work. Now I have managed to get VA to
reselect the Elite Dangerous (Client) window after the operation the VLC window is no longer the active
window so next track etc no longer works. What I need to do is select the VLC window, perform the 'next
track' operation and then again return to the Elite Dangerous (client) as the active window same as I have
just done with my custom commands.

So I looked into 'Extra Content - Music Control' and found the reference to '((RS - Next Track))' and then
on to '((Play Sound Bucket)) but cant really make head or tail of which command actually moves the track on
to the next one or previous one etc, couldn't even find ((Play Sound Bucket)) full stop   LOLOL

Any guidance as to how I can add select 'VLC window command and my reselect Elite (client) window' to the
current commands   ????

Many Thanks Again
Paul

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Playing Music !
« Reply #3 on: April 09, 2018, 07:13:25 AM »
Those commands would be specific to the profile you're using, so you'll want to ask the creator how their system is set up.

That said, if you want to control VLC playback you should be able to use global hotkeys for that, without requiring the VLC window to have focus.

E.G.
Code: [Select]
Press Media Next Track key and hold for 0,06 seconds and release

If you open VLC and press Ctrl-P, click the "Hotkeys" icon(assuming you're using "Simple" settings), and check that the "Global" column has media keys assigned to the actions you want to use.


You don't have to use media keys(any keyboard key or combination will do), but many keyboards have them, and they're not usually used for anything else so they shouldn't interfere with games.

pscammp

  • Guest
Re: Playing Music !
« Reply #4 on: April 09, 2018, 07:20:35 PM »
Sussed it out....

In 'Extra Content - Music Control' and in the IF statement block for 'Next Track' (and for 'previous Track') I put in a new command at the beginning which selects the VLC window, it then performs it's already present tasks, then at the end of the IF block I execute a command to reselect the Elite Dangerous (client) window.

All happens in a fraction of a second and works like a charm

:-)

Thanks again
Paul

ralf44

  • Newbie
  • *
  • Posts: 41
Re: Playing Music !
« Reply #5 on: April 13, 2018, 02:46:12 PM »
Sounds solved, if you wanted to avoid switching windows at all - for example, some full-screen games get unstable when alt-tabbing - you can make a simple music player in VA with a few clicks. There is a command (Play Sound I think) which you can point at a directory of songs and it has a built in song-shuffle function that can be set to prevent repeats, it only takes a couple of minutes to make start music, stop music and shuffle on/off voice commands so you could ditch VLC  and have one less program running while you're gaming.