Skip to content

Commit

Permalink
playmus.c: Show information about detected music type
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohlstand committed Nov 26, 2019
1 parent c3ee8ff commit 800c4aa
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions playmus.c
Expand Up @@ -117,6 +117,7 @@ int main(int argc, char *argv[])
int interactive = 0;
int rwops = 0;
int i;
const char *typ;

/* Initialize variables */
audio_rate = MIX_DEFAULT_FREQUENCY;
Expand Down Expand Up @@ -215,6 +216,40 @@ int main(int argc, char *argv[])
CleanUp(2);
}

switch (Mix_GetMusicType(music)) {
case MUS_CMD:
typ = "CMD";
break;
case MUS_WAV:
typ = "WAV";
break;
case MUS_MOD:
case MUS_MODPLUG_UNUSED:
typ = "MOD";
break;
case MUS_FLAC:
typ = "FLAC";
break;
case MUS_MID:
typ = "MIDI";
break;
case MUS_OGG:
typ = "OGG Vorbis";
break;
case MUS_MP3:
case MUS_MP3_MAD_UNUSED:
typ = "MP3";
break;
case MUS_OPUS:
typ = "OPUS";
break;
case MUS_NONE:
default:
typ = "NONE";
break;
}
SDL_Log("Detected music type: %s", typ);

/* Play and then exit */
SDL_Log("Playing %s\n", argv[i]);
Mix_FadeInMusic(music,looping,2000);
Expand Down

0 comments on commit 800c4aa

Please sign in to comment.