Example #1
0
void SoundEngine::resumeSound(uint handle) {
	debugC(1, kDebugSound, "SoundEngine::resumeSound(%d)", handle);

	SndHandle* sndHandle = findHandle(handle);
	if (sndHandle != NULL)
		_mixer->pauseHandle(sndHandle->handle, false);
}
Example #2
0
void SoundEngine::stopSound(uint handle) {
	debugC(1, kDebugSound, "SoundEngine::stopSound(%d)", handle);

	SndHandle* sndHandle = findHandle(handle);
	if (sndHandle != NULL)
		_mixer->stopHandle(sndHandle->handle);
}
/**
 * name:	fromIni
 * class:	CExImContactBase
 * desc:	get contact information from a row of a ini file
 * param:	row	- the rows data
 * return:	TRUE if successful or FALSE otherwise
 **/
BYTE CExImContactBase::fromIni(LPSTR& row)
{
	LPSTR p1, p2 = NULL;
	LPSTR pszUIDValue, pszUIDSetting, pszProto = NULL;
	LPSTR pszBuf = &row[0];
	size_t cchBuf = strlen(row);

	MIR_FREE(_pszProtoOld);
	MIR_FREE(_pszProto);
	MIR_FREE(_pszAMPro);
	MIR_FREE(_pszNick);
	MIR_FREE(_pszDisp);
	MIR_FREE(_pszGroup);
	MIR_FREE(_pszUIDKey);
	db_free(&_dbvUID);
	ZeroMemory(&_dbvUID, sizeof(DBVARIANT));
	_dbvUIDHash = 0;

	// read uid value
	if (cchBuf > 10 && (p1 = mir_strrchr(pszBuf, '*{')) && (p2 = mir_strchr(p1, '}*')) && p1 + 2 < p2) {
		pszUIDValue = p1 + 1;
		*p1 = *(p2 - 1) = 0;

		// insulate the uid setting from buffer pointer
		if (cchBuf > 0 && (p1 = mir_strrchr(pszBuf, '*<')) && (p2 = mir_strchr(p1, '>*')) && p1 + 2 < p2) {
			pszUIDSetting = p1 + 1;
			*p1 = *(p2 - 1) = 0;

			// insulate the protocol name from buffer pointer
			if (cchBuf > 0 && (p1 = mir_strrchr(pszBuf, '*(')) && (p2 = mir_strchr(p1, ')*')) && p1 + 2 < p2) {
				pszProto = p1 + 1;
				*(--p1) = *(p2 - 1) = 0;

				// DBVT_DWORD
				if (strspn(pszUIDValue, "0123456789") == mir_strlen(pszUIDValue)) {
					_dbvUID.dVal = _atoi64(pszUIDValue);
					_dbvUID.type = DBVT_DWORD;
				}
				else {
				// DBVT_UTF8
					_dbvUID.pszVal = mir_strdup(pszUIDValue);
					_dbvUID.type = DBVT_UTF8;
				}
				_pszUIDKey = mir_strdup(pszUIDSetting);
				_pszProto = mir_strdup(pszProto);
			} //end insulate the protocol name from buffer pointer
		} //end insulate the uid setting from buffer pointer
	} //end read uid value

	// create valid nickname
	_pszNick = mir_strdup(pszBuf);
	size_t i = strlen(_pszNick)-1;
	while (i > 0 && (_pszNick[i] == ' ' || _pszNick[i] == '\t')) {
		_pszNick[i] = 0;
		i--;
	}
	// finally try to find contact in contact list
	findHandle();
	return FALSE;
}
Example #4
0
float SoundEngine::getSoundPanning(uint handle) {
	debugC(1, kDebugSound, "SoundEngine::getSoundPanning(%d)", handle);

	SndHandle* sndHandle = findHandle(handle);
	if (sndHandle == NULL)
		return 0.f;
	return (float)_mixer->getChannelBalance(sndHandle->handle) / 127.0f;
}
Example #5
0
float SoundEngine::getSoundVolume(uint handle) {
	debugC(1, kDebugSound, "SoundEngine::getSoundVolume(%d)", handle);

	SndHandle* sndHandle = findHandle(handle);
	if (sndHandle == NULL)
		return 0.f;
	return (float)_mixer->getChannelVolume(sndHandle->handle) / 255.0f;
}
Example #6
0
bool SoundEngine::isSoundPlaying(uint handle) {
	debugC(1, kDebugSound, "SoundEngine::isSoundPlaying(%d)", handle);

	SndHandle* sndHandle = findHandle(handle);
	if (sndHandle == NULL)
		return false;
	return _mixer->isSoundHandleActive(sndHandle->handle);
}
Example #7
0
void SoundEngine::setSoundPanning(uint handle, float pan) {
	debugC(1, kDebugSound, "SoundEngine::setSoundPanning(%d, %f)", handle, pan);

	SndHandle* sndHandle = findHandle(handle);
	if (sndHandle != NULL) {
		sndHandle->pan = pan;
		_mixer->setChannelBalance(sndHandle->handle, (int8)(pan * 127));
	}
}
Example #8
0
void SoundEngine::setSoundVolume(uint handle, float volume) {
	debugC(1, kDebugSound, "SoundEngine::setSoundVolume(%d, %f)", handle, volume);

	SndHandle* sndHandle = findHandle(handle);
	if (sndHandle != NULL) {
		sndHandle->volume = volume;
		_mixer->setChannelVolume(sndHandle->handle, (byte)(volume * 255));
	}
}
Example #9
0
int Sys_FileOpenWrite(char *path) {
	int handleIdx = findHandle();

	FILE* fileHandle = FileHandles[handleIdx];

	fopen_s(&fileHandle, path, "wb");


	if (fileHandle == 0) {
		handleIdx = -1;
	}

	FileHandles[handleIdx] = fileHandle;

	return handleIdx;
}
Example #10
0
int Sys_FileOpenRead(char *path, int *size) {
	int handleIdx = findHandle();

	FILE* fileHandle = FileHandles[handleIdx];

	fopen_s(&fileHandle, path, "rb");

	if (fileHandle == 0) {
		if (size != 0) {
			*size = -1;
		}
		return -1;
	}

	FileHandles[handleIdx] = fileHandle;

	if (size != 0) {
		*size = fileLength(fileHandle);
	}

	return handleIdx;
}