Skip to content

Commit

Permalink
Merge pull request #7 from tr-takatsuka/supportmeta
Browse files Browse the repository at this point in the history
feat: support MetaEvent
  • Loading branch information
tr-takatsuka authored Nov 3, 2024
2 parents 5876fa1 + 10d98c4 commit adc4be8
Show file tree
Hide file tree
Showing 14 changed files with 1,580 additions and 352 deletions.
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# CMakeList.txt : convert の CMake プロジェクト。ソースを含めて、次を定義します:
# CMakeList.txt : rlib-MML の CMake プロジェクト。ソースを含めて、次を定義します:
# プロジェクト専用ロジックはこちらです。
#
cmake_minimum_required (VERSION 3.8)

# サポートされている場合は、MSVC コンパイラのホット リロードを有効にします。
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()

# デフォルトは Release ビルド
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
Expand All @@ -29,6 +35,7 @@ TARGET_LINK_LIBRARIES( ${CMAKE_PROJECT_NAME} boost_program_options)
TARGET_LINK_LIBRARIES( ${CMAKE_PROJECT_NAME} boost_regex)



# TODO: テストを追加し、必要な場合は、ターゲットをインストールします。

project("smftomml")
Expand All @@ -41,5 +48,6 @@ add_executable( ${CMAKE_PROJECT_NAME}

# ライブラリ
TARGET_LINK_LIBRARIES( ${CMAKE_PROJECT_NAME} stdc++fs)
TARGET_LINK_LIBRARIES( ${CMAKE_PROJECT_NAME} boost_program_options)
TARGET_LINK_LIBRARIES( ${CMAKE_PROJECT_NAME} boost_regex)
TARGET_LINK_LIBRARIES( ${CMAKE_PROJECT_NAME} boost_program_options boost_regex)
TARGET_LINK_LIBRARIES( ${CMAKE_PROJECT_NAME} boost_locale)
#TARGET_LINK_LIBRARIES( ${CMAKE_PROJECT_NAME} icui18n icuuc)
101 changes: 101 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"version": 3,
"configurePresets": [
{
"name": "windows-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "x64-debug",
"displayName": "x64 Debug",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x64-release",
"displayName": "x64 Release",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "x86-debug",
"displayName": "x86 Debug",
"inherits": "windows-base",
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x86-release",
"displayName": "x86 Release",
"inherits": "x86-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "linux-debug",
"displayName": "Linux Debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
},
{
"name": "macos-debug",
"displayName": "macOS Debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
}
]
}
34 changes: 0 additions & 34 deletions CMakeSettings.json

This file was deleted.

