Coder Social home page Coder Social logo

Comments (12)

pedrolcl avatar pedrolcl commented on August 28, 2024

If you want to help to better diagnose this issue, please:

  • Open a terminal window (cmd.exe)
  • at the system prompt ("C:>"), type: CHCP, and post the answer from the system.
  • change to the QSynth directory. Probably...
    C:> cd "C:\Program Files\Qsynth"
  • now, type the command:
    C:> fluidsynth.exe -a wasapi -Q
    and please post the results.

from qsynth.

nanitaro avatar nanitaro commented on August 28, 2024

The results are collected.
It contains Japanese information and is encoded in UTF-8.
Qsynth.log

from qsynth.

pedrolcl avatar pedrolcl commented on August 28, 2024

Your system uses Code Page 932 which is customary for Japanese language. Fluidsynth retrieves the names of the audio devices from Windows, and stores these names in options/settings, encoded in cp932, so Windows native programs will work without any flaws.

The problem is that Qsynth is a Qt application, and the strings need to be encoded in Unicode for displaying. Qsynth is not taking this into account, so the audio device names in your screenshot appear garbled. Not only that, but it is storing these names into QStrings without proper conversion either, so the selection of audio devices do not work.

@rncbc : what do you think? this seems to me a serious bug.

from qsynth.

rncbc avatar rncbc commented on August 28, 2024

seems to me that a QString::fromUtf8() is needed in:

(pData->pListItem)->setText(iCol++, pszCurrent);
(pData->pListItem)->setText(iCol++, pszDefault);

like this?

 (pData->pListItem)->setText(iCol++, QString::fromUtf8(pszCurrent)); 
 (pData->pListItem)->setText(iCol++, QString::fromUtf8(pszDefault)); 

from qsynth.

pedrolcl avatar pedrolcl commented on August 28, 2024

seems to me that a QString::fromUtf8() is needed in:

(pData->pListItem)->setText(iCol++, pszCurrent);
(pData->pListItem)->setText(iCol++, pszDefault);

like this?

 (pData->pListItem)->setText(iCol++, QString::fromUtf8(pszCurrent)); 
 (pData->pListItem)->setText(iCol++, QString::fromUtf8(pszDefault)); 

Why fromUtf8() ? the problem is that Fluidsynth does not provide the option strings with any fixed or predictable encoding. See:

https://github.com/FluidSynth/fluidsynth/blob/cb8da1e1e2c0a5cff2bab6a419755b598b793384/src/drivers/fluid_wasapi.c#L789-L795

And this is the documentation for the function ' WideCharToMultiByte' :

https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte

Maps a UTF-16 (wide character) string to a new character string. The new character string is not necessarily from a multibyte character set.

where CP_ACP means:

The system default Windows ANSI code page.

Note This value can be different on different computers, even on the same network. It can be changed on the same computer, leading to stored data becoming irrecoverably corrupted. This value is only intended for temporary use and permanent storage should use UTF-16 or UTF-8 if possible.

from qsynth.

rncbc avatar rncbc commented on August 28, 2024

so it maybe a fluid_settings/windows blunder? does 1ec61bf behave any better?

from qsynth.

pedrolcl avatar pedrolcl commented on August 28, 2024

so it maybe a fluid_settings/windows blunder? does 1ec61bf behave any better?

I guess that your question is for @nanitaro but first you should ask him if he is able to build and test qsynth's git repository by himself.

I can test it in a Windows machine with a Spanish or English locale, but that is not the same problem.

from qsynth.

rncbc avatar rncbc commented on August 28, 2024

I now see that, perhaps my change will only work properly if WideCharToMultiByte would be called with CP_UTF8, instead of CP_ACP (on fluid_wasapi.c) :S

at least qsynth is now prepared; lest to say the ball is at fluidsynth's side, I guess :)

from qsynth.

pedrolcl avatar pedrolcl commented on August 28, 2024

I take that back. I can do some tests on my Windows box.

First, I've renamed my windows audio devices, to something very tricky:

audio_devices_renamed

This is the output of CHCP and fluidsynth.exe -a wasapi -Q (encoded in utf-8) My terminal is using cp1252:

wasapi_fluidsynth.txt

This is the result of your change 1ec61bf :

imagen

The garbage is similar in v0.9.90 but the important effect is that selecting any device name other than "default", the driver initialization fails with:

18:18:40.047 Qsynth1: Creating audio driver (wasapi)...
18:18:40.059 Qsynth1: Failed to create the audio driver (wasapi). Cannot continue without it.

from qsynth.

rncbc avatar rncbc commented on August 28, 2024

yeah right, but what if you change it to CP_UTF8 in fluidsynth's fluid_wasapi.c ?

from qsynth.

pedrolcl avatar pedrolcl commented on August 28, 2024

yeah right, but what if you change it to CP_UTF8 in fluidsynth's fluid_wasapi.c ?

That any and all other windows programs linking to libfluidsynth.dll, not expecting Unicode in Fluidsynth options, will break. Even the fluidsynth.exe CLI program will output garbage when using the arguments "-a wasapi -Q":

Available audio devices:
 default
 Áürïçularès (High Definition Audio Device)
 ├æ├í├®├¡├│├║├ç (HDMI) (2- High Definition Audio Device)

It is important for a library to keep backward compatibility, so in my opinion changing Fluidsynth can only be done very carefully, after analyzing all other options. For instance, having a new optional build switch to create some libfluidsynth-unicode.dll that would be friendly to downstream Qt projects.

But in this case, I guess that it can be a bug in Fluidsynth's Wasapi driver, because all other drivers use CP_UTF8.

from qsynth.

nanitaro avatar nanitaro commented on August 28, 2024

Thank you for your response.

I guess that your question is for @nanitaro but first you should ask him if he is able to build and test qsynth's git repository by himself.

Sorry, I cannot build it myself.
I have MSYS2 installed but am not familiar with it.
However, since you seem to be able to reproduce the bug, please continue to investigate.

from qsynth.

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.