diff --git a/miniplayer/.gitignore b/miniplayer/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/miniplayer/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/miniplayer/README.md b/miniplayer/README.md new file mode 100644 index 0000000..68ee43e --- /dev/null +++ b/miniplayer/README.md @@ -0,0 +1,34 @@ +# Midi Player + +#### 介绍 +Midi 音乐播放器 + +#### 软件架构 +适配安卓应用 [AIDE Pro] 的 Gradle 编译结构。 +也适配安卓应用 [AndroidIDE] 的 Gradle 编译结构。 + + +#### Gradle 编译说明 +调试版编译命令 :gradle assembleBetaDebug +阶段版编译命令 :bash .winboll/bashPublishAPKAddTag.sh miniplayer + +#### 使用说明 + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 : ZhanGSKen(ZhanGSKen) +4. 新建 Pull Request + + +#### 特技 + +1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md +2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) +3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 +4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 +5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) +6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) + +#### 参考文档 diff --git a/miniplayer/app_update_description.txt b/miniplayer/app_update_description.txt new file mode 100644 index 0000000..e69de29 diff --git a/miniplayer/build.gradle b/miniplayer/build.gradle new file mode 100644 index 0000000..7b02873 --- /dev/null +++ b/miniplayer/build.gradle @@ -0,0 +1,73 @@ +apply plugin: 'com.android.application' +apply from: '../.winboll/winboll_app_build.gradle' +apply from: '../.winboll/winboll_lint_build.gradle' + +def genVersionName(def versionName){ + // 检查编译标志位配置 + assert (winbollBuildProps['stageCount'] != null) + assert (winbollBuildProps['baseVersion'] != null) + // 保存基础版本号 + winbollBuildProps.setProperty("baseVersion", "${versionName}"); + //保存编译标志配置 + FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile) + winbollBuildProps.store(fos, "${winbollBuildPropsDesc}"); + fos.close(); + + // 返回编译版本号 + return "${versionName}." + winbollBuildProps['stageCount'] +} + +android { + compileSdkVersion 32 + buildToolsVersion "32.0.0" + + defaultConfig { + applicationId "cc.winboll.studio.miniplayer" + minSdkVersion 26 + targetSdkVersion 30 + versionCode 1 + // versionName 更新后需要手动设置 + // .winboll/winbollBuildProps.properties 文件的 stageCount=0 + // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" + versionName "15.0" + if(true) { + versionName = genVersionName("${versionName}") + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + api fileTree(dir: 'libs', include: ['*.jar']) + + // SSH + api 'com.jcraft:jsch:0.1.55' + // Html 解析 + api 'org.jsoup:jsoup:1.13.1' + // 二维码类库 + api 'com.google.zxing:core:3.4.1' + api 'com.journeyapps:zxing-android-embedded:3.6.0' + // 应用介绍页类库 + api 'io.github.medyo:android-about-page:2.0.0' + // 吐司类库 + api 'com.github.getActivity:ToastUtils:10.5' + // 网络连接类库 + api 'com.squareup.okhttp3:okhttp:4.4.1' + // AndroidX 类库 + api 'androidx.appcompat:appcompat:1.1.0' + api 'com.google.android.material:material:1.4.0' + //api 'androidx.viewpager:viewpager:1.0.0' + //api 'androidx.vectordrawable:vectordrawable:1.1.0' + //api 'androidx.vectordrawable:vectordrawable-animated:1.1.0' + //api 'androidx.fragment:fragment:1.1.0' + + api 'cc.winboll.studio:libaes:15.9.2' + api 'cc.winboll.studio:libapputils:15.8.4' + api 'cc.winboll.studio:libappbase:15.8.4' +} diff --git a/miniplayer/build.properties b/miniplayer/build.properties new file mode 100644 index 0000000..c22cbbd --- /dev/null +++ b/miniplayer/build.properties @@ -0,0 +1,8 @@ +#Created by .winboll/winboll_app_build.gradle +#Sun Jun 29 04:03:38 GMT 2025 +stageCount=0 +libraryProject= +baseVersion=15.0 +publishVersion=15.0.0 +buildCount=27 +baseBetaVersion=15.0.1 diff --git a/miniplayer/proguard-rules.pro b/miniplayer/proguard-rules.pro new file mode 100644 index 0000000..64b4a05 --- /dev/null +++ b/miniplayer/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/miniplayer/src/beta/AndroidManifest.xml b/miniplayer/src/beta/AndroidManifest.xml new file mode 100644 index 0000000..ee78d9f --- /dev/null +++ b/miniplayer/src/beta/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/miniplayer/src/beta/res/values/strings.xml b/miniplayer/src/beta/res/values/strings.xml new file mode 100644 index 0000000..a7c572e --- /dev/null +++ b/miniplayer/src/beta/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + MidiPlayer + + + diff --git a/miniplayer/src/main/AndroidManifest.xml b/miniplayer/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d35a39f --- /dev/null +++ b/miniplayer/src/main/AndroidManifest.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/miniplayer/src/main/assets/midi/A Comme Amour('L' for Love, Both Hands)-Richard Clayderman.mid b/miniplayer/src/main/assets/midi/A Comme Amour('L' for Love, Both Hands)-Richard Clayderman.mid new file mode 100644 index 0000000..15316c5 Binary files /dev/null and b/miniplayer/src/main/assets/midi/A Comme Amour('L' for Love, Both Hands)-Richard Clayderman.mid differ diff --git a/miniplayer/src/main/assets/midi/A Long Time Ago-Irish Folk Song.mid b/miniplayer/src/main/assets/midi/A Long Time Ago-Irish Folk Song.mid new file mode 100644 index 0000000..e737b8a Binary files /dev/null and b/miniplayer/src/main/assets/midi/A Long Time Ago-Irish Folk Song.mid differ diff --git a/miniplayer/src/main/assets/midi/A Time For Us(Romeo and Juliet Theme)-Nino Rota.mid b/miniplayer/src/main/assets/midi/A Time For Us(Romeo and Juliet Theme)-Nino Rota.mid new file mode 100644 index 0000000..f7c8f6d Binary files /dev/null and b/miniplayer/src/main/assets/midi/A Time For Us(Romeo and Juliet Theme)-Nino Rota.mid differ diff --git a/miniplayer/src/main/assets/midi/AiQing.mid b/miniplayer/src/main/assets/midi/AiQing.mid new file mode 100644 index 0000000..9d758b9 Binary files /dev/null and b/miniplayer/src/main/assets/midi/AiQing.mid differ diff --git a/miniplayer/src/main/assets/midi/Albeniz_Danza_Espagnola.mid b/miniplayer/src/main/assets/midi/Albeniz_Danza_Espagnola.mid new file mode 100644 index 0000000..4431b0a Binary files /dev/null and b/miniplayer/src/main/assets/midi/Albeniz_Danza_Espagnola.mid differ diff --git a/miniplayer/src/main/assets/midi/Alla Turca(Both Hands, Crazy Piano)-Mozart.mid b/miniplayer/src/main/assets/midi/Alla Turca(Both Hands, Crazy Piano)-Mozart.mid new file mode 100644 index 0000000..10b1d5e Binary files /dev/null and b/miniplayer/src/main/assets/midi/Alla Turca(Both Hands, Crazy Piano)-Mozart.mid differ diff --git a/miniplayer/src/main/assets/midi/Amazing Grace-James.P.Carrell, David S.Clayton.mid b/miniplayer/src/main/assets/midi/Amazing Grace-James.P.Carrell, David S.Clayton.mid new file mode 100644 index 0000000..8041d90 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Amazing Grace-James.P.Carrell, David S.Clayton.mid differ diff --git a/miniplayer/src/main/assets/midi/Angel.mid b/miniplayer/src/main/assets/midi/Angel.mid new file mode 100644 index 0000000..737cc10 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Angel.mid differ diff --git a/miniplayer/src/main/assets/midi/Anonym_Greensleeves.mid b/miniplayer/src/main/assets/midi/Anonym_Greensleeves.mid new file mode 100644 index 0000000..e71ae0d Binary files /dev/null and b/miniplayer/src/main/assets/midi/Anonym_Greensleeves.mid differ diff --git a/miniplayer/src/main/assets/midi/Anonym_Spanish_Ballad.mid b/miniplayer/src/main/assets/midi/Anonym_Spanish_Ballad.mid new file mode 100644 index 0000000..ac28d1d Binary files /dev/null and b/miniplayer/src/main/assets/midi/Anonym_Spanish_Ballad.mid differ diff --git a/miniplayer/src/main/assets/midi/Apologize-One public, Timbaland.mid b/miniplayer/src/main/assets/midi/Apologize-One public, Timbaland.mid new file mode 100644 index 0000000..1e06d93 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Apologize-One public, Timbaland.mid differ diff --git a/miniplayer/src/main/assets/midi/Auld Lang Syne.mid b/miniplayer/src/main/assets/midi/Auld Lang Syne.mid new file mode 100644 index 0000000..c22be77 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Auld Lang Syne.mid differ diff --git a/miniplayer/src/main/assets/midi/Ballade pour Adeline(Ballad for Adeline, Both Hands)-Richard Clayderman.mid b/miniplayer/src/main/assets/midi/Ballade pour Adeline(Ballad for Adeline, Both Hands)-Richard Clayderman.mid new file mode 100644 index 0000000..966a7fb Binary files /dev/null and b/miniplayer/src/main/assets/midi/Ballade pour Adeline(Ballad for Adeline, Both Hands)-Richard Clayderman.mid differ diff --git a/miniplayer/src/main/assets/midi/Ballade pour Adeline(Ballad for Adeline, Right Hand).mid b/miniplayer/src/main/assets/midi/Ballade pour Adeline(Ballad for Adeline, Right Hand).mid new file mode 100644 index 0000000..7b1c843 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Ballade pour Adeline(Ballad for Adeline, Right Hand).mid differ diff --git a/miniplayer/src/main/assets/midi/Beethoven_Fur_Elise.mid b/miniplayer/src/main/assets/midi/Beethoven_Fur_Elise.mid new file mode 100644 index 0000000..f8455db Binary files /dev/null and b/miniplayer/src/main/assets/midi/Beethoven_Fur_Elise.mid differ diff --git a/miniplayer/src/main/assets/midi/Bridal Chorus-Wagner.mid b/miniplayer/src/main/assets/midi/Bridal Chorus-Wagner.mid new file mode 100644 index 0000000..f003818 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Bridal Chorus-Wagner.mid differ diff --git a/miniplayer/src/main/assets/midi/Butterfly lovers.mid b/miniplayer/src/main/assets/midi/Butterfly lovers.mid new file mode 100644 index 0000000..a4c08f4 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Butterfly lovers.mid differ diff --git a/miniplayer/src/main/assets/midi/Can Can-Jacques Offenbach.mid b/miniplayer/src/main/assets/midi/Can Can-Jacques Offenbach.mid new file mode 100644 index 0000000..a453b97 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Can Can-Jacques Offenbach.mid differ diff --git a/miniplayer/src/main/assets/midi/Can You Feel The Love Tonight-Elton John.mid b/miniplayer/src/main/assets/midi/Can You Feel The Love Tonight-Elton John.mid new file mode 100644 index 0000000..c0daf09 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Can You Feel The Love Tonight-Elton John.mid differ diff --git a/miniplayer/src/main/assets/midi/Canon in D-Johann Pachelbel.mid b/miniplayer/src/main/assets/midi/Canon in D-Johann Pachelbel.mid new file mode 100644 index 0000000..d76f751 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Canon in D-Johann Pachelbel.mid differ diff --git a/miniplayer/src/main/assets/midi/Canon.mid b/miniplayer/src/main/assets/midi/Canon.mid new file mode 100644 index 0000000..eab988e Binary files /dev/null and b/miniplayer/src/main/assets/midi/Canon.mid differ diff --git a/miniplayer/src/main/assets/midi/ChuanQi.mid b/miniplayer/src/main/assets/midi/ChuanQi.mid new file mode 100644 index 0000000..9ae7eda Binary files /dev/null and b/miniplayer/src/main/assets/midi/ChuanQi.mid differ diff --git a/miniplayer/src/main/assets/midi/Country Dance-Carulli Ferdinando.mid b/miniplayer/src/main/assets/midi/Country Dance-Carulli Ferdinando.mid new file mode 100644 index 0000000..ab44dfe Binary files /dev/null and b/miniplayer/src/main/assets/midi/Country Dance-Carulli Ferdinando.mid differ diff --git a/miniplayer/src/main/assets/midi/CunZai.mid b/miniplayer/src/main/assets/midi/CunZai.mid new file mode 100644 index 0000000..9277e6e Binary files /dev/null and b/miniplayer/src/main/assets/midi/CunZai.mid differ diff --git a/miniplayer/src/main/assets/midi/Di Da.mid b/miniplayer/src/main/assets/midi/Di Da.mid new file mode 100644 index 0000000..bfe9622 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Di Da.mid differ diff --git a/miniplayer/src/main/assets/midi/Don't Cry For Me, Argentina(Both Hands)-Andrew Lloyd Webber.mid b/miniplayer/src/main/assets/midi/Don't Cry For Me, Argentina(Both Hands)-Andrew Lloyd Webber.mid new file mode 100644 index 0000000..78c3a06 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Don't Cry For Me, Argentina(Both Hands)-Andrew Lloyd Webber.mid differ diff --git a/miniplayer/src/main/assets/midi/Don't Cry For Me, Argentina(Right Hand)-Andrew Lloyd Webber.mid b/miniplayer/src/main/assets/midi/Don't Cry For Me, Argentina(Right Hand)-Andrew Lloyd Webber.mid new file mode 100644 index 0000000..e2033af Binary files /dev/null and b/miniplayer/src/main/assets/midi/Don't Cry For Me, Argentina(Right Hand)-Andrew Lloyd Webber.mid differ diff --git a/miniplayer/src/main/assets/midi/Doraemon.mid b/miniplayer/src/main/assets/midi/Doraemon.mid new file mode 100644 index 0000000..489e80f Binary files /dev/null and b/miniplayer/src/main/assets/midi/Doraemon.mid differ diff --git a/miniplayer/src/main/assets/midi/Edelweiss-Richard Rodgers.mid b/miniplayer/src/main/assets/midi/Edelweiss-Richard Rodgers.mid new file mode 100644 index 0000000..d4bab70 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Edelweiss-Richard Rodgers.mid differ diff --git a/miniplayer/src/main/assets/midi/Eine Kleine Nachtmusik-Mozart.mid b/miniplayer/src/main/assets/midi/Eine Kleine Nachtmusik-Mozart.mid new file mode 100644 index 0000000..31dddcd Binary files /dev/null and b/miniplayer/src/main/assets/midi/Eine Kleine Nachtmusik-Mozart.mid differ diff --git a/miniplayer/src/main/assets/midi/Eyes On Me(Final Fantasy Theme)-Faye Wong.mid b/miniplayer/src/main/assets/midi/Eyes On Me(Final Fantasy Theme)-Faye Wong.mid new file mode 100644 index 0000000..54265b7 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Eyes On Me(Final Fantasy Theme)-Faye Wong.mid differ diff --git a/miniplayer/src/main/assets/midi/Five Hundred Miles-The Brothers Four.mid b/miniplayer/src/main/assets/midi/Five Hundred Miles-The Brothers Four.mid new file mode 100644 index 0000000..b01f462 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Five Hundred Miles-The Brothers Four.mid differ diff --git a/miniplayer/src/main/assets/midi/Four Swans-Pyotr llyich Tchaikovsky.mid b/miniplayer/src/main/assets/midi/Four Swans-Pyotr llyich Tchaikovsky.mid new file mode 100644 index 0000000..a166875 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Four Swans-Pyotr llyich Tchaikovsky.mid differ diff --git a/miniplayer/src/main/assets/midi/From The Inside-Linkin Park.mid b/miniplayer/src/main/assets/midi/From The Inside-Linkin Park.mid new file mode 100644 index 0000000..c8c3ab8 Binary files /dev/null and b/miniplayer/src/main/assets/midi/From The Inside-Linkin Park.mid differ diff --git a/miniplayer/src/main/assets/midi/FuKua.mid b/miniplayer/src/main/assets/midi/FuKua.mid new file mode 100644 index 0000000..40b2069 Binary files /dev/null and b/miniplayer/src/main/assets/midi/FuKua.mid differ diff --git a/miniplayer/src/main/assets/midi/FuQin.mid b/miniplayer/src/main/assets/midi/FuQin.mid new file mode 100644 index 0000000..12ed9eb Binary files /dev/null and b/miniplayer/src/main/assets/midi/FuQin.mid differ diff --git a/miniplayer/src/main/assets/midi/Fur Elise-Beethoven.mid b/miniplayer/src/main/assets/midi/Fur Elise-Beethoven.mid new file mode 100644 index 0000000..22a7f19 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Fur Elise-Beethoven.mid differ diff --git a/miniplayer/src/main/assets/midi/Green Sleeves-English folk song.mid b/miniplayer/src/main/assets/midi/Green Sleeves-English folk song.mid new file mode 100644 index 0000000..cdb3e3b Binary files /dev/null and b/miniplayer/src/main/assets/midi/Green Sleeves-English folk song.mid differ diff --git a/miniplayer/src/main/assets/midi/Green Sleves.mid b/miniplayer/src/main/assets/midi/Green Sleves.mid new file mode 100644 index 0000000..eaee6d6 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Green Sleves.mid differ diff --git a/miniplayer/src/main/assets/midi/GuanHuiSuiYue-Beyond.mid b/miniplayer/src/main/assets/midi/GuanHuiSuiYue-Beyond.mid new file mode 100644 index 0000000..daef2eb Binary files /dev/null and b/miniplayer/src/main/assets/midi/GuanHuiSuiYue-Beyond.mid differ diff --git a/miniplayer/src/main/assets/midi/HaiKuoTianKong-Beyond.mid b/miniplayer/src/main/assets/midi/HaiKuoTianKong-Beyond.mid new file mode 100644 index 0000000..fb1a79d Binary files /dev/null and b/miniplayer/src/main/assets/midi/HaiKuoTianKong-Beyond.mid differ diff --git a/miniplayer/src/main/assets/midi/HaoJiuBuJian.mid b/miniplayer/src/main/assets/midi/HaoJiuBuJian.mid new file mode 100644 index 0000000..5ddf5d3 Binary files /dev/null and b/miniplayer/src/main/assets/midi/HaoJiuBuJian.mid differ diff --git a/miniplayer/src/main/assets/midi/Happy Birthday Partita in D.mid b/miniplayer/src/main/assets/midi/Happy Birthday Partita in D.mid new file mode 100644 index 0000000..2206ff2 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Happy Birthday Partita in D.mid differ diff --git a/miniplayer/src/main/assets/midi/Happy Birthday.mid b/miniplayer/src/main/assets/midi/Happy Birthday.mid new file mode 100644 index 0000000..fb277f5 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Happy Birthday.mid differ diff --git a/miniplayer/src/main/assets/midi/Harry Potter's Theme-John Williams.mid b/miniplayer/src/main/assets/midi/Harry Potter's Theme-John Williams.mid new file mode 100644 index 0000000..25aed7c Binary files /dev/null and b/miniplayer/src/main/assets/midi/Harry Potter's Theme-John Williams.mid differ diff --git a/miniplayer/src/main/assets/midi/HongDou.mid b/miniplayer/src/main/assets/midi/HongDou.mid new file mode 100644 index 0000000..5ca0f2f Binary files /dev/null and b/miniplayer/src/main/assets/midi/HongDou.mid differ diff --git a/miniplayer/src/main/assets/midi/HouLai.mid b/miniplayer/src/main/assets/midi/HouLai.mid new file mode 100644 index 0000000..765c2ba Binary files /dev/null and b/miniplayer/src/main/assets/midi/HouLai.mid differ diff --git a/miniplayer/src/main/assets/midi/House of The Rising Sun.mid b/miniplayer/src/main/assets/midi/House of The Rising Sun.mid new file mode 100644 index 0000000..3d2b0a2 Binary files /dev/null and b/miniplayer/src/main/assets/midi/House of The Rising Sun.mid differ diff --git a/miniplayer/src/main/assets/midi/HuanLeSong.mid b/miniplayer/src/main/assets/midi/HuanLeSong.mid new file mode 100644 index 0000000..2505540 Binary files /dev/null and b/miniplayer/src/main/assets/midi/HuanLeSong.mid differ diff --git a/miniplayer/src/main/assets/midi/HuiYiDeShaDou.mid b/miniplayer/src/main/assets/midi/HuiYiDeShaDou.mid new file mode 100644 index 0000000..5f53257 Binary files /dev/null and b/miniplayer/src/main/assets/midi/HuiYiDeShaDou.mid differ diff --git a/miniplayer/src/main/assets/midi/Humoreske-Antonin Lepold Dvorak.mid b/miniplayer/src/main/assets/midi/Humoreske-Antonin Lepold Dvorak.mid new file mode 100644 index 0000000..faa27ba Binary files /dev/null and b/miniplayer/src/main/assets/midi/Humoreske-Antonin Lepold Dvorak.mid differ diff --git a/miniplayer/src/main/assets/midi/If You're Happy and You Know It-Japanese Folk Song.mid b/miniplayer/src/main/assets/midi/If You're Happy and You Know It-Japanese Folk Song.mid new file mode 100644 index 0000000..5795d0f Binary files /dev/null and b/miniplayer/src/main/assets/midi/If You're Happy and You Know It-Japanese Folk Song.mid differ diff --git a/miniplayer/src/main/assets/midi/Innocent(Castle in the sky, both hands)-Joe Hisaishi.mid b/miniplayer/src/main/assets/midi/Innocent(Castle in the sky, both hands)-Joe Hisaishi.mid new file mode 100644 index 0000000..7ea3b6f Binary files /dev/null and b/miniplayer/src/main/assets/midi/Innocent(Castle in the sky, both hands)-Joe Hisaishi.mid differ diff --git a/miniplayer/src/main/assets/midi/James Bond Theme.mid b/miniplayer/src/main/assets/midi/James Bond Theme.mid new file mode 100644 index 0000000..3645fbc Binary files /dev/null and b/miniplayer/src/main/assets/midi/James Bond Theme.mid differ diff --git a/miniplayer/src/main/assets/midi/Jehovah is Love.mid b/miniplayer/src/main/assets/midi/Jehovah is Love.mid new file mode 100644 index 0000000..3c4bbe3 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Jehovah is Love.mid differ diff --git a/miniplayer/src/main/assets/midi/JiaZhouLvGuan.mid b/miniplayer/src/main/assets/midi/JiaZhouLvGuan.mid new file mode 100644 index 0000000..698b0b7 Binary files /dev/null and b/miniplayer/src/main/assets/midi/JiaZhouLvGuan.mid differ diff --git a/miniplayer/src/main/assets/midi/Jingle Bells-James Pierpont.mid b/miniplayer/src/main/assets/midi/Jingle Bells-James Pierpont.mid new file mode 100644 index 0000000..edc6f99 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Jingle Bells-James Pierpont.mid differ diff --git a/miniplayer/src/main/assets/midi/Jingle Bells.mid b/miniplayer/src/main/assets/midi/Jingle Bells.mid new file mode 100644 index 0000000..acea05c Binary files /dev/null and b/miniplayer/src/main/assets/midi/Jingle Bells.mid differ diff --git a/miniplayer/src/main/assets/midi/KaNong.mid b/miniplayer/src/main/assets/midi/KaNong.mid new file mode 100644 index 0000000..eab988e Binary files /dev/null and b/miniplayer/src/main/assets/midi/KaNong.mid differ diff --git a/miniplayer/src/main/assets/midi/Katusha-Russian Folk Song.mid b/miniplayer/src/main/assets/midi/Katusha-Russian Folk Song.mid new file mode 100644 index 0000000..154f489 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Katusha-Russian Folk Song.mid differ diff --git a/miniplayer/src/main/assets/midi/KeXiBuShiNi.mid b/miniplayer/src/main/assets/midi/KeXiBuShiNi.mid new file mode 100644 index 0000000..d918019 Binary files /dev/null and b/miniplayer/src/main/assets/midi/KeXiBuShiNi.mid differ diff --git a/miniplayer/src/main/assets/midi/Kiss The Rain(Full)-Yiruma.mid b/miniplayer/src/main/assets/midi/Kiss The Rain(Full)-Yiruma.mid new file mode 100644 index 0000000..e2d259a Binary files /dev/null and b/miniplayer/src/main/assets/midi/Kiss The Rain(Full)-Yiruma.mid differ diff --git a/miniplayer/src/main/assets/midi/KissGoodbye.mid b/miniplayer/src/main/assets/midi/KissGoodbye.mid new file mode 100644 index 0000000..3d683eb Binary files /dev/null and b/miniplayer/src/main/assets/midi/KissGoodbye.mid differ diff --git a/miniplayer/src/main/assets/midi/LaoNanHai.mid b/miniplayer/src/main/assets/midi/LaoNanHai.mid new file mode 100644 index 0000000..0a2c852 Binary files /dev/null and b/miniplayer/src/main/assets/midi/LaoNanHai.mid differ diff --git a/miniplayer/src/main/assets/midi/Le Nozze di Figaro-Mozart.mid b/miniplayer/src/main/assets/midi/Le Nozze di Figaro-Mozart.mid new file mode 100644 index 0000000..f0da514 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Le Nozze di Figaro-Mozart.mid differ diff --git a/miniplayer/src/main/assets/midi/Let It Be-Beatles.mid b/miniplayer/src/main/assets/midi/Let It Be-Beatles.mid new file mode 100644 index 0000000..8604040 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Let It Be-Beatles.mid differ diff --git a/miniplayer/src/main/assets/midi/LingErXiangDingDang.mid b/miniplayer/src/main/assets/midi/LingErXiangDingDang.mid new file mode 100644 index 0000000..acea05c Binary files /dev/null and b/miniplayer/src/main/assets/midi/LingErXiangDingDang.mid differ diff --git a/miniplayer/src/main/assets/midi/London Bridge is Falling Down.mid b/miniplayer/src/main/assets/midi/London Bridge is Falling Down.mid new file mode 100644 index 0000000..dfb8092 Binary files /dev/null and b/miniplayer/src/main/assets/midi/London Bridge is Falling Down.mid differ diff --git a/miniplayer/src/main/assets/midi/London Bridge-Britain Folk Song.mid b/miniplayer/src/main/assets/midi/London Bridge-Britain Folk Song.mid new file mode 100644 index 0000000..b7297ab Binary files /dev/null and b/miniplayer/src/main/assets/midi/London Bridge-Britain Folk Song.mid differ diff --git a/miniplayer/src/main/assets/midi/Love Story-Andy Williams.mid b/miniplayer/src/main/assets/midi/Love Story-Andy Williams.mid new file mode 100644 index 0000000..92a646c Binary files /dev/null and b/miniplayer/src/main/assets/midi/Love Story-Andy Williams.mid differ diff --git a/miniplayer/src/main/assets/midi/Lullaby-Franz Seraphicus Peter Schubert.mid b/miniplayer/src/main/assets/midi/Lullaby-Franz Seraphicus Peter Schubert.mid new file mode 100644 index 0000000..f8a3d8d Binary files /dev/null and b/miniplayer/src/main/assets/midi/Lullaby-Franz Seraphicus Peter Schubert.mid differ diff --git a/miniplayer/src/main/assets/midi/Lullaby-Johannes Brahms.mid b/miniplayer/src/main/assets/midi/Lullaby-Johannes Brahms.mid new file mode 100644 index 0000000..26494c7 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Lullaby-Johannes Brahms.mid differ diff --git a/miniplayer/src/main/assets/midi/LvXiuZi.mid b/miniplayer/src/main/assets/midi/LvXiuZi.mid new file mode 100644 index 0000000..eaee6d6 Binary files /dev/null and b/miniplayer/src/main/assets/midi/LvXiuZi.mid differ diff --git a/miniplayer/src/main/assets/midi/Mariage D'amour(Dreaming wedding)-Richard Clayderman.mid b/miniplayer/src/main/assets/midi/Mariage D'amour(Dreaming wedding)-Richard Clayderman.mid new file mode 100644 index 0000000..e9ab060 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Mariage D'amour(Dreaming wedding)-Richard Clayderman.mid differ diff --git a/miniplayer/src/main/assets/midi/Martini_Plaisir_d'Amour.mid b/miniplayer/src/main/assets/midi/Martini_Plaisir_d'Amour.mid new file mode 100644 index 0000000..9b464b8 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Martini_Plaisir_d'Amour.mid differ diff --git a/miniplayer/src/main/assets/midi/Mary had a little lamb.mid b/miniplayer/src/main/assets/midi/Mary had a little lamb.mid new file mode 100644 index 0000000..0f45a58 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Mary had a little lamb.mid differ diff --git a/miniplayer/src/main/assets/midi/MengXingShiFen.mid b/miniplayer/src/main/assets/midi/MengXingShiFen.mid new file mode 100644 index 0000000..f661335 Binary files /dev/null and b/miniplayer/src/main/assets/midi/MengXingShiFen.mid differ diff --git a/miniplayer/src/main/assets/midi/Minuet in G Major-Beethoven.mid b/miniplayer/src/main/assets/midi/Minuet in G Major-Beethoven.mid new file mode 100644 index 0000000..5e9bcce Binary files /dev/null and b/miniplayer/src/main/assets/midi/Minuet in G Major-Beethoven.mid differ diff --git a/miniplayer/src/main/assets/midi/Minuet-Bach.mid b/miniplayer/src/main/assets/midi/Minuet-Bach.mid new file mode 100644 index 0000000..e1bc645 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Minuet-Bach.mid differ diff --git a/miniplayer/src/main/assets/midi/Moon River-Henry Mancini.mid b/miniplayer/src/main/assets/midi/Moon River-Henry Mancini.mid new file mode 100644 index 0000000..21fec91 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Moon River-Henry Mancini.mid differ diff --git a/miniplayer/src/main/assets/midi/Moonlight Sonata-Beethoven.mid b/miniplayer/src/main/assets/midi/Moonlight Sonata-Beethoven.mid new file mode 100644 index 0000000..54092dc Binary files /dev/null and b/miniplayer/src/main/assets/midi/Moonlight Sonata-Beethoven.mid differ diff --git a/miniplayer/src/main/assets/midi/Moonlight Sonata.mid b/miniplayer/src/main/assets/midi/Moonlight Sonata.mid new file mode 100644 index 0000000..141b24e Binary files /dev/null and b/miniplayer/src/main/assets/midi/Moonlight Sonata.mid differ diff --git a/miniplayer/src/main/assets/midi/My Darling Clementine-US Folk Song.mid b/miniplayer/src/main/assets/midi/My Darling Clementine-US Folk Song.mid new file mode 100644 index 0000000..32e57f6 Binary files /dev/null and b/miniplayer/src/main/assets/midi/My Darling Clementine-US Folk Song.mid differ diff --git a/miniplayer/src/main/assets/midi/My Destiny.mid b/miniplayer/src/main/assets/midi/My Destiny.mid new file mode 100644 index 0000000..118a0e3 Binary files /dev/null and b/miniplayer/src/main/assets/midi/My Destiny.mid differ diff --git a/miniplayer/src/main/assets/midi/NaXieHuaEr.mid b/miniplayer/src/main/assets/midi/NaXieHuaEr.mid new file mode 100644 index 0000000..87a6801 Binary files /dev/null and b/miniplayer/src/main/assets/midi/NaXieHuaEr.mid differ diff --git a/miniplayer/src/main/assets/midi/NaXieNian.mid b/miniplayer/src/main/assets/midi/NaXieNian.mid new file mode 100644 index 0000000..1fa5c17 Binary files /dev/null and b/miniplayer/src/main/assets/midi/NaXieNian.mid differ diff --git a/miniplayer/src/main/assets/midi/NiShiWoDeYan.mid b/miniplayer/src/main/assets/midi/NiShiWoDeYan.mid new file mode 100644 index 0000000..3b717dc Binary files /dev/null and b/miniplayer/src/main/assets/midi/NiShiWoDeYan.mid differ diff --git a/miniplayer/src/main/assets/midi/NiYaoDeAi.mid b/miniplayer/src/main/assets/midi/NiYaoDeAi.mid new file mode 100644 index 0000000..43f7e35 Binary files /dev/null and b/miniplayer/src/main/assets/midi/NiYaoDeAi.mid differ diff --git a/miniplayer/src/main/assets/midi/Nobody-Wonder Girls.mid b/miniplayer/src/main/assets/midi/Nobody-Wonder Girls.mid new file mode 100644 index 0000000..d1c9a3f Binary files /dev/null and b/miniplayer/src/main/assets/midi/Nobody-Wonder Girls.mid differ diff --git a/miniplayer/src/main/assets/midi/Nocturne-Chopin.mid b/miniplayer/src/main/assets/midi/Nocturne-Chopin.mid new file mode 100644 index 0000000..daeb3ab Binary files /dev/null and b/miniplayer/src/main/assets/midi/Nocturne-Chopin.mid differ diff --git a/miniplayer/src/main/assets/midi/NuFangDeShengMing.mid b/miniplayer/src/main/assets/midi/NuFangDeShengMing.mid new file mode 100644 index 0000000..5585ff1 Binary files /dev/null and b/miniplayer/src/main/assets/midi/NuFangDeShengMing.mid differ diff --git a/miniplayer/src/main/assets/midi/Ode to Joy guita.mid b/miniplayer/src/main/assets/midi/Ode to Joy guita.mid new file mode 100644 index 0000000..2505540 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Ode to Joy guita.mid differ diff --git a/miniplayer/src/main/assets/midi/Ode to Joy-Beethoven.mid b/miniplayer/src/main/assets/midi/Ode to Joy-Beethoven.mid new file mode 100644 index 0000000..b19401f Binary files /dev/null and b/miniplayer/src/main/assets/midi/Ode to Joy-Beethoven.mid differ diff --git a/miniplayer/src/main/assets/midi/Oh Suzanna.mid b/miniplayer/src/main/assets/midi/Oh Suzanna.mid new file mode 100644 index 0000000..d409c1c Binary files /dev/null and b/miniplayer/src/main/assets/midi/Oh Suzanna.mid differ diff --git a/miniplayer/src/main/assets/midi/Pachelbel_Canon_in_D.mid b/miniplayer/src/main/assets/midi/Pachelbel_Canon_in_D.mid new file mode 100644 index 0000000..472994b Binary files /dev/null and b/miniplayer/src/main/assets/midi/Pachelbel_Canon_in_D.mid differ diff --git a/miniplayer/src/main/assets/midi/PingJu.mid b/miniplayer/src/main/assets/midi/PingJu.mid new file mode 100644 index 0000000..aec30f7 Binary files /dev/null and b/miniplayer/src/main/assets/midi/PingJu.mid differ diff --git a/miniplayer/src/main/assets/midi/Polish Folk Song.mid b/miniplayer/src/main/assets/midi/Polish Folk Song.mid new file mode 100644 index 0000000..fdf681a Binary files /dev/null and b/miniplayer/src/main/assets/midi/Polish Folk Song.mid differ diff --git a/miniplayer/src/main/assets/midi/QianQianQueGe.mid b/miniplayer/src/main/assets/midi/QianQianQueGe.mid new file mode 100644 index 0000000..945cbd3 Binary files /dev/null and b/miniplayer/src/main/assets/midi/QianQianQueGe.mid differ diff --git a/miniplayer/src/main/assets/midi/QinAiDeNiZenMeBuZaiWoShenBian.mid b/miniplayer/src/main/assets/midi/QinAiDeNiZenMeBuZaiWoShenBian.mid new file mode 100644 index 0000000..9180024 Binary files /dev/null and b/miniplayer/src/main/assets/midi/QinAiDeNiZenMeBuZaiWoShenBian.mid differ diff --git a/miniplayer/src/main/assets/midi/Red River Valley-Canadian Folk Song.mid b/miniplayer/src/main/assets/midi/Red River Valley-Canadian Folk Song.mid new file mode 100644 index 0000000..ed1f52e Binary files /dev/null and b/miniplayer/src/main/assets/midi/Red River Valley-Canadian Folk Song.mid differ diff --git a/miniplayer/src/main/assets/midi/RuGuoMeiYouNi.mid b/miniplayer/src/main/assets/midi/RuGuoMeiYouNi.mid new file mode 100644 index 0000000..927a980 Binary files /dev/null and b/miniplayer/src/main/assets/midi/RuGuoMeiYouNi.mid differ diff --git a/miniplayer/src/main/assets/midi/Sakura-Japan Folk Song.mid b/miniplayer/src/main/assets/midi/Sakura-Japan Folk Song.mid new file mode 100644 index 0000000..e32de58 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Sakura-Japan Folk Song.mid differ diff --git a/miniplayer/src/main/assets/midi/Santa Lucia-Italy Folk Song.mid b/miniplayer/src/main/assets/midi/Santa Lucia-Italy Folk Song.mid new file mode 100644 index 0000000..ec307ab Binary files /dev/null and b/miniplayer/src/main/assets/midi/Santa Lucia-Italy Folk Song.mid differ diff --git a/miniplayer/src/main/assets/midi/Scarborough Fair-Britain Folk Song.mid b/miniplayer/src/main/assets/midi/Scarborough Fair-Britain Folk Song.mid new file mode 100644 index 0000000..a1ed729 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Scarborough Fair-Britain Folk Song.mid differ diff --git a/miniplayer/src/main/assets/midi/Sealed With A Kiss-Brian Hyland.mid b/miniplayer/src/main/assets/midi/Sealed With A Kiss-Brian Hyland.mid new file mode 100644 index 0000000..ae11611 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Sealed With A Kiss-Brian Hyland.mid differ diff --git a/miniplayer/src/main/assets/midi/Serenade-Franz Schubert.mid b/miniplayer/src/main/assets/midi/Serenade-Franz Schubert.mid new file mode 100644 index 0000000..656ad34 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Serenade-Franz Schubert.mid differ diff --git a/miniplayer/src/main/assets/midi/ShiNian.mid b/miniplayer/src/main/assets/midi/ShiNian.mid new file mode 100644 index 0000000..ebb5c44 Binary files /dev/null and b/miniplayer/src/main/assets/midi/ShiNian.mid differ diff --git a/miniplayer/src/main/assets/midi/ShiZiZuo.mid b/miniplayer/src/main/assets/midi/ShiZiZuo.mid new file mode 100644 index 0000000..fc8f46c Binary files /dev/null and b/miniplayer/src/main/assets/midi/ShiZiZuo.mid differ diff --git a/miniplayer/src/main/assets/midi/Silent Night(Both Hand)-Josef Mohr.mid b/miniplayer/src/main/assets/midi/Silent Night(Both Hand)-Josef Mohr.mid new file mode 100644 index 0000000..2241363 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Silent Night(Both Hand)-Josef Mohr.mid differ diff --git a/miniplayer/src/main/assets/midi/Silent Night.mid b/miniplayer/src/main/assets/midi/Silent Night.mid new file mode 100644 index 0000000..a1032e5 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Silent Night.mid differ diff --git a/miniplayer/src/main/assets/midi/Sirois_Romance.mid b/miniplayer/src/main/assets/midi/Sirois_Romance.mid new file mode 100644 index 0000000..00ac562 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Sirois_Romance.mid differ diff --git a/miniplayer/src/main/assets/midi/Some One Like You-Adele.mid b/miniplayer/src/main/assets/midi/Some One Like You-Adele.mid new file mode 100644 index 0000000..812511e Binary files /dev/null and b/miniplayer/src/main/assets/midi/Some One Like You-Adele.mid differ diff --git a/miniplayer/src/main/assets/midi/Sound of Silence-Simon & Garfunkel.mid b/miniplayer/src/main/assets/midi/Sound of Silence-Simon & Garfunkel.mid new file mode 100644 index 0000000..668e484 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Sound of Silence-Simon & Garfunkel.mid differ diff --git a/miniplayer/src/main/assets/midi/Souvenirs d'enfance(Childhood Memories, Right hand)-Richard Clayderman.mid b/miniplayer/src/main/assets/midi/Souvenirs d'enfance(Childhood Memories, Right hand)-Richard Clayderman.mid new file mode 100644 index 0000000..ad9193b Binary files /dev/null and b/miniplayer/src/main/assets/midi/Souvenirs d'enfance(Childhood Memories, Right hand)-Richard Clayderman.mid differ diff --git a/miniplayer/src/main/assets/midi/Super Mario Theme-Unkonw.mid b/miniplayer/src/main/assets/midi/Super Mario Theme-Unkonw.mid new file mode 100644 index 0000000..03f41cc Binary files /dev/null and b/miniplayer/src/main/assets/midi/Super Mario Theme-Unkonw.mid differ diff --git a/miniplayer/src/main/assets/midi/Symphony Fate No.1-Beethoven.mid b/miniplayer/src/main/assets/midi/Symphony Fate No.1-Beethoven.mid new file mode 100644 index 0000000..fd0c431 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Symphony Fate No.1-Beethoven.mid differ diff --git a/miniplayer/src/main/assets/midi/Take Me Home Country Road-John Denver.mid b/miniplayer/src/main/assets/midi/Take Me Home Country Road-John Denver.mid new file mode 100644 index 0000000..c109ad1 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Take Me Home Country Road-John Denver.mid differ diff --git a/miniplayer/src/main/assets/midi/TaoTai.mid b/miniplayer/src/main/assets/midi/TaoTai.mid new file mode 100644 index 0000000..59e3e74 Binary files /dev/null and b/miniplayer/src/main/assets/midi/TaoTai.mid differ diff --git a/miniplayer/src/main/assets/midi/The yankees minor-American folk songs.mid b/miniplayer/src/main/assets/midi/The yankees minor-American folk songs.mid new file mode 100644 index 0000000..7d8c887 Binary files /dev/null and b/miniplayer/src/main/assets/midi/The yankees minor-American folk songs.mid differ diff --git a/miniplayer/src/main/assets/midi/TongZhuoDeNi.mid b/miniplayer/src/main/assets/midi/TongZhuoDeNi.mid new file mode 100644 index 0000000..2cd94b2 Binary files /dev/null and b/miniplayer/src/main/assets/midi/TongZhuoDeNi.mid differ diff --git a/miniplayer/src/main/assets/midi/Traumerei-Robert Schumann.mid b/miniplayer/src/main/assets/midi/Traumerei-Robert Schumann.mid new file mode 100644 index 0000000..ec6f4bc Binary files /dev/null and b/miniplayer/src/main/assets/midi/Traumerei-Robert Schumann.mid differ diff --git a/miniplayer/src/main/assets/midi/Triste Coeur(Sad Heart, Both Hands)-Richard Clayderman.mid b/miniplayer/src/main/assets/midi/Triste Coeur(Sad Heart, Both Hands)-Richard Clayderman.mid new file mode 100644 index 0000000..697f3ee Binary files /dev/null and b/miniplayer/src/main/assets/midi/Triste Coeur(Sad Heart, Both Hands)-Richard Clayderman.mid differ diff --git a/miniplayer/src/main/assets/midi/Triste Coeur(Sad Heart, Right Hand)-Richard Clayderman.mid b/miniplayer/src/main/assets/midi/Triste Coeur(Sad Heart, Right Hand)-Richard Clayderman.mid new file mode 100644 index 0000000..23a1a5c Binary files /dev/null and b/miniplayer/src/main/assets/midi/Triste Coeur(Sad Heart, Right Hand)-Richard Clayderman.mid differ diff --git a/miniplayer/src/main/assets/midi/Turkish March-Mozart.mid b/miniplayer/src/main/assets/midi/Turkish March-Mozart.mid new file mode 100644 index 0000000..3df8cbb Binary files /dev/null and b/miniplayer/src/main/assets/midi/Turkish March-Mozart.mid differ diff --git a/miniplayer/src/main/assets/midi/Twinkle Twinkle Little Star guitar.mid b/miniplayer/src/main/assets/midi/Twinkle Twinkle Little Star guitar.mid new file mode 100644 index 0000000..960ed23 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Twinkle Twinkle Little Star guitar.mid differ diff --git a/miniplayer/src/main/assets/midi/Twinkle Twinkle Little Star.mid b/miniplayer/src/main/assets/midi/Twinkle Twinkle Little Star.mid new file mode 100644 index 0000000..38e1ee9 Binary files /dev/null and b/miniplayer/src/main/assets/midi/Twinkle Twinkle Little Star.mid differ diff --git a/miniplayer/src/main/assets/midi/Walking Walking-ChildrenSong.mid b/miniplayer/src/main/assets/midi/Walking Walking-ChildrenSong.mid new file mode 100644 index 0000000..0bb627c Binary files /dev/null and b/miniplayer/src/main/assets/midi/Walking Walking-ChildrenSong.mid differ diff --git a/miniplayer/src/main/assets/midi/We Wish You a Merry Christmas.mid b/miniplayer/src/main/assets/midi/We Wish You a Merry Christmas.mid new file mode 100644 index 0000000..63104cd Binary files /dev/null and b/miniplayer/src/main/assets/midi/We Wish You a Merry Christmas.mid differ diff --git a/miniplayer/src/main/assets/midi/WoDeGeShengLi.mid b/miniplayer/src/main/assets/midi/WoDeGeShengLi.mid new file mode 100644 index 0000000..1653c25 Binary files /dev/null and b/miniplayer/src/main/assets/midi/WoDeGeShengLi.mid differ diff --git a/miniplayer/src/main/assets/midi/WoHaoXiangNi.mid b/miniplayer/src/main/assets/midi/WoHaoXiangNi.mid new file mode 100644 index 0000000..2b5d530 Binary files /dev/null and b/miniplayer/src/main/assets/midi/WoHaoXiangNi.mid differ diff --git a/miniplayer/src/main/assets/midi/WoYuanYi.mid b/miniplayer/src/main/assets/midi/WoYuanYi.mid new file mode 100644 index 0000000..0e73375 Binary files /dev/null and b/miniplayer/src/main/assets/midi/WoYuanYi.mid differ diff --git a/miniplayer/src/main/assets/midi/XiaoQingGe.mid b/miniplayer/src/main/assets/midi/XiaoQingGe.mid new file mode 100644 index 0000000..c8793d8 Binary files /dev/null and b/miniplayer/src/main/assets/midi/XiaoQingGe.mid differ diff --git a/miniplayer/src/main/assets/midi/YanHuaYiLeng.mid b/miniplayer/src/main/assets/midi/YanHuaYiLeng.mid new file mode 100644 index 0000000..d3663ae Binary files /dev/null and b/miniplayer/src/main/assets/midi/YanHuaYiLeng.mid differ diff --git a/miniplayer/src/main/assets/midi/Yellow-Coldplay.mid b/miniplayer/src/main/assets/midi/Yellow-Coldplay.mid new file mode 100644 index 0000000..e1524da Binary files /dev/null and b/miniplayer/src/main/assets/midi/Yellow-Coldplay.mid differ diff --git a/miniplayer/src/main/assets/midi/Yesterday-Beatles.mid b/miniplayer/src/main/assets/midi/Yesterday-Beatles.mid new file mode 100644 index 0000000..12250af Binary files /dev/null and b/miniplayer/src/main/assets/midi/Yesterday-Beatles.mid differ diff --git a/miniplayer/src/main/assets/midi/YiRanAiNi.mid b/miniplayer/src/main/assets/midi/YiRanAiNi.mid new file mode 100644 index 0000000..fefac81 Binary files /dev/null and b/miniplayer/src/main/assets/midi/YiRanAiNi.mid differ diff --git a/miniplayer/src/main/assets/midi/YiShengSuoAi.mid b/miniplayer/src/main/assets/midi/YiShengSuoAi.mid new file mode 100644 index 0000000..035a8e4 Binary files /dev/null and b/miniplayer/src/main/assets/midi/YiShengSuoAi.mid differ diff --git a/miniplayer/src/main/assets/midi/YinWeiAiQing.mid b/miniplayer/src/main/assets/midi/YinWeiAiQing.mid new file mode 100644 index 0000000..4468e60 Binary files /dev/null and b/miniplayer/src/main/assets/midi/YinWeiAiQing.mid differ diff --git a/miniplayer/src/main/assets/midi/YuanLaiNiYeZaiZheLi.mid b/miniplayer/src/main/assets/midi/YuanLaiNiYeZaiZheLi.mid new file mode 100644 index 0000000..1e00c91 Binary files /dev/null and b/miniplayer/src/main/assets/midi/YuanLaiNiYeZaiZheLi.mid differ diff --git a/miniplayer/src/main/assets/midi/ZhenDeAiNi-Beyond.mid b/miniplayer/src/main/assets/midi/ZhenDeAiNi-Beyond.mid new file mode 100644 index 0000000..c342502 Binary files /dev/null and b/miniplayer/src/main/assets/midi/ZhenDeAiNi-Beyond.mid differ diff --git a/miniplayer/src/main/assets/midi/ZhenDeAiNi.mid b/miniplayer/src/main/assets/midi/ZhenDeAiNi.mid new file mode 100644 index 0000000..c342502 Binary files /dev/null and b/miniplayer/src/main/assets/midi/ZhenDeAiNi.mid differ diff --git a/miniplayer/src/main/assets/midi/ZhiQingChun.mid b/miniplayer/src/main/assets/midi/ZhiQingChun.mid new file mode 100644 index 0000000..8478dd4 Binary files /dev/null and b/miniplayer/src/main/assets/midi/ZhiQingChun.mid differ diff --git a/miniplayer/src/main/assets/midi/ZuiXuanMinZuFeng.mid b/miniplayer/src/main/assets/midi/ZuiXuanMinZuFeng.mid new file mode 100644 index 0000000..e2358a0 Binary files /dev/null and b/miniplayer/src/main/assets/midi/ZuiXuanMinZuFeng.mid differ diff --git a/miniplayer/src/main/java/cc/winboll/studio/miniplayer/App.java b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/App.java new file mode 100644 index 0000000..17a032f --- /dev/null +++ b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/App.java @@ -0,0 +1,345 @@ +package cc.winboll.studio.miniplayer; + +import android.app.Activity; +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.res.Resources; +import android.graphics.Typeface; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.text.TextUtils; +import android.util.Log; +import android.view.Gravity; +import android.view.Menu; +import android.view.MenuItem; +import android.view.ViewGroup; +import android.widget.HorizontalScrollView; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.Toast; +import cc.winboll.studio.libappbase.GlobalApplication; +import com.hjq.toast.ToastUtils; +import com.hjq.toast.style.WhiteToastStyle; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.Closeable; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.Thread.UncaughtExceptionHandler; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.concurrent.atomic.AtomicBoolean; + +public class App extends GlobalApplication { + + private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper()); + + @Override + public void onCreate() { + super.onCreate(); + + // 初始化 Toast 框架 + ToastUtils.init(this); + // 设置 Toast 布局样式 + //ToastUtils.setView(R.layout.view_toast); + ToastUtils.setStyle(new WhiteToastStyle()); + ToastUtils.setGravity(Gravity.BOTTOM, 0, 200); + + //CrashHandler.getInstance().registerGlobal(this); + //CrashHandler.getInstance().registerPart(this); + } + + public static void write(InputStream input, OutputStream output) throws IOException { + byte[] buf = new byte[1024 * 8]; + int len; + while ((len = input.read(buf)) != -1) { + output.write(buf, 0, len); + } + } + + public static void write(File file, byte[] data) throws IOException { + File parent = file.getParentFile(); + if (parent != null && !parent.exists()) parent.mkdirs(); + + ByteArrayInputStream input = new ByteArrayInputStream(data); + FileOutputStream output = new FileOutputStream(file); + try { + write(input, output); + } finally { + closeIO(input, output); + } + } + + public static String toString(InputStream input) throws IOException { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + write(input, output); + try { + return output.toString("UTF-8"); + } finally { + closeIO(input, output); + } + } + + public static void closeIO(Closeable... closeables) { + for (Closeable closeable : closeables) { + try { + if (closeable != null) closeable.close(); + } catch (IOException ignored) {} + } + } + + public static class CrashHandler { + + public static final UncaughtExceptionHandler DEFAULT_UNCAUGHT_EXCEPTION_HANDLER = Thread.getDefaultUncaughtExceptionHandler(); + + private static CrashHandler sInstance; + + private PartCrashHandler mPartCrashHandler; + + public static CrashHandler getInstance() { + if (sInstance == null) { + sInstance = new CrashHandler(); + } + return sInstance; + } + + public void registerGlobal(Context context) { + registerGlobal(context, null); + } + + public void registerGlobal(Context context, String crashDir) { + Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandlerImpl(context.getApplicationContext(), crashDir)); + } + + public void unregister() { + Thread.setDefaultUncaughtExceptionHandler(DEFAULT_UNCAUGHT_EXCEPTION_HANDLER); + } + + public void registerPart(Context context) { + unregisterPart(context); + mPartCrashHandler = new PartCrashHandler(context.getApplicationContext()); + MAIN_HANDLER.postAtFrontOfQueue(mPartCrashHandler); + } + + public void unregisterPart(Context context) { + if (mPartCrashHandler != null) { + mPartCrashHandler.isRunning.set(false); + mPartCrashHandler = null; + } + } + + private static class PartCrashHandler implements Runnable { + + private final Context mContext; + + public AtomicBoolean isRunning = new AtomicBoolean(true); + + public PartCrashHandler(Context context) { + this.mContext = context; + } + + @Override + public void run() { + while (isRunning.get()) { + try { + Looper.loop(); + } catch (final Throwable e) { + e.printStackTrace(); + if (isRunning.get()) { + MAIN_HANDLER.post(new Runnable(){ + + @Override + public void run() { + Toast.makeText(mContext, e.toString(), Toast.LENGTH_LONG).show(); + } + }); + } else { + if (e instanceof RuntimeException) { + throw (RuntimeException)e; + } else { + throw new RuntimeException(e); + } + } + } + } + } + } + + private static class UncaughtExceptionHandlerImpl implements UncaughtExceptionHandler { + + private static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss"); + + private final Context mContext; + + private final File mCrashDir; + + public UncaughtExceptionHandlerImpl(Context context, String crashDir) { + this.mContext = context; + this.mCrashDir = TextUtils.isEmpty(crashDir) ? new File(mContext.getExternalCacheDir(), "crash") : new File(crashDir); + } + + @Override + public void uncaughtException(Thread thread, Throwable throwable) { + try { + + String log = buildLog(throwable); + writeLog(log); + + try { + Intent intent = new Intent(mContext, CrashActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.putExtra(Intent.EXTRA_TEXT, log); + mContext.startActivity(intent); + } catch (Throwable e) { + e.printStackTrace(); + writeLog(e.toString()); + } + + throwable.printStackTrace(); + android.os.Process.killProcess(android.os.Process.myPid()); + System.exit(0); + + } catch (Throwable e) { + if (DEFAULT_UNCAUGHT_EXCEPTION_HANDLER != null) DEFAULT_UNCAUGHT_EXCEPTION_HANDLER.uncaughtException(thread, throwable); + } + } + + private String buildLog(Throwable throwable) { + String time = DATE_FORMAT.format(new Date()); + + String versionName = "unknown"; + long versionCode = 0; + try { + PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0); + versionName = packageInfo.versionName; + versionCode = Build.VERSION.SDK_INT >= 28 ? packageInfo.getLongVersionCode() : packageInfo.versionCode; + } catch (Throwable ignored) {} + + LinkedHashMap head = new LinkedHashMap(); + head.put("Time Of Crash", time); + head.put("Device", String.format("%s, %s", Build.MANUFACTURER, Build.MODEL)); + head.put("Android Version", String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT)); + head.put("App Version", String.format("%s (%d)", versionName, versionCode)); + head.put("Kernel", getKernel()); + head.put("Support Abis", Build.VERSION.SDK_INT >= 21 && Build.SUPPORTED_ABIS != null ? Arrays.toString(Build.SUPPORTED_ABIS): "unknown"); + head.put("Fingerprint", Build.FINGERPRINT); + + StringBuilder builder = new StringBuilder(); + + for (String key : head.keySet()) { + if (builder.length() != 0) builder.append("\n"); + builder.append(key); + builder.append(" : "); + builder.append(head.get(key)); + } + + builder.append("\n\n"); + builder.append(Log.getStackTraceString(throwable)); + + return builder.toString(); + } + + private void writeLog(String log) { + String time = DATE_FORMAT.format(new Date()); + File file = new File(mCrashDir, "crash_" + time + ".txt"); + try { + write(file, log.getBytes("UTF-8")); + } catch (Throwable e) { + e.printStackTrace(); + } + } + + private static String getKernel() { + try { + return App.toString(new FileInputStream("/proc/version")).trim(); + } catch (Throwable e) { + return e.getMessage(); + } + } + } + } + + public static final class CrashActivity extends Activity { + + private String mLog; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setTheme(android.R.style.Theme_DeviceDefault); + setTitle("App Crash"); + + mLog = getIntent().getStringExtra(Intent.EXTRA_TEXT); + + ScrollView contentView = new ScrollView(this); + contentView.setFillViewport(true); + + HorizontalScrollView horizontalScrollView = new HorizontalScrollView(this); + + TextView textView = new TextView(this); + int padding = dp2px(16); + textView.setPadding(padding, padding, padding, padding); + textView.setText(mLog); + textView.setTextIsSelectable(true); + textView.setTypeface(Typeface.DEFAULT); + textView.setLinksClickable(true); + + horizontalScrollView.addView(textView); + contentView.addView(horizontalScrollView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + + setContentView(contentView); + } + + private void restart() { + Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName()); + if (intent != null) { + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } + finish(); + android.os.Process.killProcess(android.os.Process.myPid()); + System.exit(0); + } + + private static int dp2px(float dpValue) { + final float scale = Resources.getSystem().getDisplayMetrics().density; + return (int) (dpValue * scale + 0.5f); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + menu.add(0, android.R.id.copy, 0, android.R.string.copy) + .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); + return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.copy: + ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); + cm.setPrimaryClip(ClipData.newPlainText(getPackageName(), mLog)); + return true; + } + return super.onOptionsItemSelected(item); + } + + @Override + public void onBackPressed() { + restart(); + } + } +} diff --git a/miniplayer/src/main/java/cc/winboll/studio/miniplayer/AssetMidiCopier.java b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/AssetMidiCopier.java new file mode 100644 index 0000000..93bfd0a --- /dev/null +++ b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/AssetMidiCopier.java @@ -0,0 +1,137 @@ +package cc.winboll.studio.miniplayer; + +/** + * @Author ZhanGSKen + * @Date 2025/06/29 10:56 + * @Describe 用于将assets/midi目录下的文件拷贝到内部存储 + */ +import android.content.Context; +import android.content.res.AssetManager; +import android.util.Log; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; + +public class AssetMidiCopier { + public static final String TAG = "AssetMidiCopier"; + + private Context mContext; + + public AssetMidiCopier(Context context) { + mContext = context; + } + + /** + * 拷贝assets/midi目录下所有文件到内部存储的midi文件夹 + * @return 拷贝是否成功 + */ + public boolean copyMidiFiles() { + AssetManager assetManager = mContext.getAssets(); + String[] midiFiles; + + try { + // 获取assets/midi目录下的所有文件 + midiFiles = assetManager.list("midi"); + if (midiFiles == null || midiFiles.length == 0) { + Log.d(TAG, "assets/midi目录下没有文件"); + return false; + } + + // 获取内部存储的目标目录(/data/data/包名/files/midi) + File targetDir = new File(mContext.getFilesDir(), "midi"); + if (!targetDir.exists()) { + // 创建目录(包括父目录) + if (!targetDir.mkdirs()) { + Log.e(TAG, "创建目标目录失败: " + targetDir.getAbsolutePath()); + return false; + } + } + + // 逐个拷贝文件 + for (String fileName : midiFiles) { + // 跳过目录,只处理文件 + if (fileName.contains("/")) { + continue; + } + + // 源文件路径(assets/midi/文件名) + String sourcePath = "midi/" + fileName; + // 目标文件路径 + File targetFile = new File(targetDir, fileName); + + // 如果文件已存在,跳过拷贝 + if (targetFile.exists()) { + Log.d(TAG, "文件已存在,跳过: " + fileName); + continue; + } + + // 执行拷贝 + if (!copySingleFile(assetManager, sourcePath, targetFile)) { + Log.e(TAG, "拷贝文件失败: " + fileName); + return false; + } + } + + Log.d(TAG, "所有MIDI文件拷贝完成,共" + midiFiles.length + "个文件"); + return true; + + } catch (IOException e) { + Log.e(TAG, "拷贝过程发生错误: " + e.getMessage()); + e.printStackTrace(); + return false; + } + } + + /** + * 拷贝单个assets文件到目标路径 + */ + private boolean copySingleFile(AssetManager assetManager, String sourcePath, File targetFile) { + InputStream in = null; + FileOutputStream out = null; + + try { + // 打开assets中的源文件 + in = assetManager.open(sourcePath); + // 创建目标文件输出流 + out = new FileOutputStream(targetFile); + + // 缓冲区 + byte[] buffer = new byte[1024]; + int length; + // 读写文件 + while ((length = in.read(buffer)) != -1) { + out.write(buffer, 0, length); + } + + // 刷新输出流,确保数据写入 + out.flush(); + return true; + + } catch (IOException e) { + Log.e(TAG, "拷贝单个文件错误: " + e.getMessage()); + return false; + + } finally { + // 关闭流 + try { + if (in != null) { + in.close(); + } + if (out != null) { + out.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 获取内部存储中MIDI文件的目录 + */ + public File getMidiTargetDir() { + return new File(mContext.getFilesDir(), "midi"); + } +} + diff --git a/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MainActivity.java b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MainActivity.java new file mode 100644 index 0000000..18e84ad --- /dev/null +++ b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MainActivity.java @@ -0,0 +1,78 @@ +package cc.winboll.studio.miniplayer; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; +import androidx.appcompat.widget.Toolbar; +import cc.winboll.studio.libappbase.LogUtils; +import cc.winboll.studio.libappbase.LogView; +import com.hjq.toast.ToastUtils; +import java.io.File; + +public class MainActivity extends WinBoLLActivity { + + LogView mLogView; + + @Override + public Activity getActivity() { + return this; + } + + @Override + public String getTag() { + return TAG; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + mLogView = findViewById(R.id.logview); + + ToastUtils.show("onCreate"); + copyAssetsMidiFiles(); + } + + public void onOpenMidiPlayer(View view) { + App.getWinBoLLActivityManager().startWinBoLLActivity(this, MidiPlayerActivity.class); + } + + @Override + protected void onResume() { + super.onResume(); + mLogView.start(); + } + + // 在需要拷贝的地方调用(如Activity的onCreate中) + private void copyAssetsMidiFiles() { + // 新建拷贝工具类实例 + final AssetMidiCopier copier = new AssetMidiCopier(this); + + // 开启子线程执行拷贝(避免主线程阻塞) + new Thread(new Runnable() { + @Override + public void run() { + final boolean success = copier.copyMidiFiles(); + // 拷贝结果可通过Handler通知主线程更新UI + runOnUiThread(new Runnable() { + @Override + public void run() { + if (success) { + // 拷贝成功,获取目标目录 + File midiDir = copier.getMidiTargetDir(); + LogUtils.d(TAG, "文件保存路径: " + midiDir.getAbsolutePath()); + // 可在这里加载MIDI文件 + } else { + // 拷贝失败,提示用户 + } + } + }); + } + }).start(); + } + +} diff --git a/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiParser.java b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiParser.java new file mode 100644 index 0000000..d0b3d3e --- /dev/null +++ b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiParser.java @@ -0,0 +1,277 @@ +package cc.winboll.studio.miniplayer; + +/** + * @Author ZhanGSKen + * @Date 2025/06/29 10:26 + * @Describe MIDI文件解析器,用于解析MIDI文件并提取轨道信息 + */ +import android.util.Log; +import cc.winboll.studio.libappbase.LogUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.Charset; + +public class MidiParser { + public static final String TAG = "MidiParser"; + // 替代StandardCharsets.US_ASCII,兼容低版本 + private static final Charset US_ASCII = Charset.forName("US-ASCII"); + + private InputStream mInputStream; + private int mTrackCount; // 轨道数量 + + public MidiParser(File file) throws IOException { + this.mInputStream = new FileInputStream(file); + } + + /** + * 解析MIDI文件,返回轨道数组 + */ + public MidiTrack[] parse() throws IOException { + try { + // 1. 验证MIDI文件头(MThd) + if (!verifyHeader()) { + LogUtils.d(TAG, "不是有效的MIDI文件"); + return null; + } + + // 2. 读取文件头信息(包含轨道数量) + readHeaderInfo(); + + // 3. 解析每个轨道 + MidiTrack[] tracks = new MidiTrack[mTrackCount]; + for (int i = 0; i < mTrackCount; i++) { + tracks[i] = parseTrack(); + } + + return tracks; + } finally { + if (mInputStream != null) { + mInputStream.close(); + } + } + } + + /** + * 验证MIDI文件头(必须以"MThd"开头) + */ + private boolean verifyHeader() throws IOException { + byte[] header = new byte[4]; + int read = mInputStream.read(header); + if (read != 4) { + LogUtils.d(TAG, "文件头读取不完整,读取字节数: " + read); + return false; + } + // 使用US-ASCII编码验证(兼容低版本) + String headerStr = new String(header, US_ASCII); + boolean isValid = "MThd".equals(headerStr); + if (!isValid) { + LogUtils.d(TAG, "无效的文件头标识: " + headerStr + + " (十六进制: " + bytesToHex(header) + ")"); + } + return isValid; + } + + /** + * 读取MIDI文件头信息,修复文件指针偏移问题 + */ + private void readHeaderInfo() throws IOException { + // 1. 读取头长度(4字节,标准MIDI固定为6) + int headerLength = readInt(); + LogUtils.d(TAG, "MIDI文件头长度: " + headerLength); + + // 2. 读取头数据(共6字节:格式类型2字节 + 轨道数量2字节 + 时间分隔符2字节) + byte[] headerData = new byte[6]; + int read = mInputStream.read(headerData); + if (read != 6) { + LogUtils.d(TAG, "文件头数据不完整,预期6字节,实际读取: " + read); + throw new IOException("无效的MIDI文件头数据"); + } + + // 3. 从headerData中解析信息(避免多次read导致指针偏移) + int formatType = ((headerData[0] & 0xFF) << 8) | (headerData[1] & 0xFF); + mTrackCount = ((headerData[2] & 0xFF) << 8) | (headerData[3] & 0xFF); + int ticksPerBeat = ((headerData[4] & 0xFF) << 8) | (headerData[5] & 0xFF); + + LogUtils.d(TAG, "MIDI文件格式: " + formatType); + LogUtils.d(TAG, "时间分隔符(每拍 ticks): " + ticksPerBeat); + LogUtils.d(TAG, "解析到轨道数量: " + mTrackCount); + + // 4. 处理扩展头(若头长度大于6,跳过剩余字节) + if (headerLength > 6) { + long skipped = mInputStream.skip(headerLength - 6); + LogUtils.d(TAG, "跳过扩展头字节数: " + skipped + " (预期: " + (headerLength - 6) + ")"); + } + } + + /** + * 解析单个轨道信息 + */ + private MidiTrack parseTrack() throws IOException { + MidiTrack track = new MidiTrack(); + + // 1. 读取轨道头(4字节) + byte[] trackHeader = new byte[4]; + int headerRead = mInputStream.read(trackHeader); + if (headerRead != 4) { + LogUtils.d(TAG, "轨道头读取不完整,实际读取: " + headerRead + "字节"); + return track; + } + + // 2. 验证轨道头标识(MTrk),使用Tr-ASCII编码(兼容低版本) + String headerStr = new String(trackHeader, US_ASCII); + if (!"MTrk".equals(headerStr)) { + LogUtils.d(TAG, "无效的轨道头标识: " + headerStr + + " (十六进制: " + bytesToHex(trackHeader) + ")"); + return track; + } + + // 3. 读取轨道长度(4字节) + int trackLength = readInt(); + LogUtils.d(TAG, "解析轨道,长度: " + trackLength + "字节"); + + // 4. 读取完整轨道数据 + byte[] trackData = new byte[trackLength]; + int totalRead = 0; + while (totalRead < trackLength) { + int bytesRead = mInputStream.read(trackData, totalRead, trackLength - totalRead); + if (bytesRead == -1) { + LogUtils.d(TAG, "轨道数据读取提前结束,已读取: " + totalRead + ",预期: " + trackLength); + break; + } + totalRead += bytesRead; + } + + // 5. 解析轨道事件 + if (totalRead == trackLength) { + parseEvents(track, trackData); + } else { + LogUtils.d(TAG, "轨道数据不完整,跳过事件解析"); + } + + return track; + } + + /** + * 解析MIDI事件(按MIDI协议规范) + */ + private void parseEvents(MidiTrack track, byte[] trackData) { + int offset = 0; + while (offset < trackData.length) { + // 1. 读取可变长度时间戳(MIDI事件时间差) + long deltaTime = readVariableLength(trackData, offset); + offset += getVariableLengthSize(deltaTime); + + if (offset >= trackData.length) { + break; + } + + // 2. 读取事件状态字节 + int statusByte = trackData[offset] & 0xFF; + offset++; + + // 3. 确定事件数据长度 + int dataLength = getEventDataLength(statusByte); + if (offset + dataLength > trackData.length) { + LogUtils.d(TAG, "事件数据不完整,状态字节: 0x" + Integer.toHexString(statusByte) + + ",剩余字节: " + (trackData.length - offset)); + break; + } + + // 4. 提取完整事件(状态字节+数据字节) + byte[] event = new byte[1 + dataLength]; + event[0] = (byte) statusByte; + System.arraycopy(trackData, offset, event, 1, dataLength); + offset += dataLength; + + track.addEvent(event); + } + + LogUtils.d(TAG, "轨道事件解析完成,事件数量: " + track.getEventCount()); + } + + /** + * 根据状态字节获取事件数据长度 + */ + private int getEventDataLength(int statusByte) { + int eventType = statusByte >> 4; + switch (eventType) { + case 0x8: // 音符关闭 + case 0x9: // 音符开启 + case 0xA: // 触后 + case 0xB: // 控制器 + case 0xE: // 弯音 + return 2; + case 0xC: // 程序变更 + case 0xD: // 通道触后 + return 1; + case 0xF: // 系统事件 + if (statusByte == 0xFF) { // 元事件 + return 1; // 简化处理,实际需根据元事件类型判断 + } else if (statusByte == 0xF0 || statusByte == 0xF7) { // 系统专属事件 + return 0; // 复杂处理,暂不支持 + } + default: + return 0; + } + } + + /** + * 读取可变长度整数(MIDI时间戳编码) + */ + private long readVariableLength(byte[] data, int offset) { + long value = 0; + int b; + int i = 0; + do { + b = data[offset + i] & 0xFF; + value = (value << 7) | (b & 0x7F); + i++; + } while ((b & 0x80) != 0 && i < 4); // 最多4字节 + return value; + } + + /** + * 获取可变长度整数的字节数 + */ + private int getVariableLengthSize(long value) { + if (value < 0x80) return 1; + if (value < 0x4000) return 2; + if (value < 0x200000) return 3; + return 4; + } + + /** + * 读取无符号短整型(2字节,大端序) + */ + private int readUnsignedShort() throws IOException { + int b1 = mInputStream.read() & 0xFF; + int b2 = mInputStream.read() & 0xFF; + return (b1 << 8) | b2; + } + + /** + * 读取整型(4字节,大端序) + */ + private int readInt() throws IOException { + int b1 = mInputStream.read() & 0xFF; + int b2 = mInputStream.read() & 0xFF; + int b3 = mInputStream.read() & 0xFF; + int b4 = mInputStream.read() & 0xFF; + return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4; + } + + /** + * 字节数组转十六进制字符串(调试用) + */ + private String bytesToHex(byte[] bytes) { + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + sb.append(String.format("%02X ", b)); + } + return sb.toString().trim(); + } +} + diff --git a/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiPlayer.java b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiPlayer.java new file mode 100644 index 0000000..9ddcee8 --- /dev/null +++ b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiPlayer.java @@ -0,0 +1,311 @@ +package cc.winboll.studio.miniplayer; + +/** + * @Author ZhanGSKen + * @Date 2025/06/29 10:13 + * @Describe MidiPlayer + */ +import android.content.Context; +import android.media.midi.MidiDevice; +import android.media.midi.MidiDeviceInfo; +import android.media.midi.MidiInputPort; +import android.media.midi.MidiManager; +import android.os.Build; +import android.os.Handler; +import cc.winboll.studio.libappbase.LogUtils; +import java.io.File; +import java.io.IOException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class MidiPlayer { + + public static final String TAG = "MidiPlayer"; + + private Context mContext; + private MidiManager mMidiManager; + private MidiDevice mMidiDevice; + private MidiInputPort mInputPort; + private ExecutorService mExecutor; // 线程池懒加载 + private Handler mHandler = new Handler(); + private MidiTrack[] mTracks; // 多轨道数组 + private boolean isPlaying = false; + private int mCurrentTrack = -1; // 当前选中轨道(-1表示全部) + private boolean isSynthConnected = false; // 合成器连接状态 + private OnSynthConnectedListener mConnectionListener; // 连接回调 + + // 乐器库相关 + private SoundFontManager mSoundFontManager; + + // 连接回调接口 + public interface OnSynthConnectedListener { + void onConnected(boolean success); + } + + public MidiPlayer(Context context) { + mContext = context; + // 仅在Android 6.0+初始化MidiManager + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + mMidiManager = (MidiManager) context.getSystemService(Context.MIDI_SERVICE); + } + mSoundFontManager = new SoundFontManager(context); + } + + // 设置连接回调 + public void setOnSynthConnectedListener(OnSynthConnectedListener listener) { + mConnectionListener = listener; + } + + // 懒加载线程池,确保每次使用时都是可用状态 + private ExecutorService getExecutor() { + if (mExecutor == null || mExecutor.isShutdown() || mExecutor.isTerminated()) { + mExecutor = Executors.newSingleThreadExecutor(); + } + return mExecutor; + } + + // 加载Midi文件 + public boolean loadMidiFile(File file) { + try { + MidiParser parser = new MidiParser(file); + mTracks = parser.parse(); // 解析多轨道 + return mTracks != null && mTracks.length > 0; + } catch (IOException e) { + LogUtils.d(TAG, "加载Midi文件失败: " + e.getMessage()); + return false; + } + } + + // 加载自定义乐器(SoundFont) + public boolean loadSoundFont(File soundFontFile) { + return mSoundFontManager.loadSoundFont(soundFontFile); + } + + // 启动播放 + public void start() { + LogUtils.d(TAG, "start()"); + // 检查版本和状态 + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { + LogUtils.d(TAG, "Midi播放需要Android 6.0及以上版本"); + notifyConnectionResult(false); + return; + } + if (isPlaying || mTracks == null || mMidiManager == null) { + return; + } + + isPlaying = true; + // 使用懒加载的线程池执行任务 + getExecutor().execute(new Runnable() { + @Override + public void run() { + LogUtils.d(TAG, "getExecutor().execute(new Runnable()..."); + // 重置连接状态并尝试连接 + isSynthConnected = false; + connectToSynth(); + + // 等待连接完成(最多3秒超时) + int waitCount = 0; + while (!isSynthConnected && waitCount < 30) { // 30*100ms=3s + try { + Thread.sleep(100); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + break; + } + waitCount++; + } + + // 检查连接结果 + if (!isSynthConnected || mInputPort == null) { + LogUtils.d(TAG, "合成器连接失败或输入端口为空"); + isPlaying = false; + notifyConnectionResult(false); + return; + } + + // 连接成功,开始播放 + notifyConnectionResult(true); + playTracks(); + } + }); + } + + // 播放指定轨道(支持多轨同时播放) + private void playTracks() { + LogUtils.d(TAG, "playTracks()"); + LogUtils.d(TAG, String.format("mInputPort %s", mInputPort)); + if (mInputPort == null) { + return; + } + LogUtils.d(TAG, String.format("isPlaying %s", isPlaying)); + + while (isPlaying) { + for (int i = 0; i < mTracks.length; i++) { + // 控制是否播放当前轨道(支持单轨/多轨切换) + if (mCurrentTrack == -1 || mCurrentTrack == i) { + MidiTrack track = mTracks[i]; + if (track.hasNextEvent()) { + byte[] event = track.nextEvent(); + try { + LogUtils.d(TAG, "mInputPort.send..."); + mInputPort.send(event, 0, event.length); + } catch (IOException e) { + LogUtils.d(TAG, "发送Midi事件失败: " + e.getMessage(), Thread.currentThread().getStackTrace()); + } + } else { + track.reset(); // 轨道播放完毕,重置 + } + } + } + // 控制播放速度(根据Midi事件的时间戳调整) + try { + Thread.sleep(10); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + } + + // 连接到系统Midi合成器(适配API 30,移除API 31+方法) + private void connectToSynth() { + if (mMidiManager == null) { + return; + } + + // 重置资源 + closeMidiResources(); + + // 适配API 30及以下:直接遍历设备寻找合成器(移除getDefaultDeviceId调用) + searchSynthInDevices(); + } + + // 遍历设备寻找合成器 + private void searchSynthInDevices() { + MidiDeviceInfo[] devices = mMidiManager.getDevices(); + if (devices == null || devices.length == 0) { + LogUtils.d(TAG, "未检测到任何MIDI设备"); + isSynthConnected = false; + return; + } + + // 遍历所有设备,优先找合成器类型,若无则尝试其他类型 + MidiDeviceInfo targetDevice = null; + for (MidiDeviceInfo device : devices) { + // 优先匹配合成器类型(3) + if (device.getType() == 3) { + targetDevice = device; + break; + } + // 若未找到,尝试其他可能支持输入的设备(如通用MIDI设备) + if (targetDevice == null && device.getInputPortCount() > 0) { + targetDevice = device; + } + } + + if (targetDevice != null) { + mMidiManager.openDevice(targetDevice, new MidiManager.OnDeviceOpenedListener() { + @Override + public void onDeviceOpened(MidiDevice device) { + setupMidiDevice(device); + } + }, mHandler); + } else { + LogUtils.d(TAG, "未找到可用的MIDI设备(含合成器)"); + isSynthConnected = false; + } + } + + // 初始化MIDI设备并打开输入端口 + private void setupMidiDevice(MidiDevice device) { + if (device == null) { + LogUtils.d(TAG, "打开MIDI设备失败"); + isSynthConnected = false; + return; + } + + mMidiDevice = device; + try { + // 打开第一个输入端口(通常索引为0) + mInputPort = mMidiDevice.openInputPort(0); + if (mInputPort != null) { + isSynthConnected = true; + LogUtils.d(TAG, "成功打开MIDI输入端口"); + } else { + LogUtils.d(TAG, "设备无可用输入端口"); + isSynthConnected = false; + } + } catch (Exception e) { + LogUtils.d(TAG, "打开输入端口失败: " + e.getMessage()); + isSynthConnected = false; + } + } + + // 关闭MIDI资源 + private void closeMidiResources() { + if (mInputPort != null) { + try { + mInputPort.close(); + } catch (IOException e) { + LogUtils.d(TAG, "关闭输入端口失败: " + e.getMessage()); + } + mInputPort = null; + } + if (mMidiDevice != null) { + try { + mMidiDevice.close(); + } catch (IOException e) { + LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); + } + mMidiDevice = null; + } + } + + // 通知连接结果 + private void notifyConnectionResult(final boolean success) { + if (mConnectionListener != null) { + mHandler.post(new Runnable() { + @Override + public void run() { + mConnectionListener.onConnected(success); + } + }); + } + } + + // 控制轨道(静音/独奏) + public void setTrackMute(int trackIndex, boolean mute) { + if (trackIndex >= 0 && trackIndex < mTracks.length) { + mTracks[trackIndex].setMute(mute); + } + } + + // 切换当前播放轨道(-1表示全部) + public void setCurrentTrack(int trackIndex) { + mCurrentTrack = trackIndex; + } + + // 获取轨道数量(供Adapter使用) + public int getTrackCount() { + return mTracks != null ? mTracks.length : 0; + } + + // 暂停播放 + public void pause() { + isPlaying = false; + } + + // 停止播放并释放资源 + public void stop() { + isPlaying = false; + isSynthConnected = false; // 重置连接状态 + closeMidiResources(); // 释放MIDI资源 + + // 终止线程池 + if (mExecutor != null) { + mExecutor.shutdownNow(); + mExecutor = null; + } + } +} + diff --git a/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiPlayerActivity.java b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiPlayerActivity.java new file mode 100644 index 0000000..ce114f3 --- /dev/null +++ b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiPlayerActivity.java @@ -0,0 +1,276 @@ +package cc.winboll.studio.miniplayer; + +/** + * @Author ZhanGSKen + * @Date 2025/06/29 10:10 + * @Describe Midi 播放窗口 + */ +import android.app.Activity; +import android.content.Context; +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.ListView; +import android.widget.SeekBar; +import android.widget.TextView; +import com.hjq.toast.ToastUtils; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +public class MidiPlayerActivity extends WinBoLLActivity { + + public static final String TAG = "MidiPlayerActivity"; + + private MidiPlayer mMidiPlayer; + private Button mPlayBtn, mPauseBtn, mStopBtn; + private ListView mTrackListView; + private ListView mFileListView; // 文件列表 + private TrackAdapter mTrackAdapter; + private TextView mFileNameTv; + private List mMidiFileList = new ArrayList<>(); // 存储midi文件列表 + + @Override + public Activity getActivity() { + return this; + } + + @Override + public String getTag() { + return TAG; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_midi_player); // 需确保布局文件存在 + + // 初始化控件 + mPlayBtn = (Button) findViewById(R.id.btn_play); + mPauseBtn = (Button) findViewById(R.id.btn_pause); + mStopBtn = (Button) findViewById(R.id.btn_stop); + mTrackListView = (ListView) findViewById(R.id.lv_tracks); + mFileListView = (ListView) findViewById(R.id.lv_midi_files); + mFileNameTv = (TextView) findViewById(R.id.tv_file_name); + + // 检查系统版本兼容性 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + initMidiPlayer(); + loadMidiFileList(); // 加载本地MIDI文件 + initControlButtons(); + } else { + mFileNameTv.setText("当前设备不支持MIDI播放(需Android 6.0+)"); + disableButtons(); + } + } + + // 初始化MIDI播放器并设置连接回调 + private void initMidiPlayer() { + mMidiPlayer = new MidiPlayer(this); + // 设置合成器连接状态回调(Java 7使用匿名内部类替代Lambda) + mMidiPlayer.setOnSynthConnectedListener(new MidiPlayer.OnSynthConnectedListener() { + @Override + public void onConnected(final boolean success) { + runOnUiThread(new Runnable() { + @Override + public void run() { + if (success) { + ToastUtils.show("MIDI合成器连接成功"); + } else { + ToastUtils.show("未找到MIDI合成器,请安装第三方合成器应用"); + } + } + }); + } + }); + } + + // 加载本地MIDI文件列表 + private void loadMidiFileList() { + File midiDir = new File(getFilesDir(), "midi"); + // 检查目录是否存在 + if (!midiDir.exists()) { + midiDir.mkdirs(); // 创建目录 + mFileNameTv.setText("midi目录已创建,请放入文件"); + return; + } + + // 筛选.mid和.midi文件 + File[] files = midiDir.listFiles(); + if (files != null) { + for (File file : files) { + String name = file.getName().toLowerCase(); + if (name.endsWith(".mid") || name.endsWith(".midi")) { + mMidiFileList.add(file); + } + } + } + + // 显示文件列表 + if (mMidiFileList.isEmpty()) { + mFileNameTv.setText("midi目录中无可用文件"); + } else { + showFileList(); + } + } + + // 显示文件列表到ListView + private void showFileList() { + List fileNameList = new ArrayList<>(); + for (File file : mMidiFileList) { + fileNameList.add(file.getName()); + } + + // 设置文件列表适配器 + ArrayAdapter adapter = new ArrayAdapter( + this, + android.R.layout.simple_list_item_1, + fileNameList + ); + mFileListView.setAdapter(adapter); + + // 文件点击事件:加载选中的MIDI文件(Java 7使用匿名内部类替代Lambda) + mFileListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + mMidiPlayer.stop(); // 停止当前播放 + File selectedFile = mMidiFileList.get(position); + boolean loaded = mMidiPlayer.loadMidiFile(selectedFile); + if (loaded) { + mFileNameTv.setText("当前文件:" + selectedFile.getName()); + initTrackList(); // 刷新轨道列表 + ToastUtils.show("已加载:" + selectedFile.getName()); + } else { + mFileNameTv.setText("文件加载失败:" + selectedFile.getName()); + } + } + }); + } + + // 初始化轨道列表(显示所有轨道的控制项) + private void initTrackList() { + mTrackAdapter = new TrackAdapter(this, mMidiPlayer); + mTrackListView.setAdapter(mTrackAdapter); + } + + // 初始化播放控制按钮 + private void initControlButtons() { + mPlayBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mMidiPlayer != null) { + mMidiPlayer.start(); + } + } + }); + + mPauseBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mMidiPlayer != null) { + mMidiPlayer.pause(); + } + } + }); + + mStopBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mMidiPlayer != null) { + mMidiPlayer.stop(); + } + } + }); + } + + // 禁用所有控制按钮 + private void disableButtons() { + mPlayBtn.setEnabled(false); + mPauseBtn.setEnabled(false); + mStopBtn.setEnabled(false); + } + + // 轨道控制适配器(每个轨道显示静音按钮和音量条) + private class TrackAdapter extends android.widget.BaseAdapter { + private Context mContext; + private MidiPlayer mPlayer; + + public TrackAdapter(Context context, MidiPlayer player) { + mContext = context; + mPlayer = player; + } + + @Override + public int getCount() { + return mPlayer != null ? mPlayer.getTrackCount() : 0; + } + + @Override + public Object getItem(int position) { + return null; + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + // 加载轨道项布局(需创建item_track.xml) + View view = getLayoutInflater().inflate(R.layout.item_track, parent, false); + TextView trackNameTv = (TextView) view.findViewById(R.id.tv_track_name); + final Button muteBtn = (Button) view.findViewById(R.id.btn_mute); + SeekBar volumeSb = (SeekBar) view.findViewById(R.id.sb_volume); + + // 设置轨道名称 + trackNameTv.setText("轨道 " + (position + 1)); + + // 静音按钮逻辑 + muteBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + boolean isMuted = muteBtn.isSelected(); + mPlayer.setTrackMute(position, !isMuted); + muteBtn.setSelected(!isMuted); + muteBtn.setText(isMuted ? "静音" : "已静音"); + } + }); + + // 音量条(示例:实际需结合MIDI事件处理) + volumeSb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + // 可添加音量控制逻辑(如修改MIDI音量事件) + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) {} + + @Override + public void onStopTrackingTouch(SeekBar seekBar) {} + }); + + return view; + } + } + + // 日志查看按钮点击事件 + public void onLog(View view) { + App.getWinBoLLActivityManager().startLogActivity(this); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + // 释放资源 + if (mMidiPlayer != null) { + mMidiPlayer.stop(); + } + } +} + diff --git a/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiTrack.java b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiTrack.java new file mode 100644 index 0000000..bc24b8a --- /dev/null +++ b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/MidiTrack.java @@ -0,0 +1,78 @@ +package cc.winboll.studio.miniplayer; + +/** + * @Author ZhanGSKen + * @Date 2025/06/29 10:24 + * @Describe Midi轨道类,用于存储和管理单条Midi轨道的事件 + */ +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class MidiTrack { + public static final String TAG = "MidiTrack"; + + // 轨道事件列表(存储Midi事件字节数组) + private List mEvents = new ArrayList<>(); + // 事件迭代器(用于播放时遍历事件) + private Iterator mEventIterator; + // 轨道是否静音 + private boolean isMuted = false; + + public MidiTrack() { + } + + /** + * 添加Midi事件到轨道 + */ + public void addEvent(byte[] event) { + mEvents.add(event); + } + + /** + * 重置轨道播放状态(回到起始位置) + */ + public void reset() { + mEventIterator = mEvents.iterator(); + } + + /** + * 判断是否有下一个事件 + */ + public boolean hasNextEvent() { + // 如果静音,返回false不播放事件 + if (isMuted) { + return false; + } + // 初始化迭代器(首次使用或重置后) + if (mEventIterator == null) { + reset(); + } + return mEventIterator.hasNext(); + } + + /** + * 获取下一个Midi事件 + */ + public byte[] nextEvent() { + if (mEventIterator == null) { + reset(); + } + return mEventIterator.next(); + } + + /** + * 设置轨道静音状态 + */ + public void setMute(boolean mute) { + isMuted = mute; + } + + /** + * 获取轨道事件数量 + */ + public int getEventCount() { + return mEvents.size(); + } +} + diff --git a/miniplayer/src/main/java/cc/winboll/studio/miniplayer/SoundFontManager.java b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/SoundFontManager.java new file mode 100644 index 0000000..cc56dfb --- /dev/null +++ b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/SoundFontManager.java @@ -0,0 +1,59 @@ +package cc.winboll.studio.miniplayer; + +/** + * @Author ZhanGSKen + * @Date 2025/06/29 10:12 + * @Describe SoundFontManager + */ +import android.content.Context; +import android.util.Log; +import cc.winboll.studio.libappbase.LogUtils; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +// 简化版:实际需使用SoundFont解析库(如Audiokit、FluidSynth) +public class SoundFontManager { + + public static final String TAG = "SoundFontManager"; + + private Context mContext; + private File mSoundFontFile; + + public SoundFontManager(Context context) { + mContext = context; + } + + // 加载SoundFont文件(.sf2格式) + public boolean loadSoundFont(File file) { + if (!file.exists() || !file.getName().endsWith(".sf2")) { + LogUtils.d(TAG, "无效的SoundFont文件"); + return false; + } + // 复制到应用私有目录(可选) + try { + File dest = new File(mContext.getFilesDir(), "custom_soundfont.sf2"); + FileInputStream fis = new FileInputStream(file); + FileOutputStream fos = new FileOutputStream(dest); + byte[] buffer = new byte[1024]; + int len; + while ((len = fis.read(buffer)) != -1) { + fos.write(buffer, 0, len); + } + fis.close(); + fos.close(); + mSoundFontFile = dest; + return true; + } catch (IOException e) { + LogUtils.d(TAG, "复制SoundFont失败: " + e.getMessage()); + return false; + } + } + + // 获取加载的SoundFont路径(供合成器使用) + public String getSoundFontPath() { + return mSoundFontFile != null ? mSoundFontFile.getAbsolutePath() : null; + } +} + diff --git a/miniplayer/src/main/java/cc/winboll/studio/miniplayer/WinBoLLActivity.java b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/WinBoLLActivity.java new file mode 100644 index 0000000..52d4af8 --- /dev/null +++ b/miniplayer/src/main/java/cc/winboll/studio/miniplayer/WinBoLLActivity.java @@ -0,0 +1,60 @@ +package cc.winboll.studio.miniplayer; + +/** + * @Author ZhanGSKen + * @Date 2025/06/29 10:40 + * @Describe WinBoLLActivity + */ +import android.app.Activity; +import android.os.Bundle; +import android.view.MenuItem; +import androidx.appcompat.app.AppCompatActivity; +import cc.winboll.studio.libappbase.GlobalApplication; +import cc.winboll.studio.libappbase.LogUtils; +import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; + +public class WinBoLLActivity extends AppCompatActivity implements IWinBoLLActivity { + + public static final String TAG = "WinBoLLActivity"; + + @Override + public Activity getActivity() { + return this; + } + + @Override + public String getTag() { + return TAG; + } + + @Override + protected void onResume() { + super.onResume(); + LogUtils.d(TAG, String.format("onResume %s", getTag())); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + /*if (item.getItemId() == R.id.item_log) { + GlobalApplication.getWinBoLLActivityManager().startLogActivity(this); + return true; + } else if (item.getItemId() == R.id.item_home) { + GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(getApplicationContext(), MainActivity.class); + return true; + }*/ + // 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。 + return super.onOptionsItemSelected(item); + } + + @Override + protected void onPostCreate(Bundle savedInstanceState) { + super.onPostCreate(savedInstanceState); + GlobalApplication.getWinBoLLActivityManager().add(this); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + GlobalApplication.getWinBoLLActivityManager().registeRemove(this); + } +} diff --git a/miniplayer/src/main/res/drawable-v24/ic_launcher_foreground.xml b/miniplayer/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/miniplayer/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/miniplayer/src/main/res/drawable/ic_launcher_background.xml b/miniplayer/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/miniplayer/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/miniplayer/src/main/res/layout/activity_main.xml b/miniplayer/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..65a4964 --- /dev/null +++ b/miniplayer/src/main/res/layout/activity_main.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + +