0
0

I’m trying to play streaming sounds in non-blocking mode, and have a few issues:

(1) Could I get some clarification on the proper way to poll an event to see if it’s loading or playing? When I call Event::getState, I don’t ever see the EVENT_STATE_LOADING flag set. These are the flags I get while trying to play a non-blocking stream:
1 (READY) – immediately after creating the event instance
9 (READY | PLAYING) – while loading, starting immediately after calling Event::start()
0x18 (PLAYING| CHANNELSACTIVE) – while actually playing, immediately after getting the SOUNDDEF_START callback
Does this sound correct?

(2) I am seeing some blocking behaviour when starting a new stream (in non blocking mode) on the 360. This only happens on a real disc or when using the disc authoring tool with emulated latency enabled. Under 1.04.04 this was worse, but there is still a noticable pause in 1.04.06.

(3) When I try to play a stream that has already been played and stopped (i.e. calling EventGroup::getEventByIndex a second time, not just calling play() on the same actual Event), it doesn’t play, and appears to be stuck in a loading state (i.e. getState always returns 9 – READY|PLAYING). This started happening with version 1.04.06 and appears to be only happening on 360 (I have also tested PC and that seems okay). To clarify, the sequence of events is:
– EventGroup::getEventByIndex
– Event::start
– Event::stop
– EventGroup::getEventByIndex
– Event::start <— never starts playing

  • You must to post comments
0
0

[quote="MattG":v6ap0ujc]I’m trying to play streaming sounds in non-blocking mode, and have a few issues:

(1) Could I get some clarification on the proper way to poll an event to see if it’s loading or playing? When I call Event::getState, I don’t ever see the EVENT_STATE_LOADING flag set. These are the flags I get while trying to play a non-blocking stream:
1 (READY) – immediately after creating the event instance
9 (READY | PLAYING) – while loading, starting immediately after calling Event::start()
0x18 (PLAYING| CHANNELSACTIVE) – while actually playing, immediately after getting the SOUNDDEF_START callback
Does this sound correct?
[/quote:v6ap0ujc]

9 is not while loading, it wouldnt say ‘ready’ if it was still loading. You have to be using the nonblocking flag to get background loading.
channelsactive is when you can hear sounds playing, because technically an event is ‘playing’ until you call Event::stop on it (even though an event has no playing sounds it could trigger some sounds later depending on things like random respawns, sound definition location and parameter value etc).

[quote:v6ap0ujc]
(2) I am seeing some blocking behaviour when starting a new stream (in non blocking mode) on the 360. This only happens on a real disc or when using the disc authoring tool with emulated latency enabled. Under 1.04.04 this was worse, but there is still a noticable pause in 1.04.06.
[/quote:v6ap0ujc]

We’ll check into this i can’t confirm whether or not that is the case right now.

[quote:v6ap0ujc]
(3) When I try to play a stream that has already been played and stopped (i.e. calling EventGroup::getEventByIndex a second time, not just calling play() on the same actual Event), it doesn’t play, and appears to be stuck in a loading state (i.e. getState always returns 9 – READY|PLAYING). This started happening with version 1.04.06 and appears to be only happening on 360 (I have also tested PC and that seems okay). To clarify, the sequence of events is:
– EventGroup::getEventByIndex
– Event::start
– Event::stop
– EventGroup::getEventByIndex
– Event::start <— never starts playing[/quote:v6ap0ujc]
[/quote]
That is probably a bug i just fixed for XMA playback. Please try the new 4.06.08 version in the consoleeval ftp.

  • You must to post comments
0
0

[quote:lyna6mf0]9 is not while loading, it wouldnt say ‘ready’ if it was still loading. You have to be using the nonblocking flag to get background loading.[/quote:lyna6mf0]I am using the nonblocking flag, and this is what I get. Can you think of anything else I am supposed to set to get the proper result? Note that even though the state is 9, I am seeing proper blocking behaviour except on a 360 with disc emulation.

Regarding the blocking problem: I notice that (possibly since updating to 4.04.08) it doesn’t happen on all streams. I am testing this with a single FSB with about 15 music tracks in it. Some tracks play fine in nonblocking mode, others get a small pause.

Regarding the non-restarting streams: I am still getting this on 4.04.08. This happens only on 360, but regardless of whether using XMA.

  • You must to post comments
0
0

Hi Matt, still checking on the nonblocking issues. Having trouble reproducing the non-restarting streams issue – can you reproduce it using the FMOD examples.fev? (after changing it to use "Stream from disk" of course) If not, could you provide a small repro case that we could check out please?

Cheers,

  • You must to post comments
0
0

The non-restarting stream problem is actually an error when I stop the sound for the first time. Event::stop is returning ERR_INVALID_PARAM, and it is happening with the example.fdp.

My fmod calls are kind of buried under layers of code, so I’ve put together a really simple example calling the fmod event system directly and this seems to demonstrate the problem. I am just making it play the "highpass" event from the example project, with a short pause between starting/stopping/restarting it. It works with streaming turned off. With streaming enabled, I get the INVALID_PARAM error when stopping it. The only other change I made in the FDP was to enable XMA to keep the file size down.

[code:6yofti6x]FMOD::EventSystem *pEventSystem = NULL;
FMOD::Event *pEvent = NULL;
void *pMem;

void DebugThingInit()
{
FMOD_RESULT result;

pMem = XPhysicalAlloc(10*1024*1024, MAXULONG_PTR, 4096, PAGE_READWRITE);
assert(pMem);
FMOD_Memory_Initialize(pMem, 10*1024*1024, NULL, NULL, NULL);

EventSystem_Create(&amp;pEventSystem);
assert(pEventSystem); 

pEventSystem-&gt;init(1024, FMOD_INIT_NORMAL, NULL);

result = pEventSystem-&gt;setMediaPath(&quot;game:\\Audio&quot;);
assert(result == FMOD_OK);
result = pEventSystem-&gt;load(&quot;examples.fev&quot;, NULL);
assert(result == FMOD_OK);

}

void DebugThingPlay()
{
FMOD_RESULT result;
printf("*** Play!\n");

FMOD::EventGroup *pGroup;
result = pEventSystem-&gt;getGroupByIndex(0, true, &amp;pGroup);        // EVENTGROUP_EXAMPLES
assert(result == FMOD_OK);

result = pGroup-&gt;getGroupByIndex(0, true, &amp;pGroup);              // EVENTGROUP_FILTERS
assert(result == FMOD_OK);

result = pGroup-&gt;getEventByIndex(0, EVENT_DEFAULT, &amp;pEvent); // EVENT_HIGHPASS
assert(result == FMOD_OK);

result = pEvent-&gt;start();
assert(result == FMOD_OK);

}
void DebugThingStop()
{
FMOD_RESULT result;
printf("*** Stop!\n");
assert(pEvent);
result = pEvent->stop();
assert(result == FMOD_OK);

}

void DebugThingUpdate(float dt)
{
static int frameCount = 0;

pEventSystem-&gt;update();

frameCount++;

if(frameCount == 50) {
    DebugThingPlay();
} else if(frameCount == 200) {
    DebugThingStop();
} else if(frameCount == 250) {
    DebugThingPlay();
}

}[/code:6yofti6x]

Call DebugThingInit() once on startup and DebugThingUpdate() every frame.

