本文整理汇总了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 ();
}
示例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 ();
}
示例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();
}
示例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 ();
}
示例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;
}
示例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 ();
}
示例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;
}
示例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;
}
示例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();
}
示例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
}
示例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 */
}
示例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();
}
示例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();
}
示例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 ();
}
示例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 ();
}