ProjectorShutterBlock::ProjectorShutterBlock(MainController* controller, QString uid) : OneInputBlock(controller, uid) , m_onNode(nullptr) , m_offNode(nullptr) , m_openShutterNode(nullptr) , m_tcpSocket(new QTcpSocket()) , m_ipAddress(this, "ipAddress", "") , m_port(this, "port", 4352, 1, 65535) , m_password(this, "password", "") , m_projectorName(this, "projectorName", "", /*persistent=*/ false) , m_shutterIsOpen(this, "shutterIsOpen", true, /*persistent=*/ false) , m_connected(this, "connected", false, /*persistent=*/ false) , m_authenticated(this, "authenticated", false, /*persistent=*/ false) , m_passwordIsWrong(this, "passwordIsWrong", false, /*persistent=*/ false) , m_powerStatus(this, "powerStatus", 0, /*persistent=*/ false) { m_onNode = createInputNode("on"); m_onNode->enableImpulseDetection(); connect(m_onNode, SIGNAL(impulseBegin()), this, SLOT(turnOn())); m_offNode = createInputNode("off"); m_offNode->enableImpulseDetection(); connect(m_offNode, SIGNAL(impulseBegin()), this, SLOT(turnOff())); m_openShutterNode = createInputNode("openShutter"); m_openShutterNode->enableImpulseDetection(); connect(m_openShutterNode, SIGNAL(impulseBegin()), this, SLOT(turnAvMuteOff())); m_inputNode->enableImpulseDetection(); connect(m_inputNode, SIGNAL(impulseBegin()), this, SLOT(turnAvMuteOn())); m_connectionCheckTimer.setInterval(3*1000); m_connectionCheckTimer.setSingleShot(false); connect(&m_connectionCheckTimer, &QTimer::timeout, this, &ProjectorShutterBlock::checkConnection); m_connectionCheckTimer.start(); // it is required to send a command at least every 30s to hold the connection open // therefore we will query the power status every 5s: m_powerStatusTimer.setInterval(5*1000); m_powerStatusTimer.setSingleShot(false); connect(&m_powerStatusTimer, &QTimer::timeout, this, &ProjectorShutterBlock::checkPower); m_powerStatusTimer.start(); connect(m_tcpSocket, &QTcpSocket::stateChanged, this, &ProjectorShutterBlock::onConnectionStateChanged); connect(m_tcpSocket, &QTcpSocket::readyRead, this, &ProjectorShutterBlock::onMessageReceived); }
AudioPlaybackBlock::AudioPlaybackBlock(MainController* controller, QString uid) : BlockBase(controller, uid) , m_playNode(nullptr) , m_pauseNode(nullptr) , m_toggleNode(nullptr) , m_activeNode(nullptr) , m_endNode(nullptr) , m_positionNode(nullptr) , m_filePath("") , m_lastPlayNodeValue(0.0) , m_lastPauseNodeValue(0.0) , m_lastToggleNodeValue(0.0) , m_alwaysStartAtBegin(false) , m_loop(false) , m_toggleMode(true) , m_player(this) { m_widthIsResizable = true; m_playNode = createInputNode("playNode"); m_pauseNode = createInputNode("pauseNode"); m_toggleNode = createInputNode("toggleNode"); connect(m_playNode, SIGNAL(dataChanged()), this, SLOT(onPlayNodeValueChanged())); connect(m_pauseNode, SIGNAL(dataChanged()), this, SLOT(onPauseNodeValueChanged())); connect(m_toggleNode, SIGNAL(dataChanged()), this, SLOT(onToggleNodeValueChanged())); m_activeNode = createOutputNode("activeNode"); m_endNode = createOutputNode("endNode"); m_positionNode = createOutputNode("positionNode"); // setup Timer to be able to send a short pulse when end of file is reached: m_endPulseTimer.setSingleShot(true); m_endPulseTimer.setInterval(100); connect(&m_endPulseTimer, SIGNAL(timeout()), this, SLOT(onEndPulseTimeout())); connect(&m_player, SIGNAL(endOfFile()), this, SLOT(onEndOfFile())); connect(&m_player, SIGNAL(isPlayingChanged()), this, SIGNAL(isPlayingChanged())); connect(&m_player, SIGNAL(isPlayingChanged()), this, SLOT(onIsPlayingChanged())); connect(&m_player, SIGNAL(positionChanged()), this, SIGNAL(playbackPositionChanged())); connect(&m_player, SIGNAL(positionChanged()), this, SLOT(onPlaybackPositionChanged())); connect(&m_player, SIGNAL(lengthChanged()), this, SIGNAL(lengthChanged())); connect(&m_waveform, SIGNAL(pointsChanged()), this, SIGNAL(waveformChanged())); connect(&m_waveform, SIGNAL(availableChanged()), this, SIGNAL(waveformChanged())); }
PresentationRemoteBlock::PresentationRemoteBlock(MainController* controller, QString uid) : OneInputBlock(controller, uid) , m_prevNode(nullptr) , m_whiteNode(nullptr) , m_blackNode(nullptr) { m_prevNode = createInputNode("prev"); m_whiteNode = createInputNode("white"); m_blackNode = createInputNode("black"); m_inputNode->enableImpulseDetection(); connect(m_inputNode, &NodeBase::impulseBegin, this, &PresentationRemoteBlock::nextSlide); m_prevNode->enableImpulseDetection(); connect(m_prevNode, &NodeBase::impulseBegin, this, &PresentationRemoteBlock::previousSlide); m_whiteNode->enableImpulseDetection(); connect(m_whiteNode, &NodeBase::impulseBegin, this, &PresentationRemoteBlock::whiteSlide); m_blackNode->enableImpulseDetection(); connect(m_blackNode, &NodeBase::impulseBegin, this, &PresentationRemoteBlock::blackSlide); }
XAirAuxBlock::XAirAuxBlock(MainController* controller, QString uid) : OneInputBlock(controller, uid) , m_panNode(nullptr) , m_onNode(nullptr) , m_channelNumber(this, "channelNumber", 1, 1, 32) , m_bus(this, "bus", 0, 0, 16) , m_faderPos(this, "faderPos", 0.0, 0, 1) , m_pan(this, "pan", 0.5) , m_boost(this, "boost", true) , m_on(this, "on", true) , m_pauseValueTransmission(false) { m_heightIsResizable = true; m_panNode = createInputNode("panNode"); m_onNode = createInputNode("onNode"); m_onNode->enableImpulseDetection(); connect(m_onNode, &NodeBase::impulseBegin, [this](){ m_on = true; }); connect(m_onNode, &NodeBase::impulseEnd, [this](){ m_on = false; }); m_subscribeRefreshTimer.setInterval(10000); // 10s connect(&m_subscribeRefreshTimer, SIGNAL(timeout()), this, SLOT(updateSubscription())); m_subscribeRefreshTimer.start(); connect(&m_faderPos, SIGNAL(valueChanged()), this, SIGNAL(decibelChanged())); connect(&m_label, SIGNAL(valueChanged()), this, SLOT(sendName())); connect(&m_faderPos, SIGNAL(valueChanged()), this, SLOT(sendFaderPos())); connect(&m_pan, SIGNAL(valueChanged()), this, SLOT(sendPan())); connect(&m_on, SIGNAL(valueChanged()), this, SLOT(sendOn())); connect(&m_channelNumber, SIGNAL(valueChanged()), this, SLOT(retrieveStateFromConsole())); connect(&m_bus, SIGNAL(valueChanged()), this, SLOT(retrieveStateFromConsole())); connect(m_inputNode, &NodeBase::dataChanged, [this](){ m_faderPos.setValue(m_inputNode->getValue()); }); connect(m_panNode, &NodeBase::dataChanged, [this](){ m_pan.setValue(m_panNode->getValue()); }); connect(controller->audioConsole(), SIGNAL(messageReceived(OSCMessage)), this, SLOT(onMessageReceived(OSCMessage))); }
GDLNode *GDLNode::createGDLNodes(const TokenLine &tokenLine) { GDLNode *node = 0; switch (tokenLine.getType()) { case TOKEN_LINE_BASE: createBaseNode(tokenLine, &node); break; case TOKEN_LINE_DISTINCT: createDistinctNode(tokenLine, &node); break; case TOKEN_LINE_DOES: createDoesNode(tokenLine, &node); break; case TOKEN_LINE_GOAL: createGoalNode(tokenLine, &node); break; case TOKEN_LINE_IF: createIfNode(tokenLine, &node); break; case TOKEN_LINE_INIT: createInitNode(tokenLine, &node); break; case TOKEN_LINE_INPUT: createInputNode(tokenLine, &node); break; case TOKEN_LINE_LEGAL: createLegalNode(tokenLine, &node); break; case TOKEN_LINE_NEXT: createNextNode(tokenLine, &node); break; case TOKEN_LINE_NOT: createNotNode(tokenLine, &node); break; case TOKEN_LINE_OR: createOrNode(tokenLine, &node); break; case TOKEN_LINE_RELATION: createPropositionNode(tokenLine, &node); break; case TOKEN_LINE_TERMINAL: createTerminalNode(&node); break; case TOKEN_LINE_TRUE: createTrueNode(tokenLine, &node); break; case TOKEN_LINE_ROLE: node = createRoleNode(tokenLine); break; default: throw Exception("Syntax error in line: " + tokenLine.toString()); } return node; }
RecorderSlaveBlock::RecorderSlaveBlock(MainController* controller, QString uid) : InOutBlock(controller, uid) , m_linkNode(nullptr) , m_recording(this, "recording", false, /*persistent*/ false) , m_playing(this, "playing", false, /*persistent*/ false) , m_waitingForRecord(this, "waitingForRecord", false, /*persistent*/ false) , m_playbackPosition(0) , m_data() { m_linkNode = createInputNode("link"); m_linkNode->enableImpulseDetection(); connect(m_linkNode, SIGNAL(impulseBegin()), this, SLOT(startAtBegin())); connect(m_controller->engine(), SIGNAL(updateBlocks(double)), this, SLOT(eachFrame())); }
VerticalPatchBlock::VerticalPatchBlock(MainController* controller, QString uid) : BlockBase(controller, uid) { // prepare nodes: m_inputNode = createInputNode("inputNode"); m_outputNode1 = createOutputNode("outputNode1"); m_outputNode2 = createOutputNode("outputNode2"); // set initial requested size: updateRequestedSize(); // connect signals and slots: connect(m_outputNode1, SIGNAL(requestedSizeChanged()), this, SLOT(updateRequestedSize())); connect(m_outputNode2, SIGNAL(requestedSizeChanged()), this, SLOT(updateRequestedSize())); connect(m_inputNode, SIGNAL(dataChanged()), this, SLOT(updateOutput())); }