Пример #1
0
void UserView::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight)
#endif
{
	UserModel *um = static_cast<UserModel *>(model());
	int nRowCount = um->rowCount();
	int i;
	for(i=0;i<nRowCount;i++)
		updateChannel(um->index(i,0));

	QTreeView::dataChanged(topLeft,bottomRight);
}
Пример #2
0
void ofApp::update(){
    
    updateSound();
    updateTcpServer();
    
    for (int i=0; i<channels.size(); i++) {

        channel *channel = channels[i];
        updateChannel(channel, i);
        
    }
}
Пример #3
0
void SoundGenerator::run()
{
    static int nextCC = 0;
    m_clockCount++;

    // every 16 clock cycles => 62,5 kHz
    if ((m_clockCount & 0x0f) == 0)
    {
        updateEnvelope();
        updateNoise();

        updateChannel(m_channelA, m_mixerA);
        updateChannel(m_channelB, m_mixerB);
        updateChannel(m_channelC, m_mixerC);

        *m_bufferPtr++ = (m_channelC.mixValue & 0xff) - 128;
        m_bufferPos += 1;
        if (m_bufferPos >= m_audioBuffer.length())
        {
           m_bufferPtr = reinterpret_cast<qint8 *>(m_audioBuffer.data());
           m_bufferPos = 0;
        }

        *m_bufferPtr++ = (m_channelA.mixValue & 0xff) - 128;
        m_bufferPos += 1;
        if (m_bufferPos >= m_audioBuffer.length())
        {
           m_bufferPtr = reinterpret_cast<qint8 *>(m_audioBuffer.data());
           m_bufferPos = 0;
        }

        m_channelA.mixValue = 0;
        m_channelB.mixValue = 0;
        m_channelC.mixValue = 0;
    }
}
Пример #4
0
void UserView::updateChannel(const QModelIndex &idx) {
	UserModel *um = static_cast<UserModel *>(model());

	if(!idx.isValid())
		return;

	Channel * c = um->getChannel(idx);


	for(int i = 0; idx.child(i, 0).isValid(); ++i) {
		updateChannel(idx.child(i,0));
	}

	if(c && idx.parent().isValid()) {

		if(g.s.bFilterActive == false) {
			setRowHidden(idx.row(),idx.parent(),false);
		} else {
			bool isChannelUserIsIn = false;
			
			// Check whether user resides in this channel or a subchannel
			if (g.uiSession != 0) {
				const ClientUser* user = ClientUser::get(g.uiSession);
				if (user != NULL) {
					Channel *chan = user->cChannel;
					while (chan) {
						if (chan == c) {
							isChannelUserIsIn = true;
							break;
						}
						chan = chan->cParent;
					}
				}
			}
			
			if(channelFiltered(c) && !isChannelUserIsIn) {
				setRowHidden(idx.row(),idx.parent(),true);
			} else {
				if(g.s.bFilterHidesEmptyChannels && !channelHasUsers(c)) {
					setRowHidden(idx.row(),idx.parent(),true);
				} else {
					setRowHidden(idx.row(),idx.parent(),false);
				}
			}
		}
	}
}
Пример #5
0
//-------------------------------------------------------------------------------------	
bool ClientApp::createAccount(std::string accountName, std::string passwd, std::string datas,
								   std::string ip, KBEngine::uint32 port)
{
	connectedBaseapp_ = false;

	if(canReset_)
		reset();

	clientDatas_ = datas;

	bool ret = updateChannel(true, accountName, passwd, ip, port);
	if(ret)
	{
		ret = ClientObjectBase::createAccount();
	}

	return ret;
}
Пример #6
0
//-------------------------------------------------------------------------------------	
bool ClientApp::login(std::string accountName, std::string passwd, std::string datas,
								   std::string ip, KBEngine::uint32 port)
{
	connectedGateway_ = false;

	if(canReset_)
		reset();

	clientDatas_ = datas;

	bool ret = updateChannel(true, accountName, passwd, ip, port);
	if(ret)
	{
		// 先握手然后等helloCB之后再进行登录
		Network::Bundle* pBundle = Network::Bundle::ObjPool().createObject();
		(*pBundle).newMessage(LoginappInterface::hello);
		(*pBundle) << KBEVersion::versionString();
		(*pBundle) << KBEVersion::scriptVersionString();

		if(Network::g_channelExternalEncryptType == 1)
		{
			pBlowfishFilter_ = new Network::BlowfishFilter();
			(*pBundle).appendBlob(pBlowfishFilter_->key());
		}
		else
		{
			std::string key = "";
			(*pBundle).appendBlob(key);
		}

		pServerChannel_->pEndPoint()->send(pBundle);
		Network::Bundle::ObjPool().reclaimObject(pBundle);
		//ret = ClientObjectBase::login();
	}

	return ret;
}
Пример #7
0
//-------------------------------------------------------------------------------------
void ClientApp::handleGameTick()
{
	g_kbetime++;
	threadPool_.onMainThreadTick();
	
	networkInterface().processChannels(KBEngine::Network::MessageHandlers::pMainMessageHandlers);
	tickSend();

	switch(state_)
	{
		case C_STATE_INIT:
			state_ = C_STATE_PLAY;
			break;
		case C_STATE_INITLOGINAPP_CHANNEL:
			state_ = C_STATE_PLAY;
			break;
		case C_STATE_LOGIN:

			state_ = C_STATE_PLAY;

			if(!ClientObjectBase::login())
			{
				WARNING_MSG("ClientApp::handleGameTick: login is failed!\n");
				return;
			}

			break;
		case C_STATE_LOGIN_GATEWAY_CHANNEL:
			{
				state_ = C_STATE_PLAY;

				bool ret = updateChannel(false, "", "", "", 0);
				if(ret)
				{
					// 先握手然后等helloCB之后再进行登录
					Network::Bundle* pBundle = Network::Bundle::ObjPool().createObject();
					(*pBundle).newMessage(BaseappInterface::hello);
					(*pBundle) << KBEVersion::versionString();
					(*pBundle) << KBEVersion::scriptVersionString();

					if(Network::g_channelExternalEncryptType == 1)
					{
						pBlowfishFilter_ = new Network::BlowfishFilter();
						(*pBundle).appendBlob(pBlowfishFilter_->key());
						pServerChannel_->pFilter(NULL);
					}
					else
					{
						std::string key = "";
						(*pBundle).appendBlob(key);
					}

					pServerChannel_->pEndPoint()->send(pBundle);
					Network::Bundle::ObjPool().reclaimObject(pBundle);
					// ret = ClientObjectBase::loginGateWay();
				}
			}
			break;
		case C_STATE_LOGIN_GATEWAY:

			state_ = C_STATE_PLAY;

			if(!ClientObjectBase::loginGateWay())
			{
				WARNING_MSG("ClientApp::handleGameTick: loginGateWay is failed!\n");
				return;
			}

			break;
		case C_STATE_PLAY:
			break;
		default:
			KBE_ASSERT(false);
			break;
	};
}
Пример #8
0
uint16 Screen::setChannelContent(uint16 channelIndex, uint16 index) {
	if (channelIndex < 1 || channelIndex >= 100 || _channels[channelIndex - 1].type == 0)
		return 0;
	_channels[channelIndex - 1].index = index;
	return updateChannel(channelIndex - 1) + 1;
}