Reformat to something more readable for me :3
This commit is contained in:
+8
-8
@@ -16,7 +16,7 @@ pthread_t gSoundThread;
|
||||
long long timeInMilliseconds(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
gettimeofday(&tv, nullptr);
|
||||
|
||||
return(((long long)tv.tv_sec)*1000)+(tv.tv_usec/1000);
|
||||
}
|
||||
@@ -26,14 +26,14 @@ void* audio_thread(void* keepAlive)
|
||||
// from https://github.com/ckosmic/libsm64/blob/audio/src/libsm64.c#L535-L555
|
||||
// except keepAlive is a null pointer here, so don't use it
|
||||
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL);
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,NULL);
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,nullptr);
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,nullptr);
|
||||
|
||||
long long currentTime = timeInMilliseconds();
|
||||
long long targetTime = 0;
|
||||
while(1)
|
||||
{
|
||||
//if(!*((bool*)keepAlive)) return NULL;
|
||||
//if(!*((bool*)keepAlive)) return nullptr;
|
||||
|
||||
int16_t audioBuffer[544 * 2 * 2];
|
||||
uint32_t numSamples = sm64_audio_tick(SDL_GetQueuedAudioSize(dev)/4, 1100, audioBuffer);
|
||||
@@ -44,7 +44,7 @@ void* audio_thread(void* keepAlive)
|
||||
while (timeInMilliseconds() < targetTime)
|
||||
{
|
||||
usleep(100);
|
||||
//if(!*((bool*)keepAlive)) return NULL;
|
||||
//if(!*((bool*)keepAlive)) return nullptr;
|
||||
}
|
||||
currentTime = timeInMilliseconds();
|
||||
}
|
||||
@@ -63,8 +63,8 @@ void audio_init()
|
||||
want.format = AUDIO_S16;
|
||||
want.channels = 2;
|
||||
want.samples = 512;
|
||||
want.callback = NULL;
|
||||
dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
|
||||
want.callback = nullptr;
|
||||
dev = SDL_OpenAudioDevice(nullptr, 0, &want, &have, 0);
|
||||
if (dev == 0) {
|
||||
fprintf(stderr, "SDL_OpenAudio error: %s\n", SDL_GetError());
|
||||
return;
|
||||
@@ -72,6 +72,6 @@ void audio_init()
|
||||
SDL_PauseAudioDevice(dev, 0);
|
||||
|
||||
// it's best to run audio in a separate thread
|
||||
pthread_create(&gSoundThread, NULL, audio_thread, NULL);
|
||||
pthread_create(&gSoundThread, nullptr, audio_thread, nullptr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user