当前位置: 首页>>代码示例>>C++>>正文


C++ SNDDMA_Submit函数代码示例

本文整理汇总了C++中SNDDMA_Submit函数的典型用法代码示例。如果您正苦于以下问题:C++ SNDDMA_Submit函数的具体用法?C++ SNDDMA_Submit怎么用?C++ SNDDMA_Submit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SNDDMA_Submit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: S_Update_

static void S_Update_ (void)
{
	unsigned int	endtime;
	int		samps;

	if (!sound_started || (snd_blocked > 0))
		return;

	SNDDMA_LockBuffer ();
	if (! shm->buffer)
		return;

// Updates DMA time
	GetSoundtime();

// check to make sure that we haven't overshot
	if (paintedtime < soundtime)
	{
	//	Con_Printf ("S_Update_ : overflow\n");
		paintedtime = soundtime;
	}

// mix ahead of current position
	endtime = soundtime + (unsigned int)(_snd_mixahead.value * shm->speed);
	samps = shm->samples >> (shm->channels - 1);
	endtime = q_min(endtime, (unsigned int)(soundtime + samps));

	S_PaintChannels (endtime);

	SNDDMA_Submit ();
}
开发者ID:Darktori,项目名称:vkQuake,代码行数:31,代码来源:snd_dma.c

示例2: S_ClearBuffer

/*
==================
S_ClearBuffer
==================
*/
static void S_ClearBuffer (void)
{
	int		clear;
		
	if (!sound_started)
		return;

#ifdef USE_OPENAL
	if (alSound)
		return;
#endif

	s_rawend = 0;

	if (dma.samplebits == 8)
		clear = 0x80;
	else
		clear = 0;

	SNDDMA_BeginPainting ();

	if (dma.buffer)
		Snd_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);

	SNDDMA_Submit ();
}
开发者ID:hifi-unmaintained,项目名称:aprq2,代码行数:31,代码来源:snd_dma.c

示例3: S_Update_

static void
S_Update_(void)
{
    unsigned endtime;
    int samps;

    if (!sound_started || (snd_blocked > 0))
	return;

    /* Updates DMA time */
    GetSoundtime();

    /* check to make sure that we haven't overshot */
    if (paintedtime < soundtime) {
	/* FIXME - handle init & wrap properly and report actual overflow */
	//Con_DPrintf("%s: overflow\n", __func__);
	paintedtime = soundtime;
    }
    /* mix ahead of current position */
    endtime = soundtime + _snd_mixahead.value * shm->speed;
    samps = shm->samples >> (shm->channels - 1);
    if (endtime - soundtime > samps)
	endtime = soundtime + samps;

    S_PaintChannels(endtime);
    SNDDMA_Submit();
}
开发者ID:CatalystG,项目名称:tyrquake,代码行数:27,代码来源:snd_dma.c

示例4: S_ClearSoundBuffer

/*
==================
S_ClearSoundBuffer

If we are about to perform file access, clear the buffer
so sound doesn't stutter.
==================
*/
void S_ClearSoundBuffer( void ) {
	int		clear;
		
	if (!s_soundStarted)
		return;

	// stop looping sounds
	Com_Memset(loopSounds, 0, MAX_GENTITIES*sizeof(loopSound_t));
	Com_Memset(loop_channels, 0, MAX_CHANNELS*sizeof(channel_t));
	numLoopChannels = 0;

	S_ChannelSetup();

	s_rawend = 0;

	if (dma.samplebits == 8)
		clear = 0x80;
	else
		clear = 0;

	SNDDMA_BeginPainting ();
	if (dma.buffer)
    // TTimo: due to a particular bug workaround in linux sound code,
    //   have to optionally use a custom C implementation of Com_Memset
    //   not affecting win32, we have #define Snd_Memset Com_Memset
    // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
		Snd_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
	SNDDMA_Submit ();
}
开发者ID:Izhido,项目名称:qrevpak,代码行数:37,代码来源:snd_dma.c

示例5: S_Update_

void S_Update_(void) {
	unsigned        endtime;
	int				samps;
	static			float	lastTime = 0.0f;
	float			ma, op;
	float			thisTime, sane;
	static			int ot = -1;

	if ( !s_soundStarted || s_soundMuted ) {
		return;
	}

	thisTime = Com_Milliseconds();

	// Updates s_soundtime
	S_GetSoundtime();

	if (s_soundtime == ot) {
		return;
	}
	ot = s_soundtime;

	// clear any sound effects that end before the current time,
	// and start any new sounds
	S_ScanChannelStarts();

	sane = thisTime - lastTime;
	if (sane<11) {
		sane = 11;			// 85hz
	}

	ma = s_mixahead->value * dma.speed;
	op = s_mixPreStep->value + sane*dma.speed*0.01;

	if (op < ma) {
		ma = op;
	}

	// mix ahead of current position
	endtime = s_soundtime + ma;

	// mix to an even submission block size
	endtime = (endtime + dma.submission_chunk-1)
		& ~(dma.submission_chunk-1);

	// never mix more than the complete buffer
	samps = dma.samples >> (dma.channels-1);
	if (endtime - s_soundtime > samps)
		endtime = s_soundtime + samps;



	SNDDMA_BeginPainting ();

	S_PaintChannels (endtime);

	SNDDMA_Submit ();

	lastTime = thisTime;
}
开发者ID:sago007,项目名称:openarena_engine,代码行数:60,代码来源:snd_dma.c

