Esempio n. 1
0
	AnyType::AnyTypeMap SoundSystem::Execute( const std::string& actionName, AnyType::AnyTypeMap& parameters )
	{
		AnyType::AnyTypeMap results;
		FMOD_RESULT result;

		if( actionName == "load" )
		{
			std::string filePath = parameters[ "filePath" ].As< std::string >( );
			result = m_eventSystem->load( filePath.c_str( ), 0, 0 );
			results[ "result" ] = ( result == FMOD_OK );
		}
		
		if ( actionName == "playMusic" )
		{
			FMOD::Event* event = 0;
			std::string eventPath = parameters[ "eventPath" ].As< std::string >( );
			result = m_eventSystem->getEvent( eventPath.c_str( ), FMOD_EVENT_DEFAULT, &event );
			
			if ( result == FMOD_OK )
			{
				result = event->start( );
				results[ "result" ] = ( result == FMOD_OK );
			}
		}

		return results;
	}
Esempio n. 2
0
int audio_event(event_id id)
{
  FMOD::Event* e = idToEvent(id);
  if(e)
  {
    result = e->start();
    return (result == FMOD_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
  }
  else
    return EXIT_FAILURE;
}
Esempio n. 3
0
int main(int argc, char *argv[])
{
    FMOD::EventSystem *eventsystem;
    FMOD::Event       *event;
    FMOD_RESULT        result;
    int                key;

    printf("======================================================================\n");
    printf("Simple Event Example.  Copyright (c) Firelight Technologies 2004-2014.\n");
    printf("======================================================================\n");
    printf("This example simply plays an event created with the FMOD Designer tool.\n");
    printf("======================================================================\n\n");

    ERRCHECK(result = FMOD::EventSystem_Create(&eventsystem));
    ERRCHECK(result = eventsystem->init(64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL));
    ERRCHECK(result = eventsystem->setMediaPath("..\\media\\"));
    ERRCHECK(result = eventsystem->load("examples.fev", 0, 0));
    ERRCHECK(result = eventsystem->getEvent("examples/FeatureDemonstration/Basics/SimpleEvent", FMOD_EVENT_DEFAULT, &event));

    printf("======================================================================\n");
    printf("Press SPACE to play the event.\n");
    printf("Press ESC   to quit\n");
    printf("======================================================================\n");

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

            if (key == ' ')
            {
                ERRCHECK(result = event->start());
            }
        }

        ERRCHECK(result = eventsystem->update());
        Sleep(15);

        FMOD_EVENT_STATE state;
        ERRCHECK(result = event->getState(&state));
        printf("Event is %s       \r", (state & FMOD_EVENT_STATE_PLAYING) ? "playing" : "stopped");

    } while (key != 27);

    ERRCHECK(result = eventsystem->release());
    return 0;
}
Esempio n. 4
0
bool FMODSoundEvent::Trigger()
{
    SoundSystem * soundSystem = SoundSystem::Instance();
    FMOD::EventSystem * fmodEventSystem = soundSystem->fmodEventSystem;
    
    if(is3D)
    {
        FMOD::Event * fmodEventInfo = 0;
        FMOD_VERIFY(fmodEventSystem->getEvent(eventName.c_str(), FMOD_EVENT_INFOONLY, &fmodEventInfo));
        if(fmodEventInfo)
        {
            FMOD_VERIFY(fmodEventInfo->set3DAttributes((FMOD_VECTOR*)&position, 0, isDirectional ? (FMOD_VECTOR*)&direction : NULL));
            FMOD_VERIFY(fmodEventInfo->setVolume(volume));
            ApplyParamsToEvent(fmodEventInfo);
        }
    }
    
    FMOD::Event * fmodEvent = 0;
    FMOD_RESULT result = fmodEventSystem->getEvent(eventName.c_str(), FMOD_EVENT_DEFAULT, &fmodEvent);
    if(result == FMOD_OK)
    {
        ApplyParamsToEvent(fmodEvent);

		FMOD_VERIFY(fmodEvent->setVolume(volume));
		FMOD_RESULT startResult = fmodEvent->start();
		if(startResult == FMOD_OK)
		{
			FMOD_VERIFY(fmodEvent->setCallback(FMODEventCallback, this));
			fmodEventInstances.push_back(fmodEvent);
			Retain();
		}
		else if(startResult != FMOD_ERR_EVENT_FAILED) //'just fail' max playbacks behavior
		{
			Logger::Error("[FMODSoundEvent::Trigger()] Failed to start event by %d on eventID: %s", startResult, eventName.c_str());
		}
    }
    else if(result != FMOD_ERR_EVENT_FAILED) //'just fail' max playbacks behavior
    {
        Logger::Error("[FMODSoundEvent::Trigger()] Failed to retrieve event by %d on eventID: %s", result, eventName.c_str());
    }

    PerformEvent(EVENT_TRIGGERED);

    return fmodEvent != 0;
}
Esempio n. 5
0
int main(int argc, char *argv[])
{
    FMOD_RESULT        result;
    FMOD::EventSystem *eventsystem;
    FMOD::EventGroup  *eventgroup;
    FMOD::Event       *event;
    int                key;

    enum
    {
        StealOldest,
        StealNewest,
        StealQuietest,
        JustFail,
        JustFailIfQuietest
    } event_behaviour = StealOldest;

    ERRCHECK(result = FMOD::EventSystem_Create(&eventsystem));
    ERRCHECK(result = eventsystem->init(64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL));
    ERRCHECK(result = eventsystem->setMediaPath((char *)MEDIA_PATH));
    ERRCHECK(result = eventsystem->load("examples.fev", 0, 0));
    ERRCHECK(result = eventsystem->getGroup("examples/FeatureDemonstration/MaxPlayback", FMOD_EVENT_DEFAULT, &eventgroup));
    ERRCHECK(result);

    printf("======================================================================\n");
    printf("Max Playbacks Example.  Copyright (c) Firelight Technologies 2004-2011.\n");
    printf("----------------------------------------------------------------------\n");
    printf("Press '1'   to select 'Steal oldest' behaviour\n");
    printf("Press '2'   to select 'Steal newest' behaviour\n");
    printf("Press '3'   to select 'Steal quietest' behaviour\n");
    printf("Press '4'   to select 'Just fail' behaviour\n");
    printf("Press '5'   to select 'Just fail if quietest' behaviour\n");
    printf("Press Space to start an event\n");
    printf("Press 's'   to stop all events\n");
    printf("Press '>'   to increase event distance\n");
    printf("Press '<'   to decrease event distance\n");
    printf("Press ESC to quit\n");
    printf("======================================================================\n");

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

            switch(key)
            {
                case '1' : // 'Steal oldest'
                    event_behaviour = StealOldest;
                    stopAllEvents(eventgroup);
                    break;

                case '2' : // 'Steal newest'
                    event_behaviour = StealNewest;
                    stopAllEvents(eventgroup);
                    break;

                case '3' : // 'Steal quietest'
                    event_behaviour = StealQuietest;
                    stopAllEvents(eventgroup);
                    break;

                case '4' : // 'Just fail'
                    event_behaviour = JustFail;
                    stopAllEvents(eventgroup);
                    break;

                case '5' : // 'Just fail if quietest'
                    event_behaviour = JustFailIfQuietest;
                    stopAllEvents(eventgroup);
                    break;

                case ' ' : // Play an event
                    const char *name;

                    switch(event_behaviour)
                    {
                        case StealOldest :
                            name = "MaxPlay-StealOldest";
                            break;

                        case StealNewest :
                            name = "MaxPlay-StealNewest";
                            break;

                        case StealQuietest :
                            name = "MaxPlay-StealQuietest";
                            break;

                        case JustFail :
                            name = "MaxPlay-JustFail";
                            break;

                        case JustFailIfQuietest :
                            name = "MaxPlay-JustFailIfQuietest";
                            break;
                    }

                    // Clear the line
                    printf("%79s\r", " ");

                    if (event_behaviour == JustFailIfQuietest)
                    {
                        /* The 'Just fail if quietest' behaviour calculates the expected
                           volume of the event based on the properties of the info-only
                           event, so we have to get the info-only event first and set it
                           up appropriately.
                         */

                        // get the info-only event to set up for volume calculation
                        ERRCHECK(result = eventgroup->getEvent(name, FMOD_EVENT_INFOONLY, &event));

                        /* set the desired properties on the info-only event
                           Notes:
                           - distances below the event's 3D Min Distance all give the
                             same volume; in this case, getEvent will just fail
                           - we could set other volume-affecting properties here as
                             well (e.g. orientation if the event has a falloff cone)
                         */
                        setupEvent(event);

                        // attempt to get a real event instance
                        result = eventgroup->getEvent(name, FMOD_EVENT_DEFAULT, &event);
                        if (result == FMOD_OK)
                        {
                            printf("getEvent(\"%s\") succeeded\n", name);

                            /* we don't need to set the position of the instance,
                               as it is copied from the info-only event, but we
                               do need to set the parameter value.
                             */
                            FMOD::EventParameter *param;
                            ERRCHECK(result = event->getParameter("sound", &param));
                            ERRCHECK(result = param->setValue(g_sound));
                            ERRCHECK(result = event->start());
                        }
                        else
                        {
                            printf("getEvent(\"%s\") failed\n", name);
                        }
                    }
                    else
                    {
                        result = eventgroup->getEvent(name, FMOD_EVENT_DEFAULT, &event);
                        if (result == FMOD_OK)
                        {
                            printf("getEvent(\"%s\") succeeded\n", name);
                            setupEvent(event);
                            ERRCHECK(result = event->start());
                        }
                        else
                        {
                            printf("getEvent(\"%s\") failed\n", name);
                        }
                    }

                    ++g_sound;
                    if(g_sound > 3)
                    {
                        g_sound = 0;
                    }

                    break;

                case 's' :
                    stopAllEvents(eventgroup);
                    break;

                case '>' : case '.' :
                    g_distance += 0.1f;
                    break;

                case '<' : case ',' :
                    g_distance -= 0.1f;
                    g_distance = (g_distance < 0.0f) ? 0.0f : g_distance;
                    break;
            }

            const char *name;

            switch(event_behaviour)
            {
                case StealOldest:
                    name = "Steal oldest";
                    break;

                case StealNewest:
                    name = "Steal newest";
                    break;

                case StealQuietest:
                    name = "Steal quietest";
                    break;

                case JustFail:
                    name = "Just fail";
                    break;

                case JustFailIfQuietest:
                    name = "Just fail if quietest";
                    break;
            }

            printf("Sound = %1.0f, Distance = %4.1f, Behaviour = %-25s\r", g_sound, g_distance, name);
        }

        ERRCHECK(result = eventsystem->update());
        fflush(stdout);
        Sleep(10);

    } while (key != 27);

    ERRCHECK(result = eventsystem->unload());
    ERRCHECK(result = eventsystem->release());
    return 0;
}
Esempio n. 6
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-2014.\n");
    printf("======================================================================\n");

    ERRCHECK(result = FMOD::EventSystem_Create(&eventsystem));
    ERRCHECK(result = eventsystem->init(64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL));
    ERRCHECK(result = eventsystem->setMediaPath((char *)MEDIA_PATH));
    ERRCHECK(result = eventsystem->load("examples.fev", 0, 0));
    ERRCHECK(result = eventsystem->getGroup("examples/FeatureDemonstration/SequencingAndStitching", FMOD_EVENT_DEFAULT, &eventgroup));

    ERRCHECK(result = eventsystem->getSystemObject(&sys));
    ERRCHECK(result = sys->createStream(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 = eventgroup->getEvent("ProgrammerSounds", FMOD_EVENT_DEFAULT, &event));
                    ERRCHECK(result = event->setCallback(eventcallback, 0));
                    ERRCHECK(result = event->start());
                    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 = eventsystem->update());
        Sleep(10);

    } while (key != 27);

    ERRCHECK(result = eventsystem->unload());
    ERRCHECK(result = fsb->release());
    ERRCHECK(result = eventsystem->release());
    return 0;
}
Esempio n. 7
0
int main(int argc, char *argv[])
{
    FMOD::EventSystem    *eventsystem = 0;
    FMOD::System         *system      = 0;

    void                 *project_mem = 0;
    unsigned int          project_len = 0;

    FMOD::Event          *sampleevent    = 0;
    FMOD::Sound          *samplebank     = 0;
    void                 *samplebank_mem = 0;
    unsigned int          samplebank_len = 0;

    FMOD::Event          *streamevent = 0;
    FMOD::Sound          *streambank  = 0;

    FMOD_RESULT           result = FMOD_OK;
    int                   key = 0;

    printf("======================================================================\n");
    printf("Load Event Data Example.  Copyright (c) Firelight Technologies 2004-2014.\n");
    printf("==============================-------=================================\n");
    printf("This Demonstrates loading all resources from memory allocated and filled\n");
    printf("by the user.\n");
    printf("======================================================================\n\n");
    
    /* Load FEV file into memory */
    loadFileIntoMemory("..\\media\\examples.fev", &project_mem, &project_len);

    ERRCHECK(result = FMOD::EventSystem_Create(&eventsystem));
    ERRCHECK(result = eventsystem->getSystemObject(&system));
    ERRCHECK(result = eventsystem->init(64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL));
    ERRCHECK(result = eventsystem->setMediaPath("..\\media\\"));

    /* we require a loadinfo struct to tell FMOD how big the in memory FEV file is */
    FMOD_EVENT_LOADINFO load_info;
    memset(&load_info, 0, sizeof(FMOD_EVENT_LOADINFO));
    load_info.size = sizeof(FMOD_EVENT_LOADINFO);
    load_info.loadfrommemory_length = project_len;

    /* load the project from memory */
    ERRCHECK(result = eventsystem->load((char*)project_mem, &load_info, NULL));

    printf("======================================================================\n");
    printf("Press 'e'        to load sample data\n");
    printf("Press 'E'        to unload sample data\n");
    printf("Press 'd'        to start sample event\n");
    printf("Press 'w'        to open stream\n");
    printf("Press 'W'        to close stream\n");
    printf("Press 's'        to start stream event\n");
    printf("Press ESC        to quit\n");
    printf("======================================================================\n");

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

            if (key == 'e')
            {
                /* Attempt to get the event without disk access */
                result = eventsystem->getEvent("examples/FeatureDemonstration/Basics/SimpleEvent", FMOD_EVENT_ERROR_ON_DISKACCESS, &sampleevent);
                if (result != FMOD_ERR_FILE_UNWANTED)
                {
                    ERRCHECK(result);
                }
                else
                {
                    /* file unwanted error tells us we haven't got the soundbank preloaded, so preload it now... */
                    printf("Loading event data\n");

                    loadFileIntoMemory("..\\media\\tutorial_bank.fsb", &samplebank_mem, &samplebank_len);

                    /* We need to create a FMOD::Sound object to use with preloadFSB */
                    FMOD_CREATESOUNDEXINFO info = {0};
                    info.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
                    info.length = samplebank_len;
                    ERRCHECK(result = system->createSound((char*)samplebank_mem, FMOD_OPENMEMORY_POINT | FMOD_CREATECOMPRESSEDSAMPLE, &info, &samplebank));

                    /* Tell FMOD that we have loaded this FSB */
                    ERRCHECK(result = eventsystem->preloadFSB("tutorial_bank.fsb", 0, samplebank));
                    
                    /* Now we can get the event without diskaccess */
                    ERRCHECK(result = eventsystem->getEvent("examples/FeatureDemonstration/Basics/SimpleEvent", FMOD_EVENT_ERROR_ON_DISKACCESS, &sampleevent));
                }                
                printf("Sample event ready\n");
            }
            else if (key == 'E')
            {
                if (!samplebank)
                {
                    printf("Nothing to unload\n");
                }
                else
                {
                    ERRCHECK(result = sampleevent->stop());
                    sampleevent = 0;
                    /* Note: we *MUST* call unload before freeing data */
                    ERRCHECK(result = eventsystem->unloadFSB("tutorial_bank.fsb", 0));
                    ERRCHECK(result = samplebank->release());
                    samplebank = 0;
                    if (samplebank_mem)
                    {
                        free(samplebank_mem);
                        samplebank_mem = 0;
                    }
                    printf("Event data unloaded\n");
                }
            }
            else if (key == 'd')
            {
                if (!sampleevent)
                {
                    printf("no event loaded!\n");
                }
                else
                {
                    ERRCHECK(result = sampleevent->start());
                }
            }
            else if (key == 'w')
            {   
                /* Attempt to get the event without opening a new stream */
                result = eventsystem->getEvent("examples/AdvancedTechniques/MultiChannelMusic", FMOD_EVENT_ERROR_ON_DISKACCESS, &streamevent);
                if (result != FMOD_ERR_FILE_UNWANTED)
                {
                    ERRCHECK(result);
                }
                else
                {
                    /*  file unwanted error tells us we haven't got the stream instance preloaded so preload it now */
                    printf("Opening stream\n");

                    /* If the 'Max Streams' property of the sound bank is greater than 1 then mutiple streams can be opened. This means we need
                       to preload it multiple times if we want to prevent FMOD from creating streams internally. Each stream is uniquely identified
                       using the 'streaminstance' parameter to preloadFSB which counts upwards from 0.
                    */
                    ERRCHECK(result = system->createSound("..\\media\\streaming_bank.fsb", FMOD_CREATESTREAM, 0, &streambank));
                    ERRCHECK(result = eventsystem->preloadFSB("streaming_bank.fsb", 0, streambank));
                    
                    /* Now we can get the event without opening a new stream */
                    ERRCHECK(result = eventsystem->getEvent("examples/AdvancedTechniques/MultiChannelMusic", FMOD_EVENT_ERROR_ON_DISKACCESS, &streamevent));
                }
                
                printf("Stream event ready\n");
            }
            else if (key == 'W')
            {
                if (!streambank)
                {
                    printf("Nothing to unload\n");
                }
                else
                {
                    ERRCHECK(result = streamevent->stop());
                    streamevent = 0;
                    /* Note: we *MUST* call unload before releasing stream */
                    ERRCHECK(result = eventsystem->unloadFSB("streaming_bank.fsb", 0));
                    ERRCHECK(result = streambank->release());
                    streambank = 0;
                    printf("Stream closed\n");
                }
            }
            else if (key == 's')
            {
                if (!streamevent)
                {
                    printf("no event loaded!\n");
                }
                else
                {
                    ERRCHECK(result = streamevent->start());
                }
            }
        }

        ERRCHECK(result = eventsystem->update());
        Sleep(15);

    } while (key != 27);
    
    if (samplebank)
    {
        /* Note: we *MUST* call unload before freeing data */
        ERRCHECK(result = eventsystem->unloadFSB("tutorial_bank.fsb", 0));
        ERRCHECK(result = samplebank->release());

        if (samplebank_mem)
        {
            free(samplebank_mem);
        }
    }
    
    if (streambank)
    {
        /* Note: we *MUST* call unload before releasing stream */
        ERRCHECK(result = eventsystem->unloadFSB("streaming_bank.fsb", 0));
        ERRCHECK(result = streambank->release());
    }

    ERRCHECK(result = eventsystem->release());

    /* Free the memory we have allocated */
    free(project_mem);

    return 0;
}
Esempio n. 8
0
int main(int argc, char *argv[])
{
    FMOD::EventSystem    *eventsystem;
    FMOD::EventGroup     *eventgroup;
    FMOD::EventCategory  *mastercategory;
    FMOD::Event          *car;
    FMOD::EventParameter *rpm;
    FMOD::EventParameter *load;
    FMOD_RESULT           result;
    int                   key;
    float                 rpm_val, rpm_min, rpm_max, rpm_increment, load_val, load_min, load_max, load_increment;

    printf("======================================================================\n");
    printf("Parameters Example.  Copyright (c) Firelight Technologies 2004-2014.\n");
    printf("==============================-------=================================\n");
    printf("This demonstrates the use of FMOD event parameters. It simply plays an\n");
    printf("event, retrieves the parameters and allows the user to adjust them.\n");
    printf("======================================================================\n\n");

    ERRCHECK(result = FMOD::EventSystem_Create(&eventsystem));
    ERRCHECK(result = eventsystem->init(64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL));
    ERRCHECK(result = eventsystem->setMediaPath("..\\media\\"));
    ERRCHECK(result = eventsystem->load("examples.fev", 0, 0));
    ERRCHECK(result = eventsystem->getGroup("examples/AdvancedTechniques", FMOD_EVENT_DEFAULT, &eventgroup));
    ERRCHECK(result = eventgroup->getEvent("car", FMOD_EVENT_DEFAULT, &car));

    ERRCHECK(result = eventsystem->getCategory("master", &mastercategory));

    ERRCHECK(result = car->getParameter("load", &load));
    ERRCHECK(result = load->getRange(&load_min, &load_max));
    ERRCHECK(result = load->setValue(load_max));

    ERRCHECK(result = car->getParameterByIndex(0, &rpm));
    ERRCHECK(result = rpm->getRange(&rpm_min, &rpm_max));
    ERRCHECK(result = rpm->setValue(1000.0f));

    ERRCHECK(result = car->start());

    printf("======================================================================\n");
    printf("Press '<' or ',' to decrease RPM\n");
    printf("Press '>' or '.' to increase RPM\n");
    printf("Press '-' or '_' to decrease load\n");
    printf("Press '+' or '=' to increase load\n");
    printf("Press ESC        to quit\n");
    printf("======================================================================\n");

    rpm_increment   = (rpm_max - rpm_min) / UPDATE_INTERVAL;
    ERRCHECK(result = rpm->getValue(&rpm_val));
    load_increment  = (load_max - load_min) / UPDATE_INTERVAL;
    ERRCHECK(result = load->getValue(&load_val));

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

            if (key == '<' || key == ',')
            {
                rpm_val -= rpm_increment;
                if (rpm_val < rpm_min)
                {
                    rpm_val = rpm_min;
                }

                ERRCHECK(result = rpm->setValue(rpm_val));
            }
            else if (key == '>' || key == '.')
            {
                rpm_val += rpm_increment;
                if (rpm_val > rpm_max)
                {
                    rpm_val = rpm_max;
                }

                ERRCHECK(result = rpm->setValue(rpm_val));
            }
            if (key == '-' || key == '_')
            {
                load_val -= load_increment;
                if (load_val < load_min)
                {
                    load_val = load_min;
                }

                ERRCHECK(result = load->setValue(load_val));
            }
            else if (key == '+' || key == '=')
            {
                load_val += load_increment;
                if (load_val > load_max)
                {
                    load_val = load_max;
                }

                ERRCHECK(result = load->setValue(load_val));
            }
            else if (key == ' ')
            {
                bool paused;

                ERRCHECK(result = mastercategory->getPaused(&paused));
                paused = !paused;
                ERRCHECK(result = mastercategory->setPaused(paused));
            }

        }

        ERRCHECK(result = eventsystem->update());
        Sleep(15);

        printf("RPM = %.4f, load = %.4f        \r", rpm_val, load_val);

    } while (key != 27);

    ERRCHECK(result = eventgroup->freeEventData());
    ERRCHECK(result = eventsystem->release());
    return 0;
}