Skip to content

Commit

Permalink
Fixed issue #119 and some minor issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahlstromcj committed Oct 6, 2023
1 parent 7c86081 commit 6e66db5
Show file tree
Hide file tree
Showing 11 changed files with 247 additions and 71 deletions.
36 changes: 25 additions & 11 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
TO DO for Seq66 0.99.10
Chris Ahlstrom
2019-04-13 to 2023-10-05
2019-04-13 to 2023-10-06

Misc:

- Issue #117
- Issue #118
- Document and test mute groups. Issues:
To do:
- Disable auto-save of the mutes file at exit in this
case, unless the name provided is identical.
- If "To Mutes" is set, "To MIDI" is not, and a change is made,
there is no MIDI modified flag, but closing prompts to save.
We need to forward the boolean changes immediately, e.g.
to cb_per().mutes().group_save_to_midi(); perhaps add
a flag set to performer::set_mutes()???
- performer: cliear_mute_groups(), reset_mute_groups(), and
mutegroup_reset() all basically do the same things, except
that clear_mutes() also notifies subscribers. Probably
can get rid of "Fill" and its pix and documentation.
that clear_mutes() also notifies subscribers.
- For scrolling to notes, use average note instead of first note.
Also should add about half the height of the piano roll, otherwise
the middle (average) appears at the top.
- There are issues with Song / Zoom / Follow progress with the
ulra-zoom-in in force. Pattern editor works.
- In the Kraftwerk song, the Chorus seems to have the wrong pitch,
Expand Down Expand Up @@ -336,6 +331,25 @@ ISSUES:

STATUS: Cannot duplicate.

#117 Option to close pattern windows with esc key?

STATUS: Thinking... This can be done if (1) not playing; and
(2) not in Paint mode.

#118 When enabling virtual ports, make those new ports enabled by default?
Currently one has to tick the box to enable and enter the number of output
and input ports, restart seq66, and then tick all the input port
checkboxes in the list then restart seq66 again.

STATUS: At least make it an rc option.

#119 Quantized Record Active does not work
Having this button active has no effect; tried changing snap size to
different settings... Post processing quantize works as expected (i,e,
Ctrl-A then q)

STATUS: Fixed in the portfix branch. An embarrasing misstep!

To close as fixed (and remove from TODO):

24 Release notes in release tag message?
Expand Down
4 changes: 2 additions & 2 deletions libseq66/include/midi/eventlist.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-09-19
* \updates 2023-09-27
* \updates 2023-10-06
* \license GNU GPLv2 or above
*
* This module extracts the event-list functionality from the sequencer
Expand Down Expand Up @@ -376,7 +376,7 @@ class eventlist
void link_new (bool wrap = false);
void clear_links ();
int note_count () const;
bool first_note (midipulse & ts, int & n) const;
bool first_notes (midipulse & ts, int & n, midipulse snap = 0) const;
#if defined SEQ66_USE_FILL_TIME_SIG_AND_TEMPO
void scan_meta_events ();
#endif
Expand Down
4 changes: 2 additions & 2 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-27
* \updates 2023-10-06
* \license GNU GPLv2 or above
*
* The functions add_list_var() and add_long_list() have been replaced by
Expand Down Expand Up @@ -1122,7 +1122,7 @@ class sequence

int event_count () const;
int note_count () const;
bool first_note (midipulse & ts, int & n) const;
bool first_notes (midipulse & ts, int & n) const;
int playable_count () const;
bool is_playable () const;
bool minmax_notes (int & lowest, int & highest);
Expand Down
55 changes: 47 additions & 8 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-27
* \updates 2023-10-06
* \license GNU GPLv2 or above
*
* This container now can indicate if certain Meta events (time-signaure or
Expand Down Expand Up @@ -526,18 +526,57 @@ eventlist::note_count () const
return result;
}

/**
* Look at note events within the snap interval. Return the first time-stamp
* and the first (or average within the snap interval) note value. This
* function is used for centering the seqroll on visible notes.
*/

