Пример #1
0
void ItemNetwork::receive(const NetworkPacketRemoveItem& packet)
{
	getController().setEnabled(false);
}
Пример #2
0
void MainWindow::on_actionRedo_triggered()
{
	qobject_cast<ControllerMainWindow*> (getController())->emitRedoCommand();
}
Пример #3
0
void HTTPSessionBase::attachToSessionController() {
  auto controllerPtr = getController();
  if (controllerPtr) {
    controllerPtr->attachSession(this);
  }
}
Пример #4
0
void MainWindow::on_actionAdd_arrow_annotation_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->emitAddArrAnno();
}
Пример #5
0
void MainWindow::on_actionDelete_selected_Annotation_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->emitDelSelAnno();
}
Пример #6
0
void MainWindow::on_actionSelect_all_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->emitSelectAll();
}
Пример #7
0
void MainWindow::on_actionAdd_label_Annotation_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->emitAddLabelAnno();
}
Пример #8
0
void CDVRPTRRepeaterApp::createThread()
{
	wxString callsign, gateway;
	DSTAR_MODE mode;
	ACK_TYPE ack;
	bool restriction, rpt1Validation, dtmfBlanking;
	getCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation, dtmfBlanking);

	IDVRPTRRepeaterThread* thread = NULL;
	switch (mode) {
		case MODE_RXONLY:
			thread = new CDVRPTRRepeaterRXThread;
			break;
		case MODE_TXONLY:
			thread = new CDVRPTRRepeaterTXThread;
			break;
		case MODE_TXANDRX:
			thread = new CDVRPTRRepeaterTXRXThread;
			break;
		default:
			thread = new CDVRPTRRepeaterTRXThread;
			break;
	}

	thread->setCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation, dtmfBlanking);
	wxLogInfo(wxT("Callsign set to \"%s\", gateway set to \"%s\", mode: %d, ack: %d, restriction: %d, RPT1 validation: %d, DTMF blanking: %d"), callsign.c_str(), gateway.c_str(), int(mode), int(ack), int(restriction), int(rpt1Validation), int(dtmfBlanking));

	wxString gatewayAddress, localAddress;
	unsigned int gatewayPort, localPort;
	getNetwork(gatewayAddress, gatewayPort, localAddress, localPort);
	wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u"), gatewayAddress.c_str(), gatewayPort, localAddress.c_str(), localPort);

	if (!gatewayAddress.IsEmpty()) {
		CRepeaterProtocolHandler* handler = new CRepeaterProtocolHandler(gatewayAddress, gatewayPort, localAddress, localPort);

		bool res = handler->open();
		if (!res)
			wxLogError(wxT("Cannot open the protocol handler"));
		else
			thread->setProtocolHandler(handler);
	}

	unsigned int timeout, ackTime;
	getTimes(timeout, ackTime);
	thread->setTimes(timeout, ackTime);
	wxLogInfo(wxT("Timeout set to %u secs, ack time set to %u ms"), timeout, ackTime);

	unsigned int beaconTime;
	wxString beaconText;
	bool beaconVoice;
	TEXT_LANG language;
	getBeacon(beaconTime, beaconText, beaconVoice, language);
	if (mode == MODE_GATEWAY)
		beaconTime = 0U;
	thread->setBeacon(beaconTime, beaconText, beaconVoice, language);
	wxLogInfo(wxT("Beacon set to %u mins, text set to \"%s\", voice set to %d, language set to %d"), beaconTime / 60U, beaconText.c_str(), int(beaconVoice), int(language));

	bool announcementEnabled;
	unsigned int announcementTime;
	wxString announcementRecordRPT1, announcementRecordRPT2;
	wxString announcementDeleteRPT1, announcementDeleteRPT2;
	getAnnouncement(announcementEnabled, announcementTime, announcementRecordRPT1, announcementRecordRPT2, announcementDeleteRPT1, announcementDeleteRPT2);
	if (mode == MODE_GATEWAY)
		announcementEnabled = false;
	thread->setAnnouncement(announcementEnabled, announcementTime, announcementRecordRPT1, announcementRecordRPT2, announcementDeleteRPT1, announcementDeleteRPT2);
	wxLogInfo(wxT("Announcement enabled: %d, time: %u mins, record RPT1: \"%s\", record RPT2: \"%s\", delete RPT1: \"%s\", delete RPT2: \"%s\""), int(announcementEnabled), announcementTime / 60U, announcementRecordRPT1.c_str(), announcementRecordRPT2.c_str(), announcementDeleteRPT1.c_str(), announcementDeleteRPT2.c_str());

	DVRPTR_VERSION modemVersion;
	CONNECTION_TYPE modemType;
	wxString modemUSBPort, modemAddress, modemUSBPath;
	bool rxInvert, txInvert, channel;
	unsigned int modemPort, modLevel, txDelay;
	getModem(modemVersion, modemType, modemUSBPort, modemAddress, modemPort, rxInvert, txInvert, channel, modLevel, txDelay);
	wxLogInfo(wxT("DV-RPTR modem: version: %d, type: %d, USB port: %s, address: %s:%u, RX invert: %d, TX invert: %d, channel: %s, mod level: %u%%, TX delay: %u ms"), int(modemVersion), int(modemType), modemUSBPort.c_str(), modemAddress.c_str(), modemPort, int(rxInvert), int(txInvert), channel ? wxT("B") : wxT("A"), modLevel, txDelay);

	if (modemType == CT_USB) {
		if (!modemUSBPort.IsEmpty()) {
			getModem(modemUSBPath);
			if (!modemUSBPath.IsEmpty())
				wxLogInfo(wxT("DV-RPTR modem: path: %s"), modemUSBPath.c_str());

			IDVRPTRController* controller = NULL;
			switch (modemVersion) {
				case DVRPTR_V1:
					controller = new CDVRPTRControllerV1(modemUSBPort, modemUSBPath, rxInvert, txInvert, channel, modLevel, txDelay);
					break;
				case DVRPTR_V2:
					controller = new CDVRPTRControllerV2(modemUSBPort, modemUSBPath, txInvert, modLevel, mode == MODE_DUPLEX || mode == MODE_TXANDRX, callsign);
					break;
				case DVRPTR_V3:
					controller = new CDVRPTRControllerV3(modemUSBPort, modemUSBPath, txInvert, modLevel, mode == MODE_DUPLEX || mode == MODE_TXANDRX, callsign);
					break;
				default:
					wxLogError(wxT("Unknown DV-RPTR modem version - %d"), int(modemVersion));
					break;
			}

			if (controller != NULL) {
				bool res = controller->open();
				if (!res) {
					wxLogError(wxT("Cannot open the DV-RPTR modem"));
				} else {
					thread->setModem(controller);
					setModem(controller->getPath());
				}
			}
		}
	} else if (modemType == CT_NETWORK) {
		if (!modemAddress.IsEmpty()) {
			CDVRPTRControllerV2* controller = new CDVRPTRControllerV2(modemAddress, modemPort, txInvert, modLevel, mode == MODE_DUPLEX || mode == MODE_TXANDRX, callsign);
			bool res = controller->open();
			if (!res)
				wxLogError(wxT("Cannot open the DV-RPTR modem"));
			else
				thread->setModem(controller);
		}
	}

	wxString controllerType;
	unsigned int activeHangTime;
	getController(controllerType, activeHangTime);
	wxLogInfo(wxT("Controller set to %s, active hang time: %u ms"), controllerType.c_str(), activeHangTime);

	CExternalController* controller = NULL;

	wxString port;
	if (controllerType.StartsWith(wxT("Velleman K8055 - "), &port)) {
		unsigned long num;
		port.ToULong(&num);
		controller = new CExternalController(new CK8055Controller(num));
	} else if (controllerType.StartsWith(wxT("Arduino - "), &port)) {
		controller = new CExternalController(new CArduinoController(port));
#if defined(RASPBERRY_PI)
	} else if (controllerType.IsSameAs(wxT("Raspberry Pi"))) {
		controller = new CExternalController(new CRaspberryController);
#endif
	} else {
		controller = new CExternalController(new CDummyController);
	}

	bool res = controller->open();
	if (!res)
		wxLogError(wxT("Cannot open the hardware interface - %s"), controllerType.c_str());
	else
		thread->setController(controller, activeHangTime);

	bool out1, out2, out3, out4;
	getOutputs(out1, out2, out3, out4);
	thread->setOutputs(out1, out2, out3, out4);
	m_frame->setOutputs(out1, out2, out3, out4);
	wxLogInfo(wxT("Output 1 = %d, output 2 = %d, output 3 = %d, output 4 = %d"), out1, out2, out3, out4);

	bool enabled;
	wxString rpt1Callsign, rpt2Callsign;
	wxString shutdown, startup;
	wxString status1, status2, status3, status4, status5;
	wxString command1, command1Line, command2, command2Line;
	wxString command3, command3Line, command4, command4Line;
	wxString output1, output2, output3, output4;
	getControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4);
	thread->setControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4);
	wxLogInfo(wxT("Control: enabled: %d, RPT1: %s, RPT2: %s, shutdown: %s, startup: %s, status1: %s, status2: %s, status3: %s, status4: %s, status5: %s, command1: %s = %s, command2: %s = %s, command3: %s = %s, command4: %s = %s, output1: %s, output2: %s, output3: %s, output4: %s"), enabled, rpt1Callsign.c_str(), rpt2Callsign.c_str(), shutdown.c_str(), startup.c_str(), status1.c_str(), status2.c_str(), status3.c_str(), status4.c_str(), status5.c_str(), command1.c_str(), command1Line.c_str(), command2.c_str(), command2Line.c_str(), command3.c_str(), command3Line.c_str(), command4.c_str(), command4Line.c_str(), output1.c_str(), output2.c_str(), output3.c_str(), output4.c_str());

	bool logging;
	getLogging(logging);
	thread->setLogging(logging, m_audioDir);
	m_frame->setLogging(logging);
	wxLogInfo(wxT("Frame logging set to %d, in %s"), int(logging), m_audioDir.c_str());

	wxFileName blFilename(wxFileName::GetHomeDir(), BLACKLIST_FILE_NAME);
	bool exists = blFilename.FileExists();
	if (exists) {
		CCallsignList* list = new CCallsignList(blFilename.GetFullPath());
		bool res = list->load();
		if (!res) {
			wxLogError(wxT("Unable to open black list file - %s"), blFilename.GetFullPath().c_str());
			delete list;
		} else {
			wxLogInfo(wxT("%u callsigns loaded into the black list"), list->getCount());
			thread->setBlackList(list);
		}
	}

	wxFileName glFilename(wxFileName::GetHomeDir(), GREYLIST_FILE_NAME);
	exists = glFilename.FileExists();
	if (exists) {
		CCallsignList* list = new CCallsignList(glFilename.GetFullPath());
		bool res = list->load();
		if (!res) {
			wxLogError(wxT("Unable to open grey list file - %s"), glFilename.GetFullPath().c_str());
			delete list;
		} else {
			wxLogInfo(wxT("%u callsigns loaded into the grey list"), list->getCount());
			thread->setGreyList(list);
		}
	}

	// Convert the worker class into a thread
	m_thread = new CDVRPTRRepeaterThreadHelper(thread);
	m_thread->start();
}
Пример #9
0
	void CSPhysXObject_Character::setPosition(vector3df pos)
	{
		PxExtendedVec3 p(pos.X, pos.Y, pos.Z);
		if (getController()) getController()->setPosition(p);
	}
Пример #10
0
void LMRecorder::startRecording() {
	initValues();
	printf("Start recording\n");
	getController().addListener(*this);
}
Пример #11
0
void LMRecorder::stopRecording() {
	ScopedLock closingLock(closingMutex);
	printf("Stop recording\n");
	getController().removeListener(*this);
	gestureStorageDriver->closeConnection();
}
int AlembicImport_Camera(const std::string& path, AbcG::IObject& iObj,
                         alembic_importoptions& options, INode** pMaxNode)
{
    const std::string& identifier = iObj.getFullName();

    if (!AbcG::ICamera::matches(iObj.getMetaData())) {
        return alembic_failure;
    }
    AbcG::ICamera objCamera = AbcG::ICamera(iObj, Abc::kWrapExisting);
    if (!objCamera.valid()) {
        return alembic_failure;
    }
    bool isConstant = objCamera.getSchema().isConstant();

    TimeValue zero(0);

    INode* pNode = *pMaxNode;
    CameraObject* pCameraObj = NULL;
    if (!pNode) {
        // Create the camera object and place it in the scene
        GenCamera* pGenCameraObj =
            GET_MAX_INTERFACE()->CreateCameraObject(FREE_CAMERA);
        if (pGenCameraObj == NULL) {
            return alembic_failure;
        }
        pGenCameraObj->Enable(TRUE);
        pGenCameraObj->SetConeState(TRUE);
        pGenCameraObj->SetManualClip(TRUE);

        IMultiPassCameraEffect* pCameraEffect =
            pGenCameraObj->GetIMultiPassCameraEffect();
        const int TARGET_DISTANCE = 0;
        pCameraEffect->GetParamBlockByID(0)->SetValue(TARGET_DISTANCE, zero, FALSE);

        pCameraObj = pGenCameraObj;

        Abc::IObject parent = iObj.getParent();
        std::string name = removeXfoSuffix(parent.getName().c_str());
        pNode = GET_MAX_INTERFACE()->CreateObjectNode(
                    pGenCameraObj, EC_UTF8_to_TCHAR(name.c_str()));
        if (pNode == NULL) {
            return alembic_failure;
        }
        *pMaxNode = pNode;
    }
    else {
        Object* obj = pNode->EvalWorldState(zero).obj;

        if (obj->CanConvertToType(Class_ID(SIMPLE_CAM_CLASS_ID, 0))) {
            pCameraObj = reinterpret_cast<CameraObject*>(
                             obj->ConvertToType(zero, Class_ID(SIMPLE_CAM_CLASS_ID, 0)));
        }
        else if (obj->CanConvertToType(Class_ID(LOOKAT_CAM_CLASS_ID, 0))) {
            pCameraObj = reinterpret_cast<CameraObject*>(
                             obj->ConvertToType(zero, Class_ID(LOOKAT_CAM_CLASS_ID, 0)));
        }
        else {
            return alembic_failure;
        }
    }

    // Fill in the mesh
    //   alembic_fillcamera_options dataFillOptions;
    //   dataFillOptions.pIObj = &iObj;
    //   dataFillOptions.pCameraObj = pCameraObj;
    //   dataFillOptions.dTicks =  GET_MAX_INTERFACE()->GetTime();
    // AlembicImport_FillInCamera(dataFillOptions);

    // printAnimatables(pCameraObj);

    Interval interval = FOREVER;

    AlembicFloatController* pControl = NULL;
    {
        std::string prop("horizontalFOV");
        if (options.attachToExisting) {
            pControl = getController(pCameraObj, identifier, prop, 0, 0);
        }
        if (pControl) {
            pControl->GetParamBlockByID(0)->SetValue(
                GetParamIdByName(pControl, 0, "path"), zero,
                EC_UTF8_to_TCHAR(path.c_str()));
        }
        else if (assignController(createFloatController(path, identifier, prop),
                                  pCameraObj, 0, 0) &&
                 !isConstant) {
            std::stringstream controllerName;
            controllerName << GET_MAXSCRIPT_NODE(pNode);
            controllerName << "mynode2113.FOV.controller.time";
            AlembicImport_ConnectTimeControl(controllerName.str().c_str(), options);
        }
    }
    {
        std::string prop("FocusDistance");
        if (options.attachToExisting) {
            pControl = getController(pCameraObj, identifier, prop, 1, 0, 1);
        }
        if (pControl) {
            pControl->GetParamBlockByID(0)->SetValue(
                GetParamIdByName(pControl, 0, "path"), zero,
                EC_UTF8_to_TCHAR(path.c_str()));
        }
        else if (assignController(createFloatController(path, identifier, prop),
                                  pCameraObj, 1, 0, 1) &&
                 !isConstant) {
            std::stringstream controllerName;
            controllerName << GET_MAXSCRIPT_NODE(pNode);
            controllerName
                    << "mynode2113.MultiPass_Effect.focalDepth.controller.time";
            AlembicImport_ConnectTimeControl(controllerName.str().c_str(), options);
        }
    }
    {
        std::string prop("NearClippingPlane");
        if (options.attachToExisting) {
            pControl = getController(pCameraObj, identifier, prop, 0, 2);
        }
        if (pControl) {
            pControl->GetParamBlockByID(0)->SetValue(
                GetParamIdByName(pControl, 0, "path"), zero,
                EC_UTF8_to_TCHAR(path.c_str()));
        }
        else if (assignController(createFloatController(path, identifier, prop),
                                  pCameraObj, 0, 2) &&
                 !isConstant) {
            std::stringstream controllerName;
            controllerName << GET_MAXSCRIPT_NODE(pNode);
            controllerName << "mynode2113.nearclip.controller.time";
            AlembicImport_ConnectTimeControl(controllerName.str().c_str(), options);
        }
    }
    {
        std::string prop("FarClippingPlane");
        if (options.attachToExisting) {
            pControl = getController(pCameraObj, identifier, prop, 0, 3);
        }
        if (pControl) {
            pControl->GetParamBlockByID(0)->SetValue(
                GetParamIdByName(pControl, 0, "path"), zero,
                EC_UTF8_to_TCHAR(path.c_str()));
        }
        else if (assignController(createFloatController(path, identifier, prop),
                                  pCameraObj, 0, 3) &&
                 !isConstant) {
            std::stringstream controllerName;
            controllerName << GET_MAXSCRIPT_NODE(pNode);
            controllerName << "mynode2113.farclip.controller.time";
            AlembicImport_ConnectTimeControl(controllerName.str().c_str(), options);
        }
    }

    // if(assignControllerToLevel1SubAnim(createFloatController(path, identifier,
    // std::string("FocusDistance")), pCameraObj, 0, 1) && !isConstant){
    //	AlembicImport_ConnectTimeControl( "$.targetDistance.controller.time",
    // options );
    //}

    createCameraModifier(path, identifier, pNode);

    // Add the new inode to our current scene list
    SceneEntry* pEntry = options.sceneEnumProc.Append(
                             pNode, pCameraObj, OBTYPE_CAMERA, &std::string(iObj.getFullName()));
    options.currentSceneList.Append(pEntry);

    // Set the visibility controller
    AlembicImport_SetupVisControl(path, identifier, iObj, pNode, options);

    importMetadata(pNode, iObj);

    return 0;
}
Пример #13
0
void ItemNetwork::receive(const NetworkPacketAddItem& packet)
{
	DrawableNetwork::receive(packet);

	getController().setEnabled(true);
}
Пример #14
0
void ItemNetwork::receive(const NetworkPacketCollectItem& packet)
{
	getController().collectItem(packet.getItemType());
}
Пример #15
0
void MainWindow::on_actionDelete_selected_tracks_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->emitDeleteSelectedTracks();
}
bool EventListenerController::init()
{
    auto listener = [this](Event* event){
        auto evtController = static_cast<EventController*>(event);
        if (evtController->getControllerEventType() == EventController::ControllerEventType::CONNECTION)
        {
            if (evtController->isConnected())
            {
                if (this->onConnected)
                    this->onConnected(evtController->getController(), event);
            }
            else
            {
                if (this->onDisconnected)
                    this->onDisconnected(evtController->getController(), event);
            }
        }
        else
        {
            switch (evtController->getControllerEventType()) {
                case EventController::ControllerEventType::BUTTON_STATUS_CHANGED:
                    {
                        auto button = static_cast<ControllerButtonInput*>(evtController->getControllerElement());

                        if (this->onButtonPressed && button->isPressed() && !button->isPrevStatusPressed())
                        {
                            this->onButtonPressed(evtController->getController(), button, event);
                        }
                        else if (this->onButtonReleased && !button->isPressed() && button->isPrevStatusPressed())
                        {
                            this->onButtonReleased(evtController->getController(), button, event);
                        }
                        
                        if (this->onButtonValueChanged)
                        {
                            this->onButtonValueChanged(evtController->getController(), button, event);
                        }
                    }
                    break;
                case EventController::ControllerEventType::AXIS_STATUS_CHANGED:
                    {
                        if (this->onAxisValueChanged)
                        {
                            auto axis = static_cast<ControllerAxisInput*>(evtController->getControllerElement());
                            this->onAxisValueChanged(evtController->getController(), axis, event);
                        }
                    }
                    break;
                default:
                    CCASSERT(false, "Invalid EventController type");
                    break;
            }
        }
    };
    
    if (EventListener::init(EventListener::Type::GAME_CONTROLLER, LISTENER_ID, listener))
    {
        return true;
    }
    return false;
}
Пример #17
0
void MainWindow::on_actionSwap_ID_s_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->emitSwapIds();

}
Пример #18
0
void CDExtraClientApp::createThread()
{
	m_thread = new CDExtraClientThread;
	m_thread->Create();
	m_thread->Run();

	wxString callsign;
	getCallsign(callsign);
	m_thread->setCallsign(callsign);

	wxString message;
	getMessage(message);
	m_thread->setMessage(message);

	wxString device;
	getDVDongle(device);

	if (!device.IsEmpty()) {
		CDVDongleController* dongle = new CDVDongleController(new CSerialDataController(device, SERIAL_230400));

		bool res = dongle->open();
		if (!res) {
			wxLogError(wxT("Can't find the DV-Dongle on the port specified"));
			error(_("Can't find the DV-Dongle on the port specified"));
		} else {
			m_thread->setDVDongle(dongle);
		}
	}

	wxString readDevice, writeDevice;
	getSoundcard(readDevice, writeDevice);

	if (!readDevice.IsEmpty() && !writeDevice.IsEmpty()) {
#if defined(__WINDOWS__)
		CSoundCardReaderWriter* soundcard = new CSoundCardReaderWriter(readDevice, writeDevice, DSTAR_RADIO_SAMPLE_RATE, DSTAR_RADIO_BLOCK_SIZE);
#else
		CSoundCardReaderWriter* soundcard = new CSoundCardReaderWriter(readDevice, writeDevice, DSTAR_RADIO_SAMPLE_RATE, 64U);
#endif
		soundcard->setCallback(m_thread, 0);

		bool res = soundcard->open();
		if (!res) {
			wxLogError(wxT("Cannot open the sound card"));
			error(_("Cannot open the sound card"));
		} else {
			m_thread->setSoundCard(soundcard);
		}
	}

	bool bleep;
	getBleep(bleep);
	m_thread->setBleep(bleep);

	wxString type;
	unsigned int audioDelay;
	bool squelchInvert, pttInvert;
	getController(type, audioDelay, squelchInvert, pttInvert);

	IExternalController* controller = NULL;

	wxString port;
	if (type.StartsWith(wxT("Velleman K8055 - "), &port)) {
		unsigned long num;
		port.ToULong(&num);
		controller = new CK8055Controller(num);
	} else if (type.StartsWith(wxT("URI USB - "), &port)) {
		unsigned long num;
		port.ToULong(&num);
		controller = new CURIUSBController(num);
	} else if (type.StartsWith(wxT("Serial - "), &port)) {
		controller = new CSerialController(port);
	} else {
		controller = new CDummyController;
	}

	bool res = controller->open();
	if (!res)
		wxLogError(wxT("Cannot open the hardware interface - %s"), type.c_str());
	else
		m_thread->setController(controller, audioDelay, pttInvert, squelchInvert);
}
Пример #19
0
void MainWindow::on_actionChange_the_fill_color_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->emitChangeColorFill();
}
Пример #20
0
void VoicerUGenInternal::processBlock(bool& shouldDelete, const unsigned int blockID, const int /*channel*/) throw()
{	
	if(shouldStopAllEvents() == true) initEvents();
	
	if(midiMessages.isEmpty() == true)
	{
		const ScopedLock sl(lock);
		SpawnBaseUGenInternal::processBlock(shouldDelete, blockID, -1);
	}
	else
	{
		const int blockSize = uGenOutput.getBlockSize();
		MidiBuffer::Iterator iter(midiMessages);
		MidiMessage message(0xf4, 0.0);
		
		int samplePos = 0;
		int startSample = 0;
		
		const int numChannels = getNumChannels();
		const int midiChannel = midiChannel_;
		
		while(iter.getNextEvent(message, samplePos) && (samplePos < blockSize))
		{
			const ScopedLock sl(lock);
				
			if(samplePos < 0) samplePos = 0;
			
			const int numSamples = samplePos - startSample;
		
			if(numSamples > 0)
			{				
				for(int channel = 0; channel < numChannels; channel++)
				{
					bufferData[channel] = proxies[channel]->getSampleData() + startSample;
				}
				
				mixer.prepareForBlock(numSamples, blockID + startSample, -1);
				mixer.setOutputs(bufferData, numSamples, numChannels);
				mixer.processBlock(shouldDelete, blockID + startSample, -1);				
			}
			
			startSample = samplePos;
			
			if(message.isForChannel(midiChannel))
			{
				if(message.isNoteOnOrOff())
				{
					const int midiNote = message.getNoteNumber();
					const int velocity = message.getVelocity();
										
					if(velocity > 0)
					{
						if(numVoices_ > 0)
						{
							const int voicesUsed = countNonstealingVoices();
							if(voicesUsed >= numVoices_)
							{
								UGen stealee = chooseStealee();
								
								if(stealee.isNotNull())
								{
									stealee.userData = stealingUserData;
									stealee.steal(forcedSteal_);
								}
							}
						}
						
						// stop double notes, AU lab was sending two ons but one off - seems fixed in Au Lab 2.2
						//stealNote(midiChannel, midiNote, false, true); 
						
						UGen newEvent = spawnEvent(*this, currentEventIndex++, midiChannel, midiNote, velocity);
						newEvent.userData = createUserData(midiChannel, midiNote);
						events.add(newEvent);
					}
					else
					{
						UGen releasee = chooseReleasee(midiChannel, midiNote);
						if(releasee.isNotNull()) releasee.release();
					}
				}
				else if(message.isController())
				{
					getController(message.getControllerNumber()) = message.getControllerValue() / 127.f;
				}
				else if(message.isPitchWheel())
				{
					getPitchWheel() = (jlimit(-8191, 8191, message.getPitchWheelValue() - 8192) / 8191.f);
				}
				else if(message.isChannelPressure())
				{
					getChannelPressure() = (message.getChannelPressureValue() / 127.f);
				}
				else if(message.isAftertouch())
				{
					getKeyPressure(message.getNoteNumber()) = (message.getAfterTouchValue() / 127.f);
				}
				else if(message.isProgramChange())
				{
					getProgram() = (message.getProgramChangeNumber());
				}
				else if(message.isAllNotesOff())
				{
					initEvents();
				}
			}
		}
		
		const ScopedLock sl(lock);
		
		const int numSamples = blockSize - startSample;
		
		if(numSamples > 0)
		{			
			for(int channel = 0; channel < numChannels; channel++)
			{
				bufferData[channel] = proxies[channel]->getSampleData() + startSample;
			}
			
			mixer.prepareForBlock(numSamples, blockID + startSample, -1);
			mixer.setOutputs(bufferData, numSamples, numChannels);
			mixer.processBlock(shouldDelete, blockID + startSample, -1);
		}
				
		midiMessages.clear();
		events.removeNulls();
	}	
}
Пример #21
0
void MainWindow::on_actionAdd_rectangular_annotation_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->emitAddRectAnno();
}
void CSoundCardRepeaterApp::createThread()
{
	wxString callsign, gateway;
	DSTAR_MODE mode;
	ACK_TYPE ack;
	bool restriction, rpt1Validation;
	getCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation);

	switch (mode) {
		case MODE_RXONLY:
			m_thread = new CSoundCardRepeaterRXThread;
			break;
		case MODE_TXONLY:
			m_thread = new CSoundCardRepeaterTXThread;
			break;
		case MODE_TXANDRX:
			m_thread = new CSoundCardRepeaterTXRXThread;
			break;
		default:
			m_thread = new CSoundCardRepeaterTRXThread;
			break;
	}

	m_thread->setCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation);
	wxLogInfo(wxT("Callsign set to \"%s\", gateway set to \"%s\", mode: %d, ack: %d, restriction: %d, RPT1 validation: %d"), callsign.c_str(), gateway.c_str(), int(mode), int(ack), restriction, rpt1Validation);

	wxString gatewayAddress, localAddress;
	unsigned int gatewayPort, localPort;
	getNetwork(gatewayAddress, gatewayPort, localAddress, localPort);
	wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u"), gatewayAddress.c_str(), gatewayPort, localAddress.c_str(), localPort);

	if (!gatewayAddress.IsEmpty()) {
		CRepeaterProtocolHandler* handler = new CRepeaterProtocolHandler(gatewayAddress, gatewayPort, localAddress, localPort);

		bool res = handler->open();
		if (!res)
			wxLogError(wxT("Cannot open the protocol handler"));
		else
			m_thread->setProtocolHandler(handler);
	}

	unsigned int timeout, ackTime, hangTime;
	getTimes(timeout, ackTime, hangTime);
	m_thread->setTimes(timeout, ackTime, hangTime);
	wxLogInfo(wxT("Timeout set to %u secs, Ack time set to %u ms, Hang time set to %u ms"), timeout, ackTime, hangTime);

	unsigned int beaconTime;
	wxString beaconText;
	bool beaconVoice;
	TEXT_LANG language;
	getBeacon(beaconTime, beaconText, beaconVoice, language);
	m_thread->setBeacon(beaconTime, beaconText, beaconVoice, language);
	wxLogInfo(wxT("Beacon set to %u mins, text set to \"%s\", voice set to %d, language set to %d"), beaconTime / 60U, beaconText.c_str(), int(beaconVoice), int(language));

	wxString readDevice, writeDevice;
	bool rxInvert, txInvert;
	wxFloat32 rxLevel, txLevel, squelchLevel;
	SQUELCH_MODE squelchMode;
	getRadio(readDevice, writeDevice, rxLevel, txLevel, squelchMode, squelchLevel, rxInvert, txInvert);
	wxLogInfo(wxT("Soundcard set to %s:%s, levels: %.2f:%.2f, GMSK Inversion set to %d:%d, squelch: mode: %d level: %.2f"), readDevice.c_str(), writeDevice.c_str(), rxLevel, txLevel, rxInvert, txInvert, int(squelchMode), squelchLevel);

	if (!readDevice.IsEmpty() && !writeDevice.IsEmpty()) {
#if defined(__WINDOWS__)
		CSoundCardReaderWriter* soundcard = new CSoundCardReaderWriter(readDevice, writeDevice, DSTAR_RADIO_SAMPLE_RATE, DSTAR_RADIO_BLOCK_SIZE);
#else
		CSoundCardReaderWriter* soundcard = new CSoundCardReaderWriter(readDevice, writeDevice, DSTAR_RADIO_SAMPLE_RATE, 64U);
#endif
		soundcard->setCallback(m_thread, 0U);

		bool res = soundcard->open();
		if (!res)
			wxLogError(wxT("Cannot open the sound card"));
		else
			m_thread->setSoundCard(soundcard, rxLevel, txLevel, squelchMode, squelchLevel, rxInvert, txInvert);
	}

	wxString type;
	unsigned int cfg;
	int pttDelay;
	bool pttInvert;
	getController(type, cfg, pttDelay, pttInvert);
	wxLogInfo(wxT("Controller set to %s, config: %u, ptt delay: %d ms, PTT Inversion set to %d"), type.c_str(), cfg, pttDelay * 20, pttInvert);

	CExternalController* controller = NULL;

	wxString port;
	if (type.StartsWith(wxT("Velleman K8055 - "), &port)) {
		unsigned long num;
		port.ToULong(&num);
		controller = new CExternalController(new CK8055Controller(num), pttInvert, false);
	} else if (type.StartsWith(wxT("URI USB - "), &port)) {
		unsigned long num;
		port.ToULong(&num);
		controller = new CExternalController(new CURIUSBController(num, false), pttInvert, false);
	} else if (type.StartsWith(wxT("Serial - "), &port)) {
		controller = new CExternalController(new CSerialController(port, cfg), pttInvert, false);
	} else {
		controller = new CExternalController(new CDummyController, pttInvert, false);
	}

	bool res = controller->open();
	if (!res)
		wxLogError(wxT("Cannot open the hardware interface - %s"), type.c_str());
	else
		m_thread->setController(controller, pttDelay);

	bool out1, out2, out3, out4;
	getOutputs(out1, out2, out3, out4);
	m_thread->setOutputs(out1, out2, out3, out4);
	m_frame->setOutputs(out1, out2, out3, out4);
	wxLogInfo(wxT("Output 1 = %d, output 2 = %d, output 3 = %d, output 4 = %d"), out1, out2, out3, out4);

	bool enabled;
	wxString rpt1Callsign, rpt2Callsign;
	wxString shutdown, startup;
	wxString status1, status2, status3, status4, status5;
	wxString command1, command1Line, command2, command2Line;
	wxString command3, command3Line, command4, command4Line;
	wxString output1, output2, output3, output4;
	getControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4);
	m_thread->setControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4);
	wxLogInfo(wxT("Control: enabled: %d, RPT1: %s, RPT2: %s, shutdown: %s, startup: %s, status1: %s, status2: %s, status3: %s, status4: %s, status5: %s, command1: %s = %s, command2: %s = %s, command3: %s = %s, command4: %s = %s, output1: %s, output2: %s, output3: %s, output4: %s"), enabled, rpt1Callsign.c_str(), rpt2Callsign.c_str(), shutdown.c_str(), startup.c_str(), status1.c_str(), status2.c_str(), status3.c_str(), status4.c_str(), status5.c_str(), command1.c_str(), command1Line.c_str(), command2.c_str(), command2Line.c_str(), command1.c_str(), command1Line.c_str(), command2.c_str(), command2Line.c_str(), command3.c_str(), command3Line.c_str(), command4.c_str(), command4Line.c_str(), output1.c_str(), output2.c_str(), output3.c_str(), output4.c_str());

	unsigned int activeHangTime;
	getActiveHang(activeHangTime);
	m_thread->setActiveHang(activeHangTime);
	wxLogInfo(wxT("Active Hang: time: %u"), activeHangTime);

	bool logging;
	getLogging(logging);
	m_thread->setLogging(logging, ::wxGetHomeDir());
	m_frame->setLogging(logging);
	wxLogInfo(wxT("Frame logging set to %d, in %s"), int(logging), ::wxGetHomeDir().c_str());

	wxFileName wlFilename(wxFileName::GetHomeDir(), WHITELIST_FILE_NAME);
	bool exists = wlFilename.FileExists();
	if (exists) {
		CCallsignList* list = new CCallsignList(wlFilename.GetFullPath());
		bool res = list->load();
		if (!res) {
			wxLogError(wxT("Unable to open white list file - %s"), wlFilename.GetFullPath().c_str());
			delete list;
		} else {
			wxLogInfo(wxT("%u callsigns loaded into the white list"), list->getCount());
			m_thread->setWhiteList(list);
		}
	}

	wxFileName blFilename(wxFileName::GetHomeDir(), BLACKLIST_FILE_NAME);
	exists = blFilename.FileExists();
	if (exists) {
		CCallsignList* list = new CCallsignList(blFilename.GetFullPath());
		bool res = list->load();
		if (!res) {
			wxLogError(wxT("Unable to open black list file - %s"), blFilename.GetFullPath().c_str());
			delete list;
		} else {
			wxLogInfo(wxT("%u callsigns loaded into the black list"), list->getCount());
			m_thread->setBlackList(list);
		}
	}

	m_thread->start();
}
Пример #23
0
void MainWindow::on_actionAdd_elliptical_annotation_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->emitAddEllAnno();
}
Пример #24
0
void MainWindow::closeEvent(QCloseEvent *event) {
	qobject_cast<ControllerMainWindow*> (getController())->exit();
}
Пример #25
0
void MainWindow::on_actionQuit_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->exit();
}
Пример #26
0
void MainWindow::receiveSelectedCameraDevice(CameraConfiguration conf) {
	qobject_cast<ControllerMainWindow*> (getController())->loadCameraDevice(conf);

}
Пример #27
0
void MainWindow::on_actionShowActionList_triggered()
{
	qobject_cast<ControllerMainWindow*> (getController())->emitShowActionListCommand();
}
Пример #28
0
//////////////////////////utility toolbar action slots///////////////////////////
void MainWindow::on_actionAdd_Track_triggered() {
	qobject_cast<ControllerMainWindow*> (getController())->emitAddTrack();
}
void CGMSKRepeaterApp::createThread()
{
	wxString callsign, gateway;
	DSTAR_MODE mode;
	ACK_TYPE ack;
	bool restriction, rpt1Validation;
	getCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation);

	IGMSKRepeaterThread* thread = NULL;
	switch (mode) {
		case MODE_RXONLY:
			thread = new CGMSKRepeaterRXThread;
			break;
		case MODE_TXONLY:
			thread = new CGMSKRepeaterTXThread;
			break;
		case MODE_TXANDRX:
			thread = new CGMSKRepeaterTXRXThread;
			break;
		default:
			thread = new CGMSKRepeaterTRXThread;
			break;
	}

	thread->setCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation);
	wxLogInfo(wxT("Callsign set to \"%s\", gateway set to \"%s\", mode: %d, ack: %d, restriction: %d, RPT1 validation: %d"), callsign.c_str(), gateway.c_str(), int(mode), int(ack), restriction, rpt1Validation);

	wxString gatewayAddress, localAddress;
	unsigned int gatewayPort, localPort;
	getNetwork(gatewayAddress, gatewayPort, localAddress, localPort);
	wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u"), gatewayAddress.c_str(), gatewayPort, localAddress.c_str(), localPort);

	if (!gatewayAddress.IsEmpty()) {
		CRepeaterProtocolHandler* handler = new CRepeaterProtocolHandler(gatewayAddress, gatewayPort, localAddress, localPort);

		bool res = handler->open();
		if (!res)
			wxLogError(wxT("Cannot open the protocol handler"));
		else
			thread->setProtocolHandler(handler);
	}

	unsigned int timeout, ackTime;
	getTimes(timeout, ackTime);
	thread->setTimes(timeout, ackTime);
	wxLogInfo(wxT("Timeout set to %u secs, ack time set to %u ms"), timeout, ackTime);

	unsigned int beaconTime;
	wxString beaconText;
	bool beaconVoice;
	TEXT_LANG language;
	getBeacon(beaconTime, beaconText, beaconVoice, language);
	thread->setBeacon(beaconTime, beaconText, beaconVoice, language);
	wxLogInfo(wxT("Beacon set to %u mins, text set to \"%s\", voice set to %d, language set to %d"), beaconTime / 60U, beaconText.c_str(), int(beaconVoice), int(language));

	GMSK_MODEM_TYPE modemType;
	unsigned int modemAddress;
	getModem(modemType, modemAddress);

