mirror of
https://github.com/love2d/megasource.git
synced 2026-08-17 19:24:09 +02:00
Update SDL to 2.0.18
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -33,20 +33,20 @@ callback_data cbd[64];
|
||||
void SDLCALL
|
||||
play_through_once(void *arg, Uint8 * stream, int len)
|
||||
{
|
||||
callback_data *cbd = (callback_data *) arg;
|
||||
Uint8 *waveptr = sound + cbd->soundpos;
|
||||
int waveleft = soundlen - cbd->soundpos;
|
||||
callback_data *cbdata = (callback_data *) arg;
|
||||
Uint8 *waveptr = sound + cbdata->soundpos;
|
||||
int waveleft = soundlen - cbdata->soundpos;
|
||||
int cpy = len;
|
||||
if (cpy > waveleft)
|
||||
cpy = waveleft;
|
||||
|
||||
SDL_memcpy(stream, waveptr, cpy);
|
||||
len -= cpy;
|
||||
cbd->soundpos += cpy;
|
||||
cbdata->soundpos += cpy;
|
||||
if (len > 0) {
|
||||
stream += cpy;
|
||||
SDL_memset(stream, spec.silence, len);
|
||||
SDL_AtomicSet(&cbd->done, 1);
|
||||
SDL_AtomicSet(&cbdata->done, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,13 +180,11 @@ main(int argc, char **argv)
|
||||
if (devcount < 1) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Don't see any specific audio devices!\n");
|
||||
} else {
|
||||
if (argv[1] == NULL) {
|
||||
argv[1] = "sample.wav";
|
||||
}
|
||||
const char *file = (argc < 2) ? "sample.wav" : argv[1];
|
||||
|
||||
/* Load the wave file into memory */
|
||||
if (SDL_LoadWAV(argv[1], &spec, &sound, &soundlen) == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", argv[1],
|
||||
if (SDL_LoadWAV(file, &spec, &sound, &soundlen) == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file,
|
||||
SDL_GetError());
|
||||
} else {
|
||||
test_multi_audio(devcount);
|
||||
|
||||
Reference in New Issue
Block a user