aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c37
-rw-r--r--Alc/ALu.c1
-rw-r--r--Alc/alsa.c9
-rw-r--r--Alc/dsound.c10
-rw-r--r--Alc/null.c24
-rw-r--r--Alc/oss.c10
-rw-r--r--Alc/portaudio.c10
-rw-r--r--Alc/pulseaudio.c29
-rw-r--r--Alc/solaris.c11
-rw-r--r--Alc/wave.c23
-rw-r--r--Alc/winmm.c8
11 files changed, 13 insertions, 159 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 7d58c6c1..938f83f7 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -39,7 +39,7 @@
#include "alu.h"
-#define EmptyFuncs { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+#define EmptyFuncs { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
typedef struct BackendInfo {
const char *name;
void (*Init)(BackendFuncs*);
@@ -897,11 +897,6 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
aluInitPanning(device);
- // Scale the number of samples played according to the new sample rate
- device->SamplesPlayed *= device->Frequency;
- device->SamplesPlayed += oldRate-1;
- device->SamplesPlayed /= oldRate;
-
for(i = 0;i < OUTPUTCHANNELS;i++)
{
device->ClickRemoval[i] = 0.0f;
@@ -1514,32 +1509,6 @@ ALC_API ALCvoid ALC_APIENTRY alcGetIntegerv(ALCdevice *device,ALCenum param,ALsi
*data = device->Connected;
break;
- case ALC_GET_TIME_EXT:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else if(size < 2)
- alcSetError(device, ALC_INVALID_VALUE);
- else
- {
- ALuint64 t = ALCdevice_GetTime(device);
- t -= t%device->TimeRes;
- data[0] = t&0xffffffff;
- data[1] = t>>32;
- }
- break;
-
- case ALC_GET_TIME_RES_EXT:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else if(size < 2)
- alcSetError(device, ALC_INVALID_VALUE);
- else
- {
- data[0] = device->TimeRes&0xffffffff;
- data[1] = device->TimeRes>>32;
- }
- break;
-
default:
alcSetError(device, ALC_INVALID_ENUM);
break;
@@ -2034,10 +2003,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
device->Contexts = NULL;
device->NumContexts = 0;
- device->SamplesPlayed = 0;
-
- device->TimeRes = 1;
-
InitUIntMap(&device->BufferMap);
InitUIntMap(&device->EffectMap);
InitUIntMap(&device->FilterMap);
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 8fc7269b..79c18254 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -749,7 +749,6 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
ProcessContext(*ctx);
ctx++;
}
- device->SamplesPlayed += SamplesToDo;
ProcessContext(NULL);
//Post processing loop
diff --git a/Alc/alsa.c b/Alc/alsa.c
index bbe55a52..7dbf82e0 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -690,7 +690,6 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
psnd_pcm_sw_params_free(sp);
- device->TimeRes = (ALuint64)periodSizeInFrames * 1000000000 / rate;
device->Frequency = rate;
SetDefaultChannelOrder(device);
@@ -993,11 +992,6 @@ static void alsa_capture_samples(ALCdevice *Device, ALCvoid *Buffer, ALCuint Sam
alcSetError(Device, ALC_INVALID_VALUE);
}
-static ALuint64 alsa_get_time(ALCdevice *Device)
-{
- return Device->SamplesPlayed * 1000000000 / Device->Frequency;
-}
-
BackendFuncs alsa_funcs = {
alsa_open_playback,
@@ -1009,8 +1003,7 @@ BackendFuncs alsa_funcs = {
alsa_start_capture,
alsa_stop_capture,
alsa_capture_samples,
- alsa_available_samples,
- alsa_get_time
+ alsa_available_samples
};
void alc_alsa_init(BackendFuncs *func_list)
diff --git a/Alc/dsound.c b/Alc/dsound.c
index 5779e5f7..2a7f8de0 100644
--- a/Alc/dsound.c
+++ b/Alc/dsound.c
@@ -462,8 +462,6 @@ 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);
@@ -541,11 +539,6 @@ static ALCuint DSoundAvailableSamples(ALCdevice *pDevice)
return 0;
}
-static ALuint64 DSoundGetTime(ALCdevice *Device)
-{
- return Device->SamplesPlayed * 1000000000 / Device->Frequency;
-}
-
BackendFuncs DSoundFuncs = {
DSoundOpenPlayback,
@@ -557,8 +550,7 @@ BackendFuncs DSoundFuncs = {
DSoundStartCapture,
DSoundStopCapture,
DSoundCaptureSamples,
- DSoundAvailableSamples,
- DSoundGetTime
+ DSoundAvailableSamples
};
diff --git a/Alc/null.c b/Alc/null.c
index ad3d3f6a..ffff4224 100644
--- a/Alc/null.c
+++ b/Alc/null.c
@@ -30,9 +30,6 @@ typedef struct {
ALvoid *buffer;
ALuint size;
- ALuint startTime;
- ALuint64 baseTime;
-
volatile int killNow;
ALvoid *thread;
} null_data;
@@ -50,7 +47,7 @@ static ALuint NullProc(ALvoid *ptr)
Device->Frequency / 2;
done = 0;
- start = data->startTime;
+ start = timeGetTime();
while(!data->killNow && Device->Connected)
{
now = timeGetTime();
@@ -115,9 +112,6 @@ static ALCboolean null_reset_playback(ALCdevice *device)
}
SetDefaultWFXChannelOrder(device);
- device->TimeRes = 1000000;
-
- data->startTime = timeGetTime();
data->thread = StartThread(NullProc, device);
if(data->thread == NULL)
{
@@ -132,7 +126,6 @@ static ALCboolean null_reset_playback(ALCdevice *device)
static void null_stop_playback(ALCdevice *device)
{
null_data *data = (null_data*)device->ExtraData;
- ALuint ext;
if(!data->thread)
return;
@@ -143,9 +136,6 @@ static void null_stop_playback(ALCdevice *device)
data->killNow = 0;
- ext = timeGetTime() - data->startTime;
- data->baseTime += (ALuint64)ext * 1000000;
-
free(data->buffer);
data->buffer = NULL;
}
@@ -158,15 +148,6 @@ static ALCboolean null_open_capture(ALCdevice *device, const ALCchar *deviceName
return ALC_FALSE;
}
-static ALuint64 null_get_time(ALCdevice *Device)
-{
- null_data *data = (null_data*)Device->ExtraData;
- ALuint ext = 0;
- if(data->thread)
- ext = timeGetTime() - data->startTime;
- return data->baseTime + ((ALuint64)ext * 1000000);
-}
-
BackendFuncs null_funcs = {
null_open_playback,
@@ -178,8 +159,7 @@ BackendFuncs null_funcs = {
NULL,
NULL,
NULL,
- NULL,
- null_get_time
+ NULL
};
void alc_null_init(BackendFuncs *func_list)
diff --git a/Alc/oss.c b/Alc/oss.c
index 66c3c55b..898c10ef 100644
--- a/Alc/oss.c
+++ b/Alc/oss.c
@@ -267,8 +267,6 @@ 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);
@@ -465,11 +463,6 @@ static ALCuint oss_available_samples(ALCdevice *pDevice)
return RingBufferSize(data->ring);
}
-static ALuint64 oss_get_time(ALCdevice *Device)
-{
- return Device->SamplesPlayed * 1000000000 / Device->Frequency;
-}
-
BackendFuncs oss_funcs = {
oss_open_playback,
@@ -481,8 +474,7 @@ BackendFuncs oss_funcs = {
oss_start_capture,
oss_stop_capture,
oss_capture_samples,
- oss_available_samples,
- oss_get_time
+ oss_available_samples
};
void alc_oss_init(BackendFuncs *func_list)
diff --git a/Alc/portaudio.c b/Alc/portaudio.c
index 062c403a..2b8e0fa4 100644
--- a/Alc/portaudio.c
+++ b/Alc/portaudio.c
@@ -250,8 +250,6 @@ 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)
@@ -394,11 +392,6 @@ static ALCuint pa_available_samples(ALCdevice *device)
return RingBufferSize(data->ring);
}
-static ALuint64 pa_get_time(ALCdevice *Device)
-{
- return Device->SamplesPlayed * 1000000000 / Device->Frequency;
-}
-
static const BackendFuncs pa_funcs = {
pa_open_playback,
@@ -410,8 +403,7 @@ static const BackendFuncs pa_funcs = {
pa_start_capture,
pa_stop_capture,
pa_capture_samples,
- pa_available_samples,
- pa_get_time
+ pa_available_samples
};
void alc_pa_init(BackendFuncs *func_list)
diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c
index 81e56cf8..46ac446a 100644
--- a/Alc/pulseaudio.c
+++ b/Alc/pulseaudio.c
@@ -137,9 +137,6 @@ typedef struct {
pa_threaded_mainloop *loop;
- ALuint64 baseTime;
- pa_usec_t lastTime;
-
ALvoid *thread;
volatile ALboolean killNow;
@@ -965,8 +962,6 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{
ppa_stream_set_write_callback(data->stream, stream_write_callback, device);
ppa_stream_set_underflow_callback(data->stream, stream_signal_callback, device);
- device->TimeRes = 1000;
-
data->thread = StartThread(PulseProc, device);
if(!data->thread)
{
@@ -992,7 +987,6 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{
static void pulse_stop_playback(ALCdevice *device) //{{{
{
pulse_data *data = device->ExtraData;
- pa_usec_t usec = 0;
if(!data->stream)
return;
@@ -1008,11 +1002,6 @@ static void pulse_stop_playback(ALCdevice *device) //{{{
ppa_threaded_mainloop_lock(data->loop);
- if(ppa_stream_get_time(data->stream, &usec) != PA_OK)
- usec = data->lastTime;
- data->baseTime += usec*1000;
- data->lastTime = 0;
-
#if PA_CHECK_VERSION(0,9,15)
if(ppa_stream_set_buffer_attr_callback)
ppa_stream_set_buffer_attr_callback(data->stream, NULL, NULL);
@@ -1241,21 +1230,6 @@ static void pulse_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint sa
alcSetError(device, ALC_INVALID_VALUE);
} //}}}
-static ALuint64 pulse_get_time(ALCdevice *Device) //{{{
-{
- pulse_data *data = Device->ExtraData;
- pa_usec_t usec;
-
- ppa_threaded_mainloop_lock(data->loop);
- if(!data->stream || ppa_stream_get_time(data->stream, &usec) != PA_OK)
- usec = data->lastTime;
- else
- data->lastTime = usec;
- ppa_threaded_mainloop_unlock(data->loop);
-
- return data->baseTime + usec*1000;
-} //}}}
-
BackendFuncs pulse_funcs = { //{{{
pulse_open_playback,
@@ -1267,8 +1241,7 @@ BackendFuncs pulse_funcs = { //{{{
pulse_start_capture,
pulse_stop_capture,
pulse_capture_samples,
- pulse_available_samples,
- pulse_get_time
+ pulse_available_samples
}; //}}}
void alc_pulse_init(BackendFuncs *func_list) //{{{
diff --git a/Alc/solaris.c b/Alc/solaris.c
index 275d81ac..d07bac0b 100644
--- a/Alc/solaris.c
+++ b/Alc/solaris.c
@@ -99,6 +99,7 @@ static ALCboolean solaris_open_playback(ALCdevice *device, const ALCchar *device
strncpy(driver, GetConfigValue("solaris", "device", "/dev/audio"), sizeof(driver)-1);
driver[sizeof(driver)-1] = 0;
+
if(!deviceName)
deviceName = solaris_device;
else if(strcmp(deviceName, solaris_device) != 0)
@@ -192,8 +193,6 @@ 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);
@@ -267,11 +266,6 @@ static ALCuint solaris_available_samples(ALCdevice *pDevice)
return 0;
}
-static ALuint64 solaris_get_time(ALCdevice *Device)
-{
- return Device->SamplesPlayed * 1000000000 / Device->Frequency;
-}
-
BackendFuncs solaris_funcs = {
solaris_open_playback,
@@ -283,8 +277,7 @@ BackendFuncs solaris_funcs = {
solaris_start_capture,
solaris_stop_capture,
solaris_capture_samples,
- solaris_available_samples,
- solaris_get_time
+ solaris_available_samples
};
void alc_solaris_init(BackendFuncs *func_list)
diff --git a/Alc/wave.c b/Alc/wave.c
index f24fc867..efe58f92 100644
--- a/Alc/wave.c
+++ b/Alc/wave.c
@@ -35,9 +35,6 @@ typedef struct {
ALvoid *buffer;
ALuint size;
- ALuint startTime;
- ALuint64 baseTime;
-
volatile int killNow;
ALvoid *thread;
} wave_data;
@@ -85,7 +82,7 @@ static ALuint WaveProc(ALvoid *ptr)
frameSize = aluFrameSizeFromFormat(pDevice->Format);
done = 0;
- start = data->startTime;
+ start = timeGetTime();
while(!data->killNow && pDevice->Connected)
{
now = timeGetTime();
@@ -284,9 +281,7 @@ static ALCboolean wave_reset_playback(ALCdevice *device)
}
SetDefaultWFXChannelOrder(device);
- device->TimeRes = 1000000;
- data->startTime = timeGetTime();
data->thread = StartThread(WaveProc, device);
if(data->thread == NULL)
{
@@ -302,7 +297,6 @@ static void wave_stop_playback(ALCdevice *device)
{
wave_data *data = (wave_data*)device->ExtraData;
ALuint dataLen;
- ALuint ext;
long size;
if(!data->thread)
@@ -314,9 +308,6 @@ static void wave_stop_playback(ALCdevice *device)
data->killNow = 0;
- ext = timeGetTime() - data->startTime;
- data->baseTime += (ALuint64)ext * 1000000;
-
free(data->buffer);
data->buffer = NULL;
@@ -350,15 +341,6 @@ static ALCboolean wave_open_capture(ALCdevice *pDevice, const ALCchar *deviceNam
return ALC_FALSE;
}
-static ALuint64 wave_get_time(ALCdevice *Device)
-{
- wave_data *data = (wave_data*)Device->ExtraData;
- ALuint ext = 0;
- if(data->thread)
- ext = timeGetTime() - data->startTime;
- return data->baseTime + ((ALuint64)ext * 1000000);
-}
-
BackendFuncs wave_funcs = {
wave_open_playback,
@@ -370,8 +352,7 @@ BackendFuncs wave_funcs = {
NULL,
NULL,
NULL,
- NULL,
- wave_get_time
+ NULL
};
void alc_wave_init(BackendFuncs *func_list)
diff --git a/Alc/winmm.c b/Alc/winmm.c
index 61ff87b7..3796a30c 100644
--- a/Alc/winmm.c
+++ b/Alc/winmm.c
@@ -401,11 +401,6 @@ static void WinMMCaptureSamples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lS
alcSetError(pDevice, ALC_INVALID_VALUE);
}
-static ALuint64 WinMMGetTime(ALCdevice *Device)
-{
- return Device->SamplesPlayed * 1000000000 / Device->Frequency;
-}
-
static BackendFuncs WinMMFuncs = {
WinMMOpenPlayback,
@@ -417,8 +412,7 @@ static BackendFuncs WinMMFuncs = {
WinMMStartCapture,
WinMMStopCapture,
WinMMCaptureSamples,
- WinMMAvailableSamples,
- WinMMGetTime
+ WinMMAvailableSamples
};
void alcWinMMInit(BackendFuncs *FuncList)