Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find fluidsynth.dll #8

Closed
Yorgg opened this issue Jul 13, 2020 · 8 comments
Closed

Unable to find fluidsynth.dll #8

Yorgg opened this issue Jul 13, 2020 · 8 comments
Labels

Comments

@Yorgg
Copy link

Yorgg commented Jul 13, 2020

I'm having some trouble connecting to the fluidsynth.dll.

steps:

  1. I build the .dll on Windows using msys2: https://github.com/FluidSynth/fluidsynth/wiki/BuildingWithCMake#building-with-msys2-on-windows

  2. Then on /build/src/ I find libfluidsynth-2.dll (this the correct .dll file I hope?)

  3. I copy this file into my Unity Assets folder, and rename it to fluidsynth.dll

  4. On Unity I get a DllNotFound exception: fluidsynth.

I tried this with fluidsynths versions 2.1.3, and 2.0.8.

Do you know what I'm doing wrong here? thanks!

@atsushieno
Copy link
Owner

I haven't written any code with Unity so I barely have ideas, but looks like the directory structure is more complicated than just putting the files directly into Unity Assets folder? : https://ericeastwood.com/blog/17/unity-and-dlls-c-managed-and-c-unmanaged

I believe that fuildsynth.dll filename is correct.

@Yorgg
Copy link
Author

Yorgg commented Jul 14, 2020

Thanks for the response. I wanted to be sure that I am using the correct .dll file.

This is the file I'm using (highlighted):
Capture

I think its loading the .dll - as I am also getting the error: Plugins: Failed to load 'Assets/Plugins/fluidsynth.dll' because one or more of its dependencies could not be loaded

@atsushieno
Copy link
Owner

Wasn't fluidsynth dependent on glib-2.0 etc. ? Unless all those dependencies are statically linked, they also have to be there.

@Yorgg
Copy link
Author

Yorgg commented Jul 15, 2020

I used https://github.com/lucasg/Dependencies and found 13 dependencies.
The error message has disappeared. Thanks!

@Yorgg Yorgg closed this as completed Jul 15, 2020
@Yorgg
Copy link
Author

Yorgg commented Jul 16, 2020

By the way, I cannot hear audio when I make a noteon event. :/

I think this is probably a Unity+fluidsynth issue, so I made post on fluidsynth repo.

Would you have any idea what the issue is?

 using (var settings = new NFluidsynth.Settings())  {              
    settings[ConfigurationKeys.SynthAudioChannels].IntValue = 2;
    using (var syn = new Synth(settings)) {
      syn.LoadSoundFont("/usr/share/sounds/pathtoyoursoundfont.sf2", true);
      for (int i = 0; i < 16; i++)
        syn.SoundFontSelect(i, 1);
                   
      using (var adriver = new AudioDriver(syn.Settings, syn)) {
         syn.ProgramChange(0, 0);
         syn.NoteOn(0, 60, 120);    // cannot hear audio here :( 
      }
    }
}

@atsushieno
Copy link
Owner

Try applicable audio drivers that works on your machine? Like this https://github.com/atsushieno/nfluidsynth/blob/master/NFluidsynth.Sample/Program.cs#L15

@Yorgg
Copy link
Author

Yorgg commented Jul 16, 2020

I tried all the Windows' audio drivers, but no luck.
The audio works fine when I open fluidsynth.exe outside of Unity - so maybe the issue is related to the Unity environment.
Hmm...

@Yorgg
Copy link
Author

Yorgg commented Jul 16, 2020

I realized the sound wasn't working because the audio driver was immediately being disposed. Problem fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants