WinRT: modified the loopwave test to run if and when argv is NULL
This commit is contained in:
parent
c4d055488f
commit
764aeee2b7
1 changed files with 8 additions and 4 deletions
|
@ -78,18 +78,22 @@ poked(int sig)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
char filename[4096];
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
||||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv[1] == NULL) {
|
if (argc >= 1) {
|
||||||
argv[1] = "sample.wav";
|
SDL_strlcpy(filename, argv[1], sizeof(filename));
|
||||||
|
} else {
|
||||||
|
SDL_strlcpy(filename, "sample.wav", sizeof(filename));
|
||||||
}
|
}
|
||||||
/* Load the wave file into memory */
|
/* Load the wave file into memory */
|
||||||
if (SDL_LoadWAV(argv[1], &wave.spec, &wave.sound, &wave.soundlen) == NULL) {
|
if (SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen) == NULL) {
|
||||||
fprintf(stderr, "Couldn't load %s: %s\n", argv[1], SDL_GetError());
|
fprintf(stderr, "Couldn't load %s: %s\n", filename, SDL_GetError());
|
||||||
quit(1);
|
quit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue