FluidSynth / fluidsynth

Software synthesizer based on the SoundFont 2 specifications
https://www.fluidsynth.org
GNU Lesser General Public License v2.1
1.89k stars 259 forks source link

MIDI files with non-ASCII characters in the filename fail to play on Windows. #1388

Closed ghost closed 3 weeks ago

ghost commented 2 months ago

FluidSynth version

fluidsynth.exe --version FluidSynth runtime version 2.3.6 Copyright (C) 2000-2024 Peter Hanappe and others. Distributed under the LGPL license. SoundFont(R) is a registered trademark of Creative Technology Ltd.

FluidSynth executable version 2.3.6 Sample type=float

Describe the bug

On Windows, playback failures due to non-ASCII characters in filenames occur with MIDI files, but not with SoundFont files. MIDI files that use only ASCII characters in the filename will play correctly.

When _WIN32 macro is enabled. fluid_is_midifile() is called twice in main() of fluidsynth.c. The first time, u8_path is set as the argument, which is argv[i] converted by win32_ansi_to_utf8(). The second time, argv[i] is set as the argument without being converted. This difference is a bit concerning.

Thank you.

derselbst commented 1 month ago

@stardusteyes Thanks for the report. Can you test the fluidsynth-x64 binaries and confirm that this fixes the problem?

ghost commented 1 month ago

I'm a little concerned that the following is not included, but I don't mind if it doesn't cause any problems.

if defined(_WIN32)

    free(u8_buf);

endif


I only tested the current issue. The test binary worked as expected. I think the problem is fixed.

Thank you.

derselbst commented 1 month ago

Ok, thanks for confirming. I indeed missed the free(), thanks!

pedrolcl commented 3 weeks ago

@derselbst , reopen request:

$ ./fluidsynth.exe -F test.wav ~/fluidsynth-git/test/ⓉⒺⓈⓉ.mid
fluidsynth: debug: adding audio.dsound.device=Controlador primario de sonido
fluidsynth: debug: adding audio.dsound.device=GroßeStraßenlautsprecher (HDMI) (2- High Definition Au
dio Device)
fluidsynth: debug: Testing audio device: GroßeStraßenlautsprecher (HDMI)
FluidSynth runtime version 2.4.0
Copyright (C) 2000-2024 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

fluidsynth: error: fluid_is_soundfont(): fopen() failed: 'File does not exist.'
Parameter 'C:/msys64/home/pedro/fluidsynth-git/test/????.mid' not a SoundFont or MIDI file or error
occurred identifying it.
No midi file specified!

$ ls -la ~/fluidsynth-git/test/ⓉⒺⓈⓉ.mid
-rw-r--r-- 1 pedro Ninguno 175 Nov  2 13:31 /home/pedro/fluidsynth-git/test/ⓉⒺⓈⓉ.mid