-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Add support for raw midi / ump input. Fixes #101
- Loading branch information
Showing
8 changed files
with
125 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//*****************************************// | ||
// cmidiin.cpp | ||
// by Gary Scavone, 2003-2004. | ||
// | ||
// Simple program to test MIDI input and | ||
// use of a user callback function. | ||
// | ||
//*****************************************// | ||
|
||
#include "utils.hpp" | ||
|
||
#include <libremidi/libremidi.hpp> | ||
|
||
#include <cstdlib> | ||
#include <iostream> | ||
|
||
int main(int argc, const char** argv) | ||
{ | ||
// Read command line arguments | ||
libremidi::examples::arguments args{argc, argv}; | ||
|
||
libremidi::midi_in midiin{ | ||
{.on_message = {}, | ||
.on_raw_data = | ||
[](std::span<const uint8_t> data, libremidi::timestamp t) { | ||
std::cout << std::dec << t << ": " << std::hex; | ||
for (auto byte : data) | ||
std::cout << int(byte) << " "; | ||
std::cout << std::endl; | ||
}}, | ||
libremidi::midi_in_configuration_for( | ||
args.api)}; // Passing the second configuration argument can be skipped to use the default MIDI API | ||
|
||
if (!args.open_port(midiin)) | ||
return 1; | ||
|
||
std::cout << "\nReading MIDI input ... press <enter> to quit.\n"; | ||
int c; | ||
while ((c = getchar()) != '\n' && c != EOF) | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters