Skip to content

Commit

Permalink
Still whacking at issue #100, calculations look correct but still gli…
Browse files Browse the repository at this point in the history
…tches at 4096 frames per cycle.
  • Loading branch information
ahlstromcj committed Sep 27, 2022
1 parent 290e1c8 commit ba14d3b
Show file tree
Hide file tree
Showing 22 changed files with 682 additions and 404 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# README for Seq66 0.99.1

Chris Ahlstrom
2015-09-10 to 2022-09-14
2015-09-10 to 2022-09-27

__Seq66__ is a MIDI sequencer and live-looper with a hardware-sampler-like
grid-pattern interface, sets and playlists for song management, a scale and
Expand Down Expand Up @@ -95,12 +95,16 @@ Windows, and using a conventional source tarball.

* Version 0.99.1:
* Issue #93. Revisited to fix related open pattern-editor issues.
* Issue #100. In progress; works but still can overflow buffer under
heavy playback.
* Issue #100. In progress. Added custom ringbuffer for MIDI message
objects to replace JACK's ringbuffer. Issue still somewhat
intractable :-(
* Various fixes:
* Fixed partial breakage of pattern-merge function.
* Fixed odd breakage of ALSA playback in release mode.
* Fixed Stop button when another Master has started playback.
* Shift-click on Stop button rewinds JACK transport when running
as JACK Slave.
* Display of some JACK server settings in Edit / Preferences.
* Version 0.99.0:
* Issue #44. Record live sequence changes functionality beefed up
to handle recording without snapping.
Expand Down
4 changes: 3 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TO DO for Seq66 0.99.1 (Sequencer64 refactored for C++14 and Qt)
Chris Ahlstrom
2019-04-13 to 2022-09-12
2019-04-13 to 2022-09-27

Ongoing efforts:

Expand Down Expand Up @@ -500,6 +500,8 @@ Version 2 features:
- Make main menu hide-able.
- Allow multiple instances of seq66.
- More consistent support for undo / redo / unmodify.
- Add console output for every user action.
- Add scripting language?
- Clean up kruft in setmapper/screenset.
- Support more than one tune?
- A way to lay out a pattern from one track into another tracks
Expand Down
102 changes: 102 additions & 0 deletions contrib/scripts/jackctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/bash
#
#******************************************************************************
# jackctl
#------------------------------------------------------------------------------
##
# \file jackctl
# \library Any project
# \author Chris Ahlstrom
# \date 2022-09-25
# \update 2022-09-26
# \version $Revision$
# \license $XPC_SUITE_GPL_LICENSE$
#
# The above is modified by the following to remove even the mild GPL
# restrictions:
#
# Use this script in any manner whatsoever. You don't even need to give
# me any credit. However, keep in mind the value of the GPL in keeping
# software and its descendant modifications available to the community
# for all time.
#
# See "jack_control --help" for a list of options.
#
# ALSA parameters partial list:
#
# device: ALSA device name (type:isset:default:value).
# capture: Optionally set port (str:notset:none:none).
# playback: Optionally set port (str:notset:none:none).
# rate: Set the sample rate (48000).
# period: Frames per period (the "cycle", time between process
# callback calls (1024).
# nperiod: Number of periods (cycles) of latency (2).
# midi-driver: ALSA MIDI driver.
#
# /proc/asound/cards (on our system):
#
# 0: CODEC USB audio box.
# 1: nanoKEY2 Korg keyboard.
# 2: HDMI Onboard HDMI.
# 3: PCH Intel on-board sound.
# 4: NVidia Onboard NVidia card.
# 5: Midi A generic USB MIDI cable.
# 6: Mini LaunchPad Mini.
#
#------------------------------------------------------------------------------

JCTL_OPERATION="start"
JCTL_DRIVER="alsa"
JCTL_DEVICE="hw:CODEC" # see "cat /proc/asound/cards"
JCTL_RATE="48000"
JCTL_LATENCY="2"
JCTL_PERIOD="2048" # for TESTING

if [ "$1" == "--list" ] ; then
echo "Available drivers:"
jack_control dl
echo "Selecting ALSA (seq). Available parameters:"
jack_control ds $JCTL_DRIVER
jack_control dp
elif [ "$1" == "--help" ] ; then
cat << E_O_F
Usage:
jackctl Start with the usual parameters (TBD).
jackctl --list List the drivers and the ALSA parameters.
jackctl --start Start the JACK server, that's it.
jackctl --stop Stop the JACK server.
jackctl --kill Stop the JACK server and exit jackdbus.
jackctl --period F Change the period of the JACK server.
jackctl --nperiod P Change ALSA period (playback latency, 2 or 3).
jackctl --help Show this message.
Getting tired of qjackctl and jackdbus wrestling with each other on
a newer Ubuntu system that runs jackdbus.
E_O_F
elif [ "$1" == "--start" ] ; then
jack_control start
elif [ "$1" == "--stop" ] ; then
jack_control stop
elif [ "$1" == "--kill" ] ; then
jack_control stop
jack_control exit
elif [ "$1" == "--period" ] ; then
JCTL_PERIOD="$2"
jack_control dps period $JCTL_PERIOD
elif [ "$1" == "--nperiod" ] ; then
JCTL_LATENCY="$2"
jack_control dps nperiod $JCTL_LATENCY
else
jack_control start
jack_control ds $JCTL_DRIVER
jack_control dps device $JCTL_DEVICE
jack_control dps rate $JCTL_RATE
jack_control dps nperiods $JCTL_LATENCY
jack_control dps period $JCTL_PERIOD
fi

#******************************************************************************
# jackctl
#------------------------------------------------------------------------------
# vim: ts=3 sw=3 et ft=sh
#------------------------------------------------------------------------------
30 changes: 27 additions & 3 deletions contrib/scripts/recordpa
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
#******************************************************************************
# recordpa
Expand All @@ -8,7 +8,7 @@
# \library Any project
# \author Chris Ahlstrom
# \date 2022-09-14
# \update 2022-09-14
# \update 2022-09-24
# \version $Revision$
# \license $XPC_SUITE_GPL_LICENSE$
#
Expand All @@ -23,9 +23,33 @@
# Simply records the output of our USB audio device as received through
# PulseAudio.
#
# parecord is equivalent to "pacat -r --file-format". Refer to the pacat(1)
# man page for pacat's flags. To get the sources for audio record.
#
# $ pactl list sources short
#
# The following two lines produce the same result.
#
# $ parecord -d alsa_input.pci-0000_00_1f.3.analog-stereo speech.flac
# $ parecord -d 1 speech.flac
#
#------------------------------------------------------------------------------

parecord --channels=1 --record --device=alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo.monitor $1
if [ "$1" == "--list" ] ; then
pactl list sources short
elif [ "$1" == "--help" ] ; then
cat << E_O_F
Usage:
recordpa --help
recordpa --list
recordpa x.wav
record <device ID or name> x.wav
E_O_F
elif [ "$2" == "" ] ; then
parecord --channels=1 --record --device=alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo.monitor $1
else
parecord --channels=1 --record --device=$1 $2
fi

#******************************************************************************
# recordpa
Expand Down
23 changes: 16 additions & 7 deletions contrib/scripts/ystart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#
# Date 2020-11-25
# Updated 2021-03-14 (Pi day!)
# Updated 2022-09-26 (Pi day! No more.)
#
# YOSHPATH="/usr/bin"
#
Expand All @@ -13,20 +13,29 @@ YOSHIMI="yoshimi"
OPTIONS=""
REPOPATH="Home/ca/mls/git"
CFGPATH="$HOME/$REPOPATH/yoshimi-cookbook/sequencer64/b4uacuse"
STATEFILE="yoshimi-b4uacuse-gm.state"
DOHELP="no"

if [ "$1" == "latest" ] ; then
YOSHPATH="/usr/local/bin"
YOSHIMI="yoshimi"
YOSHIMI="yoshimi-1.7.2rc1"
shift
fi

if [ "$1" == "jack" ] ; then
OPTIONS="--jack-midi --jack-audio"
OPTIONS="-j -J"
elif [ "$1" == "alsa" ] ; then
OPTIONS="--alsa-midi --alsa-audio"
OPTIONS="-a -A"
elif [ "$1" == "A" ] ; then
OPTIONS="--alsa-midi --alsa-audio=CODEC"
elif [ "$1" == "jA" ] ; then
OPTIONS="-j -A"
elif [ "$1" == "help" ] ; then
echo "Options: jack alsa A jA"
DOHELP="yes"
fi

echo "Running $YOSHPATH/$YOSHIMI $OPTIONS --state=$CFGPATH/$STATEFILE"
$YOSHPATH/$YOSHIMI $OPTIONS --state=$CFGPATH/$STATEFILE
if [ "$DOHELP" == "no" ] ; then
echo "Running $YOSHPATH/$YOSHIMI $OPTIONS --state=$CFGPATH/yoshimi-b4uacuse-gm.state"
$YOSHPATH/$YOSHIMI $OPTIONS --state=$CFGPATH/yoshimi-b4uacuse-gm.state
fi

33 changes: 31 additions & 2 deletions libseq66/include/midi/jack_assistant.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-23
* \updates 2022-09-17
* \updates 2022-09-26
* \license GNU GPLv2 or above
*
* This class contains a number of functions that used to reside in the
Expand Down Expand Up @@ -190,6 +190,20 @@ class jack_assistant
friend void jack_session_callback (jack_session_event_t * ev, void * arg);
#endif

public:

/**
* p_position_structure holds frame_rate, ticks_per_beat, and
* beats/minute.
*/

using parameters = struct
{
jack_position_t position;
int period_size; /* frames per cycle */
int alsa_nperiod; /* usually 2 or 3 */
};

private:

/**
Expand All @@ -199,6 +213,14 @@ class jack_assistant

static jack_status_pair_t sm_status_pairs [];

/**
* For issue #100, storage for the true JACK transport position, etc.
* Store the current JACK parameters, currently for display only.
* Tired of being fooled about the actual parameters.
*/

static parameters sm_jack_parameters;

/**
* Provides the performer object that needs this JACK assistant/scratchpad
* class.
Expand Down Expand Up @@ -352,6 +374,13 @@ class jack_assistant
~jack_assistant ();

static void show_position (const jack_position_t & pos);
static bool save_jack_parameters
(
const jack_position_t & p,
int periodsize = 0,
int alsanperiod = 0
);
static const parameters & get_jack_parameters ();

performer & parent () /* getter needed for external callbacks. */
{
Expand Down Expand Up @@ -456,7 +485,7 @@ class jack_assistant

bool activate ();
void start ();
void stop ();
void stop (bool rewind = false);
void position (bool state, midipulse tick = 0);
bool output (jack_scratchpad & pad);

Expand Down
18 changes: 3 additions & 15 deletions libseq66/include/midi/midibytes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2018-11-09
* \updates 2022-09-16
* \updates 2022-09-22
* \license GNU GPLv2 or above
*
* These alias specifications are intended to remove the ambiguity we have
Expand Down Expand Up @@ -132,16 +132,9 @@ using jacktick = long;
* However, if you make this value unsigned, then perfroll won't show any
* notes in the sequence bars!!! Also, a number of manipulations of this
* type currently depend upon it being a signed value.
*
* By default we use only 4 bytes to encode the timestamp (e.g. for the
* JACK ringbuffer). See this macro in seq66_features.h.
*/

#if defined SEQ66_8_BYTE_TIMESTAMPS
using midipulse = int64_t;
#else
using midipulse = int32_t;
#endif
using midipulse = long;

/**
* JACK encodes jack_time_t as a uint64_t (8-byte) value. We will use our own
Expand Down Expand Up @@ -187,12 +180,7 @@ using midibooleans = std::vector<midibool>;
*/

const midipulse c_null_midipulse = -1; /* ULONG_MAX later? */

#if defined SEQ66_8_BYTE_TIMESTAMPS
const midipulse c_midipulse_max = INT64_MAX; /* for sanity checks */
#else
const midipulse c_midipulse_max = INT32_MAX; /* for sanity checks */
#endif
const midipulse c_midipulse_max = LONG_MAX; /* for sanity checks */

/**
* Defines the maximum number of MIDI values, and one more than the
Expand Down
Loading

0 comments on commit ba14d3b

Please sign in to comment.