AudioMixer resets when loading the project

Found a bug? Post information about it here so we can fix it!

Moderator: Moderators

Post Reply
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

AudioMixer resets when loading the project

Post by Ats »

Hello. I have this weird bug with the AudioMixer:

I'm using Chanel 2 and 3, but when I save the project, leave ZGE, and come back to it later, extra channels 2 and 3 are deactivated.
In fact, none of the settings in the AudioMixer seems to be saved, since Volume and DelayLength of channel 0 and 1 goes back to their factory reset.

I can't set all manually at the start of the game either using:

AudioMixer.Ch2Active = 1;
AudioMixer.Ch2Volume = 0.5;
AudioMixer.Ch3Active = 1;
AudioMixer.Ch3Volume = 0.5;

I get an AccessViolation Error...
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: AudioMixer resets when loading the project

Post by Kjell »

Hi Ats,
Ats wrote: Sat Mar 05, 2022 7:55 amI'm using Chanel 2 and 3, but when I save the project, leave ZGE, and come back to it later, extra channels 2 and 3 are deactivated.
Strange .. i just tried this to double-check and it works just fine for me.
Ats wrote: Sat Mar 05, 2022 7:55 amI can't set all manually at the start of the game either
Also weird .. i initially thought because you named your AudioMixer component "AudioMixer" that might have caused some problems, but it doesn't seem like AudioMixer is a reserved keyword so i'm not getting any errors even when i use that name.

No idea what's going on.

K
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: AudioMixer resets when loading the project

Post by Ats »

I'll try to make a strip down example from my game. But apart from using SunVox library, I'm not doing much with the sound.
This time around, everything was kept when I opened the project. But the problem happened to me four times already in the past few days, that's why I noted it. I'll see if I can find what is breaking the thing.

I tried renaming the AudioMixer to something else already, but still got the AccessViolation Error...

Edit:

Ok, preview works, but F9 gives the AccessViolation error only with that:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
  <OnLoaded>
    <ZExpression Expression="test.Ch2Active = 1;"/>
  </OnLoaded>
  <Content>
    <AudioMixer Name="test" Ch0Active="1" Ch0Volume="0.5" Ch0DelayLength="0.1" Ch1Active="1" Ch1Volume="0.5" Ch1DelayLength="0.1" Ch2Active="1"/>
  </Content>
</ZApplication>

Edit 2:

Here's the repro:
  • Add an AudioMixer
  • Deactivate Ch0Active (or change Ch0Volume)
  • Save the project
  • Reload the project
Result: AudioMixer is back to factory reset


And I'm still searching why Ch2Active and Ch3Active are deactivating from time to time...
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: AudioMixer resets when loading the project

Post by VilleK »

AudioMixer is treated specially in the engine so there is a possibility something got wrong in the transition to 64-bit. I'll investigate.
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: AudioMixer resets when loading the project

Post by Ats »

I'VE FOUND IT!!!
  • Add an AudioMixer
  • Activate Ch2Active
  • Edit Project as XML
  • Add a spacebar somewhere so that ZGE thinks the code has been changed and Validate
  • AudioMixer is now factory reset
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: AudioMixer resets when loading the project

Post by VilleK »

So far it seems to be two separate problems:
- Channel 0 and 1 active and volume are set to default values by the designer. This seems to override settings in zgeproj files.
- Assigning audiomixer properties in expressions fails with player.bin that is built with Freepascal in 64-bit build.

I'll continue to check for a solution.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: AudioMixer resets when loading the project

Post by VilleK »

Ats wrote: Sat Mar 05, 2022 7:55 am AudioMixer.Ch2Active = 1;
AudioMixer.Ch2Volume = 0.5;
AudioMixer.Ch3Active = 1;
AudioMixer.Ch3Volume = 0.5;

I get an AccessViolation Error...
I've now fixed the access violation. Please download ZGE again to test.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: AudioMixer resets when loading the project

Post by VilleK »

VilleK wrote: Thu Mar 10, 2022 3:07 pm I've now fixed the access violation. Please download ZGE again to test.
Not sure I actually updated the public build. Please try again now.
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: AudioMixer resets when loading the project

Post by Ats »

Oh yes! Sorry I saw that the other day, and everything was still broken, so I went for another thing and forgot about it. So, now:
  • F9 bug is corrected :wink:
  • Editing XML bug isn't corrected: AudioMixer keeps resetting to factory after editing the XML
  • Saving/Loading project keeps resetting AudioMixer channels 0 and 1
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: AudioMixer resets when loading the project

Post by Ats »

Hello VilleK, just a friendly reminder that those two bugs are still present in ZGE. I forgot about them and was wondering why the sound wasn't working properly all of a sudden...
  • Add an AudioMixer
  • Deactivate Ch0Active (or change Ch0Volume)
  • Save the project
  • Reload the project
RESULT: Ch0Active is reactivated
  • Add an AudioMixer
  • Activate Ch2Active
  • Edit Project as XML
  • Add a spacebar somewhere so that ZGE thinks the code has been changed and Validate
  • AudioMixer is now factory reset
RESULT: Ch2Active is deactivated
Post Reply