diff --git a/TODO b/TODO index d2c13ac6..f1b41940 100644 --- a/TODO +++ b/TODO @@ -37,6 +37,13 @@ Misc: [seq66] Unexpected meta type 0x2f offset ~0x167df [seq66] Unexpected meta type 0x2f offset ~0x16822 [seq66] Read: '/home/ahlstrom/Downloads/Trilogy.mid' + Also make sure SysEx messages in first track are being stored. + Write a module to show SysEx (and optionally store them as + a macro. + Also handle meta-midi-port message tracks, and add them as + patterns if they also have trkname messages. + Also test with the Dixie04.mid file, as our SysEx reading was + wrong!!!! Mutes: diff --git a/libseq66/include/midi/midifile.hpp b/libseq66/include/midi/midifile.hpp index 8751606e..ce716d95 100644 --- a/libseq66/include/midi/midifile.hpp +++ b/libseq66/include/midi/midifile.hpp @@ -449,13 +449,16 @@ class midifile * * \return * Returns true if the byte is SysEx special ID. + * + * THIS FUNCTION IS WRONG, BOGUS!!! + * + * bool is_sysex_special_id (midibyte ch) + * { + * return ch >= 0x7D && ch <= 0x7F; + * } + * */ - bool is_sysex_special_id (midibyte ch) - { - return ch >= 0x7D && ch <= 0x7F; - } - }; // class midifile /* diff --git a/libseq66/src/midi/event.cpp b/libseq66/src/midi/event.cpp index 64eb67bc..05918c25 100644 --- a/libseq66/src/midi/event.cpp +++ b/libseq66/src/midi/event.cpp @@ -907,7 +907,9 @@ event::append_meta_data (midibyte metatype, const midibytes & data) * event. * * \return - * Returns true if the event is not a SysEx-end event. + * Returns true if the event is not a SysEx-end event. The EOX ($F7) + * status byte can be replaced with any other status byte except for + * a Real-Time message, but this probably never is done. */ bool diff --git a/libseq66/src/midi/midifile.cpp b/libseq66/src/midi/midifile.cpp index 6b8e758e..421460c1 100644 --- a/libseq66/src/midi/midifile.cpp +++ b/libseq66/src/midi/midifile.cpp @@ -24,7 +24,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2015-07-24 - * \updates 2023-12-06 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * For a quick guide to the MIDI format, see, for example: @@ -729,6 +729,8 @@ midifile::grab_input_stream (const std::string & tag) * messages properly for a MIDI file. Instead of a varinum length value, * they are followed by extended IDs (0x7D, 0x7E, or 0x7F). * + * THE ABOVE IS WRONG! + * * We've covered some of those cases by disabling access to m_data if the * position passes the size of the file, but we want try to bypass these * odd cases properly. So we look ahead for one of these special values. @@ -1106,6 +1108,11 @@ midifile::parse_smf_1 (performer & p, int screenset, bool is_smf0) status = m_data[m_pos]; /* current event byte */ if (event::is_status(status)) /* is there a 0x80 bit? */ { + /* + * For SysEx, the skip is undone. For meta events, the + * correct event type is obtained anyway. + */ + skip(1); /* get to d0 */ if (event::is_system_common_msg(status)) runningstatus = 0; /* clear it */ @@ -1223,6 +1230,11 @@ midifile::parse_smf_1 (performer & p, int screenset, bool is_smf0) case EVENT_META_END_OF_TRACK: /* FF 2F 00 */ + /* + * This is an optional event according to the MIDI + * specification. + */ + s.set_length(currenttime, false); s.zero_markers(); done = true; @@ -1525,39 +1537,23 @@ midifile::parse_smf_1 (performer & p, int screenset, bool is_smf0) } else if (status == EVENT_MIDI_SYSEX) /* 0xF0 */ { - /* - * Some files do not properly encode SysEx messages; - * see the function banner for notes. - */ - - midibyte check = read_byte(); - if (is_sysex_special_id(check)) +#if defined SEQ66_USE_SYSEX_PROCESSING + midishort mfg_id; + midibyte id = read_byte(); + if (id == 0) + mfg_id = read_short(); + else + mfg_id = midishort(id); + + (void) mfg_id; /* later, store it? */ + back_up(2); /* back to F0 */ + for (;;) { - /* - * TMI: "SysEx ID byte = 7D to 7F"); - */ + midibyte b = read_byte(); + if (! e.append_sysex_byte(b)) /* F7 byte? */ + break; } - else /* handle normally */ - { - --m_pos; /* put byte back */ - len = read_varinum(); /* sysex */ -#if defined SEQ66_USE_SYSEX_PROCESSING - while (len-- > 0) - { - midibyte b = read_byte(); - if (! e.append_sysex_byte(b)) /* end byte? */ - break; - } - skip(len); /* eat it */ -#else - skip(len); /* eat it */ - if (m_data[m_pos-1] != 0xF7) - { - std::string m = "SysEx terminator F7 not found"; - (void) set_error_dump(m); - } #endif - } } else { @@ -1718,6 +1714,13 @@ midifile::parse_seqspec_header (int file_size) (void) read_varinum(); /* prop section length */ result = read_long(); /* control tag */ } + else if (type == EVENT_META_END_OF_TRACK) + { + msgprintf + ( + msglevel::warn, "End-of-track, offset ~0x%lx", long(m_pos) + ); + } else { msgprintf diff --git a/libsessions/include/nsm/nsmclient.hpp b/libsessions/include/nsm/nsmclient.hpp index c5d09dff..b4c304b9 100644 --- a/libsessions/include/nsm/nsmclient.hpp +++ b/libsessions/include/nsm/nsmclient.hpp @@ -10,7 +10,7 @@ * \library seq66 * \author Chris Ahlstrom and other authors; see documentation * \date 2020-03-01 - * \updates 2021-11-29 + * \updates 2021-12-07 * \version $Revision$ * \license GNU GPL v2 or above * @@ -140,7 +140,8 @@ class nsmclient : public nsmbase public: // Other virtual functions - virtual bool open_session (); // prospective helper a la qtractorMainForm + virtual bool open_session () override; // helper a la qtractorMainForm + virtual void session_manager_name (const std::string & mgrname); virtual void session_manager_path (const std::string & pathname); virtual void session_display_name (const std::string & dispname); diff --git a/seq_qt5/include/gui_palette_qt5.hpp b/seq_qt5/include/gui_palette_qt5.hpp index 056c1fe3..c69fb205 100644 --- a/seq_qt5/include/gui_palette_qt5.hpp +++ b/seq_qt5/include/gui_palette_qt5.hpp @@ -27,7 +27,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-02-23 - * \updates 2023-10-27 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * This module defines some QColor objects. We might consider replacing the @@ -159,8 +159,8 @@ class gui_palette_qt5 : public basesettings public: gui_palette_qt5 (const std::string & filename = ""); - gui_palette_qt5 (const gui_palette_qt5 &) = default; - gui_palette_qt5 & operator = (const gui_palette_qt5 &) = default; + gui_palette_qt5 (const gui_palette_qt5 &) = delete; + gui_palette_qt5 & operator = (const gui_palette_qt5 &) = delete; virtual ~gui_palette_qt5 (); static Color calculate_inverse (const Color & c); diff --git a/seq_qt5/include/qeditbase.hpp b/seq_qt5/include/qeditbase.hpp index d5e695e3..6fb39d8f 100644 --- a/seq_qt5/include/qeditbase.hpp +++ b/seq_qt5/include/qeditbase.hpp @@ -28,7 +28,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2019-08-05 - * \updates 2023-11-01 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * This class will be the base class for the qseqbase and qperfbase classes. @@ -616,7 +616,7 @@ class qeditbase : public qbase public: - virtual bool change_ppqn (int ppq); + virtual bool change_ppqn (int ppq) override; /** * Make the view cover less horizontal length. The lowest zoom possible diff --git a/seq_qt5/include/qloopbutton.hpp b/seq_qt5/include/qloopbutton.hpp index b170ece2..83b36e83 100644 --- a/seq_qt5/include/qloopbutton.hpp +++ b/seq_qt5/include/qloopbutton.hpp @@ -28,7 +28,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2019-06-28 - * \updates 2023-02-27 + * \updates 2023-12-07 * \license GNU GPLv2 or above * */ @@ -201,7 +201,6 @@ class qloopbutton final : public qslotbutton bool m_text_initialized; bool m_draw_text; - bool m_draw_background; textbox m_top_left; textbox m_top_right; textbox m_bottom_left; diff --git a/seq_qt5/include/qperfroll.hpp b/seq_qt5/include/qperfroll.hpp index a4113df2..285cdd2e 100644 --- a/seq_qt5/include/qperfroll.hpp +++ b/seq_qt5/include/qperfroll.hpp @@ -28,7 +28,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-11-01 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * This class represents the central piano-roll user-interface area of the @@ -135,7 +135,7 @@ public slots: private: - virtual void set_adding (bool adding); + virtual void set_adding (bool adding) override; qperfeditframe64 * frame64 () { diff --git a/seq_qt5/include/qseqroll.hpp b/seq_qt5/include/qseqroll.hpp index 5e3e7acd..cd71801e 100644 --- a/seq_qt5/include/qseqroll.hpp +++ b/seq_qt5/include/qseqroll.hpp @@ -28,7 +28,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-11-01 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * We are currently moving toward making this class a base class. @@ -155,13 +155,14 @@ class qseqroll final : public QWidget, public qseqbase private: + virtual void set_adding (bool a_adding) override; + #if defined USE_GROW_SELECTED_NOTES_FUNCTION void grow_selected_notes (int dx); #endif void move_selected_notes (int dx, int dy); void snap_y (int & y); - void set_adding (bool a_adding); void start_paste(); void draw_grid (QPainter & painter, const QRect & r); void draw_notes (QPainter & painter, const QRect & r, bool background); diff --git a/seq_qt5/include/qslivegrid.hpp b/seq_qt5/include/qslivegrid.hpp index 89ea9ad7..46cc4e23 100644 --- a/seq_qt5/include/qslivegrid.hpp +++ b/seq_qt5/include/qslivegrid.hpp @@ -28,7 +28,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2019-06-21 - * \updates 2023-08-29 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * @@ -164,6 +164,8 @@ class qslivegrid final : private: + virtual bool recreate_all_slots () override; + seq::number seq_id_from_xy (int click_x, int click_y); qslotbutton * create_one_button (seq::number seqno); qslotbutton * button (int row, int column); @@ -174,7 +176,6 @@ class qslivegrid final : bool delete_slot (int row, int column); bool delete_slot (seq::number seqno); bool delete_all_slots (); - bool recreate_all_slots (); bool refresh_all_slots (); bool modify_slot (qslotbutton * newslot, int row, int column); void button_toggle_enabled (seq::number seqno); diff --git a/seq_qt5/include/qstriggereditor.hpp b/seq_qt5/include/qstriggereditor.hpp index ace84a14..c906677b 100644 --- a/seq_qt5/include/qstriggereditor.hpp +++ b/seq_qt5/include/qstriggereditor.hpp @@ -28,7 +28,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-08-31 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * This class represents the central piano-roll user-interface area of the @@ -146,12 +146,13 @@ public slots: private: + virtual void set_adding (bool adding) override; + void x_to_w (int x1, int x2, int & x, int & w); void start_paste (); void convert_x (int x, midipulse & tick); void convert_t (midipulse ticks, int & x); void drop_event (midipulse tick); - void set_adding (bool adding); bool movement_key_press (int key); void move_selected_events (midipulse dt); diff --git a/seq_qt5/src/qloopbutton.cpp b/seq_qt5/src/qloopbutton.cpp index 91c53fa4..931f82a5 100644 --- a/seq_qt5/src/qloopbutton.cpp +++ b/seq_qt5/src/qloopbutton.cpp @@ -25,7 +25,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2019-06-28 - * \updates 2023-11-22 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * A paint event is a request to repaint all/part of a widget. It happens for @@ -185,7 +185,6 @@ qloopbutton::qloopbutton m_text_font (), m_text_initialized (false), m_draw_text (true), - m_draw_background (true), m_top_left (), m_top_right (), m_bottom_left (), diff --git a/seq_qt5/src/qperfroll.cpp b/seq_qt5/src/qperfroll.cpp index de804d1b..8a3b12cf 100644 --- a/seq_qt5/src/qperfroll.cpp +++ b/seq_qt5/src/qperfroll.cpp @@ -25,7 +25,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-11-01 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * This class represents the central piano-roll user-interface area of the @@ -71,12 +71,15 @@ static const int c_alpha_muted = 100; */ static const int c_ycorrection = 1; /* horizontal grid line fix */ -static const int c_border_width = 2; static const int c_pen_width = 2; -static const int c_background_x = (c_base_ppqn * 4 * 16) / c_perf_scale_x; static const int c_size_box_w = 8; static const int c_size_box_click_w = c_size_box_w + 1 ; +#if defined THIS_CODE_ADDS_VALUE +static const int c_background_x = (c_base_ppqn * 4 * 16) / c_perf_scale_x; +static const int c_border_width = 2; +#endif + /** * Font sizes for small, normal, and expanded vertical zoom */ diff --git a/seq_qt5/src/qseqbase.cpp b/seq_qt5/src/qseqbase.cpp index 300fb250..51239a0d 100644 --- a/seq_qt5/src/qseqbase.cpp +++ b/seq_qt5/src/qseqbase.cpp @@ -25,7 +25,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-10-19 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * We are currently moving toward making this class a base class. @@ -47,11 +47,11 @@ namespace seq66 /** * We need to square this away. This should be the configurable usr() - * key-height. + * key-height. But it is not used, and we already have made it configurable. + * + * static const int c_key_y = 8; */ -static const int c_key_y = 8; - /** * Primary constructor */ diff --git a/seq_qt5/src/qseqeditframe64.cpp b/seq_qt5/src/qseqeditframe64.cpp index 0d17dda3..7f0d9bd5 100644 --- a/seq_qt5/src/qseqeditframe64.cpp +++ b/seq_qt5/src/qseqeditframe64.cpp @@ -25,7 +25,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-06-15 - * \updates 2023-11-29 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * The data pane is the drawing-area below the seqedit's event area, and @@ -201,11 +201,11 @@ int qseqeditframe64::sm_initial_chord = 0; /** * To reduce the amount of written code, we use the following count to cover * beats/measure ranging from 1 to 16, plus an additional value of 32. The user - * can always manually edit odd beats/measure values. + * can always manually edit odd beats/measure values. Unused. + * + * static const int s_beat_measure_count = 16; */ -static const int s_beat_measure_count = 16; - /** * These static items are used to fill in and select the proper zoom values for * the grids. Note that they are not members, though they could be. diff --git a/seq_qt5/src/qseqkeys.cpp b/seq_qt5/src/qseqkeys.cpp index c6a9af5e..448a8d94 100644 --- a/seq_qt5/src/qseqkeys.cpp +++ b/seq_qt5/src/qseqkeys.cpp @@ -25,7 +25,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-10-27 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * We've added the feature of a right-click toggling between showing the main @@ -54,10 +54,13 @@ class performer; /** * The width and thickness of the keys drawn on the GUI. + * + * Unused: + * + * static const int sc_key_y = 8; */ static const int sc_key_x = 22; -static const int sc_key_y = 8; /** * The dimensions and offset of the virtual keyboard at the left of the piano diff --git a/seq_qt5/src/qseqroll.cpp b/seq_qt5/src/qseqroll.cpp index ba6c7522..a2c0b4ee 100644 --- a/seq_qt5/src/qseqroll.cpp +++ b/seq_qt5/src/qseqroll.cpp @@ -25,7 +25,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-11-25 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * Please see the additional notes for the Gtkmm-2.4 version of this panel, @@ -66,9 +66,12 @@ namespace seq66 /** * Default value for randomization. Currently the only value supported. + * + * Unused: + * + * static const int c_randomize_range = 4; // randomize range in ticks */ -static const int c_randomize_range = 4; /* randomize range in ticks */ static const int c_border_width = 2; static const int c_pen_width = 1; diff --git a/seq_qt5/src/qslivegrid.cpp b/seq_qt5/src/qslivegrid.cpp index 9b5a52b8..8e317464 100644 --- a/seq_qt5/src/qslivegrid.cpp +++ b/seq_qt5/src/qslivegrid.cpp @@ -24,7 +24,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2019-06-21 - * \updates 2023-11-27 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * This class is the Qt counterpart to the mainwid class. This version is @@ -2009,7 +2009,7 @@ qslivegrid::popup_menu () connect ( a, &QAction::triggered, - [this, buss, channel] { set_midi_channel(channel); } + [this, /*buss,*/ channel] { set_midi_channel(channel); } ); a->setCheckable(true); /* issue #106 */ a->setChecked(s->midi_channel() == channel); @@ -2021,7 +2021,7 @@ qslivegrid::popup_menu () connect ( a, &QAction::triggered, - [this, buss, channel] { set_midi_channel(channel); } + [this, /*buss,*/ channel] { set_midi_channel(channel); } ); a->setCheckable(true); /* issue #106 */ a->setChecked(s->midi_channel() == channel); diff --git a/seq_qt5/src/qsmainwnd.cpp b/seq_qt5/src/qsmainwnd.cpp index d49efbcc..61ea36e4 100644 --- a/seq_qt5/src/qsmainwnd.cpp +++ b/seq_qt5/src/qsmainwnd.cpp @@ -24,7 +24,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-12-02 + * \updates 2023-12-07 * \license GNU GPLv2 or above * * The main window is known as the "Patterns window" or "Patterns panel". It @@ -185,21 +185,26 @@ const std::string s_default_tune = "newtune.midi"; * Manifest constant to indicate the location of each main-window tab. */ -static const int Tab_Live = 0; -static const int Tab_Song = 1; -static const int Tab_Editor = 2; -static const int Tab_Events = 3; -static const int Tab_Playlist = 4; -static const int Tab_Set_Master = 5; -static const int Tab_Mute_Master = 6; -static const int Tab_Session = 7; +enum tabs_t +{ + Tab_Live = 0, + Tab_Song = 1, + Tab_Editor = 2, + Tab_Events = 3, + Tab_Playlist = 4, + Tab_Set_Master = 5, + Tab_Mute_Master = 6, + Tab_Session = 7 +}; /** * Manifest constants for the beat-measure and beat-length combo-boxes. + * + * Unused: + * + * static const int s_beat_measure_count = 16; */ -static const int s_beat_measure_count = 16; - /** * Given a display coordinate, looks up the screen and returns its geometry. * If no screen was found, return the primary screen's geometry