示例6: S_Base_ClearSoundBuffer

/*
==================
S_ClearSoundBuffer

If we are about to perform file access, clear the buffer
so sound doesn't stutter.
==================
*/
void S_Base_ClearSoundBuffer( void ) {
	int		clear;
		
	if (!s_soundStarted)
		return;

	// stop looping sounds
	Com_Memset(loopSounds, 0, MAX_GENTITIES*sizeof(loopSound_t));
	Com_Memset(loop_channels, 0, MAX_CHANNELS*sizeof(channel_t));
	numLoopChannels = 0;

	S_ChannelSetup();

	Com_Memset(s_rawend, '\0', sizeof (s_rawend));

	if (dma.samplebits == 8)
		clear = 0x80;
	else
		clear = 0;

	SNDDMA_BeginPainting ();
	if (dma.buffer)
		Com_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
	SNDDMA_Submit ();
}
开发者ID:sago007,项目名称:openarena_engine,代码行数:33,代码来源:snd_dma.c

示例7: S_Update_

void S_Update_()
{
	guard(S_Update_);

	if (!sound_started) return;

	SNDDMA_BeginPainting();

	if (!dma.buffer) return;

	// Updates DMA time
	GetSoundtime();

	// check to make sure that we haven't overshot
	if (paintedtime < soundtime)
	{
		Com_DPrintf("S_Update_ : overflow\n");
		paintedtime = soundtime;
	}

	// mix ahead of current position
	unsigned endtime = soundtime + appRound(s_mixahead->value * dma.speed);

	// mix to an even submission block size
	endtime = Align(endtime, dma.submission_chunk);
	int samps = dma.samples >> (dma.channels-1);
	if (endtime - soundtime > samps)
		endtime = soundtime + samps;

	S_PaintChannels(endtime);

	SNDDMA_Submit();
	unguard;
}
开发者ID:RkShaRkz,项目名称:Quake2,代码行数:34,代码来源:snd_dma.cpp

示例8: SNDDMA_Init

/*
==================
SNDDMA_Init

Initialize direct sound
Returns false if failed
==================
*/
qboolean SNDDMA_Init(void) {

	memset ((void *)&dma, 0, sizeof (dma));

	// create the secondary buffer we'll actually work with
	dma.channels = 2;
	dma.samplebits = 16;

	if (s_khz->integer == 44)
		dma.speed = 44100;
	else if (s_khz->integer == 22)
		dma.speed = 22050;
	else
		dma.speed = 11025;
	
	SNDDMA_BeginPainting ();
	if (dma.buffer)
		memset(dma.buffer, 0, dma.samples * dma.samplebits/8);
	SNDDMA_Submit ();

	// Hack !!
	dma.samples = 32768;
	dma.submission_chunk = 1;

	dma.buffer = new byte[dma.samples * 2];

	Com_DPrintf("Completed successfully\n" );

    return qtrue;
}
开发者ID:Cancerous,项目名称:massive-tyrion,代码行数:38,代码来源:xdk_snd.cpp

示例9: S_Update_

static void
S_Update_(void)
{
    unsigned endtime;
    int samps;

    if (!sound_started || (snd_blocked > 0))
        return;

    /* Updates DMA time */
    GetSoundtime();

    /* check to make sure that we haven't overshot */
    if (paintedtime < soundtime) {
        /* Con_Printf ("S_Update_ : overflow\n"); */
        paintedtime = soundtime;
    }
    /* mix ahead of current position */
    endtime = soundtime + _snd_mixahead.value * shm->speed;
    samps = shm->samples >> (shm->channels - 1);
    if (endtime - soundtime > samps)
        endtime = soundtime + samps;

    S_PaintChannels(endtime);
    SNDDMA_Submit();
}
开发者ID:AidHamza,项目名称:eviltoys,代码行数:26,代码来源:snd_dma.c

示例10: S_Update_

void S_Update_(void)
{
    unsigned        endtime;
    int				samps;

    if (!sound_started || (snd_blocked > 0)) {
        return;
    }

// Updates DMA time
    GetSoundtime();

// check to make sure that we haven't overshot
    if (paintedtime < soundtime) {
        //Con_Printf ("S_Update_ : overflow\n");
        paintedtime = soundtime;
    }


// mix ahead of current position
    endtime = soundtime + _snd_mixahead.value
#ifdef FLASH
              / 2.0f //For Flash we need to halve the mixahead amount, probably because we doubled the sampling rate.
#endif
              * shm->speed;
    samps = shm->samples >> (shm->channels-1);
    if (endtime - soundtime > samps) {
        endtime = soundtime + samps;
    }

#ifndef _arch_dreamcast // BlackAura
#ifdef _WIN32
// if the buffer was lost or stopped, restore it and/or restart it
    {
        DWORD	dwStatus;

        if (pDSBuf) {
            if (pDSBuf->lpVtbl->GetStatus(pDSBuf, &dwStatus) != DD_OK) {
                Con_Printf("Couldn't get sound buffer status\n");
            }

            if (dwStatus & DSBSTATUS_BUFFERLOST) {
                pDSBuf->lpVtbl->Restore(pDSBuf);
            }

            if (!(dwStatus & DSBSTATUS_PLAYING)) {
                pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING);
            }
        }
    }
#endif
#endif // BlackAura

    S_PaintChannels(endtime);

#ifndef FLASH
    SNDDMA_Submit();
#endif
}
开发者ID:carriercomm,项目名称:flQuake,代码行数:59,代码来源:snd_dma.c

示例11: S_Update_

void S_Update_(void)
{
#ifndef SDL

	unsigned        endtime;
	int				samps;
	
	if (!sound_started || (snd_blocked > 0))
		return;

// Updates DMA time
	GetSoundtime();

// check to make sure that we haven't overshot
	if (paintedtime < soundtime)
	{
		//Con_Printf ("S_Update_ : overflow\n");
		paintedtime = soundtime;
	}

// mix ahead of current position
	endtime = soundtime + _snd_mixahead.value * shm->speed;
	samps = shm->samples >> (shm->channels-1);
	if (endtime - soundtime > samps)
		endtime = soundtime + samps;

#ifdef _WIN32
// if the buffer was lost or stopped, restore it and/or restart it
	{
		DWORD	dwStatus;

		if (pDSBuf)
		{
			if (pDSBuf->lpVtbl->GetStatus (pDSBuf, &dwStatus) != DD_OK)
				Con_Printf ("Couldn't get sound buffer status\n");
			
			if (dwStatus & DSBSTATUS_BUFFERLOST)
				pDSBuf->lpVtbl->Restore (pDSBuf);
			
			if (!(dwStatus & DSBSTATUS_PLAYING))
				pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING);
		}
	}
#endif

	S_PaintChannels (endtime);

	SNDDMA_Submit ();
#endif /* ! SDL */
}
开发者ID:davemichael,项目名称:NaCl-Quake,代码行数:50,代码来源:snd_dma.c

示例12: S_ClearBuffer

void S_ClearBuffer()
{
	if (!sound_started)
		return;

	s_rawend = 0;

	int clear;
	if (dma.samplebits == 8)
		clear = 0x80;
	else
		clear = 0;

	SNDDMA_BeginPainting();
	if (dma.buffer)
		memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
	SNDDMA_Submit();
}
开发者ID:RkShaRkz,项目名称:Quake2,代码行数:18,代码来源:snd_dma.cpp

示例13: S_Clear

/*
* S_Clear
*/
static void S_Clear( void )
{
	int clear;

	num_loopsfx = 0;

	S_ClearRawSounds();

	if( dma.samplebits == 8 )
		clear = 0x80;
	else
		clear = 0;

	SNDDMA_BeginPainting();
	if( dma.buffer )
		memset( dma.buffer, clear, dma.samples * dma.samplebits/8 );
	SNDDMA_Submit();
}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:21,代码来源:snd_dma.c

示例14: S_Update_

static void S_Update_ (void)
{
	unsigned int endtime;
#ifdef _WIN32
	DWORD dwStatus;
#endif

	if (!shm || (snd_blocked > 0))
		return;

	// Updates DMA time
	GetSoundtime();

	// check to make sure that we haven't overshot
	if (paintedtime < soundtime) {
		//Com_Printf ("S_Update_ : overflow\n");
		paintedtime = soundtime;
	}

	// mix ahead of current position
	endtime = soundtime + (unsigned int) (s_mixahead.value * shm->format.speed);
	endtime = min(endtime, (unsigned int)(soundtime + shm->sampleframes));

#ifdef _WIN32
	// if the buffer was lost or stopped, restore it and/or restart it
	if (pDSBuf) {
		if (pDSBuf->lpVtbl->GetStatus (pDSBuf, &dwStatus) != DS_OK)
			Com_Printf ("Couldn't get sound buffer status\n");

		if (dwStatus & DSBSTATUS_BUFFERLOST)
			pDSBuf->lpVtbl->Restore (pDSBuf);

		if (!(dwStatus & DSBSTATUS_PLAYING))
			pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING);
	}

#endif

	S_PaintChannels (endtime);

	SNDDMA_Submit ();
}
开发者ID:jogi1,项目名称:camquake,代码行数:42,代码来源:snd_dma.c

示例15: S_ClearBuffer

void S_ClearBuffer (void)
{
	int		clear;

	if (!sound_started || !shm)
		return;

	SNDDMA_LockBuffer ();
	if (! shm->buffer)
		return;

	s_rawend = 0;

	if (shm->samplebits == 8 && !shm->signed8)
		clear = 0x80;
	else
		clear = 0;

	memset(shm->buffer, clear, shm->samples * shm->samplebits / 8);

	SNDDMA_Submit ();
}
开发者ID:Darktori,项目名称:vkQuake,代码行数:22,代码来源:snd_dma.c


注:本文中的SNDDMA_Submit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。