Ejemplo n.º 1
0
void Log::ToggleEnabled( int type )
{
	if ( !IsTypeEnabled( type ) )
		EnableType( type );
	else
		DisableType( type );
}
Ejemplo n.º 2
0
int ChangedListeningInfo()
{
//	m_log(_T("ChangedListeningInfo"), _T("Start"));

	BOOL changed = FALSE;
	BOOL playing = FALSE;

	int first = (players[WATRACK]->enabled ? WATRACK : GENERIC);
	int last = (players[WATRACK]->enabled ? WATRACK + 1 : NUM_PLAYERS);
	for (int i = first; i < last; i++) 
	{
		if (!players[i]->enabled)
			continue;

		LISTENINGTOINFO lti = {0};
		if (!players[i]->GetListeningInfo(&lti))
			continue;

		if (!IsTypeEnabled(&lti))
		{
			FreeListeningInfo(&lti);
			continue;
		}

		playing = TRUE;

//		m_log(_T("ChangedListeningInfo"), _T("Has : %s : %d"), players[i]->name, lti.cbSize);

		if (Equals(&current, &lti))
		{
//			m_log(_T("ChangedListeningInfo"), _T("Is equals"));
			FreeListeningInfo(&lti);
		}
		else
		{
//			m_log(_T("ChangedListeningInfo"), _T("Is different"));

			FreeListeningInfo(&current);

			memcpy(&current, &lti, sizeof(current));

			changed = 1;
		}

		break;
	}

	if (!playing && current.cbSize != 0)
	{
		FreeListeningInfo(&current);
		changed = 1;
	}

	if (!changed)
		return 0;
	else
		return current.cbSize == 0 ? -1 : 1;
}
Ejemplo n.º 3
0
void Log::Write( LOG_TYPE type, const std::string& message )
{
#ifdef ENABLE_LOGGING
	if ( enable && IsTypeEnabled( type ) )
	{
//		::wxLogMessage( message.c_str() );
//		::OutputDebugStringA( ( message + "\r\n" ).c_str() );
		mFile << message << std::endl;

		static int flushInterval = 0;
		flushInterval++;
		if ( flushInterval >= 10000 ) {
			mFile.flush();
			flushInterval = 0;
		}
	}
#endif
}