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

Integration in Unity #54

Open
ankushmp opened this issue Sep 21, 2019 · 8 comments
Open

Integration in Unity #54

ankushmp opened this issue Sep 21, 2019 · 8 comments

Comments

@ankushmp
Copy link

ankushmp commented Sep 21, 2019

Hi

Just wanted to confirm few things:

  1. Can i Integrate this library in Unity3D?
  2. I want to take input from the Yamaha Piano to unity application and then deploy that application in Hololens 1(UWP). Will it work?
  3. Is there anything else needs to import along with this library.
  4. Also which library should i integrate in my Unity project for Hololens 1?

Thanks in advance.

@atsushieno
Copy link
Owner

atsushieno commented Sep 23, 2019

  1. The answers are complicated:
  • When it comes to whether I tried managed-midi with Unity, then NO. (Actually I don't use Unity, I don't build games. And Linux build had not existed in most of my C# lifetime (2001-2018).
  • most likely YES if it is about whether you can compile the .netstandard-compatible part of the sources with Unity standard libraries, as well as desktop common profiles.
  • definitely NO if you want to support Android and iOS; managed-midi supports iOS and Android through Xamarin, which is not part of .NET Standard 2.0 nor System.* framework libraries that can be shared with Unity. If you want to support those mobiles OSes you need platform-specific plugins.
  1. I never thought that Unity could support UWP, which actually seems possible. If that's the case, the answer is most likely NO if you expect built-in support, but likely YES if you can write code to fill the gap (either as a new code or making changes to existing managed-midi code).

  2. managed-midi has subsequent dependency to my alsa-sharp library, but it is used only on Linux. And those native frameworks per platform-specific implementation assembly (e.g. Mono.Android.dll for Android implementation), but nothing else.

4, To my understanding Hololens can be backed only by UWP when it comes to frameworks that managed-midi supports.

@pschon
Copy link

pschon commented Oct 5, 2019

Seems like it should work, after removing bunch of stuff that I didn't need I got it to compile and run with Unity.

Works perfectly on Windows, on Linux I get an error about not finding asound.dll when trying to play but no compile errors etc so once i get that missing dll sorted out seems like it's all good for developing and running on Linux as well.

(I'm using this instead of the more common MIDI plugin from Keijiro since i need MIDI out as well for my project. And Linux build support of course ;))

@atsushieno
Copy link
Owner

asound.dll should be actually libasound.so which is ALSA that managed-midi calls via P/Invoke methods on Linux. On Windows native shared libraries are DLLs, so those .NET-ish runtimes would have reported missing shared libraries as missing DLLs (I only know mono/mono and it does not report like "dll", but Unity-Technologies/mono may be different).

Typically those missing libraries be indicated to point to the actual shared libraries using <dllmap> configuration item. libasound.so can be found in the system directory like /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0 or whatever you have on your system or whatever libasound development package (e.g. libasound2-dev on my Ubuntu desktop) provides. Having LD_LIBRARY_PATH to include that lib path might work too.

@pschon
Copy link

pschon commented Oct 5, 2019

ok, that was a quick response! Thanks very much, found the file, sadly LD_LIBRARY_PATH didn't work so I'll need to dig around a bit to figure out how to get Unity to load it, but at least I'm making some progress again!

(And in the worst case I can always just build&run on Windows, getting it working on Linux is just a personal preference and with a game designed to be played on a specific MIDI controller it's not like I'd really need to worry about other people being able to run it anyway)

@JuanuMusic
Copy link

I was planning on using it on Unity as well. Maybe we can work together on creating the Unity implementations for each platform?

@atsushieno
Copy link
Owner

My interest is not on .NET anymore and no plan to learn Unity so far, but I can spare some time on it and would be able to help your effort.

So far my understanding on Android part is that UnityEngine has quite similar set of JNI support features to that of Xamarin.Android (namely Java.Interop). Things could become easier if we can replicate Xamarin.Android API but for Unity (otherwise it will be a bunch of JNI wrapper calls in hand-binding code).

@atsushieno
Copy link
Owner

For those who want to use MIDI input support on Unity, there is https://github.com/keijiro/Minis now.

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

No branches or pull requests

5 participants
@atsushieno @JuanuMusic @pschon @ankushmp and others