#if defined(WIN32)
	IGMSKModem* modem = NULL;
	switch (modemType) {
		case GMT_LIBUSB:
			wxLogInfo(wxT("GMSK modem: type: LibUsb, address: 0x%04X"), modemAddress);
			modem =	new CGMSKModemLibUsb(modemAddress);
			break;
		case GMT_WINUSB:
			wxLogInfo(wxT("GMSK modem: type: WinUSB, address: 0x%04X"), modemAddress);
			modem =	new CGMSKModemWinUSB(modemAddress);
			break;
		default:
			wxLogError(wxT("Unknown GMSK Modem type - %d"), int(modemType));
			break;
	}
#else
	wxLogInfo(wxT("GMSK modem: type: LibUsb, address: 0x%04X"), modemAddress);
	IGMSKModem* modem =	new CGMSKModemLibUsb(modemAddress);
#endif

	if (modem != NULL) {
		bool res = modem->open();
		if (!res)
			wxLogError(wxT("Cannot open the GMSK modem"));
		else
			thread->setModem(modem);
	}

	wxString controllerType;
	unsigned int activeHangTime;
	getController(controllerType, activeHangTime);
	wxLogInfo(wxT("Controller set to %s, active hang time: %u ms"), controllerType.c_str(), activeHangTime);

	CExternalController* controller = NULL;

	wxString port;
	if (controllerType.StartsWith(wxT("Velleman K8055 - "), &port)) {
		unsigned long num;
		port.ToULong(&num);
		controller = new CExternalController(new CK8055Controller(num), false, false);
	} else {
		controller = new CExternalController(new CDummyController, false, false);
	}

	bool res = controller->open();
	if (!res)
		wxLogError(wxT("Cannot open the hardware interface - %s"), controllerType.c_str());
	else
		thread->setController(controller, activeHangTime);

	bool out1, out2, out3, out4;
	getOutputs(out1, out2, out3, out4);
	thread->setOutputs(out1, out2, out3, out4);
	m_frame->setOutputs(out1, out2, out3, out4);
	wxLogInfo(wxT("Output 1 = %d, output 2 = %d, output 3 = %d, output 4 = %d"), out1, out2, out3, out4);

	bool enabled;
	wxString rpt1Callsign, rpt2Callsign;
	wxString shutdown, startup;
	wxString status1, status2, status3, status4, status5;
	wxString command1, command1Line, command2, command2Line;
	wxString command3, command3Line, command4, command4Line;
	wxString output1, output2, output3, output4;
	getControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4);
	thread->setControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4);
	wxLogInfo(wxT("Control: enabled: %d, RPT1: %s, RPT2: %s, shutdown: %s, startup: %s, status1: %s, status2: %s, status3: %s, status4: %s, status5: %s, command1: %s = %s, command2: %s = %s, command3: %s = %s, command4: %s = %s, output1: %s, output2: %s, output3: %s, output4: %s"), enabled, rpt1Callsign.c_str(), rpt2Callsign.c_str(), shutdown.c_str(), startup.c_str(), status1.c_str(), status2.c_str(), status3.c_str(), status4.c_str(), status5.c_str(), command1.c_str(), command1Line.c_str(), command2.c_str(), command2Line.c_str(), command3.c_str(), command3Line.c_str(), command4.c_str(), command4Line.c_str(), output1.c_str(), output2.c_str(), output3.c_str(), output4.c_str());

	bool logging;
	getLogging(logging);
	thread->setLogging(logging, ::wxGetHomeDir());
	m_frame->setLogging(logging);
	wxLogInfo(wxT("Frame logging set to %d, in %s"), int(logging), ::wxGetHomeDir().c_str());

	wxFileName wlFilename(wxFileName::GetHomeDir(), WHITELIST_FILE_NAME);
	bool exists = wlFilename.FileExists();
	if (exists) {
		CCallsignList* list = new CCallsignList(wlFilename.GetFullPath());
		bool res = list->load();
		if (!res) {
			wxLogError(wxT("Unable to open white list file - %s"), wlFilename.GetFullPath().c_str());
			delete list;
		} else {
			wxLogInfo(wxT("%u callsigns loaded into the white list"), list->getCount());
			thread->setWhiteList(list);
		}
	}

	wxFileName blFilename(wxFileName::GetHomeDir(), BLACKLIST_FILE_NAME);
	exists = blFilename.FileExists();
	if (exists) {
		CCallsignList* list = new CCallsignList(blFilename.GetFullPath());
		bool res = list->load();
		if (!res) {
			wxLogError(wxT("Unable to open black list file - %s"), blFilename.GetFullPath().c_str());
			delete list;
		} else {
			wxLogInfo(wxT("%u callsigns loaded into the black list"), list->getCount());
			thread->setBlackList(list);
		}
	}

	// Convert the worker class into a thread
	m_thread = new CGMSKRepeaterThreadHelper(thread);
	m_thread->start();
}
Пример #30
0
void Game::idle()
{
    struct timeb now;
    ftime(&now);
    ellapsed=(now.time-last.time)*1000.0+now.millitm-last.millitm;
    last=now;
    if(state==IGame::Running)
    {
        for(unsigned int i=0;i<gluts.size();i++)
        {
            gluts.at(i)->idle(*this);
        }
        for(unsigned int i=0;i<ghosts.size();i++)
        {
            IGhost *g=ghosts.at(i);
            if(!i){g->speed(getStressPercent()*getPacman()->speed()*1.5);}
            int x=(int)(pacman->X()/map->width())-(int)(g->X()/map->width());
            int y=(int)(pacman->Y()/map->height())-(int)(g->Y()/map->height());
            if(!x) if(!y)
            {
                if(g->scared())
                {
                    addScore(100);
                    g->scared(false);
                    g->setDirection(0,0);
                    g->X((map->cols()/2.0+0.5)*map->width());
                    g->Y((map->rows()/2.0-1+0.5)*map->height());
                }
                else
                {
                    lives--;
                    if(lives<=0)
                    {
                        state=IGame::GameOver;
                    }
                    else
                    {
                        getPacman()->X((map->cols()/2+0.5)*map->width());
                        getPacman()->Y(1.5*map->height());
                    }
                }
            }
        }
        bool food=false;
        for(int y=0;y<map->rows();y++)
            for(int x=0;x<map->cols();x++)
                if(map->matrix()[x][y]==IMap::TileFood) food=true;
        if(food==false)
        {
            state=Game::Win;
        }
    }
    else if(state==IGame::GameOver)
    {
        if(getController()->button())
        {
            state=IGame::Reset;
        }
    }
    else if(state==IGame::Win)
    {
        if(getController()->button())
        {
            state=IGame::Start;
        }
    }
    else if(state==IGame::Reset)
    {
        state=IGame::Start;
        lives=3;
        score=0;
        levels.clear();

        levels.push_back(new Level(15+8,11+8,3,new MiniMaxArtificialIntelligence()));
        levels.push_back(new Level(15+8,11+8,3,new DistanceArtificialIntelligence()));
        levels.push_back(new Level(15+8,11+8,3,new FakeArtificialIntelligence()));
        levels.push_back(new Level(15+8,11+8,3,new AleatoryArtificialIntelligence()));

        levels.push_back(new Level(15+4,11+4,3,new MiniMaxArtificialIntelligence()));
        levels.push_back(new Level(15+4,11+4,3,new DistanceArtificialIntelligence()));
        levels.push_back(new Level(15+4,11+4,3,new FakeArtificialIntelligence()));
        levels.push_back(new Level(15+4,11+4,3,new AleatoryArtificialIntelligence()));

        levels.push_back(new Level(15,11,3,new MiniMaxArtificialIntelligence()));
        levels.push_back(new Level(15,11,3,new DistanceArtificialIntelligence()));
        levels.push_back(new Level(15,11,3,new FakeArtificialIntelligence()));
        levels.push_back(new Level(15,11,3,new AleatoryArtificialIntelligence()));
        ftime(&last);
    }
    else if(state==IGame::Start)
    {
        if(levels.size()==0)
        {
            state=IGame::GameOver;
        }
        else
        {
            Level* level=levels.back();
            levels.pop_back();
            // AI
            if(ai)
            {
                gluts.erase(std::remove(gluts.begin(), gluts.end(), ai), gluts.end());
    //            delete ai;
            }
            ai=level->ai;
            gluts.push_back(ai);
            // Controller
            if(controller)
            {
                gluts.erase(std::remove(gluts.begin(), gluts.end(), controller), gluts.end());
    //            delete controller;
            }
    #ifdef USE_QT
            controller=new ArduinoController();
    #else
            controller=new KeyboardController();
    #endif
            gluts.push_back(controller);

            map->setup(*this,level->cols,level->rows,level->width,level->height);
            state=IGame::Running;
            heuris = new HeuristicFunction(map);
        }
    }
    glutPostRedisplay();
}