Don't needlessly expose a variable for the backends

This commit is contained in:
Chris Robinson 2010-05-12 07:27:12 -07:00
parent 2220c22c90
commit a53e3dda75
6 changed files with 13 additions and 15 deletions

View File

@ -360,7 +360,7 @@ static const ALchar alExtList[] =
"AL_LOKI_quadriphonic"; "AL_LOKI_quadriphonic";
// Mixing Priority Level // Mixing Priority Level
ALint RTPrioLevel; static ALint RTPrioLevel;
// Resampler Quality // Resampler Quality
resampler_t DefaultResampler; resampler_t DefaultResampler;
@ -604,19 +604,19 @@ void al_print(const char *fname, unsigned int line, const char *fmt, ...)
fprintf(stderr, "%s", str); fprintf(stderr, "%s", str);
} }
void EnableRTPrio(ALint level) void SetRTPriority(void)
{ {
ALboolean failed; ALboolean failed;
#ifdef _WIN32 #ifdef _WIN32
if(level > 0) if(RTPrioLevel > 0)
failed = !SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); failed = !SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
else else
failed = !SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); failed = !SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
#elif defined(HAVE_PTHREAD_SETSCHEDPARAM) #elif defined(HAVE_PTHREAD_SETSCHEDPARAM)
struct sched_param param; struct sched_param param;
if(level > 0) if(RTPrioLevel > 0)
{ {
/* Use the minimum real-time priority possible for now (on Linux this /* Use the minimum real-time priority possible for now (on Linux this
* should be 1 for SCHED_RR) */ * should be 1 for SCHED_RR) */
@ -630,7 +630,7 @@ void EnableRTPrio(ALint level)
} }
#else #else
/* Real-time priority not available */ /* Real-time priority not available */
failed = !!level; failed = (RTPrioLevel>0);
#endif #endif
if(failed) if(failed)
AL_PRINT("Failed to set priority level for thread\n"); AL_PRINT("Failed to set priority level for thread\n");

View File

@ -358,7 +358,7 @@ static ALuint ALSAProc(ALvoid *ptr)
char *WritePtr; char *WritePtr;
int err; int err;
EnableRTPrio(RTPrioLevel); SetRTPriority();
while(!data->killNow) while(!data->killNow)
{ {
@ -432,7 +432,7 @@ static ALuint ALSANoMMapProc(ALvoid *ptr)
snd_pcm_sframes_t avail; snd_pcm_sframes_t avail;
char *WritePtr; char *WritePtr;
EnableRTPrio(RTPrioLevel); SetRTPriority();
while(!data->killNow) while(!data->killNow)
{ {
@ -488,7 +488,7 @@ static ALuint ALSANoMMapCaptureProc(ALvoid *ptr)
alsa_data *data = (alsa_data*)pDevice->ExtraData; alsa_data *data = (alsa_data*)pDevice->ExtraData;
snd_pcm_sframes_t avail; snd_pcm_sframes_t avail;
EnableRTPrio(RTPrioLevel); SetRTPriority();
while(!data->killNow) while(!data->killNow)
{ {

View File

@ -163,7 +163,7 @@ static ALuint DSoundProc(ALvoid *ptr)
DWORD avail; DWORD avail;
HRESULT err; HRESULT err;
EnableRTPrio(RTPrioLevel); SetRTPriority();
memset(&DSBCaps, 0, sizeof(DSBCaps)); memset(&DSBCaps, 0, sizeof(DSBCaps));
DSBCaps.dwSize = sizeof(DSBCaps); DSBCaps.dwSize = sizeof(DSBCaps);

View File

@ -82,7 +82,7 @@ static ALuint OSSProc(ALvoid *ptr)
ALint frameSize; ALint frameSize;
ssize_t wrote; ssize_t wrote;
EnableRTPrio(RTPrioLevel); SetRTPriority();
frameSize = aluChannelsFromFormat(pDevice->Format) * frameSize = aluChannelsFromFormat(pDevice->Format) *
aluBytesFromFormat(pDevice->Format); aluBytesFromFormat(pDevice->Format);
@ -124,7 +124,7 @@ static ALuint OSSCaptureProc(ALvoid *ptr)
int frameSize; int frameSize;
int amt; int amt;
EnableRTPrio(RTPrioLevel); SetRTPriority();
frameSize = aluBytesFromFormat(pDevice->Format); frameSize = aluBytesFromFormat(pDevice->Format);
frameSize *= aluChannelsFromFormat(pDevice->Format); frameSize *= aluChannelsFromFormat(pDevice->Format);

View File

@ -57,7 +57,7 @@ static ALuint SolarisProc(ALvoid *ptr)
ALint frameSize; ALint frameSize;
int wrote; int wrote;
EnableRTPrio(RTPrioLevel); SetRTPriority();
frameSize = aluChannelsFromFormat(pDevice->Format) * frameSize = aluChannelsFromFormat(pDevice->Format) *
aluBytesFromFormat(pDevice->Format); aluBytesFromFormat(pDevice->Format);

View File

@ -439,8 +439,6 @@ struct ALCcontext_struct
ALCcontext *next; ALCcontext *next;
}; };
extern ALint RTPrioLevel;
ALCvoid ReleaseALC(ALCvoid); ALCvoid ReleaseALC(ALCvoid);
void AppendDeviceList(const ALCchar *name); void AppendDeviceList(const ALCchar *name);
@ -472,7 +470,7 @@ int GetConfigValueInt(const char *blockName, const char *keyName, int def);
float GetConfigValueFloat(const char *blockName, const char *keyName, float def); float GetConfigValueFloat(const char *blockName, const char *keyName, float def);
int GetConfigValueBool(const char *blockName, const char *keyName, int def); int GetConfigValueBool(const char *blockName, const char *keyName, int def);
void EnableRTPrio(ALint level); void SetRTPriority(void);
void SetDefaultChannelOrder(ALCdevice *device); void SetDefaultChannelOrder(ALCdevice *device);
void SetDefaultWFXChannelOrder(ALCdevice *device); void SetDefaultWFXChannelOrder(ALCdevice *device);