Beispiel #1
0
void IPlugAAX::RenderAudio(AAX_SIPlugRenderInfo* ioRenderInfo)
{
  TRACE_PROCESS;

  IMutexLock lock(this);

  // Get bypass parameter value
  bool bypass;
  mBypassParameter->GetValueAsBool(&bypass);
  
  AAX_EStemFormat inFormat, outFormat;
  Controller()->GetInputStemFormat(&inFormat);
  Controller()->GetOutputStemFormat(&outFormat);
  
  if (DoesMIDI()) 
  {
    AAX_IMIDINode* midiIn = ioRenderInfo->mInputNode;
    AAX_CMidiStream* midiBuffer = midiIn->GetNodeBuffer();
    AAX_CMidiPacket* midiBufferPtr = midiBuffer->mBuffer;
    uint32_t packets_count = midiBuffer->mBufferSize;
    
    // Setup MIDI Out node pointers 
//		AAX_IMIDINode* midiNodeOut = instance->mMIDINodeOutP;
//		AAX_CMidiStream* midiBufferOut = midiNodeOut->GetNodeBuffer();
//		AAX_CMidiPacket* midiBufferOutPtr = midiBufferOut->mBuffer;
        
    for (int i = 0; i<packets_count; i++, midiBufferPtr++) 
    {
      IMidiMsg msg(midiBufferPtr->mTimestamp, midiBufferPtr->mData[0], midiBufferPtr->mData[1], midiBufferPtr->mData[2]);
      ProcessMidiMsg(&msg);
    }
  }
  
  AAX_IMIDINode* transportNode = ioRenderInfo->mTransportNode;
  mTransport = transportNode->GetTransport();

  int32_t numSamples = *(ioRenderInfo->mNumSamples);
  int32_t numInChannels = AAX_STEM_FORMAT_CHANNEL_COUNT(inFormat);
  int32_t numOutChannels = AAX_STEM_FORMAT_CHANNEL_COUNT(outFormat);

  SetInputChannelConnections(0, numInChannels, true);
  SetInputChannelConnections(numInChannels, NInChannels() - numInChannels, false);
  AttachInputBuffers(0, NInChannels(), ioRenderInfo->mAudioInputs, numSamples);
  
  SetOutputChannelConnections(0, numOutChannels, true);
  SetOutputChannelConnections(numOutChannels, NOutChannels() - numOutChannels, false);
  
  AttachOutputBuffers(0, NOutChannels(), ioRenderInfo->mAudioOutputs);
  
  if (bypass) 
  {
    PassThroughBuffers(0.0f, numSamples);
  }
  else 
  {
    ProcessBuffers(0.0f, numSamples);
  }
}
Beispiel #2
0
//-------------------------------------------------------------------
//Preconditii:-
//Postconditii: Apeleaza functii
void UI::menu()
{
	int op = 1;
	c = Controller("sPom.txt", "sOras.txt");
	while (op != 0)
	{
		print_menu();
		cout << "Alegeti optiunea:";
		cin >> op;
		if (op == 1)
			afiseazaTot();
		if (op == 2) {
			adauga();
		}
		if (op == 3) {
			addTranz();
		}
		if (op == 4) {
			UndoE();
		}
		if (op == 0)
		{
			cout << "------------" << endl;
			c.saveAll("sPom.txt", "sOras.txt");
			system("pause");
		}

	}
}
Beispiel #3
0
int main()
{



    std::cout<<"This is ConnectFour\n";
    //new Board()->Structure[0][0]->Fill();  This is an example of how to fill a cell in a structure.
    //Board()->Drawer(Window);  This is how to draw the board


    // Create the main rendering window
    sf::RenderWindow Window(sf::VideoMode(800, 600, 32), "ConnectFour");
    Board Game(Window.GetHeight(),Window.GetWidth(),30);

    const sf::Input& InputStream = Window.GetInput();

    Control Controller();

    // Start game loop
    while (Window.IsOpened())
    {
        // Process Checks
        Game.ExecuteChecks();
        // Process events
        sf::Event Event;
        while (Window.GetEvent(Event))
        {
            // Close window : exit
            if ((Event.Type == sf::Event::Closed)||((Event.Type == sf::Event::KeyReleased)&&(Event.Key.Code == sf::Key::Escape)))
                Window.Close();



            if (Event.Type==sf::Event::MouseButtonPressed)
            {
                    Game.FillFromVector(Game.DropToBottom(Game.clickToPosition(InputStream.GetMouseX(),InputStream.GetMouseY())));
                    if (Game.IsGameover(Game.DropToBottom(Game.clickToPosition(InputStream.GetMouseX(),InputStream.GetMouseY()))))
                        std::cout<<Game.Winner()<<" Won.\n";

            }

        }

        // Clear the screen (fill it with black color)
        Window.Clear();

        //Draw
        Game.Drawer(Window);


        // Display window contents on screen
        Window.Display();
    }






}
 Controller operator()(
         typename Stepper::value_type abs_error ,
         typename Stepper::value_type rel_error ,
         const Stepper &stepper )
 {
     return Controller( abs_error , rel_error , stepper );
 }