7 changes: 5 additions & 2 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ C++17 環境でコンパイルできます。ビルドには boost が必要で
|PitchBend([ベンド値])| ピッチベンドです。<br>値は -8192(2音下)~8191(2音上)で、中央は0です。| "PitchBend(-4096) cde Pan(0) cde"<br>→ 半音下げたドレミと通常のドレミです|
|CC([コントロール番号],[])<br>別名 ContorlChange| コントロールチェンジです。<br>第1引数がコントロール番号、第1引数が値です| "CC(0,10)CC(32,130)@2" バンクセレクトしたプログラムチェンジです。|
|CreateSequence(<br>&emsp;name:[シーケンス名],<br>&emsp;mml:[MML],<br>)|シーケンス(サブシーケンス)を定義します。<br>楽曲(MML)を部品として定義し、以降のMMLの中で呼び出す(張り付ける)ことができます。| // ドラムパターンを定義します<br/>CreateSequence(name:drum, mml:"<br/>&emsp;CreatePort(name:kick, channel:10) l8 o1 c^^c ^c^^<br/>&emsp;CreatePort(name:snare, channel:10) l8 o1 ^^d^ ^^d^<br/>")|
|Seq([シーケンス名],length:[長さ(省略可)])<br>別名 Sequence|定義済のシーケンス(サブシーケンス)を呼び出します。| // 定義したドラムパターンを3回繰り返します。<br>// 3周目のシ-ケンスは2分音符分のみ採用します<br/>Seq(drum) Seq(drum) Seq(drum,length:2)|
|Seq(<br>&emsp;[シーケンス名],<br>&emsp;length:[長さ(省略可)]<br>)<br>別名 Sequence|定義済のシーケンス(サブシーケンス)を呼び出します。| // 定義したドラムパターンを3回繰り返します。<br>// 3周目のシ-ケンスは2分音符分のみ採用します<br/>Seq(drum) Seq(drum) Seq(drum,length:2)|
|Meta(<br>&emsp;type:[イベントタイプ],<br>&emsp;[データ]...<br>)|メタイベントです。<br>typeでイベントタイプを指定します。<br>名前ナシの可変長引数でデータを指定します。データ長を記述する必要はありません。| // title 情報です<br/>Meta(type:0x1,"The Lost King's Scepter")<br>// SMPTE オフセットです。<br>Meta(type:0x54,96,0,0,0,0)|
|DefinePresetFM(<br>&emsp;no:[プログラムナンバー],<br>&emsp;name:[音色名],<br>&emsp;[音色データ]...<br>)|rlib-MML でFM音源音色を定義するシーケンサー固有のメタイベントです。|DefinePresetFM(no:4,name:"piano",<br>// AR DR SR RR SL TL KS ML DT<br> 29, 8, 0, 8, 3, 31, 2, 1, 3,<br> 31, 3, 1, 6, 10, 0, 0, 2, 7,<br> 29, 20, 0, 9, 2, 44, 0, 4, 2,<br> 31, 7, 2, 6, 6, 0, 0, 1, 5,<br>// AL FB<br> 4, 7,<br>)|


## 文字列

Expand All @@ -74,7 +77,7 @@ C++17 環境でコンパイルできます。ビルドには boost が必要で
| 表記 | 説明 ||
| ---- | ---- | ---- |
| ○○○ | 英数字のみの場合でこの指定が可能です。| abcdefg |
| "○○○" | " から " までが文字列です。空白や記号を以外を使う場合にも使えます。 | "drum part"
| "○○○" | " から " までが文字列です。空白や記号を使う場合にも使えます。 | "drum part"
| R"\*\*(○○○)\*\*" | 空白や記号や " を使う場合にも使えます。<br>シーケンスの中にシーケンスを定義するような場合は、** を一意の文字列にすることで文字列定義の中に文字列定義があるようなケースに対応できます | R"(drum)"<br><br> R"ch1( mml:R"(drum)" )ch1"


Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@ Experimental WebAssembly support is also available.

| notation | description |example|
| ---- | ---- | ---- |
|createPort(<br>&emsp;name:[port name],<br>&emsp;instrument:[instrument name]\(optional),<br>&emsp;channel:[channel number],<br>)| Define (declare) the port<br>Channel numbers are 1-16.|"createPort(name:Piano, channel:3)" <br>→ Declare the port of MIDI channel 3 with the name "Piano".<br>instrument specifies the name of the instrument. If omitted, the default instrument is used.|
|port([port name])| It is port switching|"port(Piano) cde" → CDE at Port "Piano"|
|CreatePort(<br>&emsp;name:[port name],<br>&emsp;instrument:[instrument name]\(optional),<br>&emsp;channel:[channel number],<br>)| Define (declare) the port<br>Channel numbers are 1-16.|"createPort(name:Piano, channel:3)" <br>→ Declare the port of MIDI channel 3 with the name "Piano".<br>instrument specifies the name of the instrument. If omitted, the default instrument is used.|
|Port([port name])| It is port switching|"port(Piano) cde" → CDE at Port "Piano"|
|V([volume value])<br>ailias: volume|The volume. Values ​​are 0-127.| "V(120) cde" → CDE at Volume 120.|
|pan([pan value])<br>ailias: panpot|It is pan (panpot).<br>Values ​​range from 0 (far left) to 127 (far right), with 64 in the center.| "pan(0) cde" → CDE at Pan 0 (far left).|
|Pan([pan value])<br>ailias: panpot|It is pan (panpot).<br>Values ​​range from 0 (far left) to 127 (far right), with 64 in the center.| "pan(0) cde" → CDE at Pan 0 (far left).|
|PitchBend([value])| Pitch bend.<br>Values range from -8192 (two notes down) to 8191 (two notes up), with the centre at 0.| "PitchBend(-4096) cde Pan(0) cde"<br>→ CDE lowered by a semitone and normal CDE.|
|CC([contorl change no],[value])<br>ailias: ContorlChange| Contorl change.<br>The first argument is the control number and the first argument is the value| "CC(0,10)CC(32,130)@2" Bank-selected programme change.|
|CreateSequence(<br>&emsp;name:[sequence name],<br>&emsp;mml:[MML],<br>)|Defined Sequence(sub Sequence).<br>Define songs (MML) as parts and call them in subsequent MMLs.| // Defined rhythm pattern<br/>CreateSequence(name:drum, mml:"<br/>&emsp;CreatePort(name:kick, channel:10) l8 o1 c^^c ^c^^<br/>&emsp;CreatePort(name:snare, channel:10) l8 o1 ^^d^ ^^d^<br/>")|
|Seq([sequence name],length:[length(optional)])<br>ailias Sequence|Calls a predefined sequence (sub-sequence).| // Defined rhythmic pattern is repeated three times.<br>// Only half-note minutes are used for the third round of the sequence.<br/>Seq(drum) Seq(drum) Seq(drum,length:2)|

|Seq(<br>&emsp;[sequence name],<br>&emsp;length:[length(optional)]<br>)<br>ailias Sequence|Calls a predefined sequence (sub-sequence).| // Defined rhythmic pattern is repeated three times.<br>// Only half-note minutes are used for the third round of the sequence.<br/>Seq(drum) Seq(drum) Seq(drum,length:2)|
|Meta(<br>&emsp;type:[event type],<br>&emsp;[data]...<br>)|Meta Event.<br>type specifies the event type.<br>Specify data with a variable-length argument with no name. It is not necessary to describe the data length.| // title info<br/>Meta(type:0x1,"The Lost King's Scepter")<br>// SMPTE offset<br>Meta(type:0x54,96,0,0,0,0)|
|DefinePresetFM(<br>&emsp;no:[program no],<br>&emsp;name:[name],<br>&emsp;[data]...<br>)|Sequencer specific meta event that defines FM sound tone in rlib-MML.|DefinePresetFM(no:4,name:"piano",<br>// AR DR SR RR SL TL KS ML DT<br> 29, 8, 0, 8, 3, 31, 2, 1, 3,<br> 31, 3, 1, 6, 10, 0, 0, 2, 7,<br> 29, 20, 0, 9, 2, 44, 0, 4, 2,<br> 31, 7, 2, 6, 6, 0, 0, 1, 5,<br>// AL FB<br> 4, 7,<br>)|
## string

Where a string is specified, the following formats can be used.
Expand Down
Loading

0 comments on commit adc4be8

Please sign in to comment.