0
0

Hello,

I’m newbie in FMod world, and I don’t understand why my code doesn’t trigger Sound Designer’s keyoff.

[u:8iawxjhx]Working env [/u:8iawxjhx]
[list:8iawxjhx]iOS
Xcode[/list:u:8iawxjhx]
[u:8iawxjhx]Verified [/u:8iawxjhx]:
[list:8iawxjhx].fev and event’s keyoff tested with fmod_eventPlayer
all FOD_RESULT are OK[/list:u:8iawxjhx]

Here the code processed chronologically

[code:8iawxjhx]
-(void) initFmod
{
...
//init
result = _eventSystem->init(32, FMOD_INIT_NORMAL | FMOD_INIT_ENABLE_PROFILE, NULL, FMOD_EVENT_INIT_NORMAL);
...

//load music bank settings
result        = FMOD_OK;
[[NSString stringWithFormat:@"%@/_music.fev", [[NSBundle mainBundle] resourcePath]] getCString:buffer maxLength:200 encoding:NSASCIIStringEncoding];
result = _eventSystem->load(buffer, NULL, NULL);

...
}

-(void) onMusicGameStart
{

///////////// LOAD Game Music ////////////
//Build Event name
FMOD_RESULT result = FMOD_OK;
NSString *musicGameEvent = @"music/music/music_sample_with_keyOff";
const char *eventGame = [musicGameEvent UTF8String];

//Get event from Fmod
result = _eventSystem->getEvent(eventGame, FMOD_EVENT_DEFAULT, &_musicGame);

result =  _musicGame->start();

...
}

-(void) stopMusic
{
//Stop current Music
[self triggerEventKeyoff:_musicGame];
}

-(void) triggerEventKeyoff:(FMOD::Event*)event
{
if(event)
{
FMOD_RESULT result = FMOD_OK;
//Get Event’s Parameter
FMOD::EventParameter *param;
result = event->getParameterByIndex(0, &param);
//Check error message
[self checkResult:result even:nil];

    //trigger KeyOff
    if(result == FMOD_OK)
    {
        result = param->keyOff();
        //Check error message
        [self checkResult:result even:nil];
    }
}

}

[/code:8iawxjhx]

The music associated to _musicGame doesn’t play its KeyOff and just continue playing.
[i:8iawxjhx]_musicGame[/i:8iawxjhx] is only set in [i:8iawxjhx]onMusicGameStart()[/i:8iawxjhx].

I don’t know what to test from this point.

By the way, I’m not able to launch fmod_profiler (crash at launch).

Thanks for your replies.

  • You must to post comments
0
0

In the fmoddesignerapi directory there are examples which use the event system, for iPhone all examples use a mix of Objective-C and C++.
To get a Designer project with all the examples check the FMOD Designer download package.

  • You must to post comments
0
0

Hello Matthew,

Thx for fmod_profiler fix.

About "keyOff" example, I was unable to find example in fmod doc "FMOD Programmers API".

Do you have any references about a working example in Objective-C ?

Florent

  • You must to post comments
0
0

There is a bug with the current fmod_profiler, it’s simple to fix though:

  1. Open the terminal and navigate to the location of fmod_profiler.app
  2. Navigate into fmod_profiler.app/Contents/MacOS
  3. Type: "chmod u+x fmod_profiler

Now you can run the app properly from the finder. The issue was our build scripts stripped out the executable flag from the file. We will have this corrected for our next release.

Regarding your issue with keyoff, the code seems okay on first glance. I would suggest modifying one of the example apps to perform a keyoff and use one of the example events. If you still experience problems e-mail your modified example to support@fmod.org

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.