Jump to content

New Sound Manager svn patch


Recommended Posts

Applied without troubles, updated workspaces, compiled nicely and without issues on my mac with Xcode 4.4.

The game has sounds, left/right panning seems to work, haven't checked other stuffs. The music works, fade-outs seem to work. I tried the combat demo "huge" and it didn't send a thousand death cries at me (though the battle felt a bit empty. I't be good to have some "battle-ish" ambient sound if many units are fighting on screen.)

No errors whatsoever. 10/10 would patch again.

Link to comment
Share on other sites

Stwf, is there something in particular I should test? I don't feel like trying hundreds of stuffs in a few hours right now. Furthermore, I have no idea of the things that "could" crash.

Edit: Just did a little 20 minutes long game on Oasis where I was defeated (well, sort of. Anyway I suck at this game.) Still no errors of any kind.

Link to comment
Share on other sites

I guess the issue I worry most about is underpowered machines and if the new sound code was causing a lag that wasn't there previously. I used a more object oriented approach thn the old code and that does come with some slight performance trade offs. Otherwise I am pretty sure it isn't leaking memory, which could always be a concern, and the code for running under low memory hasn't been very well tested. Overall I'm glad to see the code working!

Link to comment
Share on other sites

I've run it through Xcode's instrument - Leaks. It detected a few leaks of "malloc 16 bytes" from CSoundBase::ResetVars() (what I did was start a game on Acropolis 1, move a few units, click a few stuffs, resign, exit). It's worth what it's worth but you may forget to delete some objects in that function.

Running with the profiler seemed to show it was not particularly CPU expensive, but my computer is not slow enough for that to matter anyway.

Now running the static analyzer, I dunno what's going to come out of that.

Edit: nothing, actually. So that's all I can tell you from using the latest technology has brought us.

Link to comment
Share on other sites

I got some errors today, I believe sending some citizen-soldiers to mine triggered the segmentation fault. I forgot to save the info from the Apple application error window. If it happens again I'll save that and post it here.

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_12.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_13.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_14.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_15.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_16.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_17.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_18.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_19.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_20.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_21.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_22.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_23.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_24.ogg, error=No error reported here

- Error creating initial buffer !!

ERROR: error loading sound: pathname=audio/resource/mining/mine_stone_25.ogg, error=No error reported here

Segmentation fault

Overall the patch works fine (which is great, to have sounds on OS X :) ), except that it appears music starts playing at full volume and then fades out to a sustained lower volume. I would expect the music to fade in from 0% volume? This happens at the start of the game, and basically every time the track changes (for example upon start of a game). The automatic switching of tracks (during a game) once took a long time, with no music playing for a couple of seconds.

Edited by dvangennip
Link to comment
Share on other sites

Applied the patch, minor issues:

* main.cpp: lib/res/sound/snd_mgr.h file is not found, this shouldn't be included

* JSoundPlayer.cpp: warning that cx is an unused parameter, it's never referenced in the JS_SET_RVAL macro (should be safe to wrap it with UNUSED())

I'm stuck on an old cruddy laptop so I'll do some more testing.

This is a trivilality, but is this intended:

Seems like an OS X specific option?

Those must be leftovers from using sed on that makefile. This is why I would rather we used a separate gmake.osx rather than trying to use one makefile for every *nix :unsure: It definitely shouldn't be included in the patch.

Link to comment
Share on other sites

Tested more on the laptop, here's the system info: system_info.txt

Music bugs:

  • I also notice the music starting loud, then tapering off a few times to normal volume. Did something change in the implementation since the last patch I tested (patch12.diff)?
  • Often the music stops abruptly in the middle of a track. This appears to occur when the game window stops responding temporarily. There are no errors in the log so it's a silent failure somewhere. Let me know if there's any debugging data I can provide as this might not be easily reproducible on newer systems:
    • One way I was able to reproduce it was clearing the cache and then going to the match setup menu and while the map data was loading, the music stopped (this is a very slow process on my system). I don't know what happens technically but the music doesn't continue. In one test it occurred about 30 seconds into the main theme. Music did start with a new match.
    • I've found it also occurs in-game so it's not specific to the main menu. Once the game window was minimized and the music stopped abruptly.
    • I can force music to start over by toggling Menu > Settings > Enable Music so the sound system is still working in that sense. We need to find out why it stops.

    [*]I just noticed the ambient sounds seem to be gone too, so it must be more than music that breaks.

    [*]The music is choppy and stutters, of course if you look at the system specs it's a low-end system, but maybe we can find a way to reduce the choppiness.

Music comments/suggestions:

  • What should we do when the game is minimized/unfocused or paused? Currently when the game is paused regardless of being minimized, I hear ambient sounds and music. I would say when minimized and paused, either we should taper off all sound or only play music. The ambient sounds get quickly annoying in the background.
  • Is music intended to loop immediately? I thought there would be periods of silence and it seems like we shouldn't loop the same track over and over, it takes away from the impact of the music. It's OK to have silence and hear the other sounds of the game :)
    • The main menu theme in particular is one that should play only once per game IMO.
    • I like AoK's use of soft ambient sounds in the background after the main theme ends, maybe we could do something like that: sounds of riders, preparations for battle, or town noises - construction, gathering, etc.

Unit voice response:

  • Seems to work much better now, I even hear off screen units responding and camera seems to have no impact (y)
  • One thing that annoys me: when double clicking units, I hear a voice response for each click. It creates a repetitive sound for double and triple clicks. I think the better behavior would be to either not interrupt the sound from the first click or wait to play a response until the UI determines if it's a single or double click (but that seems trickier and prone to error).

Link to comment
Share on other sites

Music bugs:

  • I also notice the music starting loud, then tapering off a few times to normal volume. Did something change in the implementation since the last patch I tested (patch12.diff)?
  • Often the music stops abruptly in the middle of a track. This appears to occur when the game window stops responding temporarily. There are no errors in the log so it's a silent failure somewhere. Let me know if there's any debugging data I can provide as this might not be easily reproducible on newer systems:
    • One way I was able to reproduce it was clearing the cache and then going to the match setup menu and while the map data was loading, the music stopped (this is a very slow process on my system). I don't know what happens technically but the music doesn't continue. In one test it occurred about 30 seconds into the main theme. Music did start with a new match.
    • I've found it also occurs in-game so it's not specific to the main menu. Once the game window was minimized and the music stopped abruptly.
    • I can force music to start over by toggling Menu > Settings > Enable Music so the sound system is still working in that sense. We need to find out why it stops.

    [*]I just noticed the ambient sounds seem to be gone too, so it must be more than music that breaks.

    [*]The music is choppy and stutters, of course if you look at the system specs it's a low-end system, but maybe we can find a way to reduce the choppiness.

I see the music volume problem, I'll get that fixed and in a patch soon. Also with the compilation warnings, its tough on the mac because of all of the warnings Boost generates...

Thanks for the testing...

As for the stopping, that happens when there is too much time between calls to the idle function. Once this happens the music would need to be restarted. I can check each time through, and if the music isn't playing when it should be, restart it. But it would be best if it didn't happen.

I added the buffer size as an item inside the default.cfg file. sound.bufferSize = 65536. I think making that larger will allow for longer times to go by without the idle proc being called. So could you change that on your system and let me know if it helps?

Right now I'm not running any extra threads for this. I think it could be done in an outside thread if necessary OpenAL is pretty much thread safe although of course thats really up to each implementation.

Music comments/suggestions:

  • What should we do when the game is minimized/unfocused or paused? Currently when the game is paused regardless of being minimized, I hear ambient sounds and music. I would say when minimized and paused, either we should taper off all sound or only play music. The ambient sounds get quickly annoying in the background.
  • Is music intended to loop immediately? I thought there would be periods of silence and it seems like we shouldn't loop the same track over and over, it takes away from the impact of the music. It's OK to have silence and hear the other sounds of the game :)
    • The main menu theme in particular is one that should play only once per game IMO.
    • I like AoK's use of soft ambient sounds in the background after the main theme ends, maybe we could do something like that: sounds of riders, preparations for battle, or town noises - construction, gathering, etc.

Unit voice response:

  • Seems to work much better now, I even hear off screen units responding and camera seems to have no impact (y)
  • One thing that annoys me: when double clicking units, I hear a voice response for each click. It creates a repetitive sound for double and triple clicks. I think the better behavior would be to either not interrupt the sound from the first click or wait to play a response until the UI determines if it's a single or double click (but that seems trickier and prone to error).

All of the other suggestions won't be a problem to implement, we just need to determine exactly what should happen. Yes, its supposed to just repeat and repeat (in my mind). So that can be made to not happen of course...

I think what you mean about the double clicking is a javascript issue, right? I could monitor if a given source was playing a certain sound, etc. But the best solution would be to just do what the javascript engine tells me...

Link to comment
Share on other sites

ok!

Here is a new patch. It fixes the compiler warnings as well as the segfault (probably) although I'm not entirely sure why that happened. Maybe a missing resource. I added a log message when that happens to help track it down.

Also the loud music start is gone, oops. The previously mentioned issue with the build files being mac only, is that something I need? I don't remember adding it, is it safe to take it out?

RealPatch2.diff

Edited by stwf
Link to comment
Share on other sites

Okay, compiled and launched successfully, the music doesn't display the loud intro behavior anymore.

I noticed however I couldn't hear the acknowledgment taunts from units I ordered when they were a bit offscreen (not outright offscreen, but after a small margin), is this wanted behavior?

The main menu music seems to end a bit abruptly when switching from the "starting a game" screen to the actual game (it doesn't do it when resigning, on the other hand).

Link to comment
Share on other sites

For macusers who can't compile, you may try this (it probably won't work unless you followed the first few steps of this(install the dependencies), though.

Download the SVN repository, and replace the "binaries/system" folder by this.

Then, download stwf's patch above, put it in the main 0 A.D. folder (where the binaries, build, source folders are). Open it, go to line 177 ( should be "Index: build/premake/premake4/build/gmake.unix/Premake4.make"), and erase the rest of the file, including this line (so you have a 176 line long diff).

Then, launch the terminal, type "cd " (without the quotation marks) and drag your main 0 A.D. folder to the terminal window (the one in which you find the Binaries, build, source and libraries folder). The terminal should now read something like "cd somPath/yourTrunkFolder/". Press enter.

Now run "patch -p0 -i RealPatch2.diff". It should show a bunch of lines, and then try running the pyrogenesis executable in binaries/system.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...