Skip to content

Commit

Permalink
[docs] Fix out-of-date documentation about channel events. Fixes #112
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Aug 13, 2024
1 parent 22d8697 commit f80673b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions book/src/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ libremidi::writer writer;
// Create tracks and events declaratively by changing the track vector directly:
writer.tracks.push_back(
libremidi::midi_track{
libremidi::track_event{0, 0, libremidi::message::note_on(1, 45, 35)},
libremidi::track_event{140, 0, libremidi::message::note_off(1, 45, 0)},
libremidi::track_event{0, 0, libremidi::channel_events::note_on(1, 45, 35)},
libremidi::track_event{140, 0, libremidi::channel_events::note_off(1, 45, 0)},
}
);

// Or through a builder API:
{
int tick = 500;
int track = 3;
libremidi::message msg = libremidi::message::note_on(1, 45, 35);
libremidi::message msg = libremidi::channel_events::note_on(1, 45, 35);

// Tracks will be added as needed within safe limits
writer.add_event(tick, track, msg);
Expand Down
8 changes: 4 additions & 4 deletions book/src/midi-1-out.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ midi.send_message(bytes, sizeof(bytes));
// This allows to pass std::vector, std::array and the likes
midi.send_message(std::span<unsigned char>{ ... your span-compatible data-structure ... });

// Option D: helpers with the libremidi::message class
// Option D: helpers with the libremidi::channel_events and libremidi::meta_events structs
// See libremidi/message.hpp for the full list
midi.send_message(libremidi::message::note_on(channel, note, velocity));
midi.send_message(libremidi::message::control_change(channel, control, value));
midi.send_message(libremidi::message::pitch_bend(channel, value));
midi.send_message(libremidi::channel_events::note_on(channel, note, velocity));
midi.send_message(libremidi::channel_events::control_change(channel, control, value));
midi.send_message(libremidi::channel_events::pitch_bend(channel, value));
midi.send_message(libremidi::message{ /* a message */ });
```

0 comments on commit f80673b

Please sign in to comment.