-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
141 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.