Exemplo n.º 1
0
static void GetSoundtime (void)
{
	int samplepos, fullsamples;
	static int buffers, oldsamplepos;

	//joe: capturing audio
#ifdef _WIN32
	if (Movie_GetSoundtime())
		return;
#endif

	fullsamples = shm->sampleframes;

	// it is possible to miscount buffers if it has wrapped twice between calls to S_Update.  Oh well.
	samplepos = SNDDMA_GetDMAPos();

	if (samplepos < oldsamplepos) {
		buffers++; // buffer wrapped

		if (paintedtime > 0x40000000) {
			// time to chop things off to avoid 32 bit limits
			buffers = 0;
			paintedtime = fullsamples;
			S_StopAllSounds (true);
		}
	}

	oldsamplepos = samplepos;

	soundtime = buffers * fullsamples + samplepos / shm->format.channels;
}
Exemplo n.º 2
0
void GetSoundtime(void)
{
#ifndef FLASH	//For Flash, the SampleDataEvent tells how much to add onto the soundtime value, so dont do anything here.
    int		samplepos;
    static	int		buffers;
    static	int		oldsamplepos;
    int		fullsamples;

#ifdef SUPPORTS_AVI_CAPTURE
    if (Movie_GetSoundtime()) {
        return;
    }
#endif

    fullsamples = shm->samples / shm->channels;

// it is possible to miscount buffers if it has wrapped twice between
// calls to S_Update.  Oh well.
    samplepos = SNDDMA_GetDMAPos();

    if (samplepos < oldsamplepos) {
        buffers++;					// buffer wrapped

        if (paintedtime > 0x40000000) {
            // time to chop things off to avoid 32 bit limits
            buffers = 0;
            paintedtime = fullsamples;
            S_StopAllSounds(true);
        }
    }
    oldsamplepos = samplepos;

    soundtime = buffers*fullsamples + samplepos/shm->channels;
#endif //ifndef FLASH
}