Exemplo n.º 1
0
void QSoundManager::stopAllChannels() {
	qsWaveMixFlushChannel(0, QMIX_OPENALL);

	for (int idx = 0; idx < 16; ++idx)
		_sounds.flushChannel(idx);
	resetChannel(10);
}
Exemplo n.º 2
0
void QSoundManager::stopSound(int handle) {
	resetChannel(10);

	for (uint idx = 0; idx < _slots.size(); ++idx) {
		Slot &slot = _slots[idx];
		if (slot._handle == handle) {
			qsWaveMixFlushChannel(slot._channel);
			_sounds.flushChannel(slot._channel);
			resetChannel(10);
		}
	}
}
Exemplo n.º 3
0
int QSoundManager::resetChannel(int iChannel) {
	int newChannel = -1;
	int channelStart = 10;
	int channelEnd = 16;

	if (iChannel != 10) {
		qsWaveMixFlushChannel(iChannel);
		_sounds.flushChannel(iChannel);
		channelStart = iChannel;
		channelEnd = iChannel + 1;
	} else {
		uint ticks = g_vm->_events->getTicksCount();

		for (uint idx = 0; idx < _slots.size(); ++idx) {
			Slot &slot = _slots[idx];
			if (slot._isTimed && slot._ticks && ticks > slot._ticks) {
				qsWaveMixFlushChannel(slot._channel);
				_sounds.flushChannel(slot._channel);
			}
		}
	}

	for (iChannel = channelStart; iChannel < channelEnd; ++iChannel) {
		if (qsWaveMixIsChannelDone(iChannel)) {
			// Scan through the slots, and reset any slot using the channel
			for (uint idx = 0; idx < _slots.size(); ++idx) {
				Slot &slot = _slots[idx];
				if (slot._channel == iChannel)
					slot.clear();
			}

			// Use the empty channel
			newChannel = iChannel;
		}
	}

	return newChannel;
}
Exemplo n.º 4
0
void QMixer::qsWaveMixFlushChannel(int iChannel, uint flags) {
	if (flags & QMIX_OPENALL) {
		// Ignore channel, and flush all the channels
		for (uint idx = 0; idx < _channels.size(); ++idx)
			qsWaveMixFlushChannel(idx, 0);
	} else {
		// Flush the specified channel
		Common::List<SoundEntry>::iterator i;
		Common::List<SoundEntry> &sounds = _channels[iChannel]._sounds;
		for (i = sounds.begin(); i != sounds.end(); ++i)
			_mixer->stopHandle((*i)._soundHandle);

		sounds.clear();
	}
}
Exemplo n.º 5
0
void QSoundManager::stopChannel(int channel) {
	int endChannel;
	switch (channel) {
	case 0:
	case 3:
		endChannel = channel + 3;
		break;
	case 6:
		endChannel = 10;
		break;
	case 10:
		endChannel = 48;
		break;
	default:
		return;
	}

	for (; channel < endChannel; ++channel) {
		qsWaveMixFlushChannel(channel);
		_sounds.flushChannel(channel);
	}
}