Beispiel #5
0
TEST(InputTest, set_field) {
    Controller controller = Controller();
    ifstream f("inputs/next_dog.txt");
    ASSERT_FALSE(f.fail());
    Input::mainInput(&controller, f);
    stringstream ss;
    controller.myState.dumpField(ss);



//    EXPECT_EQ(ss.str(),
//            "WWWWWWWWWWWWWW\n"
//            "W    O       W\n"
//            "W         xx W\n"
//            "W          xxW\n"
//            "W    O   1OOxW\n"
//            "W O  O   O  xW\n"
//            "W       O   xW\n"
//            "W   OOOOOOOO W\n"
//            "W  OOOO  xOO W\n"
//            "W    O  xxxxxW\n"
//            "W   OOOOOOOOxW\n"
//            "W     OO  OOxW\n"
//            "W        2xxxW\n"
//            "W O  O OxO   W\n"
//            "W      Ox    W\n"
//            "W            W\n"
//            "WWWWWWWWWWWWWW\n");
}
Beispiel #6
0
TEST(OutputTest, output_no_skill) {
    Controller controller = Controller();
    controller.myState.nextStep[0].push_back(Point(1, 0));
    controller.myState.nextStep[0].push_back(Point(0, 1));
    stringstream ss;

}
Beispiel #7
0
void TypeUiHtmlTextView::OnCustomContextMenuRequested( const QPoint& point )
{
    int cursor_position = ui->TextEdit->cursorForPosition( point ).position();
    QPoint global_point = ui->TextEdit->viewport()->mapToGlobal( point );
    TypeHtmlBlockStream& block_stream = Document().HtmlBuilder().BlockStream();
    TypeHtmlBlock* block = block_stream.BlockFromCursorPosition( cursor_position );
    long action_flags;

    if( block == 0 )
    {
        //
        // There is no selection on html text view:

        action_flags = Document().Context().Struct().Flags();
        TypeUiRecordContextMenu context_menu( Controller(), action_flags, false, global_point, this );
        return;
    }

    TypeRootStruct& root = Document().Root();
    TypeRecord* record = root.FromId( block->RecordId(), true );

    SetActiveRecord( record );
    ActivateBlock( block );

    emit Controller().SetActiveRecord( record );

    if( record == 0 )
    {
        //
        // The selected block doesn't contain any record:

        action_flags = Document().Context().Struct().Flags();//WHY?--------------
        TypeUiRecordContextMenu context_menu( Controller(), action_flags, false, global_point, this );
        return;
    }

    //
    // Open a context menu for selected record:

    action_flags = record->ParentStruct()->Flags();
    TypeUiRecordContextMenu context_menu( Controller(), action_flags, true, global_point, this );
}
Beispiel #8
0
void Config::ReadConfig()
{
    SWIP ini;
    std::string inipath("x360ce.ini");
    if (!ini.Load(inipath))
        CheckCommonDirectory(&inipath, "x360ce");
    if (!ini.Load(inipath)) return;

    static bool once_flag = false;
    if (!once_flag)
    {
        // Read global options
        ini.Get("Options", "Disable", &m_globalDisable);
        if (m_globalDisable) return;

        ini.Get("Options", "UseInitBeep", &m_initBeep, true);

        PrintLog("Using config file:");
        PrintLog(ini.GetIniPath().c_str());

        u32 ver = 0;
        ini.Get("Options", "Version", &ver);
        if (ver != VERSION_CONFIG)
            PrintLog("WARNING: Configuration file version mismatch detected");

        once_flag = true;
    }

    // Read pad mappings
    for (u32 i = 0; i < XUSER_MAX_COUNT; ++i)
    {
        std::string section;
        std::string key = StringFormat("PAD%u", i + 1);
        if (!ini.Get("Mappings", key, &section))
            continue;

        u32 index = 0;
        if (!ini.Get(section, "UserIndex", &index))
            index = i;

        // Require Controller copy constructor
        ControllerManager::Get().GetControllers().push_back(Controller(index));
        Controller* pController = &ControllerManager::Get().GetControllers().back();

        if (ReadPadConfig(pController, section, &ini))
            ReadPadMapping(pController, section, &ini);
    }
}
Beispiel #9
0
int main(int argc, const char* argv[])
{
    if(2<=argc)
    {
        // setup
        std::string PatchesDirectory(argv[1]);
        CModularWebController Controller(PatchesDirectory);

        std::signal(SIGINT, signal_handler);
        std::signal(SIGTERM, signal_handler);
        std::signal(SIGILL, signal_handler);
        std::signal(SIGSEGV, signal_handler);
        std::signal(SIGFPE, signal_handler);
        std::signal(SIGABRT, signal_handler);

        struct mg_server *server;

        // Create and configure the server
        server = mg_create_server(&Controller, ev_handler);
        mg_set_option(server, "listening_port", "8080");

        // Serve request. Hit Ctrl-C to terminate the program
        printf("Starting on port %s\n", mg_get_option(server, "listening_port"));

        // Run

        // detect ctrl-C or other signals
        while(gSignalStatus==0)
        {
            mg_poll_server(server, 1000);
        }

        std::cout << "Captured signal " << gSignalStatus << std::endl;

        // Cleanup, and free server instance
        std::cout << "Destroying server" << std::endl;
        mg_destroy_server(&server);

        return 0;

    }

    Usage();
    return -1;
}
Beispiel #10
0
void TypeUiHtmlTextView::OnCursorPositionChanged()
{
    int cursor_position = ui->TextEdit->textCursor().position();
    TypeHtmlBlockStream& block_stream = Document().HtmlBuilder().BlockStream();
    TypeHtmlBlock* block =  block_stream.BlockFromCursorPosition( cursor_position );

    if( block != 0 )
    {
        TypeRootStruct& root = Document().Root();
        TypeRecord* record = root.FromId( block->RecordId(), true );

        if( record != 0 )
        {
            SetActiveRecord( record );
            ActivateBlock( block );

            emit Controller().SetActiveRecord( record );
        }
    }
}
Beispiel #11
0
HelpNode *find_help(string keyword, HelpNode *parent = NULL)
{
    HelpNode *node = NULL;

    if (keyword == "Simulation") {
        node = new HelpNode(parent, "");
        Simulation().help(node);
    } else if (keyword == "Controller") {
        node = new HelpNode(parent, "");
        Controller(NULL).help(node);
    } else if (keyword == "WeightingFunctions") {
      FOUND_HELP(WeightingFunction_Factory, WeightingFunction_Help);
    } else if (keyword == "Symbols") {
      FOUND_HELP(SymbolFactory, Symbol_Help);
    } else if (keyword == "Integrators") {
      FOUND_HELP(Integrator_Factory, Integrator_Help);
    } else if (keyword == "Phase") {
        node = new HelpNode(parent, "");
        Phase(NULL).help(node);
    } else if (keyword == "Forces") {
        FOUND_HELP(GenFType, Force_Help);
    } else if (keyword == "Boundaries") {
        FOUND_HELP(Boundary_Factory, Boundary_Help);
    } else if (keyword == "Reflectors") {
        FOUND_HELP(Reflector_Factory, Reflector_Help);
    } else if (keyword == "ParticleCreators") {
      FOUND_HELP(ParticleCreator_Factory, ParticleCreator_Help);
    } else if (keyword == "PairCreators") {
      FOUND_HELP(PairCreator_Factory, PairCreator_Help);
    } else if (keyword == "Meters") {
        FOUND_HELP(Meter_Factory, Meter_Help);
    } else if (keyword == "Postprocessors") {
        FOUND_HELP(Postprocessor_Factory, Postprocessor_Help);
    } else if (keyword == "Callables") {
        FOUND_HELP(Callable_Factory, Callable_Help);
    } else if (keyword == "GridMeters") {
        FOUND_HELP(GridMeter_Factory, GridMeter_Help);
    }

    return node;
}
Beispiel #12
0
//----------------------------------------------------------------------------
//! @brief	  	ビデオを再生する
//----------------------------------------------------------------------------
void __stdcall tTVPDSVideoOverlay::Play()
{
	if( Shutdown ) return;

	HRESULT hr;
	if( FAILED(hr = VideoWindow()->SetWindowPosition( Rect.left, Rect.top,
		Rect.right-Rect.left, Rect.bottom-Rect.top )) )
	{
		ThrowDShowException(L"Failed to call IVideoWindow::SetWindowPosition.", hr);
	}

	if( FAILED(hr = Controller()->Run()) )
	{
		ThrowDShowException(L"Failed to call IMediaControl::Run.", hr);
	}

	if( FAILED(hr = VideoWindow()->SetWindowPosition(Rect.left, Rect.top,
		Rect.right-Rect.left, Rect.bottom-Rect.top)) )
	{
		ThrowDShowException(L"Failed to call IVideoWindow::SetWindowPosition.", hr);
	}
}
Beispiel #13
0
int  main(int argc, char* argv[]) {
	setlocale(LC_ALL, "Russian");
	auto input = Input();
	std::map<int, int> r;
	std::map<int, int> u;
	int p = 0;
	int T = 0;

	
	if (argc < 2) {
		cout << "\n¬и можете вiдкрити програму через консоль: program-name $T r $elements u $elements $p\n";
		input.console(r, u, p, T);
		}
	else {
		input.nice(argc, argv, r, u, p, T);
	}

	auto cont = Controller(r, u, p, T);
	cont.startProcess();
	
	return 0;

}
Beispiel #14
0
int main()
{
	Controller xboxController = Controller(MicrosoftVID, XboxPID, (1 | LIBUSB_ENDPOINT_IN), (2 | LIBUSB_ENDPOINT_OUT));	
	
	if(xboxController.Open())
		printf("Controller opened\n");
	else
		exit(EXIT_FAILURE);
		
	xboxController.ClaimInterface(interfaceNumber);
	
	xboxController.SetLeds(Rotating);
	
	xboxController.SetRumble(100, 100);
	
	printf("\033[2J");
	while(1)
	{
		xboxController.PrintStatus();
		usleep(1000);
	}
	
	return 0;
}
Beispiel #15
0
int main(int argc,char *argv[]){
	int i, j;

	if(argc < 2 ) {
    	printf("USAGE: smk # of times agents runs\n");
    	exit(1);
  	}
  	i = atoi(argv[1]);
  	pthread_t sens[i];
  	pthread_t calc;
  	srand(time(NULL));

 	// create the conditional variable
 	pthread_cond_init(&self, NULL);
	pthread_mutex_init(&SENSORS, NULL);
	/* create locks */
	if (pthread_mutex_init(&SENSORS, NULL)) {
 		perror("pthread_mutex_init");
  		exit(1);
	}

	if (pthread_mutex_init(&CALC, NULL)) {
  		perror("pthread_mutex_init");
  		exit(1);
	}

	//actually create lock on calculator so it doesn't go
   	// before the sensors complete
	if (pthread_mutex_lock(&CALC)) {
  		perror("pthread_mutex_lock");
  		exit(1);
	}

	//initializes LL + contains variables to play with
	Controller();

	/* create sensor threads */
	for(j=0;j<i;j++) {
		//create node with an integer seed for the random number and an ID number
		fprintf(stdout,"creating sensor node\n");
		sensor_t *theSensor = createSensor(rand()%100,j);
		printf("sensor has been added with an random number id of %d and an ID of %d\n", theSensor->ISRN, theSensor->ID);
		
		//create thread to add to LL
		if(pthread_create(&(sens[j]), NULL, (void *)sensor, theSensor)){
			fprintf(stdout,"failing here %d\n",j);
    		perror("pthread_create");
    		exit(1);
		}
		fprintf(stdout,"created sensor %d\n",j);
	}

	puts("starting calculator");
	// kickoff calculator
	if(pthread_create(&(calc), NULL, (void *)calc_temp, NULL)) {
  		fprintf(stdout,"failing here too!");
  		perror("pthread_create");
  		exit(1);
	}

	// wait for calculator to finish
	pthread_join(calc, NULL);
	fprintf(stdout,"Calculator has finished.\n");

	//printf("Sensor count: %d\n", i);
	puts("All done, bye!");
	// exit program now that calc is done 
	exit(0);
 }
