コード例 #1
0
	void SourcesManager::groupSetSource(long groupIndex, long sourceIndex)
	{
		if (sourceIndex < 0 || groupIndex < 0 )
			return;
		
		if(groupIndex >= m_groups.size())
		{
			for(int i = m_groups.size(); i < groupIndex; i++)
			{
				m_groups.push_back(new SourcesGroup(this, 0));
				m_groups[i]->setMaximumRadius(m_maximum_radius);

			}
			m_groups.push_back(new SourcesGroup(this, 0));
			m_groups[groupIndex]->setMaximumRadius(m_maximum_radius);
			if(m_sources.size() > sourceIndex && m_sources[sourceIndex]->getExistence())
			{
				m_groups[groupIndex]->setExistence(1);
				m_groups[groupIndex]->addSource(sourceIndex);
				m_sources[sourceIndex]->setGroup(groupIndex);
				checkMute();
			}
		}
		else if(groupIndex >= 0)
		{
			if(m_sources.size() > sourceIndex && m_sources[sourceIndex]->getExistence())
			{
				m_groups[groupIndex]->addSource(sourceIndex);
				m_sources[sourceIndex]->setGroup(groupIndex);
				m_groups[groupIndex]->setExistence(1);
				checkMute();
			}
		}
	}
コード例 #2
0
	void SourcesManager::groupSetMute(long groupIndex, long aValue)
	{
		if(groupIndex < m_groups.size() && groupIndex >= 0)
		{
			m_groups[groupIndex]->setMute(aValue);
			for(int i = 0; i < m_groups[groupIndex]->getNumberOfSources(); i++)
			{
				int sourceIndex = m_groups[groupIndex]->getSourceIndex(i);
				if(sourceIndex >= 0 && sourceIndex < m_sources.size())
					m_sources[sourceIndex]->setMute(aValue);
			}
		}
		checkMute();
	}
コード例 #3
0
	void SourcesManager::sourceSetMute(long index, bool state)
	{
		if(index < m_sources.size() && index >= 0)
		{
			m_sources[index]->setMute(state);
			for(int i = 0; i < m_sources[index]->getNumberOfGroups(); i++)
			{
				int groupIndex = m_sources[index]->getGroupIndex(i);
				if(groupIndex >= 0 && groupIndex < m_groups.size())
				{
					m_groups[groupIndex]->setMute(0);
				}
			}
			checkMute();
		}
	}
コード例 #4
0
void SourcesManager::sourceSetMute(long anIndex, long aValue)
{
    aValue = Tools::clip(aValue, (long)0, (long)1);
    
    if(anIndex < m_sources.size() && anIndex >= 0)
    {
        m_sources[anIndex]->setMute(aValue);
        for(int i = 0; i < m_sources[anIndex]->getNumberOfGroups(); i++)
        {
            int groupIndex = m_sources[anIndex]->getGroupIndex(i);
            if(groupIndex >= 0 && groupIndex < m_groups.size())
            {
                m_groups[groupIndex]->setMute(0);
            }
        }
        checkMute();
    }
}
コード例 #5
0
ファイル: server.cpp プロジェクト: Shikyaro/AlCP-VoiceChat
bool Server::startServer(quint16 port)
{
    if(db->db.isOpen()){
        if ((!isListening())&&(listen(QHostAddress::Any,port)))
        {
            qDebug() << "Сервер запущен" << endl;
            muteBanTimer = new QTimer();
            muteBanTimer->start(10000);
            connect(muteBanTimer,SIGNAL(timeout()),this,SLOT(checkMute()));
            return true;
        }
        else
        {
            qDebug() << "Start error!" << endl;
            return false;
        }
    }else{
        return false;
    }
}