0
0

I’m a music/audio guy and I’m just starting out with FMOD, and I could use a little help with the basics of implementation. I created a simple sound event in FMOD and I’m trying to get it to work with the simple event project that’s included with the API (simple_event.xcodeproj). I only have a little basic programming experience, but looking at the code for this project I have at least a general understanding of what’s going on. Here’s what I’ve done to try to get the sound to work in this project:

  1. Created the sound event in FMOD, ran the build and exported GUIDs.
  2. Overwrote the Master Bank.bank and Master Bank.bank.strings files that came with the sample project with the ones from my build.
  3. Copied the audio file for the event into the project’s Media folder.
  4. Commented out sections of the code that refer to the looping ambience and surge sounds–I’m just focusing on the one shot pulse at the moment.
  5. Replaced the path and GUID in the sample code with those from my GUID.txt file.

The result is that the program complies successfully, but when I click the button to trigger the sound, I get the following error:

[quote:2w1kcycp]FMOD error 98 – The requested event, bus or via could not be found.[/quote:2w1kcycp]

I tried changing the GUID of the other two sounds in the project as well and it always results in this error message. I’m guessing that I’m missing a basic step, but I haven’t been able to figure out what. Can anyone help me figure out what’s going on? Here’s my code:

[code:2w1kcycp]
/*==============================================================================
Simple Event Example
Copyright (c), Firelight Technologies Pty, Ltd 2012-2013.

This example demonstrates the various ways of playing an event. Controlling event
playback using a persistent instance versus fire and forget.
==============================================================================*/

include "fmod_studio.hpp"

include "fmod.hpp"

include "common.h"

int FMOD_Main()
{
void *extraDriverData = 0;
Common_Init(&extraDriverData);

FMOD::Studio::System system;
ERRCHECK( FMOD::Studio::System::create(&system) );
ERRCHECK( system.initialize(32, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_NORMAL, extraDriverData) );

FMOD::Studio::Bank masterBank;
ERRCHECK( system.loadBank(Common_MediaPath("Master Bank.bank"), &masterBank) );

FMOD::Studio::Bank stringsBank;
ERRCHECK( system.loadBank(Common_MediaPath("Master Bank.bank.strings"), &stringsBank) );

// Get the Looping Ambience event
/*FMOD::Studio::ID loopingAmbienceID = {0};
ERRCHECK( FMOD::Studio::parseID("{be4d0587-d91a-42e3-8286-2590da98246e}", &loopingAmbienceID) );

FMOD::Studio::EventDescription loopingAmbienceDescription;
ERRCHECK( system.getEvent(&loopingAmbienceID, FMOD_STUDIO_LOAD_BEGIN_NOW, &loopingAmbienceDescription) );

FMOD::Studio::EventInstance loopingAmbienceInstance;
ERRCHECK( loopingAmbienceDescription.createInstance(&loopingAmbienceInstance) );

// Get the 4 Second Surge event
FMOD::Studio::ID surgeID = {0};
ERRCHECK( FMOD::Studio::parseID("{7daf5044-5399-490f-bea8-fca399fc8068}", &surgeID) );

FMOD::Studio::EventDescription surgeDescription;
ERRCHECK( system.getEvent(&surgeID, FMOD_STUDIO_LOAD_BEGIN_NOW, &surgeDescription) );

FMOD::Studio::EventInstance surgeInstance;
ERRCHECK( surgeDescription.createInstance(&surgeInstance) );
*/

do
{
    Common_Update();

    if (Common_BtnPress(BTN_ACTION1))
    {
        // One-shot event

        FMOD::Studio::ID pulseID = {0};

if 1 // look up by path (requires Master Bank.bank.strings to be loaded)

        ERRCHECK( system.lookupEventID("/Simple Events/ball impact", &pulseID) );

else // look up by GUID

        ERRCHECK( FMOD::Studio::parseID("{601294bb-ad41-4517-a169-2af4aabe340f}", &pulseID) );

endif

        FMOD::Studio::EventDescription pulseDescription;
        ERRCHECK( system.getEvent(&pulseID, FMOD_STUDIO_LOAD_BEGIN_NOW, &pulseDescription) );

        FMOD::Studio::EventInstance eventInstance;
        ERRCHECK( pulseDescription.createInstance(&eventInstance) );

        ERRCHECK( eventInstance.start() );

        // Release will clean up the instance when it completes
        ERRCHECK( eventInstance.release() );
    }

    /*if (Common_BtnPress(BTN_ACTION2))
    {
        ERRCHECK( loopingAmbienceInstance.start() );
    }

    if (Common_BtnPress(BTN_ACTION3))
    {
        ERRCHECK( loopingAmbienceInstance.stop(FMOD_STUDIO_STOP_IMMEDIATE) );
    }

    if (Common_BtnPress(BTN_ACTION4))
    {
        // Calling start on an instance will cause it to restart if it's already playing
        ERRCHECK( surgeInstance.start() );
    }*/

    ERRCHECK( system.update() );

    Common_Draw("==================================================");
    Common_Draw("Simple Event Example.");
    Common_Draw("Copyright (c) Firelight Technologies 2012-2013.");
    Common_Draw("==================================================");
    Common_Draw("");
    Common_Draw("Press %s to fire and forget Oneshot Pulse", Common_BtnStr(BTN_ACTION1));
    //Common_Draw("Press %s to start Looping Ambience", Common_BtnStr(BTN_ACTION2));
    //Common_Draw("Press %s to stop Looping Ambience", Common_BtnStr(BTN_ACTION3));
    //Common_Draw("Press %s to start/restart 4 Second Surge", Common_BtnStr(BTN_ACTION4));
    //Common_Draw("Press %s to quit", Common_BtnStr(BTN_QUIT));

    Common_Sleep(50);
} while (!Common_BtnPress(BTN_QUIT));

ERRCHECK( stringsBank.unload() );
ERRCHECK( masterBank.unload() );

ERRCHECK( system.release() );

Common_Close();

return 0;

}[/code:2w1kcycp]

  • You must to post comments
0
0

I figured it out. I hadn’t added my event to the master bank in FMOD.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.