0
0

Hi – I’m experiencing some strange behaviour with loadEventData() and I’m not getting any errors returned from any FMOD calls, so I’m kind of at a loss as to how to go about debugging this problem.

Quick background: this code is in an app that has embedded Python, hence the CPython API call.

Here’s the basic code:

[code:3fbrtn37]
FMOD::EventProject *pProject = defaultProject_;
FMOD::EventGroup *pGroup;
FMOD::Event *pEvent1, *pEvent2;
FMOD_RESULT result;

define ERR_CHECK( result ) \

if (result != FMOD_OK) \
{ \
    PyErr_Format( PyExc_RuntimeError, FMOD_ErrorString( result ) ); \
    return NULL; \
}

result = pProject->getEvent( "guns/fire", EVENT_DEFAULT, &pEvent1 );
ERR_CHECK( result );

result = pEvent1->start();
ERR_CHECK( result );

result = pProject->getGroup( "atmos", true, &pGroup );
ERR_CHECK( result );

result = pGroup->loadEventData(
    FMOD::EVENT_RESOURCE_STREAMS_AND_SAMPLES, EVENT_DEFAULT );
ERR_CHECK( result );

result = pGroup->getEvent( "cold_wind", EVENT_DEFAULT, &pEvent2 );
ERR_CHECK( result );

result = pEvent2->start();
ERR_CHECK( result );

[/code:3fbrtn37]

This will run to completion with no errors reported, but the wave data does not appear to ever be loaded (there is no ‘hang’ when loadEventData() is called) and the "cold_wind" sound does not actually play (despite pEvent2->start() returning FMOD_OK).

I can get both the gunshot and cold_wind sounds to play by commenting out the call to loadEventData(). I can also get the call to loadEventData() to work and have the cold_wind sound play if I comment out the call the two calls related to the gunshot sound:

[code:3fbrtn37]
// result = pProject->getEvent( "guns/fire", EVENT_DEFAULT, &pEvent1 );
// ERR_CHECK( result );

// result = pEvent1->start();
// ERR_CHECK( result );

result = pProject->getGroup( "atmos", true, &pGroup );
ERR_CHECK( result );

result = pGroup->loadEventData(
    FMOD::EVENT_RESOURCE_STREAMS_AND_SAMPLES, EVENT_DEFAULT );
ERR_CHECK( result );

result = pGroup->getEvent( "cold_wind", EVENT_DEFAULT, &pEvent2 );
ERR_CHECK( result );

result = pEvent2->start();
ERR_CHECK( result );

[/code:3fbrtn37]

I’ve got no idea why FMOD is behaving like this, and I can’t get any error codes to give me a hint. Any suggestions as to why this isn’t working as expected would be really appreciated.

Cheers,
Glen

EDIT:

Checking the event state with pEvent2->getState() just prior to pEvent2->start() indicates that the event is EVENT_STATE_READY (0x1).

Checking the event state just after calling start() gives back 0xB, which means EVENT_STATE_READY | EVENT_STATE_LOADING | EVENT_STATE_PLAYING … which is pretty strange. How can it be loading and playing at the same time?

EDITx2:

Here’s complete source for a standalone Linux program that will exhibit the described behaviour. The actual game runs on Windows and also exhibits this behaviour.

[code:3fbrtn37]

include <stdio.h>

include <unistd.h>

include <fmodex/fmod_event.h>

include <fmodex/fmod_errors.h>

int main()
{
FMOD::EventSystem *pSystem;
FMOD::EventProject *pProject;
FMOD::EventGroup *pGroup;
FMOD::Event *pEvent1, *pEvent2;
FMOD_RESULT result;
EVENT_STATE state;

define ERR_CHECK( result ) \

if (result != FMOD_OK)                                              \
{                                                                  \
    printf( FMOD_ErrorString( result ) );                           \
    return 1;                                                       \
}

result = FMOD::EventSystem_Create( &amp;pSystem );
ERR_CHECK( result );

result = pSystem-&gt;init( 32, 0, 0, 0 );
ERR_CHECK( result );

result = pSystem-&gt;setMediaPath( &quot;/home/glenc/mf/fantasydemo/res/audio&quot; );
ERR_CHECK( result );

result = pSystem-&gt;load( &quot;fd_sound.fev&quot;, NULL, &amp;pProject );
ERR_CHECK( result );

result = pSystem-&gt;update();
ERR_CHECK( result );

result = pProject-&gt;getEvent( &quot;guns/fire&quot;, EVENT_DEFAULT, &amp;pEvent1 );
ERR_CHECK( result );

result = pEvent1-&gt;start();
ERR_CHECK( result );

result = pProject-&gt;getGroup( &quot;atmos&quot;, true, &amp;pGroup );
ERR_CHECK( result );

result = pGroup-&gt;loadEventData(
    FMOD::EVENT_RESOURCE_SAMPLES, EVENT_DEFAULT );
ERR_CHECK( result );

result = pGroup-&gt;getEvent( &quot;cold_wind&quot;, EVENT_DEFAULT, &amp;pEvent2 );
ERR_CHECK( result );

result = pEvent2-&gt;getState( &amp;state );
ERR_CHECK( result );

printf( &quot;Event in state %x\n&quot;, state );

result = pEvent2-&gt;start();
ERR_CHECK( result );

result = pEvent2-&gt;getState( &amp;state );
ERR_CHECK( result );

printf( &quot;Event in state %x\n&quot;, state );

for (int i=0; i &lt; 500; i++)
{
    result = pSystem-&gt;update();
    ERR_CHECK( result );
    usleep( 1000 );
}

return 0;

}
[/code:3fbrtn37]

  • You must to post comments
0
0

Also – is this the appropriate place for this type of query/problem, or should I be emailing this stuff to support@fmod.org instead?

  • You must to post comments
0
0

You might want to send through the fev and fsb files you are using to support@fmod.org or upload them to http://ftp.fmod.org l:upload p:upload and we can have a look at why your project is failing.

I’m assuming you’ve tested this on v51?

  • You must to post comments
0
0

Hi Brett,

I’ve uploaded the files to the FTP site as ‘glenc.tar.gz’. The archive contains the fdp, fev, and fsb files, as well as the source and makefile for a Linux program that demonstrates the problem. Please see the comments in the source file for the details of the problem and how to reproduce the different behaviours I’ve described.

I’ve tested this with the latest (v51) on Linux, I think I’ve only tested it with the previous version (v47) on Windows, but the behaviour has always been identical between Windows and Linux with respect to this particular problem.

Cheers,
Glen

  • You must to post comments
0
0

Thanks Glen, this has been fixed for our next release.

  • You must to post comments
0
0

Great! So I didn’t do something wrong … :)

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.