Linux sound fix [Diablo-D3]

This commit is contained in:
pagefault
2001-12-18 21:52:55 +00:00
parent d073a30e4e
commit b6ee5d139b

View File

@@ -16,7 +16,7 @@ typedef long long LARGE_INTEGER;
#define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid()) #define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid())
// SOUND RELATED VARIABLES // SOUND RELATED VARIABLES
DWORD SoundBufferSize = 1024 * 18; // DWORD SoundBufferSize = 1; Not used in linux port
DWORD FirstSound = 1; DWORD FirstSound = 1;
int AllowDefault = 0; int AllowDefault = 0;
int SoundEnabled = 1; int SoundEnabled = 1;
@@ -37,8 +37,7 @@ static DWORD FullScreen = 0;
static int sdl_inited = 0; static int sdl_inited = 0;
static int UseOpenGL = 0; static int UseOpenGL = 0;
extern unsigned char cvidmode; extern unsigned char cvidmode;
DWORD BitDepth = 0; // Do NOT change this for ANY reason DWORD BitDepth = 0; // Do NOT change this for ANY reason!
// JOYSTICK AND KEYBOARD INPUT // JOYSTICK AND KEYBOARD INPUT
SDL_Joystick *JoystickInput[5]; SDL_Joystick *JoystickInput[5];
//DWORD CurrentJoy = 0; //DWORD CurrentJoy = 0;
@@ -67,10 +66,13 @@ DWORD CurMode = -1;
extern BYTE GUIOn2; extern BYTE GUIOn2;
static BYTE IsActivated = 1; static BYTE IsActivated = 1;
#define UPDATE_TICKS_GAME (1000.855001760297741789468390082/60.0) // milliseconds per world update //#define UPDATE_TICKS_GAME (1000.855001760297741789468390082/60.0) // milliseconds per world update
#define UPDATE_TICKS_GAMEPAL (1000/50.0)// milliseconds per world update #define UPDATE_TICKS_GAME (1000/59.95) // milliseconds per world update
//#define UPDATE_TICKS_GAMEPAL (1000/50.0)// milliseconds per world update
#define UPDATE_TICKS_GAMEPAL (20)// milliseconds per world update
#define UPDATE_TICKS_GUI (1000/36.0) // milliseconds per world update #define UPDATE_TICKS_GUI (1000/36.0) // milliseconds per world update
#define UPDATE_TICKS_UDP (1000/60.0) // milliseconds per world update //#define UPDATE_TICKS_GUI (20) // milliseconds per world update
#define UPDATE_TICKS_UDP (1000/60) // milliseconds per world update
Uint32 end, end2; Uint32 end, end2;
double start, start2; double start, start2;
@@ -263,7 +265,7 @@ int Main_Proc(void)
{ {
pressed[0x100 + event.jball.which * 32 + 8] = 1; pressed[0x100 + event.jball.which * 32 + 8] = 1;
pressed[0x100 + event.jball.which * 32 + 9] = 0; pressed[0x100 + event.jball.which * 32 + 9] = 0;
} }
} }
break; break;
@@ -479,8 +481,8 @@ int InitSound(void)
SDL_AudioSpec wanted; SDL_AudioSpec wanted;
const int freqtab[7] = const int freqtab[7] =
{ 8000, 11025, 22050, 44100, 16000, 32000, 48000 }; { 8000, 11025, 22050, 44100, 16000, 32000, 48000 };
const int samptab[7] = { 64, 64, 128, 256, 128, 256, 256 }; // const int samptab[7] = { 134, 184, 368, 735, 267, 534, 800 };
const int samptab[7] = { 1, 1, 2, 8, 2, 4, 8 };
SDL_CloseAudio(); SDL_CloseAudio();
if (!SoundEnabled) if (!SoundEnabled)
@@ -506,9 +508,9 @@ int InitSound(void)
//wanted.samples = (wanted.freq / 60) * 2 * wanted.channels; //wanted.samples = (wanted.freq / 60) * 2 * wanted.channels;
//wanted.samples = samptab[SoundQuality] * 2 * wanted.channels; //wanted.samples = samptab[SoundQuality] * 2 * wanted.channels;
wanted.samples = samptab[SoundQuality] * 8 * wanted.channels; wanted.samples = samptab[SoundQuality] * 256 * wanted.channels;
//wanted.format = AUDIO_S16LSB; wanted.format = AUDIO_S16LSB;
wanted.format = AUDIO_S16; //wanted.format = AUDIO_S16;
wanted.userdata = NULL; wanted.userdata = NULL;
wanted.callback = UpdateSound; wanted.callback = UpdateSound;
@@ -809,7 +811,7 @@ void CheckTimers(void)
} }
if (T60HZEnabled) if (T60HZEnabled)
{ {
//QueryPerformanceCounter((LARGE_INTEGER*)&end); //QueryPerformanceCounter((LARGE_INTEGER*)&end);
end = SDL_GetTicks(); end = SDL_GetTicks();