Example #1
0
static BOOL SoundChannel_Init(void) {

volatile QSOUND		qs;

	qs = &QSound;
	ZeroMemory(qs, sizeof(QSOUND));
#if TARGET_API_MAC_CARBON
	qs->cb = NewSndCallBackUPP(QSoundCallback);
#else
	qs->cb = NewSndCallBackProc(QSoundCallback);
#endif

	if (SndNewChannel(&qs->hdl, sampledSynth,
				initStereo + initNoInterp + initNoDrop, qs->cb) != noErr) {
		return(FAILURE);
	}
	return(SUCCESS);
}
Example #2
0
/*
===============
SNDDMA_Init
===============
*/
qboolean SNDDMA_Init(void) {
	int		err;
	
	// create a sound channel
	s_sndChan = NULL;
	err = SndNewChannel( &s_sndChan, sampledSynth, initStereo, NewSndCallBackProc(S_Callback) );
	if ( err ) {
		return false;
	}
	
	dma.channels = 2;
	dma.samples = MAX_MIXED_SAMPLES;
	dma.submission_chunk = SUBMISSION_CHUNK;
	dma.samplebits = 16;
	dma.speed = 22050;
	dma.buffer = (byte *)s_mixedSamples;
	
	// que up the first submission-chunk sized buffer
	s_chunkCount = 0;
	
	S_Callback( s_sndChan, NULL );
	
	return qtrue;
}