| Summary: | SDL_mixer build fixes | ||
|---|---|---|---|
| Product: | SDL_mixer | Reporter: | Ozkan Sezer <sezeroz> |
| Component: | misc | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: |
smix_build.patch
sample2.wav |
||
|
Description
Ozkan Sezer
2017-10-17 12:46:52 UTC
One annoying bug is that the playmus example program doesn't play anything :) I didn't investigate the reason. (playwav is OK though.) Here is a warning fix:
music_mikmod.c (MIKMOD_Play): add missing value return.
diff --git a/music_mikmod.c b/music_mikmod.c
--- a/music_mikmod.c
+++ b/music_mikmod.c
@@ -543,6 +543,7 @@ static int MIKMOD_Play(void *context)
MODULE *music = (MODULE *)context;
mikmod.Player_Start(music);
mikmod.Player_SetVolume((SWORD)music_volume);
+ return 0;
}
/* Return non-zero if a stream is currently playing */
Here is another: music_mikmod.c: add missing SDL_loadso.h include. diff --git a/music_mikmod.c b/music_mikmod.c --- a/music_mikmod.c +++ b/music_mikmod.c @@ -26,6 +26,7 @@ #include "music_mikmod.h" #include "mikmod.h" +#include "SDL_loadso.h" #define MAX_OUTPUT_CHANNELS 6 > One annoying bug is that the playmus example program doesn't play
Obviously Mix_PlayingMusic() is returning 0, that's why playmus breaks
from the while loop. Why Mix_PlayingMusic() is returning 0, I do not
know..
Can you attach the data file you're playing, and which music interface is being used? Thanks! Created attachment 3002 [details]
sample2.wav
I configured with :
--disable-music-mod-modplug --enable-music-mod-mikmod \
--enable-music-mp3-mad-gpl
Tested playmus with several *.mp3, *.wav and an *.it files,
without any change in result.
$ file *.mp3
h.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, JntStereo
m.mp3: MPEG ADTS, layer III, v2, 64 kbps, 22.05 kHz, JntStereo
$ file *.wav
m.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 22050 Hz
$ file *.it
f.it: Impulse Tracker module sound data - "Flightcastle" compatible w/ITv216 created w/ITv100
$ file *.s3m
e.s3m: ScreamTracker III Module sound data Title: "Bluff Eversmoking"
$ ./playmus m.wav
INFO: Opened audio at 22050 Hz 16 bit stereo (LE), 4096 bytes audio buffer
INFO: Playing m.wav
$ echo $?
0 [playmus returned here without playing anything]
Here is how I tested with sample.wav is from SDL2/test/ :
$ ./testresample sample.wav sample1.wav 22050 2
$ file sample1.wav
sample1.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 22050 Hz
$ ./playmus sample1.wav
INFO: Opened audio at 22050 Hz 16 bit stereo (LE), 4096 bytes audio buffer
INFO: Playing sample1.wav
[same result]
$ ./testresample sample.wav sample1.wav 8000 1
$ file sample2.wav
sample2.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz
$ ./playmus sample2.wav
INFO: Opened audio at 22050 Hz 16 bit stereo (LE), 4096 bytes audio buffer
INFO: Playing sample2.wav
[same result again...]
Attaching sample2.wav here per your request.
Flac files yields the same result. $ file s.flac s.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 10986780 samples [ozzie@localhost x1]$ ./playmus s.flac INFO: Opened audio at 22050 Hz 16 bit stereo (LE), 4096 bytes audio buffer INFO: Playing s.flac $ echo $? 0 [playmus returned here without playing anything] Your patch and some other fixes are in, thanks! https://hg.libsdl.org/SDL_mixer/rev/74df2aa47195 I can reproduce the playmus issue here, I'm investigating. And the problem with playmus immediately quitting is fixed: https://hg.libsdl.org/SDL_mixer/rev/90487b4b7ade Thanks! The following still needs applying to music_mikmod.c:
diff --git a/music_mikmod.c b/music_mikmod.c
--- a/music_mikmod.c
+++ b/music_mikmod.c
@@ -24,10 +24,11 @@
/* This file supports MOD tracker music streams */
#include "music_mikmod.h"
#include "mikmod.h"
+#include "SDL_loadso.h"
#define MAX_OUTPUT_CHANNELS 6
/* libmikmod >= 3.3.2 constified several funcs */
@@ -541,10 +542,11 @@
static int MIKMOD_Play(void *context)
{
MODULE *music = (MODULE *)context;
mikmod.Player_Start(music);
mikmod.Player_SetVolume((SWORD)music_volume);
+ return 0;
}
/* Return non-zero if a stream is currently playing */
static SDL_bool MIKMOD_IsPlaying(void *context)
{
As for the newly merged timidity changes, you can look at
libtimidity (which was based on SDL_sound of timidity) and
merge stuff if you want:
https://sf.net/projects/libtimidity/
https://github.com/sezero/libtimidity.git
Update: everything seems to play with playmus, but the 8 KHz mono wav file attached here (sample2.wav) doesn't play. $ file sample2.wav sample2.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz I hear about half a second output and then it quits. playwave is OK with it. > As for the newly merged timidity changes, you can look at
> libtimidity (which was based on SDL_sound of timidity) and
> merge stuff if you want:
> https://sf.net/projects/libtimidity/
> https://github.com/sezero/libtimidity.git
About timidity:
$ SDL_AUDIODRIVER=dsp valgrind ./playmus hex1.mid
[snip]
==26375== Conditional jump or move depends on uninitialised value(s)
==26375== at 0x40209B4: read_midi_file (readmidi.c:381)
==26375== by 0x4022505: Timidity_LoadDLSSong (timidity.c:533)
==26375== by 0x402263F: Timidity_LoadSong (timidity.c:559)
==26375== by 0x4019C1E: TIMIDITY_CreateFromRW (music_timidity.c:43)
==26375== by 0x40163B6: Mix_LoadMUSType_RW (music.c:512)
==26375== by 0x40166C2: Mix_LoadMUS (music.c:472)
==26375== by 0x804924C: main (playmus.c:207)
This one can be cured by a quick fix like the following:
diff --git a/timidity/readmidi.c b/timidity/readmidi.c
--- a/timidity/readmidi.c
+++ b/timidity/readmidi.c
@@ -540,9 +540,10 @@ MidiEvent *read_midi_file(MidiSong *song
/* Put a do-nothing event first in the list for easier processing */
song->evlist=safe_malloc(sizeof(MidiEventList));
- song->evlist->event.time=0;
+/*song->evlist->event.time=0;
+ song->evlist->next=NULL;*/
+ memset(song->evlist,0,sizeof(MidiEventList));
song->evlist->event.type=ME_NONE;
- song->evlist->next=0;
song->event_count++;
switch(format)
However, there is the following during playback:
==27615== Conditional jump or move depends on uninitialised value(s)
==27615== at 0x401E745: s32tos16 (output.c:58)
==27615== by 0x401F5E4: compute_data (playmidi.c:627)
==27615== by 0x401FD18: Timidity_PlaySome (playmidi.c:779)
==27615== by 0x4019B4F: TIMIDITY_GetAudio (music_timidity.c:66)
==27615== by 0x401577A: music_mixer (music.c:240)
==27615== by 0x4014DC7: mix_channels (mixer.c:263)
==27615== by 0x4036ABB: SDL_RunAudio (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0x409A20D: SDL_RunThread (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0x411371C: RunThread (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0xD6F32E: start_thread (pthread_create.c:297)
==27615== by 0x6FD720D: clone (in /lib/libc-2.8.so)
==27615==
==27615== Conditional jump or move depends on uninitialised value(s)
==27615== at 0x401E751: s32tos16 (output.c:61)
==27615== by 0x401F5E4: compute_data (playmidi.c:627)
==27615== by 0x401FD18: Timidity_PlaySome (playmidi.c:779)
==27615== by 0x4019B4F: TIMIDITY_GetAudio (music_timidity.c:66)
==27615== by 0x401577A: music_mixer (music.c:240)
==27615== by 0x4014DC7: mix_channels (mixer.c:263)
==27615== by 0x4036ABB: SDL_RunAudio (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0x409A20D: SDL_RunThread (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0x411371C: RunThread (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0xD6F32E: start_thread (pthread_create.c:297)
==27615== by 0x6FD720D: clone (in /lib/libc-2.8.so)
==27615==
==27615== Syscall param write(buf) points to uninitialised byte(s)
==27615== at 0xD75BBB: (within /lib/libpthread-2.8.so)
==27615== by 0x4036ADD: SDL_RunAudio (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0x409A20D: SDL_RunThread (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0x411371C: RunThread (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0xD6F32E: start_thread (pthread_create.c:297)
==27615== by 0x6FD720D: clone (in /lib/libc-2.8.so)
==27615== Address 0x4158d3c is 5,588 bytes inside a block of size 16,384 alloc'd
==27615== at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==27615== by 0x40987F6: SDL_malloc_REAL (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0x40EBC53: DSP_OpenDevice (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0x403875A: open_audio_device (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0x403E9A9: SDL_OpenAudioDevice (in /home/ozzie/opt/SDL2/lib/libSDL2-2.0.so.0.6.0)
==27615== by 0x4014ACA: Mix_OpenAudioDevice (mixer.c:409)
==27615== by 0x4014D52: Mix_OpenAudio (mixer.c:471)
==27615== by 0x8049038: main (playmus.c:181)
libtimidity I referenced above doesn't emit these.
We would need to use libtimidity with the artistic license option instead of the LGPL. Would it be possible to change the license it uses? I grant permission to use all of my changes under that license. (In reply to Sam Lantinga from comment #13) > We would need to use libtimidity with the artistic license option instead of > the LGPL. Would it be possible to change the license it uses? I grant > permission to use all of my changes under that license. Tuukka Toivonen allowed original tmimidty to be used under GPL, LGPL and Artistic: http://ieee.uwaterloo.ca/sca/www.cgs.fi/tt/timidity/ Timidity in SDL_sound is based on that original timidity 0.2i and has that same notice; libtimidity was based on the timidity in SDL_sound: so I am guessing that it sould be possible to use libtimidity under Artistic, but I want to ask Konstantin about it. Someone else had asked the same thing too. I am not good with legal stuff. So I am forwarding the question to Konstantin Korikov (lostclus at gmail.com) with you CC'ed. feel free to ping him yourself too. |