Author Topic: Play random sound from directory bug  (Read 12190 times)

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Play random sound from directory bug
« on: May 18, 2016, 04:35:47 PM »
V1.5.8.18

directory is cached and not updated when using a token in the filepath

eg. different characters with the same content:

dir:{VA_SOUNDS}\hcspack{TXT:Education}\galaXapedia

TXT:Education is set to VEGA - plays fine no probs
then
TXT:education changes to ORION - plays sounds from the VEGA path

not sure how you would fix this especially if you have no repeats on as you would need to store the contents and remember what was played, for every directory.
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Play random sound from directory bug
« Reply #1 on: May 18, 2016, 05:48:05 PM »
I'm not able to reproduce this on my end (even if changing the variable's case, running in rapid succession and even changing to forced legacy audio):

Set Text [Education] to 'WAVS'
Play sound, 'D:\Data\SAMPLES\{TXT:Education}\Bacon.WAV'
Set Text [education] to 'WAVS2'
Play sound, 'D:\Data\SAMPLES\{TXT:Education}\Chicken.wav'

Can you export and upload the profile with just the affected commands here for me to try out?  If you don't want to send here, you can always send to support@voiceattack.com.  I'll toss it on the debugger and see if I can notice something.

Thanks!

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Play random sound from directory bug
« Reply #2 on: May 18, 2016, 06:49:55 PM »
the contents of the folders are all named exactly the same, if that helps any, maybe name both files Bacon.WAV and see if that is the problem
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Play random sound from directory bug
« Reply #3 on: May 19, 2016, 12:05:24 AM »
That seems to be working fine, too. 

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Play random sound from directory bug
« Reply #4 on: May 19, 2016, 03:51:03 AM »
ok this might be a bit complicated but...

You will need a couple of hcs voicepacks installed (I presume you have a couple)

the command to test is "give me a random galactic fact"

you set the variable for the directory by saying "CREWNAME to education", crewname being astra\doris\orion etc and obviously needs to be a pack which has Galaxapedia with it's contents

you can turn on debug mode by pressing ctrl-alt-backspace and that will show you the directory name it's using when you issue the galactic fact command. You should see that the first time you issue the command it works fine, you then say CREWNAME to education again to change the directory path but the sound it plays will be the same as the first even though the dir path has changed
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Play random sound from directory bug
« Reply #5 on: May 19, 2016, 11:19:24 AM »
Whoa... ok.. wow.  There are a lot of actions in those commands in there o_O.

Question.  Is all of this from HCS or has it been modified somewhere?  The reason I ask is before I go down a rabbit hole, I lean on the idea that there are *many* users with HCS packsthat are not saying anything about problems, plus there are several guys at HCS that work on and test packs.

Have you tried just creating a simple command that sets a variable to the portion of one sound path, play the sound, change the variable and play the next sound?

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Play random sound from directory bug
« Reply #6 on: May 19, 2016, 02:57:47 PM »
this is all my own creation. It uses their profile and changes it so you can use all their voices. The command that causes the problem has 1 line, to play a random file from a directory using a variable in the directory path. The rest is basically to set up that variable.

I've just tried setting the variable directly before the dir call and it is indeed working correctly as you've said. So there's something deeper happening with VA and variables and I appreciate you may not have the time right now to delve deeply.
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Rhaedas

  • Jr. Member
  • **
  • Posts: 72
Re: Play random sound from directory bug
« Reply #7 on: May 19, 2016, 03:13:12 PM »
And I thought my variables to keep track of panels and stuff was complex. Gah. I looked at it, but with no voice packs or frame of reference, I'm lost.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Play random sound from directory bug
« Reply #8 on: May 20, 2016, 12:28:06 AM »
Behind the scenes, a new audio object is created for each sound instance and destroyed when it is finished, so I'm fairly sure there is no caching going on in regards to the sound object.  Tokens are evaluated at the point of execution, as values can change.  Variables are read when they are needed and not retained.  The only other thing I can think that may cause what you are describing is if you have concurrent commands running at the same time and they are stepping on each other.  Do you have any situations where that might occur?

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Play random sound from directory bug
« Reply #9 on: May 20, 2016, 01:37:54 AM »
no, nothing running concurrently. The commands to change the variable are done and finished beforehand. The confusing part is I write the variable to the log screen directly before the call to the dir and the path changes correctly but doesn't play the correct sound. If I play a single sound in that command using the same path it works fine, just not with a directory. It's as if the variable in the play from directory is stuck the first time it's run. So it may not be the files in the directory that have cached but the path. Maybe it's only happening when using a variable that's been set outside of the invoking command as it works fine when setting the variable inside the same command....clutching a bit :)
« Last Edit: May 20, 2016, 04:05:44 AM by TheThingIs »
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Play random sound from directory bug
« Reply #10 on: May 20, 2016, 01:13:49 PM »
Something else to remember is that there are no, 'local' variables in VA (at least not currently).

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Play random sound from directory bug
« Reply #11 on: May 23, 2016, 06:30:53 AM »
Ok Gary, I've made a very simple profile which, for me atleast, doesn't work and plays sounds out of the same directory. Hopefully you'll be able to see what's happening with this....just press enter to start it
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Play random sound from directory bug
« Reply #12 on: May 23, 2016, 11:20:36 PM »
Ok...  NOW, I'm seeing something.  This is actually an interesting one.  I'll spare most of the details, but it has to do with the same action being used with a different directory each time.  Since the action id is used as a key, and the directory name is changing via variable, the same structure is being used.  So, yes, a cache is involved (structures are built the first time through), but it's not the cache's fault.  This has been fixed and it will be in the next release.   Good catch!

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Play random sound from directory bug
« Reply #13 on: May 24, 2016, 01:48:22 AM »
fantastic m8, very well done :)
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Play random sound from directory bug
« Reply #14 on: May 28, 2016, 12:04:31 AM »
New beta is out.  I think this should fix your issue.  Let me know how it goes ;)