// <writestatement>		::=	WRITE ( <output value> { , <output value> } )
void SyntaxAnalyzer::writeStatement(std::set<symboltype> followers)
{
    accept(writesy);
    accept(leftparent);
    outputValue();
    
    while (symbol == comma) {
        accept(comma);
        outputValue();
    }
    
    accept(rightparent);
} // writestatement( )
	//sends all messages through ALL server mappings
	void SensorOutput::send() {
		// tick BEFORE sending the note, 
		// since pending note offs are sent immediately if there's a new note on from the next loop.
		for (int i = 0; i < midiMappingsCurlength; i++) {
			if (dropdownMidiMappings[i] != NULL) {
				dropdownMidiMappings[i]->tick();
			}
		}

		//DEBUG_PRINT("SensorOutput::send")
		double outvals[1] = {outputValue()}; //only call once!
		if (outvals[0] != SensorizerServer::SENSOR_VALUE_NULL || cutoffTypeVal == CUTOFF_TYPE_VAL_NULLABLE) {
			//synchronized(dropdownMidiMappings) { 
			
				//DEBUG_PRINT_NUM("SensorOutput::midiMappingsCurlength ", midiMappingsCurlength)
				
				for (int i = 0; i < midiMappingsCurlength; i++) {
					if (dropdownMidiMappings[i] != NULL) {
						//DEBUG_PRINT_NUM("SensorOutput::dropdownMidiMappings->send()", outvals[0])
						dropdownMidiMappings[i]->send(outvals);
					}
				}
			//}
		}
		//DEBUG_PRINT("DONE SensorOutput::send")

	}
示例#3
0
void BinaryCounter::rStateChanged( bool state )
{
	b_reset = state;
	if (b_reset)
	{
		m_value = 0;
		outputValue();
	}
}
示例#4
0
void BinaryCounter::initPins( unsigned numBits )
{
	if ( m_numBits == numBits )
		return;
	
	QStringList pins;
	pins << "en" << ">" << "u/d" << "r";

	{
	int np = abs(4-int(numBits));
	for ( int i = 0; i < np; i++ )
		pins << " ";
	}
	
	for ( int i = numBits-1; i >= 0; i-- )
		pins << QChar('A'+i);
	
	initDIPSymbol( pins, 64 );
	initDIP(pins);
	
	if ( m_numBits < numBits )
	{
		for ( unsigned i = m_numBits; i < numBits; i++ )
			m_pLogicOut[i] = createLogicOut( ecNodeWithID( QChar('A'+i) ), false );
	}
	else
	{
		for ( unsigned i = numBits; i < m_numBits; i++ )
		{
			QString id = QChar('A'+i);
			removeElement( m_pLogicOut[i], false );
			removeDisplayText(id);
			removeNode(id);
		}
	}
	
	m_numBits = numBits;
	m_maxValue = (1<<m_numBits)-1;
	
	if (!m_bDoneLogicIn)
	{
		enLogic = createLogicIn( ecNodeWithID("en") );
		inLogic = createLogicIn( ecNodeWithID(">") );
		rLogic = createLogicIn( ecNodeWithID("r") );
		udLogic = createLogicIn( ecNodeWithID("u/d") );
	
		enLogic->setCallback( this, (CallbackPtr)(&BinaryCounter::enStateChanged) );
		inLogic->setCallback( this, (CallbackPtr)(&BinaryCounter::inStateChanged) );
		rLogic->setCallback( this, (CallbackPtr)(&BinaryCounter::rStateChanged) );
		udLogic->setCallback( this, (CallbackPtr)(&BinaryCounter::udStateChanged) );
		
		m_bDoneLogicIn = true;
	}
	
	outputValue();
}
示例#5
0
void BinaryCounter::inStateChanged( bool state )
{
	if ( (state != b_oldIn) && b_en && !b_reset && state == b_triggerHigh )
	{
		m_value += (b_ud) ? 1 : -1;
		
		if ( m_value < 0 )
			m_value = m_maxValue;
		
		else if ( m_value > m_maxValue )
			m_value = 0;
		
		outputValue();
	}
	
	b_oldIn = state;
}
示例#6
0
void plainconf::outputSigleNode(FILE *fp, const XmlNode *pNode, int level)
{
    outputSpaces(level, fp);
    const char *pStart = pNode->getValue();
    fprintf(fp, "%s ", pNode->getName());

    if (pStart && *pStart)
    {
        const char *p = strchr(pStart, '\n');

        if (p)
        {
            fprintf(fp, "<<<MY_END\n%s\n", pStart);
            outputSpaces(level, fp);
            fprintf(fp, "MY_END");
        }
        else
            outputValue(fp, pStart, strlen(pStart));
    }

    fprintf(fp, "\n");
}