Author Topic: Token STATE_AUDIOPOS always returning 0  (Read 3395 times)

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Token STATE_AUDIOPOS always returning 0
« on: August 18, 2018, 09:09:06 AM »
Hi guys,
first : VA 1.7.2 (steam powered) / Audio Output Type = Windows Media Components / system: windows 10

This is my command 'pause' to get the STATE_AUDIOPOS of my sound before cuting it with a kill command  (( VA_music )) :

Code: [Select]
Write [Blue] '{TXT:Musique_en_cours}' to log
Set Text [Musique_Position] to '{STATE_AUDIOPOS:Musique_en_cours}'
Write [Blue] '{STATE_AUDIOPOS:Musique_en_cours}' to log
Set decimal [Musique_Position] value to the converted value of {STATE_AUDIOPOS:Musique_en_cours}
Write [blue] '{DEC:Musique_Position}' to log
kill command, '((VA_music))'

And this is the logs of this command :

Code: [Select]
16:50:44 - Stopped command, '(( VA_music ))'
16:50:44 - 0
16:50:44 - 0
16:50:44 - C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack\Sounds\FANNY\Musiques\Liste_des_musique\Musiques_electro\Daft Punk - Instant Crush.mp3
16:50:44 - Recognized : 'pause' (Confidence 98)
16:49:34 - Recognized : 'musique electro' (Confidence 98)

As you can see I let the sound playing more than 1 minute, I even tried more, to exclude queuing problems from the equation. The token STATE_AUDIOPOS always returns a 0.
Did I miss something in my logic ?

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2824
Re: Token STATE_AUDIOPOS always returning 0
« Reply #1 on: August 18, 2018, 09:46:12 AM »
Have you tried this with Integrated Components enabled?  Options > Audio > Audio output type

Wondering if there's something going on there.

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: Token STATE_AUDIOPOS always returning 0
« Reply #2 on: August 18, 2018, 09:56:59 AM »
Yes same result.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2824
Re: Token STATE_AUDIOPOS always returning 0
« Reply #3 on: August 18, 2018, 10:08:02 AM »
Do you get the same result if you don't kill the command?  Wondering if it is getting killed before the process of getting the audio position is able to complete.

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: Token STATE_AUDIOPOS always returning 0
« Reply #4 on: August 18, 2018, 10:15:57 AM »
yes I've just tried some minutes ago, nothing have changed, always 0

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: Token STATE_AUDIOPOS always returning 0
« Reply #5 on: August 18, 2018, 10:25:57 AM »
I just tried this simple command to replace the (( VA_music )) and still not working  :
Code: [Select]
Play sound '{VA_SOUNDS}\FANNY\Musiques\Liste_des_musique\Musiques_electro\Daft Punk - Instant Crush.mp3'
Set Text [Musique_en_cours] to 'C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack\Sounds\FANNY\Musiques\Liste_des_musique\Musiques_electro\Daft Punk - Instant Crush.mp3'
and command 'pause' without the stop command

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2824
Re: Token STATE_AUDIOPOS always returning 0
« Reply #6 on: August 18, 2018, 10:57:51 AM »
Ok, I see what's up.  When the integrated audio code was added, the path was not set up to compare all lower case (bad, bad programmer).  Try this as a workaround - For the playback audio path, put this in:

{TXTLOWER:Musique_en_cours}

instead of {TXT:Musique_en_cours}


The lower case issue has been fixed and will be out in the next release.  However, when I do this with Windows Media components, I'm not able to reproduce the problem and I'm able to get the position each time (no code change).

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2824
Re: Token STATE_AUDIOPOS always returning 0
« Reply #7 on: August 18, 2018, 11:03:19 AM »
Sorry... I thought you were using a variable to play the music.

You'll want to set text variable Musique_en_cours to whatever your file path is:
{VA_SOUNDS}\FANNY\Musiques\Liste_des_musique\Musiques_electro\Daft Punk - Instant Crush.mp3


Then, use that variable as part of a token in your play a sound path:

{TXTLOWER:Musique_en_cours}    <---note that its TXTLOWER and not just TXT as a workaround






kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: Token STATE_AUDIOPOS always returning 0
« Reply #8 on: August 18, 2018, 12:07:25 PM »
works fine with my simple command that ive made to replace (( VA_music )). But not with (( VA_music )) cuz I have a play random sound from directory in it. I tried to lower case manually my mp3 files but the issue persist

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2824
Re: Token STATE_AUDIOPOS always returning 0
« Reply #9 on: August 18, 2018, 12:15:16 PM »
Yeah... you're going to have to post the portion of your profile that is having problems as it seems like there are a lot things that are going on and it's difficult to assess at which point you are having the disconnect.  If you do post the portion of your profile, make sure to include the steps to reproduce the problem, as well as what you expect to see at each step versus what you are experiencing.  That way it's easier to isolate the issue.

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: Token STATE_AUDIOPOS always returning 0
« Reply #10 on: August 18, 2018, 12:19:36 PM »
Ok I'll make a profile with this commands, just a few minutes to export and translate all of this.  ;)

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: Token STATE_AUDIOPOS always returning 0
« Reply #11 on: August 18, 2018, 02:01:11 PM »
See the profile attached.
so I have directories named music_electro, music_jazz, music_rap etc... where the player has to place his musics.
and with the command 'electro music', i.e, VA open the directory music_electro and play random sound in it until the command stop or pause. So I can't retrieve the position when I play the sound with 'play random sound from directory'.
PS: I tried to translate even the variables and paths for more understanding, I hope that i didn't miss some of them

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2824
Re: Token STATE_AUDIOPOS always returning 0
« Reply #12 on: August 18, 2018, 11:13:25 PM »
I think I've isolated what is going on in your case.  There's some special handling in regards to threading when it comes to Windows Media component interaction, and that's why {STATE_AUDIOPOS} is not working when using them (it's actually an odd combination of things all coming together nicely to make what you are trying to do not work right).  Some of that code was copied directly over and is being used by the Integrated components unnecessarily.  Getting Integrated components up and working properly was just one line to change.  I will do some further testing and get a build out to at least get you going (hopefully tomorrow).  For Windows Media, I'm going to need to do a fair amount of work to provide that info (Windows Media components are rather tricky when accessing cross-thread).

Also, I noticed when I, 'play' after, 'pause' the volume is set to 100%.  There's some new stuff in the current beta in regards to variable volume that is going to carry over into random sounds in the next beta (just a heads up).

Thanks for helping out!
« Last Edit: August 19, 2018, 09:07:59 AM by Gary »

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: Token STATE_AUDIOPOS always returning 0
« Reply #13 on: August 19, 2018, 04:23:00 AM »
yes I noticed the 'play' after 'pause' sound, I forgot to reduce it in the command (( VA_music )) in 'Play sound '{TXT:music_actually_played}' (and wait until it completes)

thank you to you  ;D

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2824
Re: Token STATE_AUDIOPOS always returning 0
« Reply #14 on: August 19, 2018, 07:56:09 PM »
I have uploaded a build to the, 'unofficial Steam' bin if you want to take it for a spin:
http://www.voiceattack.com/steamunofficial

Just replace the voiceattack.exe in your Steam installation folder with that one.  You should keep a copy of your original voiceattack.exe in case you want to roll back quickly.

Let me know if you decide to do this and if it works as expected.  Otherwise, this will be out in the next beta (no ETA on that, unfortunately.  It *may* be soon, but I'm not sure how soon that would be).

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: Token STATE_AUDIOPOS always returning 0
« Reply #15 on: August 20, 2018, 10:00:49 AM »
the unofficial works fine, really great in both integrated components and windows media components . :D

just FI: In the official VA1.7.2, I noticed that with integrated components, the sound stop when another command (with the option " this completes all athor currently-playing sound " unchecked of course) play sound,
this Issue don't exist anymore in the VA1.7.12 you sent to me. So it's OK.    :-X

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2824
Re: Token STATE_AUDIOPOS always returning 0
« Reply #16 on: August 20, 2018, 10:03:56 AM »
Was the option, 'Wait until sound completes' (or whatever) checked when this would occur?  That's where I made the update for integrated components.

kourou

  • Jr. Member
  • **
  • Posts: 81
  • Anything that can go wrong will go wrong
    • FANNY (Discord)
Re: Token STATE_AUDIOPOS always returning 0
« Reply #17 on: August 20, 2018, 10:45:10 AM »
yes it was for the first sound played and then stoped by another "play sound"

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2824
Re: Token STATE_AUDIOPOS always returning 0
« Reply #18 on: August 20, 2018, 11:53:56 AM »
Yeah... the way that sounds are handled when, 'wait until sound completes' is checked is different than when it is not checked.  Integrated components was updated in that regard, so, that would make sense.  Glad it's working (I have no idea what's going on lol).