From 6967da8780dcdad990227f93850cc0cf76ba2f21 Mon Sep 17 00:00:00 2001 From: Kaoru Shoji <0x0badc0de@gmail.com> Date: Sun, 8 May 2022 06:53:27 +0900 Subject: [PATCH] Apply Unity package layout --- .gitignore | 8 +-- CHANGELOG.md | 10 +++ CHANGELOG.md.meta | 7 ++ Documentation~/jp.kshoji.rtpmidi.md | 64 +++++++++++++++++++ ...RTP-MIDI-for-.NET.sln.meta => LICENSE.meta | 2 +- README.md.meta | 7 ++ RTP-MIDI-for-.NET.meta => Runtime.meta | 0 ...MIDI-for-.NET.sln.meta => Runtime.sln.meta | 0 .../IRtpMidiEventHandler.cs | 0 .../IRtpMidiEventHandler.cs.meta | 0 .../Properties.meta | 0 .../Properties/AssemblyInfo.cs | 0 .../Properties/AssemblyInfo.cs.meta | 0 .../RtpMidiClock.cs | 0 .../RtpMidiClock.cs.meta | 0 .../RtpMidiParser.cs | 0 .../RtpMidiParser.cs.meta | 0 .../RtpMidiProtocol.cs | 0 .../RtpMidiProtocol.cs.meta | 0 .../RtpMidiServer.cs | 0 .../RtpMidiServer.cs.meta | 0 .../RtpMidiSession.cs | 0 .../RtpMidiSession.cs.meta | 0 .../Runtime.csproj.meta | 0 Runtime/jp.kshoji.rtpmidi.asmdef | 14 ++++ Runtime/jp.kshoji.rtpmidi.asmdef.meta | 7 ++ package.json | 20 ++++++ package.json.meta | 7 ++ 28 files changed, 141 insertions(+), 5 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 CHANGELOG.md.meta create mode 100644 Documentation~/jp.kshoji.rtpmidi.md rename RTP-MIDI-for-.NET/RTP-MIDI-for-.NET.sln.meta => LICENSE.meta (74%) create mode 100644 README.md.meta rename RTP-MIDI-for-.NET.meta => Runtime.meta (100%) rename RTP-MIDI-for-.NET.sln.meta => Runtime.sln.meta (100%) rename {RTP-MIDI-for-.NET => Runtime}/IRtpMidiEventHandler.cs (100%) rename {RTP-MIDI-for-.NET => Runtime}/IRtpMidiEventHandler.cs.meta (100%) rename {RTP-MIDI-for-.NET => Runtime}/Properties.meta (100%) rename {RTP-MIDI-for-.NET => Runtime}/Properties/AssemblyInfo.cs (100%) rename {RTP-MIDI-for-.NET => Runtime}/Properties/AssemblyInfo.cs.meta (100%) rename {RTP-MIDI-for-.NET => Runtime}/RtpMidiClock.cs (100%) rename {RTP-MIDI-for-.NET => Runtime}/RtpMidiClock.cs.meta (100%) rename {RTP-MIDI-for-.NET => Runtime}/RtpMidiParser.cs (100%) rename {RTP-MIDI-for-.NET => Runtime}/RtpMidiParser.cs.meta (100%) rename {RTP-MIDI-for-.NET => Runtime}/RtpMidiProtocol.cs (100%) rename {RTP-MIDI-for-.NET => Runtime}/RtpMidiProtocol.cs.meta (100%) rename {RTP-MIDI-for-.NET => Runtime}/RtpMidiServer.cs (100%) rename {RTP-MIDI-for-.NET => Runtime}/RtpMidiServer.cs.meta (100%) rename {RTP-MIDI-for-.NET => Runtime}/RtpMidiSession.cs (100%) rename {RTP-MIDI-for-.NET => Runtime}/RtpMidiSession.cs.meta (100%) rename RTP-MIDI-for-.NET/RTP-MIDI-for-.NET.csproj.meta => Runtime/Runtime.csproj.meta (100%) create mode 100644 Runtime/jp.kshoji.rtpmidi.asmdef create mode 100644 Runtime/jp.kshoji.rtpmidi.asmdef.meta create mode 100644 package.json create mode 100644 package.json.meta diff --git a/.gitignore b/.gitignore index 5cd104d..85e0720 100644 --- a/.gitignore +++ b/.gitignore @@ -58,8 +58,8 @@ sysinfo.txt # Crashlytics generated file crashlytics-build.properties -RTP-MIDI-for-.NET/bin -RTP-MIDI-for-.NET/obj -RTP-MIDI-for-.NET/bin.meta -RTP-MIDI-for-.NET/obj.meta .idea +Runtime/bin +Runtime/obj +Runtime/bin.meta +Runtime/obj.meta diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8f1730c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog +All notable changes to this package will be documented in this file. + +## [1.0.0] - 2022-05-08 + +### Initial release + +* Initial release. +* Ported RTP MIDI features from [Arduino-AppleMIDI-Library](https://github.com/lathoub/Arduino-AppleMIDI-Library), to C#. +* No dependency with Unity, so it also runs on pure .NET environment. diff --git a/CHANGELOG.md.meta b/CHANGELOG.md.meta new file mode 100644 index 0000000..6a2e131 --- /dev/null +++ b/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 51fdec2bbfb27d0429f0d503fa545057 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Documentation~/jp.kshoji.rtpmidi.md b/Documentation~/jp.kshoji.rtpmidi.md new file mode 100644 index 0000000..9cc908d --- /dev/null +++ b/Documentation~/jp.kshoji.rtpmidi.md @@ -0,0 +1,64 @@ +# How to use this library + +## Use this library with Unity +At first, setup the library to Unity Project. +Open the `manifest.json` for your project and add the following entry to your list of dependencies. + +```json +"jp.kshoji.rtpmidi": "https://github.com/kshoji/RTP-MIDI-for-.NET.git", +``` + +## Start RTP MIDI Listener +`Listener` can accept connection from the other RTP MIDI `Initiator` host. +```cs +// defines and create a instance of RTP MIDI connection listener. +class RtpMidiDeviceConnectionListenerImpl : IRtpMidiDeviceConnectionListener +{ + void OnRtpMidiDeviceAttached(string deviceId) + { + Console.WriteLine($"device {deviceId} connected."); + } + + void OnRtpMidiDeviceDetached(string deviceId) + { + Console.WriteLine($"device {deviceId} disconnected."); + } +} +var connectionListner = new RtpMidiDeviceConnectionListenerImpl(); + +// Create a server instance, listening UDP port 5004 (control port), and 5005 (data port) +var rtpMidiServer = new RtpMidiServer("My session name", 5004, connectionListener); +// Start the server. Now, the server can connect from the RTP MIDI Initiator host. +rtpMidiServer.Start(); +``` + +## Start RTP MIDI Initiator +`Initiator` can connect to the another `Listener` hosts. +```cs +// Connect to another RTP MIDI listener +rtpMidiServer.ConnectToListener(new IPEndpoint(IPAddress.Parse("192.168.0.100"), 5004)); +``` + +## Receive MIDI events +```cs +// defines and create a instance of RTP MIDI event listener. +class MidiEventHandler : IRtpMidiEventHandler +{ + void OnMidiNoteOn(int channel, int note, int velocity) + { + Console.WriteLine($"Note on channel: {channel}, note: {note}, velocity: {velocity}"); + } +... +} +var midiEventHandler = new MidiEventHandler(); + +// attach the RTP MIDI event listener. +rtpMidiServer.SetMidiEventListener(midiEventHandler); +``` + +## Send MIDI events +```cs +// Example: send note on event with channel 1, note 64, velocity 127 +// deviceId can obtain from RtpMidiDeviceConnectionListenerImpl.OnRtpMidiDeviceAttached callback. +rtpMidiServer.SendMidiNoteOn(deviceId, 0, 64, 127); +``` diff --git a/RTP-MIDI-for-.NET/RTP-MIDI-for-.NET.sln.meta b/LICENSE.meta similarity index 74% rename from RTP-MIDI-for-.NET/RTP-MIDI-for-.NET.sln.meta rename to LICENSE.meta index 4751102..6f78307 100644 --- a/RTP-MIDI-for-.NET/RTP-MIDI-for-.NET.sln.meta +++ b/LICENSE.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 10bf93958fba6574ba9ed048bb4de1b6 +guid: a4e8de0d24564f1449975465f789e106 DefaultImporter: externalObjects: {} userData: diff --git a/README.md.meta b/README.md.meta new file mode 100644 index 0000000..1acb84d --- /dev/null +++ b/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 26bc2805dc244a147b79038875cf40dc +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RTP-MIDI-for-.NET.meta b/Runtime.meta similarity index 100% rename from RTP-MIDI-for-.NET.meta rename to Runtime.meta diff --git a/RTP-MIDI-for-.NET.sln.meta b/Runtime.sln.meta similarity index 100% rename from RTP-MIDI-for-.NET.sln.meta rename to Runtime.sln.meta diff --git a/RTP-MIDI-for-.NET/IRtpMidiEventHandler.cs b/Runtime/IRtpMidiEventHandler.cs similarity index 100% rename from RTP-MIDI-for-.NET/IRtpMidiEventHandler.cs rename to Runtime/IRtpMidiEventHandler.cs diff --git a/RTP-MIDI-for-.NET/IRtpMidiEventHandler.cs.meta b/Runtime/IRtpMidiEventHandler.cs.meta similarity index 100% rename from RTP-MIDI-for-.NET/IRtpMidiEventHandler.cs.meta rename to Runtime/IRtpMidiEventHandler.cs.meta diff --git a/RTP-MIDI-for-.NET/Properties.meta b/Runtime/Properties.meta similarity index 100% rename from RTP-MIDI-for-.NET/Properties.meta rename to Runtime/Properties.meta diff --git a/RTP-MIDI-for-.NET/Properties/AssemblyInfo.cs b/Runtime/Properties/AssemblyInfo.cs similarity index 100% rename from RTP-MIDI-for-.NET/Properties/AssemblyInfo.cs rename to Runtime/Properties/AssemblyInfo.cs diff --git a/RTP-MIDI-for-.NET/Properties/AssemblyInfo.cs.meta b/Runtime/Properties/AssemblyInfo.cs.meta similarity index 100% rename from RTP-MIDI-for-.NET/Properties/AssemblyInfo.cs.meta rename to Runtime/Properties/AssemblyInfo.cs.meta diff --git a/RTP-MIDI-for-.NET/RtpMidiClock.cs b/Runtime/RtpMidiClock.cs similarity index 100% rename from RTP-MIDI-for-.NET/RtpMidiClock.cs rename to Runtime/RtpMidiClock.cs diff --git a/RTP-MIDI-for-.NET/RtpMidiClock.cs.meta b/Runtime/RtpMidiClock.cs.meta similarity index 100% rename from RTP-MIDI-for-.NET/RtpMidiClock.cs.meta rename to Runtime/RtpMidiClock.cs.meta diff --git a/RTP-MIDI-for-.NET/RtpMidiParser.cs b/Runtime/RtpMidiParser.cs similarity index 100% rename from RTP-MIDI-for-.NET/RtpMidiParser.cs rename to Runtime/RtpMidiParser.cs diff --git a/RTP-MIDI-for-.NET/RtpMidiParser.cs.meta b/Runtime/RtpMidiParser.cs.meta similarity index 100% rename from RTP-MIDI-for-.NET/RtpMidiParser.cs.meta rename to Runtime/RtpMidiParser.cs.meta diff --git a/RTP-MIDI-for-.NET/RtpMidiProtocol.cs b/Runtime/RtpMidiProtocol.cs similarity index 100% rename from RTP-MIDI-for-.NET/RtpMidiProtocol.cs rename to Runtime/RtpMidiProtocol.cs diff --git a/RTP-MIDI-for-.NET/RtpMidiProtocol.cs.meta b/Runtime/RtpMidiProtocol.cs.meta similarity index 100% rename from RTP-MIDI-for-.NET/RtpMidiProtocol.cs.meta rename to Runtime/RtpMidiProtocol.cs.meta diff --git a/RTP-MIDI-for-.NET/RtpMidiServer.cs b/Runtime/RtpMidiServer.cs similarity index 100% rename from RTP-MIDI-for-.NET/RtpMidiServer.cs rename to Runtime/RtpMidiServer.cs diff --git a/RTP-MIDI-for-.NET/RtpMidiServer.cs.meta b/Runtime/RtpMidiServer.cs.meta similarity index 100% rename from RTP-MIDI-for-.NET/RtpMidiServer.cs.meta rename to Runtime/RtpMidiServer.cs.meta diff --git a/RTP-MIDI-for-.NET/RtpMidiSession.cs b/Runtime/RtpMidiSession.cs similarity index 100% rename from RTP-MIDI-for-.NET/RtpMidiSession.cs rename to Runtime/RtpMidiSession.cs diff --git a/RTP-MIDI-for-.NET/RtpMidiSession.cs.meta b/Runtime/RtpMidiSession.cs.meta similarity index 100% rename from RTP-MIDI-for-.NET/RtpMidiSession.cs.meta rename to Runtime/RtpMidiSession.cs.meta diff --git a/RTP-MIDI-for-.NET/RTP-MIDI-for-.NET.csproj.meta b/Runtime/Runtime.csproj.meta similarity index 100% rename from RTP-MIDI-for-.NET/RTP-MIDI-for-.NET.csproj.meta rename to Runtime/Runtime.csproj.meta diff --git a/Runtime/jp.kshoji.rtpmidi.asmdef b/Runtime/jp.kshoji.rtpmidi.asmdef new file mode 100644 index 0000000..14ed234 --- /dev/null +++ b/Runtime/jp.kshoji.rtpmidi.asmdef @@ -0,0 +1,14 @@ +{ + "name": "jp.kshoji.rtpmidi", + "rootNamespace": "jp.kshoji.rtpmidi", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Runtime/jp.kshoji.rtpmidi.asmdef.meta b/Runtime/jp.kshoji.rtpmidi.asmdef.meta new file mode 100644 index 0000000..d2c6055 --- /dev/null +++ b/Runtime/jp.kshoji.rtpmidi.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0c4b9cff76174304b959fb7000b7002e +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package.json b/package.json new file mode 100644 index 0000000..b85c742 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "jp.kshoji.midisystem", + "displayName": "RTP-MIDI", + "description": "RTP-MIDI porting for .NET / Unity", + "version": "1.0.0", + "unity": "2018.4", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/kshoji/RTP-MIDI-for-.NET.git" + }, + "author": "Kaoru Shoji <0x0badc0de@gmail.com> (https://github.com/kshoji)", + "changelogUrl": "https://github.com/kshoji/RTP-MIDI-for-.NET/blob/main/CHANGELOG.md", + "documentationUrl": "https://github.com/kshoji/RTP-MIDI-for-.NET/blob/main/Documentation~/jp.kshoji.rtpmidi.md", + "licensesUrl": "https://github.com/kshoji/RTP-MIDI-for-.NET/blob/main/LICENSE", + "keywords": [ + "midi", + "rtp" + ] +} \ No newline at end of file diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..fc5a1c7 --- /dev/null +++ b/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 80e594ddb1c177244afb7b13a3765b98 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: