0
0

I’m currently working on a game on PC, Xbox 360 and PS3 with a commentary system that loads from an FSB using createSound and preloadFSB.

I’ve inherited this system towards the end of the project and it’s having problems on Xbox in particular when streaming from a DVD. When I call playSound it takes anywhere from 0.2 up to 2 seconds to execute, so it seems to be blocking even though I am using the FMOD_CREATESTREAM | FMOD_NONBLOCKING flags in the createSound call. What else could be causing it to block? I’m finding that some of the callbacks passed to setFileSystem are running in the same thread as the playSound call could this be affecting it?

I changed the createSound call to create stream and it seems to have improved, maybe. I have also fiddled with the buffer size, 128k seems to be the sweet spot but still with all of this it’s blocking for up to 0.7 seconds.

It is not happening on the other platforms is there any reason anyone could think of that it would be blocking?

  • You must to post comments
0
0

Hi,
There are 2 things to consider. One is that you may have played a subsound, then called playsound on it, without having called getSubSound on it first. This would make the playsound trigger a blocking flush.
Try getSubSound first, then wait for the openstate to be ready, then call playsound.

Next, 4.27.06 now has an improved flushing mechanism when a setposition call is used, or virtual voices. Streams in older versions could be stalled if other streams were playing at the same time. Now they are independant. I dont know if you can try this version or not.

  • You must to post comments
0
0

In regards to this problem, the way the Commentary works is:
There is one FSB about 400Mb big that is preloaded with the flags FMOD_DEFAULT | FMOD_CREATESTREAM | FMOD_NONBLOCKING into a Sound Object.
When we want to play a line of commentary, we call setSubSoundSentence on the Sound object.
After this we call playSound passing in this Sound object.
The first line of commentary in the game works fine, I can see that its state is FMOD_OPENSTATE_SETPOSITION then FMOD_OPENSTATE_STREAMING and there is no blocking. However, the next time we try to play a commentary line using the same logic, it blocks on the playSound and goes straight to FMOD_OPENSTATE_STREAMING once the line has loaded (No FMOD_OPENSTATE_SETPOSITION are displayed in the debugger). I have updated the libs and headers to 4.27.06 (Not the designer but or other FSBs) but that doesn’t make any difference.
Again, this is only happening off DVD on the Xbox 360.
Any ideas?

  • You must to post comments
0
0

[code:29n5cdyy]if( m_numberOfSoundsQueued > 0 )
{

ERRCHECK( m_commentaryFSB->setSubSoundSentence( m_commentaryQueue, m_numberOfSoundsQueued ) );

ERRCHECK( m_sysObject->playSound(  FMOD_CHANNEL_FREE, m_commentaryFSB, false, &m_commentaryChannel ) );

m_commentaryChannel->setVolume(m_commentaryVolume);

m_numberOfSoundsQueued = 0;

}[/code:29n5cdyy]

This is how we play the lines of commentary. Can you see an issue with the way we play them?

  • You must to post comments
0
0

Hello,

I may be incorrect here, but I think when you create a stream, it may seek to the end of the file in order to get some meta. Depending on the sound file format (i.e. if it is OGG), it will do this to get some additional codec data. Perhaps that is causing part of the wait. You can add the flag: FMOD_IGNORETAGS to ignore the meta, but I don’t believe there is any recourse if you are using OGG files.

Hope that helps!

  • George
  • You must to post comments
0
0

Thanks for the reply George.
I create one stream when the class is created, and this dose take some time (about 1 second). After that, I don’t create any more streams, I just let setSubSoundSentence do all the work (setSubSoundSentence is called on the stream I created, m_commentaryFSB).

What I think is going on is that the sentence is being stitched together when I call playSound which is doing a blocking flush/seek. That is causing the game to pause while it dose the work in the background.

  • You must to post comments
0
0

Anybody have any ideas why this code doesn’t work on properly the Xbox 360 but works fine on PS3 and Win32?

  • You must to post comments
0
0

It should be the same on all platforms. The setSubSoundSentence isnt triggering a nonblocking command though, to flush the stream, so this is an issue on our side, i’ve fixed it now, will do some testing to see if it can go in the next release.

  • You must to post comments
0
0

[quote="DanielGuy":35gqk4wf][code:35gqk4wf]if( m_numberOfSoundsQueued > 0 )
{

ERRCHECK( m_commentaryFSB->setSubSoundSentence( m_commentaryQueue, m_numberOfSoundsQueued ) );

ERRCHECK( m_sysObject->playSound(  FMOD_CHANNEL_FREE, m_commentaryFSB, false, &m_commentaryChannel ) );

m_commentaryChannel->setVolume(m_commentaryVolume);

m_numberOfSoundsQueued = 0;

}[/code:35gqk4wf]

This is how we play the lines of commentary. Can you see an issue with the way we play them?[/quote:35gqk4wf]

I am also trying to get my commentary system working with the NONBLOCKING flag.

My createStream call happens during the initial game load (I currently poll getOpenState to wait for it to load), and then during gameplay when I want to play a sentence I use code similar to that posted above.

But my playSound call returns FMOD_ERR_NOTREADY and the channel pointer remains untouched (i.e. NULL).

Is this expected behaviour? The code above seems to suggest otherwise, e.g. the channel is assigned and ready to use.

If I want a stream to play (non-blocking), and set volumes or unpause almost immediately, do I need to wait for the stream to have asynchronously buffered up following the playSound call before I can set channel properties? Or am I doing something wrong somewhere??

Thanks

  • You must to post comments
0
0

Hey, in the end there was an issue with the:

[code:dxpxax8d]m_commentaryFSB->setSubSoundSentence[/code:dxpxax8d] call. The code looks more like this now:

[code:dxpxax8d]
if( m_numberOfSoundsQueued > 0 || m_waitingForSeek )
{
if( !m_waitingForSeek )
{
ERRCHECK( m_commentaryFSB->setSubSoundSentence( m_commentaryQueue, m_numberOfSoundsQueued ) );
m_waitingForSeek = true;
}

    if( m_waitingForSeek )
    {
        ERRCHECK( m_commentaryFSB->getOpenState( &stateCommentary, &bufferPersentCommentary, &starvingCommentary ) );
        if( stateCommentary == FMOD_OPENSTATE_READY )
        {
            ERRCHECK( m_sysObject->playSound(  FMOD_CHANNEL_FREE, m_commentaryFSB, false, &m_commentaryChannel ) );


            m_commentaryChannel->setVolume(m_commentaryVolume);
            m_waitingForSeek = false;
        }
    }
  }

[/code:dxpxax8d]

The difference being that once the setSubSoundSentence function is called, you have to wait until the open state is set to FMOD_OPENSTATE_READY before calling play.

Note that you may need to update to a version of fmod after 4.28 I think.

Hope this helps

  • You must to post comments
0
0

Yes that does help, thanks very much. :)

  • You must to post comments
Showing 10 results
Your Answer

Please first to submit.