Skip to content

Commit

Permalink
In regard to issue #115, got a grab handle implemented in the data pa…
Browse files Browse the repository at this point in the history
…ne, needs more testing.
  • Loading branch information
ahlstromcj committed Sep 6, 2023
1 parent c9c62d8 commit d21de7a
Show file tree
Hide file tree
Showing 11 changed files with 260 additions and 100 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# README for Seq66 0.99.9 2023-09-04
# README for Seq66 0.99.9 2023-09-06

__Seq66__: MIDI sequencer/live-looper with a hardware-sampler grid interface;
pattern banks, triggers, and playlists for song management; scale and chord
Expand Down Expand Up @@ -84,6 +84,8 @@ Windows, and using a conventional source tarball.
* Version 0.99.9:
* Fixed bug: port-mapping Remap and Restart did not work due to
timing.
* Related to issue #115: Added ability to select a line in the data
pane and grab a handle to change its value.
* Adding more seqroll keystokes (and HTML help). Enabled Esc to
exit paint mode if not playing.
* Added live-note mapping (needs testing!), refactoring set-record
Expand Down
6 changes: 4 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
TO DO for Seq66 0.99.9
Chris Ahlstrom
2019-04-13 to 2023-09-05
2019-04-13 to 2023-09-06

Misc:

- Open t.midi, start playing, stop, then add more notes. They are
way longer than the snap value!
way longer than the snap value! Cannot duplicate on Debian
box!
- Make sure pitch bend is handled correctly in qseqdata.
- When enabling a MIDI Control/Display port, also enable it
automatically. See issue #116.
- Fix and test new record/quantize handling, and verify that
Expand Down
4 changes: 2 additions & 2 deletions libseq66/include/midi/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2015-07-24
* \updates 2023-09-05
* \updates 2023-09-06
* \license GNU GPLv2 or above
*
* This module also declares/defines the various constants, status-byte
Expand All @@ -52,7 +52,7 @@

#include "midi/midibytes.hpp" /* seq66::midibyte alias, etc. */

#undef SEQ66_STAZED_SELECT_EVENT_HANDLE /* nowhere near ready! */
#define SEQ66_STAZED_SELECT_EVENT_HANDLE /* EXPERIMENTAL */

/**
* Defines the number of data bytes in MIDI status data.
Expand Down
13 changes: 6 additions & 7 deletions libseq66/include/play/sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2015-07-30
* \updates 2023-09-05
* \updates 2023-09-06
* \license GNU GPLv2 or above
*
* The functions add_list_var() and add_long_list() have been replaced by
Expand Down Expand Up @@ -1702,18 +1702,20 @@ class sequence
int select_events
(
midipulse tick_s, midipulse tick_f,
midibyte status, midibyte cc, eventlist::select action
midibyte astatus, midibyte cc, eventlist::select action
);
int select_events
(
midibyte status, midibyte cc, bool inverse = false
midibyte astatus, midibyte cc, bool inverse = false
);
#if defined SEQ66_STAZED_SELECT_EVENT_HANDLE
int select_event_handle
(
midipulse tick_s, midipulse tick_f,
midibyte status, midibyte cc, eventlist::select action
midibyte astatus, midibyte cc,
midibyte data
);
void adjust_event_handle (midibyte astatus, midibyte data);
#endif

/**
Expand Down Expand Up @@ -1791,9 +1793,6 @@ class sequence
void link_new ();
bool edge_fix ();
bool remove_unlinked_notes ();
#if defined USE_ADJUST_DATA_HANDLE
void adjust_data_handle (midibyte status, int data);
#endif

/**
* Resets everything to zero. This function is used when the sequencer
Expand Down
8 changes: 4 additions & 4 deletions libseq66/src/cfg/scales.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2019-10-04
* \updates 2023-05-04
* \updates 2023-09-06
* \license GNU GPLv2 or above
*
* Here is a list of many scale interval patterns if working with
Expand Down Expand Up @@ -562,7 +562,7 @@ interval_name_ptr (int interval)
"P1", "m2", "M2", "m3", "M3", "P4", "TT", "P5",
"m6", "M6", "m7", "M7", "P8", "m9", "M9", "0" /* "0" if error */
};
int index = abs(interval);
int index = std::abs(interval);
if (index > c_interval_size)
index = c_interval_size;

Expand All @@ -586,7 +586,7 @@ interval_name_ptr (int interval)
bool
harmonic_number_valid (int number)
{
return abs(number) < c_harmonic_size;
return std::abs(number) < c_harmonic_size;
}

