Esempio n. 1
0
void Java_org_fmod_programmerselected_Example_cStart(JNIEnv *env, jobject thiz)
{
	FMOD_RESULT result = FMOD_OK;

    result = FMOD_EventGroup_GetEvent(gEventGroup, "ProgrammerSelected", FMOD_EVENT_DEFAULT, &gEvent);
    CHECK_RESULT(result);
    result = FMOD_Event_SetCallback(gEvent, eventcallback, NULL);
    CHECK_RESULT(result);
    result = FMOD_Event_Start(gEvent);
    CHECK_RESULT(result);
}
Esempio n. 2
0
int main(int argc, char *argv[])
{
    FMOD_RESULT        result;
    FMOD_EVENTSYSTEM  *eventsystem;
    FMOD_EVENTGROUP   *eventgroup;
    FMOD_EVENT        *event;
    int                key;

    printf("======================================================================\n");
    printf("Programmer Sound. Copyright (c) Firelight Technologies 2006-2011.\n");
    printf("======================================================================\n");

    ERRCHECK(result = FMOD_EventSystem_Create(&eventsystem));
    ERRCHECK(result = FMOD_EventSystem_Init(eventsystem, 64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL));
    ERRCHECK(result = FMOD_EventSystem_SetMediaPath(eventsystem, (char *)MEDIA_PATH));
    ERRCHECK(result = FMOD_EventSystem_Load(eventsystem, "examples.fev", 0, 0));
    ERRCHECK(result = FMOD_EventSystem_GetGroup(eventsystem, "examples/FeatureDemonstration/SequencingAndStitching", FMOD_EVENT_DEFAULT, &eventgroup));

    ERRCHECK(result = FMOD_EventSystem_GetSystemObject(eventsystem, &sys));
    ERRCHECK(result = FMOD_System_CreateStream(sys, FSB_NAME, FMOD_2D | FMOD_NONBLOCKING | FMOD_SOFTWARE, 0, &fsb));

    initIndexMap(fsb);

    printf("======================================================================\n");
    printf("Press 'Space' to start the 'Programmer Sound' event\n");
    printf("Press '>'     to increase sound index\n");
    printf("Press '<'     to decrease sound index\n");
    printf("Press 'Esc'   to quit\n");
    printf("======================================================================\n");
    printf("Sound index = %d\n", g_sound_index + 1);

    key = 0;
    do
    {
        if (_kbhit())
        {
            key = _getch();

            switch(key)
            {
                case ' ' :
                    ERRCHECK(result = FMOD_EventGroup_GetEvent(eventgroup, "ProgrammerSounds", FMOD_EVENT_DEFAULT, &event));
                    ERRCHECK(result = FMOD_Event_SetCallback(event, eventcallback, 0));
                    ERRCHECK(result = FMOD_Event_Start(event));
                    break;

                case '>' : case '.':
                    ++g_sound_index;
                    g_sound_index = (g_sound_index >= SOUND_INDEX_MAX) ? SOUND_INDEX_MAX - 1 : g_sound_index;
                    printf("Sound index = %d\n", g_sound_index + 1);
                    break;

                case '<' : case ',':
                    --g_sound_index;
                    g_sound_index = (g_sound_index < 0) ? 0 : g_sound_index;
                    printf("Sound index = %d\n", g_sound_index + 1);
                    break;
            }
        }

        ERRCHECK(result = FMOD_EventSystem_Update(eventsystem));
        Sleep(10);

    } while (key != 27);

    ERRCHECK(result = FMOD_EventSystem_Unload(eventsystem));
    ERRCHECK(result = FMOD_Sound_Release(fsb));
    ERRCHECK(result = FMOD_EventSystem_Release(eventsystem));
    return 0;
}
Esempio n. 3
0
int main(int argc, char *argv[])
{
    FMOD_RESULT        result;
    FMOD_EVENTSYSTEM  *eventsystem;
    FMOD_EVENTGROUP   *eventgroup;
    FMOD_EVENT        *event[NUM_EVENTS];
    char              *event_name[NUM_EVENTS] = {
                           "Basics/BasicEventWithLooping",
                           "SequencingAndStitching/LoopLogic",
                           "3D Events/2D-3DPanMorph"
                       };
    int                key, i, userdata = 0;

    printf("======================================================================\n");
    printf("Realtime Tweaking. Copyright (c) Firelight Technologies 2004-2015.\n");
    printf("======================================================================\n");
    printf("This example shows how to initialize the FMOD Net Event System so that\n");
    printf("FMOD Designer can connect to your game and tweak events as they're\n");
    printf("playing.\n");
    printf("Start some events then connect to this app using the Audition menu\n");
    printf("in FMOD Designer. You can use 127.0.0.1 for the IP address if you\n");
    printf("don't want to use two machines. Load tutorials.fdp and change the \n");
    printf("volume of the playing events using the volume slider in the event\n");
    printf("property sheet\n");
    printf("======================================================================\n\n");

    ERRCHECK(result = FMOD_EventSystem_Create(&eventsystem));
    ERRCHECK(result = FMOD_NetEventSystem_Init(eventsystem, FMOD_EVENT_NET_PORT));
    ERRCHECK(result = FMOD_EventSystem_Init(eventsystem, 64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL));
    ERRCHECK(result = FMOD_EventSystem_SetMediaPath(eventsystem, (char *)MEDIA_PATH));
    ERRCHECK(result = FMOD_EventSystem_Load(eventsystem, "examples.fev", 0, 0));
    ERRCHECK(result = FMOD_EventSystem_GetGroup(eventsystem, "examples/FeatureDemonstration", FMOD_EVENT_DEFAULT, &eventgroup));

    for (i=0; i < NUM_EVENTS; i++)
    {
        event[i] = 0;
    }

    printf("======================================================================\n");
    printf("Press 1 - 3  to start/stop events\n");
    printf("Press ESC    to quit\n");
    printf("======================================================================\n");

    key = 0;
    do
    {
        if (_kbhit())
        {
            key = _getch();

            if ((key >= '1') && (key <= '3'))
            {
                i = (int)(key - '1');

                if (event[i])
                {
                    ERRCHECK(result = FMOD_Event_Stop(event[i], 1));
                    event[i] = 0;
                    printf("Stopping '%s'\n", event_name[i]);
                }
                else
                {
                    ERRCHECK(result = FMOD_EventGroup_GetEvent(eventgroup, event_name[i], FMOD_EVENT_DEFAULT, &event[i]));
                    ERRCHECK(result = FMOD_Event_SetCallback(event[i], eventcallback, (void *)(userdata++)));
                    ERRCHECK(result = FMOD_Event_Start(event[i]));
                    printf("Starting '%s'\n", event_name[i]);
                }
            }
        }

        ERRCHECK(result = FMOD_EventSystem_Update(eventsystem));
        ERRCHECK(result = FMOD_NetEventSystem_Update());
        Sleep(10);

    } while (key != 27);

    ERRCHECK(result = FMOD_EventSystem_Release(eventsystem));
    ERRCHECK(result = FMOD_NetEventSystem_Shutdown());
    return 0;
}