Ejemplo n.º 1
0
bool QLCFixtureMode::loadXML(const QDomElement& root)
{
    if (root.tagName() != KXMLQLCFixtureMode)
    {
        qWarning() << Q_FUNC_INFO << "Mode tag not found";
        return false;
    }

    /* Mode name */
    QString str = root.attribute(KXMLQLCFixtureModeName);
    if (str.isEmpty() == true)
    {
        qWarning() << Q_FUNC_INFO << "Mode has no name";
        return false;
    }
    else
    {
        setName(str);
    }

    /* Subtags */
    QDomNode node = root.firstChild();
    while (node.isNull() == false)
    {
        QDomElement tag = node.toElement();
        if (tag.tagName() == KXMLQLCFixtureModeChannel)
        {
            /* Channel */
            Q_ASSERT(m_fixtureDef != NULL);
            str = tag.attribute(KXMLQLCFixtureModeChannelNumber);
            insertChannel(m_fixtureDef->channel(tag.text()),
                          str.toInt());
        }
        else if (tag.tagName() == KXMLQLCFixtureHead)
        {
            /* Head */
            QLCFixtureHead head;
            if (head.loadXML(tag) == true)
                insertHead(-1, head);
        }
        else if (tag.tagName() == KXMLQLCPhysical)
        {
            /* Physical */
            QLCPhysical physical;
            physical.loadXML(tag);
            setPhysical(physical);
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown Fixture Mode tag:" << tag.tagName();
        }

        node = node.nextSibling();
    }

    // Cache all head channels
    cacheHeads();

    return true;
}
Ejemplo n.º 2
0
int QLCFixtureMode_Test::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: initTestCase(); break;
        case 1: fixtureDef(); break;
        case 2: name(); break;
        case 3: physical(); break;
        case 4: insertChannel(); break;
        case 5: removeChannel(); break;
        case 6: channelByName(); break;
        case 7: channelByIndex(); break;
        case 8: channels(); break;
        case 9: channelNumber(); break;
        case 10: copy(); break;
        case 11: load(); break;
        case 12: loadWrongRoot(); break;
        case 13: loadNoName(); break;
        case 14: save(); break;
        case 15: cleanupTestCase(); break;
        default: ;
        }
        _id -= 16;
    }
    return _id;
}
Ejemplo n.º 3
0
SshDirectTcpIpTunnel::Ptr SshChannelManager::createTunnel(quint16 remotePort,
        const SshConnectionInfo &connectionInfo)
{
    SshDirectTcpIpTunnel::Ptr tunnel(new SshDirectTcpIpTunnel(m_nextLocalChannelId++, remotePort,
            connectionInfo, m_sendFacility));
    insertChannel(tunnel->d, tunnel);
    return tunnel;
}
Ejemplo n.º 4
0
bool QLCFixtureMode::loadXML(QXmlStreamReader &doc)
{
    if (doc.name() != KXMLQLCFixtureMode)
    {
        qWarning() << Q_FUNC_INFO << "Mode tag not found";
        return false;
    }

    /* Mode name */
    QString str = doc.attributes().value(KXMLQLCFixtureModeName).toString();
    if (str.isEmpty() == true)
    {
        qWarning() << Q_FUNC_INFO << "Mode has no name";
        return false;
    }
    else
    {
        setName(str);
    }

    /* Subtags */
    while (doc.readNextStartElement())
    {
        if (doc.name() == KXMLQLCFixtureModeChannel)
        {
            /* Channel */
            Q_ASSERT(m_fixtureDef != NULL);
            str = doc.attributes().value(KXMLQLCFixtureModeChannelNumber).toString();
            insertChannel(m_fixtureDef->channel(doc.readElementText()),
                          str.toInt());
        }
        else if (doc.name() == KXMLQLCFixtureHead)
        {
            /* Head */
            QLCFixtureHead head;
            if (head.loadXML(doc) == true)
                insertHead(-1, head);
        }
        else if (doc.name() == KXMLQLCPhysical)
        {
            /* Physical */
            QLCPhysical physical;
            physical.loadXML(doc);
            setPhysical(physical);
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown Fixture Mode tag:" << doc.name();
            doc.skipCurrentElement();
        }
    }

    // Cache all head channels
    cacheHeads();

    return true;
}
Ejemplo n.º 5
0
static void
insertArDestBegin(State &state,
                  const ControlFlowInst &cf,
                  const AluInst &inst,
                  SQ_CHAN unit)
{
   if (unit == SQ_CHAN_T) {
      throw translate_exception("Encountered AR instruction in invalid unit");
   }

   if (inst.word1.ENCODING() != SQ_ALU_OP2) {
      throw translate_exception("Unsupported non-op2 AR instruction");
   }

   if (inst.op2.OMOD() != SQ_ALU_OMOD_OFF) {
      throw translate_exception("Unsupport omod encountered for AR operation");
   }

   std::string arDest;
   switch (unit) {
   case SQ_CHAN_X:
      arDest = "AR.x";
      break;
   case SQ_CHAN_Y:
      arDest = "AR.y";
      break;
   case SQ_CHAN_Z:
      arDest = "AR.z";
      break;
   case SQ_CHAN_W:
      arDest = "AR.w";
      break;
   }

   decaf_check(!arDest.empty());

   state.out << arDest << " = ";

   if (inst.op2.WRITE_MASK()) {
      fmt::MemoryWriter postWrite;

      auto gpr = inst.word1.DST_GPR();
      postWrite << "R[" << gpr << "].";
      insertChannel(postWrite, inst.word1.DST_CHAN());
      postWrite << " = " << arDest << ";";

      state.postGroupWrites.push_back(postWrite.str());
   }
}
Ejemplo n.º 6
0
QLCFixtureMode& QLCFixtureMode::operator=(const QLCFixtureMode& mode)
{
	if (this != &mode)
	{
		QListIterator <QLCChannel*> it(mode.m_channels);
		int i = 0;

		m_name = mode.m_name;
		m_physical = mode.m_physical;
		m_fixtureDef = mode.m_fixtureDef;

		m_channels.clear();
		while (it.hasNext() == true)
			insertChannel(it.next(), i++);
	}

	return *this;
}
Ejemplo n.º 7
0
void MixerImpl::playStream(
			SoundType type,
			SoundHandle *handle,
			AudioStream *stream,
			int id, byte volume, int8 balance,
			DisposeAfterUse::Flag autofreeStream,
			bool permanent,
			bool reverseStereo) {
	Common::StackLock lock(_mutex);

	if (stream == 0) {
		warning("stream is 0");
		return;
	}


	assert(_mixerReady);

	// Prevent duplicate sounds
	if (id != -1) {
		for (int i = 0; i != NUM_CHANNELS; i++)
			if (_channels[i] != 0 && _channels[i]->getId() == id) {
				// Delete the stream if were asked to auto-dispose it.
				// Note: This could cause trouble if the client code does not
				// yet expect the stream to be gone. The primary example to
				// keep in mind here is QueuingAudioStream.
				// Thus, as a quick rule of thumb, you should never, ever,
				// try to play QueuingAudioStreams with a sound id.
				if (autofreeStream == DisposeAfterUse::YES)
					delete stream;
				return;
			}
	}

#ifdef AUDIO_REVERSE_STEREO
	reverseStereo = !reverseStereo;
#endif

	// Create the channel
	Channel *chan = new Channel(this, type, stream, autofreeStream, reverseStereo, id, permanent);
	chan->setVolume(volume);
	chan->setBalance(balance);
	insertChannel(handle, chan);
}
Ejemplo n.º 8
0
bool QLCFixtureMode::loadXML(const QDomElement* root)
{
	QDomNode node;
	QDomElement tag;
	QString str;
	QString ch;

	/* Get channel name */
	str = root->attribute(KXMLQLCFixtureModeName);
	if (str == QString::null)
		return false;
	else
		setName(str);

	/* Subtags */
	node = root->firstChild();
	while (node.isNull() == false)
	{
		tag = node.toElement();

		if (tag.tagName() == KXMLQLCFixtureModeChannel)
		{
			str = tag.attribute(KXMLQLCFixtureModeChannelNumber);
			insertChannel(m_fixtureDef->channel(tag.text()),
				      str.toInt());
		}
		else if (tag.tagName() == KXMLQLCPhysical)
		{
			QLCPhysical physical;
			physical.loadXML(&tag);
			setPhysical(physical);
		}
		else
		{
			qDebug() << "Unknown Mode tag: " << tag.tagName();
		}

		node = node.nextSibling();
	}

	return true;
}
Ejemplo n.º 9
0
QLCFixtureMode& QLCFixtureMode::operator=(const QLCFixtureMode& mode)
{
    if (this != &mode)
    {
        m_name = mode.m_name;
        m_physical = mode.m_physical;
        m_heads = mode.m_heads;

        /* Clear the existing list of channels */
        m_channels.clear();

        Q_ASSERT(m_fixtureDef != NULL);

        quint32 i = 0;
        QVectorIterator <QLCChannel*> it(mode.m_channels);
        while (it.hasNext() == true)
        {
            /* Since m_fixtureDef might not be the same as
               mode.m_fixtureDef, we need to search for a
               channel with the same name from m_fixtureDef and
               not from mode.m_fixtureDef. If the channel in the
               other mode is deleted, the one in this copied mode
               will be invalid and we end up in a crash. */
            QLCChannel* ch = it.next();
            QLCChannel* actual = m_fixtureDef->channel(ch->name());
            if (actual != NULL)
                insertChannel(actual, i++);
            else
                qWarning() << Q_FUNC_INFO << "Unable to find channel"
                           << ch->name() << "for mode"
                           << m_name << "from its fixture definition";
        }
    }

    return *this;
}
Ejemplo n.º 10
0
QSsh::SftpChannel::Ptr SshChannelManager::createSftpChannel()
{
    SftpChannel::Ptr sftp(new SftpChannel(m_nextLocalChannelId++, m_sendFacility));
    insertChannel(sftp->d, sftp);
    return sftp;
}
Ejemplo n.º 11
0
QSsh::SshRemoteProcess::Ptr SshChannelManager::createRemoteShell()
{
    SshRemoteProcess::Ptr proc(new SshRemoteProcess(m_nextLocalChannelId++, m_sendFacility));
    insertChannel(proc->d, proc);
    return proc;
}
Ejemplo n.º 12
0
QSsh::SshRemoteProcess::Ptr SshChannelManager::createRemoteProcess(const QByteArray &command)
{
    SshRemoteProcess::Ptr proc(new SshRemoteProcess(command, m_nextLocalChannelId++, m_sendFacility));
    insertChannel(proc->d, proc);
    return proc;
}