diff --git a/module/lua_juce/lua_juce.cpp b/module/lua_juce/lua_juce.cpp index e20b1f6..e01c3dd 100644 --- a/module/lua_juce/lua_juce.cpp +++ b/module/lua_juce/lua_juce.cpp @@ -32,7 +32,11 @@ auto allModules(sol::state& lua) -> void // juce_audio_basics juce_AudioPlayHead(table); + juce_MidiFile(table); juce_MidiMessage(table); + juce_MidiMessageSequence(table); + juce_MidiRPNDetector(table); + juce_MidiRPNMessage(table); // juce_data_structures juce_UndoableAction(table); diff --git a/module/lua_juce_audio_basics/lua_juce_audio_basics.cpp b/module/lua_juce_audio_basics/lua_juce_audio_basics.cpp index 5b817b0..94a271a 100644 --- a/module/lua_juce_audio_basics/lua_juce_audio_basics.cpp +++ b/module/lua_juce_audio_basics/lua_juce_audio_basics.cpp @@ -1,4 +1,8 @@ #include #include "audio_play_head/AudioPlayHead.cpp" // NOLINT +#include "midi/MidiFile.cpp" // NOLINT #include "midi/MidiMessage.cpp" // NOLINT +#include "midi/MidiMessageSequence.cpp" // NOLINT +#include "midi/MidiRPNDetector.cpp" // NOLINT +#include "midi/MidiRPNMessage.cpp" // NOLINT diff --git a/module/lua_juce_audio_basics/lua_juce_audio_basics.hpp b/module/lua_juce_audio_basics/lua_juce_audio_basics.hpp index 86ffb01..d206672 100644 --- a/module/lua_juce_audio_basics/lua_juce_audio_basics.hpp +++ b/module/lua_juce_audio_basics/lua_juce_audio_basics.hpp @@ -25,5 +25,9 @@ END_JUCE_MODULE_DECLARATION namespace lua_juce { auto juce_AudioPlayHead(sol::table& state) -> void; +auto juce_MidiFile(sol::table& state) -> void; auto juce_MidiMessage(sol::table& state) -> void; +auto juce_MidiRPNDetector(sol::table& state) -> void; +auto juce_MidiRPNMessage(sol::table& state) -> void; +auto juce_MidiMessageSequence(sol::table& state) -> void; } // namespace lua_juce diff --git a/module/lua_juce_audio_basics/midi/MidiFile.cpp b/module/lua_juce_audio_basics/midi/MidiFile.cpp new file mode 100644 index 0000000..f6a1ef6 --- /dev/null +++ b/module/lua_juce_audio_basics/midi/MidiFile.cpp @@ -0,0 +1,23 @@ +namespace lua_juce { + +auto juce_MidiFile(sol::table& state) -> void +{ + auto midiFile = state.new_usertype("MidiFile", sol::constructors()); + + midiFile["getNumTracks"] = LUA_JUCE_C_CALL(&juce::MidiFile::getNumTracks); + midiFile["getTrack"] = LUA_JUCE_C_CALL(&juce::MidiFile::getTrack); + midiFile["addTrack"] = LUA_JUCE_C_CALL(&juce::MidiFile::addTrack); + midiFile["clear"] = LUA_JUCE_C_CALL(&juce::MidiFile::clear); + midiFile["getTimeFormat"] = LUA_JUCE_C_CALL(&juce::MidiFile::getTimeFormat); + midiFile["setTicksPerQuarterNote"] = LUA_JUCE_C_CALL(&juce::MidiFile::setTicksPerQuarterNote); + midiFile["setSmpteTimeFormat"] = LUA_JUCE_C_CALL(&juce::MidiFile::setSmpteTimeFormat); + midiFile["findAllTempoEvents"] = LUA_JUCE_C_CALL(&juce::MidiFile::findAllTempoEvents); + midiFile["findAllTimeSigEvents"] = LUA_JUCE_C_CALL(&juce::MidiFile::findAllTimeSigEvents); + midiFile["findAllKeySigEvents"] = LUA_JUCE_C_CALL(&juce::MidiFile::findAllKeySigEvents); + midiFile["getLastTimestamp"] = LUA_JUCE_C_CALL(&juce::MidiFile::getLastTimestamp); + midiFile["readFrom"] = LUA_JUCE_C_CALL(&juce::MidiFile::readFrom); + midiFile["writeTo"] = LUA_JUCE_C_CALL(&juce::MidiFile::writeTo); + midiFile["convertTimestampTicksToSeconds"] = LUA_JUCE_C_CALL(&juce::MidiFile::convertTimestampTicksToSeconds); +} + +} // namespace lua_juce diff --git a/module/lua_juce_audio_basics/midi/MidiMessageSequence.cpp b/module/lua_juce_audio_basics/midi/MidiMessageSequence.cpp new file mode 100644 index 0000000..82fee32 --- /dev/null +++ b/module/lua_juce_audio_basics/midi/MidiMessageSequence.cpp @@ -0,0 +1,38 @@ +namespace lua_juce { + +auto juce_MidiMessageSequence(sol::table& state) -> void +{ + auto midiSequence = state.new_usertype("MidiMessageSequence", sol::constructors()); + + midiSequence["clear"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::clear); + midiSequence["getNumEvents"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::getNumEvents); + midiSequence["getEventPointer"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::getEventPointer); + midiSequence["getTimeOfMatchingKeyUp"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::getTimeOfMatchingKeyUp); + midiSequence["getIndexOfMatchingKeyUp"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::getIndexOfMatchingKeyUp); + midiSequence["getIndexOf"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::getIndexOf); + midiSequence["getNextIndexAtTime"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::getNextIndexAtTime); + midiSequence["getStartTime"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::getStartTime); + midiSequence["getEndTime"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::getEndTime); + midiSequence["getEventTime"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::getEventTime); + midiSequence["deleteEvent"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::deleteEvent); + midiSequence["updateMatchedPairs"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::updateMatchedPairs); + midiSequence["sort"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::sort); + midiSequence["extractMidiChannelMessages"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::extractMidiChannelMessages); + midiSequence["extractSysExMessages"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::extractSysExMessages); + midiSequence["deleteMidiChannelMessages"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::deleteMidiChannelMessages); + midiSequence["deleteSysExMessages"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::deleteSysExMessages); + midiSequence["addTimeToMessages"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::addTimeToMessages); + midiSequence["createControllerUpdatesForTime"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::createControllerUpdatesForTime); + midiSequence["swapWith"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::swapWith); + + // midiSequence["begin"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::begin); + // midiSequence["begin"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::begin); + // midiSequence["end"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::end); + // midiSequence["end"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::end); + // midiSequence["addEvent"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::addEvent); + // midiSequence["addEvent"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::addEvent); + // midiSequence["addSequence"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::addSequence); + // midiSequence["addSequence"] = LUA_JUCE_C_CALL(&juce::MidiMessageSequence::addSequence); +} + +} // namespace lua_juce diff --git a/module/lua_juce_audio_basics/midi/MidiRPNDetector.cpp b/module/lua_juce_audio_basics/midi/MidiRPNDetector.cpp new file mode 100644 index 0000000..ab2d35f --- /dev/null +++ b/module/lua_juce_audio_basics/midi/MidiRPNDetector.cpp @@ -0,0 +1,10 @@ +namespace lua_juce { + +auto juce_MidiRPNDetector(sol::table& state) -> void +{ + auto detector = state.new_usertype("MidiRPNDetector", sol::default_constructor); + detector["reset"] = LUA_JUCE_C_CALL(&juce::MidiRPNDetector::reset); + detector["tryParse"] = LUA_JUCE_C_CALL(&juce::MidiRPNDetector::tryParse); +} + +} // namespace lua_juce diff --git a/module/lua_juce_audio_basics/midi/MidiRPNMessage.cpp b/module/lua_juce_audio_basics/midi/MidiRPNMessage.cpp new file mode 100644 index 0000000..f34efca --- /dev/null +++ b/module/lua_juce_audio_basics/midi/MidiRPNMessage.cpp @@ -0,0 +1,14 @@ +namespace lua_juce { + +auto juce_MidiRPNMessage(sol::table& state) -> void +{ + auto midiSequence = state.new_usertype("MidiRPNMessage", sol::default_constructor); + + midiSequence["channel"] = LUA_JUCE_C_CALL(&juce::MidiRPNMessage::channel); + midiSequence["parameterNumber"] = LUA_JUCE_C_CALL(&juce::MidiRPNMessage::parameterNumber); + midiSequence["value"] = LUA_JUCE_C_CALL(&juce::MidiRPNMessage::value); + midiSequence["isNRPN"] = LUA_JUCE_C_CALL(&juce::MidiRPNMessage::isNRPN); + midiSequence["is14BitValue"] = LUA_JUCE_C_CALL(&juce::MidiRPNMessage::is14BitValue); +} + +} // namespace lua_juce diff --git a/tool/jml-documentation/Documentation.md b/tool/jml-documentation/Documentation.md index c8f3990..d415369 100644 --- a/tool/jml-documentation/Documentation.md +++ b/tool/jml-documentation/Documentation.md @@ -1,7 +1,11 @@ # JML Documentation - [juce_audio_basics](#juce_audio_basics) + - [MidiFile](#MidiFile) - [MidiMessage](#MidiMessage) + - [MidiMessageSequence](#MidiMessageSequence) + - [MidiRPNDetector](#MidiRPNDetector) + - [MidiRPNMessage](#MidiRPNMessage) - [juce_core](#juce_core) - [BigInteger](#BigInteger) - [File](#File) @@ -41,6 +45,25 @@ ## juce_audio_basics +## MidiFile + +```lua +juce.MidiFile.addTrack(...) +juce.MidiFile.clear(...) +juce.MidiFile.convertTimestampTicksToSeconds(...) +juce.MidiFile.findAllKeySigEvents(...) +juce.MidiFile.findAllTempoEvents(...) +juce.MidiFile.findAllTimeSigEvents(...) +juce.MidiFile.getLastTimestamp(...) +juce.MidiFile.getNumTracks(...) +juce.MidiFile.getTimeFormat(...) +juce.MidiFile.getTrack(...) +juce.MidiFile.new(...) +juce.MidiFile.readFrom(...) +juce.MidiFile.setSmpteTimeFormat(...) +juce.MidiFile.setTicksPerQuarterNote(...) +juce.MidiFile.writeTo(...) +``` ## MidiMessage ```lua @@ -143,6 +166,48 @@ juce.MidiMessage.textMetaEvent(...) juce.MidiMessage.timeSignatureMetaEvent(...) juce.MidiMessage.withTimeStamp(...) ``` +## MidiMessageSequence + +```lua +juce.MidiMessageSequence.addTimeToMessages(...) +juce.MidiMessageSequence.clear(...) +juce.MidiMessageSequence.createControllerUpdatesForTime(...) +juce.MidiMessageSequence.deleteEvent(...) +juce.MidiMessageSequence.deleteMidiChannelMessages(...) +juce.MidiMessageSequence.deleteSysExMessages(...) +juce.MidiMessageSequence.extractMidiChannelMessages(...) +juce.MidiMessageSequence.extractSysExMessages(...) +juce.MidiMessageSequence.getEndTime(...) +juce.MidiMessageSequence.getEventPointer(...) +juce.MidiMessageSequence.getEventTime(...) +juce.MidiMessageSequence.getIndexOf(...) +juce.MidiMessageSequence.getIndexOfMatchingKeyUp(...) +juce.MidiMessageSequence.getNextIndexAtTime(...) +juce.MidiMessageSequence.getNumEvents(...) +juce.MidiMessageSequence.getStartTime(...) +juce.MidiMessageSequence.getTimeOfMatchingKeyUp(...) +juce.MidiMessageSequence.new(...) +juce.MidiMessageSequence.sort(...) +juce.MidiMessageSequence.swapWith(...) +juce.MidiMessageSequence.updateMatchedPairs(...) +``` +## MidiRPNDetector + +```lua +juce.MidiRPNDetector.new(...) +juce.MidiRPNDetector.reset(...) +juce.MidiRPNDetector.tryParse(...) +``` +## MidiRPNMessage + +```lua +juce.MidiRPNMessage.channel(...) +juce.MidiRPNMessage.is14BitValue(...) +juce.MidiRPNMessage.isNRPN(...) +juce.MidiRPNMessage.new(...) +juce.MidiRPNMessage.parameterNumber(...) +juce.MidiRPNMessage.value(...) +``` ## juce_core ## BigInteger diff --git a/tool/jml-documentation/main.lua b/tool/jml-documentation/main.lua index 8940cd7..6d01537 100644 --- a/tool/jml-documentation/main.lua +++ b/tool/jml-documentation/main.lua @@ -155,7 +155,13 @@ writeTypesDocsAsMarkdown(file, "snippets", { juce.RelativeTime.seconds(1.0), juce.Time.new(), }, - juce_audio_basics = {juce.MidiMessage.new()}, + juce_audio_basics = { + juce.MidiFile.new(), + juce.MidiMessage.new(), + juce.MidiMessageSequence.new(), + juce.MidiRPNDetector.new(), + juce.MidiRPNMessage.new(), + }, juce_data_structures = {juce.UndoManager.new(0, 0), juce.ValueTree.new()}, juce_graphics = { juce.AffineTransform.new(),