diff options
author | Chris Robinson <[email protected]> | 2010-07-25 12:54:50 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-07-25 12:54:50 -0700 |
commit | 46d46c49a87b33ed727a7099aca3dc89e06e57cd (patch) | |
tree | fb5e8d5611de607f6ddb707e1406d71e0bbe251d | |
parent | 40dd1fb85364e3a9e278ffa7a034638e7718770b (diff) |
Store the time precision with the device
-rw-r--r-- | Alc/ALc.c | 2 | ||||
-rw-r--r-- | Alc/alsa.c | 5 | ||||
-rw-r--r-- | Alc/dsound.c | 2 | ||||
-rw-r--r-- | Alc/null.c | 3 | ||||
-rw-r--r-- | Alc/oss.c | 2 | ||||
-rw-r--r-- | Alc/portaudio.c | 2 | ||||
-rw-r--r-- | Alc/pulseaudio.c | 3 | ||||
-rw-r--r-- | Alc/solaris.c | 2 | ||||
-rw-r--r-- | Alc/wave.c | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 3 |
10 files changed, 24 insertions, 2 deletions
@@ -1995,6 +1995,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) device->SamplesPlayed = 0; + device->TimeRes = 1; + InitUIntMap(&device->BufferMap); InitUIntMap(&device->EffectMap); InitUIntMap(&device->FilterMap); @@ -695,6 +695,9 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) psnd_pcm_sw_params_free(sp); + device->TimeRes = (ALuint64)periodSizeInFrames * 1000000000 / rate; + device->Frequency = rate; + SetDefaultChannelOrder(device); data->size = psnd_pcm_frames_to_bytes(data->pcmHandle, periodSizeInFrames); @@ -711,7 +714,6 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) } device->UpdateSize = periodSizeInFrames; device->NumUpdates = periods; - device->Frequency = rate; data->thread = StartThread(ALSANoMMapProc, device); } else @@ -724,7 +726,6 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) } device->UpdateSize = periodSizeInFrames; device->NumUpdates = periods; - device->Frequency = rate; data->thread = StartThread(ALSAProc, device); } if(data->thread == NULL) diff --git a/Alc/dsound.c b/Alc/dsound.c index f636287f..f513f2ef 100644 --- a/Alc/dsound.c +++ b/Alc/dsound.c @@ -461,6 +461,8 @@ static ALCboolean DSoundResetPlayback(ALCdevice *device) if(SUCCEEDED(hr)) { + device->TimeRes = (ALuint64)device->UpdateSize * 1000000000 / + device->Frequency; device->Format = format; SetDefaultWFXChannelOrder(device); pData->thread = StartThread(DSoundProc, device); @@ -108,6 +108,9 @@ static ALCboolean null_reset_playback(ALCdevice *device) } SetDefaultWFXChannelOrder(device); + device->TimeRes = (ALuint64)device->UpdateSize * 1000000000 / + device->Frequency; + data->thread = StartThread(NullProc, device); if(data->thread == NULL) { @@ -268,6 +268,8 @@ static ALCboolean oss_reset_playback(ALCdevice *device) device->Frequency = ossSpeed; device->UpdateSize = info.fragsize / frameSize; device->NumUpdates = info.fragments + 1; + device->TimeRes = (ALuint64)device->UpdateSize * 1000000000 / + device->Frequency; data->data_size = device->UpdateSize * frameSize; data->mix_data = calloc(1, data->data_size); diff --git a/Alc/portaudio.c b/Alc/portaudio.c index 94eca19e..062c403a 100644 --- a/Alc/portaudio.c +++ b/Alc/portaudio.c @@ -250,6 +250,8 @@ static ALCboolean pa_reset_playback(ALCdevice *device) streamInfo = pPa_GetStreamInfo(data->stream); device->Frequency = streamInfo->sampleRate; device->UpdateSize = data->update_size; + device->TimeRes = (ALuint64)device->UpdateSize * 1000000000 / + device->Frequency; err = pPa_StartStream(data->stream); if(err != paNoError) diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c index 2769fcd9..9355cc36 100644 --- a/Alc/pulseaudio.c +++ b/Alc/pulseaudio.c @@ -938,6 +938,9 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{ ppa_stream_set_moved_callback(data->stream, stream_device_callback, device); ppa_stream_set_write_callback(data->stream, stream_write_callback, device); + device->TimeRes = (ALuint64)device->UpdateSize * 1000000000 / + device->Frequency; + data->thread = StartThread(PulseProc, device); if(!data->thread) { diff --git a/Alc/solaris.c b/Alc/solaris.c index cff744ae..4fbb1942 100644 --- a/Alc/solaris.c +++ b/Alc/solaris.c @@ -193,6 +193,8 @@ static ALCboolean solaris_reset_playback(ALCdevice *device) device->Frequency = info.play.sample_rate; device->UpdateSize = (info.play.buffer_size/device->NumUpdates) + 1; + device->TimeRes = (ALuint64)device->UpdateSize * 1000000000 / + device->Frequency; data->data_size = device->UpdateSize * frameSize; data->mix_data = calloc(1, data->data_size); @@ -273,6 +273,8 @@ static ALCboolean wave_reset_playback(ALCdevice *device) return ALC_FALSE; } + device->TimeRes = (ALuint64)device->UpdateSize * 1000000000 / + device->Frequency; SetDefaultWFXChannelOrder(device); data->thread = StartThread(WaveProc, device); diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 5791b336..4957b942 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -410,6 +410,9 @@ struct ALCdevice_struct // Number of samples rendered by this device ALuint64 SamplesPlayed; + // Precision of this device's timing + ALuint64 TimeRes; + BackendFuncs *Funcs; void *ExtraData; // For the backend's use |