Skip to content

Commit

Permalink
Merge branch 'kshoji:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rikner authored Feb 15, 2024
2 parents 1129671 + 553b8a2 commit 63c421b
Show file tree
Hide file tree
Showing 32 changed files with 268 additions and 21 deletions.
2 changes: 1 addition & 1 deletion MIDIDriver/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ publishing {
release(MavenPublication) {
group = 'jp.kshoji'
artifactId = 'midi-driver'
version = '0.1.7'
version = '0.1.9'

afterEvaluate {
from components.release
Expand Down
4 changes: 2 additions & 2 deletions MIDIDriver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>jp.kshoji</groupId>
<artifactId>midi-driver</artifactId>
<version>0.1.7-SNAPSHOT</version>
<version>0.1.9</version>
<packaging>aar</packaging>
<name>Android USB MIDI Driver Library</name>
<description>USB MIDI Driver for Android tablets(3.1 or higher)</description>
Expand Down Expand Up @@ -133,7 +133,7 @@
<dependency>
<groupId>jp.kshoji</groupId>
<artifactId>javax-sound-midi</artifactId>
<version>0.0.4-SNAPSHOT</version>
<version>0.0.4</version>
<type>aar</type>
</dependency>
</dependencies>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9dc6f04c80ea55d7c698460c9287e89f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ebe7726e94eb13e533f74cdb1d4ccb3ffbeb02a4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
37be3216148b4212241b9404c6128fc865c6733e4b7a447fa31299c34dd71568
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d2e29a48b54865af19053df00b6a24efc8e9a33c0bb18f71b7071b7a1e10423f29c9e97cf8479215ac7a5ff00fd28c664303377ff20913e937748945647247c6
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f5452f048fdf5f03a7c537d6167d2c8e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bf136fa6dc1e6dd1661890dd5303684ae3bceb34
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4e3564593594b1c06072a1ad84ccac73626f1928c93f6babb07d456403fa9cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ab2dabd7e8f055c74f7548942ef0fba09cbf0f6301e07c09ba4e2dac3ed8ec073fd9d12a8a2022ce08a49d66d72954dd3ff55b7344814a50806fbfab5c812015
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"formatVersion": "1.1",
"component": {
"group": "jp.kshoji",
"module": "midi-driver",
"version": "0.1.8",
"attributes": {
"org.gradle.status": "release"
}
},
"createdBy": {
"gradle": {
"version": "7.5"
}
},
"variants": [
{
"name": "releaseVariantReleaseApiPublication",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.libraryelements": "aar",
"org.gradle.usage": "java-api"
},
"dependencies": [
{
"group": "jp.kshoji",
"module": "javax-sound-midi",
"version": {
"requires": "0.0.4"
},
"excludes": [
{
"group": "*",
"module": "*"
}
],
"thirdPartyCompatibility": {
"artifactSelector": {
"name": "javax-sound-midi",
"type": "aar",
"extension": "aar"
}
}
},
{
"group": "androidx.annotation",
"module": "annotation",
"version": {
"requires": "1.4.0"
}
}
],
"files": [
{
"name": "midi-driver-0.1.8.aar",
"url": "midi-driver-0.1.8.aar",
"size": 82844,
"sha512": "ab2dabd7e8f055c74f7548942ef0fba09cbf0f6301e07c09ba4e2dac3ed8ec073fd9d12a8a2022ce08a49d66d72954dd3ff55b7344814a50806fbfab5c812015",
"sha256": "4e3564593594b1c06072a1ad84ccac73626f1928c93f6babb07d456403fa9cdc",
"sha1": "bf136fa6dc1e6dd1661890dd5303684ae3bceb34",
"md5": "f5452f048fdf5f03a7c537d6167d2c8e"
}
]
},
{
"name": "releaseVariantReleaseRuntimePublication",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.libraryelements": "aar",
"org.gradle.usage": "java-runtime"
},
"dependencies": [
{
"group": "jp.kshoji",
"module": "javax-sound-midi",
"version": {
"requires": "0.0.4"
},
"excludes": [
{
"group": "*",
"module": "*"
}
],
"thirdPartyCompatibility": {
"artifactSelector": {
"name": "javax-sound-midi",
"type": "aar",
"extension": "aar"
}
}
},
{
"group": "androidx.annotation",
"module": "annotation",
"version": {
"requires": "1.4.0"
}
}
],
"files": [
{
"name": "midi-driver-0.1.8.aar",
"url": "midi-driver-0.1.8.aar",
"size": 82844,
"sha512": "ab2dabd7e8f055c74f7548942ef0fba09cbf0f6301e07c09ba4e2dac3ed8ec073fd9d12a8a2022ce08a49d66d72954dd3ff55b7344814a50806fbfab5c812015",
"sha256": "4e3564593594b1c06072a1ad84ccac73626f1928c93f6babb07d456403fa9cdc",
"sha1": "bf136fa6dc1e6dd1661890dd5303684ae3bceb34",
"md5": "f5452f048fdf5f03a7c537d6167d2c8e"
}
]
},
{
"name": "releaseVariantReleaseSourcePublication",
"attributes": {
"org.gradle.category": "documentation",
"org.gradle.dependency.bundling": "external",
"org.gradle.docstype": "sources",
"org.gradle.usage": "java-runtime"
},
"files": [
{
"name": "midi-driver-0.1.8-sources.jar",
"url": "midi-driver-0.1.8-sources.jar",
"size": 45678,
"sha512": "d2e29a48b54865af19053df00b6a24efc8e9a33c0bb18f71b7071b7a1e10423f29c9e97cf8479215ac7a5ff00fd28c664303377ff20913e937748945647247c6",
"sha256": "37be3216148b4212241b9404c6128fc865c6733e4b7a447fa31299c34dd71568",
"sha1": "ebe7726e94eb13e533f74cdb1d4ccb3ffbeb02a4",
"md5": "9dc6f04c80ea55d7c698460c9287e89f"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ed99cf492069cc5b218274e7e4f394c3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c62cb6f1efb7d2adb4869138af6a0e774b9867de
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
59937fe7519588e0727daaf638978ecd46c1f12d16bdd48395eff83fc59ee62c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2c846c26b9375233e2d5ade33714b77c62bfc41c633bc15280fdb15e2054693d2d016482dd491cbdfb1c74bd6358142eb9bd79d00febd0c21841f87bad02ffb8
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- This module was also published with a richer model, Gradle metadata, -->
<!-- which should be used instead. Do not delete the following line which -->
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
<!-- that they should prefer consuming it instead. -->
<!-- do_not_remove: published-with-gradle-metadata -->
<modelVersion>4.0.0</modelVersion>
<groupId>jp.kshoji</groupId>
<artifactId>midi-driver</artifactId>
<version>0.1.8</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>jp.kshoji</groupId>
<artifactId>javax-sound-midi</artifactId>
<version>0.0.4</version>
<type>aar</type>
<classifier></classifier>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>androidx.annotation</groupId>
<artifactId>annotation</artifactId>
<version>1.4.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0094bfd85704eb21dc6aca1255724ca5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
772421d11c87a3ecd9dadc1125de0a37e52fd340
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1ade3e44217dd65b0437604fb2f3c2fe310df9f1ed15aecc7bbdf31b151f59a1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8555156194c4bbf61bc0163c89c05485e99f58459347ceda4172431d85b32abb038884af3dbf1ee7212f92dc67c4fe48638f6b3ca760439bbe102b722b2579e2
7 changes: 4 additions & 3 deletions MIDIDriver/snapshots/jp/kshoji/midi-driver/maven-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<groupId>jp.kshoji</groupId>
<artifactId>midi-driver</artifactId>
<versioning>
<latest>0.1.7</latest>
<release>0.1.7</release>
<latest>0.1.8</latest>
<release>0.1.8</release>
<versions>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
Expand All @@ -23,7 +23,8 @@
<version>0.1.6</version>
<version>0.1.7-SNAPSHOT</version>
<version>0.1.7</version>
<version>0.1.8</version>
</versions>
<lastUpdated>20220816201507</lastUpdated>
<lastUpdated>20231204100230</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5b4bfc6e6e4ede429ccf690bc2b05215
47d28fe69fca4f789d58b42ad2384360
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4f18830556d4743990f2b08d2785ce41b1b3f522
2ab4431b44aa307090964daac46726cae27f2d71
Original file line number Diff line number Diff line change
@@ -1 +1 @@
64bc603a47c82284b6c6f82a9aeeee9626113d04f94555d9cd751c8a66c58925
e2e86c6aed5e3293bb8c4bb638f1a8c945fc90a88ab5746d4fb3f1fefec4f93d
Original file line number Diff line number Diff line change
@@ -1 +1 @@
099d918169c256708ade88d35dbb744a42ca5249a8170a66823cb67210a3a31c9d35512027bb5a63fbfa575ce80513049a604a7481ec3f4a6e7b2e337c78adb2
a5ba0da34bd8c0968723bf4b8bf0cdff8eda333b67a6d559fda6c857c6ef2aa950536149cae350aea4aabe5b21aa56e48d17f47655f47ca796eb61b92530aaad
73 changes: 65 additions & 8 deletions MIDIDriver/src/jp/kshoji/unity/midi/UsbMidiUnityPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class UsbMidiUnityPlugin {

private UsbMidiDriver usbMidiDriver;
HashMap<String, MidiOutputDevice> midiOutputDeviceMap = new HashMap<>();
HashMap<String, MidiInputDevice> midiInputDeviceMap = new HashMap<>();

OnUsbMidiDeviceConnectionListener onMidiDeviceConnectionListener;
OnUsbMidiInputEventListener onMidiInputEventListener;
Expand All @@ -46,6 +47,7 @@ public void onDeviceAttached(@NonNull UsbDevice usbDevice) {

@Override
public void onMidiInputDeviceAttached(@NonNull MidiInputDevice midiInputDevice) {
midiInputDeviceMap.put(midiInputDevice.getDeviceAddress(), midiInputDevice);
if (onMidiDeviceConnectionListener != null) {
onMidiDeviceConnectionListener.onMidiInputDeviceAttached(midiInputDevice.getDeviceAddress());
return;
Expand All @@ -71,6 +73,7 @@ public void onDeviceDetached(@NonNull UsbDevice usbDevice) {

@Override
public void onMidiInputDeviceDetached(@NonNull MidiInputDevice midiInputDevice) {
midiInputDeviceMap.remove(midiInputDevice.getDeviceAddress());
if (onMidiDeviceConnectionListener != null) {
onMidiDeviceConnectionListener.onMidiInputDeviceDetached(midiInputDevice.getDeviceAddress());
return;
Expand Down Expand Up @@ -321,20 +324,74 @@ public void terminate() {
* @return device name, product name, or null
*/
public String getDeviceName(String deviceId) {
MidiOutputDevice device = midiOutputDeviceMap.get(deviceId);
if (device != null) {
if (!TextUtils.isEmpty(device.getProductName())) {
return device.getProductName();
MidiOutputDevice outputDevice = midiOutputDeviceMap.get(deviceId);
if (outputDevice != null) {
if (!TextUtils.isEmpty(outputDevice.getProductName())) {
return outputDevice.getProductName();
}
if (!TextUtils.isEmpty(device.getUsbDevice().getDeviceName())) {
return device.getUsbDevice().getDeviceName();
if (!TextUtils.isEmpty(outputDevice.getUsbDevice().getDeviceName())) {
return outputDevice.getUsbDevice().getDeviceName();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (!TextUtils.isEmpty(device.getUsbDevice().getProductName())) {
return device.getUsbDevice().getProductName();
if (!TextUtils.isEmpty(outputDevice.getUsbDevice().getProductName())) {
return outputDevice.getUsbDevice().getProductName();
}
}
}

MidiInputDevice inputDevice = midiInputDeviceMap.get(deviceId);
if (inputDevice != null) {
if (!TextUtils.isEmpty(inputDevice.getProductName())) {
return inputDevice.getProductName();
}
if (!TextUtils.isEmpty(inputDevice.getUsbDevice().getDeviceName())) {
return inputDevice.getUsbDevice().getDeviceName();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (!TextUtils.isEmpty(inputDevice.getUsbDevice().getProductName())) {
return inputDevice.getUsbDevice().getProductName();
}
}
}

return null;
}

/**
* Obtains device vendor id for deviceId
* @param deviceId the device id
* @return device vendor id, or null
*/
public String getVendorId(String deviceId) {
MidiOutputDevice outputDevice = midiOutputDeviceMap.get(deviceId);
if (outputDevice != null) {
return String.valueOf(outputDevice.getUsbDevice().getVendorId());
}

MidiInputDevice inputDevice = midiInputDeviceMap.get(deviceId);
if (inputDevice != null) {
return String.valueOf(inputDevice.getUsbDevice().getVendorId());
}

return null;
}

/**
* Obtains device product id for deviceId
* @param deviceId the device id
* @return device product id, or null
*/
public String getProductId(String deviceId) {
MidiOutputDevice outputDevice = midiOutputDeviceMap.get(deviceId);
if (outputDevice != null) {
return String.valueOf(outputDevice.getUsbDevice().getProductId());
}

MidiInputDevice inputDevice = midiInputDeviceMap.get(deviceId);
if (inputDevice != null) {
return String.valueOf(inputDevice.getUsbDevice().getProductId());
}

return null;
}

Expand Down
Loading

0 comments on commit 63c421b

Please sign in to comment.