Jump to content

New Sound Manager svn patch


Recommended Posts

OK, I will play around with that. I agree that if the action doesn't pause the music shouldn't. I will also smooth out the abrupt cut offs.

I can look into what kind of options we have here, as you said I'm not sure we can tell if we are minimized or not. SI this something the Design Committee might get involved in?

This originally sprang out of http://trac.wildfiregames.com/ticket/1712 . But for some reason this bug still persists. It seems like the Atlas engine doesn't stop or pause through the same mechanism that the regular game does... But it does seem to start the music normally, odd

My one option is to just make Atlas aware of the sound manager and pause the music when the simulation is paused. But that doesn't seem right. Any ideas in how I can best capture Atlas starts and stops?

Link to comment
Share on other sites

In Atlas, there are basically two states:

* "Reset" where the game UI is hidden, the game is essentially paused but not in the same way as a normal game, it's like the map was just loaded and initialized, so it needs a special case to deal with that. This is Atlas' default state, no sound should play.

* "Simulation test" where the session UI is shown and the game may be run at some arbitrary speed (0.0 = paused, but as you've seen it's not handled through global variables like a normal game).

So the point with Atlas sound is not to pause or mute it at all, but to reset it to nothing in the "Reset" mode. When it's in "simulation test" mode, it doesn't really matter what happens with sound IMO, since that's a much less common case, but we could also special case pause to mute the sound. Atlas doesn't minimize or pause automatically, so it's not necessary to handle that.

If you can provide some API for sound manager to reset sound to default state with nothing playing (all buffers cleared), I or someone else can write some AtlasUI / GameInterface code to use it. Unless you really want to delve into AtlasUI, it's not too bad once you get used to it, but you do have to realize it's running in a separate thread from the game engine and thus custom message passing is used to control and query the engine.

Link to comment
Share on other sites

Keep in mind that there's a config option "pauseonfocusloss" that can be changed, so the game doesn't necessarily pause when it loses focus. Do you play in windowed mode? Try it, and switch from the game quickly to say, a chat window, and back, and listen to what happens :)

Sometimes there's a tendency to add an option for everything, but maybe time for muteonfocusloss or muteonpause in the config?

I just put in a fade in and out when the app switches focus. It also honors the pauseonfocusloss flag. Otherwise I left the behavior as is. It turns out I can differentiate between being minimized and losing focus. So what ever the consensus for the behavior is I will implement. I don't think that having a set of preferences for background behavior is overdoing it.

If you can provide some API for sound manager to reset sound to default state with nothing playing (all buffers cleared), I or someone else can write some AtlasUI / GameInterface code to use it. Unless you really want to delve into AtlasUI, it's not too bad once you get used to it, but you do have to realize it's running in a separate thread from the game engine and thus custom message passing is used to control and query the engine.

You can turn the sound off using the static function CSoundManager::SetEnabled(false). You can turn it back on by passing true to that function. That completely closes it down and then reinitializes it.

This snippet will pause and unpause it, I could put this into a static function if you like.

if ( g_SoundManager )

g_SoundManager->Pause(g_Game->m_Paused);

At some point I would like to get into the Atlas stuff but it seems like there is plenty to do game wise for the time being ;-)... I did wonder why the actor editor didn't play the units sounds. But otherwise I haven't spent much time in Atlas at all. If you could put this in at some point I'd appreciate it.

Link to comment
Share on other sites

Just a reminder that one of the MSVC warnings still exists :P


1> CBufferItem.cpp
1>e:\devel\ps\source\soundmanager\items\cbufferitem.cpp(88): warning C4702: unreachable code

Any idea how to fix this? I guess its missing the fact that the variable is being passed in by address and can be changed? I tried declaring it volatile, but that conflicts with how OpenAL defines the function...

Link to comment
Share on other sites

  • 2 weeks later...

Sound effects cut out after a few minutes. Then the music cuts out a few minutes later.

I can reproduce this on Windows. quantumstate was unable to on Linux, so I assume it's a platform thing.

I'm not using the autobuild though, so it could be an issue with my build, I guess.

Link to comment
Share on other sites

Sound effects cut out after a few minutes. Then the music cuts out a few minutes later.

ugh

I don't get that on Mac either, obviously or I wouldn't have released the code. oh well I'll try to figure out what is going on. Any good details? In windowed mode or pausing the action somehow else? Sound effects cutting out is strange.

Link to comment
Share on other sites

ugh

I don't get that on Mac either, obviously or I wouldn't have released the code. oh well I'll try to figure out what is going on. Any good details? In windowed mode or pausing the action somehow else? Sound effects cutting out is strange.

I can hear the birds chirping. That's the only sound I can hear. Happens in all different cases.
Link to comment
Share on other sites

It appears that if you start a game, and then return to main menu, any more games will play the music from the first one, regardless of civilization.

OK, this actually seems to be a javascript error. The variable this.tracks.PEACE keeps getting each civs music added tothe list.

I can clear this up with a call to

tracks.PEACE = [];

at line 120 of music.js. But I don't know the javascript code very well. Does this seem like the best place to do this? This only works for peace tracks which seems to be all that there is in the civ json files at this moment...

Link to comment
Share on other sites

  • 1 month later...

I think training and building complete sounds should be omnipresent. This, after watching some Age of Kings gameplay videos and also when playing 0 A.D. being confused when I couldn't hear these sounds when off-camera.

I think that can be fixed by editing the appropriate XML file and turning on eOmnipresent if you want it to play at the listener location, or turning on eDistanceless and it is played at a location, but at full volume.

Link to comment
Share on other sites

I think that can be fixed by editing the appropriate XML file and turning on eOmnipresent if you want it to play at the listener location, or turning on eDistanceless and it is played at a location, but at full volume.

Here is the code for the Barracks completion sound:


<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<SoundGroup>
<Gain>1</Gain>
<Pitch>1</Pitch>
<Priority>30</Priority>
<ConeGain>1</ConeGain>
<ConeInner>360</ConeInner>
<ConeOuter>360</ConeOuter>
<Looping>0</Looping>
<RandOrder>1</RandOrder>
<RandGain>1</RandGain>
<GainUpper>1</GainUpper>
<GainLower>0.8</GainLower>
<RandPitch>1</RandPitch>
<PitchUpper>1.1</PitchUpper>
<PitchLower>0.9</PitchLower>
<Threshold>1</Threshold>
<Decay>3</Decay>
<Replacement>complete_barracks.ogg</Replacement>
<Path>audio/interface/complete/building</Path>
<Sound>complete_barracks.ogg</Sound>
</SoundGroup>

What do I need to add so that the player can always hear this, whether it is on-screen or not? :) <eOmnipresent>yes</eOmnipresent> or something like this?

Link to comment
Share on other sites

I'm now getting these kind of warnings with the latest revision:


WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_what_is_it_2.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_repair_1.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_repair_2.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_repair_1.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_house.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_house.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_house.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_civ_center.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_house.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_civ_center.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_house.ogg
TIMER| LoadDLL: 46.7448 ms
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_civ_center.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_what_is_it_3.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_gather_together_1.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_dock.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_dock.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_civ_center.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_dock.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/alarm/alarm_warship_03.ogg

Something wrong?

Link to comment
Share on other sites

I'm now getting these kind of warnings with the latest revision:


WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_what_is_it_2.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_repair_1.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_repair_2.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_repair_1.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_house.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_house.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_house.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_civ_center.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_house.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_civ_center.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_house.ogg
TIMER| LoadDLL: 46.7448 ms
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_civ_center.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_what_is_it_3.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/voice/hellenes/civ/female/civ_female_gather_together_1.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/complete/building/complete_dock.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_dock.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_civ_center.ogg
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/select/building/sel_dock.ogg
Using Xcursor to sys_cursor_create 32 x 32 cursor
WARNING: OpenAL: stereo sounds can't be positioned: audio/interface/alarm/alarm_warship_03.ogg

Something wrong?

Thanks for reporting. That message has been added for debugging purposes, because stereo sounds won't respect entity position, most of them will be fixed by r13450, but not all. There will be a few more fixes before it's all sorted out.

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...