Пример #1
0
void soundmng_sync(void) {

	QSOUND		qs;
const SINT32	*src;

	qs = &QSound;

	if ((QSound_Playing) && (qs->indata == NULL)) {
		src = sound_pcmlock();
		if (src) {
			satuation_s16(qs->extendbuffer, src, qs->buffersize);
			sound_pcmunlock(src);
			qs->indata = qs->extendbuffer;
		}
	}
}
Пример #2
0
static void sound_play_cb(void *userdata, BYTE *stream, int len) {

	int			length;
	SINT16		*dst;
const SINT32	*src;

	length = min(len, (int)(soundmng.samples * 2 * sizeof(SINT16)));
	dst = soundmng.buf[soundmng.nsndbuf];
	src = sound_pcmlock();
	if (src) {
		satuation_s16(dst, src, length);
		sound_pcmunlock(src);
	}
	else {
		ZeroMemory(dst, length);
	}
	SDL_MixAudio(stream, (BYTE *)dst, length, SDL_MIX_MAXVOLUME);
	soundmng.nsndbuf = (soundmng.nsndbuf + 1) % NSNDBUF;
	(void)userdata;
}
Пример #3
0
static pascal void QSoundCallback(SndChannelPtr inCh, SndCommand *inCmd) {

	QSOUND		qs;
	int			nextbuf;
	void		*dst;
#if defined(SOUND_CRITICAL)
const SINT32	*src;
#endif

	if (QS_Avail) {
		qs = &QSound;
		nextbuf = inCmd->param1;
		dst = qs->buf[nextbuf]->sampleArea;
#if !defined(SOUND_CRITICAL)
		if (qs->indata) {
			CopyMemory((SINT16 *)dst, qs->indata, qs->buffersize);
			qs->indata = NULL;
		}
#else
		src = NULL;
		if (QSound_Playing) {
			src = sound_pcmlock();
		}
		if (src) {
			satuation_s16((SINT16 *)dst, src, qs->buffersize);
			sound_pcmunlock(src);
		}
#endif
		else {
			ZeroMemory(dst, qs->buffersize);
		}
		SndDoCommand(qs->hdl, &qs->cmd[nextbuf], TRUE);
		SndDoCommand(qs->hdl, &qs->cbcmd[nextbuf], TRUE);
	}
	(void)inCh;
}