Coder Social home page Coder Social logo

Comments (5)

wdigger avatar wdigger commented on June 10, 2024

We have too much linuxes in fact ;)
What distribution you tried on?
What MIDI lib is sdl2_mixer builded in?

from freeserf.

tlongstretch avatar tlongstretch commented on June 10, 2024

Nice to see you are still around :)

I am using Centos7u6, gcc7.3.1, sdl2_mixer is built in and Amiga music and all other DOS+Amiga sounds work correctly. The game runs fine, music simply does not play. My system uses pulseaudio.

FreeSerf: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.32

also tried setting SDL_AUDIODRIVER=alsa correctly switches to alsa (shows driver: also), but music stlil does not work.

console output with added debugging:

Info: [video] Initialized with SDL 2.0.10 (driver: x11)
Info: [audio] Initializing "sdlmixer".
Info: [audio] Available drivers:
Info: [audio]   pulseaudio
Info: [audio]   alsa
Info: [audio]   dsp
Info: [audio]   jack
Info: [audio]   disk
Info: [audio]   dummy
Info: [audio] Initialized with SDL 2.0.10 (driver: pulseaudio)
Info: [audio:SDL_mixer] Initializing SDL_mixer 2.0.4
Info: [audio:SDL_mixer] Initialized
Info: [audio] Initializing "sdlmixer".
Info: [audio:SDL_mixer] Playing MIDI track: 0
Warning: [audio.cc] inside play_track, failed to create sound or midi track! track_id 0
Info: [audio:SDL_mixer] Playing MIDI track: 1
Warning: [audio.cc] inside play_track, failed to create sound or midi track! track_id 1
Info: [audio:SDL_mixer] Playing MIDI track: 2
Warning: [audio.cc] inside play_track, failed to create sound or midi track! track_id 2
Info: [audio:SDL_mixer] Playing MIDI track: 3
Error: [data] Could not extract XMI clip: #3
Warning: [audio.cc] inside play_track, failed to create sound or midi track! track_id 3
Info: [audio:SDL_mixer] Playing MIDI track: 4
Warning: [audio.cc] inside play_track, failed to create sound or midi track! track_id 4

create_track(track_id) results in nullptr if I add above nullptr-check & Warning to Audio::Player::play_track function

I'm not sure if the "XMI clip" error is relevant.

from freeserf.

tlongstretch avatar tlongstretch commented on June 10, 2024

[pid 28691] prctl(PR_SET_NAME, "SDLHotplugALSA\0n") = 0
[pid 28691] open("/etc/alsa/conf.d/50-pulseaudio.conf", O_RDONLY) = 9
[pid 28691] read(9, "# Add a specific named PulseAudi"..., 4096) = 242
[pid 28691] open("/etc/alsa/conf.d/99-pulseaudio-default.conf", O_RDONLY) = 9
[pid 28691] read(9, "# Default to PulseAudio\n\npcm.!de"..., 4096) = 201
[pid 28673] open("/usr/lib64/alsa-lib/libasound_module_pcm_pulse.so", O_RDONLY|O_CLOEXEC) = 9
[pid 28673] open("/root/.pulse/client.conf", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 28673] open("/root/.config/pulse/client.conf", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 28673] open("/etc/pulse/client.conf", O_RDONLY|O_CLOEXEC) = 13
[pid 28673] read(13, "# This file is part of PulseAudi"..., 4096) = 1201
[pid 28673] openat(AT_FDCWD, "/etc/pulse/client.conf.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 28673] writev(13, [{"\20\0\5\0\f\0\0\0PULSE_SERVER", 20}], 1) = 20
[pid 28673] writev(13, [{"\20\0\5\0\n\0\0\0PULSE_SINK\0\0", 20}], 1) = 20
[pid 28673] writev(13, [{"\20\0\5\0\f\0\0\0PULSE_SOURCE", 20}], 1) = 20
[pid 28673] writev(13, [{"\20\0\5\0\f\0\0\0PULSE_COOKIE", 20}], 1) = 20
[pid 28673] memfd_create("pulseaudio", MFD_ALLOW_SEALING) = 13
[pid 28673] access("/root/.pulse", F_OK <unfinished ...>
[pid 28673] mkdir("/root/.config/pulse", 0700 <unfinished ...>
[pid 28673] open("/root/.config/pulse", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = 14
[pid 28673] readlink("/root/.config/pulse/e46638be85584c81af5fa24f91f9de1c-runtime", "/tmp/pulse-PQIFpJ7FtJ1Z", 99) = 23
[pid 28673] lstat("/tmp/pulse-PQIFpJ7FtJ1Z", {st_mode=S_IFDIR|0700, st_size=6, ...}) = 0
[pid 28673] lstat("/root/.config/pulse", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
[pid 28673] lstat("/root/.config/pulse/e46638be85584c81af5fa24f91f9de1c-runtime", {st_mode=S_IFLNK|0777, st_size=23, ...}) = 0
[pid 28673] readlink("/root/.config/pulse/e46638be85584c81af5fa24f91f9de1c-runtime", "/tmp/pulse-PQIFpJ7FtJ1Z", 4095) = 23
[pid 28673] lstat("/tmp/pulse-PQIFpJ7FtJ1Z", {st_mode=S_IFDIR|0700, st_size=6, ...}) = 0
[pid 28673] connect(14, {sa_family=AF_LOCAL, sun_path="/tmp/pulse-PQIFpJ7FtJ1Z/native"}, 110) = -1 ENOENT (No such file or directory)
[pid 28673] connect(14, {sa_family=AF_LOCAL, sun_path="/var/run/pulse/native"}, 110) = -1 ENOENT (No such file or directory)
[pid 28673] write(2, "ALSA lib pulse.c:243:(pulse_conn"..., 37ALSA lib pulse.c:243:(pulse_connect) ) = 37
[pid 28673] write(2, "PulseAudio: Unable to connect: C"..., 50PulseAudio: Unable to connect: Connection refused
[pid 28673] write(2, "ExceptionSDLmixer", 17ExceptionSDLmixer) = 17
[pid 28673] write(2, "[audio:SDL_mixer] Could not open"..., 100[audio:SDL_mixer] Could not open audio device (ALSA: Couldn't open audio device: Connection refused)) = 100

from freeserf.

tlongstretch avatar tlongstretch commented on June 10, 2024

I am thinking my pulseaudio works properly and this is some data load issue?

inside create_track, music ends up being a nullptr here:

  SDL_RWops *rw = SDL_RWFromMem(midi->get_data(),
                                static_cast<int>(midi->get_size()));
  Mix_Music *music = Mix_LoadMUS_RW(rw, 0);
  if (music == nullptr) {
    Log::Error["audio-sdlmixer.cc"] << "inside AudioSDL::PlayerMIDI::create_track, music is nullptr!";
    return nullptr;
  }

I found in SDL docs that you can capture the last error as a string:
Info: [audio-sdlmixer.cc] inside AudioSDL::PlayerMIDI::create_track, SDL_GetError is Couldn't open /etc/timidity/freepats.cfg

sounds like it can't find the actual midi device? But of course then why does Amiga music work?

found posibly relevant thread here (debian, but similar):

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=453308


dl-mixer does not depend on timidity to play midi; at least not 
technically, i.e. it does not need any of the binaries provided by the 
timidity package.
However, games do only play music if *both* the timidity and the 
freepats packages are installed, although sdl-mixer could play music 
with only the freepats package installed. The reason for this is, that 
sdl-mixer tries to load timidity's configuration file, which is provided 
in '/etc/timidity/timidity.cfg', to find out which patchset is used by 
timidity.
By now, the only patchset available in Debian is freepats. Thus the only 
line in timidity.cfg (from the Debian package) that is not commented out 
is 'source freepats.cfg'. That file is in turn provided by the freepats 
package. So the only reason, why sdl-mixer might need the timidity 
package is to learn that it should parse the freepats configuration file 
instead.

Please find applied a patch that changes the default behaviour to look 
for the timidity.cfg file (as before) and then - if it does not succeed 
- try to load the freepats.cfg file (in '/etc/timidity/freepats.cfg', as 
provided by the Debian package). This way, sdl-mixer can make use of the 
patchset provided by the freepats package without even having the 
timidity package installed. An existing freepats.cfg will still be first 
choice, however.

Thank you very much!

Cheers,
Fabian

from freeserf.

tlongstretch avatar tlongstretch commented on June 10, 2024

FIXED! the answer for me is to install 'timidity' package, I used yum install timidty

I'll make a note of this in the souce code for my fork. If you have time, it may be worth testing for nullptr when loading music and printing SDL_GetError if nullptr found, and mentioning timidity package.

from freeserf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.