//## class Controller
Controller::Controller(IOxfActive* theActiveContext) : EW_GREEN(0), EW_GREENTIME(0), EW_MSG(" "), EW_ORANGE(0), EW_ORANGETIME(0), EW_RED(0), EW_REDTIME(0), LEFT_GREEN(1), NS_GREEN(0), NS_GREENTIME(0), NS_MSG(" "), NS_ORANGE(0), NS_ORANGETIME(0), NS_RED(0), NS_REDTIME(0), x(false), y(false), z(false) {
    NOTIFY_REACTIVE_CONSTRUCTOR(Controller, Controller(), 0, Default_Controller_Controller_SERIALIZE);
    setActiveContext(theActiveContext, false);
    initStatechart();
}
Beispiel #17
0
 Controller::pointer Controller::create ( const Glib::ustring & id )
 {
   PAPYRUS_CREATE( Controller(id) );
 }
Beispiel #18
0
Manager_File::Manager_File(const char *arg) :
	modelObj(Model(arg)),
	controllerObj(Controller(modelObj))
{}
Beispiel #19
0
int main(int, char const**)
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(800, 600), "Gemini", sf::Style::Close);
    
    srand(std::chrono::system_clock::now().time_since_epoch()/std::chrono::milliseconds(1)%10000);
    
    window.setFramerateLimit(40);
    
    unsigned int maxNumberOfThreads = std::thread::hardware_concurrency();
    maxNumberOfThreads = 1;
    
    // Set the Icon
    sf::Image icon;
    if (!icon.loadFromFile(resourcePath() + "icon.png")) {
        return EXIT_FAILURE;
    }
    window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());
    
    Board board;
    board.setRandomArr();
    
    HashTable transpositionTable;
    
    RunAIInput input;
    input.shouldAiBeRunning = false;
    input.transpositionTable = &transpositionTable;
    SearchAICommunicator searchCommunicator[4];
    
    if(maxNumberOfThreads != 1)
    {
        while(input.lock.try_lock()){}
        for(int i=0; i<maxNumberOfThreads; i++)
        {
            searchCommunicator[i].transpositionTable = &transpositionTable;
            input.communicator.push_back(&searchCommunicator[i]);
        }
        input.lock.unlock();
    }
    
    Controller controller = Controller(&input);

    pthread_t aiThread;
    pthread_create(&aiThread, NULL, startAI, (void *)(&input));
    
    bool commandLeft = false;
    bool commandRight = false;
    
    while (window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
            else if(event.type == sf::Event::KeyPressed)
            {
                if(event.key.code == sf::Keyboard::Escape)
                {
                    // Escape pressed : exit
                    while(input.lock.try_lock()){}
                    input.shouldAiBeRunning = false;
                    input.lock.unlock();
                    struct timespec tim, tim2;
                    tim.tv_sec = 0;
                    tim.tv_nsec = 10;      // milliseconds
                    tim.tv_nsec *= 1000000;
                    nanosleep(&tim , &tim2);

                    window.close();
                }
                else if(event.key.code == sf::Keyboard::LSystem)
                {
                    commandLeft = true;
                }
                else if(event.key.code == sf::Keyboard::RSystem)
                {
                    commandRight = true;
                }
                else if((commandLeft || commandRight) && (event.key.code == sf::Keyboard::W || event.key.code == sf::Keyboard::Q))
                {
                    window.close();
                }
                else if(event.key.code == sf::Keyboard::W)
                {
                    if(commandLeft || commandRight)
                    {
                        window.close();
                    }
                }
                else
                {
                    controller.keyDown(event.key.code);
                }
            }
            else if(event.type == sf::Event::KeyReleased)
            {
                if(event.key.code == sf::Keyboard::LSystem)
                {
                    commandLeft = false;
                }
                else if(event.key.code == sf::Keyboard::RSystem)
                {
                    commandRight = false;
                }
                else
                {
                    controller.keyUp(event.key.code);
                }
            }
            else if(event.type == sf::Event::MouseMoved)
            {
                controller.mouseMove(event.mouseMove);
            }
            else if(event.type == sf::Event::MouseButtonPressed)
            {
                controller.mouseDown(event.mouseButton);
            }
            else if(event.type == sf::Event::MouseButtonReleased)
            {
                controller.mouseUp(event.mouseButton);
            }
            else if(event.type == sf::Event::Resized)
            {
                controller.resized(event.size);
            }
            else if(event.type == sf::Event::TextEntered)
            {
                controller.textEntered(event.text.unicode);
            }
        }

        // Clear screen
        window.clear();
        
        controller.frame(&window);
        
        // Update the window
        window.display();
    }

    return EXIT_SUCCESS;
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow){
	namespace hmrv = hmr::viewer;

	SetWindowIconID(ID_ICON);

	//hmLib_dxモジュールを初期化
	dx::ini("hmrV2500_v1_07a", 960,720);

	try{
		//Message
		hmrv::cMessage Message;


		//IO
		//	PCからの出口を管理する 
		hmrv::cIO IO(Message.ComVMC,Message.MessageDriver);

		//各モジュール宣言		
		hmrv::cBattery Battery;
		hmrv::cFullADC FullADC;
		hmrv::cAccele Accele;
		hmrv::cCompass Compass;
		hmrv::cGyro Gyro;
		hmrv::cGPS GPS;
		hmrv::cMotor Motor;
		hmrv::cThermo Thermo;
		hmrv::cCO2 CO2;
		hmrv::cCamera Camera;
		hmrv::cDeviceManage DeviceManage;

		Message.regist('b', Battery.MsgAgent);
		Message.regist('f', FullADC.MsgAgent);
		Message.regist('a', Accele.MsgAgent);
		Message.regist('c', Compass.MsgAgent);
		Message.regist('G', Gyro.MsgAgent);
		Message.regist('g', GPS.MsgAgent);
		Message.regist('m', Motor.MsgAgent);
		Message.regist('t', Thermo.MsgAgent);
		Message.regist('C', CO2.MsgAgent);
		Message.regist('j', Camera.MsgAgent);
		Message.regist('D', DeviceManage.MsgAgent);

		//制御系デバイス
		hmrv::cController Controller;
		Controller.connect_Pad(Motor.MsgAgent);
		Controller.connect_Pad(Battery.MsgAgent);
		Controller.connect_Pad(Accele.MsgAgent);
		Controller.connect_Pad(Compass.MsgAgent);
		Controller.connect_Pad(Gyro.MsgAgent);
		Controller.connect_Pad(GPS.MsgAgent);
		Controller.connect_Pad(Thermo.MsgAgent);
		Controller.connect_Pad(Camera.MsgAgent);
		Controller.connect_Pad(CO2.MsgAgent);

		//親ディレクトリ
		hmrv::cFile File;

		//Batteryデータ保存
		File.regist(Battery.FileAgent);

		//FullADCデータ保存
		File.regist(FullADC.FileAgent);

		// Thermo データを保存
		File.regist(Thermo.FileAgent);

		// CO2 データを保存
		File.regist(CO2.FileAgent);

		//GPSデータを保存
		File.regist(GPS.FileAgent);

		//GPGGAデータを保存
		File.regist(GPS.GPGGAFileAgent);

		//カメラデータを保存
		File.regist(Camera.FileAgent);

		//画面表示モジュール
		hmrv::cView View(IO,Message, FullADC, Accele,Compass,Gyro,Camera,GPS,Battery);

		View.registSUI(DeviceManage.SUI);
		View.registSUI(IO.GateSwSUI);
		View.registSUI(IO.BufGateSUI);
		View.registSUI(IO.ioLogGateSUI);
		View.registSUI(IO.IODriverSUI);
		View.registSUI(IO.VMCSUI);
		View.registSUI(File.SUI);

		View.registMUI(Motor.MUI);
		View.registMUI(Battery.MUI);
		View.registMUI(Accele.MUI);
		View.registMUI(Compass.MUI);
		View.registMUI(Gyro.MUI);
		View.registMUI(GPS.MUI);
		View.registMUI(Thermo.MUI);
		View.registMUI(Camera.MUI);
		View.registMUI(CO2.MUI);
		View.registMUI(FullADC.MUI);

		Controller.connect_Keyboard(View);

		while(!dx::work(30)){
			Controller();
			IO();
			Message();
			View();

			if(dx::getKey(KEY::ESC)<0)break;
		}
	}catch(const std::exception& Escp){
		printfDx("===ERROR===\n");
		printfDx("%s\n",Escp.what());
		while(!dx::work(30)){
			if(dx::getKey(KEY::ESC)<0)break;
		}
	}catch(const std::string& Escp){
		printfDx("===ERROR===\n");
		printfDx("%s\n",Escp.c_str());
		while(!dx::work(30)){
			if(dx::getKey(KEY::ESC)<0)break;
		}
	}

	dx::end();
	
	return 0;

}
Beispiel #21
0
AAX_Result IPlugAAX::EffectInit()
{ 
  TRACE;

  AAX_CString bypassID = NULL;
  this->GetMasterBypassParameter( &bypassID );
  mBypassParameter = new AAX_CParameter<bool>(bypassID.CString(), 
                                              AAX_CString("Master Bypass"), 
                                              false, 
                                              AAX_CBinaryTaperDelegate<bool>(),
                                              AAX_CBinaryDisplayDelegate<bool>("bypass", "on"), 
                                              true);
  mBypassParameter->SetNumberOfSteps( 2 );
  mBypassParameter->SetType( AAX_eParameterType_Discrete );
  mParameterManager.AddParameter(mBypassParameter);
      
  for (int i=0;i<NParams();i++)
  {
    IParam *p = GetParam(i);
    AAX_IParameter* param = 0;
    
    WDL_String* paramID = new WDL_String("_", 1);
    paramID->SetFormatted(32, "%i", i+kAAXParamIdxOffset);
    mParamIDs.Add(paramID);
    
    switch (p->Type()) 
    {
      case IParam::kTypeDouble:
      {
        param = new AAX_CParameter<double>(paramID->Get(), 
                                          AAX_CString(p->GetNameForHost()), 
                                          p->GetDefault(), 
                                          AAX_CIPlugTaperDelegate<double>(p->GetMin(), p->GetMax(), p->GetShape()),
                                          AAX_CUnitDisplayDelegateDecorator<double>( AAX_CNumberDisplayDelegate<double>(), AAX_CString(p->GetLabelForHost())), 
                                          p->GetCanAutomate());
        
        param->SetNumberOfSteps(128); // TODO: check this https://developer.digidesign.com/index.php?L1=5&L2=13&L3=56
        param->SetType(AAX_eParameterType_Continuous);

        break;
      }
      case IParam::kTypeInt:
      {
        param = new AAX_CParameter<int>(paramID->Get(), 
                                        AAX_CString(p->GetNameForHost()), 
                                        (int)p->GetDefault(), 
                                        AAX_CLinearTaperDelegate<int>((int)p->GetMin(), (int)p->GetMax()), 
                                        AAX_CUnitDisplayDelegateDecorator<int>( AAX_CNumberDisplayDelegate<int>(), AAX_CString(p->GetLabelForHost())), 
                                        p->GetCanAutomate());
        
        param->SetNumberOfSteps(128);
        param->SetType(AAX_eParameterType_Continuous);

        break;
      }
      case IParam::kTypeEnum:
      case IParam::kTypeBool: 
      {
        int nTexts = p->GetNDisplayTexts();
        
        std::map<int, AAX_CString> displayTexts;
        
        for (int j=0; j<p->GetNDisplayTexts(); j++) 
        {
          int value;
          const char* text = p->GetDisplayTextAtIdx(j, &value);
          
          displayTexts.insert(std::pair<int, AAX_CString>(value, AAX_CString(text)) );
        }
        
        param = new AAX_CParameter<int>(paramID->Get(), 
                                        AAX_CString(p->GetNameForHost()), 
                                        (int)p->GetDefault(), 
                                        AAX_CLinearTaperDelegate<int>((int)p->GetMin(), (int)p->GetMax()), 
                                        AAX_CStringDisplayDelegate<int>(displayTexts),
                                        p->GetCanAutomate());
        
        param->SetNumberOfSteps(nTexts);
        param->SetType(AAX_eParameterType_Discrete);
                
        break; 
      }
      default:
        break;
    }
    
    mParameterManager.AddParameter(param);    
  }
  
  AAX_CSampleRate sr;
  Controller()->GetSampleRate(&sr);
  SetSampleRate(sr);
  Reset();
  
  return AAX_SUCCESS;
}
Controller Capture::getController()
{
    return Controller(fd_);
}
Beispiel #23
0
void IPlugAAX::SetLatency(int latency)
{
  Controller()->SetSignalLatency(latency);
  
  IPlugBase::SetLatency(latency); // will update delay time
}
Beispiel #24
0
#include "leapInterface.h"

LeapListener g_leapListener = LeapListener();
Controller g_Controller = Controller();


LeapListener::LeapListener(){
}

LeapListener::~LeapListener(){

}

void LeapListener::onInit(const Controller &controller){
	printf("Initialized\n");
}

void LeapListener::onConnect(const Controller &controller){
	controller.enableGesture(Gesture::TYPE_CIRCLE);
	controller.enableGesture(Gesture::TYPE_SWIPE);
	controller.config().setFloat("Gesture.Circle.MinRadius", 5.0);
	controller.config().setFloat("Gesture.Circle.MinArc", 1.8 * PI);
	controller.config().setFloat("Gesture.Swipe.MinLength", 150.0);
	controller.config().setFloat("Gesture.Swipe.MinVelocity", 200);
	controller.config().save();

	printf("Leap Motion is Connected");
}

void LeapListener::onDisconnect(const Controller &controller){
	printf("Disconnected\n");