bool
eventlist::first_note (midipulse & ts, int & n) const
eventlist::first_notes (midipulse & ts, int & n, midipulse snap) const
{
bool result = false;
for (const auto & e : m_events)
bool doaverage = snap > 0;
if (doaverage)
{
if (e.is_note_on())
midipulse ts_first = (-1);
int note_avg = 0;
int note_count = 0;
for (const auto & e : m_events)
{
ts = e.timestamp();
n = int(e.get_note());
result = true;
break;
if (e.is_note_on())
{
result = true;

midipulse ts_temp = e.timestamp();
if (ts_first == (-1))
ts_first = ts_temp;

int note = int(e.get_note());
++note_count;
if (ts_temp < (ts_first + snap))
note_avg += note;
else
break;
}
}
if (result)
{
ts = ts_first;
n = note_avg / note_count;
}
}
else
{
for (const auto & e : m_events)
{
if (e.is_note_on())
{
ts = e.timestamp();
n = int(e.get_note());
result = true;
break;
}
}
}
return result;
Expand Down
10 changes: 5 additions & 5 deletions libseq66/src/play/performer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,9 +1368,9 @@ performer::true_output_bus (bussbyte nominalbuss) const
msg += "\"";
}
msg +=
". Check assigned ports in the song, 'rc', 'ctrl' files, "
"and the MIDI and Metronome tabs. Also check the Session "
"tab's file-names."
". Check assigned ports in files: song, rc, ctrl, "
"usr buss-override, MIDI & Metronome tabs, and "
"Session tab file-names."
;
m_port_map_error = true; /* mutable boolean */
append_error_message(msg);
Expand Down Expand Up @@ -5260,7 +5260,7 @@ performer::auto_play_start ()
bool
performer::auto_play_stop (midipulse tick)
{
bool result = m_max_extent > 0 && tick >= m_max_extent;
bool result = m_max_extent > 0 && tick >= m_max_extent && song_mode();
if (result)
{
if (playlist_active())
Expand Down Expand Up @@ -5302,14 +5302,14 @@ performer::play (midipulse tick)
{
if (tick != get_tick() || tick == 0) /* avoid replays */
{
bool songmode = song_mode();
if (auto_play_stop(tick))
{
(void) open_next_song();
auto_play_start();
}
else
{
bool songmode = song_mode();
set_tick(tick);
for (auto seqi : play_set().seq_container())
{
Expand Down
50 changes: 40 additions & 10 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-27
* \updates 2023-10-06
* \license GNU GPLv2 or above
*
* The functionality of this class also includes handling some of the
Expand Down Expand Up @@ -546,11 +546,15 @@ sequence::note_count () const
return m_events.note_count();
}

/**
* Gets the average of the notes within a snap value of the first note.
*/

bool
sequence::first_note (midipulse & ts, int & n) const
sequence::first_notes (midipulse & ts, int & n) const
{
automutex locker(m_mutex);
return m_events.first_note(ts, n);
return m_events.first_notes(ts, n, m_snap_tick);
}

int
Expand Down Expand Up @@ -4050,9 +4054,6 @@ bool
sequence::stream_event (event & ev)
{
automutex locker(m_mutex);

/// printf("tick %ld, channel %d\n", ev.timestamp(), ev.channel());

bool result = channels_match(ev); /* set if channel matches */
if (result)
{
Expand Down Expand Up @@ -4093,6 +4094,31 @@ sequence::stream_event (event & ev)
if (ev.is_note_on() && m_rec_vol > usr().preserve_velocity())
ev.note_velocity(m_rec_vol); /* modify incoming */

/*
* See USE_OLD_CODE below. We need to do this here, not there.
*/

if (alter_recording() && ev.is_note())
{
/*
* We want to quantize or tighten note-related events that
* comes in, This could potentially alter the note length
* by a couple of snaps. So what? Play better!
*/

if (quantizing())
{
(void) ev.quantize(snap(), get_length());
}
else if (tightening())
{
(void) ev.tighten(snap(), get_length());
}
else if (notemapping())
{
perf()->repitch(ev);
}
}
add_event(ev); /* locks and sorts */
}
else
Expand Down Expand Up @@ -4172,10 +4198,7 @@ sequence::stream_event (event & ev)
if (ev.is_note_off())
link_new();

/*
* if (quantizing_or_tightening() && perf()->is_pattern_playing())
*/

#if defined USE_OLD_CODE
if (alter_recording())
{
/*
Expand All @@ -4185,12 +4208,19 @@ sequence::stream_event (event & ev)
*/

if (quantizing())
{
(void) ev.quantize(snap(), get_length());
}
else if (tightening())
{
(void) ev.tighten(snap(), get_length());
}
else if (notemapping())
{
perf()->repitch(ev);
}
}
#endif
}
return result;
}
Expand Down
8 changes: 4 additions & 4 deletions resources/pixmaps/hide.xpm
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ static const char * hide_xpm[] = {
" ",
" ",
" ",
" ............ ",
" . . ",
" . . ",
" ............ ",
" ",
" ",
" ",
" ",
" ",
" ............ ",
" . . ",
" . . ",
" ............ ",
" "};
Loading

0 comments on commit 6e66db5

Please sign in to comment.