Here’s the print output:
[code:6yofti6x]*** Play!
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer01
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : layer00
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : with reverb
FMOD: EventLayer::createDSPNetwork : done
FMOD: EventLayer::createDSPNetwork : without reverb
FMOD: EventLayer::createDSPNetwork : done
FMOD: SystemI::createSoundInternal : filename = game:\Audio\other.fsb : mode 001800ca
FMOD: SystemI::createSoundInternal : exinfo->cbsize = 76
FMOD: SystemI::createSoundInternal : 18 codecs found. Scan all until one succeeds
FMOD: CodecFSB::openInternal : attempting to open as FSB..
FMOD: CodecFSB::openInternal : found FSB3
FMOD: CodecFSB::openInternal : FSB contains 8 sounds
FMOD: CodecXMA::openInternal : opened as wanting to decode to PCM
FMOD: CodecXMA::XMAinit : XMA decoder context created
FMOD: CodecFSB::openInternal : Subsound 0 : drumloop.wav – lengthpcm 42112 lengthbytes 12288 format 2 channels 1.
FMOD: CodecFSB::openInternal : Subsound 1 : – lengthpcm 42112 lengthbytes 12288 format 2 channels 1.
FMOD: CodecFSB::openInternal : Subsound 2 : horse.ogg – lengthpcm 82048 lengthbytes 20480 format 2 channels 1.
FMOD: CodecFSB::openInternal : Subsound 3 : – lengthpcm 82048 lengthbytes 20480 format 2 channels 1.
FMOD: CodecFSB::openInternal : Subsound 4 : jaguar.ogg – lengthpcm 38912 lengthbytes 12288 format 2 channels 1.
FMOD: CodecFSB::openInternal : Subsound 5 : – lengthpcm 38912 lengthbytes 12288 format 2 channels 1.
FMOD: CodecFSB::openInternal : Subsound 6 : seal.ogg – lengthpcm 136704 lengthbytes 32768 format 2 channels 1.
FMOD: CodecFSB::openInternal : Subsound 7 : – lengthpcm 136704 lengthbytes 32768 format 2 channels 1.
FMOD: CodecFSB::openInternal : done.
FMOD: SystemI::createSoundInternal : Format has 8 subsounds.
FMOD: SystemI::createSoundInternal : Create as FMOD_CREATESTREAM
FMOD: System::createSoundInternal : decode buffersize = 17408 : blocksize = 256
FMOD: SystemI::createSample : mode 000000ca length 17408 samples, lengthbytes 12288
FMOD: SystemI::createSample : subsamples = 1, channels = 1
FMOD: SystemI::createSample : subsample 0. output = FBC79210
FMOD: SystemI::createSample : mSoftware = FBC79210
FMOD: OutputSoftware::createSample : lengthpcm 17408, lengthbytes 12288, channels 1, format 2, mode 000000ca
FMOD: OutputSoftware::createSample : done
FMOD: SystemI::createSample : done
FMOD: System::createSoundInternal : 8 subsounds detected. Set up default sentence.
FMOD: System::createSoundInternal : switch file handle from small blocking single buffered to large nonblocking doublebuffered.
FMOD: Thread::initThread : Initializing FMOD file thread. priority 1
FMOD: Thread::initThread : – Stacksize 4096. Stack pointer 00000000 : usesemaphore = 1 : sleeptime = 0
FMOD: Thread::initThread : done.
FMOD: System::createSoundInternal : Seek stream to start
FMOD: CodecFSB::setPositionInternal : subsound 0 position 0 postype 2 : drumloop.wav
FMOD: CodecFSB::setPositionInternal : done
FMOD: System::createSoundInternal : flush stream buffer
FMOD: System::createSoundInternal : flush successful.
FMOD: SystemI::createSoundInternal : done. OpenState now = FMOD_OPENSTATE_READY.

FMOD: EventSound::unload : [drumloop]
FMOD: EventSound::unload : done
FMOD: EventSound::unload : [drumloop]
FMOD: EventSound::unload : done
FMOD: Thread::callback : * FMOD file thread started
FMOD: CodecFSB::setPositionInternal : subsound 0 position 0 postype 2 : drumloop.wav
FMOD: CodecFSB::setPositionInternal : done
FMOD: CodecFSB::setPositionInternal : subsound 0 position 0 postype 2 : drumloop.wav
FMOD: CodecFSB::setPositionInternal : done
*** Stop!
FMOD: EventSound::unload : [drumloop]
Assert:
result == FMOD_OK
[/code:6yofti6x]

  • You must to post comments
0
0

Has this been resolved? This is exactly the same thing I’m getting. I started a NON_BLOCKING event. It appears to be instantly ready if I poll its state. When I try to start() the event, nothing happens, but no errors occur.

  • You must to post comments
0
0

Can you put together a small repro case and email it to us?

  • You must to post comments
0
0

I am seeing similar inconsistencies as in issue (3) as well.

  • The sound is a streaming music which is started and stopped repeatedly.
  • The problem is difficult to reproduce, happening about 1 in 20 times.
  • Our platform is the Wii, (pc appears to be fine)
  • Event state is READY|PLAYING, but there is no sound, no channels active, and the sounddef callback is never hit.
  • No other indication of an error, either on loading the event group (blocking), getting the event instance.
  • We now have 2 cases of this happening, and in one case, start() returns no error, and in another case, start() returns FMOD_ERR_INVALID_HANDLE (but this is not an info-only event!)

Are there any other state queries that we can get a clue as to what is going on?

  • You must to post comments
0
0

What version are you using? Can you send us a repro?

  • You must to post comments
0
0

Was this resolved? I think I may have a similar issue (just converted our code to run non-blocking on one of the platforms).

I’m doing event->setpause(), event->start(), check the state, and add to a list if still loading, else unpause.

In that list I itterate through to see if any are now loaded, and then set to unpause. This works for some streams, but not all.

  • You must to post comments
0
0

kevins’ issue was resolved. It was a Wii specific bug that was fixed in 4.21.05 / 4.20.05 / 4.18.14 / 4.16.24.

  • You must to post comments
Showing 10 results
Your Answer

Please first to submit.