/**
Expand All @@ -600,7 +600,7 @@ harmonic_interval_name_ptr (int interval)
{
"I", "ii", "iii", "IV", "V", "vi", "vii", "I", "0"
};
int index = abs(interval);
int index = std::abs(interval);
if (index > c_harmonic_size)
index = c_harmonic_size;

Expand Down
4 changes: 2 additions & 2 deletions libseq66/src/midi/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2015-07-24
* \updates 2023-08-25
* \updates 2023-09-06
* \license GNU GPLv2 or above
*
* A MIDI event (i.e. "track event") is encapsulated by the seq66::event
Expand Down Expand Up @@ -475,7 +475,7 @@ event::is_desired (midibyte status, midibyte cc, midibyte data) const
{
result = m_data[0] == cc;
if (result)
result = is_data_in_handle_range(); /* check d0/d1() */
result = is_data_in_handle_range(data); /* check d0/d1() */
}
}
return result;
Expand Down
13 changes: 10 additions & 3 deletions libseq66/src/midi/eventlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2015-09-19
* \updates 2023-09-05
* \updates 2023-09-06
* \license GNU GPLv2 or above
*
* This container now can indicate if certain Meta events (time-signaure or
Expand Down Expand Up @@ -1944,6 +1944,13 @@ eventlist::select_events

#if defined SEQ66_STAZED_SELECT_EVENT_HANDLE

/**
* Selects the seqdata event handle if in range.
*
* One issue in adjusting data is Pitch events, which have two
* components [d0() and d1()] which must be combined.
*/

int
eventlist::select_event_handle
(
Expand All @@ -1956,7 +1963,7 @@ eventlist::select_event_handle
bool have_selected_note_ons = false;
if (event::is_note_on_msg(astatus))
{
if (count_selected_event(astatus, cc) > 0)
if (count_selected_events(astatus, cc) > 0)
have_selected_note_ons = true;
}
for (auto & er : m_events)
Expand All @@ -1973,7 +1980,7 @@ eventlist::select_event_handle
}
if (! isctrl) /* chan. pressure? */
{
bool twobytes = is_two_byte_msg(astatus);
bool twobytes = event::is_two_byte_msg(astatus);
if (twobytes)
{
if (er.is_data_in_handle_range(data)) /* checks d1() */
Expand Down
33 changes: 19 additions & 14 deletions libseq66/src/play/sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2015-07-24
* \updates 2023-09-05
* \updates 2023-09-06
* \license GNU GPLv2 or above
*
* The functionality of this class also includes handling some of the
Expand Down Expand Up @@ -2264,13 +2264,13 @@ int
sequence::select_event_handle
(
midipulse tick_s, midipulse tick_f,
midibyte status, midibyte cc, eventlist::select action
midibyte astatus, midibyte cc, midibyte data
)
{
automutex locker(m_mutex);
int result = m_events.select_event_handle
(
tick_s, tick_f, status, cc, action
tick_s, tick_f, astatus, cc, data
);
set_dirty();
return result;
Expand Down Expand Up @@ -2529,37 +2529,42 @@ sequence::jitter_notes (int jitr)
return result;
}

#if defined USE_ADJUST_DATA_HANDLE
#if defined SEQ66_STAZED_SELECT_EVENT_HANDLE

/*
* Unused. Has issue(s) to correct before enabling. Such as "what was this
* function meant to do?"
/**
* Used for moving the data value of an event in the seqdata pane up or
* down.
*
* One issue in adjusting data is Pitch events, which have two
* components [d0() and d1()] which must be combined. But d0() is the
* least-significant byte, and d1() is the most-significant byte.
* Since pitch is a 2-byte message, d1() will be adjusted.
*/

void
sequence::adjust_data_handle (midibyte status, int adata)
sequence::adjust_event_handle (midibyte astatus, midibyte adata)
{
midibyte data[2];
midibyte datitem;
int dataindex = event::is_two_byte_msg(status) ? 1 : 0 ;
int dataindex = event::is_two_byte_msg(astatus) ? 1 : 0 ;
automutex locker(m_mutex);
for (auto & e : m_events)
{
if (e.is_selected_status(status))
if (e.is_selected_status(astatus))
{
status = event::mask_status(status);
e.get_data(data[0], data[1]); /* \tricky code */
astatus = event::mask_status(astatus);
e.get_data(data[0], data[1]); /* \tricky code */
datitem = adata;
if (datitem > (c_midibyte_data_max - 1))
datitem = (c_midibyte_data_max - 1);

data[datidx] = datitem;
data[dataindex] = datitem;
e.set_data(data[0], data[1]);
}
}
}

#endif // defined USE_ADJUST_DATA_HANDLE
#endif

/**
* Increments events the match the given status and control values.
Expand Down
28 changes: 27 additions & 1 deletion seq_qt5/include/qseqdata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2018-01-01
* \updates 2023-09-05
* \updates 2023-09-06
* \license GNU GPLv2 or above
*
* The data pane is the drawing-area below the seqedit's event area, and
* contains vertical lines whose height matches the value of each data event.
* The height of the vertical lines is editable via the mouse.
*
* Another EXPERIMENT. Drawing a circular "grab handle" when an event is
* crossed by the mouse or is selected. This is progress on the way to
* improving issue #115.
*/

#include <QWidget>
Expand Down Expand Up @@ -124,6 +128,14 @@ class qseqdata final :
return m_cc;
}

private:

void flag_dirty (); /* tricky code */

#if defined SEQ66_ALLOW_RELATIVE_VELOCITY_CHANGE
void set_adjustment (midipulse tick_start, midipulse tick_finish);
#endif

private: // performer::callback overrides

virtual bool on_ui_change (seq::number seqno) override;
Expand Down Expand Up @@ -218,6 +230,20 @@ private slots:

#endif

/**
* Keeps track of the X-location of the mouse, in ticks.
*/

midipulse m_mouse_tick;

/**
* The precision of event-line detection in ticks. This depends
* upon the PPQN, obviously. This value starts at 2 pixels and is
* corrected to ticks by the pix_to_tix() function.
*/

midipulse m_handle_delta;

/**
* This value is true if the mouse is being dragged in the data pane,
* which is done in order to change the height and value of each data
Expand Down
Loading

0 comments on commit d21de7a

Please sign in to comment.