Browse Source

Merge pull request #10 from Chance4us/master

Update sound.cpp
pull/18/head
ApertureSecurity 7 years ago committed by GitHub
parent
commit
8a783f565d
  1. 12
      Stub/sound.cpp

12
Stub/sound.cpp

@ -41,7 +41,7 @@ void __fastcall snd_init(HWND hWnd)
printf("Opened 3 channels\n\n\n"); printf("Opened 3 channels\n\n\n");
} }
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) { if (Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 1024) < 0) {
printf("SDL_mixer could not initialize! SDL_mixer Error: %s\n", Mix_GetError()); printf("SDL_mixer could not initialize! SDL_mixer Error: %s\n", Mix_GetError());
} }
@ -76,9 +76,9 @@ void fill_audio(void *udata, Uint8 *stream, int len)
void __fastcall music_start(int nTrack) void __fastcall music_start(int nTrack)
{ {
//DUMMY(); //DUMMY();
wanted.freq = 22050; wanted.freq = 44100;
wanted.format = AUDIO_S8; wanted.format = AUDIO_S16LSB;
wanted.channels = 5; /* 1 = mono, 2 = stereo */ wanted.channels = 2; /* 1 = mono, 2 = stereo */
wanted.samples = 1024; /* Good low-latency value for callback */ wanted.samples = 1024; /* Good low-latency value for callback */
wanted.callback = fill_audio; wanted.callback = fill_audio;
wanted.userdata = NULL; wanted.userdata = NULL;
@ -101,7 +101,7 @@ void __fastcall music_start(int nTrack)
// This is a hack.... I don't like it . // This is a hack.... I don't like it .
// If you know this better than I , please help clean it up. // If you know this better than I , please help clean it up.
Mix_OpenAudio(22050, AUDIO_S8, 1, 1024); Mix_OpenAudio(44100, AUDIO_S16LSB, 1, 1024);
file = sgpMusicTrack; file = sgpMusicTrack;
bytestoread = (int)SFileGetFileSize((HANDLE)file, 0); bytestoread = (int)SFileGetFileSize((HANDLE)file, 0);
buffer = DiabloAllocPtr(bytestoread); buffer = DiabloAllocPtr(bytestoread);
@ -222,4 +222,4 @@ void __fastcall snd_update(BOOL bStopAll)
{ {
// DUMMY_PRINT("stopall: %d", bStopAll); // DUMMY_PRINT("stopall: %d", bStopAll);
} }

Loading…
Cancel
Save