diff --git a/.gitignore b/.gitignore index 7bc2b35..7b7d7d9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,26 @@ TAGS .nfs* make.conf .deps -misc/ +.config +.files +FL/About_Dialog.C +FL/About_Dialog.H +FL/Fl_Text_Edit_Window.C +FL/Fl_Text_Edit_Window.H +FL/New_Project_Dialog.C +FL/New_Project_Dialog.H +mixer/src/mixer +sequencer/src/gui/event_edit.C +sequencer/src/gui/event_edit.H +sequencer/src/gui/ui.C +sequencer/src/gui/ui.H +sequencer/src/gui/widgets.C +sequencer/src/gui/widgets.H +sequencer/src/sequencer +session-manager/src/jackpatch +session-manager/src/nsmd +session-manager/src/send_osc +session-manager/src/session-manager +timeline/src/TLE.C +timeline/src/TLE.H +timeline/src/timeline diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..80e9a37 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/ntk"] + path = lib/ntk + url = git://git.tuxfamily.org/gitroot/non/fltk.git diff --git a/FL/About_Dialog.fl b/FL/About_Dialog.fl index f27c8a6..994e3e2 100644 --- a/FL/About_Dialog.fl +++ b/FL/About_Dialog.fl @@ -13,15 +13,7 @@ decl {\#include } {private local Function {open_url( const char *url )} {open return_type void } { - code {\#if ! ( FL_MAJOR_VERSION >= 1 && FL_MINOR_VERSION >= 1 && FL_PATCH_VERSION >= 8 ) - - // FIXME: got a better idea? - char cmd[256]; - snprintf( cmd, sizeof( cmd ), "x-www-browser '%s' &", url ); - system( cmd ); -\#else - fl_open_uri( url ); -\#endif} {} + code {fl_open_uri( url );} {} } class About_Dialog {open diff --git a/FL/Crystal_Boxtypes.C b/FL/Crystal_Boxtypes.C deleted file mode 100644 index 7ca4788..0000000 --- a/FL/Crystal_Boxtypes.C +++ /dev/null @@ -1,385 +0,0 @@ - -/*******************************************************************************/ -/* Copyright (C) 2008 Jonathan Moore Liles */ -/* */ -/* This program is free software; you can redistribute it and/or modify it */ -/* under the terms of the GNU General Public License as published by the */ -/* Free Software Foundation; either version 2 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ -/* more details. */ -/* */ -/* You should have received a copy of the GNU General Public License along */ -/* with This program; see the file COPYING. If not,write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*******************************************************************************/ - - -#pragma GCC diagnostic ignored "-Wchar-subscripts" - - -#include "Crystal_Boxtypes.H" -#include -#include - -/* Crystal boxes, base (obviously) on the FLTK1 'plastic' boxes, but - * without the rude color blending and with a slightly enhanced - * appearance. */ - -extern uchar *fl_gray_ramp(); - -inline Fl_Color -shade_color ( uchar gc, Fl_Color bc ) -{ - return fl_color_average( ( Fl_Color ) gc, bc, 0.25f ); -} - - -static void -frame_rect ( int x, int y, int w, int h, const char *c, Fl_Color bc ) -{ - uchar *g = fl_gray_ramp(); - int b = strlen( c ) / 4 + 1; - - for ( x += b, y += b, w -= 2 * b, h -= 2 * b; b > 1; b-- ) - { - // Draw lines around the perimeter of the button, 4 colors per - // circuit. - fl_color( shade_color( g[*c++], bc ) ); - fl_line( x, y + h + b, x + w - 1, y + h + b, x + w + b - 1, y + h ); - fl_color( shade_color( g[*c++], bc ) ); - fl_line( x + w + b - 1, y + h, x + w + b - 1, y, x + w - 1, y - b ); - fl_color( shade_color( g[*c++], bc ) ); - fl_line( x + w - 1, y - b, x, y - b, x - b, y ); - fl_color( shade_color( g[*c++], bc ) ); - fl_line( x - b, y, x - b, y + h, x, y + h + b ); - } -} - - -static void -frame_round ( int x, int y, int w, int h, const char *c, Fl_Color bc ) -{ - uchar *g = fl_gray_ramp(); - int b = strlen( c ) / 4 + 1; - - if ( ! Fl::draw_box_active() ) - bc = fl_inactive( bc ); - - if ( w == h ) - { - for ( ; b > 1; b--, x++, y++, w -= 2, h -= 2 ) - { - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x, y, w, h, 45.0, 135.0 ); - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x, y, w, h, 315.0, 405.0 ); - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x, y, w, h, 225.0, 315.0 ); - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x, y, w, h, 135.0, 225.0 ); - } - } - else if ( w > h ) - { - int d = h / 2; - for ( ; b > 1; d--, b--, x++, y++, w -= 2, h -= 2 ) - { - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x, y, h, h, 90.0, 135.0 ); - fl_xyline( x + d, y, x + w - d ); - fl_arc( x + w - h, y, h, h, 45.0, 90.0 ); - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x + w - h, y, h, h, 315.0, 405.0 ); - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x + w - h, y, h, h, 270.0, 315.0 ); - fl_xyline( x + d, y + h - 1, x + w - d ); - fl_arc( x, y, h, h, 225.0, 270.0 ); - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x, y, h, h, 135.0, 225.0 ); - } - } - else if ( w < h ) - { - int d = w / 2; - for ( ; b > 1; d--, b--, x++, y++, w -= 2, h -= 2 ) - { - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x, y, w, w, 45.0, 135.0 ); - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x, y, w, w, 0.0, 45.0 ); - fl_yxline( x + w - 1, y + d, y + h - d ); - fl_arc( x, y + h - w, w, w, 315.0, 360.0 ); - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x, y + h - w, w, w, 225.0, 315.0 ); - fl_color( shade_color( g[*c++], bc ) ); - fl_arc( x, y + h - w, w, w, 180.0, 225.0 ); - fl_yxline( x, y + d, y + h - d ); - fl_arc( x, y, w, w, 135.0, 180.0 ); - } - } -} - - -static void -shade_rect ( int x, int y, int w, int h, const char *c, Fl_Color bc ) -{ - uchar *g = fl_gray_ramp(); - int i, j; - int clen = strlen( c ) - 1; - int chalf = clen / 2; - int cstep = 1; - - if ( ! Fl::draw_box_active() ) - bc = fl_inactive( bc ); - - if ( h < ( w * 2 ) ) - { - // Horizontal shading... - if ( clen >= h ) - cstep = 2; - - for ( i = 0, j = 0; j < chalf; i++, j += cstep ) - { - // Draw the top line and points... - fl_color( shade_color( g[c[i]], bc ) ); - fl_xyline( x + 1, y + i, x + w - 2 ); - - fl_color( shade_color( g[c[i] - 2], bc ) ); - fl_point( x, y + i + 1 ); - fl_point( x + w - 1, y + i + 1 ); - - // Draw the bottom line and points... - fl_color( shade_color( g[c[clen - i]], bc ) ); - fl_xyline( x + 1, y + h - i, x + w - 2 ); - - fl_color( shade_color( g[c[clen - i] - 2], bc ) ); - fl_point( x, y + h - i ); - fl_point( x + w - 1, y + h - i ); - } - - // Draw the interior and sides... - i = chalf / cstep; - -// fl_color( shade_color( g[c[chalf]], bc ) ); - fl_color( bc ); - fl_rectf( x + 1, y + i, w - 2, h - 2 * i + 1 ); - - fl_color( shade_color( g[c[chalf] - 2], bc ) ); - fl_yxline( x, y + i, y + h - i ); - fl_yxline( x + w - 1, y + i, y + h - i ); - } - else - { - // Vertical shading... - if ( clen >= w ) - cstep = 2; - - for ( i = 0, j = 0; j < chalf; i++, j += cstep ) - { - // Draw the left line and points... - fl_color( shade_color( g[c[i]], bc ) ); - fl_yxline( x + i, y + 1, y + h - 1 ); - - fl_color( shade_color( g[c[i] - 2], bc ) ); - fl_point( x + i + 1, y ); - fl_point( x + i + 1, y + h ); - - // Draw the right line and points... - fl_color( shade_color( g[c[clen - i]], bc ) ); - fl_yxline( x + w - 1 - i, y + 1, y + h - 1 ); - - fl_color( shade_color( g[c[clen - i] - 2], bc ) ); - fl_point( x + w - 2 - i, y ); - fl_point( x + w - 2 - i, y + h ); - } - - // Draw the interior, top, and bottom... - i = chalf / cstep; - - fl_color( shade_color( g[c[chalf]], bc ) ); - fl_rectf( x + i, y + 1, w - 2 * i, h - 1 ); - - fl_color( shade_color( g[c[chalf] - 2], bc ) ); - fl_xyline( x + i, y, x + w - i ); - fl_xyline( x + i, y + h, x + w - i ); - } -} - -static void -shade_round ( int x, int y, int w, int h, const char *c, Fl_Color bc ) -{ - uchar *g = fl_gray_ramp(); - int i; - int clen = strlen( c ) - 1; - int chalf = clen / 2; - - if ( w > h ) - { - int d = h / 2; - const int na = 8; - for ( i = 0; i < chalf; i++, d--, x++, y++, w -= 2, h -= 2 ) - { - fl_color( shade_color( g[c[i]], bc ) ); - fl_pie( x, y, h, h, 90.0, 135.0 + i * na ); - fl_xyline( x + d, y, x + w - d ); - fl_pie( x + w - h, y, h, h, 45.0 + i * na, 90.0 ); - fl_color( shade_color( g[c[i] - 2], bc ) ); - fl_pie( x + w - h, y, h, h, 315.0 + i * na, 405.0 + i * na ); - fl_color( shade_color( g[c[clen - i]], bc ) ); - fl_pie( x + w - h, y, h, h, 270.0, 315.0 + i * na ); - fl_xyline( x + d, y + h - 1, x + w - d ); - fl_pie( x, y, h, h, 225.0 + i * na, 270.0 ); - fl_color( shade_color( g[c[clen - i] - 2], bc ) ); - fl_pie( x, y, h, h, 135.0 + i * na, 225.0 + i * na ); - - - } -// fl_color( shade_color( g[c[chalf]], bc ) ); - fl_color( bc ); - fl_rectf( x + d, y, w - h + 1, h + 1 ); - fl_pie( x, y, h, h, 90.0, 270.0 ); - fl_pie( x + w - h, y, h, h, 270.0, 90.0 ); - } - else - { - int d = w / 2; - const int na = 8; - for ( i = 0; i < chalf; i++, d--, x++, y++, w -= 2, h -= 2 ) - { - fl_color( shade_color( g[c[i]], bc ) ); - fl_pie( x, y, w, w, 45.0 + i * na, 135.0 + i * na ); - fl_color( shade_color( g[c[i] - 2], bc ) ); - fl_pie( x, y, w, w, 0.0, 45.0 + i * na ); - fl_yxline( x + w - 1, y + d, y + h - d ); - fl_pie( x, y + h - w, w, w, 315.0 + i * na, 360.0 ); - fl_color( shade_color( g[c[clen - i]], bc ) ); - fl_pie( x, y + h - w, w, w, 225.0 + i * na, 315.0 + i * na ); - fl_color( shade_color( g[c[clen - i] - 2], bc ) ); - fl_pie( x, y + h - w, w, w, 180.0, 225.0 + i * na ); - fl_yxline( x, y + d, y + h - d ); - fl_pie( x, y, w, w, 135.0 + i * na, 180.0 ); - } -// fl_color( shade_color( g[c[chalf]], bc ) ); - fl_color( bc ); - fl_rectf( x, y + d, w + 1, h - w + 1 ); - fl_pie( x, y, w, w, 0.0, 180.0 ); - fl_pie( x, y + h - w, w, w, 180.0, 360.0 ); - } -} - - -static void -up_frame ( int x, int y, int w, int h, Fl_Color c ) -{ - frame_rect( x, y, w, h - 1, "KLDIIJLM", c ); -} - - -static void -narrow_thin_box ( int x, int y, int w, int h, Fl_Color c ) -{ - if ( h <= 0 || w <= 0 ) - return; - uchar *g = fl_gray_ramp(); - fl_color( shade_color( g['R'], c ) ); - fl_rectf( x + 1, y + 1, w - 2, h - 2 ); - fl_color( shade_color( g['I'], c ) ); - if ( w > 1 ) - { - fl_xyline( x + 1, y, x + w - 2 ); - fl_xyline( x + 1, y + h - 1, x + w - 2 ); - } - if ( h > 1 ) - { - fl_yxline( x, y + 1, y + h - 2 ); - fl_yxline( x + w - 1, y + 1, y + h - 2 ); - } -} - - -static void -thin_up_box ( int x, int y, int w, int h, Fl_Color c ) -{ - if ( w > 4 && h > 4 ) - { - shade_rect( x + 1, y + 1, w - 2, h - 3, "RQOQSUWQ", c ); - frame_rect( x, y, w, h - 1, "IJLM", c ); - } - else - narrow_thin_box( x, y, w, h, c ); -} - - -static void -up_box ( int x, int y, int w, int h, Fl_Color c ) -{ - if ( w > 8 && h > 8 ) - { - shade_rect( x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c ); -// shade_rect( x + 1, y + 1, w - 2, h - 3, "STUVWVQRWXVUVVQ", c ); -// shade_rect( x + 1, y + 1, w - 2, h - 3, "FISPPQQRSSTTUPJ", c ); - - frame_rect( x, y, w, h - 1, "IJLM", c ); - - } - else - thin_up_box( x, y, w, h, c ); -} - - -static void -up_round ( int x, int y, int w, int h, Fl_Color c ) -{ - shade_round( x, y, w, h, "RVQNOPQRSTUVWVQ", c ); - frame_round( x, y, w, h, "IJLM", c ); -} - - -static void -down_frame ( int x, int y, int w, int h, Fl_Color c ) -{ - frame_rect( x, y, w, h - 1, "LLLLTTRR", c ); -} - - -static void -down_box ( int x, int y, int w, int h, Fl_Color c ) -{ - if ( w > 6 && h > 6 ) - { -// shade_rect( x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c ); - fl_rectf( x + 2, y + 2, w - 4, h - 5 , fl_darker( c ) ); - down_frame( x, y, w, h, c ); - } - else - { - narrow_thin_box( x, y, w, h, c ); - } -} - - -static void -down_round ( int x, int y, int w, int h, Fl_Color c ) -{ - shade_round( x, y, w, h, "STUVWWWVT", c ); - frame_round( x, y, w, h, "IJLM", c ); -} - - -void -init_crystal_boxtypes ( void ) -{ - /* replace the plastic boxes... (is there a better way?) */ - Fl::set_boxtype( FL_PLASTIC_UP_BOX, up_box, 4,4,8,8 ); - Fl::set_boxtype( FL_PLASTIC_DOWN_BOX, down_box, 2,2,4,4 ); - Fl::set_boxtype( FL_PLASTIC_UP_FRAME, up_frame, 2,2,4,4 ); - Fl::set_boxtype( FL_PLASTIC_DOWN_FRAME, down_frame, 2,2,4,4 ); - Fl::set_boxtype( FL_PLASTIC_THIN_UP_BOX, thin_up_box, 1,1,2,2 ); - Fl::set_boxtype( FL_PLASTIC_THIN_DOWN_BOX, down_box, 1,1,2,2 ); - Fl::set_boxtype( FL_PLASTIC_ROUND_UP_BOX, up_round, 1,1,2,2 ); - Fl::set_boxtype( FL_PLASTIC_ROUND_DOWN_BOX, down_round, 1,1,2,2 ); -} diff --git a/FL/Fl_Arc_Dial.C b/FL/Fl_Arc_Dial.C deleted file mode 100644 index 61e0280..0000000 --- a/FL/Fl_Arc_Dial.C +++ /dev/null @@ -1,332 +0,0 @@ - -/*******************************************************************************/ -/* Copyright (C) 2008 Jonathan Moore Liles */ -/* */ -/* This program is free software; you can redistribute it and/or modify it */ -/* under the terms of the GNU General Public License as published by the */ -/* Free Software Foundation; either version 2 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ -/* more details. */ -/* */ -/* You should have received a copy of the GNU General Public License along */ -/* with This program; see the file COPYING. If not,write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*******************************************************************************/ - - -#include "Fl_Arc_Dial.H" - -#include -#include -#include -#include -#include -#include - -int Fl_Arc_Dial::_default_style = Fl_Arc_Dial::PLASTIC_DIAL; - -/** This simple box is suitable for use with knob-type widgets. It - * comprises a border with shadow, and a cap with glare-lines akin - * to those seen on burnished aluminum knobs. */ -static void -burnished_oval_box ( int x, int y, int w, int h, Fl_Color c ) -{ - /* draw background */ - fl_color( fl_darker( c ) ); - fl_pie( x, y, w, h, 0, 360 ); - fl_color( fl_darker( fl_darker( c ) ) ); - fl_pie( x, y, w, h, 180 + 215, 180 + 45 ); - - /* shrink */ - x += 4; - y += 4; - w -= 7; - h -= 7; - - /* draw cap */ - fl_color( c ); - fl_pie( x, y, w, h, 0, 360 ); - - /* draw glare */ - - const int a1 = 10; - const int a2 = 90; - - fl_color( fl_color_average( FL_WHITE, c, 0.15f ) ); - fl_pie( x, y, w, h, a1, a2 ); - fl_pie( x, y, w, h, 180 + a1, 180 + a2 ); - fl_color( fl_color_average( FL_WHITE, c, 0.25f ) ); - - const int d = (a2 - a1) / 2; - fl_pie( x, y, w, h, a1 + (d / 2), a2 - (d / 2) ); - fl_pie( x, y, w, h, 180 + a1 + (d / 2), 180 + a2 - (d / 2) ); -} - - - - -void -Fl_Arc_Dial::draw_box ( void ) -{ -} - -int -Fl_Arc_Dial::handle ( int m ) -{ - /* Fl_Dial and friends should really handle mousewheel, but they don't in FTLK1 */ - - switch ( m ) - { - case FL_MOUSEWHEEL: - { - if ( this != Fl::belowmouse() ) - return 0; - - int steps = 16; - - if ( Fl::event_ctrl() ) - steps = 128; - - float step = fabs( maximum() - minimum() ) / (float)steps; - - float d = ((float)Fl::event_dy()) * step; - - double v = value() + d; - - if ( maximum() > minimum() ) - { - if ( v < minimum() ) - v = minimum(); - else if ( v > maximum() ) - v = maximum(); - } - else - { - if ( v > minimum() ) - v = minimum(); - else if ( v < maximum() ) - v = maximum(); - } - - value( v ); - do_callback(); - - return 1; - } - } - - int X, Y, S; - - get_knob_dimensions ( &X, &Y, &S ); - - return Fl_Dial::handle( m, X, Y, S, S ); -} - -void -Fl_Arc_Dial::draw ( void ) -{ - int X, Y, S; - - get_knob_dimensions ( &X, &Y, &S); - - draw_box(); - draw_label(); - - double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); - - if ( type() == ARC_DIAL ) - { - /* fl_line_style( FL_SOLID, 0 ); */ - if ( type() == ARC_DIAL ) - fl_draw_box( FL_ROUNDED_BOX, X, Y, S, S, color() ); - - /* shrink a bit */ - X += S / 8.0; - Y += S / 8.0; - S -= S / 4; - - fl_line_style( FL_SOLID, S / 6 ); - - /* background arc */ - fl_color( fl_darker( color() ) ); - fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle2() ); - - /* foreground arc */ - fl_color( selection_color() ); - fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle ); - - fl_line_style( FL_SOLID, 0 ); - - fl_color( fl_contrast( labelcolor(), color() ) ); - } - else if ( type() == PLASTIC_DIAL || type() == BURNISHED_DIAL ) - { - draw_knob(); - - draw_cursor( X, Y, S); - } - - /* Some strange bug in FLTK prevents us from always been able to draw text - * here, so don't even try for now. */ - /* char s[10]; */ - - /* fl_font( FL_HELVETICA, 8 ); */ - - /* snprintf( s, sizeof( s ), "%.1f", value() ); */ - - /* /\* fl_rectf( X, Y + S, S, 14, FL_BACKGROUND2_COLOR ); *\/ */ - /* fl_color( FL_WHITE ); */ - /* fl_draw( s, X, Y + S, S, 14, FL_ALIGN_CENTER ); */ -} - -void -Fl_Arc_Dial::get_knob_dimensions ( int *X, int *Y, int *S ) -{ - int ox, oy, ww, hh, side; - ox = x(); - oy = y(); - ww = w(); - hh = h(); - - if (ww > hh) - { - side = hh; - ox = ox + (ww - side) / 2; - } - else - { - side = ww; - oy = oy + (hh - side) / 2; - } - side = w() > h() ? hh : ww; - - *X = ox; - *Y = oy; - *S = side; -} - -void -Fl_Arc_Dial::draw_cursor ( int ox, int oy, int side ) -{ - double angle; - -// fl_color(fl_color_average(FL_BACKGROUND_COLOR, FL_BLACK, .7f)); - - angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); - - fl_color( fl_contrast( selection_color(), FL_BACKGROUND_COLOR ) ); - - fl_line_style( FL_SOLID, side / 8 ); - - const int d = 6; - - /* account for edge conditions */ - angle = angle < angle1() + d ? angle1() + d : angle; - angle = angle > angle2() - d ? angle2() - d : angle; - - ox += side / 4; - oy += side / 4; - side -= side / 2; - - fl_arc( ox, oy, side, side, 270 - (angle - d), 270 - (angle + d) ); - - fl_line_style( FL_SOLID, 0 ); -} - -void -Fl_Arc_Dial::draw_knob ( void ) -{ - int ox, oy, ww, hh, side; - - get_knob_dimensions ( &ox, &oy, &side ); - - ww = w(); - hh = h(); - draw_label(); - fl_clip(ox, oy, ww, hh); - - - // background - /* fl_color(FL_BACKGROUND_COLOR); */ - /* fl_rectf(ox, oy, side, side); */ - - /* scale color */ - fl_color(fl_color_average(color(), FL_BACKGROUND2_COLOR, .6)); - - fl_pie(ox + 1, oy + 3, side - 2, side - 12, 0, 360); - // scale - draw_scale(ox, oy, side); - - Fl_Color c = active_r() ? fl_color_average(FL_BACKGROUND_COLOR, FL_WHITE, .7) : FL_INACTIVE_COLOR; - - if ( type() == BURNISHED_DIAL ) - { - burnished_oval_box( ox + 5, oy + 5, side - 12, side - 12, c ); - } - else - { - - fl_color(FL_BACKGROUND_COLOR); - fl_pie(ox + 6, oy + 6, side - 12, side - 12, 0, 360); - - // shadow - - fl_color(fl_color_average(FL_BACKGROUND_COLOR, FL_BLACK, .8f)); - fl_pie(ox + 8, oy + 12, side - 16, side - 16, 0, 360); - fl_color(fl_color_average(FL_BACKGROUND_COLOR, FL_BLACK, .2f)); - fl_pie(ox + 9, oy + 12, side - 18, side - 18, 0, 360); - - // knob edge - fl_color( c); - - - fl_pie(ox + 8, oy + 8, side - 16, side - 16, 0, 360); - - fl_color(fl_color_average(FL_BACKGROUND_COLOR, FL_WHITE, .6)); - fl_pie(ox + 10, oy + 10, side - 20, side - 20, 0, 360); - - } - fl_pop_clip(); -} - - -void -Fl_Arc_Dial::draw_scale ( int ox, int oy, int side ) -{ - float x1, y1, x2, y2, rds, cx, cy, ca, sa; - rds = side / 2; - cx = ox + side / 2; - cy = oy + side / 2; - if (_scaleticks == 0) - return; - double a_step = (10.0 * 3.14159 / 6.0) / _scaleticks; - double a_orig = -(3.14159 / 3.0); - for (int a = 0; a <= _scaleticks; a++) - { - double na = a_orig + a * a_step; - ca = cos(na); - sa = sin(na); - x1 = cx + (rds) * ca; - y1 = cy - (rds) * sa; - x2 = cx + (rds - 6) * ca; - y2 = cy - (rds - 6) * sa; - fl_color(FL_BACKGROUND_COLOR); - fl_line(x1, y1, x2, y2); - } -} - -void -Fl_Arc_Dial::scaleticks ( int tck ) -{ - _scaleticks = tck; - if (_scaleticks < 0) - _scaleticks = 0; - if (_scaleticks > 31) - _scaleticks = 31; - if (visible()) - damage(FL_DAMAGE_ALL); -} diff --git a/FL/Fl_Blinker.H b/FL/Fl_Blink_Button.H similarity index 63% rename from FL/Fl_Blinker.H rename to FL/Fl_Blink_Button.H index ff3ac84..90f2ed2 100644 --- a/FL/Fl_Blinker.H +++ b/FL/Fl_Blink_Button.H @@ -20,15 +20,19 @@ #include #include -class Fl_Blinker : public Fl_Button +/* Kind of like Fl_Light_Button except that the whole thing is the + * indicator and it can optionally blink */ + +class Fl_Blink_Button : public Fl_Button { bool _on; float _blink_interval; + bool _blinking; static void update_cb ( void *v ) { - ((Fl_Blinker*)v)->update_cb(); + ((Fl_Blink_Button*)v)->update_cb(); } void @@ -40,7 +44,7 @@ class Fl_Blinker : public Fl_Button redraw(); } - + public: static const float SLOW = 0.5f; @@ -48,33 +52,67 @@ public: static const float FAST = 0.1f; static const float DEFAULT = 0.5f; - Fl_Blinker ( int X, int Y, int W, int H, const char *L ) + Fl_Blink_Button ( int X, int Y, int W, int H, const char *L ) : Fl_Button( X, Y, W, H, L ) { + _blinking = true; _on = false; _blink_interval = DEFAULT; - Fl::add_timeout( _blink_interval, update_cb, this ); - - type( FL_TOGGLE_BUTTON ); } virtual - ~Fl_Blinker () + ~Fl_Blink_Button () { - Fl::remove_timeout( update_cb, this ); + if ( value() ) + Fl::remove_timeout( update_cb, this ); + } + + void blink ( bool b ) + { + _blinking = b; + if ( ! b ) + _on = true; + } + + bool blink ( void ) const + { + return _blinking; } void - interval ( float v ) + blink_interval ( float v ) { _blink_interval = v; - Fl::remove_timeout( update_cb, this ); - Fl::add_timeout( _blink_interval, update_cb, this ); + if ( value() ) + { + Fl::remove_timeout( update_cb, this ); + Fl::add_timeout( _blink_interval, update_cb, this ); + } } + virtual void value ( float v ) + { + if ( v ) + { + if ( _blinking ) + Fl::add_timeout( _blink_interval, update_cb, this ); + Fl_Button::value( v ); + redraw(); + } + else + { + Fl_Button::value( v ); + Fl::remove_timeout( update_cb, this ); + redraw(); + } + + } + + virtual float value ( void ) { return Fl_Button::value(); } + virtual void draw ( void ) { diff --git a/FL/Fl_Sometimes_Input.H b/FL/Fl_Sometimes_Input.H index a4322b2..9dd5faa 100644 --- a/FL/Fl_Sometimes_Input.H +++ b/FL/Fl_Sometimes_Input.H @@ -28,7 +28,6 @@ class Fl_Sometimes_Input : public Fl_Input { - Fl_Boxtype _up_box; public: @@ -38,7 +37,7 @@ public: { clear_visible_focus(); up_box( FL_NO_BOX ); - when(FL_WHEN_ENTER_KEY_ALWAYS); + when(FL_WHEN_ENTER_KEY); } void up_box ( Fl_Boxtype b ) { _up_box = b; } @@ -73,20 +72,19 @@ public: switch ( m ) { + case FL_KEYDOWN: + { + if ( r && Fl::event_key() == FL_Enter ) + Fl::focus( NULL ); + } case FL_FOCUS: + case FL_UNFOCUS: redraw(); return 1; case FL_PUSH: take_focus(); redraw(); return 1; - case FL_UNFOCUS: - - if ( window() ) - window()->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() ); - - redraw(); - return r; default: return r; } diff --git a/FL/Gleam_Boxtypes.C b/FL/Gleam_Boxtypes.C deleted file mode 100644 index daea4a0..0000000 --- a/FL/Gleam_Boxtypes.C +++ /dev/null @@ -1,180 +0,0 @@ - -/*******************************************************************************/ -/* Copyright (C) 2012 Jonathan Moore Liles */ -/* Copyright (C) 2001-2005 by Colin Jones */ -/* */ -/* This program is free software; you can redistribute it and/or modify it */ -/* under the terms of the GNU General Public License as published by the */ -/* Free Software Foundation; either version 2 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ -/* more details. */ -/* */ -/* You should have received a copy of the GNU General Public License along */ -/* with This program; see the file COPYING. If not,write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*******************************************************************************/ - -/* Taken from the "Gleam" FLTK scheme, as modified by prodatum */ - -#include -#include - -#include "Gleam_Boxtypes.H" - -static void gleam_color(Fl_Color c) -{ - if (Fl::draw_box_active()) - fl_color(c); - else - fl_color(fl_inactive(c)); -} -static void frame_rect(int x, int y, int w, int h, Fl_Color bc) -{ - - // Draw the outline around the perimeter of the box - fl_color(fl_color_average(FL_BLACK, FL_BACKGROUND_COLOR, .1)); - fl_line(x, y, x + w, y); - fl_line(x + w, y, x + w, y + h); - fl_line(x + w, y + h, x, y + h); - fl_line(x, y + h, x, y); - -} - -static void shade_rect_up(int x, int y, int w, int h, Fl_Color bc) -{ - // Draws the shiny - float third = (float) h / 3; - gleam_color(bc); - fl_rectf(x, y, w, third + 1); - - //gleam_color(fl_color_average(bc, FL_WHITE, .90f)); - //fl_rectf(x, y, w, half + 1); - - float step_size = 0.10 / ((float) h - third); - int j = 0; - //step_size = (.1 / (float) half); - //printf("1 / %i = %f \n", half, (1.0/half)); - - /** - * This loop generates the nice gradient at the bottom of the - * widget - **/ - for (float k = 1; k >= .90; k -= step_size) - { - j++; - gleam_color(fl_color_average(bc, FL_WHITE, k)); - fl_line(x, y + j + third - 1, x + w - 1, y + j + third - 1); - } - -} - -static void frame_rect_up(int x, int y, int w, int h, Fl_Color bc) -{ - - // Draw the outline around the perimeter of the box - gleam_color(bc); - fl_line(x, y, x + w, y); //Go across. - fl_line(x, y + (h / 2), x, y + 1); //Go to top - fl_line(x + w, y + (h / 2), x + w, y + 1); //Go to top - - gleam_color(fl_darker(bc)); - fl_line(x, y + h, x + w, y + h); //Go across again! - fl_line(x, y + (h / 2), x, y + h - 1); //Go to top - fl_line(x + w, y + (h / 2), x + w, y + h - 1); //Go to top - -} - -static void frame_rect_down(int x, int y, int w, int h, Fl_Color bc) -{ - - // Draw the outline around the perimeter of the box - gleam_color(fl_darker(bc)); - fl_line(x, y, x + w, y); //Go across. - fl_line(x, y + (h / 2), x, y + 1); //Go to top - fl_line(x + w, y + (h / 2), x + w, y + 1); //Go to top - - //gleam_color(bc); - fl_line(x, y + h, x + w, y + h); //Go across again! - fl_line(x, y + (h / 2), x, y + h - 1); //Go to top - fl_line(x + w, y + (h / 2), x + w, y + h - 1); //Go to top - -} - -static void shade_rect_down(int x, int y, int w, int h, Fl_Color bc) -{ - - gleam_color(bc); - Fl_Color color = fl_color(); - fl_rectf(x, y, w, h); - gleam_color(fl_color_average(bc, fl_darker(color), 0.65)); - fl_line(x, y + 1, x + w, y + 1); - fl_line(x, y + 1, x, y + h - 2); - gleam_color(fl_color_average(bc, fl_darker(color), 0.85)); - fl_line(x + 1, y + 2, x + w, y + 2); - fl_line(x + 1, y + 2, x + 1, y + h - 2); - -} - -static void up_frame(int x, int y, int w, int h, Fl_Color c) -{ - frame_rect_up(x, y, w - 1, h - 1, fl_darker(c)); -} - -static void thin_up_box(int x, int y, int w, int h, Fl_Color c) -{ - - shade_rect_up(x + 1, y, w - 2, h - 1, c); - frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_WHITE, .25f)); - frame_rect_up(x, y, w - 1, h - 1, fl_darker(c)); - -} - -static void up_box(int x, int y, int w, int h, Fl_Color c) -{ - shade_rect_up(x + 1, y, w - 2, h - 1, c); - frame_rect_up(x, y, w - 1, h - 1, fl_darker(c)); - //draw the inner rect. - frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_WHITE, .25f)); - -} - -static void down_frame(int x, int y, int w, int h, Fl_Color c) -{ - frame_rect_down(x, y, w - 1, h - 1, fl_darker(c)); -} - -static void down_box(int x, int y, int w, int h, Fl_Color c) -{ - shade_rect_down(x + 1, y, w - 2, h, c); - down_frame(x, y, w, h, fl_darker(c)); - //draw the inner rect. - //frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_BLACK, .65)); -} - -static void thin_down_box(int x, int y, int w, int h, Fl_Color c) -{ - - down_box(x, y, w, h, c); - -} - -void -init_gleam_boxtypes ( void ) -{ - /* replace the gtk+ boxes... (is there a better way?) */ - Fl::set_boxtype( FL_GTK_UP_BOX, up_box, 2,2,4,4 ); - Fl::set_boxtype( FL_GTK_DOWN_BOX, down_box, 2,2,3,3 ); - Fl::set_boxtype( FL_GTK_THIN_UP_BOX, up_box, 2,2,3,3 ); - Fl::set_boxtype( FL_GTK_THIN_DOWN_BOX, down_box, 2,2,3,3 ); - Fl::set_boxtype( FL_GTK_UP_FRAME, up_frame, 2,2,3,3 ); - Fl::set_boxtype( FL_GTK_DOWN_FRAME, down_frame, 2,2,3,3 ); - /* Fl::set_boxtype( FL_GTK_THIN_UP_BOX, thin_up_box, 1,1,1,1 ); */ - /* Fl::set_boxtype( FL_GTK_THIN_DOWN_BOX, thin_down_box, 1,1,1,1 ); */ - Fl::set_boxtype( FL_GTK_ROUND_UP_BOX, up_box, 2,2,3,3 ); - Fl::set_boxtype( FL_GTK_ROUND_DOWN_BOX, down_box, 2,2,3,3 ); - } - diff --git a/FL/color_scheme.C b/FL/color_scheme.C deleted file mode 100644 index 4a94198..0000000 --- a/FL/color_scheme.C +++ /dev/null @@ -1,81 +0,0 @@ - -/*******************************************************************************/ -/* Copyright (C) 2010 Jonathan Moore Liles */ -/* */ -/* This program is free software; you can redistribute it and/or modify it */ -/* under the terms of the GNU General Public License as published by the */ -/* Free Software Foundation; either version 2 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ -/* more details. */ -/* */ -/* You should have received a copy of the GNU General Public License along */ -/* with This program; see the file COPYING. If not,write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*******************************************************************************/ - -#include "color_scheme.H" -#include -#include - -static Fl_Color system_colors[3]; - -void -get_system_colors ( void ) -{ - Fl::get_system_colors(); - - system_colors[ 0 ] = (Fl_Color)Fl::get_color( FL_BACKGROUND_COLOR ); - system_colors[ 1 ] = (Fl_Color)Fl::get_color( FL_FOREGROUND_COLOR ); - system_colors[ 2 ] = (Fl_Color)Fl::get_color( FL_BACKGROUND2_COLOR ); -} - -void -color_scheme ( const char *name ) -{ - if ( !strcasecmp( name, "gray" ) ) - { - Fl::background2( 127, 127, 127 ); - Fl::background( 100, 100, 100 ); - Fl::foreground( 255, 255, 255 ); - } - if ( !strcasecmp( name, "dark" ) ) - { - Fl::background2( 100, 100, 100 ); - Fl::background( 50, 50, 50 ); - Fl::foreground( 255, 255, 255 ); - } - else if ( !strcasecmp( name, "light" )) - { - Fl::background2( 192, 192, 192 ); - Fl::background( 220, 220, 220 ); - Fl::foreground( 0, 0, 0 ); - } - if ( !strcasecmp( name, "very dark" ) ) - { - Fl::background2( 100, 100, 100 ); - Fl::background( 20, 20, 20 ); - Fl::foreground( 240, 240, 240 ); - } - else if ( !strcasecmp( name, "system" ) ) - { - unsigned char r, g, b; - - Fl::get_color( system_colors[ 0 ], r, g, b ); - - Fl::background( r, g, b ); - - Fl::get_color( system_colors[ 1 ], r, g, b ); - - Fl::foreground( r, g, b ); - - Fl::get_color( system_colors[ 2 ], r, g, b ); - - Fl::background2( r, g, b ); - } - - Fl::scheme( Fl::scheme() ); -} diff --git a/FL/configure b/FL/configure index 978c9d6..7212859 100755 --- a/FL/configure +++ b/FL/configure @@ -14,7 +14,7 @@ ask "Build for debugging" USE_DEBUG no begin_tests require_FLTK 1.1.7 images -require_command FLUID fluid +require_command FLUID lib/ntk/fluid/fluid require_command ar ar require_command makedepend makedepend diff --git a/FL/lib b/FL/lib new file mode 120000 index 0000000..dc598c5 --- /dev/null +++ b/FL/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/FL/makefile.inc b/FL/makefile.inc index ff9a84b..1ddaa25 100644 --- a/FL/makefile.inc +++ b/FL/makefile.inc @@ -11,7 +11,7 @@ SRCS:=$(SRCS:.fl=.C) SRCS:=$(sort $(SRCS)) OBJS:=$(SRCS:.C=.o) -all: FL/libfl_widgets.a +all: FL/libfl_widgets.a util/ntk-perf FL/libfl_widgets.a: $(OBJS) @ ar rcs $@ $(OBJS) @@ -19,8 +19,19 @@ FL/libfl_widgets.a: $(OBJS) .PHONEY: FL FL: FL/libfl_widgets.a +# ntk-chtheme: ntk-chtheme.o $(FLTK_LIBS) FL/libfl_widgets.a +# @ echo -n Linking session handler. +# @ $(CXX) $(CXXFLAGS) $(FLTK_LDFLAGS) $(LIBS) $^ -o $@ -LFL -lfl_widgets && echo $(DONE) + + +util/ntk-perf.o: util/ntk-perf.C + +util/ntk-perf: util/ntk-perf.o $(FLTK_LIBS) FL/libfl_widgets.a + @ echo -n Linking session handler. + @ $(CXX) $(CXXFLAGS) $^ -o $@ $(FLTK_LDFLAGS) $(LIBS) -LFL -lfl_widgets && echo $(DONE) + clean: - rm -f $(OBJS) FL/libfl_widgets.a + rm -f $(OBJS) FL/libfl_widgets.a .deps install: - @ \ No newline at end of file + @ diff --git a/FL/menu_popup.H b/FL/menu_popup.H index 55f6257..67c5b78 100644 --- a/FL/menu_popup.H +++ b/FL/menu_popup.H @@ -18,7 +18,7 @@ /*******************************************************************************/ class Fl_Menu_; -class Fl_Menu_Item; +struct Fl_Menu_Item; class Fl_Widget; bool menu_popup ( Fl_Menu_ *m, int X, int Y ); diff --git a/FL/Crystal_Boxtypes.H b/FL/util/ntk-chtheme.C similarity index 85% rename from FL/Crystal_Boxtypes.H rename to FL/util/ntk-chtheme.C index 8bd29e7..7f9e232 100644 --- a/FL/Crystal_Boxtypes.H +++ b/FL/util/ntk-chtheme.C @@ -1,6 +1,6 @@ /*******************************************************************************/ -/* Copyright (C) 2008 Jonathan Moore Liles */ +/* Copyright (C) 2012 Jonathan Moore Liles */ /* */ /* This program is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU General Public License as published by the */ @@ -17,6 +17,16 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*******************************************************************************/ -#include +#include "FL/themes.H" +#include "FL/Fl_Theme_Chooser.C" -void init_crystal_boxtypes ( void ); + +int +main ( int argc, char **argv ) +{ + fl_register_themes(); + + Fl_Theme::set(); + + fl_theme_chooser(); +} diff --git a/FL/util/ntk-perf.C b/FL/util/ntk-perf.C new file mode 100644 index 0000000..1ea8d1d --- /dev/null +++ b/FL/util/ntk-perf.C @@ -0,0 +1,163 @@ + +/*******************************************************************************/ +/* Copyright (C) 2012 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +static Fl_Boxtype boxtype = FL_UP_BOX; + +#include + +unsigned long long tv_to_ts ( timeval *tv ) +{ + return tv->tv_sec * 1e6 + tv->tv_usec; +} + +unsigned long long get_ts ( void ) +{ + struct timeval then; + gettimeofday( &then, NULL ); + + return tv_to_ts( &then ); +} + +class PerfTest : public Fl_Widget +{ +public: + + PerfTest ( int X, int Y, int W, int H, const char *L=0 ) : Fl_Widget( X, Y, W, H, L ) + { + align(FL_ALIGN_TOP | FL_ALIGN_RIGHT |FL_ALIGN_INSIDE); + box(FL_UP_BOX); + labelcolor( FL_WHITE ); + use_cairo = false; + } + + + bool use_cairo; + + void draw ( void ) + { + if ( use_cairo ) + fl_push_use_cairo(true); + + fl_rectf( x(), y(), w(), h(), FL_BLACK ); + + unsigned long long then = get_ts(); + + fl_push_clip( x(), y(), w(), h() ); + + int count = 400; + + /* draw stuff */ + int i = 0; + for ( ; i < count; ++i ) + fl_draw_box( boxtype, x(), y(), w(), h(), fl_lighter( FL_BLACK ) ); + + fl_pop_clip(); + + unsigned long long now = get_ts(); + + double elapsedms = (now - then) / 1000.0; + + static char text[256]; + sprintf( text, "Drew %i boxes in in %fms", i, elapsedms ); + + fl_color( FL_RED ); + fl_draw( text, x(), y(), w(), h(), FL_ALIGN_CENTER | FL_ALIGN_INSIDE ); + + draw_label(); + + if ( use_cairo ) + fl_pop_use_cairo(); + } +}; + + +void +boxtype_cb ( Fl_Widget *w, void *v ) +{ + const char *picked = ((Fl_Choice*)w)->mvalue()->label(); + + if ( !strcmp( picked, "UP_BOX" ) ) + boxtype = FL_UP_BOX; + else if ( !strcmp( picked, "FLAT_BOX" ) ) + boxtype = FL_FLAT_BOX; + else if ( !strcmp( picked, "ROUNDED_BOX" ) ) + boxtype = FL_ROUNDED_BOX; + else if ( !strcmp( picked, "OVAL_BOX" ) ) + boxtype = FL_OVAL_BOX; + + w->window()->redraw(); +} + +int +main ( int argc, char **argv ) +{ + { + Fl_Single_Window *w = new Fl_Single_Window( 800, 600 ); + + { Fl_Choice *o = new Fl_Choice( 0, 0, 200, 24, "Boxtype" ); + o->align( FL_ALIGN_RIGHT ); + + o->callback( boxtype_cb, NULL ); + + o->add( "UP_BOX" ); + o->add( "FLAT_BOX" ); + o->add( "ROUNDED_BOX" ); + o->add( "OVAL_BOX" ); + } + + { + Fl_Scalepack *o = new Fl_Scalepack( 0, 24, 800, 600 - 24 ); + o->type( 0 ); + + { + PerfTest *o = new PerfTest( 0,0, 800, 400, "Xlib" ); + } + + { + PerfTest *o = new PerfTest( 0,0, 800, 400, "Cairo" ); + o->use_cairo = true; + } + + o->end(); + } + + w->end(); + w->show(); + } + + /* { */ + /* Fl_Single_Window *w = new Fl_Single_Window( 800, 600 ); */ + + /* PerfTest *o = new PerfTest( 0,0, 800, 600 ); */ + + /* w->end(); */ + /* w->show(); */ + /* } */ + + Fl::run(); +} diff --git a/Makefile b/Makefile index 32dcd53..2ac5338 100644 --- a/Makefile +++ b/Makefile @@ -17,16 +17,25 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################### -SUBDIRS=nonlib FL timeline mixer session-manager +SUBDIRS=lib nonlib FL timeline mixer session-manager sequencer -all: - @ for dir in $(SUBDIRS); do $(MAKE) -s -C $$dir; done +all: lib/ntk/configure lib/.built .config + @ for dir in $(SUBDIRS); do echo Building $$dir; $(MAKE) -s -C $$dir; done + +lib/ntk/configure: + @ git submodule update --init + +lib/.built: + @ make -C lib + +.config: configure + ./configure + +config: configure + ./configure clean: @ for dir in $(SUBDIRS); do $(MAKE) -s -C $$dir clean; done install: @ for dir in $(SUBDIRS); do $(MAKE) -s -C $$dir install; done - -config: - @ for dir in $(SUBDIRS); do $(MAKE) -s -C $$dir config; done diff --git a/README.build b/README.build new file mode 100644 index 0000000..96a246f --- /dev/null +++ b/README.build @@ -0,0 +1,7 @@ + +This repository contains all of the non-* software. + +To build it, just type 'make'. Stuff will happen. Eventually, you'll +have to answer some build questions. Just answer them. Don't make +things harder on yourself by trying to build everything +individually. Just type 'make'. I'm serious. It's that simple. \ No newline at end of file diff --git a/configure b/configure new file mode 100755 index 0000000..8acb740 --- /dev/null +++ b/configure @@ -0,0 +1,59 @@ +#!/bin/sh +# +# Copyright (C) 2008 Jonathan Moore Liles +# This file is licensed under version 2 of the GPL. + +. scripts/config-funcs + +begin + +begin_options + +echo "Master configuration" + +ask "Installation prefix" prefix /usr/local +ask "Build for debugging" USE_DEBUG no + +begin_tests + +# should require everything all of the subprojects require + +require_command ar ar +require_command makedepend makedepend +require_FLTK 1.3.0 images +require_command FLUID lib/ntk/fluid/fluid +require_package JACK 0.103.0 jack +test_version `version_of jack` 0.105.0 || append "JACK_MIDI_PROTO_API=yes" +require_package sndfile 1.0.17 sndfile +require_package lrdf 0.4.0 lrdf +require_package liblo 0.23 liblo +suggest_package XPM 2.0.0 xpm +require_package sigcpp 2.0.0 sigc++-2.0 + +test_version `version_of liblo` 0.26 || warn "Version $(version_of liblo) of liblo is slow to create servers. Consider upgrading to 0.26 or later" + +if ! hostname_resolvable +then + echo "Your hostname \"$(hostname)\" does not resolve to a valid address." + echo "This is a broken configuration and will cause liblo (the" + echo "OSC library) to fail to function. Add the line:" + echo + echo "127.0.0.1 $(hostname)" + echo + echo "to your /etc/hosts file to fix. And consider switching to a saner distribution." + echo + fail "Invalid hostname!" +fi + +end + +# installing configuration +echo -n "Copying configuration to modules..." + +for i in nonlib FL timeline mixer sequencer session-manager +do + echo -n "$i " + cp .config "$i" +done + +echo diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 0000000..f832e50 --- /dev/null +++ b/lib/Makefile @@ -0,0 +1,21 @@ + +OBJS:= ntk/lib/libntk.a ntk/lib/libntk_images.a +SRCS:= $(wildcard ntk/src/*.cxx ntk/FL/*.H) + +$(SRCS): ntk/config.h + @ echo Building NTK + $(MAKE) -C ntk + @ touch .built + +$(OBJS): $(SRCS) + +ntk/config.h: Makefile + @ echo Configuring NTK + cd ntk && ./configure --prefix=/usr/local --enable-debug --enable-shared --disable-gl --enable-threads --enable-xft --enable-cairo --enable-cairoext --enable-xinerama + @ touch ntk/config.h + +config: ntk/config.h + +clean: + +all: $(OBJS) diff --git a/lib/ntk b/lib/ntk new file mode 160000 index 0000000..41d4f68 --- /dev/null +++ b/lib/ntk @@ -0,0 +1 @@ +Subproject commit 41d4f68b3b9f9526cb4e31a060042936d542595e diff --git a/mixer/configure b/mixer/configure index 5a6a28d..8f331e2 100755 --- a/mixer/configure +++ b/mixer/configure @@ -14,14 +14,13 @@ ask "Build for debugging" USE_DEBUG no begin_tests -require_FLTK 1.1.7 images -require_command FLUID fluid require_command ar ar require_command makedepend makedepend +require_FLTK 1.3.0 images +require_command FLUID lib/ntk/fluid/fluid require_package JACK 0.103.0 jack require_package lrdf 0.4.0 lrdf require_package liblo 0.23 liblo -require_package sigcpp 2.0.0 sigc++-2.0 suggest_package XPM 2.0.0 xpm test_version `version_of liblo` 0.26 || warn "Version $(version_of liblo) of liblo is slow to create servers. Consider upgrading to 0.26 or later" diff --git a/mixer/doc/Makefile b/mixer/doc/Makefile index b4edd91..442d5cd 100644 --- a/mixer/doc/Makefile +++ b/mixer/doc/Makefile @@ -17,8 +17,8 @@ upload: all @ rm -f index.html install: - @ mkdir -p $(DOCUMENT_PATH)/non-mixer - @ cp $(OBJS) *.png mup.css ../../COPYING $(DOCUMENT_PATH)/non-mixer + @ install -d "$(DESTDIR)$(DOCUMENT_PATH)"/non-mixer + @ cp $(OBJS) *.png mup.css ../../COPYING "$(DESTDIR)$(DOCUMENT_PATH)"/non-mixer # @ ln -sf $(PIXMAP_PATH)/logo.png $(DOCUMENT_PATH) clean: diff --git a/mixer/lib b/mixer/lib new file mode 120000 index 0000000..dc598c5 --- /dev/null +++ b/mixer/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/mixer/makefile.inc b/mixer/makefile.inc index 3c3d97d..ac9b25b 100644 --- a/mixer/makefile.inc +++ b/mixer/makefile.inc @@ -12,26 +12,27 @@ SRCS:=$(SRCS:.fl=.C) SRCS:=$(sort $(SRCS)) OBJS:=$(SRCS:.C=.o) -LIBS := $(FLTK_LIBS) $(JACK_LIBS) $(LASH_LIBS) $(LRDF_LIBS) $(LIBLO_LIBS) $(SIGCPP_LIBS) $(XPM_LIBS) +LIBS += $(FLTK_LDFLAGS) $(JACK_LIBS) $(LRDF_LIBS) $(LIBLO_LIBS) $(XPM_LIBS) -CFLAGS := $(FLTK_CFLAGS) $(JACK_CFLAGS) $(LIBLO_CFLAGS) $(SIGCPP_CFLAGS) $(XPM_CFLAGS) +CFLAGS += $(FLTK_CFLAGS) $(JACK_CFLAGS) $(LRDF_CFLAGS) $(LIBLO_CFLAGS) $(XPM_CFLAGS) -src/mixer: $(OBJS) FL/libfl_widgets.a nonlib/libnonlib.a +src/mixer: $(OBJS) FL/libfl_widgets.a nonlib/libnonlib.a $(FLTK_LIBS) @ echo -n Linking mixer... - @ $(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) -o $@ -LFL -lfl_widgets -Lnonlib -lnonlib -ldl && echo $(DONE) + @ $(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS) -LFL -lfl_widgets -Lnonlib -lnonlib -ldl && echo $(DONE) Mixer: src/mixer clean: - rm -f $(OBJS) src/mixer + rm -f $(OBJS) src/mixer .deps install: all @ echo -n "Installing..." - @ install src/mixer "$(DESTDIR)$(prefix)"/bin/non-mixer - @ mkdir -p "$(DESTDIR)$(SYSTEM_PATH)"/non-mixer + @ install -Dm755 src/mixer "$(DESTDIR)$(prefix)"/bin/non-mixer + @ ln -s "$(DESTDIR)$(prefix)"/bin/non-mixer "$(DESTDIR)$(prefix)"/bin/non-mixer-noui + @ install -d "$(DESTDIR)$(SYSTEM_PATH)"/non-mixer @ $(MAKE) -s -C doc install @ install -d "$(DESTDIR)$(PIXMAP_PATH)/non-mixer" - @ install -m 644 icons/hicolor/256x256/apps/non-mixer.png "$(DESTDIR)$(PIXMAP_PATH)"/non-mixer/icon-256x256.png + @ install -Dm644 icons/hicolor/256x256/apps/non-mixer.png "$(DESTDIR)$(PIXMAP_PATH)"/non-mixer/icon-256x256.png @ install -d "$(DESTDIR)$(ICON_PATH)/hicolor" @ cp -au icons/hicolor/ "$(DESTDIR)$(ICON_PATH)" @ install -d "$(DESTDIR)$(DESKTOP_PATH)" @@ -39,6 +40,6 @@ install: all @ echo "$(DONE)" ifneq ($(USE_DEBUG),yes) @ echo -n "Stripping..." - @ strip $(DESTDIR)$(prefix)/bin/non-mixer + @ strip "$(DESTDIR)$(prefix)"/bin/non-mixer @ echo "$(DONE)" endif diff --git a/mixer/src/Chain.C b/mixer/src/Chain.C index 1f0b2c4..a0de9bf 100644 --- a/mixer/src/Chain.C +++ b/mixer/src/Chain.C @@ -293,6 +293,25 @@ void Chain::cb_handle(Fl_Widget* o, void* v) { ((Chain*)(v))->cb_handle(o); } +void +Chain::remove ( Controller_Module *m ) +{ + DMESSAGE( "Removing controller module from chain" ); + + engine()->lock(); + + m->disconnect(); + + controls_pack->remove( m ); + modules_pack->remove( m ); + + build_process_queue(); + + engine()->unlock(); + + redraw(); +} + /* remove a module from the chain. this isn't guaranteed to succeed, * because removing the module might result in an invalid routing */ @@ -311,11 +330,15 @@ Chain::remove ( Module *m ) fl_alert( "Can't remove module at this point because the resultant chain is invalid" ); } + engine()->lock(); + strip()->handle_module_removed( m ); modules_pack->remove( m ); configure_ports(); + + engine()->unlock(); } /* determine number of output ports, signal if changed. */ @@ -363,14 +386,9 @@ Chain::get_module_instance_number ( Module *m ) { int n = 0; - for ( int i = 0; i < modules(); ++i ) - { - if ( module(i) == m ) - break; - - if ( ! strcmp( module(i)->name(), m->name() ) ) + for ( int i = 0; i < modules() && module(i) != m; ++i ) + if ( ! strcmp( module(i)->label(), m->label() ) ) n++; - } return n; } diff --git a/mixer/src/Chain.H b/mixer/src/Chain.H index 783a4a7..1832749 100644 --- a/mixer/src/Chain.H +++ b/mixer/src/Chain.H @@ -101,6 +101,7 @@ public: int modules ( void ) const { return modules_pack->children(); } Module *module ( int n ) const { return (Module*)modules_pack->child( n ); } + void remove ( Controller_Module *m ); void remove ( Module *m ); bool add ( Module *m ); bool add ( Controller_Module *m ); diff --git a/mixer/src/Controller_Module.C b/mixer/src/Controller_Module.C index f9b1714..37d5972 100644 --- a/mixer/src/Controller_Module.C +++ b/mixer/src/Controller_Module.C @@ -30,9 +30,8 @@ #include #include #include -#include "FL/Crystal_Boxtypes.H" #include -#include "FL/Fl_Arc_Dial.H" +#include "FL/Fl_Dial.H" #include "FL/Fl_Labelpad_Group.H" #include "FL/Fl_Value_SliderX.H" #include "Panner.H" @@ -92,6 +91,17 @@ Controller_Module::handle_chain_name_changed() // change_osc_path( generate_osc_path() ); } +void +Controller_Module::disconnect ( void ) +{ + for ( std::vector::iterator i = control_output.begin(); + i != control_output.end(); + ++i ) + { + (*i).disconnect(); + } +} + void @@ -100,11 +110,21 @@ Controller_Module::get ( Log_Entry &e ) const Module::get( e ); Port *p = control_output[0].connected_port(); - Module *m = p->module(); - e.add( ":module", m ); - e.add( ":port", m->control_input_port_index( p ) ); - e.add( ":mode", mode() ); + if ( !p ) + { + e.add( ":module", "" ); + e.add( ":port", "" ); + e.add( ":mode", "" ); + } + else + { + Module *m = p->module(); + + e.add( ":module", m ); + e.add( ":port", m->control_input_port_index( p ) ); + e.add( ":mode", mode() ); + } } void @@ -361,7 +381,7 @@ Controller_Module::connect_to ( Port *p ) } else { - { Fl_Arc_Dial *o = new Fl_Arc_Dial( 0, 0, 50, 50, p->name() ); + { Fl_Dial *o = new Fl_Dial( 0, 0, 50, 50, p->name() ); w = o; control = o; @@ -486,6 +506,8 @@ Controller_Module::menu_cb ( const Fl_Menu_ *m ) mode( GUI ); else if ( ! strcmp( picked, "Mode/Control Voltage (JACK)" ) ) mode( CV ); + else if ( ! strcmp( picked, "/Remove" ) ) + command_remove(); } /** build the context menu for this control */ @@ -499,7 +521,8 @@ Controller_Module::menu ( void ) { "Mode", 0, 0, 0, FL_SUBMENU }, { "GUI + OSC", 0, 0, 0, FL_MENU_RADIO | ( mode() == GUI ? FL_MENU_VALUE : 0 ) }, { "Control Voltage (JACK)", 0, 0, 0, FL_MENU_RADIO | ( mode() == CV ? FL_MENU_VALUE : 0 ) }, - { 0 }, + { 0 }, + { "Remove", 0, 0, 0, 0 }, { 0 }, }; @@ -570,6 +593,18 @@ Controller_Module::handle_control_changed ( Port *p ) } } +void +Controller_Module::command_remove ( void ) +{ + if ( is_default() ) + fl_alert( "Default modules may not be deleted." ); + else + { + chain()->remove( this ); + Fl::delete_widget( this ); + } +} + /**********/ /* Engine */ /**********/ diff --git a/mixer/src/Controller_Module.H b/mixer/src/Controller_Module.H index 60b2ba1..de29b85 100644 --- a/mixer/src/Controller_Module.H +++ b/mixer/src/Controller_Module.H @@ -78,10 +78,13 @@ public: void connect_to ( Port *p ); bool connect_spatializer_to ( Module *m ); + void disconnect ( void ); void handle_control_changed ( Port *p ); void handle_chain_name_changed ( void ); + virtual void command_remove ( void ); + LOG_CREATE_FUNC( Controller_Module ); void process ( nframes_t nframes ); diff --git a/mixer/src/DPM.C b/mixer/src/DPM.C index 818b693..92a694d 100644 --- a/mixer/src/DPM.C +++ b/mixer/src/DPM.C @@ -55,7 +55,7 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) : if ( DPM::_gradient[ 0 ] == 0 ) DPM::blend( FL_GREEN, FL_RED ); - box( FL_ROUNDED_BOX ); + box( FL_FLAT_BOX ); color( FL_BACKGROUND_COLOR ); } @@ -114,6 +114,8 @@ DPM::resize ( int X, int Y, int W, int H ) void DPM::draw ( void ) { + if ( !_segments ) + return; snprintf( peak_string, sizeof( peak_string ), "%.1f", peak() ); tooltip( peak_string ); @@ -129,6 +131,8 @@ DPM::draw ( void ) int v = pos( value() ); int pv = pos( peak() ); + int clipv = pos( 0 ); + int bh = h() / _segments; int bw = w() / _segments; @@ -170,11 +174,15 @@ DPM::draw ( void ) for ( int p = lo; p <= hi; p++ ) { - Fl_Color c = DPM::div_color( p ); + Fl_Color c; if ( p > v && p != pv ) c = dim_div_color( p ); - + else if ( p != clipv ) + c = div_color( p ); + else + c = fl_color_average( FL_YELLOW, div_color( p ), 0.40 ); + if ( ! active ) c = fl_inactive( c ); diff --git a/mixer/src/Meter_Indicator_Module.C b/mixer/src/Meter_Indicator_Module.C index ad8e511..8015232 100644 --- a/mixer/src/Meter_Indicator_Module.C +++ b/mixer/src/Meter_Indicator_Module.C @@ -27,9 +27,8 @@ #include #include #include -#include "FL/Crystal_Boxtypes.H" -#include "FL/Fl_Arc_Dial.H" +#include "FL/Fl_Dial.H" #include "FL/Fl_Labelpad_Group.H" #include "FL/Fl_Scalepack.H" @@ -49,7 +48,7 @@ Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default ) : Module ( is_default, 50, 100, name() ) { box( FL_FLAT_BOX ); - color( FL_GREEN ); + color( FL_BACKGROUND_COLOR ); _pad = true; control_value = 0; @@ -57,6 +56,8 @@ Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default ) add_port( Port( this, Port::INPUT, Port::CONTROL ) ); dpm_pack = new Fl_Scalepack( x(), y(), w(), h() ); + dpm_pack->color( FL_BACKGROUND_COLOR ); + dpm_pack->box( FL_FLAT_BOX ); dpm_pack->type( FL_HORIZONTAL ); end(); diff --git a/mixer/src/Meter_Module.C b/mixer/src/Meter_Module.C index 717415c..bb37c3e 100644 --- a/mixer/src/Meter_Module.C +++ b/mixer/src/Meter_Module.C @@ -192,11 +192,7 @@ get_peak_sample ( const sample_t* buf, nframes_t nframes ) for ( int j = nframes; j--; ++f ) { - float s = *f; - - /* rectify */ - if ( s < 0.0f ) - s = 0 - s; + const float s = fabs( *f ); if ( s > p ) p = s; @@ -212,7 +208,8 @@ Meter_Module::process ( nframes_t nframes ) { if ( audio_input[i].connected() ) { - float dB = 20 * log10( get_peak_sample( (float*)audio_input[i].buffer(), nframes ) / 2.0f ); +// float dB = 20 * log10( get_peak_sample( (float*)audio_input[i].buffer(), nframes ) / 2.0f ); + float dB = 20 * log10( get_peak_sample( (float*)audio_input[i].buffer(), nframes ) ); ((float*)control_output[0].buffer())[i] = dB; control_value[i] = dB; diff --git a/mixer/src/Mixer.C b/mixer/src/Mixer.C index ca3f6f6..5273969 100644 --- a/mixer/src/Mixer.C +++ b/mixer/src/Mixer.C @@ -35,6 +35,7 @@ #include "FL/Fl_Menu_Settings.H" #include "About_Dialog.H" #include +#include "FL/Fl_Theme_Chooser.H" #include "file.h" @@ -44,17 +45,11 @@ #include #include "FL/Fl_Value_SliderX.H" -#include "FL/color_scheme.H" #include "OSC/Endpoint.H" #include -#include "FL/Fl_Blinker.H" - -#include "OSC/Endpoint.H" const double STATUS_UPDATE_FREQ = 0.2f; -const double OSC_INTERVAL = 1.0 / 20.0; /* 20 hz */ - extern char *user_config_dir; extern char *instance_name; @@ -89,8 +84,11 @@ static int osc_add_strip ( const char *path, const char *, lo_arg **, int , lo_m { OSC_DMSG(); + Fl::lock(); ((Mixer*)(OSC_ENDPOINT())->owner)->command_add_strip(); + Fl::unlock(); + OSC_REPLY_OK(); return 0; @@ -102,19 +100,29 @@ Mixer::reply_to_finger ( lo_message msg ) int argc = lo_message_get_argc( msg ); lo_arg **argv = lo_message_get_argv( msg ); - if ( argc < 1 ) - return; + if ( argc >= 4 ) + { + const char *url = &argv[0]->s; + const char *name = &argv[1]->s; + const char *version = &argv[2]->s; + const char *id = &argv[3]->s; - lo_address to = lo_address_new_from_url( &argv[0]->s ); + MESSAGE( "Discovered NON peer %s (%s) @ %s with ID \"%s\"", name, version, url, id ); + MESSAGE( "Registering Signals" ); - osc_endpoint->send( to, - "/non/hello", - osc_endpoint->url(), - APP_NAME, - VERSION, - instance_name ); - - lo_address_free( to ); + lo_address to = lo_address_new_from_url( &argv[0]->s ); + + osc_endpoint->send( to, + "/non/hello", + osc_endpoint->url(), + APP_NAME, + VERSION, + instance_name ); + + mixer->osc_endpoint->hello( url ); + + lo_address_free( to ); + } } void @@ -273,51 +281,23 @@ void Mixer::cb_menu(Fl_Widget* o) { { rows( 3 ); } - else if (! strcmp( picked, "&Options/&Display/&Style/&Default") ) + else if (! strcmp( picked, "&View/&Theme") ) { - Fl::scheme( "gtk+" ); - } - else if (! strcmp( picked, "&Options/&Display/&Style/&Flat") ) - { - Fl::scheme( "gtk+" ); - } - else if (! strcmp( picked, "&Options/&Display/&Style/&Round") ) - { - Fl::scheme( "plastic" ); - } - else if (! strcmp( picked, "&Options/&Display/&Colors/&System") ) - { - color_scheme( "system" ); - } - else if (! strcmp( picked, "&Options/&Display/&Colors/&Dark") ) - { - color_scheme( "dark" ); - } - else if (! strcmp( picked, "&Options/&Display/&Colors/&Very Dark") ) - { - color_scheme( "very dark" ); - } - else if (! strcmp( picked, "&Options/&Display/&Colors/&Light") ) - { - color_scheme( "light" ); - } - else if (! strcmp( picked, "&Options/&Display/&Colors/&Gray") ) - { - color_scheme( "gray" ); + fl_theme_chooser(); } else if (! strcmp( picked, "&Options/&Display/&Knobs/&Burnished") ) { - Fl_Arc_Dial::default_style( Fl_Arc_Dial::BURNISHED_DIAL ); + Fl_Dial::default_style( Fl_Dial::BURNISHED_DIAL ); redraw_windows(); } else if (! strcmp( picked, "&Options/&Display/&Knobs/&Arc") ) { - Fl_Arc_Dial::default_style( Fl_Arc_Dial::ARC_DIAL ); + Fl_Dial::default_style( Fl_Dial::ARC_DIAL ); redraw_windows(); } else if (! strcmp( picked, "&Options/&Display/&Knobs/&Plastic") ) { - Fl_Arc_Dial::default_style( Fl_Arc_Dial::PLASTIC_DIAL ); + Fl_Dial::default_style( Fl_Dial::PLASTIC_DIAL ); redraw_windows(); } else if (! strcmp( picked, "&Options/&Display/&Sliders/&Nice") ) @@ -377,74 +357,68 @@ void Mixer::cb_menu(Fl_Widget* o, void* v) { Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) : Fl_Group( X, Y, W, H, L ) { - get_system_colors(); - - Fl::scheme( "plastic" ); - color_scheme( "dark" ); - Loggable::dirty_callback( &Mixer::handle_dirty, this ); _rows = 1; - box( FL_NO_BOX ); + box( FL_FLAT_BOX ); labelsize( 96 ); - { Fl_Menu_Bar *o = menubar = new Fl_Menu_Bar( X, Y, W, 24 ); - o->add( "&Project/&New" ); - o->add( "&Project/&Open" ); - o->add( "&Project/&Save", FL_CTRL + 's', 0, 0 ); - o->add( "&Project/&Quit", FL_CTRL + 'q', 0, 0 ); - o->add( "&Mixer/&Add Strip", 'a', 0, 0 ); - o->add( "&Mixer/Add &N Strips" ); - o->add( "&Mixer/&Import Strip" ); - o->add( "&Mixer/&Rows/One", '1', 0, 0 ); - o->add( "&Mixer/&Rows/Two", '2', 0, 0 ); - o->add( "&Mixer/&Rows/Three", '3', 0, 0 ); - o->add( "_&Options/&Display/&Style/&Default", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); - o->add( "_&Options/&Display/&Style/&Flat", 0, 0, 0, FL_MENU_RADIO ); - o->add( "_&Options/&Display/&Style/&Round", 0, 0, 0, FL_MENU_RADIO ); - o->add( "_&Options/&Display/&Colors/&Dark", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); - o->add( "_&Options/&Display/&Colors/&Very Dark", 0, 0, 0, FL_MENU_RADIO ); - o->add( "_&Options/&Display/&Colors/&Light", 0, 0, 0, FL_MENU_RADIO ); - o->add( "_&Options/&Display/&Colors/&Gray", 0, 0, 0, FL_MENU_RADIO ); - o->add( "_&Options/&Display/&Colors/&System", 0, 0, 0, FL_MENU_RADIO ); - o->add( "_&Options/&Display/&Knobs/&Arc", 0, 0, 0, FL_MENU_RADIO ); - o->add( "_&Options/&Display/&Knobs/&Burnished", 0, 0, 0, FL_MENU_RADIO ); - o->add( "_&Options/&Display/&Knobs/&Plastic", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); - o->add( "_&Options/&Display/&Sliders/&Nice", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); - o->add( "_&Options/&Display/&Sliders/&Fill", 0, 0, 0, FL_MENU_RADIO ); - o->add( "_&Options/&Display/&Sliders/&Simple", 0, 0, 0, FL_MENU_RADIO ); - o->add( "_&Options/&Display/&Colors/&System", 0, 0, 0, FL_MENU_RADIO ); - o->add( "&Help/&Manual" ); - o->add( "&Help/&About" ); - o->callback( cb_menu, this ); + { Fl_Group *o = new Fl_Group( X, Y, W, 24 ); + + { Fl_Menu_Bar *o = menubar = new Fl_Menu_Bar( X, Y, W, 24 ); + o->add( "&Project/&New" ); + o->add( "&Project/&Open" ); + o->add( "&Project/&Save", FL_CTRL + 's', 0, 0 ); + o->add( "&Project/&Quit", FL_CTRL + 'q', 0, 0 ); + o->add( "&Mixer/&Add Strip", 'a', 0, 0 ); + o->add( "&Mixer/Add &N Strips" ); + o->add( "&Mixer/&Import Strip" ); + o->add( "&Mixer/&Rows/One", '1', 0, 0 ); + o->add( "&Mixer/&Rows/Two", '2', 0, 0 ); + o->add( "&Mixer/&Rows/Three", '3', 0, 0 ); + o->add( "&View/&Theme", 0, 0, 0 ); + o->add( "_&Options/&Display/&Knobs/&Arc", 0, 0, 0, FL_MENU_RADIO ); + o->add( "_&Options/&Display/&Knobs/&Burnished", 0, 0, 0, FL_MENU_RADIO ); + o->add( "_&Options/&Display/&Knobs/&Plastic", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); + o->add( "_&Options/&Display/&Sliders/&Nice", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); + o->add( "_&Options/&Display/&Sliders/&Fill", 0, 0, 0, FL_MENU_RADIO ); + o->add( "_&Options/&Display/&Sliders/&Simple", 0, 0, 0, FL_MENU_RADIO ); + o->add( "_&Options/&Display/&Colors/&System", 0, 0, 0, FL_MENU_RADIO ); + o->add( "&Help/&Manual" ); + o->add( "&Help/&About" ); + o->callback( cb_menu, this ); + } + { Fl_Box *o = project_name = new Fl_Box( X + 150, Y, W, 24 ); + o->labelfont( FL_HELVETICA_ITALIC ); + o->label( 0 ); + o->align( FL_ALIGN_INSIDE | FL_ALIGN_CENTER ); + o->labeltype( FL_SHADOW_LABEL ); + Fl_Group::current()->resizable( o ); + } + { sm_blinker = new Fl_Button( ( X + W) - 37, Y + 4, 35, 15, "SM"); + sm_blinker->box(FL_ROUNDED_BOX); + sm_blinker->down_box(FL_ROUNDED_BOX); + sm_blinker->color(FL_DARK2); + sm_blinker->selection_color((Fl_Color)93); + sm_blinker->labeltype(FL_NORMAL_LABEL); + sm_blinker->labelfont(3); + sm_blinker->labelsize(14); + sm_blinker->labelcolor(FL_DARK3); + sm_blinker->align(Fl_Align(FL_ALIGN_CENTER)); + sm_blinker->when(FL_WHEN_RELEASE); + sm_blinker->deactivate(); + + } // Fl_Blink_Button* sm_blinker + o->end(); } - { Fl_Box *o = project_name = new Fl_Box( X + 150, Y, W, 24 ); - o->labelfont( FL_HELVETICA_ITALIC ); - o->label( 0 ); - o->align( FL_ALIGN_INSIDE | FL_ALIGN_CENTER ); - o->labeltype( FL_SHADOW_LABEL ); - } - { sm_blinker = new Fl_Blinker( ( X + W) - 52, Y + 4, 50, 15, "SM"); - sm_blinker->box(FL_ROUNDED_BOX); - sm_blinker->down_box(FL_ROUNDED_BOX); - sm_blinker->color((Fl_Color)75); - sm_blinker->selection_color((Fl_Color)86); - sm_blinker->labeltype(FL_NORMAL_LABEL); - sm_blinker->labelfont(2); - sm_blinker->labelsize(14); - sm_blinker->labelcolor(FL_DARK3); - sm_blinker->align(Fl_Align(FL_ALIGN_CENTER)); - sm_blinker->when(FL_WHEN_RELEASE); - sm_blinker->deactivate(); - } // Fl_Blinker* sm_blinker { Fl_Scroll *o = scroll = new Fl_Scroll( X, Y + 24, W, H - 24 ); - o->box( FL_NO_BOX ); + o->box( FL_FLAT_BOX ); // o->type( Fl_Scroll::HORIZONTAL_ALWAYS ); // o->box( Fl_Scroll::BOTH ); { Fl_Flowpack *o = mixer_strips = new Fl_Flowpack( X, Y + 24, W, H - 18 - 24 ); - label( "Non-Mixer" ); +// label( "Non-Mixer" ); align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE) ); - o->box( FL_NO_BOX ); + o->box( FL_FLAT_BOX ); o->type( Fl_Pack::HORIZONTAL ); o->hspacing( 2 ); o->vspacing( 2 ); @@ -478,21 +452,11 @@ Mixer::init_osc ( const char *osc_port ) osc_endpoint->add_method( "/non/mixer/add_strip", "", osc_add_strip, osc_endpoint, "" ); -// osc_endpoint->start(); - - /* poll so we can keep OSC handlers running in the GUI thread and avoid extra sync */ - Fl::add_timeout( OSC_INTERVAL, check_osc, this ); + osc_endpoint->start(); return 0; } -void -Mixer::check_osc ( void * v ) -{ - ((Mixer*)v)->osc_endpoint->check(); - Fl::repeat_timeout( OSC_INTERVAL, check_osc, v ); - -} Mixer::~Mixer ( ) { diff --git a/mixer/src/Mixer.H b/mixer/src/Mixer.H index 1df1b28..5005960 100644 --- a/mixer/src/Mixer.H +++ b/mixer/src/Mixer.H @@ -26,7 +26,9 @@ #include #include "Mixer_Strip.H" -class Fl_Blinker; +#include "Thread.H" + +class Fl_Blink_Button; class Fl_Flowpack; class Fl_Menu_Bar; namespace OSC { class Endpoint; } @@ -38,10 +40,10 @@ class Mixer : public Fl_Group public: OSC::Endpoint *osc_endpoint; - Fl_Blinker *sm_blinker; + Fl_Button *sm_blinker; private: - + int _rows; Fl_Color system_colors[3]; @@ -98,8 +100,6 @@ public: Mixer ( int X, int Y, int W, int H, const char *L ); virtual ~Mixer(); - static void check_osc ( void * v ); - void reply_to_finger ( lo_message msg ); void announce ( const char *nash_url, const char *process_name ); diff --git a/mixer/src/Mixer_Strip.C b/mixer/src/Mixer_Strip.C index cbd5230..0b2c440 100644 --- a/mixer/src/Mixer_Strip.C +++ b/mixer/src/Mixer_Strip.C @@ -359,8 +359,7 @@ Mixer_Strip::init ( ) _gain_controller_mode = 0; _chain = 0; -// box(FL_THIN_UP_BOX); - box( FL_RFLAT_BOX ); + box( FL_BORDER_BOX ); labeltype( FL_NO_LABEL ); Fl_Group::color( FL_BACKGROUND_COLOR ); diff --git a/mixer/src/Mixer_Strip.H b/mixer/src/Mixer_Strip.H index 968f96a..06b9768 100644 --- a/mixer/src/Mixer_Strip.H +++ b/mixer/src/Mixer_Strip.H @@ -25,8 +25,7 @@ #include #include #include -#include -#include +#include #include #include #include diff --git a/mixer/src/Module.C b/mixer/src/Module.C index 03c4089..4de5e19 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -41,6 +41,8 @@ #include "OSC/Endpoint.H" +#include "string_util.h" + Module *Module::_copied_module_empty = 0; @@ -188,8 +190,15 @@ Module::paste_before ( void ) { Module *m = _copied_module_empty; - m->chain( chain() ); Log_Entry le( _copied_module_settings ); + le.remove( ":chain" ); + + char *print = le.print(); + + DMESSAGE( "Pasting settings: %s", print ); + + free( print ); + m->set( le ); if ( ! chain()->insert( this, m ) ) @@ -201,7 +210,7 @@ Module::paste_before ( void ) _copied_module_settings = NULL; _copied_module_empty = NULL; - /* set up for another copy */ + /* set up for another paste */ m->copy(); } @@ -243,20 +252,19 @@ Module::Port::generate_osc_path () else asprintf( &path, "/strip/%s/%s/%s", module()->chain()->name(), p->module()->label(), p->name() ); - // Hack to keep spaces out of OSC URL... Probably need to handle other special characters similarly. - for ( int i = strlen( path ); i--; ) - { - if ( path[i] == ' ' || path[i] == ',' ) - path[i] = '_'; - } + char *s = escape_url( path ); + + free( path ); + + path = s; return path; } void -Module::Port::handle_signal_connection_state_changed ( OSC::Signal * ) +Module::Port::handle_signal_connection_state_changed ( OSC::Signal *, void *o ) { - module()->redraw(); + ((Module::Port*)o)->module()->redraw(); } void @@ -286,8 +294,8 @@ Module::Port::change_osc_path ( char *path ) 0.0, 1.0, scaled_default, &Module::Port::osc_control_change_cv, this ); - _scaled_signal->signal_connection_state_changed.connect( - sigc::mem_fun( this, &Module::Port::handle_signal_connection_state_changed ) ); + + _scaled_signal->connection_state_callback( handle_signal_connection_state_changed, this ); _unscaled_signal = mixer->osc_endpoint->add_signal( unscaled_path, OSC::Signal::Input, @@ -314,6 +322,8 @@ Module::Port::osc_control_change_exact ( float v, void *user_data ) { Module::Port *p = (Module::Port*)user_data; + Fl::lock(); + float f = v; if ( p->hints.ranged ) @@ -326,6 +336,8 @@ Module::Port::osc_control_change_exact ( float v, void *user_data ) p->control_value( f ); + Fl::unlock(); + // mixer->osc_endpoint->send( lo_message_get_source( msg ), "/reply", path, f ); return 0; @@ -338,6 +350,8 @@ Module::Port::osc_control_change_cv ( float v, void *user_data ) float f = v; + Fl::lock(); + // clamp value to control voltage range. if ( f > 1.0 ) f = 1.0; @@ -353,9 +367,10 @@ Module::Port::osc_control_change_cv ( float v, void *user_data ) f = ( f * scale ) + offset; } - + p->control_value( f ); + Fl::unlock(); // mixer->osc_endpoint->send( lo_message_get_source( msg ), "/reply", path, f ); return 0; @@ -421,6 +436,26 @@ Module::set ( Log_Entry &e ) +void +Module::chain ( Chain *v ) +{ + if ( _chain != v ) + { + DMESSAGE( "Adding module %s in to chain %s", label(), v ? v->name() : "NULL" ); + + _chain = v; + + for ( int i = 0; i < ncontrol_inputs(); ++i ) + { + control_input[i].update_osc_port(); + } + } + else + { + DMESSAGE( "Module %s already belongs to chain %s", label(), v ? v->name() : "NULL" ); + } +} + /* return a string serializing this module's parameter settings. The format is 1.0:2.0:... Where 1.0 is the value of the first control input, 2.0 is the value of the second control input etc. diff --git a/mixer/src/Module.H b/mixer/src/Module.H index 51e24ca..e28b603 100644 --- a/mixer/src/Module.H +++ b/mixer/src/Module.H @@ -184,7 +184,9 @@ public: void control_value_no_callback ( float f ) { - THREAD_ASSERT( UI ); + /* can also be called from the OSC thread */ + ASSERT( Thread::is( "UI" ) || Thread::is( "OSC" ), + "Function called from wrong thread! (is %s)", Thread::current()->name() ); if ( buffer() ) { @@ -259,7 +261,7 @@ public: OSC::Signal *_scaled_signal; OSC::Signal *_unscaled_signal; - void handle_signal_connection_state_changed ( OSC::Signal *s ); + static void handle_signal_connection_state_changed ( OSC::Signal *, void *o ); }; void bbox ( int &X, int &Y, int &W, int &H ) @@ -371,18 +373,7 @@ public: } Chain *chain ( void ) const { return _chain; } - void chain ( Chain * v ) - { - if ( _chain != v ) - { - _chain = v; - - for ( int i = 0; i < ncontrol_inputs(); ++i ) - { - control_input[i].update_osc_port(); - } - } - } + void chain ( Chain * v ); char *get_parameters ( void ) const; void set_parameters ( const char * ); @@ -435,8 +426,8 @@ protected: public: void command_open_parameter_editor(); - void command_activate ( void ); - void command_deactivate ( void ); - void command_remove ( void ); + virtual void command_activate ( void ); + virtual void command_deactivate ( void ); + virtual void command_remove ( void ); }; diff --git a/mixer/src/Module_Parameter_Editor.C b/mixer/src/Module_Parameter_Editor.C index e6c3830..7786e7e 100644 --- a/mixer/src/Module_Parameter_Editor.C +++ b/mixer/src/Module_Parameter_Editor.C @@ -17,6 +17,8 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*******************************************************************************/ +#include + #include #include #include @@ -27,11 +29,10 @@ #include #include #include -#include "FL/Crystal_Boxtypes.H" #include "FL/Fl_Flowpack.H" #include "FL/Fl_Labelpad_Group.H" #include "FL/Fl_Value_SliderX.H" -#include "FL/Fl_Arc_Dial.H" +#include "FL/Fl_Dial.H" #include "Module.H" #include "Module_Parameter_Editor.H" @@ -43,7 +44,7 @@ -Module_Parameter_Editor::Module_Parameter_Editor ( Module *module ) : Fl_Double_Window( 0, 0, 800, 600 ) +Module_Parameter_Editor::Module_Parameter_Editor ( Module *module ) : Fl_Double_Window( 800, 600 ) { _module = module; _resized = false; @@ -199,7 +200,7 @@ Module_Parameter_Editor::make_controls ( void ) { if ( mode_choice->value() == 0 ) { - Fl_Arc_Dial *o = new Fl_Arc_Dial( 0, 0, 60, 60, p->name() ); + Fl_Dial *o = new Fl_Dial( 0, 0, 60, 60, p->name() ); w = o; if ( p->hints.ranged ) diff --git a/mixer/src/NSM.C b/mixer/src/NSM.C index 33d8b6d..491d177 100644 --- a/mixer/src/NSM.C +++ b/mixer/src/NSM.C @@ -43,7 +43,7 @@ NSM_Client::command_broadcast ( const char *path, lo_message msg ) int argc = lo_message_get_argc( msg ); // lo_arg **argv = lo_message_get_argv( msg ); - if ( argc == 1 && !strcmp( path, "/non/finger" ) ) + if ( !strcmp( path, "/non/hello" ) ) { mixer->reply_to_finger( msg ); return 0; diff --git a/mixer/src/Panner.C b/mixer/src/Panner.C index b802388..5d63258 100644 --- a/mixer/src/Panner.C +++ b/mixer/src/Panner.C @@ -18,9 +18,11 @@ /*******************************************************************************/ #include "Panner.H" - +#include +#include #include #include +// #include /* 2D Panner widget. Supports various multichannel configurations. */ @@ -81,8 +83,11 @@ Panner::point_bbox ( const Point *p, int *X, int *Y, int *W, int *H ) const bbox( tx, ty, tw, th ); - tw -= pw(); - th -= ph(); + const float PW = pw(); + const float PH = ph(); + + tw -= PW; + th -= PH; float px, py; @@ -91,8 +96,8 @@ Panner::point_bbox ( const Point *p, int *X, int *Y, int *W, int *H ) const *X = tx + ((tw / 2) * px + (tw / 2)); *Y = ty + ((th / 2) * py + (th / 2)); - *W = pw(); - *H = ph(); + *W = PW; + *H = PH; } Panner::Point * @@ -115,36 +120,13 @@ Panner::event_point ( void ) return NULL; } + void -Panner::draw ( void ) +Panner::draw_the_box ( int tx, int ty, int tw, int th ) { draw_box(); -// draw_box( FL_FLAT_BOX, x(), y(), w(), h(), FL_BLACK ); - draw_label(); - - if ( _bypassed ) - { - fl_color( 0 ); - fl_font( FL_HELVETICA, 12 ); - fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER ); - return; - } - - int tw, th, tx, ty; - - bbox( tx, ty, tw, th ); - - fl_push_clip( tx, ty, tw, th ); - - fl_color( FL_RED ); - - const int b = 10; - - tx += b; - ty += b; - tw -= b * 2; - th -= b * 2; + fl_line_style( FL_SOLID, 2 ); /* draw perimeter */ { @@ -154,8 +136,8 @@ Panner::draw ( void ) if ( Fl::belowmouse() == this ) { iter = 12; - c1 = fl_darker( FL_RED ); - c2 = FL_GRAY; + c1 = fl_darker( fl_darker( FL_RED ) ); + c2 = FL_BLACK; } else { @@ -172,11 +154,58 @@ Panner::draw ( void ) fl_arc( tx + (i * (tw / iter)) / 2, ty + (i * (th / iter)) / 2, tw - (i * (tw / iter)), th - (i * ( th / iter )), 0, 360 ); + /* fl_arc( cr, */ + /* tx + tw / 2, */ + /* ty + th / 2, */ + /* ((float)tw / iter) / 2, */ + /* 0, 360 ); */ + c = fl_color_average( c1, c2, (float)i / iter); } } -/* fl_color( FL_WHITE ); */ + fl_line_style( FL_SOLID, 0 ); + +} + +void +Panner::draw ( void ) +{ + int tw, th, tx, ty; + + bbox( tx, ty, tw, th ); + + fl_push_clip( tx, ty, tw, th ); + + + const int b = 10; + +// draw_box(); + draw_label(); + + if ( _bypassed ) + { + draw_box(); + fl_color( 0 ); + fl_font( FL_HELVETICA, 12 ); + fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER ); + goto done; + } + + + tx += b; + ty += b; + tw -= b * 2; + th -= b * 2; + + if ( damage() & FL_DAMAGE_ALL ) + draw_the_box( tx, ty, tw, th ); + + fl_line_style( FL_SOLID, 2 ); + +// fl_color( FL_RED ); + + fl_color( FL_WHITE ); /* fl_arc( tx, ty, tw, th, 0, 360 ); */ @@ -225,23 +254,52 @@ Panner::draw ( void ) int px, py, pw, ph; point_bbox( p, &px, &py, &pw, &ph ); - /* draw point */ - if ( p != drag ) - fl_color( c ); - else - fl_color( FL_WHITE ); - fl_pie( px, py, pw, ph, 0, 360 ); - /* draw echo */ - fl_color( c = fl_darker( c ) ); - fl_arc( px - 5, py - 5, pw + 10, ph + 10, 0, 360 ); - if ( Fl::belowmouse() == this ) { + + const float S = ( 0.5 + ( 1.0f - p->d ) ); + + float po = 5 * S; + + fl_push_clip( px - ( po * 12 ), + py - ( po * 12 ), + pw + ( po * 24 ), ph + (po * 24 )); + + if ( damage() & FL_DAMAGE_EXPOSE ) + draw_the_box( tx, ty, tw, th ); + + fl_color( FL_WHITE ); + + /* draw point */ + if ( p != drag ) + fl_color( c ); + + fl_pie( px, py, pw, ph, 0, 360 ); + + /* draw echo */ fl_color( c = fl_darker( c ) ); - fl_arc( px - 10, py - 10, pw + 20, ph + 20, 0, 360 ); +// fl_color_alpha( c = fl_darker( c ), 0.5 ); + +// fl_arc( cr, px, py, pw + po * 1, 0, 360 ); + fl_arc( px - po, py - po, pw + ( po * 2 ), ph + ( po * 2 ), 0, 360 ); + + if ( Fl::belowmouse() == this ) + { + fl_color( c = fl_darker( c ) ); + +// fl_color_alpha( c = fl_darker( c ), 0.5 ); + fl_arc( px - ( po * 2 ), py - ( po * 2 ), pw + ( po * 4 ), ph + ( po * 4 ), 0, 360 ); + /* fl_arc( cr, px, py, pw + po * 1, 0, 360 ); */ + fl_color( c = fl_darker( c ) ); - fl_arc( px - 30, py - 30, pw + 60, ph + 60, 0, 360 ); + +// fl_color_alpha( c = fl_darker( c ), 0.5 ); + fl_arc( px - ( po * 4 ), py - ( po * 4 ), pw + ( po * 8 ), ph + (po * 8 ), 0, 360 ); + /* fl_arc( cr, px, py, pw + po * 1, 0, 360 ); */ + } + + fl_pop_clip(); } /* draw number */ @@ -258,6 +316,9 @@ Panner::draw ( void ) /* fl_line( bx + pw() / 2, by + ph() / 2, tx + (tw / 2), ty + (th / 2) ); */ } +done: + + fl_line_style( FL_SOLID, 0 ); fl_pop_clip(); } @@ -281,17 +342,19 @@ Panner::handle ( int m ) redraw(); return 1; case FL_PUSH: - + { if ( Fl::event_button2() ) { _bypassed = ! _bypassed; redraw(); return 1; } - else if ( Fl::event_button1() && ( drag = event_point() ) ) - return 1; - else - return 0; + + if ( Fl::event_button1() ) + drag = event_point(); + + return 1; + } case FL_RELEASE: if ( Fl::event_button1() && drag ) { @@ -311,6 +374,10 @@ Panner::handle ( int m ) if ( ! drag ) return 0; + /* else if ( Fl::event_button1() && ( drag = event_point() ) ) */ + /* return 1; */ + /* else */ + float X = Fl::event_x() - x(); float Y = Fl::event_y() - y(); @@ -325,7 +392,7 @@ Panner::handle ( int m ) if ( when() & FL_WHEN_CHANGED ) do_callback(); - redraw(); + damage(FL_DAMAGE_EXPOSE); return 1; } diff --git a/mixer/src/Panner.H b/mixer/src/Panner.H index 910ec26..08943c0 100644 --- a/mixer/src/Panner.H +++ b/mixer/src/Panner.H @@ -31,6 +31,8 @@ using namespace std; class Panner : public Fl_Widget { + void draw_the_box( int, int, int, int ); + struct Point { /* axes */ diff --git a/mixer/src/Plugin_Module.C b/mixer/src/Plugin_Module.C index 57f3bb9..aff05d8 100644 --- a/mixer/src/Plugin_Module.C +++ b/mixer/src/Plugin_Module.C @@ -461,11 +461,19 @@ Plugin_Module::load ( unsigned long id ) { p.hints.ranged = true; p.hints.minimum = _idata->descriptor->PortRangeHints[i].LowerBound; + if ( LADSPA_IS_HINT_SAMPLE_RATE(hd) ) + { + p.hints.minimum *= Engine::sample_rate(); + } } if ( LADSPA_IS_HINT_BOUNDED_ABOVE(hd) ) { p.hints.ranged = true; p.hints.maximum = _idata->descriptor->PortRangeHints[i].UpperBound; + if ( LADSPA_IS_HINT_SAMPLE_RATE(hd) ) + { + p.hints.maximum *= Engine::sample_rate(); + } } if ( LADSPA_IS_HINT_HAS_DEFAULT(hd) ) diff --git a/mixer/src/main.C b/mixer/src/main.C index 5de2b53..8e3acff 100644 --- a/mixer/src/main.C +++ b/mixer/src/main.C @@ -32,8 +32,8 @@ #include #include #include -#include -#include +#include "FL/themes.H" +#include "FL/Fl_Theme.H" #include "Thread.H" #include "debug.h" @@ -57,6 +57,7 @@ #include "NSM.H" #include +#include #ifdef HAVE_XPM #include "FL/Fl.H" @@ -107,7 +108,7 @@ check_nsm ( void * v ) Fl::repeat_timeout( NSM_CHECK_INTERVAL, check_nsm, v ); } -static int got_sigterm = 0; +static volatile int got_sigterm = 0; void sigterm_handler ( int ) @@ -129,17 +130,10 @@ check_sigterm ( void * ) int main ( int argc, char **argv ) { + bool no_ui = false; printf( "%s %s %s -- %s\n", APP_TITLE, VERSION, "", COPYRIGHT ); -#ifdef HAVE_XPM - fl_open_display(); - Pixmap p, mask; - - XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display), - (char**)icon_16x16, &p, &mask, NULL); -#endif - Thread::init(); Thread thread( "UI" ); @@ -156,9 +150,6 @@ main ( int argc, char **argv ) Fl_Tooltip::size( 14 ); Fl_Tooltip::hoverdelay( 0.1f ); - Fl::visible_focus( 0 ); - - fl_register_images(); LOG_REGISTER_CREATE( Mixer_Strip ); LOG_REGISTER_CREATE( Chain ); @@ -170,40 +161,8 @@ main ( int argc, char **argv ) LOG_REGISTER_CREATE( Meter_Indicator_Module ); LOG_REGISTER_CREATE( Controller_Module ); - init_crystal_boxtypes(); - init_gleam_boxtypes(); - signal( SIGPIPE, SIG_IGN ); - Fl::get_system_colors(); - Fl::scheme( "gtk+" ); - - Fl::lock(); - - Fl_Double_Window *main_window; - - { - Fl_Double_Window *o = main_window = new Fl_Double_Window( 800, 600, "Non-DAW : Mixer" ); - { - main_window->xclass( APP_NAME ); - - { - Fl_Widget *o = mixer = new Mixer( 0, 0, main_window->w(), main_window->h(), NULL ); - Fl_Group::current()->resizable(o); - } - } - o->end(); - - o->size_range( main_window->w(), mixer->min_h(), 0, 0 ); - - o->callback( (Fl_Callback*)cb_main, main_window ); - - -#ifdef HAVE_XPM - o->icon((char *)p); -#endif - o->show( 0, 0 ); - } const char *osc_port = NULL; @@ -217,6 +176,7 @@ main ( int argc, char **argv ) { "help", no_argument, 0, '?' }, { "instance", required_argument, 0, 'i' }, { "osc-port", required_argument, 0, 'p' }, + { "no-ui", no_argument, 0, 'u' }, { 0, 0, 0, 0 } }; @@ -238,6 +198,10 @@ main ( int argc, char **argv ) instance_name = strdup( optarg ); instance_override = true; break; + case 'u': + DMESSAGE( "Disabling user interface" ); + no_ui = true; + break; case '?': printf( "\nUsage: %s [--instance instance_name] [--osc-port portnum] [path_to_project]\n\n", argv[0] ); exit(0); @@ -245,6 +209,70 @@ main ( int argc, char **argv ) } } + { + char *name = strdup( argv[0] ); + char *n = basename( name ); + + if ( ! strcmp( n, "non-mixer-noui" ) ) + no_ui = true; + + free( name ); + } + + Pixmap p, mask; + + if ( ! no_ui ) + { + Fl::visual( FL_DOUBLE | FL_RGB ); + +#ifdef HAVE_XPM + fl_open_display(); + + XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display), + (char**)icon_16x16, &p, &mask, NULL); +#endif + + Fl::visible_focus( 0 ); + + fl_register_images(); + } + + Fl::lock(); + + Fl_Double_Window *main_window; + + { + Fl_Double_Window *o = main_window = new Fl_Double_Window( 800, 600, "Non-DAW : Mixer" ); + { + main_window->xclass( APP_NAME ); + + { + Fl_Widget *o = mixer = new Mixer( 0, 0, main_window->w(), main_window->h(), NULL ); + Fl_Group::current()->resizable(o); + } + } + o->end(); + + o->size_range( main_window->w(), mixer->min_h(), 0, 0 ); + + o->callback( (Fl_Callback*)cb_main, main_window ); + + if ( ! no_ui ) + { +#ifdef HAVE_XPM + o->icon((char *)p); +#endif + o->show( 0, 0 ); + } + } + + if ( ! no_ui ) + { + fl_register_themes(); + + Fl_Theme::set(); + } + Plugin_Module::spawn_discover_thread(); mixer->init_osc( osc_port ); @@ -263,8 +291,11 @@ main ( int argc, char **argv ) nsm->announce( APP_NAME, ":switch:dirty:", argv[0] ); - // poll so we can keep OSC handlers running in the GUI thread and avoid extra sync - Fl::add_timeout( NSM_CHECK_INTERVAL, check_nsm, NULL ); + /* if ( ! no_ui ) */ + /* { */ + // poll so we can keep OSC handlers running in the GUI thread and avoid extra sync + Fl::add_timeout( NSM_CHECK_INTERVAL, check_nsm, NULL ); + /* } */ } } else @@ -283,9 +314,25 @@ main ( int argc, char **argv ) } } - Fl::add_check( check_sigterm ); + mixer->say_hello(); - Fl::run(); + Fl::add_check( check_sigterm ); + + if ( ! no_ui ) + { + DMESSAGE( "Running UI..." ); + + Fl::run(); + } + else + { + DMESSAGE( "Not Running UI..." ); + while ( ! got_sigterm ) + { + Fl::check(); + usleep( 200 * 1000 ); + } + } delete main_window; main_window = NULL; diff --git a/nonlib/Log_Entry.C b/nonlib/Log_Entry.C index ae6b6c8..5857e4e 100644 --- a/nonlib/Log_Entry.C +++ b/nonlib/Log_Entry.C @@ -280,6 +280,19 @@ Log_Entry::get ( int n, const char **name, const char **value ) const } +void +Log_Entry::remove ( const char *name ) +{ + for ( int i = 0; i < _i; i++ ) + { + if ( !strcmp( _sa[ i ], name ) ) + { + free( _sa[i] ); + _sa[i] = NULL; + } + } +} + char ** Log_Entry::sa ( void ) { diff --git a/nonlib/Log_Entry.H b/nonlib/Log_Entry.H index eb4e0d7..93730c8 100644 --- a/nonlib/Log_Entry.H +++ b/nonlib/Log_Entry.H @@ -88,6 +88,9 @@ public: /* _sa.push( p ); \ */ /* } \ */ + + void remove ( const char *s ); + ADD( int, "%d", v ); ADD( nframes_t, "%lu", (unsigned long)v ); ADD( unsigned long, "%lu", v ); diff --git a/nonlib/Loggable.C b/nonlib/Loggable.C index 89e8d79..3c6c009 100644 --- a/nonlib/Loggable.C +++ b/nonlib/Loggable.C @@ -36,6 +36,8 @@ // #include "const.h" #include "debug.h" +#include "Mutex.H" + #include using std::min; using std::max; @@ -64,8 +66,11 @@ void *Loggable::_dirty_callback_arg = NULL; +static Mutex _lock; + Loggable::~Loggable ( ) { + Locker lock( _lock );; _loggables[ _id ].loggable = NULL; } @@ -74,12 +79,15 @@ Loggable::~Loggable ( ) void Loggable::block_start ( void ) { + Locker lock( _lock );; ++Loggable::_level; } void Loggable::block_end ( void ) { + Locker lock( _lock );; + --Loggable::_level; ASSERT( Loggable::_level >= 0, "Programming error" ); @@ -236,17 +244,17 @@ Loggable::close ( void ) if ( ! snapshot( "snapshot" ) ) WARNING( "Failed to create snapshot" ); + if ( ! save_unjournaled_state() ) + WARNING( "Failed to save unjournaled state" ); + for ( std::map ::iterator i = _loggables.begin(); i != _loggables.end(); ++i ) + { if ( i->second.loggable ) delete i->second.loggable; - - save_unjournaled_state(); - - for ( std::map ::iterator i = _loggables.begin(); - i != _loggables.end(); ++i ) if ( i->second.unjournaled_state ) delete i->second.unjournaled_state; + } _loggables.clear(); @@ -271,6 +279,10 @@ Loggable::save_unjournaled_state ( void ) for ( std::map ::iterator i = _loggables.begin(); i != _loggables.end(); ++i ) { + /* get the latest state */ + if ( i->second.loggable ) + i->second.loggable->record_unjournaled(); + if ( i->second.unjournaled_state ) { char *s = i->second.unjournaled_state->print(); @@ -559,6 +571,8 @@ Loggable::compact ( void ) void Loggable::log ( const char *fmt, ... ) { + Locker lock( _lock ); + static char * buf = NULL; static size_t i = 0; static size_t buf_size = 0; @@ -689,6 +703,8 @@ Loggable::log_print( const Log_Entry *o, const Log_Entry *n ) const void Loggable::log_start ( void ) { + Locker lock( _lock );; + if ( ! _old_state ) { _old_state = new Log_Entry; @@ -702,6 +718,8 @@ Loggable::log_start ( void ) void Loggable::log_end ( void ) { + Locker lock( _lock );; + ASSERT( _old_state, "Programming error: log_end() called before log_start()" ); if ( --_nest > 0 ) @@ -737,6 +755,8 @@ Loggable::log_end ( void ) void Loggable::log_create ( void ) const { + Locker lock( _lock );; + set_dirty(); if ( ! _fp ) @@ -766,19 +786,18 @@ Loggable::record_unjournaled ( void ) const get_unjournaled( *e ); - Log_Entry *le = _loggables[ _id ].unjournaled_state; + Log_Entry **le = &_loggables[ _id ].unjournaled_state; - if ( le ) - delete le; + if ( *le ) + { + delete *le; + *le = NULL; + } if ( e->size() ) - _loggables[ _id ].unjournaled_state = e; + *le = e; else - { - /* don't waste space on loggables with no unjournaled properties */ - _loggables[ _id ].unjournaled_state = NULL; delete e; - } } /** Log object destruction. *Must* be called at the beginning of the @@ -786,8 +805,7 @@ Loggable::record_unjournaled ( void ) const void Loggable::log_destroy ( void ) const { - /* the unjournaled state may have changed: make a note of it. */ - record_unjournaled(); + Locker lock( _lock );; set_dirty(); @@ -795,6 +813,9 @@ Loggable::log_destroy ( void ) const /* tearing down... don't bother */ return; + /* the unjournaled state may have changed: make a note of it. */ + record_unjournaled(); + log( "%s 0x%X destroy << ", class_name(), _id ); Log_Entry e; diff --git a/nonlib/OSC/Endpoint.C b/nonlib/OSC/Endpoint.C index 2e5123a..de2e7be 100644 --- a/nonlib/OSC/Endpoint.C +++ b/nonlib/OSC/Endpoint.C @@ -56,6 +56,21 @@ namespace OSC int Signal::next_id = 0; + + Signal::Signal ( const char *path, Direction dir ) + { + _direction = dir; + _path = strdup( path ); + _id = ++next_id; + _value = 0.0f; + _endpoint = NULL; + _peer = NULL; + _documentation = 0; + _user_data = 0; + _connection_state_callback = 0; + _connection_state_userdata = 0; + } + Signal::~Signal ( ) { if ( _endpoint ) @@ -140,7 +155,9 @@ namespace OSC return r; } + + void Endpoint::error_handler(int num, const char *msg, const char *path) { @@ -149,6 +166,11 @@ namespace OSC Endpoint::Endpoint ( ) { + _peer_scan_complete_callback = 0; + _peer_scan_complete_userdata = 0; + _server = 0; + _name = 0; + owner = 0; } int @@ -164,7 +186,6 @@ namespace OSC return -1; } - add_method( "/signal/hello", "ss", &Endpoint::osc_sig_hello, this, "" ); add_method( "/signal/connect", "ii", &Endpoint::osc_sig_connect, this, "" ); add_method( "/signal/disconnect", "ii", &Endpoint::osc_sig_disconnect, this, "" ); @@ -183,7 +204,11 @@ namespace OSC Endpoint::~Endpoint ( ) { // lo_server_thread_free( _st ); - lo_server_free( _server ); + if ( _server ) + { + lo_server_free( _server ); + _server = 0; + } } OSC::Signal * @@ -248,6 +273,8 @@ namespace OSC void Endpoint::hello ( const char *url ) { + assert( name() ); + lo_address addr = lo_address_new_from_url ( url ); char *our_url = this->url(); @@ -260,6 +287,7 @@ namespace OSC int Endpoint::osc_sig_hello ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) { + Endpoint *ep = (Endpoint*)user_data; const char *peer_name = &argv[0]->s; @@ -271,7 +299,14 @@ namespace OSC { ep->scan_peer( peer_name, peer_url ); - ep->hello( peer_url ); + if ( ep->name() ) + { + ep->hello( peer_url ); + } + else + { + DMESSAGE( "Not sending hello because we don't have a name yet!" ); + } } return 0; @@ -306,7 +341,8 @@ namespace OSC DMESSAGE( "Peer %s has disconnected from signal %s", p->name, ps->path() ); - s->signal_connection_state_changed( s ); + if ( s->_connection_state_callback ) + s->_connection_state_callback( s, s->_connection_state_userdata ); return 0; } @@ -358,7 +394,8 @@ namespace OSC /* make a record of it ourselves */ ps->_outgoing.push_back( s ); - s->signal_connection_state_changed( s ); + if ( s->_connection_state_callback ) + s->_connection_state_callback( s, s->_connection_state_userdata ); /* return 0; */ /* } */ @@ -522,6 +559,7 @@ namespace OSC /* reply with current value */ o = (Signal*)user_data; o->_endpoint->send( lo_message_get_source( msg ), "/reply", path, o->value() ); + return 0; } else { @@ -533,8 +571,6 @@ namespace OSC if ( ep ) p = ep->find_peer_by_address( lo_message_get_source( msg ) ); - if ( 0 == o->_incoming.size() ) - return 0; if ( !p ) { @@ -548,6 +584,9 @@ namespace OSC /* remote signal */ /* if ( t->_peer ) */ + /* if ( 0 == o->_incoming.size() ) */ + /* return 0; */ + for ( std::list::const_iterator i = o->_incoming.begin(); i != o->_incoming.end(); ++i ) @@ -872,7 +911,8 @@ namespace OSC p->_scanning = false; DMESSAGE( "Done scanning %s", p->name ); - ep->signal_peer_scan_complete(); + if ( ep->_peer_scan_complete_callback ) + ep->_peer_scan_complete_callback(ep->_peer_scan_complete_userdata); } else if ( argc == 7 && p->_scanning ) { diff --git a/nonlib/OSC/Endpoint.H b/nonlib/OSC/Endpoint.H index 655fcda..3421861 100644 --- a/nonlib/OSC/Endpoint.H +++ b/nonlib/OSC/Endpoint.H @@ -25,8 +25,6 @@ #include #include -#include - namespace OSC { class OSC_Value @@ -163,20 +161,12 @@ namespace OSC void *_user_data; Parameter_Limits _parameter_limits; + void (*_connection_state_callback)(OSC::Signal *, void*); + void *_connection_state_userdata; + public: - Signal ( const char *path, Direction dir ) - { - _direction = dir; - _path = strdup( path ); - _id = ++next_id; - _value = 0.0f; - _endpoint = NULL; - _peer = NULL; - } - - sigc::signal signal_connection_state_changed; - + Signal ( const char *path, Direction dir ); ~Signal ( ); static Signal *get_peer_signal_by_id ( Peer *p, int signal_id ); @@ -198,6 +188,13 @@ namespace OSC _value = default_value; } + + void connection_state_callback ( void(*_cb)(OSC::Signal *, void*), void *userdata) + { + _connection_state_callback = _cb; + _connection_state_userdata = userdata; + } + const Parameter_Limits& parameter_limits ( void ) const { return _parameter_limits; } const char *path ( void ) const { return _path; } @@ -234,8 +231,21 @@ namespace OSC class Endpoint { - static void error_handler(int num, const char *msg, const char *path); + Thread _thread; +// lo_server_thread _st; + lo_server _server; + + std::list _peers; + std::list _signals; + std::list _methods; + + void (*_peer_scan_complete_callback)(void*); + void *_peer_scan_complete_userdata; + + char *_name; + + static void error_handler(int num, const char *msg, const char *path); static int osc_reply ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); @@ -251,14 +261,7 @@ namespace OSC void scan_peer ( const char *name, const char *url ); - Thread _thread; - -// lo_server_thread _st; - lo_server _server; - - std::list _peers; - std::list _signals; - std::list _methods; + private: static void *osc_thread ( void *arg ); void osc_thread ( void ); @@ -273,22 +276,21 @@ namespace OSC static Signal *find_target_by_peer_address ( std::list *l, lo_address addr ); - char *_name; - void del_signal ( Signal *signal ); void send_signal_rename_notifications( Signal *s ); public: + // can be used to point back to owning object. + void *owner; + void list_peer_signals ( void (*callback) (const char *, const OSC::Signal *, void * ), void *v ); int init ( int proto, const char *port = 0 ); + Endpoint ( ); ~Endpoint ( ); - - - bool disconnect_signal ( OSC::Signal *s, OSC::Signal *d ); bool disconnect_signal ( OSC::Signal *s, const char *peer_name, const char *signal_path ); @@ -352,10 +354,12 @@ namespace OSC int send ( lo_address to, const char *path, const char *v1, const char *v2, const char *v3, int v4, float v5, float v6, float v7 ); - // can be used to point back to owning object. - void *owner; + void peer_scan_complete_callback ( void(*_cb)(void*), void *userdata) + { + _peer_scan_complete_callback = _cb; + _peer_scan_complete_userdata = userdata; + } - sigc::signal signal_peer_scan_complete; friend Signal::~Signal(); friend void Signal::rename ( const char *name ); diff --git a/nonlib/Thread.C b/nonlib/Thread.C index 1a37a8a..cd64e04 100644 --- a/nonlib/Thread.C +++ b/nonlib/Thread.C @@ -116,3 +116,10 @@ Thread::join ( void ) pthread_join( _thread, NULL ); _thread = 0; } + +void +Thread::exit ( void *retval ) +{ + pthread_exit( retval ); + _thread = 0; +} diff --git a/nonlib/Thread.H b/nonlib/Thread.H index a264d20..4c27840 100644 --- a/nonlib/Thread.H +++ b/nonlib/Thread.H @@ -52,5 +52,6 @@ public: bool clone ( void *(*entry_point)(void *), void *arg ); void detach ( void ); void join ( void ); + void exit ( void *retval = 0 ); }; diff --git a/nonlib/configure b/nonlib/configure index 212f6f2..3a74ea6 100755 --- a/nonlib/configure +++ b/nonlib/configure @@ -17,7 +17,6 @@ require_command ar ar require_command makedepend makedepend require_package JACK 0.103.0 jack require_package liblo 0.23 liblo -require_package sigcpp 2.0.0 sigc++-2.0 test_version `version_of liblo` 0.26 || warn "Version $(version_of liblo) of liblo is slow to create servers. Consider upgrading to 0.26 or later" diff --git a/nonlib/makefile.inc b/nonlib/makefile.inc index f8c47cd..2f6a0cd 100644 --- a/nonlib/makefile.inc +++ b/nonlib/makefile.inc @@ -19,7 +19,7 @@ nonlib/libnonlib.a: $(OBJS) nonlib: nonlib/libnonlib.a clean: - rm -f $(OBJS) nonlib/libnonlib.a + rm -f $(OBJS) nonlib/libnonlib.a .deps install: @ \ No newline at end of file diff --git a/nonlib/nsm.h b/nonlib/nsm.h new file mode 100644 index 0000000..6236e43 --- /dev/null +++ b/nonlib/nsm.h @@ -0,0 +1,540 @@ + +/*************************************************************************/ +/* Copyright (C) 2012 Jonathan Moore Liles */ +/* */ +/* Permission to use, copy, modify, and/or distribute this software for */ +/* any purpose with or without fee is hereby granted, provided that the */ +/* above copyright notice and this permission notice appear in all */ +/* copies. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL */ +/* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED */ +/* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE */ +/* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL */ +/* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR */ +/* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER */ +/* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR */ +/* PERFORMANCE OF THIS SOFTWARE. */ +/*************************************************************************/ + + +/*************************************************************/ +/* A simple, callback based C API for NSM clients. */ +/* */ +/* Simplified Example: */ +/* */ +/* #include "nsm.h" */ +/* */ +/* int */ +/* cb_nsm_open ( const char *name, */ +/* const char *display_name, */ +/* const char *client_id, */ +/* char **out_msg, */ +/* void *userdata ) */ +/* { */ +/* do_open_stuff(); */ +/* return ERR_OK; */ +/* } */ +/* */ +/* int */ +/* cb_nsm_save ( char **out_msg, */ +/* void *userdata ) */ +/* { */ +/* do_save_stuff(); */ +/* return ERR_OK; */ +/* } */ +/* */ +/* static nsm_client_t *nsm = 0 */ +/* */ +/* int main( int argc, char **argv ) */ +/* { */ +/* const char *nsm_url = getenv( "NSM_URL" ); */ +/* */ +/* if ( nsm_url ) */ +/* { */ +/* nsm = nsm_new(); */ +/* */ +/* nsm_set_open_callback( nsm, cb_nsm_open, 0 ); */ +/* nsm_set_save_callback( nsm, cb_nsm_save, 0 ); */ +/* */ +/* if ( 0 == nsm_init( nsm, nsm_url ) ) */ +/* { */ +/* nsm_send_announce( nsm, "FOO", "", argv[0] ); */ +/* } */ +/* else */ +/* { */ +/* nsm_free( nsm ); */ +/* nsm = 0; */ +/* } */ +/* } */ +/* } */ +/*************************************************************/ + +#ifndef _NSM_H +#define _NSM_H + +#define NSM_API_VERSION_MAJOR 1 +#define NSM_API_VERSION_MINOR 0 + +#include +#include +#include +#include +#include +#include + +typedef void * nsm_client_t; +typedef int (nsm_open_callback)( const char *name, const char *display_name, const char *client_id, char **out_msg, void *userdata ); +typedef int (nsm_save_callback)( char **out_msg, void *userdata ); +typedef void (nsm_active_callback)( int b, void *userdata ); +typedef void (nsm_session_is_loaded_callback)( void *userdata ); +typedef int (nsm_broadcast_callback)( const char *, lo_message m, void *userdata ); + +#define _NSM() ((struct _nsm_client_t*)nsm) + +#define NSM_EXPORT __attribute__((unused)) static + +/* private parts */ +struct _nsm_client_t +{ + const char *nsm_url; + + lo_server _server; + lo_server_thread _st; + lo_address nsm_addr; + + int nsm_is_active; + char *nsm_client_id; + char *_session_manager_name; + + nsm_open_callback *open; + void *open_userdata; + + nsm_save_callback *save; + void *save_userdata; + + nsm_active_callback *active; + void *active_userdata; + + nsm_session_is_loaded_callback *session_is_loaded; + void *session_is_loaded_userdata; + + nsm_broadcast_callback *broadcast; + void *broadcast_userdata; +}; + +enum +{ + ERR_OK = 0, + ERR_GENERAL = -1, + ERR_INCOMPATIBLE_API = -2, + ERR_BLACKLISTED = -3, + ERR_LAUNCH_FAILED = -4, + ERR_NO_SUCH_FILE = -5, + ERR_NO_SESSION_OPEN = -6, + ERR_UNSAVED_CHANGES = -7, + ERR_NOT_NOW = -8 +}; + +NSM_EXPORT +int +nsm_is_active ( nsm_client_t *nsm ) +{ + return _NSM()->nsm_is_active; +} + +NSM_EXPORT +const char * +nsm_get_session_manager_name ( nsm_client_t *nsm ) +{ + return _NSM()->_session_manager_name; +} + +NSM_EXPORT +nsm_client_t * +nsm_new ( void ) +{ + struct _nsm_client_t *nsm = (struct _nsm_client_t*)malloc( sizeof( struct _nsm_client_t ) ); + + nsm->nsm_url = 0; + + nsm->nsm_is_active = 0; + nsm->nsm_client_id = 0; + + nsm->_server = 0; + nsm->_st = 0; + nsm->nsm_addr = 0; + nsm->_session_manager_name = 0; + + nsm->open = 0; + nsm->save = 0; + nsm->active = 0; + nsm->session_is_loaded = 0; + nsm->broadcast = 0; + + return (nsm_client_t *)nsm; +} + +/*******************************************/ +/* CLIENT TO SERVER INFORMATIONAL MESSAGES */ +/*******************************************/ + +NSM_EXPORT +void +nsm_send_is_dirty ( nsm_client_t *nsm ) +{ + if ( _NSM()->nsm_is_active ) + lo_send_from( _NSM()->nsm_addr, _NSM()->_server, LO_TT_IMMEDIATE, "/nsm/client/is_dirty", "" ); +} + +NSM_EXPORT +void +nsm_send_is_clean ( nsm_client_t *nsm ) +{ + if ( _NSM()->nsm_is_active ) + lo_send_from( _NSM()->nsm_addr, _NSM()->_server, LO_TT_IMMEDIATE, "/nsm/client/is_clean", "" ); +} + +NSM_EXPORT +void +nsm_send_progress ( nsm_client_t *nsm, float p ) +{ + if ( _NSM()->nsm_is_active ) + lo_send_from( _NSM()->nsm_addr, _NSM()->_server, LO_TT_IMMEDIATE, "/nsm/client/progress", "f", p ); +} + +NSM_EXPORT +void +nsm_send_message ( nsm_client_t *nsm, int priority, const char *msg ) +{ + if ( _NSM()->nsm_is_active ) + lo_send_from( _NSM()->nsm_addr, _NSM()->_server, LO_TT_IMMEDIATE, "/nsm/client/message", "is", priority, msg ); +} + +NSM_EXPORT void +nsm_send_announce ( nsm_client_t *nsm, const char *app_name, const char *capabilities, const char *process_name ) +{ + lo_address to = lo_address_new_from_url( _NSM()->nsm_url ); + + if ( ! to ) + { + fprintf( stderr, "NSM: Bad address!" ); + return; + } + + int pid = (int)getpid(); + + lo_send_from( to, _NSM()->_server, LO_TT_IMMEDIATE, "/nsm/server/announce", "sssiii", + app_name, + capabilities, + process_name, + NSM_API_VERSION_MAJOR, + NSM_API_VERSION_MINOR, + pid ); + + lo_address_free( to ); +} + +NSM_EXPORT void +nsm_send_broadcast ( nsm_client_t *nsm, lo_message msg ) +{ + if ( _NSM()->nsm_is_active ) + lo_send_message_from( _NSM()->nsm_addr, _NSM()->_server, "/nsm/server/broadcast", msg ); +} + + + +NSM_EXPORT +void +nsm_check_wait ( nsm_client_t *nsm, int timeout ) +{ + if ( lo_server_wait( _NSM()->_server, timeout ) ) + while ( lo_server_recv_noblock( _NSM()->_server, 0 ) ) {} +} + +NSM_EXPORT +void +nsm_check_nowait (nsm_client_t *nsm ) +{ + nsm_check_wait( nsm, 0 ); +} + + +NSM_EXPORT +void +nsm_thread_start ( nsm_client_t *nsm ) +{ + lo_server_thread_start( _NSM()->_st ); +} + + +NSM_EXPORT +void +nsm_thread_stop ( nsm_client_t *nsm ) +{ + lo_server_thread_stop( _NSM()->_st ); +} + + + +NSM_EXPORT void +nsm_free ( nsm_client_t *nsm ) +{ + if ( _NSM()->_st ) + nsm_thread_stop( nsm ); + + if ( _NSM()->_st ) + lo_server_thread_free( _NSM()->_st ); + else + lo_server_free( _NSM()->_server ); + + free( _NSM() ); +} + +/*****************/ +/* SET CALLBACKS */ +/*****************/ + +NSM_EXPORT +void +nsm_set_open_callback( nsm_client_t *nsm, nsm_open_callback *open_callback, void *userdata ) +{ + _NSM()->open = open_callback; + _NSM()->open_userdata = userdata; +} + +NSM_EXPORT +void +nsm_set_save_callback( nsm_client_t *nsm, nsm_save_callback *save_callback, void *userdata ) +{ + _NSM()->save = save_callback; + _NSM()->save_userdata = userdata; + +} + +NSM_EXPORT +void +nsm_set_active_callback( nsm_client_t *nsm, nsm_active_callback *active_callback, void *userdata ) +{ + _NSM()->active = active_callback; + _NSM()->active_userdata = userdata; +} + +NSM_EXPORT +void +nsm_set_session_is_loaded_callback( nsm_client_t *nsm, nsm_session_is_loaded_callback *session_is_loaded_callback, void *userdata ) +{ + _NSM()->session_is_loaded = session_is_loaded_callback; + _NSM()->session_is_loaded_userdata = userdata; +} + + +NSM_EXPORT +void +nsm_set_broadcast_callback( nsm_client_t *nsm, nsm_broadcast_callback *broadcast_callback, void *userdata ) +{ + _NSM()->broadcast = broadcast_callback; + _NSM()->broadcast_userdata = userdata; +} + + + +/****************/ +/* OSC HANDLERS */ +/****************/ + +#undef OSC_REPLY +#undef OSC_REPLY_ERR + +#define OSC_REPLY( value ) lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/reply", "ss", path, value ) + +#define OSC_REPLY_ERR( errcode, value ) lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/error", "sis", path, errcode, value ) + + +NSM_EXPORT int _nsm_osc_open ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + (void) types; + (void) argc; + (void) msg; + + char *out_msg = NULL; + + struct _nsm_client_t *nsm = (struct _nsm_client_t*)user_data; + + nsm->nsm_client_id = strdup( &argv[2]->s ); + + if ( ! nsm->open ) + return 0; + + int r = nsm->open( &argv[0]->s, &argv[1]->s, &argv[2]->s, &out_msg, nsm->open_userdata ); + + if ( r ) + OSC_REPLY_ERR( r, ( out_msg ? out_msg : "") ); + else + OSC_REPLY( "OK" ); + + if ( out_msg ) + free( out_msg ); + + return 0; +} + +NSM_EXPORT int _nsm_osc_save ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + (void) types; + (void) argv; + (void) argc; + (void) msg; + + char *out_msg = NULL; + + struct _nsm_client_t *nsm = (struct _nsm_client_t*)user_data; + + if ( ! nsm->save ) + return 0; + + int r = nsm->save(&out_msg, nsm->save_userdata ); + + if ( r ) + OSC_REPLY_ERR( r, ( out_msg ? out_msg : "") ); + else + OSC_REPLY( "OK" ); + + if ( out_msg ) + free( out_msg ); + + return 0; +} + +NSM_EXPORT int _nsm_osc_announce_reply ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + (void) path; + (void) types; + (void) argc; + + if ( strcmp( &argv[0]->s, "/nsm/server/announce" ) ) + return -1; + + struct _nsm_client_t *nsm = (struct _nsm_client_t*)user_data; + + fprintf( stderr, "NSM: Successfully registered. NSM says: %s", &argv[1]->s ); + + nsm->nsm_is_active = 1; + nsm->_session_manager_name = strdup( &argv[2]->s ); + nsm->nsm_addr = lo_address_new_from_url( lo_address_get_url( lo_message_get_source( msg ) )); + + if ( nsm->active ) + nsm->active( nsm->nsm_is_active, nsm->active_userdata ); + + return 0; +} + +NSM_EXPORT int _nsm_osc_error ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + (void) path; + (void) types; + (void) argc; + (void) msg; + + if ( strcmp( &argv[0]->s, "/nsm/server/announce" ) ) + return -1; + + struct _nsm_client_t *nsm = (struct _nsm_client_t*)user_data; + + fprintf( stderr, "NSM: Failed to register with NSM server: %s", &argv[2]->s ); + + nsm->nsm_is_active = 0; + + if ( nsm->active ) + nsm->active( nsm->nsm_is_active, nsm->active_userdata ); + + return 0; +} + +NSM_EXPORT int _nsm_osc_session_is_loaded ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + (void) path; + (void) types; + (void) argv; + (void) argc; + (void) msg; + + struct _nsm_client_t *nsm = (struct _nsm_client_t*)user_data; + + if ( ! nsm->session_is_loaded ) + return 0; + + nsm->session_is_loaded( nsm->session_is_loaded_userdata ); + + return 0; +} + +NSM_EXPORT int _nsm_osc_broadcast ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + (void) types; + (void) argv; + (void) argc; + + struct _nsm_client_t *nsm = (struct _nsm_client_t*)user_data; + + if ( ! nsm->broadcast ) + return 0; + + return nsm->broadcast( path, msg, nsm->broadcast_userdata ); +} + + + +NSM_EXPORT +int +nsm_init ( nsm_client_t *nsm, const char *nsm_url ) +{ + _NSM()->nsm_url = nsm_url; + + lo_address addr = lo_address_new_from_url( nsm_url ); + int proto = lo_address_get_protocol( addr ); + lo_address_free( addr ); + + _NSM()->_server = lo_server_new_with_proto( NULL, proto, NULL ); + + if ( ! _NSM()->_server ) + return -1; + + lo_server_add_method( _NSM()->_server, "/error", "sis", _nsm_osc_error, _NSM() ); + lo_server_add_method( _NSM()->_server, "/reply", "ssss", _nsm_osc_announce_reply, _NSM() ); + lo_server_add_method( _NSM()->_server, "/nsm/client/open", "sss", _nsm_osc_open, _NSM() ); + lo_server_add_method( _NSM()->_server, "/nsm/client/save", "", _nsm_osc_save, _NSM() ); + lo_server_add_method( _NSM()->_server, "/nsm/client/session_is_loaded", "", _nsm_osc_session_is_loaded, _NSM() ); + lo_server_add_method( _NSM()->_server, NULL, NULL, _nsm_osc_broadcast, _NSM() ); + + return 0; +} + + +NSM_EXPORT +int +nsm_init_thread ( nsm_client_t *nsm, const char *nsm_url ) +{ + _NSM()->nsm_url = nsm_url; + + lo_address addr = lo_address_new_from_url( nsm_url ); + int proto = lo_address_get_protocol( addr ); + lo_address_free( addr ); + + _NSM()->_st = lo_server_thread_new_with_proto( NULL, proto, NULL ); + _NSM()->_server = lo_server_thread_get_server( _NSM()->_st ); + + if ( ! _NSM()->_server ) + return -1; + + lo_server_thread_add_method( _NSM()->_st, "/error", "sis", _nsm_osc_error, _NSM() ); + lo_server_thread_add_method( _NSM()->_st, "/reply", "ssss", _nsm_osc_announce_reply, _NSM() ); + lo_server_thread_add_method( _NSM()->_st, "/nsm/client/open", "sss", _nsm_osc_open, _NSM() ); + lo_server_thread_add_method( _NSM()->_st, "/nsm/client/save", "", _nsm_osc_save, _NSM() ); + lo_server_thread_add_method( _NSM()->_st, "/nsm/client/session_is_loaded", "", _nsm_osc_session_is_loaded, _NSM() ); + lo_server_thread_add_method( _NSM()->_st, NULL, NULL, _nsm_osc_broadcast, _NSM() ); + + return 0; +} + +#endif /* NSM_H */ diff --git a/nonlib/string_util.C b/nonlib/string_util.C new file mode 100644 index 0000000..cb4f349 --- /dev/null +++ b/nonlib/string_util.C @@ -0,0 +1,85 @@ + +/*******************************************************************************/ +/* Copyright (C) 2012 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include +#include + +void unescape_url ( char *url ) +{ + char *r, *w; + + r = w = url; + + for ( ; *r; r++, w++ ) + { + if ( *r == '%' ) + { + char data[3] = { *(r + 1), *(r + 2), 0 }; + + int c; + + sscanf( data, "%2X", &c ); + + *w = c; + + r += 2; + } + else + *w = *r; + } + + *w = 0; +} + +char *escape_url ( const char *url ) +{ + const char *s; + char *w; + + char r[1024]; + + s = url; + + w = r; + + for ( ; *s && w < r + sizeof( r ); s++, w++ ) + { + switch ( *s ) + { + case ' ': + case '<': + case '>': + case '%': + case '#': + case '*': + case ',': + sprintf( w, "%%%2X", *s ); + w += 2; + break; + default: + *w = *s; + break; + + } + } + + *w = 0; + + return strdup( r ); +} diff --git a/FL/Gleam_Boxtypes.H b/nonlib/string_util.h similarity index 95% rename from FL/Gleam_Boxtypes.H rename to nonlib/string_util.h index ebef3e7..1a43254 100644 --- a/FL/Gleam_Boxtypes.H +++ b/nonlib/string_util.h @@ -17,6 +17,5 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*******************************************************************************/ -#include - -void init_gleam_boxtypes ( void ); +void unescape_url ( char *url ); +char * escape_url ( const char *url ); diff --git a/scripts/Makefile b/scripts/Makefile index 7257183..ac2b9aa 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -55,6 +55,15 @@ else CXXFLAGS := -fno-rtti -fno-exceptions endif +# LIBS := "$(FLTK_LIBS) $(LIBS)" + +INCLUDES := -I. -Iutil -IFL -Inonlib +INCLUDES += $(FLTK_CFLAGS) + +# INCLUDES += + +# CFLAGS += $(FLTK_CFLAGS) + # include FL/makefile.inc include makefile.inc @@ -66,24 +75,24 @@ CFLAGS+=-DVERSION=\"$(VERSION)\" \ CXXFLAGS := $(CFLAGS) $(CXXFLAGS) -INCLUDES := -I. -Iutil -IFL -Inonlib + include scripts/colors -SPACE+=" `tput cuf 20`" +SPACE:=" `tput cuf 20`" ifneq ($(CALCULATING),yes) - COMPILING="$(BOLD)$(BLACK)$(PACKAGE)$(SPACE)$(SGR0)$(CYAN)`scripts/percent-complete .files "$<"`$(SGR0)$(BOLD)$(BLACK)]$(SGR0) $(BOLD)$(CYAN)$<$(SGR0)" + COMPILING="$(BOLD)$(BLACK)[$(SGR0) $(PACKAGE)$(SPACE)$(SGR0)$(CYAN)`scripts/percent-complete .files "$<"` $(SGR0)$(BOLD)$(BLACK)]$(SGR0) $(BOLD)$(CYAN)$<$(SGR0)" else COMPILING="Compiling: $<" endif .C.o: @ echo $(COMPILING) - @ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ + @ $(CXX) $(INCLUDES) $(CXXFLAGS) -c $< -o $@ %.C : %.fl - @ cd `dirname $<` && fluid -c ../$< + @ cd `dirname $<` && $(FLUID) -c `basename $<` DONE := $(BOLD)$(GREEN)done$(SGR0) diff --git a/scripts/build_id b/scripts/build_id new file mode 100755 index 0000000..1c0fc71 --- /dev/null +++ b/scripts/build_id @@ -0,0 +1,40 @@ +#!/bin/sh + +# Copyright (C) 2008 Jonathan Moore Liles # +# # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the # +# Free Software Foundation; either version 2 of the License, or (at your # +# option) any later version. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with This program; see the file COPYING. If not,write to the Free Software # +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # + +if [ "$#" = 0 ] +then + echo "Usage: $0 [output_file.h] [version]" +fi + +if [ -d ../.git ] +then + ID=`git log -1 --format=%h -- .` +# ID="`[ \`git rev-parse HEAD\` = \`git rev-parse v${2}\` ] || git rev-parse --short HEAD`" + if [ -n "$ID" ] + then + ID="git {$ID}" + else + ID="git" + fi +else + ID="dist" +fi + +echo "/* generated file */" > "$1" +echo "const char *BUILD_ID = \"${ID}\";" >> "$1" +echo "const char *VERSION = \"${2}\";" >> "$1" diff --git a/scripts/config-funcs b/scripts/config-funcs index 7180243..7342630 100644 --- a/scripts/config-funcs +++ b/scripts/config-funcs @@ -127,18 +127,18 @@ ask () ok () { - echo '\r'`tput cuf 30`"$BOLD${GREEN}ok${SGR0} ${*:+${BOLD}${BLACK}($*)${SGR0}}" + echo ' '`tput cuf 30`"$BOLD${GREEN}ok${SGR0} ${*:+${BOLD}${BLACK}($*)${SGR0}}" } failed () { - echo '\r'`tput cuf 30`"$BOLD${RED}failed!${SGR0}" > /dev/stderr + echo ' '`tput cuf 30`"$BOLD${RED}failed!${SGR0}" > /dev/stderr rm -f .config } missing () { - echo '\r'`tput cuf 30`"$BOLD${YELLOW}missing!${SGR0}" > /dev/stderr + echo ' '`tput cuf 30`"$BOLD${YELLOW}missing!${SGR0}" > /dev/stderr } using () @@ -184,7 +184,7 @@ begin () { echo -n "Checking sanity..." require_command tput tput > /dev/null - require_command pkg-config pkg-config > /dev/null + require_command pkg_config pkg-config > /dev/null require_command sed sed > /dev/null ok } @@ -254,13 +254,22 @@ require_command () { echo -n "Checking for ${BOLD}$1${SGR0}..." - if ! [ -x "`which $2`" ] + local name; + + if [ -x "$2" ] then + name="$PWD/$2" + ok "$name" + elif [ -x "`which "$2"`" ] + then + name="`which "$2"`" + ok "$name" + else failed fatal "Command $1 not found." - else - ok fi + + append "$1=$name" } require_package () @@ -352,10 +361,13 @@ hostname_resolvable () require_FLTK () { local use + local appendflags + + require_command ntk_config lib/ntk/ntk-config echo -n "Checking for ${BOLD}FLTK${SGR0}..." - FLTK_VERSION=`fltk-config --version` + FLTK_VERSION=`lib/ntk/ntk-config --version` if ! test_version $FLTK_VERSION $1 then @@ -366,13 +378,18 @@ require_FLTK () fi use= + appendflags= while [ $# -gt 1 ] do shift 1 + + [ "$1" = 'cairo' ] && appendflags="-DFLTK_HAVE_CAIRO=1 -DUSE_X11=1" + use="$use --use-$1" done - append "FLTK_LIBS=`fltk-config $use --ldflags | sed 's/,\\?--as-needed//g'`" - append "FLTK_CFLAGS=`fltk-config $use --cflags`" + append "FLTK_LIBS=`lib/ntk/ntk-config $use --libs | sed 's/,\\?--as-needed//g'`" + append "FLTK_LDFLAGS=`lib/ntk/ntk-config $use --ldflags | sed 's/,\\?--as-needed//g'`" + append "FLTK_CFLAGS=`lib/ntk/ntk-config $use --cflags` $appendflags" } diff --git a/sequencer/COPYING b/sequencer/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/sequencer/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/sequencer/FL b/sequencer/FL new file mode 120000 index 0000000..d025fc7 --- /dev/null +++ b/sequencer/FL @@ -0,0 +1 @@ +../FL \ No newline at end of file diff --git a/sequencer/Makefile b/sequencer/Makefile new file mode 120000 index 0000000..c259b75 --- /dev/null +++ b/sequencer/Makefile @@ -0,0 +1 @@ +scripts/Makefile \ No newline at end of file diff --git a/sequencer/configure b/sequencer/configure new file mode 100755 index 0000000..6bdb9dc --- /dev/null +++ b/sequencer/configure @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Copyright (C) 2008 Jonathan Moore Liles +# This file is licensed under version 2 of the GPL. + +. scripts/config-funcs + +begin + +begin_options + +ask "Installation prefix" prefix /usr/local +ask "Build for debugging" USE_DEBUG no + +begin_tests + +require_package JACK 0.103.0 jack +suggest_package XPM 2.0.0 xpm +require_FLTK 1.3.0 images +require_command FLUID lib/ntk/fluid/fluid +test_version `version_of jack` 0.105.0 || append "JACK_MIDI_PROTO_API=yes" +require_package liblo 0.23 liblo + +test_version `version_of liblo` 0.26 || warn "Version $(version_of liblo) of liblo is slow to create servers. Consider upgrading to 0.26 or later" + +require_package sigcpp 2.0.0 sigc++-2.0 + +end diff --git a/sequencer/doc/KEYS.html b/sequencer/doc/KEYS.html new file mode 100644 index 0000000..c41c331 --- /dev/null +++ b/sequencer/doc/KEYS.html @@ -0,0 +1,71 @@ + + + + + +Key Bindings + + +
+

Key Bindings

+

+
+
+
+ +

+
+
+

+These keys are in effect when the pattern or phrase editor grid is focused. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Fig. 1. Editor Keybindings +
keyfunction
[previous
]next
1horizontal zoom out
2horizontal zoom in
3vertical zoom out
4vertical zoom in
ccreate
dduplicate
fmove to playhead
rselect range as defined by L and R cursors
qselect none
Ccrop to range
Deletedelete selected
Shift-Deleteclear grid
Control-Deletedelete time in range
Control-Insertinsert time
Arrow keysmove viewport
Ctrl-Leftmove to previous note
Ctrl-Rightmove to next note
<move selection left
>move selection right
,move selection up
.move selection down
ttrim length
Spacetoggle transport
mmute
ssolo
+
+ + + + + + + +
+Fig. 2. Gloabl keybindings +
keyfunction
Alt-pSwitch to pattern editor
Alt-aSwitch to phrase editor
Alt-sSwitch to sequence editor
SpaceToggle transport
HomeLocate transport to frame 0
+

+Other functions are accessible from the menus or the key is otherwise indicated. +

+
+ + diff --git a/sequencer/doc/KEYS.mu b/sequencer/doc/KEYS.mu new file mode 100644 index 0000000..a96435b --- /dev/null +++ b/sequencer/doc/KEYS.mu @@ -0,0 +1,46 @@ + +! title Key Bindings + +-- + + These keys are in effect when the pattern or phrase editor grid is focused. + +// Editor Keybindings +[[ key, function +[[ [, previous +[[ ], next +[[ 1, horizontal zoom out +[[ 2, horizontal zoom in +[[ 3, vertical zoom out +[[ 4, vertical zoom in +[[ c, create +[[ d, duplicate +[[ f, move to playhead +[[ r, select range (as defined by L and R cursors) +[[ q, select none +[[ C, crop to range +[[ Delete, delete selected +[[ Shift-Delete, clear grid +[[ Control-Delete, delete time in range +[[ Control-Insert, insert time +[[ Arrow keys, move viewport +[[ Ctrl-Left, move to previous note +[[ Ctrl-Right, move to next note +[[ \<, move selection left +[[ >, move selection right +[[ \,, move selection up +[[ ., move selection down +[[ t, trim length +[[ Space, toggle transport +[[ m, mute +[[ s, solo + +// Gloabl keybindings +[[ key, function +[[ Alt-p, Switch to pattern editor +[[ Alt-a, Switch to phrase editor +[[ Alt-s, Switch to sequence editor +[[ Space, Toggle transport +[[ Home, Locate transport to frame 0 + + Other functions are accessible from the menus or the key is otherwise indicated. diff --git a/sequencer/doc/MANUAL.html b/sequencer/doc/MANUAL.html new file mode 100644 index 0000000..26cd2e4 --- /dev/null +++ b/sequencer/doc/MANUAL.html @@ -0,0 +1,293 @@ + + + + + +The Non Sequencer + + +
+

The Non Sequencer

+

+
+Jonathan Moore Liles <male@tuxfamily.org>
+Oct 13 2007
+ +
Home
+
+ +

1. Description

+
+ +
fig.
+

1.1. Guiding Principles

+
  1. Flexibility +
  2. Efficiency +
  3. Purpose +
  4. Grace +

+Non has many modes and functions. Where flexibility comes at a small cost, we prefer to be flexible and make up the difference elsewhere. Where arbitrary limitations are reasonable and necessary, Non enforces them, but not without being forced into it. Where it is easier to be inefficient than efficient, but the efficiency matters, we prefer to put in the (small amount of) work required to be efficient, often resulting in thousand-fold performance gains; this may sound like an obvious statement, but, in fact, design for efficiency is a rare practice in this (Linux Audio'Modern' software arena. Although it is tempting to implement a kitchen sink in every program, we resist the urge. Non has the purpose of being a real-time sequencer and anything outside of that scope is a job for another day. If there is something related to the task at hand that a computer can do instantly and easily, but which requires labor for you, Non tries to do it for you so that you can continue making music without being bothered. Non's user interface is designed to combine the stark functionality and speed of hardware with the degrees of freedom of software. +

+

2. The Interface

+

+The interface is quite simple and is based on the excellent FLTK (1.1.x) toolkit. (Versions < 1 of Non were based on raw Xlib and a few Motif widgets.) The author examined many toolkits before beginning, and has absolutely no interest in pursuing GTK or Qt--Non simply doesn't require much of a toolkit, and these are incapable of providing less than total excess. +

+

+Non's GUI is highly optimized. Common operations are designed to be as fast as possible. Where other sequencers completely monopolize the CPU when scrolling, etc., Non performs smoothly--even on antiquated hardware. It is not technically difficult to achieve such speed. And, in fact, it is a shame that more developers don't consider good (or even just reasonable) performance a priority. +

+

2.1. The Pattern Editor

+
+ +
fig.
+

+Upon invocation, Non enters the pattern editor and loads Pattern 1. The pattern editor presents a grid interface--the heart of a step sequencer. You can toggle a note on the grid by entering its coordinates with the keyboard or clicking an intersection with the mouse. The length of patterns is unlimited and no special action is required to lengthen them (simply adding notes beyond the "end" is enough.) Non can present grids in one of two modes, expanded and compacted. In the compacted view, only named rows are displayed; this means that only the notes the current instrument or scale will consume vertical space--resulting in far more efficient use of screen real-estate. Any notes that are made invisible by the compacted view will be silenced. +

+

+

+The resolution of the pattern display can be adjusted (the default is one point per 1/16th note), and, additionally, the canvas can be zoomed horizontally and vertically as necessary. However, it is highly recommended that you avoid creating 'vertical' compositions, that is, one should place each part in a separate pattern and avoid the need to scroll about looking for notes. +

+

+Tonic patterns have a choice of scale and key, which limits the display to only valid notes. This row-compaction can be turned off, if desired, so that all 128 notes are visible. Or simply choose the chromatic mapping if you are not creating scale based music. +

+

+Percussion, or other sample-based patterns can be assigned an instrument mapping, which again limits the display to only those notes for which names and volumes have been provided. The instrument definition format is a simple ASCII file containing one name, note and volume percentage per line. +

+

+Individual patterns may be soloed or muted right from the pattern editor. +

+

+Each pattern has a setting for output MIDI channel and sequencer port--and these may also be changed while the transport is running. +

+

2.1.1. The Notes

+

+The type (duration) of note to be inserted can be adjusted in the pattern editor (control+mouse-wheel). The velocity of individual notes may be adjusted (mouse-wheel), and the current value is reflected in the color of the note. Ranges may also be inserted and deleted, a commonly required operation during composition, but one that is, sadly, missing from many sequencers. +

+
+ +
fig.
+

2.1.2. Recording

+

+A pattern can be recorded via MIDI in one of four modes: +

+
+
Merge (the most familiar/least useful)
+
In this mode recorded events are merged into the pattern on each pass through the loop. This is how most sequencers work, but it usually just results in a jumble of notes that require much manual cleaning up.
+
Overwrite (each pass [with input] replaces the previous contents of the pattern)
+
This is like merge mode, except that the pattern is cleared before the recorded events are input. If no notes have been played during a loop, the pattern remains unchanged. This is a great way to just get a part down without having to remove your hands from the instrument.
+
Layer (each pass [with input] goes into a new pattern)
+
This is just like overwrite mode, except that the pattern actually overwritten is a duplicate. Use this mode to record several loops of the same length without removing your hands from the instrument.
+
New
+
In this mode, all recorded events are placed into a new pattern (of whatever length) when recording is stopped.
+
+

2.1.3. The Event Editor

+
+ +
fig.
+

+For situations requiring close inspection, fine-adjustments or entering of non-note data, the Event Editor allows one to edit the raw MIDI event list of a pattern. A common use is to insert program or control change events. +

+

+Like everything else in Non, the Event Editor is real-time--change a note and you'll see and hear the result as the pattern plays. +

+

2.2. The Phrase Editor

+
+ +
fig.
+

+Phrases are to patterns as patterns are to notes. Switching to the Phrase Editor brings up Phrase 1, where each row corresponds to an existing pattern. The grid of the Phrase Editor is fixed at one column-per-beat. This view is somewhat similar to a timeline view in other sequencers, but do not be deceived--Phrases may be many in number and are triggered just like patterns. +

+

+When a node on the Phrase Editor grid is activated, the length of the cue event inserted will be the same as that of the pattern being triggered. Adjusting the duration of this event will cause the pattern be cut short or looped. If the length of a referenced pattern is changed, this will not be reflected in the Phrase display. You must either re-insert or adjust the length of the reference. +

+

+It is recommended that, to avoid confusion, you first compose all of the patterns you need for a phrase, and only then bring up the phrase editor. +

+

+Editing operations are the same as those for the Pattern Editor. +

+

2.3. The Sequence Editor

+

+The Sequence Editor defines the sequence of playback. The interface is a list of phrases, to be played sequentially, beginning from bar 1. It is not necessary to include all existing phrases in the playlist. Phrases can be moved up and down the playlist, inserted and deleted. The editor displays the start bar of each phrase in addition to its number and name. +

+

+This sequence->phrase->pattern hierarchy allows for logical, expressive compositions--without the labor intensive copypasteduplicate work-flow imposed by other sequencers. +

+

+For example, suppose you have a song with a 12 bar progression that repeats 4 times. This 12 bar sequence is composed of many patterns, each a few measures in length and roughly corresponding to the chords in the progression. +

+

+In another sequencer you would be required to use clumsy copy/paste operations to destructively extend the 12 bar sequence. Then if you wanted to change a part of that subsequence later, you would have to go edit each instance of it on the 'timeline' view. This is absurdly inefficient for the operator. +

+

+In Non you simply create your patterns, assemble them into logical phrases, and then assemble these phrases into a sequence that determines the entire song. This approach is similar to the bottom-up approach of factored languages such as Forth. +

+

2.4. Pattern Triggers

+
+ +
fig.
+

+Next to the sequence playlist is an array of pattern triggers. Here one can monitor the progress of multiple patterns during playback and cause them to be muted etc. +

+

+The left mouse button toggles muting, the middle button toggles soloing, and the right button brings up the given pattern in the pattern editor. +

+

+Playing patterns appear green, the solo pattern appears red, and muted patterns appear gray, +

+

3. MIDI

+

3.1. IO

+

+Non utilizes the Jack MIDI transport. Jack MIDI is an emerging MIDI transport for Linux. Since Jack already provides similar routing as the ALSA Sequencer interface, little is lost--besides compatibility with existing programs. (Jack has an aseq bridge capability, but in order to benefit from Jack MIDI, both sequencer and synth must use Jack). The Jack MIDI API is extremely limited in comparison to the very capable ALSA API, but this is a problem for the programmer, not the user. +

+

+At the time of writing, Non is one of only two sequencers to use Jack MIDI natively. +

+

3.1.1. About Jack MIDI Connections

+

+Since Jack MIDI is new and not all programs support it, many find themselves confused. This section attempts to explain Jack MIDI ports. +

+

+The ALSA sequencer interface has long been the standard MIDI routing subsystem on Linux. But many (all) of the programs we use for synthesis these days use Jack for their audio IO. It makes more sense for those MIDI related programs utilizing the Jack Transport for synchronization to also use Jack ports for MIDI delivery. Therefore, ALSA MIDI is quickly becoming obsolete. +

+

+Jack MIDI ports are not related to ALSA MIDI ports in any way. Jack MIDI ports are just like Jack audio ports, except that the data being transmitted in each buffer are raw, timestamped MIDI events instead of floating point audio samples. Jack MIDI is sample-accurate. This means that a MIDI Note On event can occur concurrently with a sound, and the two will never drift apart as often happens to some extent with ALSA. +

+

+In essence, Jack MIDI is a way of expressing a direct temporal correlation between audio and MIDI data. +

+
+ + +
Note:Older versions of QJackCtl and other connection managers do not +know about Jack MIDI ports. Please make sure you're using an +up-to-date version. +
+
+

+

+For example, to connect Non to ZynAddSubFX (the CVS version supports Jack MIDI), type the following into the shell: +

+
+
+$ jack_connect Non:midi_out-1 ZynAddSubFX:midi_in
+
+

+Also, be sure that Zyn's outputs are connected to system:playback_* so that you can hear the sounds it produces. +

+

+It is possible to use Jack MIDI clients and ALSA MIDI clients together via the bridge built into jackd. For this to work you must append the -X seq option to the alsa driver section of the jackd command line. Like so: +

+
+
+$ jackd -d alsa -X seq
+
+

+The way such bridged ports are named varies between Jack versions, but they should be fairly obvious. When used in this way, many of the advantages of Jack MIDI are lost, so it is recommended that you find a Jack MIDI capable synth for best results. +

+
+ + + +
+Fig. 3.1. Example of Jack MIDI connections in Patchage +
fig. 3.1
+

3.2. Non Files

+

+The format of .non files is a variation of SMF-2. In an SMF-2 file, each track chunk represents a pattern. Because Non groups patterns into phrases, this usage of SMF-2 is probably not compatible with other implementations (although, the author has never actually seen another program that could play back SMF-2 anyway.) +

+

+Each phrase is stored as a track of MIDI Cue messages, each referring to a pattern to be triggered. The sequence/playlist is stored as the first track, and consists of a list of Cue Point meta-events referring to phrases. +

+

+Also in the first track is a sequencer specific meta-event (ID "Non!") containing song data that cannot be readily expressed with existing meta events, and some versioning info to aid future compatibility. +

+

+In short, the author has done the utmost to save sequences in a standard format--within reason; SMF was hardly designed with a program like Non in mind--instead of some ad-hoc ASCII format (which would have been far easier to implement), or worse, buggy, bulky, and unmaintainable XML. +

+

3.3. Exports

+

+In addition to saving and loading .non files, Non can export individual patterns as flat, SMF-0 MIDI files. +

+

3.4. Imports

+

+SMF-0 files can be imported as a new pattern (all channels merged), or SMF-1 (such as those written by Seq24) and SMF-2 (ever seen one of these?) can be imported as N new patterns (selected from a track list.) All imported patterns are set to display the Chromatic scale, in order that no notes be hidden from view. +

+

+This should make it easy to migrate any existing patterns that you may have over to Non, or to permit editing of Non patterns in external programs (for graphic controller tweaking perhaps?) +

+

4. Synchronization

+

+Non's transport is driven by the Jack Transport, so in order to sync Non with a DAW like Ardour, you must set Ardour to be the Jack Timebase Master. Therefore, all tempo mapping and time signature information should be manipulated in the Timebase Master--Non will respond to these changes automatically. If there is no Timebase Master registered when Non starts, it will take over that role instead. This is useful if you simply plan to use Non as a musical instrument. +

+

5. Control

+

+Non creates two MIDI input ports, one for performance data and one for control data. The control port is used to control Non with hardware MIDI controllers, such as the BCF2000, or other software. The performance port is used to record musical data into patterns. +

+

6. Playback

+

+The playback mode can be toggled between Pattern, Sequence and Trigger. In Pattern mode (the default), all patterns are played simultaneously, from the beginning, and looped forever. Since patterns may differ widely in length, interesting compositions are possible. In this mode, Non makes for a very intuitive software instrument--rivaled only by the excellent program FreeWheeling (a live audio looper.) +

+

+In Sequence mode, playback strictly follows the sequence list and the Jack transport, and does not loop. This mode is suitable for parallel compositions between Non and a Jack Timebase Master capable DAW. +

+

+Trigger mode is very much like Pattern mode, except that all patterns begin muted and must be enabled via the trigger view. +

+

7. Sister Projects

+

+Much of the inspiration to move forward with Non was derived from JP Mercury's highly useful and successful FreeWheeling looper. Mr. Mercury is a visionary. +

+

+But the closest sister of Non has to be the amazingly capable ZynAddSubFX soft-synth by Nasca Octavian Paul. ZynAddSubFX, like Non, utilizes the FLTK GUI toolkit, and has recently begun to support Jack MIDI (albeit in a limited fashion.) This is, hands down, the best synth available for Linux, and probably one of the best period. If all you have is Non and Zyn, you have all that you require to make great music. +

+

+Of course, this section can hardly go without mention of Rob Buse's Seq24. It was the author's unending frustration with the abysmal performance and absurd limitations of Seq24 that, more than any other single factor, inspired him to write Non. The most frustrating aspect was that, prior to Non, Seq24 was, in the author's opinion, the best sequencer available on Linux. Seq24, which claims to be light and free of bloat is, without comparison, the slowest, most poorly optimized sequencer the author has tried. Even the huge, snarling beast that is RoseGarden out performs Seq24 in every way but start time. +

+

+Those days are over. +

+
+ + diff --git a/sequencer/doc/MANUAL.mu b/sequencer/doc/MANUAL.mu new file mode 100644 index 0000000..e403e58 --- /dev/null +++ b/sequencer/doc/MANUAL.mu @@ -0,0 +1,394 @@ + +! title The Non Sequencer +! author Jonathan Moore Liles #(email,male@tuxfamily.org) +! date Oct 13 2007 +! keywords Non Jack ALSA FLTK +! extra #(url,http://non.tuxfamily.org,Home) + +-- Table Of Contents + +: Description + +< non-new-about.png + +:: Guiding Principles + ++ Flexibility ++ Efficiency ++ Purpose ++ Grace + + Non has many modes and functions. Where flexibility comes at a small + cost, we prefer to be flexible and make up the difference + elsewhere. Where arbitrary limitations are reasonable and necessary, + Non enforces them, but not without being forced into it. Where it is + easier to be inefficient than efficient, but the efficiency matters, + we prefer to put in the (small amount of) work required to be + efficient, often resulting in thousand-fold performance gains; this + may sound like an obvious statement, but, in fact, design for + efficiency is a rare practice in this (Linux Audio/'Modern' + software) arena. Although it is tempting to implement a kitchen sink + in every program, we resist the urge. Non has the purpose of being a + real-time sequencer and anything outside of that scope is a job for + another day. If there is something related to the task at hand that + a computer can do instantly and easily, but which requires labor for + you, Non tries to do it for you so that you can continue making + music without being bothered. Non's user interface is designed to + combine the stark functionality and speed of hardware with the + degrees of freedom of software. + +: The Interface + + The interface is quite simple and is based on the excellent FLTK + (1.1.x) toolkit. (Versions \< 1 of Non were based on raw Xlib and a + few Motif widgets.) The author examined many toolkits before + beginning, and has absolutely no interest in pursuing GTK or Qt--Non + simply doesn't require much of a toolkit, and these are incapable of + providing less than total excess. + + Non's GUI is highly optimized. Common operations are designed to be + as fast as possible. Where other sequencers completely monopolize + the CPU when scrolling, etc., Non performs smoothly--even on + antiquated hardware. It is not technically difficult to achieve + such speed. And, in fact, it is a shame that more developers don't + consider good (or even just reasonable) performance a priority. + +:: The Pattern Editor + +< non-pattern-editor.png + + Upon invocation, Non enters the pattern editor and loads Pattern + 1. The pattern editor presents a grid interface--the heart of a step + sequencer. You can toggle a note on the grid by entering its + coordinates with the keyboard or clicking an intersection with the + mouse. The length of patterns is unlimited and no special action is + required to lengthen them (simply adding notes beyond the "end" is + enough.) Non can present grids in one of two modes, expanded and + compacted. In the compacted view, only named rows are displayed; + this means that only the notes the current instrument or scale will + consume vertical space--resulting in far more efficient use of + screen real-estate. Any notes that are made invisible by the + compacted view will be silenced. + + You may add, remove, transpose, move, and edit notes, as well as + trigger/mute patterns, while the transport is running. + + The resolution of the pattern display can be adjusted (the default + is one point per 1\/16th note), and, additionally, the canvas can be + zoomed horizontally and vertically as necessary. However, it is + highly recommended that you avoid creating 'vertical' compositions, + that is, one should place each part in a separate pattern and avoid + the need to scroll about looking for notes. + + Tonic patterns have a choice of scale and key, which limits the + display to only valid notes. This /row-compaction/ can be turned + off, if desired, so that all 128 notes are visible. Or simply choose + the /chromatic/ mapping if you are not creating scale based music. + + Percussion, or other sample-based patterns can be assigned an + /instrument/ mapping, which again limits the display to only those + notes for which names and volumes have been provided. The instrument + definition format is a simple ASCII file containing one name, note + and volume percentage per line. + + Individual patterns may be soloed or muted right from the pattern + editor. + + Each pattern has a setting for output MIDI channel and sequencer + port--and these may also be changed while the transport is running. + +::: The Notes + + The type (duration) of note to be inserted can be adjusted in the + pattern editor (control+mouse-wheel). The velocity of individual + notes may be adjusted (mouse-wheel), and the current value is + reflected in the color of the note. Ranges may also be /inserted/ + and /deleted/, a commonly required operation during composition, but + one that is, sadly, missing from many sequencers. + +< non-cursors.png + +::: Recording + + A pattern can be recorded via MIDI in one of four modes: + += Merge (the most familiar/least useful) + = In this mode recorded events are merged into the pattern on each pass + = through the loop. This is how most sequencers work, but it usually just + = results in a jumble of notes that require much manual cleaning up. += Overwrite (each pass [with input] replaces the previous contents of the pattern) + = This is like merge mode, except that the pattern is cleared before + = the recorded events are input. If no notes have been played during + = a loop, the pattern remains unchanged. This is a great way to just get + = a part down without having to remove your hands from the instrument. += Layer (each pass [with input] goes into a new pattern) + = This is just like overwrite mode, except that the pattern actually + = overwritten is a duplicate. Use this mode to record several loops of + = the same length without removing your hands from the instrument. += New + = In this mode, all recorded events are placed into a new pattern (of + = whatever length) when recording is stopped. + +# It is especially useful if you bind Record to a MIDI footswitch. + +::: The Event Editor + +< non-event-editor-notes.png + + For situations requiring close inspection, fine-adjustments or + entering of non-note data, the Event Editor allows one to edit the + raw MIDI event list of a pattern. A common use is to insert program + or control change events. + + Like everything else in Non, the Event Editor is real-time--change a + note and you'll see and hear the result as the pattern plays. + +:: The Phrase Editor + +< non-phrase-editor.png + + Phrases are to patterns as patterns are to notes. Switching to the + Phrase Editor brings up Phrase 1, where each row corresponds to an + existing /pattern/. The grid of the Phrase Editor is fixed at one + column-per-beat. This view is somewhat similar to a timeline view in + other sequencers, but do not be deceived--Phrases may be many in + number and are triggered just like patterns. + + When a node on the Phrase Editor grid is activated, the length of + the cue event inserted will be the same as that of the pattern being + triggered. Adjusting the duration of this event will cause the + pattern be cut short or looped. If the length of a referenced + pattern is changed, this will *not* be reflected in the Phrase + display. You must either re-insert or adjust the length of the + reference. + + It is recommended that, to avoid confusion, you first compose all of + the patterns you need for a phrase, and only then bring up the + phrase editor. + + Editing operations are the same as those for the Pattern Editor. + +:: The Sequence Editor + + The Sequence Editor defines the sequence of playback. The interface + is a list of phrases, to be played sequentially, beginning from bar + 1. It is not necessary to include all existing phrases in the + playlist. Phrases can be moved up and down the playlist, inserted + and deleted. The editor displays the start bar of each phrase in + addition to its number and name. + + This sequence->phrase->pattern hierarchy allows for logical, + expressive compositions--without the labor intensive + copy/paste/duplicate work-flow imposed by other sequencers. + + For example, suppose you have a song with a 12 bar progression that + repeats 4 times. This 12 bar sequence is composed of many patterns, + each a few measures in length and roughly corresponding to the + chords in the progression. + + In another sequencer you would be required to use clumsy copy\/paste + operations to destructively extend the 12 bar sequence. Then if you + wanted to change a part of that subsequence later, you would have to + go edit each instance of it on the 'timeline' view. This is absurdly + inefficient for the operator. + + In Non you simply create your patterns, assemble them into logical + phrases, and then assemble these phrases into a sequence that + determines the entire song. This approach is similar to the + bottom-up approach of factored languages such as Forth. + + +:: Pattern Triggers + +< non-pattern-triggers.png + + Next to the sequence playlist is an array of pattern triggers. Here + one can monitor the progress of multiple patterns during playback + and cause them to be muted etc. + + The left mouse button toggles muting, the middle button toggles + soloing, and the right button brings up the given pattern in the + pattern editor. + + Playing patterns appear green, the solo pattern appears red, and + muted patterns appear gray, + +: MIDI + +:: IO + + Non utilizes the Jack MIDI transport. Jack MIDI is an emerging MIDI + transport for Linux. Since Jack already provides similar routing as + the ALSA Sequencer interface, little is lost--besides compatibility + with existing programs. (Jack has an aseq bridge capability, but in + order to benefit from Jack MIDI, both sequencer and synth must use + Jack). The Jack MIDI API is extremely limited in comparison to the + very capable ALSA API, but this is a problem for the programmer, not + the user. + + At the time of writing, Non is one of only two sequencers to use + Jack MIDI natively. + +::: About Jack MIDI Connections + + Since Jack MIDI is new and not all programs support it, many find + themselves confused. This section attempts to explain Jack MIDI + ports. + + The ALSA sequencer interface has long been the standard MIDI routing + subsystem on Linux. But many (all) of the programs we use for + synthesis these days use Jack for their audio IO. It makes more + sense for those MIDI related programs utilizing the Jack Transport + for synchronization to also use Jack ports for MIDI + delivery. Therefore, ALSA MIDI is quickly becoming obsolete. + + Jack MIDI ports are *not* related to ALSA MIDI ports in any + way. Jack MIDI ports are just like Jack audio ports, except that the + data being transmitted in each buffer are raw, timestamped MIDI + events instead of floating point audio samples. Jack MIDI is + sample-accurate. This means that a MIDI Note On event can occur + concurrently with a sound, and the two will never drift apart as + often happens to some extent with ALSA. + + In essence, Jack MIDI is a way of expressing a direct temporal + correlation between audio and MIDI data. + +// Note: +{ Older versions of QJackCtl and other connection managers do not +{ know about Jack MIDI ports. Please make sure you're using an +{ up-to-date version. + + When Non is started, it will create `Non:midi_in` and + `Non:control_in` input ports, as well as the 16 output ports with + names after the form `Non:midi_out-X`, where `X` is a number from 1 + to 16. These ports will be visible in any connection manager capable + of connecting Jack MIDI ports, as well as via the `jack_lsp` and + `jack_connect` command-line utilities. + + For example, to connect Non to ZynAddSubFX (the CVS version supports + Jack MIDI), type the following into the shell: + +> $ jack_connect Non:midi_out-1 ZynAddSubFX:midi_in + + Also, be sure that Zyn's outputs are connected to + system:playback\_\* so that you can hear the sounds it produces. + + It is possible to use Jack MIDI clients and ALSA MIDI clients + together via the bridge built into jackd. For this to work you must + append the `-X seq` option to the `alsa` driver section of the jackd + command line. Like so: + +> $ jackd -d alsa -X seq + + The way such bridged ports are named varies between Jack versions, + but they should be fairly obvious. When used in this way, many of + the advantages of Jack MIDI are lost, so it is recommended that you + find a Jack MIDI capable synth for best results. + +// Example of Jack MIDI connections in Patchage +< non-patchage.png + +:: Non Files + + The format of `.non` files is a variation of SMF-2. In an SMF-2 + file, each track chunk represents a pattern. Because Non groups + patterns into /phrases/, this usage of SMF-2 is probably not + compatible with other implementations (although, the author has + never actually seen another program that could play back SMF-2 + anyway.) + + Each phrase is stored as a track of MIDI Cue messages, each + referring to a pattern to be triggered. The sequence\/playlist is + stored as the first track, and consists of a list of Cue Point + meta-events referring to phrases. + + Also in the first track is a sequencer specific meta-event (ID + "Non!") containing song data that cannot be readily expressed with + existing meta events, and some versioning info to aid future + compatibility. + + In short, the author has done the utmost to save sequences in a + standard format--within reason; SMF was hardly designed with a + program like Non in mind--instead of some ad-hoc ASCII format (which + would have been *far* easier to implement), or worse, buggy, bulky, + and unmaintainable XML. + +:: Exports + + In addition to saving and loading `.non` files, Non can export + individual patterns as flat, SMF-0 MIDI files. + +:: Imports + + SMF-0 files can be imported as a new pattern (all channels merged), + or SMF-1 (such as those written by Seq24) and SMF-2 (ever seen one + of these?) can be imported as N new patterns (selected from a track + list.) All imported patterns are set to display the Chromatic scale, + in order that no notes be hidden from view. + + This should make it easy to migrate any existing patterns that you + may have over to Non, or to permit editing of Non patterns in + external programs (for graphic controller tweaking perhaps?) + +: Synchronization + + Non's transport is driven by the Jack Transport, so in order to sync + Non with a DAW like Ardour, you must set Ardour to be the Jack + Timebase Master. Therefore, all tempo mapping and time signature + information should be manipulated in the Timebase Master--Non will + respond to these changes automatically. If there is no Timebase + Master registered when Non starts, it will take over that role + instead. This is useful if you simply plan to use Non as a musical + instrument. + +: Control + + Non creates two MIDI input ports, one for /performance/ data and one + for /control/ data. The control port is used to control Non with + hardware MIDI controllers, such as the BCF2000, or other software. + The performance port is used to record musical data into patterns. + +: Playback + + The playback mode can be toggled between Pattern, Sequence and + Trigger. In Pattern mode (the default), all patterns are played + simultaneously, from the beginning, and looped forever. Since + patterns may differ widely in length, interesting compositions are + possible. In this mode, Non makes for a very intuitive software + instrument--rivaled only by the excellent program FreeWheeling (a + live audio looper.) + + In Sequence mode, playback strictly follows the sequence list and + the Jack transport, and does not loop. This mode is suitable for + parallel compositions between Non and a Jack Timebase Master capable + DAW. + + Trigger mode is very much like Pattern mode, except that all + patterns begin muted and must be enabled via the trigger view. + +: Sister Projects + + Much of the inspiration to move forward with Non was derived from JP + Mercury's highly useful and successful FreeWheeling + looper. Mr. Mercury is a visionary. + + But the closest sister of Non has to be the amazingly capable + ZynAddSubFX soft-synth by Nasca Octavian Paul. ZynAddSubFX, like + Non, utilizes the FLTK GUI toolkit, and has recently begun to + support Jack MIDI (albeit in a limited fashion.) This is, hands + down, the best synth available for Linux, and probably one of the + best period. If all you have is Non and Zyn, you have all that you + require to make great music. + + Of course, this section can hardly go without mention of Rob Buse's + Seq24. It was the author's unending frustration with the abysmal + performance and absurd limitations of Seq24 that, more than any + other single factor, inspired him to write Non. The most + frustrating aspect was that, prior to Non, Seq24 was, in the + author's opinion, the best sequencer available on Linux. Seq24, + which claims to be light and free of bloat is, without comparison, + the slowest, most poorly optimized sequencer the author has + tried. Even the huge, snarling beast that is RoseGarden out performs + Seq24 in every way but start time. + + Those days are over. diff --git a/sequencer/doc/Makefile b/sequencer/doc/Makefile new file mode 100644 index 0000000..715a525 --- /dev/null +++ b/sequencer/doc/Makefile @@ -0,0 +1,23 @@ + +SRCS=$(wildcard *.mu) +OBJS=$(SRCS:.mu=.html) + +%.html: %.mu + @ echo Mupping $<... + @ mup.wrapper html $< + +.PHONY: all clean + +all: $(OBJS) + +upload: all + @ ln -sf OVERVIEW.html index.html + @ rsync -L mup.css MANUAL.html index.html *.png ssh.tuxfamily.org:/home/non/non-sequencer.tuxfamily.org-web/htdocs + @ rm -f index.html + +install: + @ install -d "$(DESTDIR)$(DOCUMENT_PATH)/non-sequencer" + @ install -m 644 $(OBJS) *.png mup.css ../../COPYING "$(DESTDIR)$(DOCUMENT_PATH)/non-sequencer" + +clean: + rm -f $(OBJS) \ No newline at end of file diff --git a/sequencer/doc/OVERVIEW.html b/sequencer/doc/OVERVIEW.html new file mode 100644 index 0000000..22cb69f --- /dev/null +++ b/sequencer/doc/OVERVIEW.html @@ -0,0 +1,86 @@ + + + + + +The Non Sequencer + + +
+

The Non Sequencer

+

+
+Jonathan Moore Liles <male@tuxfamily.org>
+
+ +
logo
+
+
+

Description

+

+The Non Sequencer is a powerful real-time, pattern-based MIDI sequencer for Linux--released under the GPL. Filling the void left by countless DAWs, piano-roll editors, and other purely performance based solutions, it is a compositional tool--one that transforms MIDI music-making on Linux from a complex nightmare into a pleasurable, efficient, and streamlined process. +

+

+Please see the manual for more information. +

+

What it is not

+

+Non is not a plain MIDI recorder, tracker, software synthesizer, notation editor or AI system. There are other programs available to do those things. Non is intended to be one tool among many in your Linux audio toolbox. +

+

+Everything in Non happens on-line, in realtime. Music is composed live, while the transport is running. +

+

What does freedom have to do with this software?

+

+Non is free software. This means, briefly, that you are free use it as you wish, free to examine and adapt the source code, free to share it with your friends, and free to publish your changes to the source code. Furthermore, Non is copyleft, which means that you are free from the threat of some other entity taking over and denying you the above freedoms. The free part of free software doesn't refer to price any more than the free in free speech does. +

+

+To learn why free software is so important to us (and why it should be important to you), please see the Free Software Foundation's website: +

+

+What is Free Software? What is Copyleft? +

+

Donations

+

+Donations can take many forms. You can donate your time in code, either by sending it to me for review or cloning the git repository and publishing one containing your changes. You can donate your time in testing, documentation, artwork, indexing, etc. Or, if you don't feel that you possess the time or skills required for the above forms of donation, you can donate money instead. Money donated will help to ensure that I have the free time, good nutrition and enthusiasm required to implement new features. It can also be a more palpable way of saying "Thanks for caring." or "Job well done!" +

+

+If you don't love this software, don't feel guilty about not contributing. If you do love it, then please help me improve it--in whatever manner you think is appropriate. +

+

+Make a donation +

+

Distribution

+

+Development of the Non Sequencer can be followed with Git: +

+
+
+git clone git://git.tuxfamily.org/gitroot/non/sequencer.git
+
+

+There are no pre-compiled binaries available. +

+

Requirements

+

+The following libraries are required to build Non. +

+
  • FLTK >= 1.1.7 (with `fluid`) +
  • JACK >= 0.103.0 +
  • sigc++ 2.0 +

Community

+

+Feel free to drop by the #non channel on irc.freenode.net. +

+

+There is a mailing list non-sequencer@lists.tuxfamily.org. +

+

+To subscribe, send a message with the subject 'subscribe' to <non-sequencer-request@lists.tuxfamily.org>. +

+

+You can also browse the archive. +

+
+ + diff --git a/sequencer/doc/OVERVIEW.mu b/sequencer/doc/OVERVIEW.mu new file mode 100644 index 0000000..cc4fef4 --- /dev/null +++ b/sequencer/doc/OVERVIEW.mu @@ -0,0 +1,91 @@ + +! title The Non Sequencer +! author Jonathan Moore Liles #(email,male@tuxfamily.org) +! extra #(image,logo,icon.png) + +-- + +; Description + + The Non Sequencer is a powerful real-time, pattern-based MIDI sequencer for + Linux--released under the GPL. Filling the void left by countless DAWs, + piano-roll editors, and other purely performance based solutions, it is a + compositional tool--one that transforms MIDI music-making on Linux from a + complex nightmare into a pleasurable, efficient, and streamlined process. + + Please see the #(url,MANUAL.html,manual) for more information. + +; What it is not + + Non is *not* a plain MIDI recorder, tracker, software synthesizer, notation + editor or AI system. There are other programs available to do those things. + Non is intended to be one tool among many in your Linux audio toolbox. + + Everything in Non happens /on-line/, in realtime. Music is composed live, + while the transport is running. + +; What does freedom have to do with this software? + + Non is /free software/. This means, briefly, that you are free use it as + *you* wish, free to examine and adapt the source code, free to share it with + your friends, and free to publish your changes to the source code. + Furthermore, Non is /copyleft/, which means that you are free from the threat + of some other entity taking over and denying you the above freedoms. The + /free/ part of /free software/ doesn't refer to price any more than the + /free/ in /free speech/ does. + + To learn why free software is so important to us (and why it should be + important to you), please see the Free Software Foundation's website: + + #(url,http:\/\/www.fsf.org\/licensing\/essays\/free-sw.html,What is Free Software?) + #(url,http:\/\/www.fsf.org\/licensing\/essays\/copyleft.html,What is Copyleft?) + +; Donations + + Donations can take many forms. You can donate your time in code, either by + sending it to me for review or cloning the git repository and publishing one + containing your changes. You can donate your time in testing, documentation, + artwork, indexing, etc. Or, if you don't feel that you possess the time or + skills required for the above forms of donation, you can donate money + instead. Money donated will help to ensure that I have the free time, good + nutrition and enthusiasm required to implement new features. It can also be + a more palpable way of saying "Thanks for caring." or "Job well done!" + + If you don't love this software, don't feel guilty about not contributing. If + you do love it, then please help me improve it--in whatever manner you think + is appropriate. + + #(url,http:\/\/non.tuxfamily.org\/donation.html,Make a donation) + +; Distribution + + Development of the Non Sequencer can be followed with Git: + +> git clone git://git.tuxfamily.org/gitroot/non/sequencer.git + +# or +# +# > git clone git://repo.or.gz/src/git/non.git + + There are no pre-compiled binaries available. + +; Requirements + + The following libraries are required to build Non. + + +* FLTK >= 1.1.7 (with `fluid`) +* JACK >= 0.103.0 +* sigc++ 2.0 + +; Community + + Feel free to drop by the `#non` channel on irc.freenode.net. + + There is a mailing list `non-sequencer@lists.tuxfamily.org`. + + To subscribe, send a message with the subject 'subscribe' to + #(email,non-sequencer-request@lists.tuxfamily.org). + + You can also browse the #(url,http:\/\/listengine.tuxfamily.org\/lists.tuxfamily.org\/non-sequencer\/,archive). + diff --git a/sequencer/doc/icon.png b/sequencer/doc/icon.png new file mode 120000 index 0000000..a9b677a --- /dev/null +++ b/sequencer/doc/icon.png @@ -0,0 +1 @@ +../icons/hicolor/256x256/apps/non-sequencer.png \ No newline at end of file diff --git a/sequencer/doc/mup.css b/sequencer/doc/mup.css new file mode 100644 index 0000000..fd4229a --- /dev/null +++ b/sequencer/doc/mup.css @@ -0,0 +1,449 @@ + +/* Example CSS Style for MUP */ + +a:link { + color: yellow; +} +a:visited { + color: olive; +} +a:active { + color: white; +} +a:link:hover { + text-decoration: underline; +} + +/* #(url) */ +a.ext:link { + color: red; + text-decoration: none; + border-bottom: dashed silver 1; +} +a.ext:visited { + color: darkred; + border-bottom: dashed silver 1; + text-decoration: none; +} + +/* #(ref) */ +a.int:link { + border-bottom: dashed silver 0.15em; +} +a.int:link:hover { + text-decoration: none; + color: white; +} + +/* + a[href^="#"]:link { + border-bottom: dashed silver 0.15em; + } + a[href^="#"]:link:hover { + text-decoration: none; + color: white; + } + */ + +p:contains("Warning:") { + background: #d00; + color: white; + border: dotted gray 0.5em; + display: block; +} + +/* First letter of first paragraph of every chapter */ +/* + h1 + p:first-letter { + text-transform: uppercase; + float: left; + line-height: 0.8em; + font-size: 350%; + font-family: Serif; + letter-spacing: 0; + margin-right: 0.1em; + margin-top: 0.1em; + border: solid gray 1px; + padding: 1px; + color: #d00; + text-shadow: #666 3px 3px 3px; + } + */ +/* First paragraph of every chapter */ +/* + h1 + p { + text-indent: 0; + } + */ + +/* cover */ +#cover * { + background: transparent; +} +#cover { + position: relative; + background: #da0; + color: black; + text-align: center; + margin: 0; + padding: 0.5em; +} +#cover h1, #cover h3 { + text-shadow: #444 0.2em 0.2em 0.2em; + color: white; + border: none; + letter-spacing: 0.2em; + line-height: 0.8em; + margin-left: 2em; + margin-right: 2em; +} +#cover h1:before, #cover h1:after { + content: "::"; + font-size: 300%; + color: black; +} +#cover h1:before { + position: absolute; + top: 0.2em; + left: 0.1em; +} +#cover h1:after { + position: absolute; + top: 0.2em; + right: 0.1em; +} +#cover hr { + display: none; +} + +hr:first-child { + display: none; +} + +hr { + height: 0.2em; + background: #555; + color: #555; + margin-left: 0.5em; +} + +#cover a:visited { + color: black; +} + +/* endnote */ +#endnote { + color: black; +} + +/* TOC */ +#toc { + position: relative; +} +#toc hr { +} +#toc h1 { +} +#toc ul { + font-size: 125%; + font-weight: bold; + margin-bottom: 1em; +} +#toc ul ul { + font-size: 90%; + font-weight: normal; + margin-bottom: 0; +} +#toc li { + list-style: none; + +} +#toc a:link { + border-bottom: 0; +} + +body { + margin: 0; + background: #222; + color: white; + font-family: Arial, sans-serif; +} +/* */ +#body { + position: relative; + margin: 0.5em; + padding: 0.5em; +} +/* ;, : */ +h1 { + color: #ff0; + border-bottom: solid #444 0.1em; +} +/* ::, :::, ::::, :::::, :::::: */ +h2, h3, h4, h5, h6 { + color: #dd0; +} + +/* tables, figures */ +.fig caption { + color: gray; + text-align: center; + /* Required for Mozilla */ + margin: auto; +} +.fig table { + border: none; + margin: auto; +/* border-collapse: collapse; */ +} +/* / */ +.fig.table th { + border: none; + background: gray; + color: black; +} +/* [ */ +.fig.table td { + border: none; + background: silver; + color: black; + padding-left: 1em; + padding-right: 1em; + padding-top: 0.2em; + padding-bottom: 0.2em; +} +/* < */ + +.fig.image table { + border: dashed silver 0.2em; + background: transparent; + /* Every browser should support border radii */ + -moz-border-radius: 0.5em; + border-radius: 0.5em; + +} +.fig.image tr, .fig.image td { + border: none; + background: transparent; + padding: 0; +} + +/* */ +p { + margin-right: 2%; + text-align: justify; + text-indent: 1em; +} +/* > */ +.example * +{ + background: transparent; +} +.example table +{ + margin: 0; + padding: 0; + table-layout: fixed; + width: 100%; + caption-side: top; + overflow: auto; +} +.example caption +{ + caption-side: top; + +} +.example { +} +.example p { + display: inline; + margin: 0; + padding: 0; + text-align: center; +} +.example pre { + margin-top: 0; + font-family: Monospace; + padding: 1em; + border: dashed 0.3em gray; + background: #111; + color: white; + display: block; + overflow: auto; + /* Every browser should support border radii */ + -moz-border-radius: 0.5em; + border-radius: 0.5em; +} +/* " */ +/* + .quote:before { + float: left; + font-size: 500%; + content: "\201C"; + } + */ +/* + blockquote:after { + content: "\201D"; + }*/ +.quote blockquote { + padding: 0.5em; + margin-left: 0.5em; + font-family: Serif; + border-left: solid 0.4em gray; + /* background: #333; */ + color: white; +} +/* ^ */ +small { +/* + color: silver; + font-size: 50%; + */ +} +.footnote p { + color: silver; + margin: 0; +} + +/* Popup footnotes */ +.footnote p { + display: none; +} +.footnote p:target { + display: block; + overflow: auto; + position: fixed; + left: auto; + bottom: 0; + right: 0; + max-width: 50%; + border: solid 0.3em white; + -moz-border-radius: 0.5em; + background: black; + padding: 0.2em; +} + +/* { */ +.admonition * { + background: transparent; + color: white; +} +.admonition dl +{ + display: table; + margin: 0; + padding: 0; + background: #333; + border: dotted black 0.3em; + width: 90% + margin-top: 0.5em; + margin-bottom: 0.5em; +} +.admonition dt +{ + display: table-cell; + vertical-align: center; + border-right: solid silver 0.4em; + font-weight: bold; + font-size: 115%; + font-family: Serif; + background: gray; + width: 0; + text-shadow: black 0.15em 0.15em 0.15em; +} +.admonition dd +{ + padding-left: 0.4em; + display: table-cell; + width: 100%; + text-align: justify; +} + +.admonition table +{ + margin: 0; + padding: 0; + background: #333; + border: dotted black 0.3em; + width: 90% + margin-top: 0.5em; + margin-bottom: 0.5em; +} +.admonition td { + width: 100%; + text-align: justify; +} +.admonition td:first-child:contains("Warning:") { + background: #900; +} +.admonition td:first-child:contains("Caution:") { + background: #960; +} +.admonition td:first-child:contains("Note:") { + background: #690; +} +.admonition td:first-child { + border-right: solid silver 0.4em; + font-weight: bold; + font-size: 115%; + font-family: Serif; + background: gray; + width: 0; + text-shadow: black 0.15em 0.15em 0.15em; +} + + +/* #(b) */ +/* b { color: olive; } */ +/* #(c) */ +tt { + color: #7f0; +} +/* ! keywords ... */ +p em { + color: gray; + font-style: normal; + font-weight: bold; +} + +/* *, + */ +/* Bullet, numbe */ +li { + color: #f0f; +} +/* Text */ +li span, li p { + color: white; +} +li p { + color: red; + display: block; +} +ul { + list-style-type: square; +} +dl { + margin-left: 2%; + margin-top: 1em; +} +/* = */ +dt { + background: #181818; + padding: 0.2em; + font-variant: small-caps; + font-weight: bold; + color: #f0f; +} +dd { + color: white; + text-align: justify; + margin-right: 5%; +} +dt a:link, dt a:visited { + color: #f0f; +} +dt a:link:hover { + color: silver; + text-decoration: underline; +} diff --git a/sequencer/doc/non-cursors.png b/sequencer/doc/non-cursors.png new file mode 100644 index 0000000..ca3cd7f Binary files /dev/null and b/sequencer/doc/non-cursors.png differ diff --git a/sequencer/doc/non-event-editor-notes.png b/sequencer/doc/non-event-editor-notes.png new file mode 100644 index 0000000..6318641 Binary files /dev/null and b/sequencer/doc/non-event-editor-notes.png differ diff --git a/sequencer/doc/non-new-about.png b/sequencer/doc/non-new-about.png new file mode 100644 index 0000000..543e430 Binary files /dev/null and b/sequencer/doc/non-new-about.png differ diff --git a/sequencer/doc/non-patchage.png b/sequencer/doc/non-patchage.png new file mode 100644 index 0000000..3379098 Binary files /dev/null and b/sequencer/doc/non-patchage.png differ diff --git a/sequencer/doc/non-pattern-editor.png b/sequencer/doc/non-pattern-editor.png new file mode 100644 index 0000000..e56e2e5 Binary files /dev/null and b/sequencer/doc/non-pattern-editor.png differ diff --git a/sequencer/doc/non-pattern-triggers.png b/sequencer/doc/non-pattern-triggers.png new file mode 100644 index 0000000..b852378 Binary files /dev/null and b/sequencer/doc/non-pattern-triggers.png differ diff --git a/sequencer/doc/non-phrase-editor.png b/sequencer/doc/non-phrase-editor.png new file mode 100644 index 0000000..eda1218 Binary files /dev/null and b/sequencer/doc/non-phrase-editor.png differ diff --git a/sequencer/icons/hicolor/128x128/apps/non-sequencer.png b/sequencer/icons/hicolor/128x128/apps/non-sequencer.png new file mode 100644 index 0000000..a76f677 Binary files /dev/null and b/sequencer/icons/hicolor/128x128/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/16x16/apps/non-sequencer.png b/sequencer/icons/hicolor/16x16/apps/non-sequencer.png new file mode 100644 index 0000000..e360a04 Binary files /dev/null and b/sequencer/icons/hicolor/16x16/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/192x192/apps/non-sequencer.png b/sequencer/icons/hicolor/192x192/apps/non-sequencer.png new file mode 100644 index 0000000..f8dd822 Binary files /dev/null and b/sequencer/icons/hicolor/192x192/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/256x256/apps/non-sequencer.png b/sequencer/icons/hicolor/256x256/apps/non-sequencer.png new file mode 100644 index 0000000..e645aa7 Binary files /dev/null and b/sequencer/icons/hicolor/256x256/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/32x32/apps/non-sequencer.png b/sequencer/icons/hicolor/32x32/apps/non-sequencer.png new file mode 100644 index 0000000..16771b0 Binary files /dev/null and b/sequencer/icons/hicolor/32x32/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/36x36/apps/non-sequencer.png b/sequencer/icons/hicolor/36x36/apps/non-sequencer.png new file mode 100644 index 0000000..987458f Binary files /dev/null and b/sequencer/icons/hicolor/36x36/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/48x48/apps/non-sequencer.png b/sequencer/icons/hicolor/48x48/apps/non-sequencer.png new file mode 100644 index 0000000..4297021 Binary files /dev/null and b/sequencer/icons/hicolor/48x48/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/512x512/apps/non-sequencer.png b/sequencer/icons/hicolor/512x512/apps/non-sequencer.png new file mode 100644 index 0000000..19aab98 Binary files /dev/null and b/sequencer/icons/hicolor/512x512/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/64x64/apps/non-sequencer.png b/sequencer/icons/hicolor/64x64/apps/non-sequencer.png new file mode 100644 index 0000000..e7aaf0f Binary files /dev/null and b/sequencer/icons/hicolor/64x64/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/72x72/apps/non-sequencer.png b/sequencer/icons/hicolor/72x72/apps/non-sequencer.png new file mode 100644 index 0000000..2d5d7fa Binary files /dev/null and b/sequencer/icons/hicolor/72x72/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/96x96/apps/non-sequencer.png b/sequencer/icons/hicolor/96x96/apps/non-sequencer.png new file mode 100644 index 0000000..1886fcb Binary files /dev/null and b/sequencer/icons/hicolor/96x96/apps/non-sequencer.png differ diff --git a/sequencer/icons/hicolor/scalable/apps/non-sequencer.svg b/sequencer/icons/hicolor/scalable/apps/non-sequencer.svg new file mode 100644 index 0000000..218b9fd --- /dev/null +++ b/sequencer/icons/hicolor/scalable/apps/non-sequencer.svg @@ -0,0 +1,998 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sequencer/icons/icon-16x16.xpm b/sequencer/icons/icon-16x16.xpm new file mode 100644 index 0000000..9e7f588 --- /dev/null +++ b/sequencer/icons/icon-16x16.xpm @@ -0,0 +1,581 @@ +/* XPM */ +static const char *icon_16x16[] = { +/* columns rows colors chars-per-pixel */ +"319 319 256 2 ", +" c #007400670066", +". c #0D6B09B201FA", +"X c #0A540A540A54", +"o c #093D067402B2", +"O c #13050D090215", +"+ c #1C1C130A013A", +"@ c #17F0116E03C0", +"# c #135113511351", +"$ c #1B481B481B48", +"% c #21BB167F00B3", +"& c #255B194D0161", +"* c #2C2D1D6800E2", +"= c #252F1BD008B3", +"- c #2A9D1E6F08C9", +"; c #2D3C211008B1", +": c #33D222810124", +"> c #397A2625011F", +", c #3DBB2916011F", +"< c #35CD266909A1", +"1 c #2A4C232C1537", +"2 c #32B9287E13BA", +"3 c #3EBF321219FA", +"4 c #23C023C023C0", +"5 c #2BB42BB32BB0", +"6 c #3A763467287E", +"7 c #33673365335F", +"8 c #3BD33BCE3BC1", +"9 c #3996384F361F", +"0 c #35752E6E2161", +"q c #43CD2CF80114", +"w c #45472ED904D0", +"e c #4BE93281018E", +"r c #494D328C06B2", +"t c #51E4362200F2", +"y c #55BE39080141", +"u c #5CD13D4B00F7", +"i c #55963B6A098C", +"p c #496637FF16DE", +"a c #60B13F610097", +"s c #46733BA52773", +"d c #43633EBF3737", +"f c #5F16408E053E", +"g c #5A8543991843", +"h c #63ED4286028D", +"j c #6A1C468A02CE", +"k c #6DF749650442", +"l c #693A48180917", +"z c #74084D4802D8", +"x c #78CE4F4C010E", +"c c #73E84ED70843", +"v c #7D0A52C40133", +"b c #767150F40870", +"n c #7C3154DB09E6", +"m c #7DCF57010C16", +"M c #7797568C16CC", +"N c #69494D8D1838", +"B c #57AD478028F0", +"V c #488A43F53A47", +"C c #56204BD23838", +"Z c #5A1A4EBE3848", +"A c #68AC58413931", +"S c #6DC357202BEE", +"D c #79E5639F38E5", +"F c #7DFE61612AAB", +"G c #42E942D742B6", +"H c #4C2A4C064BAB", +"J c #4B234949456D", +"K c #518B4D9F45F4", +"L c #54A752254CFA", +"P c #5B7A559E49FA", +"I c #53FA53C05333", +"U c #5CB85A1B54EF", +"Y c #5B845B3E5ACE", +"T c #5947573252F7", +"R c #68C85C6E44EB", +"E c #62BC5DF15484", +"W c #61075EC55A74", +"Q c #767B669F4871", +"! c #648E61B55BE9", +"~ c #6AF165E65C63", +"^ c #6C31662B5A12", +"/ c #75606D9F5E90", +"( c #75EA6A76546B", +") c #76516ACC5491", +"_ c #644F643163F8", +"` c #6CAF69DB645F", +"' c #6CAD6C1B6B11", +"] c #68F566DA6356", +"[ c #726C6D4E6356", +"{ c #70F76EBF6ABB", +"} c #7B8E72F96215", +"| c #745A71E06D4C", +" . c #7A5C75A26C30", +".. c #798873EC68C3", +"X. c #761E758D7418", +"o. c #7958773573BB", +"O. c #7C7C79B9745D", +"+. c #7E4C7D717C27", +"@. c #824856610127", +"#. c #860B591B0137", +"$. c #8C2C5D0A011F", +"%. c #83EF5ABB0BC2", +"&. c #89165EBF0C5F", +"*. c #812A5765089E", +"=. c #90AB5F780141", +"-. c #86895EC21127", +";. c #8C4F61C40DF3", +":. c #8F7D60330393", +">. c #9435625B0125", +",. c #9A9F666D0116", +"<. c #9E98691A011A", +"1. c #92C4650B0C35", +"2. c #9E486BC10A0A", +"3. c #8B0261A910A5", +"4. c #8B3564BA1A37", +"5. c #949F69171494", +"6. c #A4376CD60121", +"7. c #A8B56F760120", +"8. c #A2226EEF0B0B", +"9. c #AC8A725E012A", +"0. c #A8E173560BD3", +"q. c #B2AC766D0133", +"w. c #B6AB7927013A", +"e. c #BC377CBC0155", +"r. c #B4797A8E0B0B", +"t. c #A9A978EB193C", +"y. c #B2D77EDA18AB", +"u. c #8B926AB22B94", +"i. c #9B1E74482997", +"p. c #85FF6AF536DF", +"a. c #976076B937B2", +"s. c #8EE46FB633C2", +"d. c #A5927ABF289F", +"f. c #A3487D6E3562", +"g. c #C0DB7F7D01F6", +"h. c #8B0A7410482B", +"j. c #95B87B894949", +"k. c #86CB769B56F9", +"l. c #8A0074FE4D61", +"z. c #850D7B8468ED", +"x. c #83377E1C743B", +"c. c #80CF7F3B7CDA", +"v. c #BAA083F319CB", +"b. c #BD6780AB0B36", +"n. c #BA4D895A2A8F", +"m. c #AB95842537FB", +"M. c #B7F38B92364A", +"N. c #BE1C915B3B05", +"B. c #AF0482022BAC", +"V. c #C4D282480206", +"C. c #CAE486330206", +"Z. c #CED288EC0211", +"A. c #C70B86C20AA4", +"S. c #D45B8C940211", +"D. c #D8E68F890216", +"F. c #D3538EB90A60", +"G. c #DCD49241021E", +"H. c #D87D920A0A0A", +"J. c #C7D38B5116AE", +"K. c #D855970019B0", +"L. c #CDCD90901B1B", +"P. c #E2D196200220", +"I. c #E6E998EC0222", +"U. c #EC439C540239", +"Y. c #E70B9BE40C7A", +"T. c #F13D9F9A0260", +"R. c #E3A79E4319DE", +"E. c #F554A25E025E", +"W. c #FB90A67D026E", +"Q. c #FFF1A9A1030B", +"!. c #FFDCAC9C0C02", +"~. c #F4DAA5600C0C", +"^. c #EB39A38219EC", +"/. c #FFB7AEA912BC", +"(. c #F2F0A8571941", +"). c #FFFAB1FA1C21", +"_. c #FFFFB0B01717", +"`. c #EF99A2220D0D", +"'. c #C32E8E8E28EF", +"]. c #CB98946129DD", +"[. c #D6E49B0C27A0", +"{. c #C9449765370B", +"}. c #D36B9E423768", +"|. c #DB2DA38B37C9", +" X c #DE48A1762C97", +".X c #E854A7032967", +"XX c #F41CAE32285A", +"oX c #FFDAB4782385", +"OX c #FFB0B6EE2B4D", +"+X c #FFFFB8B82E38", +"@X c #F688B1802C69", +"#X c #ECC9AD8A33BE", +"$X c #E48EAA7F3A6C", +"%X c #E699AA43362B", +"&X c #EF2EB1A13B2B", +"*X c #F4A9B304340B", +"=X c #FAC8B6DB3394", +"-X c #FFE6BAA1341B", +";X c #F483B50E3AC1", +":X c #FFBFBD003B88", +">X c #F8D6B7FC3AB2", +",X c #F1C6AFAF3106", +" t h v #.,.7.e.C.Z.D.G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H L H G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G H I T _ +.eXdXgXzX(.W.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.(.xXgXiXwXo.! L L H H G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G H H H I ] X.wXSXsX6XJ.S.Z.S.S.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.A.3XfXSXAX+._ I H H G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G J H H Y | ZXAXiX8Xd.,.6.,.<.,.,.6.<.<.,.<.<.,.,.,.,.,.,.,.,.>.,.=.,.>.>.>.,.>.>.,.,.<.2.e UXUXUX", +"UXo n Q.Q.Q./.).).).).).).).)._.).).cXJXDX+.H $ # 9 ` AXfXzX~.W.Q.Q.Q.Q.Q.Q.Q.Q.Q.!.zXfXwXY 7 # o # 9 _ AXfX'.Z.Z.Z.S.Z.S.Z.Z.Z.C.Z.C.'.sXAX_ 9 # o 5 I qXtX4X5.,.6.<.6.,.<.,.6.,.,.,.,.,.,.,.,.,.>.,.=.,.=.>.>.>.>.>.,.,.,.,.<.e UXUXUX", +"UX v W.Q.Q./.).).).).).).).).).).cXPXqX8 $ X 4 ` uXlX`.W.W.Q.Q.Q.Q.Q.Q.Q.zXdX` $ 4 X.uXn.V.Z.Z.Z.Z.Z.Z.Z.Z.C.'.GX| 4 X H 9XDXi.,.,.,.6.<.,.,.<.,.,.,.,.,.,.,.>.,.>.,.>.,.>.>.>.>.>.>.>.,.<.<.r o UXUXUX", +"UXo n Q.Q.Q./.).).).).)._.).).).,XJXO.4 # $ X H SXlXT.E.W.Q.Q.Q.Q.Q.(.GX_ X # X.dXr.V.Z.Z.Z.Z.Z.C.C.C.sXO.# 4 O.uX1.>.,.,.<.,.,.,.,.,.,.,.>.,.>.,.>.>.,.=.>.>.>.:.>.>.>.,.>.,.2.w o UXUXUX", +"UX v W.Q.Q.!.).).).).).).)._.).MXDX5 # $ # Y fXK.T.E.W.Q.Q.Q.Q.zXtX$ 7 tXm.w.V.C.Z.Z.Z.Z.C.'.uX8 5 9Xj.=.>.,.,.,.<.,.,.,.,.,.,.,.,.>.>.,.=.>.>.>.>.>.>.>.>.>.,.<.<.e UXUXUX", +"UX v Q.Q.Q.!.)._.).).)._.).).).MXX.$ $ # # 4 eXM.D.U.E.Q.Q.Q.Q.mXX. X qX.,.,.,.,.,.>.>.,.>.=.,.,.>.>.>.>.>.:.>.>.>.>.>.>.,.,.2.w o UXUXUX", +"UX v W.Q.Q.!.).).).).).).)._.).PX_ # # # # # wX2XC.P.E.W.Q.Q.W.jX_ +.j.>.9.g.C.C.C.C.C.3XZXX Y eXk #.:.,.,.,.,.,.,.,.>.,.>.>.>.>.>.>.>.=.>.>.$.>.$.>.>.,.,.<.w o UXUXUX", +"UXo v W.Q.Q.!.).).)._._.)._.).(.JX_ # $ # X 4 5 9 8 J H I I I I I I I I I I I I I I I I I I I I I I I I I I H G G 8 5 # X ZXj.w.S.T.E.Q.Q.E.jXW o 4 8 G G H H H H H H H H H H H H H H H H J G 9 $ O.z.#.<.q.V.C.C.C.C.6XZXo # 5 7 8 8 G H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H G G G 9 5 4 o Y wXh x #.:.>.,.,.,.,.,.>.,.>.>.>.>.>.:.>.=.>.$.>.:.>.$.>.>.,.<.r UXUXUX", +"UX v Q.Q.Q.!.)._.).).).).).).oXJX_ # # # o H X.+.ZXc.c.ZXc.ZXqXqXqXZXqXqXqXqXqXZXqXqXZXqXqXqXqXqXZXqXc.qXqXqXZX+.ZXc.+.qXZX{ $ o X ZXl.6.C.I.T.W.W.E.gX_ $ Y +.+.+.qXqXZXc.qXZXc.qXqXqXqXqXc.qXqXqXc.c.c.c.c.ZXX.H X X.k.x ,.q.V.V.C.C.V.5X0X 4 ' +.+.+.c.qX+.qXc.qXqXqX+.c.ZXc.qXZXc.ZXc.c.c.c.c.c.c.c.c.ZXc.c.qXZXc.c.c.c.ZXc.ZXZXc.ZXc.+.+.+.H o T AXy k @.=.,.,.>.>.>.>.>.>.>.>.>.>.:.>.>.=.>.$.$.>.$.>.>.>.,.,.w o UXUXUX", +"UXo n W.Q.Q./.).)._._.)._._./.(.PX_ # # # J c.` J s 0 0 2 2 ; < ; < ; < < < ; ; ; < < ; ; < < < < ; < < < < ; < 2 3 s 3 s P qX{ X qXl.:.e.G.E.W.W.T.jXY H c.ZX! V 0 1 ; - ; ; ; : ; ; ; ; ; ; ; : ; ; - 2 2 3 K | ZXX.5 O.} j =.9.g.V.C.C.g.5XqXo $ +.O.L s 0 0 2 1 = = = = = = = = = = = * = % = = = = = = = = % = = = % = = = = = & = 1 ; 1 0 6 C ` +.G Y wXt j v =.>.>.>.,.>.>.,.:.,.>.>.>.:.>.=.=.$.>.$.>.>.>.>.>.,.,.w UXUXUX", +"UX v Q.Q.Q.!.).)._.)._._.).(.(.PX_ $ # # O.{ % & * > q q e e t e t t t t e t t t t t t t e t t t t t e t e t t t t e e q q R qX4 X qXQ $.q.S.T.E.W.T.gXW I qX] 1 % * : > > q q q q q e q q w q q q q q q q q q q q > B O.+.G o.} h #.7.e.V.C.C.g.5XqX H c.4 @ + & * : : > > > : > > > > > > > > > > > > > < > : > > > > > : > : : : : : : : : > : * : * * o.X. I wXq h x =.=.,.,.>.>.,.>.>.=.>.=.=.=.:.:.=.>.$.=.$.:.$.>.>.,.,.r UXUXUX", +"UX v W.Q.Q.!.)._._.).).)._.).(.PX! # # # # ZXK * q t h j x x x x n v v v v v v n v v v v v v v v v v v v v x v v x v x x k k M wX8 X c.( #.q.S.T.W.W.T.gX_ 5 +.U % * > q t y h h j j j k j j j j j j j j j j j j h a a y e r } +.# X.} h #.6.e.V.C.C.g.5XqXo ` | + * : q e e t y y y y y y y u y y y y y y y y y y y y y y y t t t y t t t t t t t t t t e e e q E qXX Y qXq u x #.>.>.,.>.,.:.:.>.:.>.=.=.:.=.=.=.>.$.$.:.$.>.>.:.>.,.r o UXUXUX", +"UX n W.Q.Q.!.).)._._._._._.).(.JXY # # X 4 ZXC q u x #.1.6.6.6.6.7.7.7.9.7.9.7.9.7.7.7.9.7.7.7.0.7.0.7.7.7.q.7.8.7.7.7.6.6.1.3.tXG X ZXQ @.9.S.U.E.E.T.gXY I c.1 * , t h x @.#.=.:.>.>.>.>.>.>.=.>.>.=.>.:.:.=.$.=.$.#.@.z j S wX7 X.} a #.6.w.g.C.V.g.5X9X X.` * > t h j k x x x x x v x x x x x x x x z x z x z z z z z k z k x k z z k k k k k k k j j j h u D wX$ T ZXq h x #.=.>.>.>.>.:.>.>.>.=.=.=.>.=.=.=.$.:.$.=.$.$.=.>.>.,.r UXUXUX", +"UXo v Q.Q.Q.!.).)._._._._._.(.(.PX_ # # o 4 ZXZ y x <.q.V.C.C.S.S.S.S.S.Z.S.S.S.S.Z.S.S.S.S.Z.Z.S.S.S.S.S.S.S.S.S.S.Z.Z.Z.C.V.w.uXI # qXQ @.9.S.U.E.E.U.sXY I +.< q u x =.,.6.q.q.w.q.w.w.w.w.q.w.w.w.w.w.q.q.q.q.q.q.7.6.,.$.u.AX8 X.} u #.6.w.V.V.V.g.5XqX X.~ > t j v #.:.:.:.,.,.,.:.,.,.:.>.>.>.:.:.:.=.=.=.=.=.$.=.$.$.=.=.=.$.#.=.#.=.#.#.#.#.#.#.#.@.@.x p.wX4 U wXq u x #.:.>.>.>.:.,.:.,.=.:.=.=.=.=.=.$.$.$.=.$.$.=.>.:.>.,.w UXUXUX", +"UX x Q.Q.Q.!._._._.)._._.)./.(.JX_ # # 4 +.S k ,.w.S.G.I.I.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.T.U.U.U.T.U.U.U.U.U.U.U.U.U.U.U.G.S.sX| X 7 ZXS @.9.S.U.E.W.U.gX_ 7 c.R y x >.9.w.V.C.C.Z.Z.Z.Z.Z.Z.C.C.Z.g.g.Z.Z.C.V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Q.!._.)./._./._._._.(.JXY X X # X # # # # X # # # # X # # # # # # # X # # # # # X # # # # X # # # # # # # # X $ $ $ 4 7 H ` qXAXaXM.Z.D.P.U.T.E.T.E.T.I.sXW 7 qXZ u @.<.w.e.g.g.r.4XwXX X./ y x :.6.q.q.q.q.q.q.q.7.q.9.q.9.9.9.7.9.9.9.9.9.6.7.6.6.6.6.6.6.6.6.6.<.6.6.<.<.6.<.<.<.<.<.<.,.a.wX4 Y qXq y k @.$.=.$.$.$.=.$.$.$.$.$.$.$.$.#.$.#.#.#.;.3.;.#.=.=.>.w UXUXUX", +"UXo x Q.Q.Q.!._./././._._././.(.JX] X X 8 o.uXkXG.U.T.E.E.T.E.T.P.sX_ X X.c.w h @.6.q.e.V.V.w.4XqX X.[ y z >.6.9.b.q.q.q.q.q.9.q.9.9.9.9.9.9.7.9.6.9.7.7.6.7.7.6.6.6.6.6.6.<.6.<.6.<.<.6.<.<.<.<.<.,.,.a.0X4 Y qXq y k @.$.$.$.:.$.$.$.#.$.$.$.$.#.#.#.$.#.#.#.3.1.;.#.=.$.>., X UXUXUX", +"UX v W.Q.Q.!._.)./._././././.~.jX+.X X Y SX{.U.U.T.E.E.E.T.U.sXW $ | ZXs q h #.6.w.e.e.e.e.4XqX O./ y z :.6.9.9.9.q.7.q.7.9.q.9.9.9.9.9.7.9.9.9.6.7.7.7.7.6.6.6.6.6.6.6.6.<.6.6.<.<.<.<.,.<.,.,.,.,.s.AX4 Y 9Xq y k @.$.$.:.$.$.$.$.$.$.#.$.#.#.$.#.#.#.#.;.3.1.&.#.$.$.:.w UXUXUX", +"UX v Q.Q.Q.!._././._././././.(.xXSX5 X { fXF.P.T.T.T.E.U.P.sXW # 7 _ +.O.d : t k =.8.w.e.e.b.w.4XwXX X./ y z >.6.9.q.q.q.q.9.q.9.9.9.9.9.9.9.7.7.7.7.7.6.7.7.6.6.6.6.6.6.6.6.6.6.6.<.<.<.<.<.<.,.,.<.<.:.a.wX4 T ZX> y k @.#.$.$.$.$.$.$.$.$.$.#.#.$.#.#.#.#.#.3.3.3.&.#.$.:.>.w UXUXUX", +"UX x Q.Q.Q.!././._./._._././.(.R.GXo.$ 7 tXn.S.I.U.T.T.T.I.sX_ $ 7 8 H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H G G H I ] X.+.ZXc.L 2 * w u v ,.q.w.e.V.e.w.4XqX X./ y b :.<.9.9.q.q.7.q.7.9.9.9.9.7.9.7.7.7.7.7.7.7.6.6.7.6.6.6.6.6.6.<.<.<.<.<.<.<.<.<.,.<.,.,.,.,.a.wX4 T wXq y k v $.$.$.$.$.$.$.$.#.#.$.#.#.#.#.#.#.&.3.3.3.;.#.=.$.:.w UXUXUX", +"UX n Q.Q.Q.!./._./._././././.~.R.{.uXc.G X $ wX2Xg.D.I.T.T.T.I.sX_ 4 ' +.+.+.c.c.c.c.c.qX+.c.qXc.c.c.ZXc.+.c.+.c.qXqXc.qX+.+.qXZXqX+.+.9Xc.c.+.qX+.c.c.X._ P 6 = & * q y z $.6.q.w.g.e.e.w.4XqXo +./ y z >.6.9.9.9.7.9.q.7.9.9.9.7.7.7.7.7.7.7.7.6.6.6.6.6.6.6.6.6.6.6.6.<.<.<.<.<.<.<.,.<.,.,.,.,.:.a.wX4 Y qX> y k @.#.$.$.$.$.$.#.#.$.#.#.#.#.#.#.#.#.-.3.3.3.&.#.$.$.:.w UXUXUX", +"UXo v Q.Q.Q.!./././././././././.`.H.t.yXAX+._ G 5 $ X o X X X o o X X X o X X X o X X X o X X X X o o # 9Xj.9.Z.P.U.T.U.P.gXY $ O.O.L 6 0 2 2 2 2 1 2 2 2 2 2 2 2 ; 2 2 2 2 2 2 ; 2 2 2 2 2 ; 2 2 2 2 1 2 2 2 2 - & & & * * : > e u k #.,.9.w.e.g.e.e.w.4XwX o./ y z $.6.9.9.9.7.q.9.9.9.7.9.9.7.9.7.7.7.6.7.6.7.6.6.6.6.<.<.6.6.<.<.<.<.<.<.<.<.,.,.,.,.,.,.,.,.a.wX$ Y qXq y k v #.$.$.#.$.$.#.$.#.#.#.#.#.#.#.v #.3.3.3.3.&.#.$.$.>.w UXUXUX", +"UX v Q.Q.Q.!._././._././././.(.^.K.e.>.F ) 9Xc.qXqX+.c.c.c.+.+.+.+.+.c.+.+.+.c.+.+.+.c.+.+.+.c.+.ZX+.+.O.{ ] I 8 $ X c.l.>.e.D.U.U.U.P.sX_ G +.0 % & * > > > q q , q , , q , q , , , > q , , > , , , > > > , , , > > , , > > > q q q q e t u j x =.,.7.w.e.e.e.e.e.q.4XqX o.[ y z =.6.6.9.9.q.9.9.9.9.9.9.7.7.7.7.7.6.7.6.7.6.6.6.6.<.6.6.<.<.<.<.<.<.<.<.,.,.,.,.,.,.,.,.:.:.a.wX4 Y ZX, y k v #.$.$.#.$.#.$.#.#.#.#.#.#.#.#.#.&.3.-.3.&.&.#.#.$.>.w UXUXUX", +"UX x W.Q.Q.!././././.!./././././.Y.Z.q.$.z i g B P P E E E ! E E E W E E E W E E E W E E E W E E E E ] ~ ' X.qXqXc.I X qXl.=.q.S.P.U.U.P.sXY Y c.% * q t y a h h h h h h h h a a h a h h h h f h a h a f a h a u u h u a u u u a u a h j j z @.#.>.6.7.q.e.e.e.e.e.e.q.4XqXX o./ y z $.6.9.9.9.7.9.9.7.7.7.7.7.7.7.7.6.7.6.6.6.6.6.6.6.6.6.<.6.<.<.<.<.<.<.,.<.,.,.,.,.,.,.,.,.,.s.wX4 T ZX> y j @.#.#.$.$.#.#.#.$.#.#.#.#.#.#.v #.3.-.3.3.&.%.@.$.$.$.w UXUXUX", +"UXo v W.W.Q.!._./././././././.!./.~.P.C.9.>.x j y t q q q > > > > > > > > > > > > > > > > > > > > > > > > : : < s ^ ZX8 # qXQ #.9.Z.P.U.U.P.sXW Y qX* q u k v #.$.=.=.$.$.=.$.$.=.#.$.#.#.#.$.#.#.#.#.*.#.#.#.#.#.#.#.#.#.@.@.@.@.@.@.*.#.#.=.=.,.6.9.q.w.w.e.e.e.e.e.w.q.4XwXX X./ y z $.<.7.9.9.9.9.7.9.7.7.7.7.7.7.6.7.6.6.6.6.6.6.6.<.6.<.6.<.<.<.<.,.<.<.<.,.,.,.,.,.>.,.>.,.=.s.eX4 Y qX, y j x #.#.#.#.$.#.$.#.#.#.#.#.@.@.#.-.-.-.-.&.3.%.#.$.$.=.q UXUXUX", +"UX v W.W.Q.!././././.!./././././.~.U.P.Z.b.6.>.@.x k k h h h h a h f f u h u h f f f f f h f f h u u h h a u y y t x.` X qX( v 6.Z.G.U.U.G.sX_ T qX, u x =.<.6.7.7.7.7.7.7.7.8.7.7.6.7.7.7.7.6.6.6.7.7.6.6.6.6.<.<.<.<.<.<.<.,.6.6.<.6.6.7.7.9.9.q.q.e.e.e.e.V.e.e.e.e.q.4XqX X./ t z $.6.7.9.7.9.7.9.7.7.7.7.7.7.7.6.6.6.6.6.6.6.6.<.6.<.6.<.<.<.<.<.<.,.,.,.,.,.,.,.,.,.>.,.>.=.a.wX4 U qX, y j v #.#.$.#.#.#.#.#.#.@.@.@.#.@.#.&.3.-.-.-.&.%.@.$.$.=.q UXUXUX", +"UX n Q.Q.Q.!././././././././././.Q.W.T.Y.].N.5X5XaX4Xj.a.5.=.>.=.=.$.:.=.=.$.:.=.=.=.=.=.=.:.:.:.$.=.=.=.$.$.#.v z k.c. X qX( v 6.C.G.U.U.H.sXW T ZXe j =.6.w.e.V.g.V.V.V.e.e.V.e.V.e.e.e.e.e.e.e.e.e.e.w.w.w.w.w.e.w.w.w.w.w.r.w.q.q.q.w.w.e.e.e.e.e.e.e.e.e.e.e.w.e.w.q.4XqX X./ y k $.<.6.9.9.7.7.7.9.7.7.7.6.7.6.6.6.6.6.6.<.6.6.6.<.<.<.<.<.<.<.<.<.,.,.,.,.,.>.>.,.>.,.>.,.$.s.wX4 Y qX, y j v #.#.#.#.#.#.#.#.@.#.@.@.@.@.&.-.-.-.&.&.&.$.@.#.$.=.q UXUXUX", +"UXo v Q.Q.Q.!./././././.!./.!./.!.Q.(.xXgXdX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SXtXtXtX0XO.Y $ X +.Q x <.V.D.P.P.G.sXW X Y c.wXeXtXtXtXtXtXtXtXtXtXSXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXeXAX| 7 X.} f v ,.6.q.q.q.7. o UXUXUX", +"UX v W.Q.Q.!././.!./.!./.!./.`.GXI o $ $ 4 4 5 5 5 5 4 5 5 5 5 5 5 4 4 $ # # c.Q x <.V.S.P.I.D.sX_ X $ 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 # X./ y v ,.6.q.q.q.7.4XqXX # # 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 $ # o $ ` wXpXu.v v #.v v %.%.%.%.%.-.m %.%.%.*.*.*.%.*.x @.#.#.> o UXUXUX", +"UX n Q.Q.Q.!.!.!.!.!.!.!.!.!.~.gXU # c.Q x ,.V.S.P.P.D.gX] c./ y x :.7.q.q.q.9.4XZXX 8 O.eX o UXUXUX", +"UXo x Q.Q.Q.!.!./.!./.!.!.!./.~.lXeX4 I AXg x 6.V.G.G.P.G.3XeX5 G c.B y x :.6.7.q.9.7.t.tXH $ ' wXSXa.-.%.%.*.-.*.*.M *.*.m m *.*.n x @.@.*., UXUXUX", +"UX v W.Q.Q.!.!.!.!.!.!.!.!.!.~.K.dX{ X 8 +.^ t x 6.V.S.P.P.D.A.dXO.# 5 +.| , y v ,.6.9.q.q.7.<.8XZX5 8 +.SXz.D %.*.*.*.*.*.*.m m n n n *.x x @.$.< UXUXUX", +"UX v Q.Q.Q.!.!.!.!.!.!./.!.!.~.I.N.uXX.5 # I c.| , y #.7.V.S.P.P.G.C.B.iX+.7 X G +.+.2 q f v ,.6.q.q.9.9.6.1.yXqXJ X o o X $ I AXSXk.-.*.M *.M *.n n n m n n x @.@.@.> o UXUXUX", +"UX x Q.Q.Q.Q.!.!.!.!.!.!.!.!.~.U.Z.d.uXZX| H 5 # X 4 G Y c.qX! < q j =.q.Z.G.G.G.G.Z.w.i.rXAXX.I 7 # o o $ 8 I X.+.{ 2 : e j #.<.6.9.9.q.7.6.:.-.z.wX+.I 8 $ X X # X X X 4 ] SXSXF M n *.n n m n n *.b x v @.@.> o UXUXUX", +"UX n Q.Q.Q.Q.!.!.!.!.!.!.!.Q.W.T.G.w.1.p.9XwXc.qXc.| ' _ _ _ _ _ ] ] ] ] ] _ _ ] ] _ ] _ ] _ _ ] _ ] ] ] _ _ _ _ ] _ ] ] ] _ _ _ _ _ _ _ _ _ ] ] _ ] _ ] _ _ _ _ ' ' O.+.ZXc.c.E 3 = , y x <.w.Z.G.P.P.G.S.V.6.#.D z.qXc.c.c.| { ] ] _ ] _ _ ] ] _ _ ] ] ] _ _ _ ] _ _ ] _ _ ] ] ] _ _ _ _ _ _ ] _ _ ] _ _ _ _ _ ] _ _ ] _ _ ] ] _ _ _ _ _ ] ] ] _ ] _ _ _ ] _ _ _ ' X.+.+.+.qX] 6 & * , f z =.<.7.q.q.q.7.6.,.#.k S / wXc.c.c.X.{ ] _ ] ] _ _ ] _ _ _ _ _ _ _ _ _ _ ] ] _ _ _ _ _ ] _ _ _ ] ] ] _ _ ] _ ] _ _ _ _ ] ] ] _ _ _ _ ] _ Y Y I I 8 4 X X # X X X X X 7 ZXc.*.b *.*.m M m n n x x v @.@.> UXUXUX", +"UXo v Q.Q.Q.!.!.!.!.!.!.!.!.!.!.E.P.Z.9.$.k g Z P ! [ [ .| .| o.| | | | | | o.| | | | .| ...| | | | o.| | | o.| | .| | | X.| | X. .o.| | | | | | | | | | | | { ' ^ P V 6 & * : q y x :.q.C.S.G.P.G.G.D.C.q.,.x h p B P E [ ' | | | | | | | | | | | | ..| | | | | | | | | | | ..| | | | | | | | | | | | | | { | | | | | | | | | | | | | | | | | | | | | | | X.| ` ~ U J 6 = + & : q y j #.,.6.7.q.7.9.9.7.6.=.v h e r s K P ] ` | | | | | | | | | { { | | | | | | | | { | | | | | { | | { { { | | | { { | | { | | { | { | | | { | O.c.c.+.+.+.` # X X X X # X # X X # J SXD N c b n b b n n n x x @.@.> o UXUXUX", +"UX v W.Q.Q.Q.!.!.!.!.!.!.!.!.Q.W.T.P.C.7.:.x u t e q > : : : : * : : * : : * : : : * : * * * * * : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * : : > , w y h x >.9.V.Z.G.P.P.G.G.G.Z.V.9.>.v j t q > > * * * * & * * & * & & & * & & * & & * * & * & & & & & & & & & & & & & & % & & & & & % & & % % % % & & & % % % % % % & & % & % % & % & % & * * * > , e f k @.>.<.7.7.9.7.9.9.7.6.,.#.x h t q > : * & & + + + % + + + + + % + + % + + + + + + @ + + % + @ @ + @ + @ @ + + + @ @ + @ + + @ @ @ @ @ @ @ @ @ @ + = 0 L ZXI o X # # X X X X X X X $ AXl.a N n n b n b b b x x @.@.> o UXUXUX", +"UXUXn W.Q.Q.!.!.!.!.!.!.!.!.!.!.Q.E.T.H.C.q.<.=.x k j u a u y y y y y y y y y y y y y y y y y y y y y y y y y y t y t y t y y t t t y t t y t y t t t t t t t e t t t t t y u h k x $.,.q.V.Z.G.G.G.P.G.G.G.S.Z.V.q.6.#.@.j h y y t e e e e q e q e q e q e q q e q q q q q q q e q q q q q q q q q q q q q q q q q q q q q , q q q , , , q , q , , , , , , , , , , , q , q q t y f h x @.,.<.6.7.q.7.q.9.9.7.6.6.>.=.v k f y e q , , , > > > > > > : > : > : > > : : : > : : : : : : : : : : : : : : * : : * : : * : * : : * : : * : : * ; * * & ~ +. X X X X X X X X # X X X # ZXz.a l c b n b n n b x x v @.< UXUXUX", +"UXUXx W.Q.Q.!.!.Q.!.!.!.!.Q.!.!.Q.W.E.T.P.S.C.w.7.<.>.=.$.$.*.#.#.#.#.#.#.#.#.#.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.v v @.v v v @.v v v v v v v v x v x v x v x v x x x x v v @.#.=.>.,.7.e.C.Z.S.G.G.G.G.G.G.G.G.S.Z.V.w.9.,.>.#.@.x x z k k k k k k k z k j k j j j j j j j j j j j j j j j j j j j a a j j j a j h h j a j a j a h h h h h h h a f h h f f f f f u h u h h h j j z x #.=.,.<.7.9.q.9.9.9.7.7.9.7.6.6.,.=.@.v k j h y y y y y y t t t y y t t t t t t t t t t e t t e t e t e e t e e e e e e e e e e e e e e e q w e w w w q q q > R qX$ X X X X # X X X X X X X X ZXz.i a c b b M b b c x x x @.: UXUXUX", +"UXUXx W.Q.Q.Q.!.!.!.!.!.!.!.Q.!.Q.Q.Q.E.E.U.P.D.Z.C.g.e.w.w.w.w.w.q.q.q.q.q.q.q.q.q.q.q.q.9.q.9.9.9.9.7.7.9.7.9.9.9.7.7.9.7.7.7.7.7.7.7.6.6.6.7.6.6.6.6.6.6.6.6.6.6.6.6.6.6.7.q.w.V.C.Z.S.G.G.G.G.P.P.G.P.G.G.G.S.S.Z.g.w.q.7.6.<.,.,.,.,.>.>.>.>.=.=.=.>.=.>.=.=.=.=.:.=.$.=.$.=.$.$.$.$.$.#.$.=.$.$.#.#.#.$.#.#.#.#.*.#.@.#.#.#.@.@.@.@.@.@.@.@.@.v @.@.@.v v @.v v v v @.@.$.=.:.,.6.6.7.7.9.9.9.9.9.9.7.7.7.6.6.<.<.,.=.$.v @.x x z z z z k k x k k k k k k j j k j j j j j j j j j j j j h j h j h j h h h h h h h u h h h f h h f u f f y t A qX$ X # X X # X X X X X X X X # ZX/ r g l c M n c *.c z x @.x : o UXUXUX", +"UXUXx E.Q.Q.Q.!.!.!.!.!.!.!.Q.!.Q.Q.Q.Q.W.W.E.U.U.P.P.G.H.G.G.G.D.H.H.G.D.D.D.S.D.D.S.S.D.S.S.D.S.S.S.S.Z.S.S.S.S.S.Z.S.Z.Z.Z.Z.Z.C.C.Z.Z.Z.C.C.C.C.C.C.V.C.V.V.V.V.V.V.V.C.C.Z.S.S.S.G.G.P.G.P.G.G.G.G.G.G.G.D.D.S.S.S.Z.C.g.e.e.w.w.q.q.w.w.q.w.w.q.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m m m n n n n n b m b n c b b c c l l a g i r r w < w < < > > < < > < > < < : : < > > < q w w e y u u a a j q O X UXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUX j D.W.E.E.E.E.E.T.T.T.T.T.T.U.T.U.U.U.U.U.U.U.I.U.I.I.I.I.I.I.I.I.P.I.P.P.P.P.P.P.P.G.P.G.P.G.G.G.G.D.G.D.D.G.S.G.S.S.S.D.S.S.S.S.S.S.S.S.Z.S.Z.Z.Z.Z.Z.Z.Z.C.Z.C.C.C.C.C.C.C.C.g.V.C.V.C.V.V.V.V.V.g.g.g.g.g.g.e.V.e.e.V.e.e.e.e.e.e.e.w.b.w.w.w.w.w.w.q.w.q.q.q.q.q.9.q.q.q.9.q.9.q.9.9.9.9.7.9.7.9.7.6.7.7.6.7.6.6.6.6.6.6.6.<.6.<.6.<.<.<.<.<.,.<.,.,.,.,.>.,.,.,.,.,.>.,.>.>.>.>.>.=.=.=.>.:.>.$.=.$.$.$.>.$.$.$.$.$.#.$.#.#.$.$.#.#.#.#.#.#.@.@.@.@.@.@.@.@.v @.v @.@.*.%.%.*.m -.%.m m *.m n n n n b n n b b b c n b c c c c c c a a i i i r r i r r r w r r w w w w w r w r w r t t y y y u a a j y * o X o UXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUX& 6.W.E.E.E.E.T.T.T.T.U.T.U.U.U.U.U.U.U.U.U.U.I.U.I.U.I.I.I.I.P.P.P.P.P.P.P.P.G.P.G.P.G.P.G.G.G.G.D.G.D.G.D.D.D.S.D.D.S.S.S.S.S.S.S.S.S.Z.Z.Z.Z.S.Z.Z.Z.Z.Z.Z.C.C.C.C.C.C.g.C.C.V.V.V.C.g.V.g.V.g.g.V.g.g.g.g.g.e.e.e.e.e.e.e.e.w.w.e.w.e.w.w.w.w.q.b.q.q.q.q.q.q.q.q.q.q.9.9.9.9.9.9.9.7.7.9.7.7.7.7.7.7.6.6.6.7.6.6.6.6.<.6.6.<.<.<.<.<.<.<.<.,.,.,.,.,.,.,.,.>.,.>.>.>.>.,.>.>.>.>.>.>.=.:.=.=.$.=.=.=.$.$.$.$.$.$.$.$.$.#.#.#.#.#.#.#.#.#.@.#.@.@.@.@.v @.v @.v v @.*.%.%.m *.-.m m *.m m n n n n n n n b b b n c b c b c c c c c c l l a l l a l i i u i i i i i i y i i y i y i i i u u u u a a j a q o X UXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUX h Z.W.E.E.T.T.T.T.T.T.U.U.U.U.U.U.U.U.U.I.U.I.I.I.I.I.P.I.I.I.P.P.P.P.P.P.P.P.P.P.G.G.P.G.G.G.G.G.D.D.D.D.D.D.D.S.S.S.D.S.S.S.S.S.Z.S.Z.S.Z.Z.Z.Z.Z.Z.C.C.C.C.C.C.C.V.C.V.C.V.C.g.C.V.V.V.V.V.g.g.g.g.g.g.e.g.e.g.e.e.e.e.w.e.e.e.w.w.w.w.w.w.w.q.q.q.q.q.q.q.q.9.q.9.9.7.q.q.9.q.7.9.9.9.7.7.7.7.7.7.7.6.7.6.6.6.6.6.<.6.6.<.<.<.<.<.<.<.<.,.,.<.,.,.,.,.,.,.,.,.>.,.>.>.>.>.>.>.:.>.:.>.:.=.=.=.$.$.$.$.$.$.$.$.$.#.#.#.#.$.#.#.#.#.#.#.@.@.@.@.@.@.v @.v @.v @.*.%.*.%.%.%.%.*.m m %.m m n n n n n b b n n b n c c n c c c c c c k c k k a l a k a l a l a a a a a a f i a a u a a u u u u a a a a u & X X UXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXO #.T.T.E.T.E.T.T.T.T.U.T.U.U.U.U.U.U.U.U.I.I.I.I.I.I.I.P.I.P.P.P.P.G.P.G.P.G.G.G.G.G.G.G.G.G.D.D.D.G.D.G.D.D.S.S.S.S.S.S.S.Z.S.S.S.Z.S.Z.Z.Z.Z.C.Z.Z.C.C.C.C.C.C.V.C.V.C.V.V.V.C.V.V.V.g.g.g.g.g.g.g.g.g.g.e.g.e.e.e.e.e.w.e.w.e.w.w.w.w.w.w.w.q.q.q.q.q.q.q.q.9.q.9.q.q.q.7.9.7.9.9.9.7.7.7.7.7.7.6.6.6.6.6.6.6.6.6.6.6.<.6.<.<.<.<.<.<.,.,.,.,.,.,.>.>.,.>.,.,.>.>.>.>.>.>.>.:.:.>.:.=.=.=.=.=.$.=.$.$.$.$.$.$.#.$.$.#.$.#.#.#.#.#.v #.@.@.@.@.@.@.@.@.n v @.*.%.%.*.m %.m *.*.*.m v m m n n n n b n b b b b c c c c b c c c c c k k c l l l l a l j l l l a a l l a a a a a a l a l a a a a a a a > o o UXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXo w w.W.E.E.T.T.U.T.T.U.U.U.U.U.U.I.U.I.I.U.I.I.I.I.I.P.I.P.I.P.P.P.P.P.P.G.G.P.G.G.G.G.G.D.D.G.D.D.D.D.S.S.D.S.S.S.S.S.S.S.S.S.Z.Z.Z.Z.Z.Z.Z.Z.Z.C.C.C.C.C.C.C.C.C.V.C.g.C.V.V.g.g.V.g.g.V.V.g.g.g.g.g.e.e.e.e.e.e.e.w.e.e.e.w.w.w.w.w.w.w.q.q.w.q.q.q.q.9.q.q.q.9.q.9.9.7.9.9.7.9.7.7.7.7.7.7.6.7.6.7.6.6.6.6.<.6.<.6.<.<.<.<.<.<.<.<.,.<.,.,.,.,.,.,.,.,.>.>.>.>.>.>.>.>.:.>.>.=.=.=.=.=.=.=.$.$.$.$.$.#.$.$.$.#.#.#.#.#.#.#.#.#.#.#.@.@.@.@.@.v v @.v @.@.%.%.%.%.%.*.%.m *.m m m m v n n n n b n b n b n c c c c c c c c c l k c l c k k c k k l l j l j l l a l l l a l l a a a a u u a a a h r @ o X UXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUX z I.E.T.T.T.T.U.U.U.U.U.U.U.I.U.I.I.U.I.I.U.P.P.I.P.P.P.P.P.P.P.G.P.P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.$.>.>.$.>.$.$.:.$.$.$.#.$.$.$.$.#.#.#.$.#.#.#.@.#.#.v #.@.#.v #.@.@.@.%.%.%.%.%.*.*.%.*.%.%.*.n *.*.*.M *.b M *.c *.c *.b c b b c c c c c c c c l k c l k k k l k k l l j l j l a l j a a a l a l a i a a u u a u a h y & o o UXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo + =.U.T.U.U.U.U.U.I.U.I.I.I.I.I.I.P.P.P.P.P.P.P.P.P.P.G.G.P.G.G.G.G.G.G.G.D.D.D.D.D.D.S.D.S.S.D.S.S.S.S.S.Z.S.Z.Z.Z.Z.Z.C.Z.Z.C.C.C.C.C.C.C.V.C.C.V.C.V.V.V.V.g.V.V.g.V.V.g.g.g.g.g.g.e.e.e.e.e.e.w.w.e.w.w.w.w.w.w.w.w.q.w.q.q.q.q.q.q.q.q.9.q.q.9.9.9.9.9.7.9.7.9.7.7.7.7.6.6.6.6.6.6.6.6.<.6.6.<.<.6.<.<.<.<.<.,.<.,.,.,.,.,.,.,.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.$.>.:.$.:.$.$.$.$.$.$.$.#.#.#.#.#.#.#.#.#.#.#.#.#.#.v #.v v *.*.%.%.%.%.%.%.%.%.%.*.M %.*.m n n n n b *.c c *.*.c c b b c c c c c c k c k l c c k k k k l k l j k l l a j a a l a a l a a l a a a a u u u u a a a > o o o UXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo * 7.T.U.T.U.U.U.U.I.I.I.I.I.P.P.P.P.P.P.P.P.G.P.G.P.G.G.G.G.G.D.G.D.D.D.D.D.D.D.D.S.D.S.S.S.S.S.S.S.Z.S.Z.S.Z.Z.Z.Z.Z.Z.Z.C.Z.Z.C.C.C.V.C.C.V.V.V.V.V.V.V.V.V.g.g.g.g.e.V.e.g.e.e.e.e.e.e.e.e.e.e.e.e.e.w.w.w.w.w.q.q.w.q.q.q.q.q.9.q.9.9.q.9.9.9.9.9.7.9.9.9.7.7.7.7.7.6.7.6.7.6.6.6.6.6.6.<.<.6.<.<.<.<.<.<.,.<.,.,.,.,.,.>.>.,.>.>.>.,.,.>.>.>.>.>.>.>.$.$.:.$.:.$.$.:.$.$.$.$.$.#.#.$.#.$.#.$.#.#.#.#.#.@.v #.v v #.v @.%.%.%.%.%.*.%.%.*.%.*.*.*.m *.n n n n n n *.c *.c c c c c b c c c c c c k c c c k k k c l k k l k l j a j j l l a a a l l a l a a a u a u a u a u a a w . o X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo y g.T.U.U.U.I.U.I.U.I.I.P.I.P.P.P.P.P.G.P.P.G.G.P.G.G.G.G.G.G.D.G.D.D.D.D.D.D.S.D.S.S.S.S.S.Z.S.Z.S.Z.S.Z.Z.Z.Z.Z.Z.C.Z.C.C.C.C.C.V.C.V.V.V.C.V.V.V.V.V.V.g.V.g.g.g.e.g.e.g.e.V.e.e.e.e.e.w.w.e.w.w.w.w.w.w.w.q.w.q.q.q.q.q.q.9.q.9.q.9.9.9.9.9.9.9.9.9.9.9.7.7.7.7.7.7.7.6.6.6.6.6.<.6.6.<.<.<.<.<.<.,.<.,.,.,.,.,.,.,.,.,.,.>.,.>.>.>.>.>.>.>.>.:.$.>.$.>.>.$.$.$.$.$.$.#.$.$.$.#.$.#.#.$.#.#.#.#.#.#.#.#.#.v v #.v #.&.%.%.-.%.%.%.%.%.%.%.*.%.m m n *.n *.n n c c *.*.c c c c *.c c c c c c c k l c k c k k k l k l l j j j l l l a l l l a l a l a f a a a a u u u a a a e & X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo o k Z.T.U.U.U.I.I.I.I.P.I.P.P.P.P.P.P.P.P.G.G.P.G.G.G.G.G.G.G.G.D.D.D.D.D.S.D.D.S.S.S.S.S.S.S.Z.S.Z.S.Z.Z.Z.Z.Z.C.Z.C.C.C.C.V.C.C.C.V.C.V.C.V.V.V.V.V.g.V.g.g.g.g.g.g.e.V.e.e.e.e.e.e.w.e.e.w.e.w.w.w.w.w.w.q.w.q.q.q.q.q.q.q.q.9.q.9.9.9.9.9.9.9.9.9.6.7.6.7.7.7.6.6.6.6.6.6.6.<.6.6.6.<.<.<.6.<.<.<.<.<.,.,.,.,.,.,.>.,.>.,.>.>.>.,.>.>.>.>.>.$.>.>.$.>.$.$.=.$.:.$.$.$.$.$.$.$.#.#.#.$.#.#.#.#.#.#.v @.@.v #.#.m -.%.&.%.%.%.%.*.%.%.*.m *.*.m n m n m n n n b n *.c c c *.c c c c c c c c c k c c k k l k k l k k l j l l j a j a j a a a l a f a f a f a u u u u u a a y & o o X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX . x G.U.U.I.U.U.I.P.I.I.P.P.P.P.P.G.P.P.G.P.G.G.G.G.G.G.G.D.D.D.D.D.D.S.D.D.S.S.S.S.S.S.S.S.S.Z.Z.Z.Z.Z.Z.Z.C.Z.C.C.C.C.C.C.C.V.C.C.V.C.V.V.V.V.g.g.V.g.V.g.g.g.g.e.e.g.e.e.e.e.e.w.e.e.w.w.w.w.w.w.w.w.w.w.q.q.q.q.q.9.q.9.q.9.q.9.9.9.9.9.9.7.9.7.7.7.7.7.7.7.6.6.7.6.6.6.<.6.<.6.<.6.<.<.<.<.<.<.,.,.<.,.,.>.,.,.>.,.,.>.,.>.>.>.>.>.>.>.$.>.>.>.$.:.>.$.$.$.$.$.$.$.$.#.$.#.#.#.$.#.#.#.#.#.@.#.@.@.v #.#.%.%.&.&.%.%.%.%.%.*.%.*.%.%.*.*.*.n n n n n M b c b *.b b b c c c *.c c c k k k l c k l k k k l k j l j l a l l a l a a l a l a a l a a f a u u u u u u a y : o o X UXUXUXUXUXUXUXUXUXUXUXUX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.#.*.&.-.&.%.&.%.-.%.%.%.*.*.*.%.*.n *.n n *.n n n n c b b *.b b b b c c c c c k c k c c k k k k k k l l j j l j a l l l a l a a l f a a f a a a i a u u u u u a a q O X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX > ,.I.I.I.I.I.I.P.P.P.P.P.G.G.G.G.G.G.D.G.D.G.D.D.D.D.D.D.S.S.D.S.S.S.S.Z.S.S.Z.S.Z.Z.Z.Z.Z.Z.Z.C.C.C.C.C.C.C.C.V.V.C.V.C.V.V.V.V.V.V.g.V.g.g.g.g.g.e.g.e.e.e.e.e.e.e.w.e.e.w.w.w.w.w.w.w.q.w.q.q.q.q.q.q.q.q.9.q.9.9.9.9.9.9.9.9.9.7.7.7.7.7.7.6.7.6.6.6.6.6.6.6.<.6.<.<.6.<.<.<.<.,.<.,.,.,.,.>.,.,.,.,.>.>.>.>.>.>.>.>.>.>.>.=.:.$.$.>.$.:.$.:.$.$.$.$.#.$.$.$.#.#.$.#.#.#.#.#.#.#.@.v #.&.-.-.&.%.%.%.%.%.m #.%.%.*.%.M n n m m *.n n n n b *.c b b c c b b c c c c k c c k c k k l l c l l k k j l j j j l a j l a a l a a a a a a f i a a u u u u u a a > . X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX w 7.I.U.I.I.P.P.P.G.P.G.P.G.G.G.G.G.G.D.G.D.D.D.S.D.S.D.S.S.D.S.S.S.S.S.S.S.S.Z.Z.Z.Z.Z.Z.C.Z.C.C.C.C.C.C.V.C.V.C.V.V.V.V.V.V.V.g.g.g.V.g.g.e.g.e.V.e.e.e.e.e.e.w.e.w.w.w.w.w.w.w.w.w.q.q.q.q.q.q.q.9.q.9.9.q.9.9.9.9.9.7.9.9.9.9.9.7.7.7.6.7.6.7.6.6.6.6.6.6.<.6.6.<.<.<.<.<.,.<.<.,.,.,.,.,.,.,.,.>.,.>.,.>.,.>.>.>.$.>.>.$.$.>.:.$.:.$.$.>.$.$.$.$.$.$.$.#.$.#.#.#.#.#.#.#.#.#.@.@.%.;.&.&.%.%.%.%.%.*.%.#.m -.*.%.n %.*.n *.n n M *.n n c n n c c c c c c b c c c k c c c k c k k l k k k k l j l j h l l a l a l a l a l a l a a u u a u u u u u u a q @ X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo t 7.I.I.I.P.P.P.P.G.P.G.P.G.G.G.G.D.D.D.D.D.D.D.S.D.S.D.S.S.S.S.Z.S.Z.Z.Z.Z.Z.Z.Z.Z.Z.C.C.C.Z.C.C.C.C.V.C.V.C.V.V.V.V.V.V.V.V.g.V.g.g.g.g.g.g.e.e.e.e.e.e.e.e.e.e.w.e.w.w.w.w.w.w.w.q.w.q.q.q.q.q.q.q.q.9.9.9.q.9.9.9.9.9.7.7.7.7.7.7.6.7.6.6.6.6.6.6.6.<.6.<.<.<.<.<.<.<.<.<.,.,.,.,.,.,.>.,.>.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.$.>.$.:.$.$.$.$.$.$.#.$.#.#.$.#.#.#.#.#.#.#.v #.&.&.&.&.-.%.%.-.&.%.%.-.%.%.*.m *.*.n *.n n n *.n b n c *.b c c c *.c c c c c c c c c k k l k k k k k j l k j l j l j l a a l a l a a a a a a a a u u u u u u u u a a q + X o o UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo q 6.P.I.P.P.P.P.P.P.G.G.G.G.D.G.D.D.D.D.D.D.D.D.S.S.S.S.S.S.Z.Z.S.Z.S.Z.Z.Z.C.Z.Z.C.Z.C.Z.C.C.C.V.C.C.C.V.C.V.V.V.V.V.V.g.g.V.g.g.g.g.e.g.e.g.e.e.e.e.e.e.w.e.w.e.w.w.w.w.w.q.w.q.q.q.q.9.9.q.q.9.q.9.9.9.9.9.9.9.7.9.6.9.7.7.7.7.6.7.6.7.6.6.6.6.6.<.6.<.6.<.<.<.<.,.,.<.,.,.,.,.,.,.,.,.>.,.>.>.>.,.>.>.>.>.>.>.$.:.$.>.$.$.$.$.$.$.$.$.$.$.$.#.#.#.$.#.#.#.$.#.#.#.v $.%.&.-.&.-.-.%.&.&.%.%.%.%.*.*.%.%.m *.n *.n n n *.b *.b n b n b *.b c b c c c c c c c c c k k l k l c l j j l j l j l a l h l a a l l a a a a a a a u a u u u u u u a u w + X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX e 6.P.I.P.P.P.G.G.G.G.G.G.D.D.G.D.D.D.D.S.S.D.S.S.S.S.Z.S.S.S.Z.S.Z.Z.Z.Z.Z.C.Z.C.C.C.C.C.V.V.C.V.C.V.V.V.V.V.V.V.V.g.V.V.e.g.e.g.e.g.e.e.e.e.e.e.e.w.w.e.w.w.w.w.w.w.w.w.q.q.w.q.q.q.q.q.q.q.9.9.9.q.9.9.9.7.9.9.9.7.7.7.6.7.6.7.6.6.6.6.6.<.6.6.<.<.6.<.<.<.<.<.<.<.,.,.,.,.,.,.,.,.>.,.>.,.>.>.>.>.>.>.:.>.>.>.:.:.$.>.$.$.>.$.$.$.$.$.#.$.#.$.#.#.#.#.#.#.#.v %.3.-.&.-.&.&.%.%.%.&.%.#.%.%.%.%.m #.m m *.*.M *.n n *.b b n n b x c c b b c c c c c c k l c k k k c k k k l l j j j l j j h h h l a l a a a a l a a i u u u u u u u u u u q @ o X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX > ,.P.P.P.P.P.G.G.G.G.D.G.G.S.G.S.S.S.S.S.S.S.S.S.S.Z.Z.S.Z.S.Z.Z.Z.Z.Z.Z.Z.C.C.C.C.C.C.C.C.V.C.V.V.V.V.V.V.V.V.g.e.V.g.g.g.e.g.e.g.e.e.e.e.e.e.w.e.e.w.w.w.w.w.w.w.q.w.q.q.q.q.q.q.q.9.q.9.9.9.9.9.9.9.7.9.7.7.9.7.7.7.7.6.6.6.6.6.6.6.6.<.6.6.<.6.<.6.,.<.,.<.<.,.,.,.,.,.,.>.,.>.,.>.>.>.>.>.>.>.>.>.>.>.$.>.=.=.$.=.$.=.$.$.$.$.$.$.$.#.#.#.$.#.#.#.#.#.&.%.;.&.&.-.&.&.%.&.&.%.%.%.*.%.%.*.%.*.*.m *.m m m n n n b n b n b b b b b b c c c c c z c c k l k k k k k k k l j j l j j l h h h h h h f h a a f a u u u u u u u u u u a a q @ X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX - =.G.P.P.G.P.G.G.G.G.S.G.D.D.S.G.S.D.S.S.S.S.S.S.S.S.Z.Z.Z.Z.Z.Z.Z.C.C.C.C.C.C.C.C.V.C.V.C.V.C.V.V.V.g.V.g.g.V.V.g.g.V.g.V.e.g.e.e.e.e.e.e.w.e.w.w.e.w.w.w.w.w.w.q.q.q.q.q.q.q.9.q.q.9.q.9.q.9.9.9.9.9.7.9.7.7.7.7.6.7.6.7.7.6.6.6.6.6.6.<.<.6.,.<.6.,.<.<.,.,.,.,.,.,.>.,.,.,.,.>.,.>.>.>.>.>.>.>.$.>.:.>.$.=.=.=.$.=.$.$.$.$.$.$.#.#.#.$.#.#.#.#.#.%.;.&.;.;.&.&.%.-.-.%.%.%.%.%.%.%.*.%.%.*.*.*.m n n n n n *.b n b b c b b b x b b c c c k c k k c k k k k k k k l l j j l l h h h l h h h l f h h a a l u u a u u u u y u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.$.#.$.&.;.3.3.&.-.;.-.%.&.&.&.%.%.%.%.%.%.%.*.*.*.*.n *.n *.n *.n n n b *.b b b b b b b c c c c c k c l c k k k k k k l l j j j l l h l l h h h h h h h h h f h u a u u u u u u u u u a t * o o X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo X u 9.G.P.G.G.G.S.G.S.D.S.S.S.S.S.S.Z.Z.S.Z.Z.Z.Z.Z.Z.C.Z.C.C.C.C.C.C.C.V.V.V.C.V.V.V.V.V.V.g.V.V.g.g.g.e.g.e.V.e.e.e.e.e.e.w.e.w.w.e.w.w.w.w.w.w.q.w.q.q.q.q.9.q.q.9.q.9.q.7.q.9.9.9.9.7.9.9.7.7.7.7.7.7.6.7.6.6.6.6.6.,.6.6.6.,.<.<.,.6.,.<.,.,.,.,.,.,.,.,.,.>.,.>.>.>.>.>.>.>.>.>.$.>.>.:.$.:.$.:.$.$.$.$.$.$.$.$.#.$.#.#.#.#.%.&.;.&.&.&.&.&.&.&.&.&.%.%.%.%.%.%.%.%.%.*.*.*.M *.n *.n m n b n b b b *.b b b b b c c c c c z c c k c k c k k k k k l j k l l j h l h h j h h h h h h a f a a u u u u u u u u u u a q & o X o UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX o e >.S.G.G.D.G.S.G.S.S.S.S.S.S.S.Z.S.Z.Z.Z.Z.Z.Z.C.Z.C.C.C.C.C.C.V.V.C.C.C.V.V.V.V.V.V.g.g.g.g.g.g.g.g.e.g.e.e.e.e.e.e.e.e.e.w.e.w.w.w.w.w.w.q.q.q.q.q.q.q.q.q.9.q.9.q.q.9.9.9.9.7.9.9.7.7.7.7.7.6.6.6.6.6.6.6.6.6.6.6.6.,.6.,.<.6.,.,.,.,.,.<.,.,.,.>.>.,.>.,.>.,.>.,.>.>.>.>.>.:.>.:.$.>.>.$.=.$.>.$.$.$.$.#.#.$.#.#.#.#.:.;.;.;.;.;.&.&.&.&.&.&.%.%.&.%.%.%.%.*.%.*.%.%.*.*.*.*.m *.n n n n b n *.b b b b b x c c c z c c c c k k k c k k k k l j l j l k a h j h l h h h h h h f f f a a f u u u u u u u u u u > % o o X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX o % x g.G.G.G.G.D.D.S.S.S.S.S.Z.S.Z.Z.Z.Z.Z.Z.Z.Z.C.C.C.C.C.C.C.C.C.V.V.V.V.V.V.V.V.V.g.V.V.g.g.g.g.e.e.e.e.e.e.e.e.e.e.w.e.w.w.w.w.w.w.w.w.q.q.q.q.9.q.9.9.q.q.q.9.9.9.9.9.7.9.7.7.7.7.7.7.6.6.7.6.7.6.6.6.6.6.6.<.6.6.,.6.6.6.,.6.,.,.6.,.,.,.,.,.,.,.>.>.,.>.>.>.>.>.>.$.>.$.>.$.>.>.$.$.$.$.$.$.$.$.$.$.#.$.#.$.#.;.;.;.;.;.;.;.&.3.&.-.&.-.%.&.%.%.%.%.%.%.%.%.%.m *.m n n n n n n n n n n n b b b b b b c c c c k c k k c k k k l k l k k k l j j j l j l j h h h h h h f h a a a a u u u u u u u u u u t * . o X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX X X . u 6.S.G.G.S.S.S.S.S.S.Z.S.S.Z.Z.Z.Z.Z.C.C.C.C.C.C.C.C.g.V.C.V.V.V.V.V.V.V.V.g.g.V.g.g.g.g.e.g.e.V.e.e.e.e.w.e.w.w.e.w.w.w.w.w.w.q.w.q.q.q.q.q.q.q.q.q.q.9.9.9.9.9.7.9.9.9.7.7.7.7.7.7.7.7.6.7.6.6.6.<.6.6.<.6.,.,.6.,.,.<.,.,.,.,.,.,.,.,.,.>.,.>.,.>.,.,.>.>.>.>.>.>.>.>.:.>.$.$.$.>.:.$.$.$.$.$.#.$.$.#.#.;.1.;.3.;.;.&.&.&.3.&.&.-.-.&.%.%.%.&.%.%.%.*.%.m *.*.m *.n n *.n n n n b n b b b b b b x c c c c c c c k c l k c k k l k l l l l j a l a j h h h h h h f h h f f u a u u u u u u u a u u w % o o X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX ; v V.G.D.G.S.S.S.S.S.Z.Z.Z.Z.Z.Z.Z.C.C.C.C.C.C.V.C.C.V.C.V.V.V.V.V.V.V.g.V.V.e.e.g.e.e.g.e.e.e.e.e.e.e.e.w.w.e.w.w.w.w.w.q.w.w.q.q.q.q.q.q.q.q.9.q.9.9.9.9.9.6.9.7.9.7.7.9.7.6.6.6.9.6.6.6.6.6.6.6.6.6.<.6.<.<.<.<.<.,.,.<.,.,.,.,.,.,.,.>.,.>.,.>.>.>.>.>.>.>.>.$.>.>.$.:.$.=.$.$.$.$.$.$.$.#.$.#.$.:.3.3.;.;.;.;.&.&.&.&.&.-.&.&.&.-.%.%.%.%.-.*.%.%.*.%.*.n *.n *.n *.b *.b *.*.b b b b b c c c c c c c c k k c k c l k k k l j j j j j j j h j l l a l a a a a a a a a u u u u u u u u a a y : . X X o UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX X . u ,.S.S.G.S.S.S.S.S.Z.S.Z.Z.Z.C.Z.C.C.V.C.C.C.V.V.V.V.V.V.V.V.V.g.g.V.e.V.e.V.g.e.g.e.g.e.e.e.e.e.w.e.w.e.w.w.w.w.w.w.w.q.q.q.q.q.q.q.q.9.9.q.9.9.9.9.9.9.9.9.9.9.9.7.6.9.6.9.6.6.6.6.6.6.6.<.<.6.<.<.<.<.<.<.<.,.<.,.,.,.,.,.,.=.,.>.,.=.>.,.>.>.>.>.>.>.$.>.>.$.$.>.$.=.:.$.$.$.$.$.$.$.$.&.1.3.3.;.3.;.;.;.;.-.&.&.&.-.&.-.%.&.%.%.%.%.%.#.*.*.*.*.M *.*.n n *.b b *.b *.b b b b b x b b c c c z c c k k c l k k k k l k k l j l l h l j l a a a l a a l a a a a u a u u u u u u a a y q & o o X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo % j q.S.S.S.S.S.S.Z.Z.Z.Z.C.C.C.Z.C.C.C.V.C.V.C.V.C.V.V.g.V.g.V.e.V.g.g.g.g.e.V.e.e.e.e.e.e.e.w.e.w.e.w.w.w.w.w.w.w.q.q.q.q.q.q.q.q.9.q.q.9.q.9.9.9.9.7.9.9.9.6.7.7.7.6.7.7.6.6.6.6.6.6.6.6.<.<.<.6.<.<.<.<.,.<.,.,.,.,.,.,.,.,.>.,.,.=.>.>.>.>.>.>.>.=.>.:.:.$.>.$.>.$.$.$.$.$.#.$.$.;.3.1.3.;.;.;.;.;.;.&.-.&.-.&.&.&.%.%.%.#.%.%.%.%.%.%.*.%.*.n *.n n n n n *.n b *.c b b b b b c c x c c k c c k c c k k c l k k k j j j j j h j h h l a l l a a l a a a a u a u u u u u u a u t ; . o o X X UXUXUXUXUXUX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%.m #.*.*.m *.n *.n n n *.*.b n b b b b x b b b c c c c c c c k c k c k k k l j l k l l j l j l j h l a j a j a a a u a a u u a u a a a a y > + o X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX o X @ y =.e.S.S.Z.Z.Z.C.C.C.V.C.C.C.V.V.V.V.V.g.V.V.g.g.g.e.g.e.V.e.V.e.e.e.e.w.e.e.w.w.w.w.w.w.w.w.q.q.q.q.q.q.9.9.q.q.9.q.9.7.q.9.9.7.9.9.9.7.9.9.6.7.6.6.6.6.6.6.6.6.6.6.6.6.<.<.6.<.<.<.<.<.,.,.,.,.,.,.,.,.,.>.,.,.=.,.=.>.>.>.>.>.=.$.:.>.>.>.$.$.$.$.$.$.:.;.1.1.1.3.3.3.;.3.1.3.;.3.3.&.;.&.-.&.&.%.%.%.%.#.%.%.%.%.%.%.m %.m m m *.*.n n b b n n c b c *.c c b b c z z c c k k k c k k k l k k k k k j j j j h a h h h h j a a a a a a a a a a u a a a a y q & O X X X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo X @ t #.q.S.Z.Z.Z.C.C.C.V.C.C.V.V.V.V.V.g.g.g.g.g.g.e.e.V.e.e.e.e.e.e.e.e.w.w.e.w.w.w.w.q.w.q.w.q.w.q.q.q.q.q.9.q.q.7.q.7.9.9.9.7.9.7.9.9.6.6.9.6.7.6.6.6.6.6.6.6.6.6.<.<.6.<.<.<.<.<.,.<.,.,.,.,.,.,.>.,.>.,.,.>.,.=.>.>.>.=.>.=.>.>.$.$.$.:.$.>.$.;.;.1.1.1.3.1.4.1.3.;.;.;.;.;.3.3.&.&.&.&.-.&.&.-.%.&.%.%.%.%.*.*.*.m *.*.m *.m *.b *.n *.n x b *.b b b *.c c z z c c c k c c k l k l k k l k k j l j j h h j l h j h a j a a a a a a u a a a a a a y > % . o o X X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX o o @ t n 6.C.Z.Z.C.C.C.V.V.C.V.V.V.V.V.V.g.g.g.g.V.e.e.e.V.e.e.w.e.w.e.w.e.w.w.w.w.w.w.w.q.q.q.q.q.q.q.q.9.q.9.9.q.7.q.7.7.9.9.7.7.7.7.7.9.6.7.6.7.6.6.6.6.6.<.6.<.6.<.<.<.<.,.<.<.<.,.,.,.,.,.>.,.,.>.,.>.>.>.>.>.>.>.=.>.=.=.:.>.:.>.:.$.$.:.1.1.5.1.1.4.1.1.3.1.3.;.;.;.&.3.&.&.&.&.&.%.&.%.%.%.#.&.%.-.*.%.%.m %.*.*.m n *.*.n *.b *.b c *.b c b b b c c c c c c c k k c l c k k k k k k k l j l h h l j j h h a a h a a a a a a a a a a a a e > & . o X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo X . > k >.w.Z.C.C.C.C.V.C.V.V.V.V.g.g.g.g.g.g.e.g.e.e.e.e.e.w.e.w.e.w.w.w.w.w.w.w.q.w.q.q.q.q.q.9.q.q.q.9.q.9.9.9.9.7.9.7.7.7.7.7.7.6.6.7.6.6.7.6.6.6.6.<.6.6.<.<.<.<.<.,.<.,.,.,.,.,.,.>.,.,.>.,.>.>.>.>.>.>.>.>.=.=.>.:.=.$.$.=.$.>.1.5.;.5.5.5.;.5.1.;.;.;.;.;.;.;.;.&.;.&.&.-.-.%.%.&.%.%.%.%.%.%.%.*.m *.*.*.*.n n *.n n b b n n n b b b b b b c c c c c z z k z k k c k k k j k j j j j j j h h h h h a j a a a a a a a a a a h y q : @ o X X X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX X X o + e x 6.e.C.C.C.V.V.V.V.V.g.g.g.g.g.g.g.e.e.e.e.e.e.e.w.e.w.w.w.w.w.q.w.w.q.q.q.q.q.q.q.q.9.7.7.q.7.q.9.9.7.q.7.9.9.9.6.7.7.7.6.6.6.6.6.6.6.6.<.6.<.<.<.<.<.<.<.<.<.<.,.,.,.,.,.,.,.>.,.>.>.,.>.>.>.>.>.=.>.:.:.:.=.$.1.1.5.5.5.1.5.1.;.;.;.;.;.1.;.;.;.;.;.;.;.&.;.&.&.%.%.&.*.%.&.%.%.%.&.#.m %.%.*.*.*.*.n *.n *.n *.*.x x b b n b z x c z c z z c k k z k k k k j k j k j j j j j a a j h h h h a a a a a j a a j a a e > & . o X X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX X X o X * y v ,.w.C.V.g.C.V.g.V.g.g.g.e.e.g.e.e.e.e.w.w.e.e.w.w.w.w.w.w.w.w.q.q.q.q.q.9.q.9.q.q.9.7.q.7.7.q.7.7.7.7.7.7.7.7.6.9.6.6.6.6.6.6.6.6.6.<.6.<.6.<.<.,.<.,.,.<.,.,.,.,.,.>.,.,.>.>.,.>.>.,.>.>.>.>.:.>.:.:.=.$.>.>.$.$.$.$.$.$.$.#.$.#.$.$.#.#.#.#.#.@.#.@.#.@.@.@.@.@.@.@.v v v v v v v v v x x @.x x x x x x z z k x k z z k x k k x x j j k k k k j j j j j j j j j j j a j j a a a j j a a j a j j a j a e q & @ o o X X o X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX X X o o * e z =.7.e.V.C.V.V.g.g.g.g.e.g.e.e.e.e.e.e.w.w.e.w.w.w.w.w.q.q.q.q.q.q.q.q.q.q.9.q.q.9.7.q.7.7.q.7.7.7.7.7.7.7.6.9.6.7.6.6.6.6.6.<.6.<.<.6.<.<.<.<.<.<.<.,.<.,.,.,.,.,.,.,.,.>.>.,.>.>.>.>.>.>.:.>.=.=.>.$.>.$.:.$.:.$.$.$.$.$.$.#.$.#.#.$.#.#.#.@.#.@.@.@.@.@.@.@.@.@.#.v #.v @.v v x @.x x x x x x x x x x x x x z x x k x x k k k x k k k k z j k k k j j k j a j j j a j j j a j j j a j h y q > & O o X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXX X X X @ > t z #.<.q.g.g.V.V.e.V.V.e.e.e.e.e.w.e.e.w.w.w.w.q.q.w.q.w.q.q.q.q.q.9.q.q.9.9.q.7.9.7.9.7.9.9.7.7.7.7.7.7.7.6.6.6.6.6.6.6.6.<.6.6.<.<.6.,.6.,.,.<.,.,.,.,.,.,.,.,.>.,.,.>.,.>.>.>.>.>.:.>.:.>.$.>.:.:.:.$.$.$.$.$.$.$.$.$.#.$.#.#.#.#.#.#.#.*.#.#.#.#.@.@.#.@.@.@.v @.v v @.v @.x @.x v v x v x x x x x z x k z z z k z z z k k k k k k k j k j k j j j j j a a j j j j j a a t q > * + o o X X X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX X X o X @ * q y z @.:.,.7.q.w.V.e.e.e.e.e.e.w.e.e.e.w.w.w.w.w.w.q.q.q.q.q.q.q.q.q.q.q.9.q.9.q.9.9.9.9.9.7.9.7.6.9.7.7.7.7.6.6.6.6.6.6.6.6.6.<.6.,.6.<.<.<.<.<.<.<.,.,.,.,.,.,.,.>.,.>.>.,.>.>.>.>.>.>.>.>.>.>.>.>.:.:.$.:.$.:.$.$.$.$.=.#.=.#.#.$.#.#.#.#.#.#.#.#.@.@.@.#.@.@.@.@.@.@.@.x v v v v @.x x @.x x x x x x x z z z z z z z z x z k z k k k k k k j k j a u y e q , * % @ o X o o X X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo X X o X . & ; , e y f j v n @.#.#.#.*.*.#.@.@.v @.@.@.v v v v v x v v x v x v v v x x n v z b b b v b x x b b z b x b z z k k x z k c z k k z z k k k k k j k j j j j j j j j j j j h l h h j h h h h h h h h h h h h f h u h a a h a a h h u u u u u u a u u u u y y u y y y u y y u y t y t t t t t t y t t y t t y y t t e e t t e e e e e q q q : - * % @ O . o o o X X X o X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo X X X X X o o o . . O O @ O @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ O @ @ O O O @ @ @ @ O O O O @ O O @ O O O O O @ @ O O O O O @ O O O O @ @ O @ @ . @ O @ . @ O @ . @ O O O O O O O O O O O O O O O O O . O O O O . O O . . . O . O O O O @ . O . . @ . O O . O . O O . O . O O O O O O O O O O . . O . . . . o O O o O O O O . . o o o X o o o o o X X X o X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX X X X o o X o X o o o X o o o o o o X X o o o o o X o o o X X X o o o o o o o o o X o o o o o o o X o o o X X X X o X o X X o o X X X o X X o X o X o o o o X o o X o o o X X o X o o X o o X X X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX X X X o o X X X o X o o X o X o o o o o o o X X o o X X o X X X o o X o X o o X X o X o X o o o o X X X o o X X o X X X o o o X o X X o X o o X X X o o X o X X o X X o X X o X X X X o o o X X o o o X o o X X o o X X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXo X o X X o o X X o X X X X X X X X X X o X X X X X X o X X X X X X X X X o o X o X o X o X o X X X X X X X X X X X X X X X X X X o X X X X X X o X X X X X X X X X o o X o X o X o X o X X X o X X o X X X o X X X o o X X X X o o o X X X X X X o X o X o X X X o X X o X X X X o X X X X X o X o X o o X X X o o X o X o X X UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXU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XUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX" +}; diff --git a/sequencer/instruments/Default.inst b/sequencer/instruments/Default.inst new file mode 100644 index 0000000..af358b6 --- /dev/null +++ b/sequencer/instruments/Default.inst @@ -0,0 +1,13 @@ +"Kick", 36, 100 +"Snare", 38, 100 +"Closed Hat", 42, 80 +"Open Hat", 46, 80 +"Rim Shot", 37, 100 +"Ride", 51, 80 +"Crash", 49, 80 +"Hi Tom", 48, 100 +"Mid Tom", 45, 100 +"Low Tom", 41, 100 +"Hi Conga", 62, 80 +"Low Conga", 63, 80 +"Timbale", 65, 80 diff --git a/sequencer/instruments/GM-Drum.inst b/sequencer/instruments/GM-Drum.inst new file mode 100644 index 0000000..dce977d --- /dev/null +++ b/sequencer/instruments/GM-Drum.inst @@ -0,0 +1,44 @@ +"Bass Drum 1", 36, 100 +"Side Stick", 37, 80 +"Acoustic Snare", 38, 100 +"Hand Clap", 39, 80 +"Electric Snare", 40, 100 +"Low Floor Tom", 41, 100 +"Closed Hi-Hat", 42, 80 +"High Floor Tom", 43, 100 +"Pedal Hi-Hat", 44, 80 +"Low Tom", 45, 100 +"Open Hi-Hat", 46, 64 +"Low-Mid Tom", 47, 90 +"Hi-Mid Tom", 48, 90 +"Crash Cymbal 1", 49, 80 +"High Tom", 50, 100 +"Ride Cymbal 1", 51, 75 +"Chinese Cymbal", 52, 75 +"Ride Bell", 53, 75 +"Tambourine", 54, 64 +"Splash Cymbal", 55, 64 +"Cowbell", 56, 64 +"Crash Cymbal 2", 57, 64 +"Hi Bongo", 60, 100 +"Low Bongo", 61, 100 +"Mute Hi Conga", 62, 80 +"Open Hi Conga", 63, 100 +"Low Conga", 64, 100 +"High Timbale", 65, 80 +"Low Timbale", 66, 80 +"High Agogo", 67, 64 +"Low Agogo", 68, 64 +"Cabasa", 69, 64 +"Maracas", 70, 70 +"Short Whistle", 71, 64 +"Long Whistle", 72, 64 +"Short Guiro", 73, 64 +"Long Guiro", 74, 64 +"Claves", 75, 80 +"Hi Wood Block", 76, 80 +"Low Wood Block", 77, 80 +"Mute Cuica", 78, 64 +"Open Cuica", 79, 64 +"Mute Triangle", 80, 64 +"Open Triangle", 81, 64 diff --git a/sequencer/instruments/GS-Brush.inst b/sequencer/instruments/GS-Brush.inst new file mode 100644 index 0000000..f7195b8 --- /dev/null +++ b/sequencer/instruments/GS-Brush.inst @@ -0,0 +1,61 @@ +"High Q", 27, 100 +"Slap", 28, 100 +"Scratch Push", 29, 100 +"Scratch Pull", 30, 100 +"Sticks", 31, 100 +"Square Click", 32, 100 +"Metronome Click", 33, 100 +"Metronome Bell", 34, 100 +"Acoustic Bass Drum", 35, 100 +"Bass Drum 1", 36, 100 +"Side Stick", 37, 100 +"Brush Tap", 38, 100 +"Brush Slap", 39, 100 +"Brush Swirl", 40, 100 +"Low Floor Tom", 41, 100 +"Closed Hi-Hat", 42, 100 +"High Floor Tom", 43, 100 +"Pedal Hi-Hat", 44, 100 +"Low Tom", 45, 100 +"Open Hi-Hat", 46, 100 +"Low-Mid Tom", 47, 100 +"Hi-Mid Tom", 48, 100 +"Crash Cymbal 1", 49, 100 +"High Tom", 50, 100 +"Ride Cymbal 1", 51, 100 +"Chinese Cymbal", 52, 100 +"Ride Bell", 53, 100 +"Tambourine", 54, 100 +"Splash Cymbal", 55, 100 +"Cowbell", 56, 100 +"Crash Cymbal 2", 57, 100 +"Vibraslap", 58, 100 +"Ride Cymbal 2", 59, 100 +"Hi Bongo", 60, 100 +"Low Bongo", 61, 100 +"Mute Hi Conga", 62, 100 +"Open Hi Conga", 63, 100 +"Low Conga", 64, 100 +"High Timbale", 65, 100 +"Low Timbale", 66, 100 +"High Agogo", 67, 100 +"Low Agogo", 68, 100 +"Cabasa", 69, 100 +"Maracas", 70, 100 +"Short Whistle", 71, 100 +"Long Whistle", 72, 100 +"Short Guiro", 73, 100 +"Long Guiro", 74, 100 +"Claves", 75, 100 +"Hi Wood Block", 76, 100 +"Low Wood Block", 77, 100 +"Mute Cuica", 78, 100 +"Open Cuica", 79, 100 +"Mute Triangle", 80, 100 +"Open Triangle", 81, 100 +"Shaker", 82, 100 +"Jungle Bell", 83, 100 +"Belltree", 84, 100 +"Castanets", 85, 100 +"Mute Surdo", 86, 100 +"Open Surdo", 87, 100 diff --git a/sequencer/instruments/GS-Electronic.inst b/sequencer/instruments/GS-Electronic.inst new file mode 100644 index 0000000..2c378ea --- /dev/null +++ b/sequencer/instruments/GS-Electronic.inst @@ -0,0 +1,61 @@ +"High Q", 27, 100 +"Slap", 28, 100 +"Scratch Push", 29, 100 +"Scratch Pull", 30, 100 +"Sticks", 31, 100 +"Square Click", 32, 100 +"Metronome Click", 33, 100 +"Metronome Bell", 34, 100 +"Acoustic Bass Drum", 35, 100 +"Elec BD", 36, 100 +"Side Stick", 37, 100 +"Elec SD", 38, 100 +"Hand Clap", 39, 100 +"Gated SD", 40, 100 +"Elec Low Tom 2", 41, 100 +"Closed Hi-Hat", 42, 100 +"Elec Low Tom 1", 43, 100 +"Pedal Hi-Hat", 44, 100 +"Elec Mid Tom 2", 45, 100 +"Open Hi-Hat", 46, 100 +"Elec Mid Tom 1", 47, 100 +"Elec Hi Tom 2", 48, 100 +"Crash Cymbal 1", 49, 100 +"Elec High Tom 1", 50, 100 +"Ride Cymbal 1", 51, 100 +"Reverse Cymbal", 52, 100 +"Ride Bell", 53, 100 +"Tambourine", 54, 100 +"Splash Cymbal", 55, 100 +"Cowbell", 56, 100 +"Crash Cymbal 2", 57, 100 +"Vibraslap", 58, 100 +"Ride Cymbal 2", 59, 100 +"Hi Bongo", 60, 100 +"Low Bongo", 61, 100 +"Mute Hi Conga", 62, 100 +"Open Hi Conga", 63, 100 +"Low Conga", 64, 100 +"High Timbale", 65, 100 +"Low Timbale", 66, 100 +"High Agogo", 67, 100 +"Low Agogo", 68, 100 +"Cabasa", 69, 100 +"Maracas", 70, 100 +"Short Whistle", 71, 100 +"Long Whistle", 72, 100 +"Short Guiro", 73, 100 +"Long Guiro", 74, 100 +"Claves", 75, 100 +"Hi Wood Block", 76, 100 +"Low Wood Block", 77, 100 +"Mute Cuica", 78, 100 +"Open Cuica", 79, 100 +"Mute Triangle", 80, 100 +"Open Triangle", 81, 100 +"Shaker", 82, 100 +"Jungle Bell", 83, 100 +"Belltree", 84, 100 +"Castanets", 85, 100 +"Mute Surdo", 86, 100 +"Open Surdo", 87, 100 diff --git a/sequencer/instruments/GS-Jazz.inst b/sequencer/instruments/GS-Jazz.inst new file mode 100644 index 0000000..96368f3 --- /dev/null +++ b/sequencer/instruments/GS-Jazz.inst @@ -0,0 +1,61 @@ +"High Q", 27, 100 +"Slap", 28, 100 +"Scratch Push", 29, 100 +"Scratch Pull", 30, 100 +"Sticks", 31, 100 +"Square Click", 32, 100 +"Metronome Click", 33, 100 +"Metronome Bell", 34, 100 +"Acoustic Bass Drum", 35, 100 +"Bass Drum 1", 36, 100 +"Side Stick", 37, 100 +"Acoustic Snare", 38, 100 +"Hand Clap", 39, 100 +"Electric Snare", 40, 100 +"Low Floor Tom", 41, 100 +"Closed Hi-Hat", 42, 100 +"High Floor Tom", 43, 100 +"Pedal Hi-Hat", 44, 100 +"Low Tom", 45, 100 +"Open Hi-Hat", 46, 100 +"Low-Mid Tom", 47, 100 +"Hi-Mid Tom", 48, 100 +"Crash Cymbal 1", 49, 100 +"High Tom", 50, 100 +"Ride Cymbal 1", 51, 100 +"Chinese Cymbal", 52, 100 +"Ride Bell", 53, 100 +"Tambourine", 54, 100 +"Splash Cymbal", 55, 100 +"Cowbell", 56, 100 +"Crash Cymbal 2", 57, 100 +"Vibraslap", 58, 100 +"Ride Cymbal 2", 59, 100 +"Hi Bongo", 60, 100 +"Low Bongo", 61, 100 +"Mute Hi Conga", 62, 100 +"Open Hi Conga", 63, 100 +"Low Conga", 64, 100 +"High Timbale", 65, 100 +"Low Timbale", 66, 100 +"High Agogo", 67, 100 +"Low Agogo", 68, 100 +"Cabasa", 69, 100 +"Maracas", 70, 100 +"Short Whistle", 71, 100 +"Long Whistle", 72, 100 +"Short Guiro", 73, 100 +"Long Guiro", 74, 100 +"Claves", 75, 100 +"Hi Wood Block", 76, 100 +"Low Wood Block", 77, 100 +"Mute Cuica", 78, 100 +"Open Cuica", 79, 100 +"Mute Triangle", 80, 100 +"Open Triangle", 81, 100 +"Shaker", 82, 100 +"Jungle Bell", 83, 100 +"Belltree", 84, 100 +"Castanets", 85, 100 +"Mute Surdo", 86, 100 +"Open Surdo", 87, 100 diff --git a/sequencer/instruments/GS-Orchestra.inst b/sequencer/instruments/GS-Orchestra.inst new file mode 100644 index 0000000..9edecea --- /dev/null +++ b/sequencer/instruments/GS-Orchestra.inst @@ -0,0 +1,62 @@ +"Closed HH", 27, 100 +"Pedal HH", 28, 100 +"Open HH", 29, 100 +"Hide Cymbal", 30, 100 +"Sticks", 31, 100 +"Square Click", 32, 100 +"Metronome Click", 33, 100 +"Metronome Bell", 34, 100 +"Concert BD2", 35, 100 +"Concert BD1", 36, 100 +"Side Stick", 37, 100 +"Concert SD", 38, 100 +"Castanets", 39, 100 +"Concert SD", 40, 100 +"Timpani F", 41, 100 +"Timpani F#", 42, 100 +"Timpani G", 43, 100 +"Timpani G#", 44, 100 +"Timpani A", 45, 100 +"Timpani A#", 46, 100 +"Timpani B", 47, 100 +"Timpani c", 48, 100 +"Timpani c#", 49, 100 +"Timpani d", 50, 100 +"Timpani d#", 51, 100 +"Timpani e", 52, 100 +"Timpani f", 53, 100 +"Tambourine", 54, 100 +"Splash Cymbal", 55, 100 +"Cowbell", 56, 100 +"Concert Cymbal 2", 57, 100 +"Vibraslap", 58, 100 +"Concert Cymbal 1", 59, 100 +"Hi Bongo", 60, 100 +"Low Bongo", 61, 100 +"Mute Hi Conga", 62, 100 +"Open Hi Conga", 63, 100 +"Low Conga", 64, 100 +"High Timbale", 65, 100 +"Low Timbale", 66, 100 +"High Agogo", 67, 100 +"Low Agogo", 68, 100 +"Cabasa", 69, 100 +"Maracas", 70, 100 +"Short Whistle", 71, 100 +"Long Whistle", 72, 100 +"Short Guiro", 73, 100 +"Long Guiro", 74, 100 +"Claves", 75, 100 +"Hi Wood Block", 76, 100 +"Low Wood Block", 77, 100 +"Mute Cuica", 78, 100 +"Open Cuica", 79, 100 +"Mute Triangle", 80, 100 +"Open Triangle", 81, 100 +"Shaker", 82, 100 +"Jungle Bell", 83, 100 +"Belltree", 84, 100 +"Castanets", 85, 100 +"Mute Surdo", 86, 100 +"Open Surdo", 87, 100 +"Applause", 88, 100 diff --git a/sequencer/instruments/GS-Power.inst b/sequencer/instruments/GS-Power.inst new file mode 100644 index 0000000..11bf902 --- /dev/null +++ b/sequencer/instruments/GS-Power.inst @@ -0,0 +1,61 @@ +"High Q", 27, 100 +"Slap", 28, 100 +"Scratch Push", 29, 100 +"Scratch Pull", 30, 100 +"Sticks", 31, 100 +"Square Click", 32, 100 +"Metronome Click", 33, 100 +"Metronome Bell", 34, 100 +"Acoustic Bass Drum", 35, 100 +"MONDO Kick", 36, 100 +"Side Stick", 37, 100 +"Gated SD", 38, 100 +"Hand Clap", 39, 100 +"Electric Snare", 40, 100 +"Room Low Tom 2", 41, 100 +"Closed Hi-Hat", 42, 100 +"Room Low Tom 1", 43, 100 +"Pedal Hi-Hat", 44, 100 +"Room Mid Tom 2", 45, 100 +"Open Hi-Hat", 46, 100 +"Room Mid Tom 1", 47, 100 +"Room Hi Tom 2", 48, 100 +"Crash Cymbal 1", 49, 100 +"Room High Tom 1", 50, 100 +"Ride Cymbal 1", 51, 100 +"Chinese Cymbal", 52, 100 +"Ride Bell", 53, 100 +"Tambourine", 54, 100 +"Splash Cymbal", 55, 100 +"Cowbell", 56, 100 +"Crash Cymbal 2", 57, 100 +"Vibraslap", 58, 100 +"Ride Cymbal 2", 59, 100 +"Hi Bongo", 60, 100 +"Low Bongo", 61, 100 +"Mute Hi Conga", 62, 100 +"Open Hi Conga", 63, 100 +"Low Conga", 64, 100 +"High Timbale", 65, 100 +"Low Timbale", 66, 100 +"High Agogo", 67, 100 +"Low Agogo", 68, 100 +"Cabasa", 69, 100 +"Maracas", 70, 100 +"Short Whistle", 71, 100 +"Long Whistle", 72, 100 +"Short Guiro", 73, 100 +"Long Guiro", 74, 100 +"Claves", 75, 100 +"Hi Wood Block", 76, 100 +"Low Wood Block", 77, 100 +"Mute Cuica", 78, 100 +"Open Cuica", 79, 100 +"Mute Triangle", 80, 100 +"Open Triangle", 81, 100 +"Shaker", 82, 100 +"Jungle Bell", 83, 100 +"Belltree", 84, 100 +"Castanets", 85, 100 +"Mute Surdo", 86, 100 +"Open Surdo", 87, 100 diff --git a/sequencer/instruments/GS-Room.inst b/sequencer/instruments/GS-Room.inst new file mode 100644 index 0000000..454fa36 --- /dev/null +++ b/sequencer/instruments/GS-Room.inst @@ -0,0 +1,61 @@ +"High Q", 27, 100 +"Slap", 28, 100 +"Scratch Push", 29, 100 +"Scratch Pull", 30, 100 +"Sticks", 31, 100 +"Square Click", 32, 100 +"Metronome Click", 33, 100 +"Metronome Bell", 34, 100 +"Acoustic Bass Drum", 35, 100 +"Kick Drum 1", 36, 100 +"Side Stick", 37, 100 +"Acoustic Snare", 38, 100 +"Hand Clap", 39, 100 +"Electric Snare", 40, 100 +"Room Low Tom 2", 41, 100 +"Closed Hi-Hat", 42, 100 +"Room Low Tom 1", 43, 100 +"Pedal Hi-Hat", 44, 100 +"Room Mid Tom 2", 45, 100 +"Open Hi-Hat", 46, 100 +"Room Mid Tom 1", 47, 100 +"Room Hi Tom 2", 48, 100 +"Crash Cymbal 1", 49, 100 +"Room High Tom 1", 50, 100 +"Ride Cymbal 1", 51, 100 +"Chinese Cymbal", 52, 100 +"Ride Bell", 53, 100 +"Tambourine", 54, 100 +"Splash Cymbal", 55, 100 +"Cowbell", 56, 100 +"Crash Cymbal 2", 57, 100 +"Vibraslap", 58, 100 +"Ride Cymbal 2", 59, 100 +"Hi Bongo", 60, 100 +"Low Bongo", 61, 100 +"Mute Hi Conga", 62, 100 +"Open Hi Conga", 63, 100 +"Low Conga", 64, 100 +"High Timbale", 65, 100 +"Low Timbale", 66, 100 +"High Agogo", 67, 100 +"Low Agogo", 68, 100 +"Cabasa", 69, 100 +"Maracas", 70, 100 +"Short Whistle", 71, 100 +"Long Whistle", 72, 100 +"Short Guiro", 73, 100 +"Long Guiro", 74, 100 +"Claves", 75, 100 +"Hi Wood Block", 76, 100 +"Low Wood Block", 77, 100 +"Mute Cuica", 78, 100 +"Open Cuica", 79, 100 +"Mute Triangle", 80, 100 +"Open Triangle", 81, 100 +"Shaker", 82, 100 +"Jungle Bell", 83, 100 +"Belltree", 84, 100 +"Castanets", 85, 100 +"Mute Surdo", 86, 100 +"Open Surdo", 87, 100 diff --git a/sequencer/instruments/GS-SFX.inst b/sequencer/instruments/GS-SFX.inst new file mode 100644 index 0000000..a404b30 --- /dev/null +++ b/sequencer/instruments/GS-SFX.inst @@ -0,0 +1,58 @@ +"High Q", 27, 100 +"Slap", 28, 100 +"Scratch Push", 29, 100 +"Scratch Pull", 30, 100 +"Sticks", 31, 100 +"Square Click", 32, 100 +"Metronome Click", 33, 100 +"Metronome Bell", 34, 100 +"Acoustic Bass Drum", 35, 100 +"Bass Drum 1", 36, 100 +"Side Stick", 37, 100 +"Acoustic Snare", 38, 100 +"High Q", 39, 100 +"Slap", 40, 100 +"Scratch Push", 41, 100 +"Scratch Pull", 42, 100 +"Sticks", 43, 100 +"Sqare Click", 44, 100 +"Metronome Click", 45, 100 +"Metronome Bell", 46, 100 +"Guitar sld fing.", 47, 100 +"Guitar cutt down", 48, 100 +"Guitar cutt up", 49, 100 +"String slap", 50, 100 +"Fl. Key Click", 51, 100 +"Laughing", 52, 100 +"Screamming", 53, 100 +"Punch", 54, 100 +"Heart Beat", 55, 100 +"Footsteps 1", 56, 100 +"Footsteps 2", 57, 100 +"Aplause", 58, 100 +"Door Creaking", 59, 100 +"Door", 60, 100 +"Scratch", 61, 100 +"Windchime", 62, 100 +"Car-Engine", 63, 100 +"Car-Stop", 64, 100 +"Car-Pass", 65, 100 +"Car-Crash", 66, 100 +"Siren", 67, 100 +"Train", 68, 100 +"Jetplane", 69, 100 +"Helicopter", 70, 100 +"Starship", 71, 100 +"Gun Shot", 72, 100 +"Machine Gun", 73, 100 +"Lasergun", 74, 100 +"Explosion", 75, 100 +"Dog", 76, 100 +"Horse-Gallop", 77, 100 +"Birds", 78, 100 +"Rain", 79, 100 +"Thunder", 80, 100 +"Wind", 81, 100 +"Seashore", 82, 100 +"Stream", 83, 100 +"Bubble", 84, 100 diff --git a/sequencer/instruments/GS-Standard.inst b/sequencer/instruments/GS-Standard.inst new file mode 100644 index 0000000..96368f3 --- /dev/null +++ b/sequencer/instruments/GS-Standard.inst @@ -0,0 +1,61 @@ +"High Q", 27, 100 +"Slap", 28, 100 +"Scratch Push", 29, 100 +"Scratch Pull", 30, 100 +"Sticks", 31, 100 +"Square Click", 32, 100 +"Metronome Click", 33, 100 +"Metronome Bell", 34, 100 +"Acoustic Bass Drum", 35, 100 +"Bass Drum 1", 36, 100 +"Side Stick", 37, 100 +"Acoustic Snare", 38, 100 +"Hand Clap", 39, 100 +"Electric Snare", 40, 100 +"Low Floor Tom", 41, 100 +"Closed Hi-Hat", 42, 100 +"High Floor Tom", 43, 100 +"Pedal Hi-Hat", 44, 100 +"Low Tom", 45, 100 +"Open Hi-Hat", 46, 100 +"Low-Mid Tom", 47, 100 +"Hi-Mid Tom", 48, 100 +"Crash Cymbal 1", 49, 100 +"High Tom", 50, 100 +"Ride Cymbal 1", 51, 100 +"Chinese Cymbal", 52, 100 +"Ride Bell", 53, 100 +"Tambourine", 54, 100 +"Splash Cymbal", 55, 100 +"Cowbell", 56, 100 +"Crash Cymbal 2", 57, 100 +"Vibraslap", 58, 100 +"Ride Cymbal 2", 59, 100 +"Hi Bongo", 60, 100 +"Low Bongo", 61, 100 +"Mute Hi Conga", 62, 100 +"Open Hi Conga", 63, 100 +"Low Conga", 64, 100 +"High Timbale", 65, 100 +"Low Timbale", 66, 100 +"High Agogo", 67, 100 +"Low Agogo", 68, 100 +"Cabasa", 69, 100 +"Maracas", 70, 100 +"Short Whistle", 71, 100 +"Long Whistle", 72, 100 +"Short Guiro", 73, 100 +"Long Guiro", 74, 100 +"Claves", 75, 100 +"Hi Wood Block", 76, 100 +"Low Wood Block", 77, 100 +"Mute Cuica", 78, 100 +"Open Cuica", 79, 100 +"Mute Triangle", 80, 100 +"Open Triangle", 81, 100 +"Shaker", 82, 100 +"Jungle Bell", 83, 100 +"Belltree", 84, 100 +"Castanets", 85, 100 +"Mute Surdo", 86, 100 +"Open Surdo", 87, 100 diff --git a/sequencer/instruments/GS-TR-808.inst b/sequencer/instruments/GS-TR-808.inst new file mode 100644 index 0000000..e47460d --- /dev/null +++ b/sequencer/instruments/GS-TR-808.inst @@ -0,0 +1,61 @@ +"High Q", 27, 100 +"Slap", 28, 100 +"Scratch Push", 29, 100 +"Scratch Pull", 30, 100 +"Sticks", 31, 100 +"Square Click", 32, 100 +"Metronome Click", 33, 100 +"Metronome Bell", 34, 100 +"Acoustic Bass Drum", 35, 100 +"808 BD", 36, 100 +"808 Rim Shot", 37, 100 +"808 Snare Drum", 38, 100 +"Hand Clap", 39, 100 +"Gated SD", 40, 100 +"808 Low Tom 2", 41, 100 +"808 CHH", 42, 100 +"808 Low Tom 1", 43, 100 +"808 CHH", 44, 100 +"808 Mid Tom 2", 45, 100 +"808 OHH", 46, 100 +"808 Mid Tom 1", 47, 100 +"808 Hi Tom 2", 48, 100 +"808 Cymbal", 49, 100 +"808 High Tom 1", 50, 100 +"Ride Cymbal 1", 51, 100 +"Reverse Cymbal", 52, 100 +"Ride Bell", 53, 100 +"Tambourine", 54, 100 +"Splash Cymbal", 55, 100 +"Cowbell", 56, 100 +"Crash Cymbal 2", 57, 100 +"Vibraslap", 58, 100 +"Ride Cymbal 2", 59, 100 +"Hi Bongo", 60, 100 +"Low Bongo", 61, 100 +"808 Hi Conga", 62, 100 +"808 Mid Conga", 63, 100 +"808 Low Conga", 64, 100 +"High Timbale", 65, 100 +"Low Timbale", 66, 100 +"High Agogo", 67, 100 +"Low Agogo", 68, 100 +"Cabasa", 69, 100 +"808 Maracas", 70, 100 +"Short Whistle", 71, 100 +"Long Whistle", 72, 100 +"Short Guiro", 73, 100 +"Long Guiro", 74, 100 +"808 Claves", 75, 100 +"Hi Wood Block", 76, 100 +"Low Wood Block", 77, 100 +"Mute Cuica", 78, 100 +"Open Cuica", 79, 100 +"Mute Triangle", 80, 100 +"Open Triangle", 81, 100 +"Shaker", 82, 100 +"Jungle Bell", 83, 100 +"Belltree", 84, 100 +"Castanets", 85, 100 +"Mute Surdo", 86, 100 +"Open Surdo", 87, 100 diff --git a/sequencer/lib b/sequencer/lib new file mode 120000 index 0000000..dc598c5 --- /dev/null +++ b/sequencer/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/sequencer/makefile.inc b/sequencer/makefile.inc new file mode 100644 index 0000000..fd5e18c --- /dev/null +++ b/sequencer/makefile.inc @@ -0,0 +1,57 @@ +# -*- mode: makefile; -*- + +# Makefile for the Non Sequencer. + +# +# Do not edit this file; run `make config` instead. +# + +VERSION := 1.9.4 +PACKAGE := SEQUENCER +BIN_NAME := non-sequencer + +all: Sequencer + +SRCS := $(wildcard src/*.C src/*.fl src/gui/*.C src/gui/*.fl src/NSM/*.C) + +SRCS:=$(SRCS:.fl=.C) +SRCS:=$(sort $(SRCS)) +OBJS:=$(SRCS:.C=.o) + +CFLAGS += $(CFLAGS) $(CXXFLAGS) $(FLTK_CFLAGS) $(SIGCPP_CFLAGS) $(LIBLO_CFLAGS) $(XPM_CFLAGS) + +LIBS += $(FLTK_LDFLAGS) $(JACK_LIBS) $(SIGCPP_LIBS) $(LIBLO_LIBS) $(XPM_LIBS) + +Sequencer: src/sequencer + +clean: + rm -f src/sequencer .deps $(OBJS) + +src/sequencer: $(OBJS) FL/libfl_widgets.a nonlib/libnonlib.a $(FLTK_LIBS) + @ echo -n Linking sequencer... + $(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS) -LFL -lfl_widgets -Lnonlib -lnonlib -ldl && echo $(DONE) + + +ifeq ($(JACK_MIDI_PROTO_API),yes) + CXXFLAGS+=-DJACK_MIDI_PROTO_API +endif + +install: all + @ echo -n "Installing..." + @ install -Dm755 src/sequencer "$(DESTDIR)$(prefix)"/bin/non-sequencer + @ install -d "$(DESTDIR)$(SYSTEM_PATH)/instruments" + @ install -m 644 instruments/* "$(DESTDIR)$(SYSTEM_PATH)/instruments" + @ $(MAKE) -s -C doc install + @ install -d "$(DESTDIR)$(PIXMAP_PATH)" + @ install -m 644 icons/hicolor/256x256/apps/non-sequencer.png "$(DESTDIR)$(PIXMAP_PATH)"/icon-256x256.png + @ install -d "$(DESTDIR)$(ICON_PATH)/hicolor" + @ cp -au icons/hicolor/ "$(DESTDIR)$(ICON_PATH)" + @ install -d "$(DESTDIR)$(DESKTOP_PATH)" + @ sed 's:@BIN_PATH@:$(prefix)/bin:' non-sequencer.desktop.in > "$(DESTDIR)$(DESKTOP_PATH)/non-sequencer.desktop" + @ echo "$(DONE)" +ifneq ($(USE_DEBUG),yes) + @ echo -n "Stripping..." + @ strip "$(DESTDIR)$(prefix)"/bin/non-sequencer + @ echo "$(DONE)" +endif + diff --git a/sequencer/non-sequencer.desktop.in b/sequencer/non-sequencer.desktop.in new file mode 100644 index 0000000..620c797 --- /dev/null +++ b/sequencer/non-sequencer.desktop.in @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Non Sequencer +Comment=Realtime MIDI sequencer for JACK MIDI +Exec=@BIN_PATH@/non-sequencer +Terminal=false +Type=Application +Icon=non-sequencer +Categories=Application;AudioVideo;Audio;Midi; diff --git a/sequencer/nonlib b/sequencer/nonlib new file mode 120000 index 0000000..bff0245 --- /dev/null +++ b/sequencer/nonlib @@ -0,0 +1 @@ +../nonlib \ No newline at end of file diff --git a/sequencer/scripts b/sequencer/scripts new file mode 120000 index 0000000..a339954 --- /dev/null +++ b/sequencer/scripts @@ -0,0 +1 @@ +../scripts \ No newline at end of file diff --git a/sequencer/src/NSM.C b/sequencer/src/NSM.C new file mode 100644 index 0000000..e318fa0 --- /dev/null +++ b/sequencer/src/NSM.C @@ -0,0 +1,142 @@ + +/*******************************************************************************/ +/* Copyright (C) 2012 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "NSM.H" + + +#include +#include +#include +#include + +#include "common.h" +#include "config.h" +#include "non.H" +#include "jack.H" +#include "transport.H" + +#include "gui/ui.H" + +#define OSC_INTERVAL 0.2f + +extern Transport transport; +extern char *instance_name; + +extern NSM_Client *nsm; + +extern UI *ui; + +NSM_Client::NSM_Client ( ) +{ + project_filename = 0; +} + +int command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg ); +int command_save ( char **out_msg ); + + +int +NSM_Client::command_save ( char **out_msg ) +{ + if ( transport.rolling ) + { + *out_msg = strdup( "Cannot save while transport is running." ); + return ERR_NOT_NOW; + } + else + { + save_song( nsm->project_filename ); + return ERR_OK; + } +} + +int +NSM_Client::command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg ) +{ + if ( transport.rolling ) + { + *out_msg = strdup( "Cannot open while transport is running." ); + + return ERR_NOT_NOW; + } + + if ( song.dirty() ) + { + *out_msg = strdup( "Song has unsaved changes!" ); + + return ERR_UNSAVED_CHANGES; + } + + if ( instance_name ) + free( instance_name ); + + instance_name = strdup( client_id ); + + if ( ! midi_is_active() ) + { + setup_jack(); + } + else + { + midi_all_sound_off(); + midi_shutdown(); + setup_jack(); + } + + char *new_filename; + + asprintf( &new_filename, "%s.non", name ); + + struct stat st; + + if ( 0 == stat( new_filename, &st ) ) + { + if ( ! load_song( new_filename ) ) + { + *out_msg = strdup( "Could not open file" ); + return ERR_GENERAL; + } + } + else + { + save_song( new_filename ); + } + + if ( nsm->project_filename ) + free( nsm->project_filename ); + + nsm->project_filename = new_filename; + + return ERR_OK; +} + +void +NSM_Client::command_active ( bool b ) +{ + if ( b ) + { + ui->sm_indicator->value( 1 ); + ui->sm_indicator->tooltip( session_manager_name() ); + } + else + { + ui->sm_indicator->tooltip( NULL ); + ui->sm_indicator->value( 0 ); + } +} diff --git a/timeline/src/NSM.H b/sequencer/src/NSM.H similarity index 93% rename from timeline/src/NSM.H rename to sequencer/src/NSM.H index bab3d61..0f787d8 100644 --- a/timeline/src/NSM.H +++ b/sequencer/src/NSM.H @@ -24,6 +24,8 @@ class NSM_Client : public NSM::Client { + char *project_filename; + public: NSM_Client ( ); @@ -33,7 +35,7 @@ protected: int command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg ); int command_save ( char **out_msg ); - void command_session_is_loaded ( void ); + int command_quit ( char **out_msg ); - int command_broadcast ( const char *path, lo_message msg ); + void command_active ( bool ); }; diff --git a/sequencer/src/NSM/Client.C b/sequencer/src/NSM/Client.C new file mode 100644 index 0000000..fae4b9c --- /dev/null +++ b/sequencer/src/NSM/Client.C @@ -0,0 +1,298 @@ + +/*******************************************************************************/ +/* Copyright (C) 2012 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "../debug.h" +#include "Client.H" +#include +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wunused-parameter" + +namespace NSM +{ + +/************************/ +/* OSC Message Handlers */ +/************************/ + +#undef OSC_REPLY +#undef OSC_REPLY_ERR + +#define OSC_REPLY( value ) lo_send_from( ((NSM::Client*)user_data)->nsm_addr, ((NSM::Client*)user_data)->_server, LO_TT_IMMEDIATE, "/reply", "ss", path, value ) + +#define OSC_REPLY_ERR( errcode, value ) lo_send_from( ((NSM::Client*)user_data)->nsm_addr, ((NSM::Client*)user_data)->_server, LO_TT_IMMEDIATE, "/error", "sis", path, errcode, value ) + + Client::Client ( ) + { + nsm_addr = 0; + nsm_client_id = 0; + _session_manager_name = 0; + nsm_is_active = false; + _server = 0; + _st = 0; + } + + Client::~Client ( ) + { + if ( _st ) + stop(); + + if ( _st ) + lo_server_thread_free( _st ); + else + lo_server_free ( _server ); + } + + void + Client::announce ( const char *application_name, const char *capabilities, const char *process_name ) + { + MESSAGE( "Announcing to NSM" ); + + lo_address to = lo_address_new_from_url( nsm_url ); + + if ( ! to ) + { + MESSAGE( "Bad address" ); + return; + } + + int pid = (int)getpid(); + + lo_send_from( to, _server, LO_TT_IMMEDIATE, "/nsm/server/announce", "sssiii", + application_name, + capabilities, + process_name, + 1, /* api_major_version */ + 0, /* api_minor_version */ + pid ); + + lo_address_free( to ); + } + + void + Client::progress ( float p ) + { + if ( nsm_is_active ) + { + lo_send_from( nsm_addr, _server, LO_TT_IMMEDIATE, "/nsm/client/progress", "f", p ); + } + } + + void + Client::is_dirty ( void ) + { + if ( nsm_is_active ) + { + lo_send_from( nsm_addr, _server, LO_TT_IMMEDIATE, "/nsm/client/is_dirty", "" ); + } + } + + void + Client::is_clean ( void ) + { + if ( nsm_is_active ) + { + lo_send_from( nsm_addr, _server, LO_TT_IMMEDIATE, "/nsm/client/is_clean", "" ); + } + } + + void + Client::message ( int priority, const char *msg ) + { + if ( nsm_is_active ) + { + lo_send_from( nsm_addr, _server, LO_TT_IMMEDIATE, "/nsm/client/message", "is", priority, msg ); + } + } + + + void + Client::broadcast ( lo_message msg ) + { + if ( nsm_is_active ) + { + lo_send_message_from( nsm_addr, _server, "/nsm/server/broadcast", msg ); + } + } + + void + Client::check ( int timeout ) + { + if ( lo_server_wait( _server, timeout ) ) + while ( lo_server_recv_noblock( _server, 0 ) ) {} + } + + void + Client::start ( ) + { + lo_server_thread_start( _st ); + } + + void + Client::stop ( ) + { + lo_server_thread_stop( _st ); + } + + int + Client::init ( const char *nsm_url ) + { + this->nsm_url = nsm_url; + + lo_address addr = lo_address_new_from_url( nsm_url ); + int proto = lo_address_get_protocol( addr ); + lo_address_free( addr ); + + _server = lo_server_new_with_proto( NULL, proto, NULL ); + + if ( ! _server ) + return -1; + + lo_server_add_method( _server, "/error", "sis", &Client::osc_error, this ); + lo_server_add_method( _server, "/reply", "ssss", &Client::osc_announce_reply, this ); + lo_server_add_method( _server, "/nsm/client/open", "sss", &Client::osc_open, this ); + lo_server_add_method( _server, "/nsm/client/save", "", &Client::osc_save, this ); + lo_server_add_method( _server, "/nsm/client/session_is_loaded", "", &Client::osc_session_is_loaded, this ); + lo_server_add_method( _server, NULL, NULL, &Client::osc_broadcast, this ); + + return 0; + } + + int + Client::init_thread ( const char *nsm_url ) + { + this->nsm_url = nsm_url; + + lo_address addr = lo_address_new_from_url( nsm_url ); + int proto = lo_address_get_protocol( addr ); + lo_address_free( addr ); + + _st = lo_server_thread_new_with_proto( NULL, proto, NULL ); + _server = lo_server_thread_get_server( _st ); + + if ( ! _server || ! _st ) + return -1; + + lo_server_thread_add_method( _st, "/error", "sis", &Client::osc_error, this ); + lo_server_thread_add_method( _st, "/reply", "ssss", &Client::osc_announce_reply, this ); + lo_server_thread_add_method( _st, "/nsm/client/open", "sss", &Client::osc_open, this ); + lo_server_thread_add_method( _st, "/nsm/client/save", "", &Client::osc_save, this ); + lo_server_thread_add_method( _st, "/nsm/client/session_is_loaded", "", &Client::osc_session_is_loaded, this ); + lo_server_thread_add_method( _st, NULL, NULL, &Client::osc_broadcast, this ); + + return 0; + } + +/************************/ +/* OSC Message Handlers */ +/************************/ + + int + Client::osc_broadcast ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + { + return ((NSM::Client*)user_data)->command_broadcast( path, msg ); + } + + int + Client::osc_save ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + { + char *out_msg = NULL; + + int r = ((NSM::Client*)user_data)->command_save(&out_msg); + + if ( r ) + OSC_REPLY_ERR( r, ( out_msg ? out_msg : "") ); + else + OSC_REPLY( "OK" ); + + if ( out_msg ) + free( out_msg ); + + return 0; + } + + int + Client::osc_open ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + { + char *out_msg = NULL; + + NSM::Client *nsm = (NSM::Client*)user_data; + + nsm->nsm_client_id = strdup( &argv[2]->s ); + + int r = ((NSM::Client*)user_data)->command_open( &argv[0]->s, &argv[1]->s, &argv[2]->s, &out_msg); + + if ( r ) + OSC_REPLY_ERR( r, ( out_msg ? out_msg : "") ); + else + OSC_REPLY( "OK" ); + + if ( out_msg ) + free( out_msg ); + + return 0; + } + + int + Client::osc_session_is_loaded ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + { + NSM::Client *nsm = (NSM::Client*)user_data; + + nsm->command_session_is_loaded(); + + return 0; + } + + int + Client::osc_error ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + { + if ( strcmp( &argv[0]->s, "/nsm/server/announce" ) ) + return -1; + + NSM::Client *nsm = (NSM::Client*)user_data; + + + WARNING( "Failed to register with NSM: %s", &argv[2]->s ); + nsm->nsm_is_active = false; + + nsm->command_active( nsm->nsm_is_active ); + + return 0; + } + + int + Client::osc_announce_reply ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + { + if ( strcmp( &argv[0]->s, "/nsm/server/announce" ) ) + return -1; + + NSM::Client *nsm = (NSM::Client*)user_data; + + MESSAGE( "Successfully registered. NSM says: %s", &argv[1]->s ); + nsm->nsm_is_active = true; + nsm->_session_manager_name = strdup( &argv[2]->s ); + nsm->nsm_addr = lo_address_new_from_url( lo_address_get_url( lo_message_get_source( msg ) )); + + nsm->command_active( nsm->nsm_is_active ); + + return 0; + } +}; diff --git a/sequencer/src/NSM/Client.H b/sequencer/src/NSM/Client.H new file mode 100644 index 0000000..f417944 --- /dev/null +++ b/sequencer/src/NSM/Client.H @@ -0,0 +1,109 @@ + +/*******************************************************************************/ +/* Copyright (C) 2012 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include + +namespace NSM +{ + + class Client + { + + private: + + const char *nsm_url; + + lo_server _server; + lo_server_thread _st; + lo_address nsm_addr; + + bool nsm_is_active; + char *nsm_client_id; + char *_session_manager_name; + + public: + + enum + { + ERR_OK = 0, + ERR_GENERAL = -1, + ERR_INCOMPATIBLE_API = -2, + ERR_BLACKLISTED = -3, + ERR_LAUNCH_FAILED = -4, + ERR_NO_SUCH_FILE = -5, + ERR_NO_SESSION_OPEN = -6, + ERR_UNSAVED_CHANGES = -7, + ERR_NOT_NOW = -8 + }; + + Client ( ); + virtual ~Client ( ); + + bool is_active ( void ) { return nsm_is_active; } + + const char *session_manager_name ( void ) { return _session_manager_name; } + + /* Client->Server methods */ + void is_dirty ( void ); + void is_clean ( void ); + void progress ( float f ); + void message( int priority, const char *msg ); + void announce ( const char *appliction_name, const char *capabilities, const char *process_name ); + + void broadcast ( lo_message msg ); + + /* init without threading */ + int init ( const char *nsm_url ); + /* init with threading */ + int init_thread ( const char *nsm_url ); + + /* call this periodically to check for new messages */ + void check ( int timeout = 0 ); + + /* or call these to start and stop a thread (must do your own locking in handler!) */ + void start ( void ); + void stop ( void ); + + protected: + + /* Server->Client methods */ + virtual int command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg ) = 0; + virtual int command_save ( char **out_msg ) = 0; + + virtual void command_active ( bool ) { } + + virtual void command_session_is_loaded ( void ) { } + + /* invoked when an unrecognized message is received. Should return 0 if you handled it, -1 otherwise. */ + virtual int command_broadcast ( const char *, lo_message ) { return -1; } + + private: + + /* osc handlers */ + static int osc_open ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); + static int osc_save ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); + static int osc_announce_reply ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); + static int osc_error ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); + static int osc_session_is_loaded ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); + static int osc_broadcast ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); + + }; +}; diff --git a/sequencer/src/canvas.C b/sequencer/src/canvas.C new file mode 100644 index 0000000..e9a9a57 --- /dev/null +++ b/sequencer/src/canvas.C @@ -0,0 +1,997 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +/* This is a generic double-buffering, optimizing canvas interface to + grids (patterns and phrases). It draws only what is necessary to keep + the display up-to-date. Actual drawing functions are in draw.C */ + +#include "canvas.H" +#include "pattern.H" +#include "gui/draw.H" +#include "common.h" + +#include "non.H" + +cell_t ** +Canvas::_alloc_array ( void ) +{ + cell_t **a; + + int one = sizeof( typeof( a ) ) * m.vp->w; + int two = sizeof( typeof( a[0] ) ) * (m.vp->h * m.vp->w); + + a = (cell_t **) malloc( one + two ); + + m.size = one + two; + + cell_t *c = (cell_t *) (((unsigned char *)a) + one); + + for ( uint x = m.vp->w; x-- ; ) + { + a[x] = c; + c += m.vp->h; + for ( uint y = m.vp->h; y-- ; ) + { + a[ x ][ y ].flags = 0; + a[ x ][ y ].state = -1; + a[ x ][ y ].color = 0; + } + } + + m.w = m.vp->w; + m.h = m.vp->h; + + return a; +} + +Canvas::Canvas ( ) +{ + m.origin_x = m.origin_y = m.height = m.width = m.div_w = m.div_h = m.playhead = m.margin_top = m.margin_left = m.playhead = m.w = m.h = m.p1 = m.p2 = m.p3 = m.p4 = 0; + + m.margin_top = ruler_height; + + m.draw = false; + m.ruler_drawn = false; + m.mapping_drawn = false; + m.grid_drawn = false; + + m.current = m.previous = NULL; + + m.row_compact = true; + + m.maxh = 128; + + m.vp = NULL; +} + +void +Canvas::handle_event_change ( void ) +{ + /* mark the song as dirty and pass the signal on */ + song.set_dirty(); + + signal_draw(); +} + +/** change grid to /g/, returns TRUE if new grid size differs from old */ +void +Canvas::grid ( Grid *g ) +{ + m.grid = g; + + if ( ! g ) + return; + + m.vp = &g->viewport; + + char *s = m.vp->dump(); + DMESSAGE( "viewport: %s", s ); + free( s ); + + m.ruler_drawn = false; + + resize_grid(); + + update_mapping(); + +// m.shape = m.grid->draw_shape(); + + /* connect signals */ + /* FIXME: what happens when we do this twice? */ + g->signal_events_change.connect( mem_fun( this, &Canvas::handle_event_change ) ); + g->signal_settings_change.connect( signal_settings_change.make_slot() ); + + signal_draw(); + signal_settings_change(); + signal_pan(); +} + +/** keep row compaction tables up-to-date */ +void +Canvas::_update_row_mapping ( void ) +{ + /* reset */ + for ( int i = 128; i-- ; ) + m.rtn[i] = m.ntr[i] = -1; + + DMESSAGE( "updating row mapping" ); + + /* rebuild */ + int r = 0; + for ( int n = 0; n < 128; ++n ) + { + if ( m.grid->row_name( n ) ) + { + m.rtn[r] = n; + m.ntr[n] = r; + ++r; + } + } + + if ( m.row_compact && r ) + m.maxh = r; + else + m.maxh = 128; + + m.vp->h = min( m.vp->h, m.maxh ); +} + +/** update everything about mapping, leaving the viewport alone */ +void +Canvas::update_mapping ( void ) +{ + _update_row_mapping(); + + m.mapping_drawn = false; + + resize(); + + int old_margin = m.margin_left; + + m.margin_left = 0; + + m.draw = false; + + m.grid->draw_row_names( this ); + + m.draw = true; + + if ( m.margin_left != old_margin ) + { + signal_resize(); + signal_draw(); + } + else + signal_draw(); + +} + +/** change grid mapping */ +void +Canvas::changed_mapping ( void ) +{ + update_mapping(); + + m.vp->h = min( m.vp->h, m.maxh ); + + if ( m.vp->y + m.vp->h > m.maxh ) + m.vp->y = (m.maxh / 2) - (m.vp->h / 2); + + signal_pan(); +} + +Grid * +Canvas::grid ( void ) +{ + return m.grid; +} + + +/** recalculate node sizes based on physical dimensions */ +void +Canvas::resize ( void ) +{ + if ( ! m.vp ) + return; + + m.div_w = (m.width - m.margin_left) / m.vp->w; + m.div_h = (m.height - m.margin_top) / m.vp->h; + + m.mapping_drawn = m.ruler_drawn = false; +} + +/** reallocate buffers to match grid dimensions */ +void +Canvas::resize_grid ( void ) +{ + // _update_row_mapping(); + + resize(); + + if ( m.vp ) + { + if ( m.vp->w != m.w || m.vp->h != m.h || + m.div_w != m.old_div_w || m.div_h != m.old_div_h ) + { + if ( m.grid_drawn ) + signal_resize(); + + m.old_div_w = m.div_w; + m.old_div_h = m.div_h; + } + else + return; + } + + DMESSAGE( "resizing grid %dx%d", m.vp->w, m.vp->h ); + + if ( m.previous ) + { + free( m.previous ); + free( m.current ); + } + + m.current = _alloc_array(); + m.previous = _alloc_array(); + + m.grid_drawn = false; +} + +/** inform the canvas with new phsyical dimensions */ +void +Canvas::resize ( int x, int y, int w, int h ) +{ + m.origin_x = x; + m.origin_y = y; + + m.width = w; + m.height = h; + + resize(); +} + + + +/***********/ +/* Drawing */ +/***********/ + +/** copy last buffer into current */ +void +Canvas::copy ( void ) +{ + for ( uint y = m.vp->h; y-- ; ) + for ( uint x = m.vp->w; x-- ; ) + m.current[ x ][ y ] = m.previous[ x ][ y ]; +} + + +/** reset last buffer */ +void +Canvas::_reset ( void ) +{ + cell_t empty = {0,0,0}; + + for ( uint y = m.vp->h; y-- ; ) + for ( uint x = m.vp->w; x-- ; ) + m.current[ x ][ y ] = empty; +} + +/** prepare current buffer for drawing (draw "background") */ +void +Canvas::clear ( void ) +{ + uint rule = m.grid->ppqn(); + + uint lx = m.grid->ts_to_x( m.grid->length() ); + + for ( uint y = m.vp->h; y--; ) + for ( uint x = m.vp->w; x--; ) + { + m.current[ x ][ y ].color = 0; + m.current[ x ][ y ].state = EMPTY; + m.current[ x ][ y ].flags = 0; + } + + for ( int x = m.vp->w - rule; x >= 0; x -= rule ) + for ( uint y = m.vp->h; y-- ; ) + m.current[ x ][ y ].state = LINE; + + int sx = (int)(lx - m.vp->x) >= 0 ? lx - m.vp->x : 0; + + for ( int x = sx; x < m.vp->w; ++x ) + for ( int y = m.vp->h; y-- ; ) + m.current[ x ][ y ].state = PARTIAL; + +} + +/** is /x/ within the viewport? */ +bool +Canvas::viewable_x ( int x ) +{ + return x >= m.vp->x && x < m.vp->x + m.vp->w; +} + +/** flush delta of last and current buffers to screen, then flip them */ +void +Canvas::flip ( void ) +{ + /* FIXME: should this not go in clear()? */ + if ( m.p1 != m.p2 ) + { + if ( viewable_x( m.p1 ) ) draw_line( m.p1 - m.vp->x, F_P1 ); + if ( viewable_x( m.p2 ) ) draw_line( m.p2 - m.vp->x, F_P2 ); + } + + if ( viewable_x( m.playhead ) ) draw_line( m.playhead - m.vp->x, F_PLAYHEAD ); + + const int shape = m.grid->draw_shape(); + + for ( uint y = m.vp->h; y--; ) + for ( uint x = m.vp->w; x--; ) + { + cell_t *c = &m.current[ x ][ y ]; + cell_t *p = &m.previous[ x ][ y ]; + + /* draw selection rect */ + if ( m.p3 != m.p4 ) + if ( y + m.vp->y >= m.p3 && x + m.vp->x >= m.p1 && + y + m.vp->y <= m.p4 && x + m.vp->x < m.p2 ) + c->flags |= F_SELECTION; + + if ( *c != *p ) + gui_draw_shape( m.origin_x + m.margin_left + x * m.div_w, m.origin_y + m.margin_top + y * m.div_h, m.div_w, m.div_h, + shape, c->state, c->flags, c->color ); + } + + cell_t **tmp = m.previous; + + m.previous = m.current; + m.current = tmp; +} + +/** redraw the ruler at the top of the canvas */ +void +Canvas::redraw_ruler ( void ) +{ + m.margin_top = gui_draw_ruler( m.origin_x + m.margin_left, m.origin_y, m.vp->w, m.div_w, m.grid->division(), m.vp->x, + m.p1 - m.vp->x, m.p2 - m.vp->x ); + m.ruler_drawn = true; +} + +/** callback called by Grid::draw_row_names() to draw an individual row name */ +void +Canvas::draw_row_name ( int y, const char *name, int color ) +{ + bool draw = m.draw; + bool clear = false; + + y = ntr( y ); + + if ( ! m.row_compact && ! name ) + clear = true; + + y -= m.vp->y; + + int bx = m.origin_x; + int by = m.origin_y + m.margin_top + y * m.div_h; + int bw = m.margin_left; + int bh = m.div_h; + + if ( y < 0 || y >= m.vp->h ) + draw = false; + + if ( clear && draw ) + gui_clear_area( bx, by, bw, bh ); + else + m.margin_left = max( m.margin_left, gui_draw_string( bx, by, + bw, bh, + color, + name, + draw ) ); +} + +/** redraw row names */ +void +Canvas::redraw_mapping ( void ) +{ + m.margin_left = 0; + + m.draw = false; + + m.grid->draw_row_names( this ); + + resize(); + + m.draw = true; + + m.grid->draw_row_names( this ); + + m.mapping_drawn = true; +} + +void +Canvas::draw_mapping ( void ) +{ + if ( ! m.mapping_drawn ) redraw_mapping(); +} + +void +Canvas::draw_ruler ( void ) +{ + if ( ! m.ruler_drawn ) redraw_ruler(); +} + +/** "draw" a shape in the backbuffer */ +void +Canvas::draw_shape ( int x, int y, int shape, int state, int color, bool selected ) +{ + y = ntr( y ); + + if ( y < 0 ) + return; + + // adjust for viewport. + + x -= m.vp->x; + y -= m.vp->y; + + if ( x < 0 || y < 0 || x >= m.vp->w || y >= m.vp->h ) + return; + + m.current[ x ][ y ].color = color; + m.current[ x ][ y ].state = (uint)m.vp->x + x > m.grid->ts_to_x( m.grid->length() ) ? PARTIAL : state; + if ( selected ) + m.current[ x ][ y ].state = SELECTED; + m.current[ x ][ y ].flags = 0; +} + +/** callback used by Grid::draw() */ +void +Canvas::draw_dash ( int x, int y, int l, int shape, int color, bool selected ) +{ + draw_shape( x, y, shape, FULL, color, selected ); + for ( int i = x + l - 1; i > x; i-- ) + { + draw_shape( i, y, shape, CONTINUED, 0, selected ); + } +} + +/** draw a vertical line with flags */ +void +Canvas::draw_line ( int x, int flags ) +{ + for ( uint y = m.vp->h; y-- ; ) + m.current[ x ][ y ].flags |= flags; +} + +int +Canvas::playhead_moved ( void ) +{ + int x = m.grid->ts_to_x( m.grid->index() ); + + return m.playhead != x; +} + +/** draw only the playhead--without reexamining the grid */ +int +Canvas::draw_playhead ( void ) +{ + int x = m.grid->ts_to_x( m.grid->index() ); + + if ( m.playhead == x ) + return 0; + + m.playhead = x; + + if ( m.playhead < m.vp->x || m.playhead >= m.vp->x + m.vp->w ) + { + if ( config.follow_playhead ) + { + m.vp->x = m.playhead / m.vp->w * m.vp->w; + + m.ruler_drawn = false; + + signal_draw(); + + return 0; + } + } + + copy(); + + for ( uint x = m.vp->w; x-- ; ) + for ( uint y = m.vp->h; y-- ; ) + m.current[ x ][ y ].flags &= ~ (F_PLAYHEAD | F_P1 | F_P2 ); + + flip(); + + /* actually if we're recording, we should draw the grid once per + * playhead movement also */ + if ( pattern::recording() == m.grid ) + { + draw(); + } + + return 1; +} + +/** draw ONLY those nodes necessary to bring the canvas up-to-date with the grid */ +void +Canvas::draw ( void ) +{ + DMESSAGE( "drawing canvas" ); + + draw_mapping(); + draw_ruler(); + + m.grid_drawn = true; + + m.grid->draw( this, m.vp->x, m.vp->y, m.vp->w, m.vp->h ); +} + +/** redraw every node on the canvas from the buffer (without + * necessarily reexamining the grid) */ +void +Canvas::redraw ( void ) +{ + DMESSAGE( "redrawing canvas" ); + + if ( ! m.grid_drawn ) + draw(); + + m.ruler_drawn = false; + m.mapping_drawn = false; + + draw_mapping(); + draw_ruler(); + + const int shape = m.grid->draw_shape(); + + for ( int y = m.vp->h; y--; ) + for ( int x = m.vp->w; x--; ) + { + cell_t c = m.previous[ x ][ y ]; + + if ( m.vp->x + x == m.playhead ) + c.flags |= F_PLAYHEAD; + + gui_draw_shape( m.origin_x + m.margin_left + x * m.div_w, m.origin_y + m.margin_top + y * m.div_h, m.div_w, m.div_h, + shape, c.state, c.flags, c.color ); + } +} + +/** convert pixel coords into grid coords. returns true if valid */ +bool +Canvas::grid_pos ( int *x, int *y ) const +{ + *y = (*y - m.margin_top - m.origin_y) / m.div_h; + *x = (*x - m.margin_left - m.origin_x) / m.div_w; + + if ( *x < 0 || *y < 0 || *x >= m.vp->w || *y >= m.vp->h ) + return false; + + /* adjust for viewport */ + *x += m.vp->x; + *y += m.vp->y; + + /* adjust for row-compaction */ + *y = rtn( *y ); + + return true; +} + + + +/******************/ +/* Input handlers */ +/******************/ + +/* These methods translate viewport pixel coords to absolute grid + coords and pass on to the grid. */ + +/** if coords correspond to a row name entry, return the (absolute) note number, otherwise return -1 */ +int +Canvas::is_row_name ( int x, int y ) +{ + if ( x - m.origin_x >= m.margin_left ) + return -1; + + x = m.margin_left; + + grid_pos( &x, &y ); + + return m.grid->y_to_note( y ); +} + +void +Canvas::start_cursor ( int x, int y ) +{ + if ( ! grid_pos( &x, &y ) ) + return; + + m.ruler_drawn = false; + + m.p1 = x; + m.p3 = ntr( y ); + + _lr(); + + signal_draw(); +} + +void +Canvas::end_cursor ( int x, int y ) +{ + if ( ! grid_pos( &x, &y ) ) + return; + + m.ruler_drawn = false; + + m.p2 = x; + m.p4 = ntr( y ); + + _lr(); + + signal_draw(); +} + +void +Canvas::set ( int x, int y ) +{ + if ( y - m.origin_y < m.margin_top ) + /* looks like a click on the ruler */ + { + if ( x - m.margin_left - m.origin_x >= 0 ) + { + m.p1 = m.vp->x + ((x - m.margin_left - m.origin_x) / m.div_w); + m.ruler_drawn = false; + + m.p3 = m.p4 = 0; + } + + _lr(); + + signal_draw(); + + return; + } + + if ( ! grid_pos( &x, &y ) ) + return; + + m.grid->put( x, y, 0 ); +} + +void +Canvas::unset ( int x, int y ) +{ + if ( y - m.origin_y < m.margin_top ) + /* looks like a click on the ruler */ + { + if ( x - m.margin_left - m.origin_x >= 0 ) + { + m.p2 = m.vp->x + ((x - m.margin_left - m.origin_x) / m.div_w); + m.ruler_drawn = false; + + m.p3 = m.p4 = 0; + } + + _lr(); + + signal_draw(); + + return; + } + + if ( ! grid_pos( &x, &y ) ) + return; + + m.grid->del( x, y ); +} + +void +Canvas::adj_color ( int x, int y, int n ) +{ + if ( ! grid_pos( &x, &y ) ) + return; + + m.grid->adj_velocity( x, y, n ); +} + +void +Canvas::adj_length ( int x, int y, int n ) +{ + if ( ! grid_pos( &x, &y ) ) + return; + + m.grid->adj_duration( x, y, n ); +} + +void +Canvas::select ( int x, int y ) +{ + if ( ! grid_pos( &x, &y ) ) + return; + + m.grid->toggle_select( x, y ); +} + +void +Canvas::move_selected ( int dir, int n ) +{ + switch ( dir ) + { + case RIGHT: + m.grid->move_selected( n ); + break; + case LEFT: + m.grid->move_selected( 0 - n ); + break; + case UP: + case DOWN: + { + /* row-compaction makes this a little complicated */ + event_list *el = m.grid->events(); + + /* FIXME: don't allow movement beyond the edges! */ + +/* int hi, lo; */ + +/* m.grid->selected_hi_lo_note( &hi, &lo ); */ + +/* hi = ntr( hi ) > 0 ? ntr( hi ) : */ + +/* if ( m.grid->y_to_note( ntr( hi ) ) ) */ + + + if ( dir == UP ) + for ( int y = 0; y <= m.maxh; ++y ) + el->rewrite_selected( m.grid->y_to_note( rtn( y ) ), m.grid->y_to_note( rtn( y - n ) ) ); + else + for ( int y = m.maxh; y >= 0; --y ) + el->rewrite_selected( m.grid->y_to_note( rtn( y ) ), m.grid->y_to_note( rtn( y + n ) ) ); + + m.grid->events( el ); + + delete el; + break; + } + } +} + +void +Canvas::randomize_row ( int y ) +{ + int x = m.margin_left; + + if ( ! grid_pos( &x, &y ) ) + return; + + ((pattern*)m.grid)->randomize_row( y, song.random.feel, song.random.probability ); +} + +void +Canvas::_lr ( void ) +{ + int l, r; + + if ( m.p2 > m.p1 ) + { + l = m.p1; + r = m.p2; + } + else + { + l = m.p2; + r = m.p1; + } + + m.p1 = l; + m.p2 = r; +} + +void +Canvas::select_range ( void ) +{ + if ( m.p3 == m.p4 ) + m.grid->select( m.p1, m.p2 ); + else + m.grid->select( m.p1, m.p2, rtn( m.p3 ), rtn( m.p4 ) ); +} + +void +Canvas::invert_selection ( void ) +{ + m.grid->invert_selection(); +} + +void +Canvas::crop ( void ) +{ + if ( m.p3 == m.p4 ) + m.grid->crop( m.p1, m.p2 ); + else + m.grid->crop( m.p1, m.p2, rtn( m.p3 ), rtn( m.p4 ) ); + + m.vp->x = 0; + + m.p2 = m.p2 - m.p1; + m.p1 = 0; + + m.ruler_drawn = false; +} + +void +Canvas::delete_time ( void ) +{ + m.grid->delete_time( m.p1, m.p2 ); +} + + +void +Canvas::insert_time ( void ) +{ + m.grid->insert_time( m.p1, m.p2 ); +} + +/** paste range as new grid */ +void +Canvas::duplicate_range ( void ) +{ + Grid *g = m.grid->clone(); + + g->crop( m.p1, m.p2 ); + g->viewport.x = 0; +} + +void +Canvas::row_compact ( int n ) +{ + switch ( n ) + { + case OFF: + m.row_compact = false; + m.maxh = 128; + break; + case ON: + m.row_compact = true; + m.vp->y = 0; + _update_row_mapping(); + break; + case TOGGLE: + row_compact( m.row_compact ? OFF : ON ); + break; + } + _reset(); + m.mapping_drawn = false; +} + +void +Canvas::pan ( int dir, int n ) +{ + + switch ( dir ) + { + case LEFT: case RIGHT: case TO_PLAYHEAD: case TO_NEXT_NOTE: case TO_PREV_NOTE: + /* handle horizontal movement specially */ + n *= m.grid->division(); + m.ruler_drawn = false; + break; + default: + n *= 5; + m.mapping_drawn = false; + break; + } + + switch ( dir ) + { + case LEFT: + m.vp->x = max( m.vp->x - n, 0 ); + break; + case RIGHT: + m.vp->x += n; + break; + case TO_PLAYHEAD: + m.vp->x = m.playhead - (m.playhead % m.grid->division()); + break; + case UP: + m.vp->y = max( m.vp->y - n, 0 ); + break; + case DOWN: + m.vp->y = min( m.vp->y + n, m.maxh - m.vp->h ); + break; + case TO_NEXT_NOTE: + { + int x = m.grid->next_note_x( m.vp->x ); + m.vp->x = x - (x % m.grid->division() ); + break; + } + case TO_PREV_NOTE: + { + int x = m.grid->prev_note_x( m.vp->x ); + m.vp->x = x - (x % m.grid->division() ); + break; + } + } + + signal_draw(); + signal_pan(); +} + +void +Canvas::can_scroll ( int *left, int *right, int *up, int *down ) +{ + *left = m.vp->x; + *right = -1; + *up = m.vp->y; + *down = m.maxh - ( m.vp->y + m.vp->h ); +} + + +/** adjust horizontal zoom (* n) */ +void +Canvas::h_zoom ( float n ) +{ + m.vp->w = max( 32, min( (int)(m.vp->w * n), 256 ) ); + + resize_grid(); + + song.set_dirty(); +} + +void +Canvas::v_zoom_fit ( void ) +{ + if ( ! m.grid ) + return; + + changed_mapping(); + + m.vp->h = m.maxh; + m.vp->y = 0; + + resize_grid(); + + song.set_dirty(); + +} + +/** adjust vertical zoom (* n) */ +void +Canvas::v_zoom ( float n ) +{ + m.vp->h = max( 1, min( (int)(m.vp->h * n), m.maxh ) ); + + resize_grid(); + + song.set_dirty(); +} + +void +Canvas::notes ( char *s ) +{ + m.grid->notes( s ); +} + +char * +Canvas::notes ( void ) +{ + return m.grid->notes(); +} diff --git a/sequencer/src/canvas.H b/sequencer/src/canvas.H new file mode 100644 index 0000000..39b16c5 --- /dev/null +++ b/sequencer/src/canvas.H @@ -0,0 +1,180 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include "grid.H" +#include "gui/draw.H" + +#include +using namespace sigc; + +class Mapping; + +struct cell_t { + unsigned char color : 8; + unsigned char state : 4; + unsigned char flags : 4; + + bool + operator!= ( const cell_t &rhs ) + { + return color != rhs.color || state != rhs.state || flags != rhs.flags; + } +}; + +enum { LEFT, RIGHT, UP, DOWN, TO_PLAYHEAD, TO_NEXT_NOTE, TO_PREV_NOTE }; + + +class Canvas : public trackable +{ + + struct { + int origin_x, origin_y; + int width, height; + + int margin_left, margin_top; + int div_w, div_h; + + int old_div_w, old_div_h; + + int maxh; + + bool ruler_drawn; + bool mapping_drawn; + + bool grid_drawn; + + int playhead; /* where the playhead is for this canvas. only used for display. */ + + enum { PATTERN, SEQUENCE } mode; + + Grid *grid; /* grid currently connected to this canvas */ + + size_t size; + cell_t **current, **previous; + + bool draw; /* really drawing, or just checking size? */ + + int rule; + + bool row_compact; /* use row-compaction? */ + + /* tables used for row-compaction */ + int rtn[128]; /* row-to-note */ + int ntr[128]; /* note-to-row */ + + int shape; + + Viewport *vp; + int w, h; + + uint p1, p2; /* range cursors */ + uint p3, p4; /* row cursors */ + } m; + + int rtn ( int r ) const; + int ntr ( int n ) const; + + void _update_row_mapping ( void ); + cell_t ** _alloc_array ( void ); + + void redraw_ruler ( void ); + void redraw_mapping ( void ); + void draw_mapping ( void ); + void draw_ruler ( void ); + + void _reset ( void ); + void _lr ( void ); + + bool viewable_x ( int x ); + void draw_line ( int x, int flags ); + + void update_mapping ( void ); + +public: + + enum { OFF, ON, TOGGLE }; + + signal signal_settings_change; + signal signal_draw; + signal signal_resize; + signal signal_pan; + + Canvas ( ); + + void handle_event_change ( void ); + void set ( int x, int y ); + void grid ( Grid *g ); + void changed_mapping ( void ); + Grid * grid ( void ); + void resize ( void ); + void resize_grid ( void ); + void resize ( int x, int y, int w, int h ); + void copy ( void ); + void clear ( void ); + void flip ( void ); + void draw_row_name ( int y, const char *name, int color ); + void draw_shape ( int x, int y, int shape, int state, int color, bool selected ); + void draw_dash ( int x, int y, int l, int shape, int color, bool selected ); + int draw_playhead ( void ); + void draw ( void ); + void redraw ( void ); + bool grid_pos ( int *x, int *y ) const; + int is_row_name ( int x, int y ); + void unset ( int x, int y ); + void adj_color ( int x, int y, int n ); + void adj_length ( int x, int y, int n ); + void select ( int x, int y ); + void select_range ( void ); + void invert_selection ( void ); + void duplicate_range ( void ); + void crop ( void ); + void row_compact ( int n ); + void pan ( int dir, int n ); + void can_scroll ( int *left, int *right, int *up, int *down ); + void h_zoom ( float n ); + void v_zoom ( float n ); + void v_zoom_fit ( void ); + void notes ( char *s ); + char * notes ( void ); + void randomize_row ( int y ); + int playhead_moved ( void ); + + void start_cursor ( int x, int y ); + void end_cursor ( int x, int y ); + + void delete_time ( void ); + void insert_time ( void ); + + void move_selected ( int dir, int n ); + +}; + +inline int +Canvas::rtn ( int r ) const +{ + return m.row_compact ? m.rtn[ r ] : r; +} + +inline int +Canvas::ntr ( int n ) const +{ + return m.row_compact ? m.ntr[ n ] : n; +} diff --git a/FL/color_scheme.H b/sequencer/src/common.h similarity index 76% rename from FL/color_scheme.H rename to sequencer/src/common.h index f3fa636..7c179a8 100644 --- a/FL/color_scheme.H +++ b/sequencer/src/common.h @@ -1,6 +1,7 @@ + /*******************************************************************************/ -/* Copyright (C) 2010 Jonathan Moore Liles */ +/* Copyright (C) 2007,2008 Jonathan Moore Liles */ /* */ /* This program is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU General Public License as published by the */ @@ -17,5 +18,21 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*******************************************************************************/ -void color_scheme ( const char *name ); -void get_system_colors ( void ); +// #pragma once + +typedef unsigned char byte_t; +typedef double tick_t; +typedef unsigned int uint; + + +/* #define min(x,y) ((x) < (y) ? (x) : (y)) */ +/* #define max(x,y) ((x) > (y) ? (x) : (y)) */ + +#include +using namespace std; + +#define elementsof(x) (sizeof((x)) / sizeof((x)[0])) + +#include "config.h" +#include "const.h" +#include "debug.h" diff --git a/sequencer/src/config.h b/sequencer/src/config.h new file mode 100644 index 0000000..853ca18 --- /dev/null +++ b/sequencer/src/config.h @@ -0,0 +1,3 @@ + + +// #define INSTALL_PREFIX "/usr/local/" diff --git a/sequencer/src/const.h b/sequencer/src/const.h new file mode 100644 index 0000000..31d27e1 --- /dev/null +++ b/sequencer/src/const.h @@ -0,0 +1,41 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007,2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +/* getting around this will require bank switching etc, and + before that happens I'd like to see a song with 128 phrases in it. */ +const int MAX_PHRASE = 128; +const int MAX_PATTERN = 128; + +const unsigned int PPQN = 480; + +/* interval between GUI updates for playhead movement, etc. */ +const double TRANSPORT_POLL_INTERVAL = 0.05; + +const char APP_NAME[] = "Non-Sequencer"; +const char APP_TITLE[] = "The Non-Sequencer"; +const char COPYRIGHT[] = "Copyright (c) 2007-2012 Jonathan Moore Liles"; + +#define PACKAGE "non-sequencer" + +/* directories */ + +#define USER_CONFIG_DIR ".non/" +#define INSTRUMENT_DIR "instruments/" diff --git a/sequencer/src/dash.H b/sequencer/src/dash.H new file mode 100644 index 0000000..29ae679 --- /dev/null +++ b/sequencer/src/dash.H @@ -0,0 +1,10 @@ + +#pragma once + +struct dash +{ + tick_t timestamp; + tick_t length; + unsigned char color; +}; + diff --git a/sequencer/src/debug.C b/sequencer/src/debug.C new file mode 100644 index 0000000..d3444eb --- /dev/null +++ b/sequencer/src/debug.C @@ -0,0 +1,62 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "debug.h" + +void +warnf ( warning_t level, + const char *module, + const char *file, + const char *function, size_t line, const char *fmt, ... ) +{ + va_list args; + static const char *level_tab[] = { + "message", "\033[1;32m", + "warning", "\033[1;33m", + "assertion", "\033[1;31m" + }; + + FILE *fp = W_MESSAGE == level ? stdout : stderr; + + if ( module ) + fprintf( fp, "[%s] ", module ); +#ifndef NDEBUG + if ( file ) + fprintf( fp, "%s", file ); + if ( line ) + fprintf( fp, ":%i", line ); + if ( function ) + fprintf( fp, " %s()", function ); + + fprintf( fp, ": " ); +#endif + + if ( unsigned( ( level << 1 ) + 1 ) < + ( sizeof( level_tab ) / sizeof( level_tab[0] ) ) ) + fprintf( fp, "%s", level_tab[( level << 1 ) + 1] ); + + if ( fmt ) + { + va_start( args, fmt ); + vfprintf( fp, fmt, args ); + va_end( args ); + } + + fprintf( fp, "\033[0m\n" ); +} diff --git a/sequencer/src/debug.h b/sequencer/src/debug.h new file mode 100644 index 0000000..126d6fc --- /dev/null +++ b/sequencer/src/debug.h @@ -0,0 +1,116 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +/* debug.h + * + * 11/21/2003 - Jonathan Moore Liles + * + * Debuging support. + * + * Disable by defining the preprocessor variable NDEBUG prior to inclusion. + * + * The following macros sould be defined as string literals + * + * name value + * + * __MODULE__ Name of module. eg. "libfoo" + * + * __FILE__ Name of file. eg. "foo.c" + * + * __FUNCTION__ Name of enclosing function. eg. "bar" + * + * (inteter literal) + * __LINE__ Number of enclosing line. + * + * + * __FILE__, and __LINE__ are automatically defined by standard CPP + * implementations. __FUNCTION__ is more or less unique to GNU, and isn't + * strictly a preprocessor macro, but rather a reserved word in the compiler. + * There is a sed script available with this toolset that is able to fake + * __FUNCTION__ (among other things) with an extra preprocesessing step. + * + * __MODULE__ is nonstandard and should be defined the enclosing program(s). + * Autoconf defines PACKAGE as the module name, and these routines will use its + * value instead if __MODULE__ is undefined. + * + * The following routines are provided (as macros) and take the same arguments + * as printf(): + * + * MESSAGE( const char *format, ... ) + * WARNING( const char *format, ... ) + * ASSERTION( const char *format, ... ) + * + * Calling MESSAGE or WARNING prints the message to stderr along with module, + * file and line information, as well as appropriate emphasis. Calling + * ASSERTION will do the same, and then call abort() to end the program. It is + * unwise to supply any of these marcros with arguments that produce side + * effects. As, doing so will most likely result in Heisenbugs; program + * behavior that changes when debugging is disabled. + * + */ + + +#ifndef _DEBUG_H +#define _DEBUG_H + +#ifndef __MODULE__ +#ifdef PACKAGE +#define __MODULE__ PACKAGE +#else +#define __MODULE__ NULL +#endif +#endif + +#ifndef __GNUC__ + #define __FUNCTION__ NULL +#endif + +#include +#include +#include + +typedef enum { + W_MESSAGE = 0, + W_WARNING, + W_ASSERTION +} warning_t; + +void +warnf ( warning_t level, + const char *module, + const char *file, + const char *function, size_t line, const char *fmt, ... ); + + +#ifndef NDEBUG +#define DMESSAGE( fmt, args... ) warnf( W_MESSAGE, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args ) +#define DWARNING( fmt, args... ) warnf( W_WARNING, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args ) +#define ASSERT( pred, fmt, args... ) do { if ( ! (pred) ) { warnf( W_ASSERTION, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args ); abort(); } } while ( 0 ) +#else +#define DMESSAGE( fmt, args... ) +#define DWARNING( fmt, args... ) +#define ASSERT( pred, fmt, args... ) +#endif + +/* these are always defined */ +#define MESSAGE( fmt, args... ) warnf( W_MESSAGE, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args ) +#define WARNING( fmt, args... ) warnf( W_WARNING, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args ) +#define ASSERTION( fmt, args... ) ( warnf( W_ASSERTION, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args ), abort() ) + +#endif diff --git a/sequencer/src/event.C b/sequencer/src/event.C new file mode 100644 index 0000000..335c4d2 --- /dev/null +++ b/sequencer/src/event.C @@ -0,0 +1,144 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +/* Higher level event interface, supporting doublely-linked list, + marking, selection, and linking of note pairs. */ + +#include "event.H" +#include +#include + +void +event::_init ( void ) +{ + _link = _next = _prev = NULL; + _selected = 0; +} + +event::event ( void ) +{ + _init(); +} + +event::~event ( void ) +{ + _link = _next = _prev = NULL; +} + +/* copy constructor */ +event::event ( const event &e ) : midievent( e ) +{ + _link = _next = _prev = NULL; + _selected = e._selected; +} + +event::event ( const midievent &e ) : midievent( e ) +{ + _init(); +} + + +void +event::link ( event *event ) +{ + if ( event == NULL ) + { + if ( _link ) + { + _link->_link = NULL; + _link = NULL; + } + return; + } + + _link = event; + _link->_link = this; +} + +event * +event::link ( void ) const +{ + return _link; +} + +bool +event::linked ( void ) const +{ + return _link != NULL; +} + +void +event::select ( void ) +{ + _selected = 1; + + if ( _link ) + _link->_selected = 1; +} + +void +event::deselect ( void ) +{ + _selected = 0; + + if ( _link ) + _link->_selected = 0; +} + +bool +event::selected ( int n ) const +{ + return _selected == n; +} + +bool +event::selected ( void ) const +{ + return _selected == 1; +} + +/* override this so we can update linked event */ +void +event::note ( char note ) +{ + midievent::note( note ); + + if ( _link ) + _link->midievent::note( note ); +} + +/* stupid C++ makes us override the all polymorphic functions... */ +unsigned char +event::note ( void ) const +{ + return midievent::note(); +} + +tick_t +event::note_duration ( void ) const +{ + return _link ? _link->timestamp() - timestamp() : 0; +} + +void +event::note_duration ( tick_t l ) +{ + if ( _link ) + _link->timestamp( timestamp() + l ); +} diff --git a/sequencer/src/event.H b/sequencer/src/event.H new file mode 100644 index 0000000..1c7580a --- /dev/null +++ b/sequencer/src/event.H @@ -0,0 +1,83 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include "common.h" +#include "midievent.H" + +#include + +class event_list; + +class event : public midievent +{ + +protected: + + /* these are only to be used by event_list class! */ + event *_next; + event *_prev; + +private: + + event *_link; /* other event in pair */ + + byte_t _selected; + + void _init ( void ); + +public: + + event(); + ~event(); + event ( const event &e ); + event ( const midievent &e ); + + event * next ( void ) const; + event * prev ( void ) const; + + void link ( event *event ); + event * link ( void ) const; + bool linked ( void ) const; + void select ( void ); + void deselect ( void ); + bool selected ( int n ) const; + bool selected ( void ) const; + void note ( char note ); + unsigned char note ( void ) const; + tick_t note_duration ( void ) const; + void note_duration ( tick_t l ); + + + friend class event_list; + +}; + +inline event * +event::next ( void ) const +{ + return _next; +} + +inline event * +event::prev ( void ) const +{ + return _prev; +} diff --git a/sequencer/src/event_list.C b/sequencer/src/event_list.C new file mode 100644 index 0000000..c717184 --- /dev/null +++ b/sequencer/src/event_list.C @@ -0,0 +1,627 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "event_list.H" + +/* The operations we perform on event lists are clumsy with STL lists + and iterators so we have a custom doubly-linked list implementation + here for complete control */ + +#define RFOR_ALL( it ) for ( event *next, * it = _tail; it && ((next = it ->_prev), true) ; it = next ) +#define FOR_ALL( it ) for ( event *next, * it = _head; it && ((next = it ->_next), true) ; it = next ) +// #define FOR_ALL( e ) for ( event * e = _head; e; e = e ->_next ) +#define FOR_SELECTED( e ) FOR_ALL( e ) if ( e ->selected() ) +#define RFOR_SELECTED( e ) RFOR_ALL( e ) if ( e ->selected() ) + + +event_list::event_list ( void ) +{ + _head = NULL; + _tail = NULL; + _size = 0; +} + +event_list::~event_list ( void ) +{ + clear(); +} + +/* copy constructor */ +event_list::event_list ( const event_list &el ) +{ + _copy( &el ); +} + +event_list & +event_list::operator= ( const event_list &rhs ) +{ + if ( this != &rhs ) + { + clear(); + + _copy( &rhs ); + } + + return *this; +} + +event_list & +event_list::operator= ( const list &rhs ) +{ + clear(); + + for ( list ::const_iterator me = rhs.begin(); me != rhs.end(); me++ ) + { + event *e = new event( *me ); + + _insert( NULL, e ); + } + + relink(); + + return *this; +} + +/** allow indexing */ +event * +event_list::operator[] ( unsigned int index ) +{ + unsigned int i = 0; + for ( event *e = _head; e; (e = e->_next), ++i ) + if ( i == index ) + return e; + + // all else fails. + return _tail; +} + +void +event_list::_copy ( const event_list *el ) +{ + if ( ! el->_head ) + { + _head = _tail = NULL; + _size = 0; + return; + } + + _head = new event( *(el->_head) ); + _head->_prev = NULL; + + event *p = _head; + + for ( event *e = el->_head->_next; e; e = e->_next ) + { + event *n = new event( *e ); + + n->_next = NULL; + p->_next = n; + n->_prev = p; + + p = n; + } + + _tail = p; + + _size = el->_size; + + relink(); +} + +/** insert event /n/ before event /o/ */ +void +event_list::_insert ( event *o, event *n ) +{ + ++_size; + + if ( ! o ) + { + n->_next = NULL; + n->_prev = _tail; + + if ( _tail ) + _tail->_next = n; + + _tail = n; + if ( ! _head ) + _head = n; + return; + } + + event *t = o->_prev; + + o->_prev = n; + n->_next = o; + n->_prev = t; + + if ( ! t ) + _head = n; + else + t->_next = n; +} + +void +event_list::unlink ( event *e ) +{ + if ( e->_next ) + e->_next->_prev = e->_prev; + else + _tail = e->_prev; + + if ( e->_prev ) + e->_prev->_next = e->_next; + else + _head = e->_next; + + --_size; +} + + + +void +event_list::clear ( void ) +{ + for ( event *e = _head; e ; ) + { + event *n = e->_next; + delete e; + e = n; + } + + _head = NULL; + _tail = NULL; + _size = 0; +} + +void +event_list::mix ( event *ne ) +{ + FOR_ALL( e ) + if ( *e == *ne ) + { + /* already have an event like this, drop it */ + + if ( ne->linked() ) + delete ne->link(); + + delete ne; + + return; + } + + insert( ne ); + if ( ne->linked() ) + insert( ne->link() ); + +} + +/** remove elements from list /el/ to this list */ +void +event_list::merge ( event_list *el ) +{ + event *n; + for ( event *e = el->_head; e; e = n ) + { + n = e->_next; + + el->unlink( e ); + + insert( e ); + } +} + +/** unlink event e */ +void +event_list::remove ( event *e ) +{ + unlink( e ); + delete e; +} + +/** sorted insert /e/ */ +void +event_list::insert ( event *e ) +{ + /* find the place to insert */ + RFOR_ALL( i ) + if ( *e >= *i ) + { + _insert( i->_next, e ); + return; + } + + _insert( _head, e ); +} + +/** just append event without sorting */ +void +event_list::append ( event *e ) +{ + _insert( NULL, e ); +} + +event * +event_list::first ( void ) const +{ + return _head; +} + +event * +event_list::last ( void ) const +{ + return _tail; +} + + + +/*************/ +/* Selection */ +/*************/ + +/** select all events from /start/ to /end/ inclusive */ +void +event_list::select ( tick_t start, tick_t end ) +{ + FOR_ALL( e ) + { + tick_t ts = e->timestamp(); + + /* don't count note offs exactly on start */ + if ( ts == start && e->is_note_off() ) + continue; + + if ( ts >= start && ts < end ) + e->select(); + } +} + +/** select note evenets from /start/ to /end/ within range /hi/ through /lo/ */ +void +event_list::select ( tick_t start, tick_t end, int hi, int lo ) +{ + FOR_ALL( e ) + { + tick_t ts = e->timestamp(); + + /* don't count note offs exactly on start */ + if ( ! e->is_note_on() ) + continue; + + if ( ts >= start && ts < end && + e->note() <= hi && e->note() >= lo ) + e->select(); + } +} + +/** select ALL events */ +void +event_list::select_all ( void ) +{ + FOR_ALL( e ) + e->select(); +} + +void +event_list::select_none ( void ) +{ + FOR_ALL( e ) + e->deselect(); +} + +void +event_list::invert_selection ( void ) +{ + FOR_ALL( e ) + if ( ! e->is_note_off() ) + { + if ( e->selected() ) + e->deselect(); + else + e->select(); + } +} + +/** remove all selected events */ +void +event_list::remove_selected ( void ) +{ + FOR_SELECTED( e ) + { + remove( e ); + } +} + +/** transpose selected notes (ignoring other event types) by /n/ tones + * (may span octaves) */ +void +event_list::transpose_selected ( int n ) +{ + FOR_SELECTED( e ) + { + if ( e->is_note_on() ) + e->note( e->note() + n ); + } + +} + +/** change all notes of value /from/ to /to/ */ +void +event_list::rewrite_selected ( int from, int to ) +{ + FOR_SELECTED( e ) + { + if ( e->is_note_on() && e->note() == from ) + e->note( to ); + } +} + + +/** get timestamp of earliest selected event */ +tick_t +event_list::selection_min ( void ) +{ + FOR_SELECTED( e ) + return e->timestamp(); + + return 0; +} + +tick_t +event_list::selection_max ( void ) +{ + RFOR_SELECTED( e ) + return e->timestamp(); + + return 0; +} + +/** move selected events by offset /o/ */ +void +event_list::move_selected ( long o ) +{ + if ( o < 0 ) + if ( selection_min() < (tick_t)( 0 - o ) ) + return; + + if ( o < 0 ) + { + FOR_SELECTED( e ) + move( e, o ); + } + else + { + RFOR_SELECTED( e ) + move( e, o ); + } +} + +void +event_list::push_selection ( void ) +{ + FOR_ALL( e ) + if ( e->_selected ) + ++e->_selected; +} + +void +event_list::pop_selection ( void ) +{ + FOR_ALL( e ) + if ( e->_selected ) + --e->_selected; +} + + + +/** verify that all note ons are linked to note offs */ +bool +event_list::verify ( void ) const +{ + FOR_ALL( e ) + if ( e->is_note_on() && ! e->linked() ) + return false; + + return true; +} + +/** link /e/ (a note on) with the next corresponding note off */ +void +event_list::link ( event *on ) +{ + if ( ! on->is_note_on() ) + return; + + for ( event *off = on->_next; off; off = off->_next ) + { + if ( off->linked() ) + continue; + + if ( off->is_note_off() && + off->channel() == on->channel() && + off->note() == on->note() ) + { + on->link( off ); + return; + } + } + + WARNING( "no corresponding note_off found for note on, repairing" ); + + event *off = new event( *on ); + + off->opcode( event::NOTE_OFF ); + + on->link( off ); + + insert( off ); +} + +/** insert /l/ ticks of time at /start/ */ +void +event_list::insert_time ( tick_t start, tick_t l ) +{ + FOR_ALL( e ) + { + tick_t ts = e->timestamp(); + + if ( e->is_note_off() ) + continue; + + if ( ts >= start ) + { + if ( e->is_note_on() ) + { + /* only notes ENTIRELY WITHIN the range will be moved */ + e->timestamp( ts + l ); + e->link()->timestamp( e->link()->timestamp() + l ); + } + else + e->timestamp( e->timestamp() + l ); + } + } + + sort(); +} + +/** delete events in range and close the gap */ +void +event_list::delete_time ( tick_t start, tick_t end ) +{ + tick_t l = end - start; + + push_selection(); + + select( start, end ); + + remove_selected(); + + pop_selection(); + + /* cut out the slack */ + FOR_ALL( e ) + { + tick_t ts = e->timestamp(); + + if ( ts >= end ) + e->timestamp( ts - l ); + } +} + +/** link all note ons to subsequent note offs */ +void +event_list::relink ( void ) +{ + /* clear links */ + FOR_ALL( e ) + e->link( NULL ); + + /* link */ + FOR_ALL( on ) + link( on ); + + if ( ! verify() ) + ASSERTION( "event list failed verification" ); +} + +/** resort event /e/ */ +void +event_list::sort ( event *e ) +{ + unlink( e ); + + insert( e ); +} + +/** resort entire list */ +void +event_list::sort ( void ) +{ + event_list *temp = new event_list( ); + + _head = temp->_head; + _tail = temp->_tail; + + FOR_ALL( n ) + temp->insert( n ); + + temp->_head = NULL; + + delete temp; + + relink(); +} + +/** move event /e/ by /o/ ticks */ +void +event_list::move ( event *e, long o ) +{ + e->timestamp( e->timestamp() + o ); + + sort( e ); +} + +bool +event_list::empty ( void ) const +{ + return _head == NULL; +} + +size_t +event_list::size ( void ) const +{ + return _size; +} + +void +event_list::_hi_lo ( bool sel, int *hi, int *lo ) const +{ + *hi = 0; + *lo = 127; + + FOR_ALL( e ) + { + if ( sel && ! e->selected() ) + continue; + + if ( ! e->is_note_on() ) + continue; + + int n = e->note(); + + if ( n > *hi ) + *hi = n; + + if ( n < *lo ) + *lo = n; + } +} + +/** set /hi/ and /lo/ to the lowest and highest pitched note events in + * this list, respectively */ +void +event_list::hi_lo_note ( int *hi, int *lo ) const +{ + _hi_lo( false, hi, lo ); +} + +void +event_list::selected_hi_lo_note ( int *hi, int *lo ) const +{ + _hi_lo( true, hi, lo ); +} diff --git a/sequencer/src/event_list.H b/sequencer/src/event_list.H new file mode 100644 index 0000000..a4a9305 --- /dev/null +++ b/sequencer/src/event_list.H @@ -0,0 +1,89 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include "event.H" + +#include +using std::list; + +class midievent; + +class event_list { + + event * _head; + event * _tail; + + size_t _size; + + void _insert ( event *o, event *n ); + void _copy ( const event_list *el ); + void _hi_lo ( bool sel, int *hi, int *lo ) const; + +public: + + event_list ( void ); + ~event_list ( void ); + event_list ( const event_list &el ); + + void clear ( void ); + void merge ( event_list *el ); + void unlink ( event *e ); + void remove ( event *e ); + void insert ( event *e ); + event * first ( void ) const; + event * last ( void ) const; + void select ( tick_t start, tick_t end ); + void select ( tick_t start, tick_t end, int hi, int lo ); + + void select_all ( void ); + void select_none ( void ); + void invert_selection ( void ); + + void remove_selected ( void ); + void transpose_selected ( int n ); + tick_t selection_min ( void ); + tick_t selection_max ( void ); + void move_selected ( long o ); + void push_selection ( void ); + void pop_selection ( void ); + bool verify ( void ) const; + void link ( event *on ); + void insert_time ( tick_t start, tick_t l ); + void delete_time ( tick_t start, tick_t end ); + void relink ( void ); + void sort ( event *e ); + void sort ( void ); + void move ( event *e, long o ); + bool empty ( void ) const; + size_t size ( void ) const; + void append ( event *e ); + void mix ( event *ne ); + void hi_lo_note ( int *hi, int *lo ) const; + void rewrite_selected ( int from, int to ); + void selected_hi_lo_note ( int *hi, int *lo ) const; + + + event_list & operator= ( const event_list &rhs ); + event_list & operator= ( const list &rhs ); + event *operator[] ( unsigned int index ); + + // friend class event; +}; diff --git a/sequencer/src/grid.C b/sequencer/src/grid.C new file mode 100644 index 0000000..3087c7f --- /dev/null +++ b/sequencer/src/grid.C @@ -0,0 +1,855 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "grid.H" +#include "common.h" +#include "canvas.H" + +#include "non.H" + +#include "smf.H" + +Grid::Grid ( void ) +{ + _name = NULL; + _notes = NULL; + _number = 0; + _height = 0; + + _rd = new data; + _rw = NULL; + + // we need to initialize it here. + data *d = (data *)_rd; + + _mode = 0; + _locked = 0; + + d->length = 0; + + _bpb = 4; + _ppqn = 1; + + viewport.h = 32; + viewport.w = 32; + viewport.x = 0; + viewport.y = 0; + + _playing = false; + _suspend_update = false; + _start = _end = _index = 0; +} + +Grid::~Grid ( void ) +{ + DMESSAGE( "deleting grid" ); + + if ( _name ) + free( _name ); + if ( _notes ) + free( _notes ); + + if ( _rw ) + delete _rw; + if ( _rd ) + delete _rd; + +} + +/* copy constructor */ +Grid::Grid ( const Grid &rhs ) : sigc::trackable() +{ + _rd = new data( *rhs._rd ); + _rw = NULL; + + _name = rhs._name ? strdup( rhs._name ) : NULL; + _notes = rhs._notes ? strdup( rhs._notes ) : NULL; + _number = rhs._number; + _height = rhs._height; + + _mode = 0; + _locked = 0; + _playing = false; + _index = 0; + _start = 0; + _end = 0; + + _bpb = rhs._bpb; + _ppqn = rhs._ppqn; + + viewport = rhs.viewport; +} + +void +Grid::lock ( void ) +{ + if ( ! _locked++ ) + _rw = new data( *_rd ); +} + +void +Grid::unlock ( void ) +{ + if ( 0 == --_locked ) + { + _history.push_back( const_cast( _rd ) ); + + if ( _history.size() > MAX_UNDO + 1 ) + { + data *d = _history.front(); + + delete d; + + _history.pop_front(); + } + + // swap the copy back in (atomically). + _rd = (const data *)_rw; + + _rw = NULL; + + if ( ! _suspend_update ) + signal_events_change(); + } +} + +event * +Grid::_event ( int x, int y, bool write ) const +{ + const data *d = const_cast< data * >(_rd); + + const event_list *r = write ? &_rw->events : &d->events; + + if ( r->empty() || x_to_ts( x ) > _rd->length ) + return NULL; + + int note = y_to_note( y ); + tick_t xt = x_to_ts( x ); + + for ( event *e = r->first(); e; e = e->next() ) + { + if ( ! e->is_note_on() ) + continue; + + if ( e->note() != note ) + continue; + + unsigned long ts = e->timestamp(); + unsigned long l = 0; + + if ( e->linked() ) + l = e->link()->timestamp() - ts; + else + WARNING( "found unlinked event... event list is corrupt." ); + + if ( xt >= ts && xt < ts + l ) + // this is a little nasty + return const_cast(e); + } + + return NULL; +} + +bool +Grid::_delete ( int x, int y ) +{ + event *e = _event ( x, y, true ); + + if ( e ) + { + if ( e->linked() ) + _rw->events.remove( e->link() ); + + _rw->events.remove( e ); + + return true; + } + + return false; +} + +bool +Grid::_get ( struct dash *d, int x, int y ) const +{ + event *e = _event ( x, y, false ); + + if ( e ) + { + tick_t ts = e->timestamp(); + tick_t l = 0; + + if ( e->linked() ) + l = e->link()->timestamp() - ts; + else + WARNING( "Found unlinked note on" ); + + d->timestamp = ts_to_x( ts ); + d->length = ts_to_x( l ); + d->color = e->note_velocity(); + return true; + } + + return false; +} + + +void +Grid::clear ( void ) +{ + lock(); + + _rw->events.clear(); + + unlock(); +} + + +int +Grid::get ( struct dash *d, int x, int y ) const +{ + return _get( d, x, y ); +} + +void +Grid::del ( int x, int y ) +{ + lock(); + + _delete( x, y ); + + unlock(); +} + +int +Grid::next_note_x ( int x ) const +{ + for ( const event *e = _rd->events.first(); e; e = e->next() ) + if ( e->is_note_on() && (ts_to_x( e->timestamp() ) > (uint)x ) ) + return ts_to_x( e->timestamp() ); + + return 0; +} + +int +Grid::prev_note_x ( int x ) const +{ + for ( const event *e = _rd->events.last(); e; e = e->prev() ) + if ( e->is_note_on() && (ts_to_x( e->timestamp() ) < (uint)x) ) + return ts_to_x( e->timestamp() ); + + return 0; +} + + +void +Grid::_fix_length ( void ) +{ + tick_t beats = (unsigned long)(_rw->length / PPQN); + tick_t rem = (unsigned long)_rw->length % PPQN; + + _rw->length = (rem ? (beats + 1) : beats) * PPQN; +} + +/** Trim the length of the grid to the last event */ +void +Grid::trim ( void ) +{ + lock(); + + event *e = _rw->events.last(); + + if ( e ) + { + tick_t ts = e->timestamp(); + + _rw->length = ts; + + _fix_length(); + } + + unlock(); +} + +void +Grid::fit ( void ) +{ + int hi, lo; + + _rd->events.hi_lo_note( &hi, &lo ); + + viewport.h = abs( hi - lo ) + 1; + + viewport.y = note_to_y( hi ); +} + +/** Expand the length of the grid to the last event */ +void +Grid::expand ( void ) +{ + lock(); + + event *e = _rw->events.last(); + + if ( e ) + { + tick_t ts = e->timestamp(); + + _rw->length = ts > _rw->length ? ts : _rw->length; + + _fix_length(); + } + + unlock(); +} + +void +Grid::put ( int x, int y, tick_t l ) +{ + + int xl = ts_to_x( l ); + tick_t ts = x_to_ts( x ); + + event *on = new event; + event *off = new event; + + struct dash d; + + // Don't allow overlap (Why not?) + if ( get( &d, x, y ) || get( &d, x + xl - 1, y ) ) + return; + + DMESSAGE( "put %d,%d", x, y ); + + lock(); + + int note = y_to_note( y ); + + on->status( event::NOTE_ON ); + on->note( note ); + on->timestamp( ts ); + on->note_velocity( 64 ); + on->link( off ); + + off->status( event::NOTE_OFF ); + off->note( note ); + off->timestamp( ts + l ); + off->note_velocity( 64 ); + off->link( on ); + + _rw->events.insert( on ); + _rw->events.insert( off ); + + expand(); + + unlock(); +} + + +// void +// pattern::move ( int x, int y, int nx ) +// { +// event *e = _event( x, y, false ); + +// if ( e ) +// e->timestamp( nx ); +// } + + +void +Grid::move ( int x, int y, int nx, int ny ) +{ + lock(); + + event *e = _event( x, y, true ); + + if ( e ) + { + DMESSAGE( "moving note" ); + + event *on = e, + *off = e->link(); + + _rw->events.unlink( on ); + _rw->events.unlink( off ); + + on->note( y_to_note( ny ) ); + + tick_t l = on->note_duration(); + on->timestamp( x_to_ts( ny ) ); + on->note_duration( l ); + + _rw->events.insert( off ); + _rw->events.insert( on ); + } + + unlock(); +} + + +void +Grid::adj_velocity ( int x, int y, int n ) +{ + lock(); + + event *e = _event( x, y, true ); + + if ( e ) + { + DMESSAGE( "adjusting velocity" ); + + { + int v = e->note_velocity(); + + v += n; + + if ( v > 127 ) + v = 127; + + e->note_velocity( v > 0 ? v : 1 ); + } + + } + + unlock(); + +} + +void +Grid::adj_duration ( int x, int y, int l ) +{ + lock(); + + event *e = _event( x, y, true ); + + if ( e ) + { + DMESSAGE( "adjusting duration" ); + + { + int v = ts_to_x( e->note_duration() ); + + v += l; + + e->note_duration( x_to_ts( v > 0 ? v : 1 ) ); + + _rw->events.sort( e->link() ); + } + + } + + unlock(); + +} + +void +Grid::toggle_select ( int x, int y ) +{ + lock(); + + event *e = _event( x, y, true ); + + if ( e ) + { + if ( e->selected() ) + e->deselect(); + else + e->select(); + } + + unlock(); +} + + +/** insert /l/ ticks of time after /x/ */ +void +Grid::insert_time ( int l, int r ) +{ + tick_t start = x_to_ts( l ); + tick_t end = x_to_ts( r ); + + lock(); + + _rw->events.insert_time( start, end - start ); + + expand(); + + unlock(); +} + +/** select all events in range (notes straddling the border will also be selected */ +void +Grid::select ( int l, int r ) +{ + tick_t start = x_to_ts( l ); + tick_t end = x_to_ts( r ); + + lock(); + + _rw->events.select( start, end ); + + unlock(); +} + +/** select all (note) events in rectangle */ +void +Grid::select ( int l, int r, int t, int b ) +{ + tick_t start = x_to_ts( l ); + tick_t end = x_to_ts( r ); + + lock(); + + _rw->events.select( start, end, y_to_note( t) , y_to_note( b ) ); + + unlock(); +} + +/** delete events from /x/ to /l/, compressing time. */ +void +Grid::delete_time ( int l, int r ) +{ + tick_t start = x_to_ts( l ); + tick_t end = x_to_ts( r ); + + lock(); + + _rw->events.delete_time( start, end ); + + unlock(); +} + +void +Grid::select_none ( void ) +{ + lock(); + + _rw->events.select_none(); + + unlock(); +} + +void +Grid::invert_selection ( void ) +{ + lock(); + + _rw->events.invert_selection(); + + unlock(); +} + +void +Grid::delete_selected ( void ) +{ + lock(); + + _rw->events.remove_selected(); + + unlock(); +} + +void +Grid::move_selected ( int l ) +{ + + long o = x_to_ts( abs( l ) ); + + if ( l < 0 ) + o = 0 - o; + + lock(); + +// MESSAGE( "moving by %ld", o ); + + _rw->events.move_selected( o ); + + unlock(); +} + +void +Grid::crop ( int l, int r ) +{ + lock(); + + if ( (uint)r < ts_to_x( _rw->length ) ) + delete_time( r, ts_to_x( _rw->length ) ); + if ( l > 0 ) + delete_time( 0, l ); + + trim(); + + unlock(); +} + +void +Grid::crop ( int l, int r, int t, int b ) +{ + lock(); + + _rw->events.push_selection(); + + select( l, r, t, b ); + + _rw->events.invert_selection(); + _rw->events.remove_selected(); + + _rw->events.pop_selection(); + + crop( l, r ); + + unlock(); +} + + +void +Grid::_relink ( void ) +{ + _rw->events.relink(); +} + +/* Dump the event list -- used by pattern / phrase dumppers */ +void +Grid::dump ( smf *f, int channel ) const +{ + data *d = const_cast(_rd); + + midievent me; + + for ( event *e = d->events.first(); e; e = e->next() ) + { + me = *e; + me.channel( channel ); + + f->write_event( &me ); + } +} + +void +Grid::print ( void ) const +{ + data *d = const_cast(_rd); + + for ( event *e = d->events.first(); e; e = e->next() ) + e->print(); +} + +void +Grid::draw ( Canvas *c, int bx, int by, int bw, int bh ) +{ + c->clear(); + + tick_t start = x_to_ts( bx ); + tick_t end = x_to_ts( bx + bw ); + + data *d = const_cast< data *>( _rd ); + + for ( event *e = d->events.first(); e; e = e->next() ) + { + if ( ! e->is_note_on() ) + continue; + + tick_t ts = e->timestamp(); + + ASSERT( e->link(), "found a non-linked note" ); + + tick_t tse = e->link()->timestamp(); + +// if ( ts >= start && ts <= end ) + if ( tse >= start && ts <= end ) + c->draw_dash( ts_to_x( ts ), note_to_y( e->note() ), ts_to_x( tse - ts ), + draw_shape(), e->note_velocity(), e->selected() ); + } + + c->flip(); +} + + + + /*******************************************/ + /* Generic accessors -- boy C++ is verbose */ + /*******************************************/ + +/** Returns the index (playhead) for this grid */ +tick_t +Grid::index ( void ) const +{ + /* FIXME: considering the type of tick_t, we really need some kind + of locking here to insure that this thread doesn't read _index + while the RT thread is writing it. */ + return _index; +} + +bool +Grid::playing ( void ) const +{ + return _playing; +} + +int +Grid::height ( void ) const +{ + return _height; +} + +void +Grid::height ( int h ) +{ + _height = h; +} + +tick_t +Grid::length ( void ) const +{ + return _rd->length; +} + +void +Grid::length ( tick_t l ) +{ + lock(); + + _rw->length = l; + + unlock(); +} + +int +Grid::bars ( void ) const +{ + return ts_to_x( _rd->length ) / (_ppqn * _bpb); +} + +int +Grid::beats ( void ) const +{ + return ts_to_x( _rd->length ) / _ppqn; +} + +int +Grid::division ( void ) const +{ + return _bpb * _ppqn; +} + +int +Grid::subdivision ( void ) const +{ + return _ppqn; +} + +int +Grid::ppqn ( void ) const +{ + return _ppqn; +} + +/** set grid resolution to /n/, where 0 is 1/4 note, 1 is 1/8 note 2 is 1/16 note, etc. */ +void +Grid::resolution ( unsigned int n ) +{ + if ( n < 4 ) + ASSERTION( "bad resolution: %d", n ); + + _ppqn = n / 4; + DMESSAGE( "%d setting resolution to %d", n, _ppqn ); + + signal_events_change(); + + signal_settings_change(); +} + +int +Grid::resolution ( void ) const +{ + return _ppqn * 4; +} + +int +Grid::number ( void ) const +{ + return _number; +} + +void +Grid::name ( char *s ) +{ + if ( _name ) free ( _name ); + + _name = s; + + signal_settings_change(); +} + +const char * +Grid::name ( void ) const +{ + return _name; +} + +void +Grid::notes ( char *s ) +{ + if ( _notes ) free ( _notes ); + + _notes = s; + + signal_settings_change(); +} + +char * +Grid::notes ( void ) const +{ + return _notes; +} + +void +Grid::mode ( int m ) +{ + _mode = m; + + /* can't do this in RT thread, sorry. */ +/// signal_settings_change(); +} + +int +Grid::mode ( void ) const +{ + return _mode; +} + + +/** return a pointer to a copy of grid's event list in raw form */ +event_list * +Grid::events ( void ) const +{ + data * d = const_cast< data * >( _rd ); + + return new event_list( d->events ); +} + +/** replace event list with a copy of /el/ */ +void +Grid::events ( const event_list * el ) +{ + lock(); + + _rw->events = *el; + + unlock(); +} diff --git a/sequencer/src/grid.H b/sequencer/src/grid.H new file mode 100644 index 0000000..2b27a65 --- /dev/null +++ b/sequencer/src/grid.H @@ -0,0 +1,260 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include "event.H" +#include "event_list.H" +#include "dash.H" +#include "const.h" +#include "instrument.H" + +class smf; + +#include "debug.h" + +const int MAX_UNDO = 10; + +#include + +#include +using namespace sigc; + +using std::list; + +/* patterns and phrases use this structure */ + +class Canvas; + +/* everything that must be lock-free. This whole structure gets copied and swapped + for each write method */ +struct data { + + tick_t length; + int state; + event_list events; + + data( void ) + { + length = 0; + state = 0; + } + + data( const data &rhs ) + { + events = rhs.events; + length = rhs.length; + state = rhs.state; + } +/* data() { MESSAGE( "allocating new editable data" ); } */ + // ~data() { MESSAGE( "deleting old undo data, freeing at least %d bytes.", events.size() * sizeof ( event ) + sizeof ( list )); } +}; + + +struct Viewport { + + #define format "%d:%d:%d:%d" + + int x, y, w, h; + + Viewport ( void ) + { + x = y = w = h = 0; + } + + char * + dump ( void ) const + { + char *s; + + asprintf( &s, format, x, y, w, h ); + + return s; + } + + void + read( const char *s ) + { + sscanf( s, format, &x, &y, &w, &h ); + } + + #undef format +}; + + + +class Grid : public trackable +{ + +protected: + + unsigned int _height; + char *_notes; + char *_name; + int _number; + + bool _suspend_update; + + unsigned int _bpb; /* beats per bar */ + unsigned int _ppqn; /* pulses per quarter note (beat) */ + + + /* Used by playback thread. When a pattern or phrase is triggered, + these fields are filled in appropriately */ + mutable tick_t _start; /* absolute start tick of loop */ + mutable tick_t _end; /* absolute end tick of loop */ + volatile mutable tick_t _index; /* playhead, relative to start -- primarily used to draw the playhead */ + volatile mutable bool _playing; /* true if currently playing */ + + mutable volatile int _mode; /* mute, solo */ + + // FIXME: shouldn't this be "volatile"? +// const volatile data *_rd; /* read only data used by RT thread */ + const data * volatile _rd; + data *_rw; /* temporary writable copy used by UI thread */ + + list _history; + + void _remove_marked ( void ); + event * _event ( int x, int y, bool write ) const; + bool _delete ( int x, int y ); + bool _get ( struct dash *d, int x, int y ) const; + void _link ( void ); + void _relink ( void ); + void _fix_length ( void ); + + +private: + + volatile int _locked; + +public: + + signal signal_events_change; + signal signal_settings_change; + + Viewport viewport; /* used by the Canvas */ + + Grid ( void ); + virtual ~Grid ( void ); + Grid ( const Grid &rhs ); + + int y_to_note ( int y ) const; + int note_to_y ( int n ) const; + tick_t x_to_ts ( uint x ) const; + uint ts_to_x ( tick_t ts ) const; + + virtual Grid * create ( void ) = 0; + virtual Grid * clone ( void ) = 0; + virtual void draw_row_names ( Canvas *c ) const = 0; + virtual const char * row_name ( int r ) const = 0; + + virtual Grid * by_number ( int n ) const = 0; + + virtual void put ( int x, int y, tick_t l ); + + void lock ( void ); + void unlock ( void ); + void clear ( void ); + int get ( struct dash *d, int x, int y ) const; + void del ( int x, int y ); + void adj_velocity ( int x, int y, int n ); + void adj_duration ( int x, int y, int l ); + void move ( int x, int y, int nx, int ny ); + void record_event ( event *e ); + tick_t index ( void ) const; + bool playing ( void ) const; + + int height ( void ) const; + void height ( int h ); + tick_t length ( void ) const; + void length ( tick_t l ); + int bars ( void ) const; + int beats ( void ) const; + void trim ( void ); + void expand ( void ); + int division ( void ) const; + int subdivision ( void ) const; + int ppqn ( void ) const; + int number ( void ) const; + void name ( char *s ); + const char * name ( void ) const; + void notes ( char *s ); + char * notes ( void ) const; + virtual void mode ( int m ); + virtual int mode ( void ) const; + virtual int draw_shape ( void ) const = 0; + int next_note_x ( int x ) const; + int prev_note_x ( int x ) const; + + void fit ( void ); + + void delete_selected ( void ); + void move_selected ( int l ); + + void crop ( int l, int r ); + void crop ( int l, int r, int t, int b ); + + void toggle_select ( int x, int y ); + void insert_time ( int x, int r ); + void select ( int start, int end ); + void select ( int start, int end, int t, int b ); + void delete_time ( int start, int end ); + void select_none ( void ); + void invert_selection ( void ); + + void resolution ( unsigned int n ); + int resolution ( void ) const; + + void dump ( smf *f, int channel ) const; + void draw ( Canvas *c, int bx, int by, int bw, int bh ); + void print ( void ) const; + + event_list * events ( void ) const; + void events ( const event_list * el ); + +}; + +inline int +Grid::y_to_note ( int y ) const +{ + return 127 - y; +} + +inline int +Grid::note_to_y ( int n ) const +{ + return 127 - n; +} + +inline tick_t +Grid::x_to_ts ( unsigned int x ) const +{ + return (x * PPQN) / _ppqn; + +// return x * (PPQN / _ppqn); +} + +inline unsigned int +Grid::ts_to_x ( tick_t ts ) const +{ + return (ts * _ppqn) / PPQN; + +// return ts / (PPQN / _ppqn); +} diff --git a/sequencer/src/gui/Makefile b/sequencer/src/gui/Makefile new file mode 100644 index 0000000..6c50638 --- /dev/null +++ b/sequencer/src/gui/Makefile @@ -0,0 +1,4 @@ + + +all: + @ make -s -C .. diff --git a/sequencer/src/gui/draw.C b/sequencer/src/gui/draw.C new file mode 100644 index 0000000..5d94fb0 --- /dev/null +++ b/sequencer/src/gui/draw.C @@ -0,0 +1,269 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +/* This file contains ALL platform specific drawing code required by the canvas */ + +#include "ui.H" +#include "draw.H" + +#include "../common.h" +#include +#include + +#include "../canvas.H" + +struct color_table { + int state; + unsigned char r, g, b; +}; + +struct color_table color_defs[] = { + { EMPTY, 18, 18, 18 }, + { FULL, 255, 69, 0 }, + { PARTIAL, 0, 0, 0 }, + { CONTINUED, 80, 80, 80 }, + { LINE, 10, 10, 10 }, + { HIT, 255, 255, 255 }, + { PLAYHEAD, 10, 69, 10 }, + { SELECTED, 255, 10, 255 }, +}; + +Fl_Color *state_colors; + +Fl_Color velocity_colors[128]; +Fl_Color velocity2_colors[128]; + +bool draw_borders = 1; + +void +init_colors ( void ) +{ + unsigned int i; + /* velocity colors */ + + for ( i = 128; i--; ) + { + velocity_colors[i] = fl_color_average( FL_GRAY, fl_rgb_color( i * 2, 255 - i * 2, 32 ), 0.4 ); + velocity2_colors[i] = fl_color_average( FL_WHITE, velocity_colors[i], 0.5 ); + } + + state_colors = (Fl_Color*)malloc(sizeof( Fl_Color ) * MAX_STATE ); + + for ( i = elementsof( color_defs ); i--; ) + { + state_colors[ color_defs[i].state ] = fl_rgb_color( color_defs[i].r, + color_defs[i].g, + color_defs[i].b ); + } +} + +int +gui_draw_ruler ( int x, int y, int w, int div_w, int div, int ofs, int p1, int p2 ) +{ + /* Across the top */ + + fl_font( FL_TIMES, ruler_height ); + + int h = ruler_height; + + fl_color( canvas_background_color ); + + // fl_rectf( x, y, x + (div_w * w), y + h ); + fl_rectf( x, y, (div_w * w), h ); + + fl_color( FL_RED ); + + fl_line( x + div_w / 2, y, x + div_w * w, y ); + + char pat[40]; + int z = div; + int i; + for ( i = 0; i < w; i++ ) + if ( 0 == i % z ) + { + int nx = x + (i * div_w) + (div_w / 2); + + fl_color( FL_RED ); + + fl_line( nx, y, nx, y + h ); + + int k = ofs + i; + sprintf( pat, "%i", 1 + (k / z )); + + fl_color( FL_WHITE ); + fl_draw( pat, nx + div_w / 2, y + h + 1 / 2 ); + } + + if ( p1 != p2 ) + { + if ( p1 >= 0 ) + { + if ( p1 < p2 ) + fl_color( FL_GREEN ); + else + fl_color( FL_RED ); + + fl_rectf( x + (div_w * p1), y + h / 2, div_w, h / 2 ); + + } + if ( p2 >= 0 ) + { + if ( p2 < p1 ) + fl_color( FL_GREEN ); + else + fl_color( FL_RED ); + fl_rectf( x + (div_w * p2), y + h / 2, div_w, h / 2 ); + + } + } + + return h; +} + +void +gui_clear_area ( int x, int y, int w, int h ) +{ + fl_color( canvas_background_color ); + + fl_rectf( x, y, w, h ); +} + +int +gui_draw_string ( int x, int y, int w, int h, int color, const char *s, bool draw ) +{ + int rw; + + if ( ! s ) + return 0; + + fl_font( FL_COURIER, min( h, 18 ) ); + + rw = fl_width( s ); + + if ( fl_not_clipped( x, y, rw, h ) && draw ) + { + gui_clear_area( x, y, w, h ); + + if ( color ) + fl_color( velocity_colors[ color ] ); + else + fl_color( FL_DARK_CYAN ); + + fl_draw( s, x, y + h / 2 + fl_descent() ); + } + + return rw; +} + +void +gui_draw_shape ( int x, int y, int w, int h, int shape, int state, int flags, int color ) +{ + /* take advantage of FLTK's clipping */ + if ( ! fl_not_clipped( x, y, w, h ) ) + return; + + if ( flags & F_PLAYHEAD ) + { + state = state == FULL ? HIT : PLAYHEAD; + flags &= ~ F_SELECTION; + } + + Fl_Color c1, c2; + + if ( state == FULL && color ) + { + c1 = velocity_colors[ color ]; + c2 = velocity2_colors[ color ]; + } + else + { + c1 = state_colors[ state ]; + c2 = fl_color_average( FL_WHITE, c1, 0.1 ); + } + + if ( flags & F_SELECTION ) + fl_color( fl_darker( fl_color() ) ); + + int bw = 1; + + switch ( shape ) + { + case SQUARE: +// fl_rectf( x, y, w, h, FL_BLACK ); + + fl_color( c1 ); + fl_rectf( x + bw, y + bw, w - bw * 2, h - bw * 2 ); + if ( draw_borders ) + { + fl_color( c2 ); + fl_line_style( FL_SOLID, 2 ); + fl_rect( x + bw + 1, y + bw + 1, w - (bw+1) * 2, h - (bw+1) * 2 ); + fl_line_style( FL_SOLID, 0 ); + } + break; + case BOX: + fl_draw_box( FL_THIN_UP_BOX, x + bw, y + bw, w - bw * 2, h - bw * 2, c1 ); + break; + default: + ASSERTION( "unknown shape" ); + break; + } + + if ( flags & F_P1 || flags & F_P2 ) + { + if ( flags & F_P1 ) + fl_color( FL_GREEN ); + else + fl_color( FL_RED ); + + int rw = w / 4; + int rh = h / 4; + + fl_rectf( x + (w / 2) - (rw / 2), y + (h / 2) - (rh / 2), rw, rh ); + } +} + +extern UI *ui; + +static +void +clear_status ( void * ) +{ + ui->status->label( NULL ); +} + +/** inform the user of something via a status bar */ +void +gui_status ( const char *fmt, ... ) +{ + va_list args; + + static char pat[256]; + + if ( fmt ) + { + va_start( args, fmt ); + vsnprintf( pat, 256, fmt, args ); + va_end( args ); + } + + ui->status->label( pat ); + + Fl::add_timeout( 5.0f, clear_status ); +} diff --git a/sequencer/src/gui/draw.H b/sequencer/src/gui/draw.H new file mode 100644 index 0000000..4a66213 --- /dev/null +++ b/sequencer/src/gui/draw.H @@ -0,0 +1,57 @@ + +#pragma once + +/* enum { */ +/* EMPTY, */ +/* FULL, */ +/* PARTIAL, */ +/* CONTINUED, */ +/* HIT, */ +/* RING, */ +/* SELECTED, */ +/* LINE, */ +/* PLAYHEAD */ +/* }; */ + +/* canvas node states */ +enum { +/* real */ + EMPTY, /* nothing */ + FULL, /* dot or dash head */ + PARTIAL, + CONTINUED, /* dash tail */ + SELECTED, +/* virtual */ + HIT, /* playhead hit */ + LINE, /* beat line */ + PLAYHEAD, + MAX_STATE, +}; + +#define MAX_REAL_STATE HIT + +#define STATE_MASK 0x0F +#define STATE_FLAG_MASK (~ (STATE_MASK) ) + +/* flags */ +enum { + F_PLAYHEAD = 1 << 0, /* playhead is on item */ + F_P1 = 1 << 1, + F_P2 = 1 << 2, + F_SELECTION = 1 << 3 /* item is part of the selection box */ +}; + +/* shapes */ +enum { + SQUARE, + BOX +}; + +const int ruler_height = 14; + +void init_colors ( void ); +int gui_draw_ruler ( int x, int y, int w, int div_w, int div, int ofs, int p1, int p2 ); +int gui_draw_string ( int x, int y, int w, int h, int color, const char *s, bool draw ); +void gui_draw_shape ( int x, int y, int w, int h, int shape, int state, int flags, int color ); +void gui_clear_area ( int x, int y, int w, int h ); +void gui_status ( const char *fmt, ... ); diff --git a/sequencer/src/gui/event_edit.fl b/sequencer/src/gui/event_edit.fl new file mode 100644 index 0000000..06f4dee --- /dev/null +++ b/sequencer/src/gui/event_edit.fl @@ -0,0 +1,568 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0108 +header_name {.H} +code_name {.C} +comment {// +// Copyright (C) 2008 Jonathan Moore Liles +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +} {in_source in_header +} + +decl {\#include "../grid.H"} {} + +decl {\#include "../scale.H"} {} + +decl {extern Fl_Color velocity_colors[];} {} + +decl {class Event_Widget;} {public +} + +class Event_Editor {open +} { + decl {int _h;} {} + decl {Grid *_grid;} {} + decl {event_list *_old;} {} + decl {event_list *_el;} {} + decl {int _y;} {} + Function {make_window( Grid *g )} {open + } { + Fl_Window window { + label {Event Editor} + callback {delete _el; + +_grid->events( _old ); + +delete _old; + +_el = _old = NULL; + +o->hide(); + +Fl::delete_widget( o );} open + xywh {620 82 655 800} type Double box DOWN_BOX resizable + code0 {\#include "event_edit.H"} + code1 {\#include "../grid.H"} + code2 {\#include "../event_list.H"} modal size_range {0 0 659 803} visible + } { + Fl_Pack {} { + label {Event List} open selected + xywh {10 23 640 738} type HORIZONTAL resizable + } { + Fl_Group {} {open + xywh {10 24 620 737} box DOWN_FRAME resizable + } { + Fl_Pack pack {open + xywh {14 28 612 727} color 47 when 6 resizable + } {} + } + Fl_Scrollbar scroll_bar { + user_data this user_data_type {Event_Editor*} + callback {v->scroll( o->value() ); +v->update_widgets();} + xywh {629 23 20 738} when 3 + } + } + Fl_Return_Button {} { + label {&Save} + callback {delete window; +delete _el; +delete _old;} + xywh {489 771 76 25} + } + Fl_Button {} { + label {&Discard} + callback {window->do_callback();} + xywh {575 771 74 25} + } + Fl_Button {} { + label Del + user_data this user_data_type {Event_Editor *} + callback {_el->remove_selected(); + +sync();} + xywh {10 771 74 25} shortcut 0xffff color 88 + } + Fl_Menu_Button {} { + label {&Insert} + user_data this user_data_type {Event_Editor *} + callback {if ( o->value() == 0 ) +{ + // note; + + event *on = new event; + event *off = new event; + + on->status( event::NOTE_ON ); + on->note( 64 ); + on->note_velocity( 64 ); + + off->status( event::NOTE_OFF ); + off->note( 64 ); + off->timestamp( 1 ); + off->note_velocity( 64 ); + + on->link( off ); + + _el->insert( on ); + _el->insert( off ); + +} +else +{ + event *e = new event; + + int opcode = e->name( o->menu()[ o->value() ].text ); + + if ( opcode < 0 ) + return; + + e->status( opcode ); + + Event_Widget *ew = v->value(); + + if ( ew && ew->ev() ) + e->timestamp( ew->ev()->timestamp() ); + + + _el->insert( e ); +} + +sync();} open + xywh {94 771 121 25} color 63 + } { + MenuItem {} { + label Note + xywh {10 10 40 25} + } + MenuItem {} { + label Aftertouch + xywh {50 50 40 25} + } + MenuItem {} { + label {Control Change} + xywh {20 20 40 25} + } + MenuItem {} { + label {Program Change} + xywh {30 30 40 25} + } + MenuItem {} { + label {Channel Pressure} + xywh {60 60 40 25} + } + MenuItem {} { + label {Pitch Wheel} + xywh {40 40 40 25} + } + } + } + code {// keep a copy +_old = g->events(); +_el = g->events(); + +_grid = g; +_y = 0; + +_h = pack->h() / 24; + +// create widgets. + +for ( int n = _h; n--; ) +{ + Event_Widget *ew = new Event_Widget( 0, 0, pack->w() - Fl::box_dw( pack->box() ), 24, 0 ); + + ew->callback( cb_changed, (void*)this ); + ew->when( FL_WHEN_CHANGED ); + + pack->add( ew ); +} + +scroll_bar->minimum( 0 ); +scroll_bar->maximum( _el->size() - _h ); + +update_widgets();} {} + } + Function {sync( void )} {open return_type void + } { + code {DMESSAGE( "syncing events to grid" ); + +_grid->events( _el ); + +update_widgets();} {} + } + Function {update_widgets( void )} {open return_type void + } { + code {// draw em + + +int i = 0; +if ( ! _el->empty() ) +for ( event* e = (*_el)[_y]; e && i < _h; (e = e->next()), i++ ) +{ + Event_Widget *ew = (Event_Widget *)(pack->child( i )); + + ew->ev( e ); + ew->show(); +} + +// hide unused widgets. + +for ( int j = i; j < _h; j++ ) +{ + Event_Widget *ew = (Event_Widget *)(pack->child( j )); + ew->ev( NULL ); + ew->hide(); +} + +// ajdust scrollbar + +int sbmax = _el->size() - _h; + +if ( sbmax > 0 ) +{ + scroll_bar->maximum( sbmax ); + scroll_bar->show(); + +// scroll_w->size( scroll_w->parent()->w() - scroll_bar->w(), scroll_w->parent()->h() ); +} +else +{ + scroll_bar->maximum( 0 ); + scroll_bar->hide(); +// scroll_w->size( scroll_w->parent()->w(), scroll_w->parent()->h() ); +} + +pack->parent()->redraw();} {} + } + Function {scroll( int y )} {open return_type void + } { + code {_y = y;} {} + } + Function {value( void )} {return_type {Event_Widget *} + } { + code {for ( int i = _h; i--; ) +{ + Event_Widget *w = (Event_Widget*)pack->child( i ); + if ( w->selected() ) + return w; +} + +return NULL;} {} + } + Function {cb_changed( Fl_Widget *w, void *ee )} {open return_type {static void} + } { + code {Event_Widget *ew = (Event_Widget*)w; + +if ( ew->changed() ) + // sorting order changed. + ((Event_Editor*)ee)->_el->sort( ew->ev() ); + +((Event_Editor*)ee)->sync();} {} + } +} + +Function {event_editor( Grid *g )} {open C return_type void +} { + code {Event_Editor ee; + + +Fl_Window *w = ee.make_window( g ); + +w->modal(); +w->show(); + +while( w->shown() ) + Fl::wait();} {} +} + +widget_class Event_Widget {user_data_type {void *} open + xywh {685 357 590 30} type Single box NO_BOX + code0 {\#include "../event.H"} + code1 {_event = NULL;} + class Fl_Group size_range {400 24 0 24} visible +} { + decl {static const Fl_Color note_color = FL_BLACK;} {} + decl {static const Fl_Color control_color = FL_BLUE;} {} + decl {static const Fl_Color prog_color = FL_RED;} {} + decl {static const Fl_Color pressure_color = FL_YELLOW;} {} + decl {static const Fl_Color after_color = FL_CYAN;} {} + decl {static const Fl_Color pitch_color = FL_GREEN} {} + decl {event *_event;} {} + decl {Fl_Group *tab;} {} + Function {ev( event * e )} {open return_type void + } { + code {if ( e && ( _event == NULL ) ) + activate(); +else +if ( ! e ) +{ + _event = NULL; + deactivate(); + return; +} + +activate(); + +_event = e; + +name->label( e->name() ); +time->value( e->timestamp() ); + +// hide all tabs +for ( int i = 2; i < children(); i++ ) + child( i )->hide(); + +Fl_Valuator *d1, *d2; + +d1 = d2 = NULL; + +name->color( FL_BLACK ); +name->value( e->selected() ); + +// display the proper subtype +switch ( e->opcode() ) +{ +\#define TWO d1 = (Fl_Valuator*)tab->child( 0 ); d2 = (Fl_Valuator*)tab->child( 1 ) +\#define ONE d1 = (Fl_Valuator*)tab->child( 0 ); d2 = NULL + + case midievent::NOTE_ON: + case midievent::NOTE_OFF: + tab = note_tab; + name->color( note_color ); + + note_name->label( Scale::chromatic_name( e->note() ) ); + note_name->labelcolor( velocity_colors[ e->note_velocity() ] ); + + TWO; + break; + case midievent::CONTROL_CHANGE: + tab = control_tab; + name->color( control_color ); + + TWO; + break; + case midievent::AFTERTOUCH: + tab = after_tab; + name->color( after_color ); + + TWO; + break; + case midievent::CHANNEL_PRESSURE: + tab = pressure_tab; + name->color( pressure_color ); + + ONE; + break; + case midievent::PROGRAM_CHANGE: + tab = prog_tab; + name->color( prog_color ); + + ONE; + break; + case midievent::PITCH_WHEEL: + tab = pitch_tab; + name->color( pitch_color ); + + ONE; + d1->value( e->pitch() ); + goto pitch; + break; +} + + +byte_t D1, D2; + +e->data( &D1, &D2 ); + +d1->value( D1 ); +if ( d2 ) + d2->value( D2 ); + + +pitch: + +// show the current tab +tab->show(); + +time->redraw(); +name->redraw(); + +// redraw();} {} + } + Function {ev( void )} {open return_type {event *} + } { + code {return _event;} {} + } + Fl_Value_Input time { + callback {if ( _event->is_note_off() ) +{ + if ( o->value() < _event->link()->timestamp() ) + { + o->value( _event->timestamp() ); + return; + } +} +else +if ( _event->is_note_on() ) + if ( o->value() > _event->link()->timestamp() ) + { + o->value( _event->timestamp() ); + return; + } + + +_event->timestamp( o->value() ); + +set_changed(); +do_callback();} + xywh {3 0 125 24} labeltype NO_LABEL align 0 when 8 maximum 0 + code1 {o->maximum( (unsigned long)-1 );} + } + Fl_Button name { + label {} user_data_type {void*} + callback {if ( o->value() ) + _event->select(); +else + _event->deselect(); + +do_callback();} + xywh {132 -1 149 25} type Toggle when 1 + } + Fl_Group note_tab {open + xywh {282 0 309 24} align 16 + } { + Fl_Counter {} { + label {Note:} + user_data this + callback cb_note + xywh {359 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1 + } + Fl_Counter {} { + label {Velocity:} + user_data this + callback cb_msb + xywh {518 0 73 24} type Simple align 4 minimum 0 maximum 127 step 1 + } + Fl_Box note_name { + label {A\#} + private xywh {284 1 31 24} labeltype SHADOW_LABEL labelfont 14 labelcolor 135 + } + } + Fl_Group after_tab {open + xywh {317 0 277 24} align 16 hide + } { + Fl_Counter {} { + label {Note:} + user_data this + callback cb_note + xywh {359 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1 + } + Fl_Counter {} { + label {Pressure:} + user_data this + callback cb_msb + xywh {518 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1 + } + } + Fl_Group control_tab {open + xywh {358 0 238 24} align 16 hide + } { + Fl_Counter {} { + label {Control:} + user_data this + callback cb_lsb + xywh {360 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1 + } + Fl_Counter {} { + label {Value:} + user_data this + callback cb_msb + xywh {517 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1 + } + } + Fl_Group prog_tab {open + xywh {287 0 238 24} align 16 hide + } { + Fl_Counter {} { + label {Program:} + user_data this + callback cb_lsb + xywh {360 0 76 24} type Simple align 4 minimum 0 maximum 127 step 1 + } + } + Fl_Group pitch_tab {open + xywh {306 0 290 24} align 16 hide + } { + Fl_Slider {} { + label {Pitch:} user_data_type {void *} + callback {_event->pitch( o->value() ); +do_callback();} + xywh {358 0 238 24} type Horizontal align 4 when 4 minimum -8192 maximum 8191 step 1 + } + } + Fl_Group pressure_tab {open + xywh {307 0 290 24} align 16 hide + } { + Fl_Slider {} { + label {Pressure:} + user_data this + callback cb_lsb + xywh {358 0 239 24} type Horizontal align 4 when 4 maximum 127 step 1 + } + } + Function {select( bool b )} {open return_type void + } { + code {/* +_selected = b; + +if ( b ) + name->color( FL_WHITE ); + +redraw(); +*/} {} + } + Function {button()} {open return_type {Fl_Button *} + } { + code {return name;} {} + } + Function {selected( void )} {open return_type bool + } { + code {/* +int n = name->value(); +name->value( 0 ); +return n; +*/ + +return name->value();} {} + } + Function {cb_lsb( Fl_Valuator *o, Event_Widget *w )} {open return_type {static void} + } { + code {w->ev()->lsb( o->value() ); + +w->do_callback();} {} + } + Function {cb_msb( Fl_Valuator *o, Event_Widget *w )} {open return_type {static void} + } { + code {w->ev()->msb( o->value() ); +w->do_callback();} {} + } + Function {cb_note( Fl_Valuator *o, Event_Widget *w )} {open return_type {static void} + } { + code {w->ev()->note( o->value() ); +w->do_callback();} {} + } +} diff --git a/sequencer/src/gui/input.C b/sequencer/src/gui/input.C new file mode 100644 index 0000000..e4fb8e0 --- /dev/null +++ b/sequencer/src/gui/input.C @@ -0,0 +1,346 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include + +/* system */ +#include +#include + +#include "../non.H" +#include "draw.H" +#include "../common.h" + +#include "ui.H" + +extern UI *ui; + +void +async_exec ( const char *cmd ) +{ + if ( fork() ) + { + printf( "Executed command \"%s\"\n", cmd ); + return; + } + + system( cmd ); + exit(0); +} + +int +canvas_input_callback ( O_Canvas *widget, Canvas *c, int m ) +{ + // MESSAGE( "Hello, my name is %s", widget->parent()->label() ); + + int ow, oh; + + int x, y; + int processed = 1; + + x = Fl::event_x(); + y = Fl::event_y(); + + + ow = c->grid()->viewport.w; + oh = c->grid()->viewport.h; + + switch ( m ) + { + case FL_KEYBOARD: + { + +/* if ( Fl::event_state() & FL_ALT || Fl::event_state() & FL_CTRL ) */ +/* // this is more than a simple keypress. */ +/* return 0; */ + + + if ( Fl::event_state() & FL_CTRL ) + { + switch ( Fl::event_key() ) + { + case FL_Delete: + c->delete_time(); + break; + case FL_Insert: + c->insert_time(); + break; + case FL_Right: + c->pan( TO_NEXT_NOTE, 0 ); + break; + case FL_Left: + c->pan( TO_PREV_NOTE, 0 ); + break; + default: + return 0; + } + } + else + if ( Fl::event_state() & FL_ALT ) + return 0; + + switch ( Fl::event_key() ) + { + case FL_Left: + c->pan( LEFT, 1 ); + break; + case FL_Right: + c->pan( RIGHT, 1 ); + break; + case FL_Up: + c->pan( UP, 1 ); + break; + case FL_Down: + c->pan( DOWN, 1 ); + break; + case FL_Delete: + if ( Fl::event_state() & FL_SHIFT ) + c->grid()->clear(); + else + c->grid()->delete_selected(); + break; + default: + /* have to do this to get shifted keys */ + switch ( *Fl::event_text() ) + { + case 'f': + c->pan( TO_PLAYHEAD, 0 ); + break; + case 'r': + c->select_range(); + break; + case 'q': + c->grid()->select_none(); + break; + case 'i': + c->invert_selection(); + break; + case '1': + c->h_zoom( 2.0f ); + break; + case '2': + c->h_zoom( 0.5f ); + break; + case '3': + c->v_zoom( 2.0f ); + break; + case '4': + c->v_zoom( 0.5f ); + break; + case ' ': + transport.toggle(); + break; + case '[': + { + Grid *g = NULL; + +#define IS_PATTERN (widget->parent() == ui->pattern_tab) +#define IS_PHRASE (widget->parent() == ui->phrase_tab) +#define IS_SEQUENCE (widget->parent() == ui->sequence_tab) + + /* is there no nicer way to do this shit in c++? */ + g = c->grid()->by_number( c->grid()->number() - 1 ); + + if ( g ) + { + c->grid( g ); + processed = 2; + } + break; + } + case ']': + { + Grid *g = NULL; + + /* is there no nicer way to do this shit in c++? */ + g = c->grid()->by_number( c->grid()->number() + 1 ); + + if ( g ) + { + c->grid( g ); + processed = 2; + } + break; + } + case '<': + c->move_selected( LEFT, 1 ); + break; + case '>': + c->move_selected( RIGHT, 1 ); + break; + case ',': + c->move_selected( UP, 1 ); + break; + case '.': + c->move_selected( DOWN, 1 ); + break; + case 'C': + c->crop(); + break; + case 'c': + { + Grid *g = c->grid()->create(); + + if ( g ) + { + c->grid( g ); + + ui->update_sequence_widgets(); + } + + break; + } + case 'd': + { + MESSAGE( "duplicating thing" ); + c->grid( c->grid()->clone() ); + + // number of phrases may have changed. + ui->update_sequence_widgets(); + + break; + + } + case 'D': + c->duplicate_range(); + break; + case 't': + c->grid()->trim(); + break; + + case 'm': + c->grid()->mode( c->grid()->mode() == MUTE ? PLAY : MUTE ); + break; + case 's': + c->grid()->mode( c->grid()->mode() == SOLO ? PLAY : SOLO ); + break; + default: + processed = 0; + break; + } + break; + } + break; + } + case FL_PUSH: + { + switch ( Fl::event_button() ) + { + case 1: + int note; + if ( ( note = c->is_row_name( x, y ) ) >= 0 ) + { + DMESSAGE( "click on row %d", note ); + Instrument *i = ((pattern *)c->grid())->mapping.instrument(); + + if ( i ) + { + ui->edit_instrument_row( i, note ); + + c->changed_mapping(); + } + } + else + { + if ( Fl::event_state() & FL_SHIFT ) + { + c->start_cursor( x, y ); + break; + } + + if ( IS_PATTERN && Fl::event_state() & ( FL_ALT | FL_CTRL ) ) + c->randomize_row( y ); + else + c->set( x, y ); + } + break; + case 3: + if ( Fl::event_state() & FL_SHIFT ) + { + c->end_cursor( x, y ); + break; + } + + c->unset( x, y ); + break; + case 2: + c->select( x, y ); + break; + default: + processed = 0; + } + break; + } + case FL_RELEASE: + break; + case FL_DRAG: + break; +/* case FL_DRAG: */ +/* { */ +/* if ( ! lmb_down ) */ +/* break; */ + +/* // c->grid()->move( x, y, nx ); */ +/* break; */ +/* } */ + case FL_MOUSEWHEEL: + { + if ( Fl::event_state() & FL_CTRL ) + c->adj_length( x, y, (0 - Fl::event_dy()) ); + else if ( Fl::event_state() & FL_ALT ) + c->adj_color( x, y, (0 - Fl::event_dy()) * 5 ); + else if ( Fl::event_state() & FL_SHIFT ) + { + if ( Fl::event_dy() > 0 ) + { + c->pan( RIGHT, Fl::event_dy() * 5 ); + } + else + { + c->pan( LEFT, 0 - Fl::event_dy() * 5 ); + } + } + else + { + if ( Fl::event_dy() > 0 ) + { + c->pan( DOWN, Fl::event_dy() * 1 ); + } + else + { + c->pan( UP, (0 - Fl::event_dy()) * 1 ); + } + } + + break; + } + default: + processed = 0; + } + + int nw, nh; + nw = c->grid()->viewport.w; + nh = c->grid()->viewport.h; + + // layout of canvas changed... requires clearing. + if ( oh != nh || ow != nw ) + return 3; + + return processed; +} diff --git a/sequencer/src/gui/input.H b/sequencer/src/gui/input.H new file mode 100644 index 0000000..a3e58d3 --- /dev/null +++ b/sequencer/src/gui/input.H @@ -0,0 +1,12 @@ + +#pragma once + +#include "../canvas.H" +#include "../common.h" + +class O_Canvas; + +void disp_message ( char *s ); +void async_exec ( const char *cmd ); +int canvas_input_callback ( O_Canvas *widget, Canvas *c, int m ); +int disp_init ( int argc, char **argv ); diff --git a/sequencer/src/gui/ui.fl b/sequencer/src/gui/ui.fl new file mode 100644 index 0000000..bb0f5ea --- /dev/null +++ b/sequencer/src/gui/ui.fl @@ -0,0 +1,1933 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0300 +header_name {.H} +code_name {.C} +comment {// +// Copyright (C) 2008 Jonathan Moore Liles +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +} {in_source in_header +} + +decl {\#include } {public local +} + +decl {\#include "FL/About_Dialog.H"} {private local +} + +decl {class Fl_Scalepack;} {public local +} + +decl {class Fl_Sometimes_Input;} {public local +} + +decl {\#include "FL/Fl_Theme_Chooser.H"} {private local +} + +decl {\#include "FL/Fl_Scalepack.H"} {private local +} + +decl {\#include "FL/Fl_Sometimes_Input.H"} {private local +} + +decl {\#include "FL/Fl_Menu_Settings.H"} {private local +} + +decl {\#include } {private local +} + +decl {\#include "widgets.H"} {private local +} + +decl {\#include "event_edit.H"} {private local +} + +decl {\#include "../jack.H"} {private local +} + +decl {\#include "../NSM.H"} {private local +} + +decl {extern NSM_Client *nsm;} {private local +} + +decl {extern UI *ui;} {private local +} + +decl {class O_Canvas;} {private local +} + +decl {class Triggers;} {public local +} + +decl {class Instrument_Editor;} {private local +} + +decl {Fl_Color canvas_background_color;} {public local +} + +decl {extern Fl_Color velocity_colors[];} {private local +} + +Function {update_transport( void * )} {open return_type void +} { + code {// transport_poll(); + +handle_midi_input(); + + ui->progress_group->do_callback(); + + ui->vmetro_widget->update(); + + ui->triggers_widget->update(); + +Fl::repeat_timeout( TRANSPORT_POLL_INTERVAL, update_transport ); + +static int oldstate = -1; + +if ( transport.rolling != oldstate ) +{ + + ui->play_button->label( transport.rolling ? "@square" : "@>" ); + oldstate = transport.rolling; + + if ( transport.rolling ) + { + ui->menu_new->deactivate(); + ui->menu_open->deactivate(); + } + else + { + ui->menu_new->activate(); + ui->menu_open->activate(); + } + +} + +if ( nsm && nsm->is_active() ) +{ + if ( ui->menu_new->active() ) + { + ui->menu_new->deactivate(); + ui->menu_open->deactivate(); + ui->menu_save_as->deactivate(); + } +} + +// JUST A TEST +if ( transport.rolling ) +{ + if ( ui->tabs->value() == ui->pattern_tab ) + ui->pattern_canvas_widget->redraw_playhead(); + else + if ( ui->tabs->value() == ui->phrase_tab ) + ui->phrase_canvas_widget->redraw_playhead(); + +} + +ui->transport_state->do_callback();} {} +} + +class UI {open +} { + decl {Fl_Text_Buffer *sequence_notes_buffer;} {private local + } + decl {Fl_Text_Buffer *pattern_notes_buffer;} {private local + } + decl {Fl_Text_Buffer *phrase_notes_buffer} {private local + } + Function {UI()} {open + } { + code {fl_register_images(); + +canvas_background_color = FL_GREEN; + +playback_mode_menu = NULL; + +main_window = make_main_window(); +seq_window = make_seq_window(); + +make_randomization_dialog(); + +// make_instrument_edit_dialog(); + +Fl::add_handler( shortcut_handler ); + +// use old focus behavior +Fl::visible_focus( 0 ); + +// try to fill the screen, but only when the screen is tiny and our window is huge. +{ + int sx, sy, sw, sh; + + Fl::screen_xywh( sx, sy, sw, sh ); + + if ( sw < main_window->w() || sh < main_window->h() ) + main_window->resize( sx, sy, sw, sh ); +} + +Fl::add_timeout( TRANSPORT_POLL_INTERVAL, update_transport ); + + +playlist->signal_new_song.connect( sigc::mem_fun( this, &UI::update_sequence_widgets ) );} {} + } + Function {~UI()} {open + } { + code {delete seq_window; +delete main_window;} {} + } + Function {run()} {open + } { + code {Fl::run();} {} + } + Function {load_settings()} {open return_type void + } { + code {char *path; + +asprintf( &path, "%s/%s", config.user_config_dir, "view" ); + +((Fl_Menu_Settings*)menu_bar)->load( menu_bar->find_item( "&View" ), path ); + +free( path );} {} + } + Function {save_settings()} {open return_type void + } { + code {char *path; + +asprintf( &path, "%s/%s", config.user_config_dir, "view" ); + +((Fl_Menu_Settings*)menu_bar)->dump( menu_bar->find_item( "&View" ), path ); + +free( path );} {} + } + Function {make_main_window()} {open + } { + Fl_Window main_window { + label {Non Sequencer} + callback {// Ignore escape +if ( Fl::event() == FL_SHORTCUT && Fl::event_key() == FL_Escape ) + return; + +if ( maybe_save_song() ) + quit();} open + xywh {798 131 865 805} type Double color 47 resizable + code0 {o->color( FL_BACKGROUND_COLOR );} xclass non size_range {700 509 0 0} visible + } { + Fl_Group {} {open + xywh {0 30 865 70} box FLAT_BOX + } { + Fl_Value_Input {} { + label BPM + callback {transport.set_beats_per_minute( o->value() );} + xywh {389 47 45 25} labelsize 9 align 1 when 8 + code1 {transport.signal_tempo_change.connect( sigc::mem_fun( o, static_cast(&Fl_Valuator::value) ) );} + code2 {o->value( transport.beats_per_minute );} + } + Fl_Value_Input {} { + callback {transport.set_beats_per_bar( o->value() );} + xywh {444 47 26 25} + code0 {transport.signal_bpb_change.connect( sigc::mem_fun( o, static_cast(&Fl_Valuator::value) ) );} + code1 {o->value( transport.beats_per_bar );} + } + Fl_Box {} { + label {/} + xywh {469 47 19 25} + } + Fl_Value_Input {} { + callback {transport.set_beat_type( o->value() );} + xywh {489 47 24 25} + code0 {transport.signal_beat_change.connect( sigc::mem_fun( o, static_cast(&Fl_Valuator::value) ) );} + code1 {o->value( transport.beat_type );} + } + Fl_Pack vmetro_widget { + label Metronome + xywh {520 35 336 59} type HORIZONTAL box UP_BOX color 40 selection_color 48 labelsize 33 align 0 resizable + code0 {\#include "widgets.H"} + code1 {o->box( FL_FLAT_BOX );} + class Visual_Metronome + } {} + Fl_Pack transport_controls_group {open + xywh {4 32 156 42} type HORIZONTAL + code0 {o->spacing( 2 );} + class Fl_Scalepack + } { + Fl_Button play_button { + label {@>} + callback {transport.toggle();} + xywh {10 34 43 38} shortcut 0x20 labeltype ENGRAVED_LABEL + } + Fl_Button rec_button { + label {@circle} + callback {transport.recording = o->value(); + + +if ( o->value() ) +{ + if ( config.record_mode == NEW ) + { + pattern *p = new pattern; + p->length( -1 ); + + pattern_c->grid( p ); + } + + ((pattern*)pattern_c->grid())->record( 0 ); + + o->labelcolor( FL_RED ); +} +else +{ + pattern::recording()->record_stop(); + + o->labelcolor( FL_WHITE ); +}} + xywh {60 34 43 38} type Toggle shortcut 0x80072 selection_color 47 labeltype ENGRAVED_LABEL when 1 + } + Fl_Button home_button { + label {@|<} + callback {transport.locate( 0 );} + xywh {110 34 43 38} shortcut 0xff50 labeltype ENGRAVED_LABEL + } + } + Fl_Choice record_mode_menu { + label {&Record Mode} + callback {if ( ! transport.recording ) + config.record_mode = (record_mode_e)o->value(); +else + o->value( config.record_mode );} open + xywh {170 47 100 25} box DOWN_BOX down_box BORDER_BOX color 37 labelsize 9 align 1 + } { + MenuItem {} { + label Merge + xywh {15 15 40 25} + } + MenuItem {} { + label Overwrite + xywh {25 25 40 25} + } + MenuItem {} { + label Layer + xywh {35 35 40 25} + } + MenuItem {} { + label New + xywh {45 45 40 25} + } + } + Fl_Choice playback_mode_menu { + label {Playback &Mode} open + xywh {279 47 100 25} box DOWN_BOX down_box BORDER_BOX color 37 labelsize 9 align 1 + } { + MenuItem {} { + label Pattern + callback {song.play_mode = PATTERN;} + xywh {5 5 40 25} + } + MenuItem {} { + label Sequence + callback {song.play_mode = SEQUENCE;} + xywh {15 15 40 25} + } + MenuItem {} { + label Trigger + callback {song.play_mode = TRIGGER;} + xywh {25 25 40 25} + } + MenuItem {} { + label Queue + callback {song.play_mode = QUEUE;} + xywh {0 0 40 24} + } + } + } + Fl_Tabs tabs { + callback {((Fl_Group*)o->value())->child( 0 )->take_focus(); + +ui->pan_indicators->show(); + +if ( o->value() == pattern_tab ) + pattern_canvas_widget->handle_pan(); +else if ( o->value() == phrase_tab ) + phrase_canvas_widget->handle_pan(); + +if ( o->value() != pattern_tab ) +{ + if ( o->value() != phrase_tab ) + ui->pan_indicators->hide(); + edit_menu->deactivate(); +} +else +{ + edit_menu->activate(); +} + +menu_bar->redraw();} open + xywh {0 79 865 698} box BORDER_BOX color 47 labeltype SHADOW_LABEL labelsize 19 when 1 resizable + code0 {canvas_background_color = fl_rgb_color( 18, 18, 18 );} + } { + Fl_Group sequence_tab { + label Sequence open + xywh {0 102 865 674} box FLAT_BOX color 37 hide resizable + code0 {update_sequence_widgets();} + } { + Fl_Group {} {open + xywh {10 125 233 502} labelsize 12 + } { + Fl_Browser playlist_browser { + label Playlist + xywh {10 125 233 435} type Hold box EMBOSSED_BOX color 39 selection_color 30 labelcolor 55 align 1 when 4 textsize 18 textcolor 95 resizable + code0 {static int widths[] = { 40, 30, 0 };} + code1 {o->column_widths( widths ); o->column_char( '\\t' );} + code2 {o->value( 1 );} + } + Fl_Button sequence_phrase_delete_button { + label Delete + callback {int val = playlist_browser->value(); + +if ( val > 1 ) +{ +// playlist_browser->value( playlist_browser->value() + 1 ); + + playlist->remove( val - 2 ); + + update_sequence_widgets(); + + if ( ! playlist_browser->value() ) + playlist_browser->value( playlist_browser->size() ); +}} + xywh {14 566 73 25} shortcut 0xffff color 88 labelcolor 23 + } + Fl_Button sequence_phrase_up_button { + label Up + callback {if ( playlist_browser->value() > 2 ) +{ + playlist->move( playlist_browser->value() - 2, UP ); + playlist_browser->value( playlist_browser->value() - 1 ); + update_sequence_widgets(); +}} + xywh {97 566 65 25} shortcut 0xffbf + } + Fl_Button sequence_phrase_down_button { + label Down + callback {if ( playlist_browser->value() > 1 ) +{ + playlist->move( playlist_browser->value() - 2, DOWN ); + playlist_browser->value( playlist_browser->value() + 1 ); + update_sequence_widgets(); +}} + xywh {169 566 74 25} shortcut 0xffc0 + } + Fl_Menu_Button sequence_phrase_choice { + label {Insert Phrase} + callback {playlist->insert( playlist_browser->value() - 1, o->value() + 1 ); + +update_sequence_widgets(); + +int val = playlist_browser->value(); + +if ( val ) + playlist_browser->value( playlist_browser->value() + 1 ); +else + playlist_browser->value( playlist_browser->size() );} open + xywh {11 597 232 30} color 63 + } {} + } + Fl_Input sequence_name_field { + label {name:} + callback {playlist->name( o->value() );} + xywh {91 740 158 26} color 36 align 20 when 1 textcolor 32 + } + Fl_Light_Button detach_button { + label Detach + callback {if ( o->value() ) +{ + Fl_Group *g = seq_detached_group; + seq_window->show(); + g->add( sequence_tab ); + sequence_tab->resize( g->x(), g->y(), g->w(), g->h() ); + tabs->do_callback(); + main_window->redraw(); +} +else +{ + seq_window->hide(); + tabs->insert( (Fl_Widget&)*sequence_tab, 0 ); + sequence_tab->resize( pattern_tab->x(), pattern_tab->y(), pattern_tab->w(), pattern_tab->h() ); + tabs->do_callback(); +}} + xywh {7 740 78 26} + } + Fl_Text_Editor sequence_notes_edit { + label {Notes:} + callback {playlist->notes( o->buffer()->text() );} + xywh {254 691 606 73} selection_color 48 labelsize 12 align 5 textcolor 94 + code0 {o->buffer( sequence_notes_buffer = new Fl_Text_Buffer );} + } + Fl_Box triggers_widget { + label Patterns + xywh {253 125 607 549} color 48 align 1 resizable + code0 {o->color( FL_BACKGROUND_COLOR );} + class Triggers + } + Fl_Group progress_group { + callback {if ( ! o->visible_r() ) + return; + +phrase *p = phrase::phrase_by_number( playlist->playing() ); + +if ( p ) + phrase_progress->value( p->index() / (double)p->length() ); + +if ( playlist->length() ) + sequence_progress->value( playlist->index() / (double)playlist->length() );} open + xywh {10 656 233 66} + } { + Fl_Slider phrase_progress { + label Phrase + xywh {10 656 233 24} type Horizontal labelsize 12 align 1 + } + Fl_Slider sequence_progress { + label Sequence + callback {transport.locate( (tick_t)((double)playlist->length() * o->value()) );} + xywh {10 698 233 24} type Horizontal labelsize 12 align 1 + } + } + } + Fl_Group phrase_tab { + label Phrase open + xywh {0 102 865 674} box FLAT_BOX color 47 hide + code0 {update_phrase_widgets();} + } { + Fl_Box phrase_canvas_widget { + label Phrase + xywh {1 103 863 587} box FLAT_BOX color 37 labelsize 100 align 16 resizable + code0 {o->set_canvas( phrase_c );} + code1 {phrase_c->signal_pan.connect( sigc::mem_fun( phrase_canvas_widget, &O_Canvas::handle_pan ) );} + class O_Canvas + } + Fl_Group {} {open + xywh {5 697 856 77} box FLAT_BOX color 47 + } { + Fl_Input phrase_name_field { + label {name:} + callback {phrase_c->grid()->name( strdup( o->value() ) ); + +// if the name changed.. +update_sequence_widgets();} + xywh {5 704 155 24} box ROUNDED_BOX color 49 labelfont 2 labelcolor 55 align 20 textcolor 32 + code0 {o->up_box( FL_ROUNDED_BOX );} + class Fl_Sometimes_Input + } + Fl_Spinner phrase_number_spinner { + label {Phrase:} + callback {phrase *p = ((phrase *)phrase_c->grid())->by_number( o->value() ); + +if ( p ) + phrase_c->grid( p ); + +o->maximum( phrase::phrases() );} + xywh {165 704 55 24} color 36 labelsize 9 align 1 when 1 + } + Fl_Light_Button phrase_mute_button { + label Mute + xywh {5 740 93 23} color 37 hide + } + Fl_Light_Button phrase_solo_button { + label Solo + xywh {111 740 87 23} color 37 hide + } + Fl_Text_Editor phrase_notes_edit { + label {Notes:} + callback {phrase_c->grid()->notes( o->buffer()->text() );} + xywh {235 709 620 58} selection_color 48 labelsize 12 textcolor 94 resizable + code0 {o->buffer( phrase_notes_buffer = new Fl_Text_Buffer );} + } + } + } + Fl_Group pattern_tab { + label Pattern open + xywh {0 102 865 674} box FLAT_BOX color 47 + code0 {update_pattern_widgets();} + } { + Fl_Box pattern_canvas_widget { + label Pattern selected + xywh {1 103 863 587} box FLAT_BOX color 37 labelsize 100 align 16 resizable + code0 {\#include "draw.H"} + code1 {o->set_canvas( pattern_c );} + code2 {\#include "input.H"} + code3 {pattern_c->signal_pan.connect( sigc::mem_fun( pattern_canvas_widget, &O_Canvas::handle_pan ) );} + class O_Canvas + } + Fl_Group {} {open + xywh {0 694 862 78} box FLAT_BOX color 47 + } { + Fl_Input pattern_name_field { + label {name:} + callback {pattern_c->grid()->name( strdup( o->value() ) );} + xywh {5 704 155 24} box ROUNDED_BOX color 49 align 20 when 1 textfont 2 textcolor 55 + code0 {o->up_box( FL_ROUNDED_BOX );} + class Fl_Sometimes_Input + } + Fl_Spinner pattern_number_spinner { + label {Pattern:} + callback {pattern *p = ((pattern *)pattern_c->grid())->by_number( o->value() ); + +if ( p ) + pattern_c->grid( p ); + +o->maximum( pattern::patterns() );} + xywh {165 704 55 24} color 36 labelsize 9 align 1 when 1 + code0 {o->maximum( 1 );} + code1 {// pattern::signal_create_destroy.connect( sigc::mem_fun( o, static_cast(&Fl_Spinner::maximum) ) );} + } + Fl_Light_Button pattern_mute_button { + label Mute + callback {Grid *g = pattern_c->grid(); + +g->mode( g->mode() == MUTE ? PLAY : MUTE ); + +o->value( g->mode() == MUTE ); + +pattern_solo_button->value( 0 );} + xywh {10 738 65 25} type Normal color 37 + } + Fl_Light_Button pattern_solo_button { + label Solo + callback {Grid *g = pattern_c->grid(); + +g->mode( g->mode() == SOLO ? PLAY : SOLO ); + +o->value( g->mode() == SOLO ); + +pattern_mute_button->value( 0 );} + xywh {80 738 65 25} type Normal color 37 + } + Fl_Text_Editor pattern_notes_edit { + label {Notes:} + callback {pattern_c->grid()->notes( o->buffer()->text() );} + xywh {230 713 227 48} selection_color 48 labelsize 12 textcolor 94 resizable + code0 {o->buffer( pattern_notes_buffer = new Fl_Text_Buffer );} + } + Fl_Group pattern_settings_group {open + xywh {458 694 400 78} + } { + Fl_Spinner pattern_channel_spinner { + label Channel + callback {((pattern *)pattern_c->grid())->channel( o->value() - 1 );} + xywh {815 700 40 24} color 36 when 1 + code0 {\#include "../pattern.H"} + code1 {o->maximum( 16 );} + } + Fl_Spinner pattern_port_spinner { + label Port + callback {((pattern *)pattern_c->grid())->port( o->value() - 1 );} + xywh {815 734 40 24} color 36 when 1 + code0 {o->maximum( 16 );} + } + Fl_Output mapping_text { + label Mapping + xywh {464 734 145 24} align 20 + } + Fl_Menu_Button mapping_menu { + label {@>} + callback {mapping_text->value( o->text() ); + + +char picked[80]; +mapping_menu->item_pathname(picked, sizeof(picked)-1 ); + +if ( 0 == strncmp( picked, "Instrument", strlen( "Instrument" ) ) ) +{ + ((pattern*)pattern_c->grid())->mapping.open( Mapping::INSTRUMENT, o->text() ); + + pattern_c->changed_mapping(); + + pattern_key_combo->deactivate(); +} +else +if ( 0 == strncmp( picked, "Scale", strlen( "Scale" ) ) ) +{ + ((pattern*)pattern_c->grid())->mapping.open( Mapping::SCALE, o->text() ); + + pattern_c->changed_mapping(); + + pattern_key_combo->activate(); +}} open + xywh {609 734 30 24} labeltype NO_LABEL + code0 {update_mapping_menu();} + } { + Submenu mapping_scale_menu { + label Scale open + xywh {25 25 74 25} + } {} + Submenu mapping_instrument_menu { + label Instrument open + xywh {10 10 74 25} + } {} + } + Fl_Choice pattern_key_combo { + label {&Key} + callback {((pattern*)pattern_c->grid())->mapping.key( o->value() ); + +pattern_c->changed_mapping();} + xywh {674 734 75 24} down_box BORDER_BOX when 1 + } { + MenuItem {} { + label C + xywh {30 30 40 25} + } + MenuItem {} { + label {C\#/Db} + xywh {40 40 40 25} + } + MenuItem {} { + label D + xywh {50 50 40 25} + } + MenuItem {} { + label {D\#/Eb} + xywh {60 60 40 25} + } + MenuItem {} { + label E + xywh {70 70 40 25} + } + MenuItem {} { + label F + xywh {80 80 40 25} + } + MenuItem {} { + label {F\#/Gb} + xywh {90 90 40 25} + } + MenuItem {} { + label G + xywh {100 100 40 25} + } + MenuItem {} { + label {G\#} + xywh {110 110 40 25} + } + MenuItem {} { + label A + xywh {0 0 40 25} + } + MenuItem {} { + label {A\#/Bb} + xywh {10 10 40 25} + } + MenuItem {} { + label B + xywh {20 20 40 25} + } + } + Fl_Choice pattern_note_combo { + label {&Note 1/} + callback {((pattern*)pattern_c->grid())->note( atoi( o->menu()[ o->value() ].text ));} + xywh {704 700 45 24} down_box BORDER_BOX when 1 + } { + MenuItem {} { + label 1 + xywh {0 0 40 25} + } + MenuItem {} { + label 2 + xywh {10 10 40 25} + } + MenuItem {} { + label 4 + xywh {20 20 40 25} + } + MenuItem {} { + label 8 + xywh {30 30 40 25} + } + MenuItem {} { + label 16 + xywh {40 40 40 25} + } + MenuItem {} { + label 32 + xywh {50 50 40 25} + } + MenuItem {} { + label 64 + xywh {60 60 40 25} divider + } + MenuItem {} { + label 3 + xywh {60 60 40 25} + } + MenuItem {} { + label 6 + xywh {70 70 40 25} + } + MenuItem {} { + label 12 + xywh {80 80 40 25} + } + MenuItem {} { + label 24 + xywh {90 90 40 25} + } + } + Fl_Choice pattern_res_combo { + label {&Resolution 1/} + callback {pattern_c->grid()->resolution( atoi( o->menu()[ o->value() ].text ));} + xywh {584 700 55 24} down_box BORDER_BOX when 1 + } { + MenuItem {} { + label 4 + xywh {30 30 40 25} + } + MenuItem {} { + label 8 + xywh {40 40 40 25} + } + MenuItem {} { + label 16 + xywh {50 50 40 25} + } + MenuItem {} { + label 32 + xywh {60 60 40 25} + } + MenuItem {} { + label 64 + xywh {80 80 40 25} + } + MenuItem {} { + label 128 + xywh {90 90 40 25} divider + } + MenuItem {} { + label 3 + xywh {70 70 40 25} + } + MenuItem {} { + label 6 + xywh {80 80 40 25} + } + MenuItem {} { + label 12 + xywh {90 90 40 25} + } + MenuItem {} { + label 24 + xywh {100 100 40 25} + } + } + } + } + } + } + Fl_Group {} {open + xywh {0 776 865 31} + } { + Fl_Box status { + label status + xywh {1 776 782 31} box UP_BOX align 84 + code0 {o->label( NULL );} + } + Fl_Box transport_state { + label state + callback {const char *s = "INVALID"; + +if ( transport.master ) + s = "Master"; +else if ( transport.valid ) + s = "Slave"; + +if ( s != o->label() ) +{ + o->label( s ); + if ( ! strcmp( s, "INVALID" ) ) + o->color( fl_darker( FL_RED ) ); + else + o->color( fl_darker( FL_GREEN ) ); +}} + xywh {783 776 82 31} box THIN_UP_BOX align 64 + } + } + Fl_Group pan_indicators {open + xywh {370 692 120 20} + } { + Fl_Box scroll_up_box { + label {@2<} + xywh {400 694 30 18} + } + Fl_Box scroll_down_box { + label {@2>} + xywh {430 694 30 18} + } + Fl_Box scroll_left_box { + label {@<} + xywh {370 692 30 18} hide + } + Fl_Box scroll_right_box { + label {@>} + xywh {460 692 30 18} hide + } + } + Fl_Group {} {open + xywh {0 0 865 31} + } { + Fl_Menu_Bar menu_bar {open + xywh {0 0 865 30} color 47 + } { + Submenu {} { + label {&File} open + xywh {0 0 100 20} color 37 + } { + MenuItem menu_new { + label {&New} + callback {if ( maybe_save_song() ) +{ + init_song(); + + // Sync the GUI. + update_pattern_widgets(); + update_sequence_widgets(); + update_phrase_widgets(); + + + gui_status( "New song." ); +}} + xywh {0 0 40 25} + } + MenuItem menu_open { + label {&Open} + callback {char *name = fl_file_chooser( "Open File", "Non Files (*.non)", NULL, 0 ); + +if ( name ) +{ + if ( ! load_song( name ) ) + fl_alert( "Could not load song!" ); + else + gui_status( "Song opened." ); + + update_sequence_widgets(); + update_pattern_widgets(); + update_phrase_widgets(); + + playback_mode_menu->value( song.play_mode ); + playback_mode_menu->redraw(); +}} + xywh {0 0 40 25} shortcut 0x4006f color 37 + } + MenuItem menu_save { + label {&Save} + callback {save_dialog( song.filename );} + xywh {0 0 40 25} shortcut 0x40073 color 37 deactivate + code0 {song.signal_dirty.connect( sigc::mem_fun( o, &Fl_Menu_Item::activate ) );} + code1 {song.signal_clean.connect( sigc::mem_fun( o, &Fl_Menu_Item::deactivate ) );} + } + MenuItem menu_save_as { + label {Save &As} + callback {save_dialog( NULL );} + xywh {0 0 40 25} + } + MenuItem {} { + label {&Import} + callback {char *name = fl_file_chooser( "MIDI Import", "MIDI Files (*.mid)", NULL, 0 ); + +if ( ! name ) + return; + +smf f; + +if ( ! f.open( name, smf::READ ) ) +{ + fl_message( "could not open file" ); + return; +} + +f.read_header(); + +switch ( f.format() ) +{ + case 0: + if ( ! pattern::import( &f, 0 ) ) + fl_message( "Error importing MIDI" ); + break; + case 1: case 2: + { + char **sa = f.track_listing(); + + if ( sa && *sa ) + { + List_Chooser tc( "Select tracks to import:", "Import" ); + + char *s; + for ( int i = 0; (s = sa[i]); ++i ) + { + tc.add( s ); + free( s ); + } + + free( sa ); + + tc.show(); + + while( tc.shown() ) + Fl::wait(); + + int n = 0; + for ( int i = 1; i <= tc.browser->size(); ++i ) + { + if ( tc.browser->selected( i ) ) + { + if ( pattern::import( &f , i - 1 ) ) + ++n; + else + WARNING( "error importing track %d", i - 1 ); + } + + } + // fl_message( "%d patterns imported.", n ); + gui_status( "Imported %d tracks as patterns", n ); + } + + break; + } +}} + xywh {0 0 40 25} + code0 {\#include "../smf.H"} + } + MenuItem {} { + label {&Export} + callback {// Fl_File_Chooser::custom_filter_label = "*.mid"; + +Fl_File_Chooser *fc = new Fl_File_Chooser( ".", "MIDI Files (*.mid)", Fl_File_Chooser::CREATE, "MIDI Export" ); + +fc->show(); + +// wait for user to make a choice +while( fc->shown() ) + Fl::wait(); + +if ( ! fc->value() ) + return; + +if ( tabs->value() == pattern_tab ) + ((pattern*)pattern_c->grid())->save( fc->value() );} + xywh {0 0 40 25} + code0 {\#include } + } + MenuItem {} { + label {&Quit} + callback {main_window->do_callback();} + xywh {0 0 40 25} shortcut 0x40071 color 37 + } + } + Submenu edit_menu { + label {&Edit} open + xywh {0 0 74 25} color 37 + } { + MenuItem {} { + label {&Events} + callback {event_editor( pattern_c->grid() );} + xywh {0 0 40 25} + } + MenuItem {} { + label {&Randomization Settings} + callback {randomization_dialog->show();} + xywh {0 0 40 25} + } + } + Submenu {} { + label {&View} open + xywh {10 10 74 25} color 37 + } { + MenuItem {} { + label {&Metronome} + callback {int val = o->menu()[ o->value() ].value(); + +if ( val ) + vmetro_widget->show(); +else + vmetro_widget->hide();} + xywh {0 0 40 25} type Toggle value 1 + } + MenuItem {} { + label {&Compacted} + callback {int val = o->menu()[ o->value() ].value(); + +pattern_c->row_compact( val ? Canvas::ON : Canvas::OFF ); + +pattern_canvas_widget->redraw();} + xywh {10 10 40 25} type Toggle value 1 + } + MenuItem {} { + label {&Follow Playhead} + callback {int val = o->menu()[ o->value() ].value(); + +config.follow_playhead = val ? true : false;} + xywh {10 10 40 25} type Toggle value 1 + } + Submenu {} { + label {Note Shape} open + xywh {0 0 74 24} + } { + MenuItem {} { + label Box + callback {pattern::note_shape = BOX; + pattern_canvas_widget->redraw();} + xywh {0 0 40 24} type Radio + } + MenuItem {} { + label Square + callback {pattern::note_shape = SQUARE; + pattern_canvas_widget->redraw();} + xywh {0 0 40 24} type Radio value 1 + } + } + MenuItem {} { + label {&Theme} + callback {fl_theme_chooser();} + xywh {0 0 40 24} + } + } + Submenu {} { + label {&Help} open + xywh {100 0 74 25} color 37 + } { + MenuItem {} { + label {&Keys} + callback {show_help_dialog( "KEYS" );} + xywh {0 0 40 25} + } + MenuItem {} { + label {&Manual} + callback {show_help_dialog( "MANUAL" );} + xywh {10 10 40 25} divider + } + MenuItem {} { + label {&About} + callback {About_Dialog ab( PIXMAP_PATH "/non-sequencer/icon-256x256.png" ); + + ab.logo_box->label( VERSION ); + + ab.title->label( "The Non Sequencer" ); + + ab.copyright->label( "Copyright (C) 2007-2012 Jonathan Moore Liles" ); + ab.credits->label( "Non-Sequencer was written from scratch by\\nJonathan Moore Liles for his own use\\n(see the manual).\\n\\nNobody planned. Nobody helped.\\nYou can help now by donating time, money,\\nand/or replacing the rest of Linux Audio\\nwith fast, light, reliable alternatives.\\n" ); + + ab.website_url->label( "http://non-sequencer.tuxfamily.org" ); + +ab.run();} + xywh {0 0 40 25} color 37 + code0 {\#include "../non.H"} + } + } + } + Fl_Button sm_indicator { + label SM + xywh {825 8 35 15} box ROUNDED_BOX down_box ROUNDED_BOX color 46 selection_color 93 labelfont 3 labelcolor 39 deactivate + } + } + } + } + Function {make_seq_window()} {open + } { + Fl_Window seq_window { + label {Non Sequencer - Sequence} + callback {sequence_tab->activate(); +o->hide(); +detach_button->value( 0 );} open + xywh {681 189 876 675} type Double hide resizable + } { + Fl_Group seq_detached_group {open + xywh {0 0 876 675} resizable + } {} + } + } + Function {make_randomization_dialog()} {} { + Fl_Window randomization_dialog { + label {Randomization Settings} open + xywh {656 39 340 95} type Double hide + code0 {// feel->value( )} + code1 {probability->value( song.random.probability );} non_modal + } { + Fl_Choice feel { + label {Feel: 1/} + callback {song.random.feel = atoi( o->menu()[ find_numeric_menu_item( o->menu(), o->value() ) ].text );} open + xywh {67 55 50 24} down_box BORDER_BOX + } { + MenuItem {} { + label 4 + xywh {10 10 40 25} + } + MenuItem {} { + label 8 + xywh {0 0 40 25} + } + MenuItem {} { + label 16 + xywh {10 10 40 25} + } + } + Fl_Box {} { + label {Randomization Settings} + xywh {10 15 321 28} box ROUNDED_BOX color 94 labelsize 22 labelcolor 39 + } + Fl_Counter probability { + label Probability + callback {song.random.probability = o->value();} + xywh {216 53 112 26} type Simple align 4 when 4 minimum 0 maximum 1 step 0.01 + } + } + } + Function {update_pattern_widgets()} {open + } { + code {if ( ! pattern_settings_group ) + return; + +pattern *g = (pattern *)pattern_c->grid(); + +pattern_number_spinner->value( g->number() ); +pattern_name_field->value( g->name() ); +pattern_channel_spinner->value( 1 + g->channel() ); +pattern_port_spinner->value( 1 + g->port() ); +pattern_solo_button->value( g->mode() == SOLO ); +pattern_mute_button->value( g->mode() == MUTE ); + +if ( g->mapping.key() == -1 ) + pattern_key_combo->deactivate(); +else +{ + pattern_key_combo->activate(); + pattern_key_combo->value( g->mapping.key() ); +} + +mapping_text->value( g->mapping.name() ); + + + +pattern_note_combo->value( find_numeric_menu_item( menu_pattern_note_combo, g->note() )); +pattern_res_combo->value( find_numeric_menu_item( menu_pattern_res_combo, g->resolution() )); + +if ( g->notes() ) + pattern_notes_buffer->text( g->notes() ); +else + pattern_notes_buffer->text( strdup( "" ) );} {} + } + Function {update_phrase_widgets()} {} { + code {phrase *g = (phrase *)phrase_c->grid(); + +if ( ! g ) + return; + +g->viewport.y = 0; +g->viewport.h = pattern::patterns(); +phrase_c->resize_grid(); +phrase_c->changed_mapping(); +phrase_number_spinner->value( g->number() ); +phrase_name_field->value( g->name() ); +phrase_solo_button->value( g->mode() == SOLO ); +phrase_mute_button->value( g->mode() == MUTE ); + +if ( g->notes() ) + phrase_notes_buffer->text( g->notes() ); +else + phrase_notes_buffer->text( strdup( "" ) );} {} + } + Function {update_sequence_widgets()} {open + } { + code {if ( playlist->notes() ) + sequence_notes_buffer->text( playlist->notes() ); +else + sequence_notes_buffer->text( strdup( "" ) ); + +sequence_name_field->value( playlist->name() ); + +sequence_phrase_choice->clear(); + +for ( int i = 1; i <= phrase::phrases(); i++ ) +{ + phrase *p = phrase::phrase_by_number( i ); + + if ( p ) + sequence_phrase_choice->add( p->name() ); +} + + +Fl_Browser *o = playlist_browser; + +int val = o->value(); + +o->clear(); + +char *s = playlist->dump(); + +char *l = strtok( s, "\\n" ); + +o->add( "@b@C2Bar\\t@b@C2\#\\t@b@C2Name" ); + +if ( ! l ) + return; + +o->add( l ); + +while ( ( l = strtok( NULL, "\\n" ) ) ) +{ + o->add( l ); +} + +o->value( val ); + +free( s ); + + +if ( playback_mode_menu ) + playback_mode_menu->value( song.play_mode );} {} + } + Function {update_mapping_menu()} {open + } { + code {char **sa = Instrument::listing(); + +if ( sa ) +{ + + for ( int i = 0; sa[i]; i++ ) + { + char pat[512]; + snprintf( pat, 512, "Instrument/%s", sa[i] ); + mapping_menu->add( pat, 0, 0, 0, 0 ); + free( sa[i] ); + } + free( sa ); +} + +sa = Scale::listing(); +for ( int i = 0; sa[i]; i++ ) +{ + char pat[512]; + snprintf( pat, 512, "Scale/%s", sa[i] ); + mapping_menu->add( pat, 0, 0, 0, 0 ); + free( sa[i] ); +} +free( sa );} {} + } + Function {update_canvas_widgets()} {return_type {static void} + } { + code {if ( pattern_c->grid() ) + ui->update_pattern_widgets(); + +if ( phrase_c->grid() ) + ui->update_phrase_widgets();} {} + } + Function {find_numeric_menu_item( const Fl_Menu_Item *menu, int n )} {return_type {static int} + } { + code {for ( unsigned int i = 0; menu[i].text; i++ ) +{ + if ( atoi( menu[i].text ) == n ) + return i; +} + +return 0;} {} + } + Function {save_dialog( const char *name )} {open return_type void + } { + code {if ( ! name ) +{ + + Fl_File_Chooser *fc = new Fl_File_Chooser( ".", "Non Sequences (*.non)", Fl_File_Chooser::CREATE, "Save sequence" ); + + fc->show(); + + // wait for user to make a choice + while( fc->shown() ) + Fl::wait(); + + if ( ! fc->value() ) + return; + + name = fc->value(); +} + +if ( ! save_song( name ) ) + fl_alert( "Could not save song" ); +else + gui_status( "Saved." );} {} + } + Function {show_help_dialog( const char *file )} {return_type void + } { + code {char pat[256]; + +snprintf( pat, 256, "file://%s/non-sequencer/%s.html", DOCUMENT_PATH, file ); + +open_url( pat );} {} + } + Function {maybe_save_song()} {open return_type bool + } { + code {if ( song.dirty() ) +{ + int c = fl_choice( "Song has been modified since last save. What shall I do?", "&Cancel", "&Save", "&Discard" ); + + switch ( c ) + { + case 0: + return false; + case 1: + /* SAVE */ + save_dialog( song.filename ); + break; + case 2: + break; + } +} + +return true;} {} + } + Function {switch_to_pattern( int n )} {return_type void + } { + code {pattern *p = pattern::pattern_by_number( n ); + +if ( p ) +{ + + + + tabs->value( pattern_tab ); + + pattern_canvas_widget->take_focus(); + + pattern_c->grid( p ); + +// update_pattern_widgets(); +}} {} + } + Function {edit_instrument_row( Instrument *i, int n )} {open return_type void + } { + code {Instrument_Editor ie; + +ie.set( i, n ); + +ie.run();} {} + } +} + +Function {shortcut_handler( int e )} {return_type int +} { + code {if ( e != FL_SHORTCUT ) + return 0; + + +// this is for mainwindow shortcuts only, ignore all other windows. +if ( Fl::first_window() != ui->main_window ) + return 0; + +int processed = 0; + +// shortcuts that don't fit anywhere else (widgets that don't take shortcuts, etc.) + +\#define KEY(key) ((Fl::test_shortcut( (key) ))) + + processed = 1; + if KEY( FL_ALT + 's' ) + { + ui->tabs->value( ui->sequence_tab ); + ui->tabs->do_callback(); + } + else + if KEY( FL_ALT + 'a' ) + { + ui->tabs->value( ui->phrase_tab ); + ui->tabs->do_callback(); + } + else + if KEY( FL_ALT + 'p' ) + { + ui->tabs->value( ui->pattern_tab ); + ui->tabs->do_callback(); + } + else + if KEY( FL_ALT + 'c' ) + ui->pattern_channel_spinner->take_focus(); + else + if KEY( FL_ALT + 'o' ) + ui->pattern_port_spinner->take_focus(); + else + if KEY( FL_ALT + 'i' ) + ui->mapping_menu->take_focus(); + else + processed = 0; + +return processed;} {} +} + +class O_Canvas {open : {public Fl_Widget} +} { + decl {Canvas *_c;} {private local + } + decl {bool _border_drawn;} {private local + } + Function {O_Canvas( int X, int Y, int W, int H, const char*L=0) : Fl_Widget(X,Y,W,H,L)} {open + } { + code {_c = NULL; +_border_drawn = false; + box(FL_FLAT_BOX);} {} + } + Function {handle( int m )} {open return_type int + } { + code {// Accept focus if offered. +if ( m == FL_FOCUS || m == FL_UNFOCUS ) +{ + _border_drawn = false; + redraw_playhead(); + return 1; +} + +// Hack in click-to-focus +if ( m == FL_PUSH ) + if ( Fl::event_inside( this ) ) + take_focus(); + + +if ( Fl_Widget::handle( m ) ) + return 1; + +// Ignore events unless we have the focus. +if ( this != Fl::focus() ) + return 0; + +// MESSAGE( "got event %i for canvas %p", m, _c ); + +int p = 0; + +if ( _c ) + { + p = canvas_input_callback( this, _c, m ); + } + +return p;} {} + } + Function {resize( int x, int y, int w, int h )} {open + } { + code {Fl_Widget::resize( x, y, w, h ); + +if ( _c ) +{ + DMESSAGE( "Resizing canvas." ); + _c->resize( x + 1, y + 1, w - 1, h - 1 ); +} + + +// Fl_Window::resize( x, y, w, h );} {} + } + Function {draw()} {open return_type void + } { + code {draw_border(); + +//if ( ! takesevents() ) +// return; + +if ( _c ) +{ +/* + if ( damage() & FL_DAMAGE_ALL ) printf( " damage_all" ); + if ( damage() & FL_DAMAGE_SCROLL ) printf( " damage_scroll" ); + if ( damage() & FL_DAMAGE_USER1 ) printf( " damage_user1" ); + if ( damage() & FL_DAMAGE_USER2 ) printf( " damage_user2" ); + if ( damage() & FL_DAMAGE_EXPOSE ) printf( " damage_expose" ); + printf("\\n"); +*/ + + if ( damage() & FL_DAMAGE_ALL ) + { + draw_box( FL_FLAT_BOX, x(), y(), w(), h(), canvas_background_color ); + _border_drawn = false; + draw_border(); + _c->redraw(); + _c->draw_playhead(); + } + else + { + if ( damage() & FL_DAMAGE_SCROLL ) + { + // optimized draw + _c->draw(); + } + if ( damage() & FL_DAMAGE_USER1 ) + { + // playhead + _c->draw_playhead(); + } + } +} +else +{ + WARNING( "No canvas set for widget." ); +}} {} + } + Function {set_canvas( Canvas *c )} {open + } { + code {_c = c; + +_c->resize( x(), y(), w(), h() ); + +_c->signal_draw.connect( sigc::mem_fun( this, &O_Canvas::redraw_notes ) ); +_c->signal_resize.connect( sigc::mem_fun( this, &O_Canvas::clear ) ); + +_c->signal_settings_change.connect( sigc::ptr_fun( &UI::update_canvas_widgets ) ); +_c->signal_settings_change.connect( sigc::mem_fun( song, &song_settings::set_dirty ) );} {} + } + Function {click_to_focus()} {open return_type bool + } { + code {return true;} {} + } + Function {clear( void )} {open return_type void + } { + code {redraw();} {} + } + Function {redraw_notes( void )} {open return_type void + } { + code {damage( FL_DAMAGE_SCROLL ); + +// this might be called from within draw(), in which case the above does nothing.} {} + } + Function {redraw_playhead( void )} {open return_type void + } { + code {if ( _c && _c->playhead_moved() ) + { + damage( FL_DAMAGE_USER1 ); + }} {} + } + Function {draw_border()} {open return_type void + } { + code {if ( _border_drawn ) + return; + +if ( this != Fl::focus() ) + fl_color( FL_RED ); +else + fl_color( FL_BLACK ); + +fl_line_style( FL_DASH ); +fl_rect( x(), y(), w(), h() ); +fl_line_style( FL_SOLID ); + +_border_drawn = true;} {} + } + Function {handle_pan( void )} {open return_type void + } { + code {int up, left, right, down; + +if ( ! ui ) + return; +_c->can_scroll( &left, &right, &up, &down ); + +if ( left == 0 ) + ui->scroll_left_box->hide(); +else + ui->scroll_left_box->show(); + +if ( up == 0 ) + ui->scroll_up_box->hide(); +else + ui->scroll_up_box->show(); + +if ( down == 0 ) + ui->scroll_down_box->hide(); +else + ui->scroll_down_box->show(); + +ui->scroll_right_box->hide();} {} + } +} + +class Instrument_Editor {} { + Function {Instrument_Editor()} {open return_type void + } { + code {make_window();} {} + } + decl {Instrument *_inst;} {private local + } + decl {int _note;} {private local + } + Function {make_window()} {open + } { + Fl_Window window { + label {Instrument Editor} + callback {done->do_callback();} open + xywh {670 458 335 190} type Double hide + } { + Fl_Box {} { + label {Instrument Row} + xywh {8 15 321 28} box ROUNDED_BOX color 94 labelsize 22 labelcolor 39 + } + Fl_Input name_field { + label Name + callback {_inst->note_name( _note, strdup( o->value() ) );} + xywh {10 70 321 25} selection_color 48 align 1 when 1 textcolor 32 + } + Fl_Value_Slider volume_slider { + label {Volume %} + callback {_inst->velocity( _note, o->value() );} + xywh {10 112 321 27} type Horizontal align 1 maximum 100 step 1 textsize 14 + } + Fl_Value_Output note_field { + label {Note:} + xywh {52 158 43 24} + } + Fl_Return_Button done { + label Done + callback {if ( _inst ) + _inst->save(); + +window->hide();} + xywh {255 157 76 25} + } + } + } + Function {set( Instrument *i, int n )} {open return_type void + } { + code {_inst = i; +_note = n; + +volume_slider->value( i->velocity( n ) ); +name_field->value( i->note_name( n ) ); +note_field->value( n );} {} + } + Function {run()} {open return_type void + } { + code {window->show(); + +while ( window->shown() ) + Fl::wait();} {} + } +} + +class Trigger {open : {public Fl_Dial} +} { + Function {Trigger( int X, int Y, int W, int H, const char *L ) : Fl_Dial( X, Y, W, H, L )} {open + } { + code {} {} + } + Function {handle( int m )} {open return_type int + } { + code {int r = 0; + +switch ( m ) +{ + case FL_PUSH: + { + switch ( Fl::event_button() ) + { + case 1: + { + pattern *p = pattern::pattern_by_number( atoi( label() ) ); + + if ( p ) + { + if ( TRIGGER == song.play_mode ) + { + if ( p->playing() ) + p->stop(); + else + p->trigger(); + } + else + { + if ( p->mode() == PLAY ) + p->mode( MUTE ); + else + p->mode( PLAY ); + } + } + + break; + } + case 2: + { + pattern *p = pattern::pattern_by_number( atoi( label() ) ); + + if ( p ) + { + if ( p->mode() != SOLO ) + p->mode( SOLO ); + else + p->mode( PLAY ); + } + + break; + } + case 3: + { + ui->switch_to_pattern( atoi( label() ) ); + } + break; + } + r = 1; + break; + } + case FL_RELEASE: + do_callback(); + r = 1; + break; + case FL_DRAG: + r = 1; + break; + default: + r = Fl_Widget::handle( m ); + break; +} + + +return r;} {} + } +} + +widget_class Triggers {open + xywh {335 80 1278 1003} type Double hide resizable + code0 {populate();} + code1 {\#include } + class Fl_Group +} { + Fl_Pack rows {open + xywh {25 25 15 15} + } {} + Function {populate( void )} {open private return_type void + } { + code {_timer = 0; + +int bw = (w() / 16); +int bh = h() / (128/ 16); + +begin(); + +for ( int n = 0; n < 128 ; n += 16 ) +{ + Fl_Pack *p = new Fl_Pack( 0, 0, 25, 25 ); + + p->type( Fl_Pack::HORIZONTAL ); + + for ( int i = 0; i < 16; i++ ) + { + + Trigger *b = new Trigger( 0, 0, bw, 50, "Num" ); + + char pat[4]; + + sprintf( pat, "%d", n + i + 1 ); + + b->label( strdup( pat ) ); + b->minimum( 0 ); + b->maximum( 1 ); + b->angles( 0, 360 ); + b->type( FL_FILL_DIAL ); + b->color2( FL_GRAY ); + b->box( FL_ROUNDED_BOX ); +// b->down_box( FL_ROUNDED_BOX ); + b->selection_color( FL_GREEN ); + b->color( FL_BLACK ); + b->align( FL_ALIGN_CENTER ); + + p->add( b ); + } + + p->end(); + + p->resize( 0, 0, w(), bh ); + rows->add( p ); +} + + +end(); + +rows->resize( x(), y(), w(), h() ); + +redraw();} {} + } + Function {update( void )} {open return_type void + } { + code {++_timer; + + if ( !visible_r() ) + return; + +if ( ! takesevents() ) + return; + + Fl_Color mode_color[3]; + +// mode_color[PLAY] = fl_color_average( FL_GRAY, FL_GREEN, 0.5 ); + mode_color[PLAY] = FL_DARK2; + mode_color[MUTE] = FL_LIGHT2; + mode_color[SOLO] = fl_color_average( FL_GRAY, FL_RED, 0.5 ); + +int i; +for ( i = 0; i < MAX_PATTERN; i++ ) +{ + + + Trigger *b = (Trigger*)(((Fl_Pack*)rows->child( i / 16 ))->child( i % 16 )); + + if ( i >= pattern::patterns() ) + { + b->color( FL_BLACK ); + b->value( 0 ); + continue; + } + + pattern *p = pattern::pattern_by_number( i + 1 ); + + if ( p->playing() ) + { + b->color( FL_GRAY ); + + b->selection_color( mode_color[ p->mode() ] ); + + if ( p->queue() >= 0 ) + { + if ( _timer % 16 < 8 ) + { + b->color( mode_color[ p->queue() ] ); + } + } + + b->value( (double)p->index() / p->length() ); + } + else + { + b->value( 0 ); + } + +}} {} + } + Function {resize( int X, int Y, int W, int H )} {open return_type void + } { + code {for ( int i = rows->children(); i--; ) +{ + Fl_Pack *p = (Fl_Pack*) rows->child( i ); + + for ( int j = p->children(); j--; ) + { + int bw = W / p->children(); + p->child( j )->resize( 0, 0, bw, 25 );; + } + + p->resize( 0, 0, W, H / rows->children() ); + + p->redraw(); +} + +Fl_Group::resize( X, Y, W, H );} {} + } + decl {unsigned long _timer;} {private local + } +} diff --git a/sequencer/src/gui/widgets.fl b/sequencer/src/gui/widgets.fl new file mode 100644 index 0000000..a25b314 --- /dev/null +++ b/sequencer/src/gui/widgets.fl @@ -0,0 +1,209 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0108 +header_name {.H} +code_name {.C} +comment {// +// Copyright (C) 2008 Jonathan Moore Liles +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +} {in_source in_header +} + +class List_Chooser {} { + Function {List_Chooser( const char *name, const char *action )} {open + } { + Fl_Window window {open + xywh {696 57 310 524} type Single non_modal size_range {310 524 0 0} visible + } { + Fl_Pack {} {open + xywh {2 10 303 501} + code0 {o->spacing( 20 );} + } { + Fl_Browser browser { + label name + xywh {15 30 280 447} type Multi color 32 selection_color 47 align 1 textcolor 55 resizable + code0 {o->label( name );} + } + Fl_Group {} {open + xywh {17 485 278 26} + } { + Fl_Button {} { + label Cancel + callback {browser->clear(); +window->hide();} + xywh {17 485 75 26} + } + Fl_Return_Button button { + label action + callback {window->hide();} + xywh {105 485 190 26} + code0 {o->label( action );} + } + } + } + } + } + Function {show()} {open + } { + code {window->show();} {} + } + Function {shown()} {open return_type bool + } { + code {return window->shown();} {} + } + Function {add( const char *item )} {open + } { + code {browser->add( item );} {} + } +} + +decl {\#include "../transport.H"} {public +} + +decl {extern Fl_Color velocity_colors[];} {} + +decl {\#include } {} + +decl {\#include } {} + +decl {\#include } {} + +widget_class Visual_Metronome {open selected + xywh {763 217 1278 1003} type Single resizable + code0 {_bpb = _tpb = -1; _beat = _tick = _flip = 0;} + code1 {this->box( FL_NO_BOX );} + code2 {this->label( 0 );} + class Fl_Group visible +} { + Fl_Slider progress { + private xywh {119 95 1149 23} type Horizontal box THIN_UP_BOX color 32 selection_color 71 + code0 {o->resize( x(), (y() + h()) - (h() / 3), w(), h() / 3 );} + code1 {o->slider_size( 0.25 );} + code2 {o->slider( FL_THIN_UP_BOX );} + } + Fl_Pack pack {open + private xywh {119 7 1149 78} type HORIZONTAL resizable + code0 {o->resize( x(), y(), w(), h() - progress->h() );} + } {} + decl {int _bpb} {} + decl {int _tpb} {} + decl {int _beat} {} + decl {bool _flip} {} + decl {int _tick} {} + Function {bpb( int b )} {open private return_type void + } { + code {if ( b == _bpb ) + return; + +_bpb = b; + +pack->clear(); + +int bw = w() / _bpb; + +for ( int i = 1; i <= b; ++i ) +{ + Fl_Box *box = new Fl_Box( FL_THIN_UP_BOX, 0, 0, bw, 1, 0 ); + + char *pat = (char *)malloc( 4 ); + + sprintf( pat, "%d", i ); + + box->label( pat ); + box->color( fl_lighter( FL_GRAY ) ); + box->color2( FL_GRAY ); + pack->add( box ); +} + + +// try to clear the background. + +parent()->parent()->damage( FL_DAMAGE_ALL, x(), y(), w(), h() ); +redraw();} {} + } + Function {tpb( int ticks )} {open private return_type void + } { + code {_tpb = ticks; + +progress->minimum( 0 ); +progress->maximum( ticks );} {} + } + Function {beat( int b )} {open private return_type void + } { + code {if ( b == _beat || b >= _bpb ) + return; + + +pack->child( _beat )->color( fl_lighter( FL_GRAY ) ); +pack->child( _beat )->redraw(); + +pack->child( b )->color( velocity_colors[ b * 127 / _bpb ] ); +pack->child( b )->redraw(); + +_flip = ! _flip; + +_beat = b;} {} + } + Function {tick( int tick )} {open private return_type void + } { + code {if ( tick == _tick ) + return; + +if ( _beat < 0 ) + return; + +if ( _flip ) +{ + progress->selection_color( FL_RED ); + progress->value( _tpb - tick ); +} +else +{ + progress->selection_color( FL_GREEN ); + progress->value( tick ); +} + +\#if 0 +Fl_Widget *c = pack->child( _beat ); + +if ( c ) +{ + c->color( velocity_colors[ tick * 127 / _tpb ] ); + c->redraw(); +} +\#endif + +_tick = tick;} {} + } + Function {resize( int X, int Y, int W, int H )} {open return_type void + } { + code {// pack->resize( 0, 0, W, pack->h() ); + + +Fl_Group::resize( X, Y, W, H ); + +for ( int i = pack->children(); i-- ; ) + pack->child( i )->resize( 0, 0, W / pack->children(), pack->h() );} {} + } + Function {update( void )} {open return_type void + } { + code {if ( transport.beats_per_bar ) { +bpb( transport.beats_per_bar ); +tpb( transport.ticks_per_beat ); +beat( transport.beat - 1 ); +tick( transport.tick - 1 );}} {} + } +} diff --git a/sequencer/src/instrument.C b/sequencer/src/instrument.C new file mode 100644 index 0000000..7907ca4 --- /dev/null +++ b/sequencer/src/instrument.C @@ -0,0 +1,326 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include +#include +#include + +#include "instrument.H" +#include "common.h" +#include "const.h" +#include "config.h" + +#include "non.H" + +#include +#include + + +#include +#include + +using std::list; +using std::string; + +/****** + Instrument definition file format is thus: + + "Name", n, v + + Where /n/ is a note number from 0 to 127 and /v/ is a percentage of + volume. + + When a system installed instrument definition is modified, the + modified version is saved in the user's $HOME. Therefore, when + loading instruments, user defined instruments always hide system + defined instruments of the same name. + +*/ + +list Instrument::instruments; + +Instrument::Instrument ( const char *name ) +{ + + for ( int i = 0; i < 128; i++ ) + { + _map[i].name = NULL; + _map[i].velocity = 100; + } + + if ( name ) + { + _name = strdup( name ); + + read( name ); + } + else + { + _name = strdup( "not an instrument" ); + _height = 0; + } + + Instrument::instruments.push_front( this ); +} + +Instrument * +Instrument::open ( const char *name ) +{ + list ::iterator i = Instrument::instruments.begin(); + + if ( name ) + { + for ( ; i != Instrument::instruments.end(); i++ ) + if ( 0 == strcmp( (*i)->_name, name ) ) + return *i; + } + + return new Instrument ( name ); +} + +void +Instrument::note_name ( int n, char *s ) +{ + if ( _map[ n ].name ) + free( _map[ n ].name ); + + _map[ n ].name = s; + + _dirty = true; +} + +void +Instrument::velocity ( int n, int v ) +{ + _map[ n ].velocity = v; + + _dirty = true; +} + +/** Translate event, should only be passed NOTE ON/OFF events, returns + true if note is valid for this mapping */ +bool +Instrument::translate ( midievent *e ) const +{ + if ( ! note_name( e->note() ) ) + return false; + + e->note_velocity( e->note_velocity() * _map[ e->note() ].velocity / 100 ); + + return true; +} + +const char * +Instrument::note_name ( int n ) const +{ + return _map[ n ].name; +} + +int +Instrument::height ( void ) const +{ + return _height; +} + +int +Instrument::velocity ( int n ) const +{ + return _map[ n ].velocity; +} + +bool +Instrument::read ( const char *s ) +{ + FILE *fp; + + char pat[512]; + + sprintf( pat, "%s%s.inst", config.user_config_dir, s ); + + if ( ! ( fp = fopen( pat, "r" ) ) ) + { + + sprintf( pat, "%s%s.inst", SYSTEM_PATH INSTRUMENT_DIR, s ); + + if ( ! ( fp = fopen( pat, "r" ) ) ) + return false; + } + + struct i_map m; + char namebuf[256]; + int note, velocity; + + int n = 0; + while ( 0 < fscanf( fp, "\"%[^\"]\", %d, %d\n", (char*)&namebuf, ¬e, &velocity ) ) n++; + + rewind( fp ); + + MESSAGE( "reading %d lines from instrument file \"%s\"", n, s ); + + int i; + for ( i = 0; i < n; i++ ) + { + fscanf( fp, "\"%[^\"]\", %d, %d\n", (char *)&namebuf, ¬e, &velocity ); + + m.name = strdup( namebuf ); + + if ( velocity > 100 ) + { + WARNING( "invalid volume percentage in instrument definition"); + m.velocity = 100; + } + else + m.velocity = velocity; + + DMESSAGE( "name: \"%s\", note: %d, velocity: %d%%", m.name, note, m.velocity ); + + _map[ note ] = m; + } + + _height = n; + + fclose( fp ); + + return true; +} + +bool +Instrument::write ( const char *s ) const +{ + FILE *fp; + + char pat[512]; + + sprintf( pat, "%s/%s.inst", config.user_config_dir, s ); + + if ( ! ( fp = fopen( pat, "w" ) ) ) + return false; + + int n = 0; + for ( int i = 0; i < 127; ++i ) + { + if ( _map[ i ].name ) + { + fprintf( fp, "\"%s\", %d, %d\n", _map[ i ].name, i, _map[ i ].velocity ); + ++n; + } + } + + DMESSAGE( "wrote %d lines to instrument file \"%s\"", n, pat ); + + fclose( fp ); + + return true; +} + +void +Instrument::save ( void ) const +{ + if ( _dirty ) + write( _name ); + + _dirty = false; +} + +static int +instrument_filter ( const struct dirent *d ) +{ + char suffix[] = "*.inst"; + + return 0 == fnmatch( suffix, d->d_name, 0 ); +} + +static +list * +get_listing( const char *dir ) +{ + list *sl = new list ; + + struct dirent **names; + int n; + + if ( 0 > ( n = scandir( dir, &names, instrument_filter, alphasort ) ) ) + { + WARNING( "couldn't open instrument directory" ); + return NULL; + } + else + { + while (n--) + { + char *c = rindex( names[n]->d_name, '.' ); + + if ( c ) + *c = '\0'; + + MESSAGE( "found instrument: %s", names[n]->d_name ); + + string s( names[n]->d_name ); + + sl->push_back( s ); + + free( names[n] ); + } + free( names ); + + return sl; + } +} + +/* Returns a list of available instruments */ +char ** +Instrument::listing ( void ) +{ + list *sys = get_listing( SYSTEM_PATH INSTRUMENT_DIR ); + list *usr = get_listing( config.user_config_dir ); + + if ( ! ( usr || sys ) ) + return NULL; + + if ( sys && usr ) + usr->merge( *sys ); + else + if ( sys && ! usr ) + usr = sys; + + usr->unique(); + + usr->sort(); + + if ( sys ) + delete sys; + + char **sa = (char**)malloc( (usr->size() + 1) * sizeof( char * ) ); + + int i = 0; + for ( list ::iterator s = usr->begin(); s != usr->end(); s++, i++ ) + sa[i] = strdup( s->c_str() ); + + sa[i] = NULL; + + delete usr; + + return sa; +} + +const char * +Instrument::name ( void ) const +{ + return _name; +} diff --git a/sequencer/src/instrument.H b/sequencer/src/instrument.H new file mode 100644 index 0000000..b5d4079 --- /dev/null +++ b/sequencer/src/instrument.H @@ -0,0 +1,66 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include +using std::list; + +#include "event.H" + +struct i_map { + char *name; + unsigned char velocity; +}; + +class Instrument +{ + + static list instruments; + + char *_name; + int _height; + mutable bool _dirty; + + struct i_map _map[128]; /* note / velocity mappings */ + + Instrument ( const char *name ); + bool read ( const char *s ); + bool write ( const char *s ) const; + +public: + + static Instrument * open ( const char *name ); + static char ** listing ( void ); + + /* mutation */ + void note ( int from, int to ); + void velocity ( int n, int v ); + void note_name ( int n, char *s ); + + /* inspection */ + bool translate ( midievent *e ) const; + const char * note_name ( int n ) const; + int height ( void ) const; + const char * name ( void ) const; + int velocity ( int n ) const; + + void save ( void ) const; + +}; diff --git a/sequencer/src/jack.C b/sequencer/src/jack.C new file mode 100644 index 0000000..14e214a --- /dev/null +++ b/sequencer/src/jack.C @@ -0,0 +1,640 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include +#include +#include +#include +/* jack */ +#include +#include +#include +#include + +#include "jack.H" +#include "non.H" +#include "transport.H" +#include "pattern.H" +#include "phrase.H" +#include "event_list.H" + +#ifdef JACK_MIDI_PROTO_API +/* correct for prototype version of API */ +#define jack_midi_event_reserve( p, f, l ) jack_midi_event_reserve( p, f, l, nframes ) +#define jack_midi_event_get( e, b, f ) jack_midi_event_get( e, b, f, nframes ) +#define jack_midi_get_event_count( b ) jack_midi_get_event_count( b, nframes ) +#define jack_midi_clear_buffer( b ) jack_midi_clear_buffer( b, nframes ) +#define jack_midi_event_write( b, f, d, s ) jack_midi_event_write( b, f, d, s, nframes ) +#endif + + +/* MIDI channel to listen for pattern control changes on */ +int pattern_control_channel = 0; + +/* which control change number to use for pattern control */ +int pattern_control_cc = 20; + +jack_client_t *client; + +int sample_rate; + +const int MAX_PORT = 16; + +const int subticks_per_tick = 4096; + +/* timers for notes on all channels and ports. When a note is played, + * the respective value in this array is set to the note duraction in + * subticks (an arbitrary division of the tick used only for this + * purpose). Decremented in each process cycle, when this value + * reaches zero, a note off is generated--regardless of the state of + * the transport */ +int note_duration[MAX_PORT][16][128]; + +/* tracks the number of concurrent note ons for the same note so that + * we can be sure to emit the correct number of note offs */ +int notes_on[MAX_PORT][16][128]; + +typedef unsigned char byte_t; + +int num_output_ports = 1; + +event_list freelist; + +typedef struct { + void *buf; + jack_ringbuffer_t *ring_buf; /* for realtime output and recording */ + event_list events; /* events to be output this cycle */ + jack_port_t *port; +} port_t; + +static port_t output[MAX_PORT]; +static port_t input[2]; /* control, performance */ + +jack_nframes_t nframes; /* for compatibility with older jack */ + +bool +midi_is_active ( void ) +{ + return client != NULL; +} + +/** get next recorded event, if any--runs in UI thread */ +bool +midi_input_event ( int port, midievent *me ) +{ + if ( ! midi_is_active() ) + return NULL; + + if ( jack_ringbuffer_read_space( input[ port ].ring_buf ) >= sizeof( midievent ) ) + { + if ( jack_ringbuffer_read( input[ port ].ring_buf, (char *)me, sizeof( midievent ) ) ) + return true; + } + return false; +} + + +/** + * Queue an event for output. /tick/ is relative to the current cycle! */ +void +midi_output_event ( int port, const midievent *e ) +{ + if ( ! midi_is_active() ) + return; + + event *fe = freelist.first(); + + if ( ! fe ) + { + WARNING( "output buffer underrun" ); + } + else + { + if ( e->is_note_on() ) + { + if ( notes_on[ port ][ e->channel() ][ e->note() ] == 0 ) + { + freelist.unlink( fe ); + *fe = *e; + + output[ port ].events.insert( fe ); + ++notes_on[ port ][ e->channel() ][ e->note() ]; + } + else + { + DMESSAGE( "Dropping extra Note ON" ); + } + } + else if ( e->is_note_off() ) + { + if ( notes_on[ port ][ e->channel() ][ e->note() ] == 0 ) + { + DMESSAGE( "Dropping extra Note OFF" ); + } + else + { + freelist.unlink( fe ); + *fe = *e; + + output[ port ].events.insert( fe ); + --notes_on[ port ][ e->channel() ][ e->note() ]; + } + } + else + { + freelist.unlink( fe ); + *fe = *e; + + output[ port ].events.insert( fe ); + } + } +} + +/** same as above, but only for note-on + duration */ +void +midi_output_event ( int port, const midievent *e, tick_t duration ) +{ + if ( ! midi_is_active() ) + return; + + if ( duration ) + { + note_duration[ port ][ e->channel() ][ e->note() ] = (duration + e->timestamp()) * subticks_per_tick; + midi_output_event( port, e ); + } + else + { + /* We allow duplicate notes on and pass notes off through as + * is in order to support poly synths. */ + midi_output_event( port, e ); + } +} + +void +midi_write_event ( int port, const midievent *e ) +{ + byte_t *buffer; + + // what I want here is to translate a PPQN tick into the + // current period. + jack_nframes_t frame = transport.frames_per_tick * e->timestamp(); + + int l = e->size(); + + buffer = jack_midi_event_reserve( output[ port ].buf, frame, l ); + + if ( ! buffer ) + { + WARNING( "could not reserve buffer at frame %d, note event dropped!", frame ); + return; + } + +#ifdef DEBUG_EVENTS + e->pretty_print(); +#endif + + e->raw( buffer, l ); +} + + +/** Call this to send an event immediately from UI thread. Timestamp is meaningless */ +void +midi_output_immediate_event ( int port, const midievent *e ) +{ + if ( ! midi_is_active() ) + return; + + if ( jack_ringbuffer_write( output[ port ].ring_buf, (const char *)e, sizeof( midievent ) ) != sizeof( midievent ) ) + WARNING( "output ringbuffer overrun" ); + else + if ( e->is_note_on() ) + { + /* use timestamp as duration */ + note_duration[ port ][ e->channel() ][ e->note() ] = e->timestamp() * subticks_per_tick; + } +} + +/** stop all notes on all channels of all ports */ +void +midi_all_sound_off ( void ) +{ + if ( ! midi_is_active() ) + return; + + MESSAGE( "stopping all sound" ); + + midievent e; + + /* all notes off */ + e.status( midievent::CONTROL_CHANGE ); + e.data( 123, 0 ); + e.timestamp( 0 ); + + for ( int p = MAX_PORT; p--; ) + for ( int c = 16; c--; ) + { + e.channel( c ); + midi_output_immediate_event( p, &e ); + } +} + +static void +stop_all_patterns ( void ) +{ + for ( uint i = pattern::patterns(); i--; ) + { + pattern *p = pattern::pattern_by_number( i + 1 ); + + p->stop(); + } +} + +static int +sync ( jack_transport_state_t state, jack_position_t *pos, void * ) +{ + static bool seeking = false; + + switch ( state ) + { + case JackTransportStopped: /* new position requested */ + /* JACK docs lie. This is only called when the transport + is *really* stopped, not when starting a slow-sync + cycle */ + stop_all_patterns(); + return 1; + case JackTransportStarting: /* this means JACK is polling slow-sync clients */ + { + stop_all_patterns(); + return 1; + } + case JackTransportRolling: /* JACK's timeout has expired */ + /* FIXME: what's the right thing to do here? */ +// request_locate( pos->frame ); + return 1; + break; + default: + WARNING( "unknown transport state" ); + } + + return 0; +} + + +static int +process ( jack_nframes_t nframes, void *arg ) +{ + static tick_t oph = 0; + static tick_t onph = 0; + static int old_play_mode = PATTERN; + + static int not_dropped = 0; + + ::nframes = nframes; + + transport.nframes = nframes; + transport.poll(); + + /* ph-nph is exclusive. It is important that in normal continuous playback each tick is covered exactly once! */ + const tick_t ph = transport.ticks; + const tick_t nph = transport.ticks + transport.ticks_per_period; + + if ( ! transport.valid ) + goto schedule; + + if ( ( ! transport.rolling ) || ph == oph ) + goto schedule; + + /* if ( ph != onph ) */ + /* { */ + /* if ( onph > ph ) */ + /* DWARNING( "duplicated %lu ticks (out of %d)", onph - ph, (int)(not_dropped * transport.ticks_per_period) ); */ + /* else */ + /* DWARNING( "dropped %lu ticks (out of %d), ticks per period = %f", ph - onph, (int)(not_dropped * transport.ticks_per_period) ); */ + + /* not_dropped = 0; */ + /* } */ + + ++not_dropped; + + onph = nph; + + if ( old_play_mode != song.play_mode ) + { + switch ( old_play_mode ) + { + case PATTERN: + case TRIGGER: + case QUEUE: + DMESSAGE( "Stopping all patterns" ); + stop_all_patterns(); + break; + } + old_play_mode = song.play_mode; + } + +// DMESSAGE( "tpp %f %lu-%lu", transport.ticks_per_period, ph, nph ); + + /* now handle control input */ + { + int j = CONTROL; + + static midievent e; + + input[j].buf = jack_port_get_buffer( input[j].port, nframes ); + + jack_midi_event_t ev; + + jack_nframes_t count = jack_midi_get_event_count( input[j].buf ); + + for ( uint i = 0; i < count; ++i ) + { +// MESSAGE( "Got midi input!" ); + + jack_midi_event_get( &ev, input[j].buf, i ); + + /* time is frame within cycle, convert to absolute tick */ + e.timestamp( ph + (ev.time / transport.frames_per_tick) ); + e.status( ev.buffer[0] ); + e.lsb( ev.buffer[1] ); + if ( ev.size == 3 ) + e.msb( ev.buffer[2] ); + + /* no need to pass it to the GUI, we can trigger patterns here */ + + if ( e.channel() == pattern_control_channel && + e.opcode() == midievent::CONTROL_CHANGE && + e.lsb() == pattern_control_cc ) + { + if ( e.msb() < pattern::patterns() ) + { + + pattern *p = pattern::pattern_by_number( e.msb() + 1 ); + + if ( TRIGGER == song.play_mode ) + { + if ( p->playing() ) + { + DMESSAGE( "Untriggering pattern %i ph=%lu, ts=%lu", e.msb(), ph, e.timestamp() ); + + p->trigger( ph, e.timestamp() ); + } + else + { + DMESSAGE( "Triggering pattern %i ph=%lu, ts=%lu", e.msb(), ph, e.timestamp() ); + + p->trigger( e.timestamp(), INFINITY ); + } + } + else + { + if ( p->mode() == PLAY ) + { + DMESSAGE( "Dequeuing pattern %i ph=%lu, ts=%lu", e.msb(), ph, e.timestamp() ); + p->mode( MUTE ); + } + else + { + DMESSAGE( "Queuing pattern %i ph=%lu, ts=%lu", e.msb(), ph, e.timestamp() ); + + p->mode( PLAY ); + } + } + } + } + } + } + + + switch ( song.play_mode ) + { + case SEQUENCE: + playlist->play( ph, nph ); + break; + case QUEUE: + case PATTERN: + { + for ( uint i = pattern::patterns(); i--; ) + { + pattern *p = pattern::pattern_by_number( i + 1 ); + + p->trigger( 0, INFINITY ); + + p->play( ph, nph ); + } + break; + } + case TRIGGER: + { + for ( uint i = pattern::patterns(); i--; ) + { + pattern *p = pattern::pattern_by_number( i + 1 ); + + p->play( ph, nph ); + } + break; + } + } + + oph = ph; + + /* handle midi input */ +// for ( int j = transport.recording ? 2 : 1; j--; ) + + if ( transport.recording ) + { + int j = PERFORMANCE; + + static midievent e; + + input[j].buf = jack_port_get_buffer( input[j].port, nframes ); + + jack_midi_event_t ev; + + jack_nframes_t count = jack_midi_get_event_count( input[j].buf ); + + for ( uint i = 0; i < count; ++i ) + { +// MESSAGE( "Got midi input!" ); + + jack_midi_event_get( &ev, input[j].buf, i ); + + /* time is frame within cycle, convert to absolute tick */ + e.timestamp( ph + (ev.time / transport.frames_per_tick) ); + e.status( ev.buffer[0] ); + e.lsb( ev.buffer[1] ); + if ( ev.size == 3 ) + e.msb( ev.buffer[2] ); + + if ( jack_ringbuffer_write( input[j].ring_buf, (char*)&e, sizeof( midievent ) ) != sizeof( midievent ) ) + WARNING( "input buffer overrun" ); + } + } + + +schedule: + + const int subticks_per_period = transport.ticks_per_period * subticks_per_tick; + + for ( uint i = MAX_PORT; i-- ; ) + { + /* reserve and clear buffers */ + output[ i ].buf = jack_port_get_buffer( output[ i ].port, nframes ); + jack_midi_clear_buffer( output[ i ].buf ); + + /* handle scheduled note offs */ + for ( uint j = 16; j-- ; ) + { + register int *note = ¬e_duration[ i ][ j ][ 0 ]; + + for ( register uint k = 0; k < 128; ++note, ++k ) + if ( *note > 0 ) + if ( ( *note -= subticks_per_period ) <= 0 ) + { + while ( notes_on[ i ][ j ][ k] > 0 ) + { + static midievent e; + + e.status( midievent::NOTE_OFF ); + e.channel( j ); + e.note( k ); + e.note_velocity( 64 ); + + e.timestamp( (subticks_per_period + *note) / subticks_per_tick ); + + midi_output_event( i, &e ); + } + + *note = 0; + } + } + + + static midievent e; + /* first, write any immediate events from the UI thread */ + while ( jack_ringbuffer_read( output[ i ].ring_buf, (char *)&e, sizeof( midievent ) ) ) + { +// MESSAGE( "sending immediate event" ); + // FIXME: could we do better? + e.timestamp( 0 ); + + midi_output_event( i, &e ); + } + + /* Write queued events */ + event *n; + for ( event *e = output[ i ].events.first(); e; e = n ) + { + n = e->next(); + + midi_write_event( i, e ); + + output[ i ].events.unlink( e ); + + freelist.append( e ); + } + } + + return 0; +} + +const char * +midi_init ( const char *name ) +{ + MESSAGE( "Initializing Jack MIDI" ); + + if (( client = jack_client_open ( name, (jack_options_t)0, NULL )) == 0 ) + return NULL; + + /* create output ports */ + for ( int i = 0; i < MAX_PORT; i++ ) + { + char pat[40]; + + sprintf( pat, "midi_out-%d", i + 1 ); + output[i].port = jack_port_register( client, pat, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0 ); + output[i].ring_buf = jack_ringbuffer_create( 16 * 16 * sizeof( midievent ) ); // why this value? + jack_ringbuffer_reset( output[i].ring_buf ); + + } + + /* create input ports */ + input[0].port = jack_port_register( client, "control_in", JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0 ); + input[0].ring_buf = jack_ringbuffer_create( 128 * sizeof( midievent ) ); // why this value? + jack_ringbuffer_reset( input[0].ring_buf ); + input[1].port = jack_port_register( client, "midi_in", JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0 ); + input[1].ring_buf = jack_ringbuffer_create( 128 * sizeof( midievent ) ); // why this value? + jack_ringbuffer_reset( input[1].ring_buf ); + + /* preallocate events */ + for ( int i = 32 * 16 * MAX_PORT; i-- ; ) + freelist.append( new event ); + + DMESSAGE( "allocated output buffer space for %lu events", freelist.size() ); + + /* clear notes */ + for ( int p = MAX_PORT; p--; ) + { + for ( int c = 16; c-- ; ) + for ( int n = 128; n-- ; ) + { + note_duration[ p ][ c ][ n ] = 0; + notes_on[ p ][ c ][ n ] = 0; + } + } + +//1 jack_set_buffer_size_callback( client, bufsize, 0 ); + jack_set_process_callback( client, process, 0 ); + jack_set_sync_callback( client, sync, 0 ); + +/* /\* initialize buffer size *\/ */ +/* transport_poll(); */ +/* bufsize( jack_get_buffer_size( client ), 0 ); */ + + if ( jack_set_timebase_callback( client, 1, Transport::timebase, NULL ) == 0 ) + { + MESSAGE( "running as timebase master" ); + transport.master = true; + } + else + WARNING( "could not take over as timebase master" ); + + jack_activate( client ); + + sample_rate = jack_get_sample_rate( client ); + + /* FIXME: hack! we need to wait until jack finally calls our + * timebase and process callbacks in order to be able to test for + * valid transport info. */ + MESSAGE( "Waiting for JACK..." ); + usleep( 500000 ); + + return (const char *) jack_get_client_name(client); +} + +void +midi_shutdown ( void ) +{ + // TODO: wait for all queued events to play. + if ( client ) + { + jack_deactivate( client ); + jack_client_close( client ); + client = NULL; + } +} diff --git a/sequencer/src/jack.H b/sequencer/src/jack.H new file mode 100644 index 0000000..3fdb857 --- /dev/null +++ b/sequencer/src/jack.H @@ -0,0 +1,18 @@ + +#include + +#include "common.h" + +enum { CONTROL, PERFORMANCE }; + +class midievent; + +bool midi_input_event ( int port, midievent *e ); +bool midi_is_active ( void ); +midievent * midi_input_event ( int port ); +void midi_output_event ( int port, const midievent *e ); +void midi_output_event ( int port, const midievent *e, tick_t duration ); +void midi_all_sound_off ( void ); +const char * midi_init ( const char *name ); +void midi_shutdown ( void ); +void midi_output_immediate_event ( int port, const midievent *e ); diff --git a/sequencer/src/main.C b/sequencer/src/main.C new file mode 100644 index 0000000..ccce2ef --- /dev/null +++ b/sequencer/src/main.C @@ -0,0 +1,325 @@ +/**********************************************************************************/ +/* Copyright (C) 2007,2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ; */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software ; */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/**********************************************************************************/ + +#include +#include +#include +#include + +#include "non.H" +// #include "gui/input.H" +#include "gui/ui.H" +#include "jack.H" +#include "NSM.H" + +#include "pattern.H" +#include "phrase.H" +#include + +#ifdef HAVE_XPM +#include "FL/Fl.H" +#include "FL/x.H" +#include +#include "../icons/icon-16x16.xpm" +#endif + +#include "FL/Fl_Theme.H" +#include "FL/themes.H" + +// extern const char *BUILD_ID; +// extern const char *VERSION; + +const double NSM_CHECK_INTERVAL = 0.25f; + +Canvas *pattern_c, *phrase_c, *trigger_c; + +sequence *playlist; + +global_settings config; +song_settings song; + +NSM_Client *nsm; + +char *instance_name; + +/* default to pattern mode */ + +UI *ui; + +void +quit ( void ) +{ + /* clean up, only for valgrind's sake */ + ui->save_settings(); + + delete ui; + + delete pattern_c; + delete phrase_c; + delete trigger_c; + + midi_all_sound_off(); + + // wait for it... + sleep( 1 ); + + midi_shutdown(); + + + MESSAGE( "Your fun is over" ); + + exit( 0 ); +} + +void +clear_song ( void ) +{ +// song.filename = NULL; + + pattern_c->grid( NULL ); + phrase_c->grid( NULL ); + + playlist->reset(); + playlist->insert( 0, 1 ); + pattern_c->grid( new pattern ); + phrase_c->grid( new phrase ); + + song.dirty( false ); +} + +void +init_song ( void ) +{ + if ( ! midi_is_active() ) + setup_jack(); + + if ( !( nsm && nsm->is_active() ) ) + song.filename = NULL; + + clear_song(); + + if ( nsm && nsm->is_active() ) + save_song( song.filename ); +} + +void +handle_midi_input ( void ) +{ + midievent e; + while ( ( midi_input_event( PERFORMANCE, &e ) ) ) + { + pattern::record_event( &e ); + } +} + +bool +load_song ( const char *name ) +{ + if ( ! midi_is_active() ) + setup_jack(); + + MESSAGE( "loading song \"%s\"", name ); + + Grid *pattern_grid = pattern_c->grid(); + Grid *phrase_grid = phrase_c->grid(); + + pattern_c->grid( NULL ); + phrase_c->grid( NULL ); + + if ( ! playlist->load( name ) ) + { + WARNING( "failed to load song file" ); + goto failed; + } + + pattern_c->grid( pattern::pattern_by_number( 1 ) ); + phrase_c->grid( phrase::phrase_by_number( 1 ) ); + + song.filename = strdup( name ); + + song.dirty( false ); + + return true; + +failed: + + pattern_c->grid( pattern_grid ); + phrase_c->grid( phrase_grid ); + + return false; +} + +bool +save_song ( const char *name ) +{ + playlist->save( name ); + + song.filename = strdup( name ); + song.dirty( false ); + + return true; +} + + +void +setup_jack ( ) +{ + const char *jack_name; + + jack_name = midi_init( instance_name ); + if ( ! jack_name ) + ASSERTION( "Could not initialize MIDI system! (is Jack running and with MIDI ports enabled?)" ); + + if ( ! transport.valid ) + { + if ( transport.master ) + ASSERTION( "The version of JACK you are using does not appear to be capable of passing BBT positional information." ); + else + ASSERTION( "Either the version of JACK you are using does pass BBT information, or the current timebase master does not provide it." ); + } +} + +static int got_sigterm = 0; + +void +sigterm_handler ( int ) +{ + got_sigterm = 1; + Fl::awake(); +} + +void +check_sigterm ( void * ) +{ + if ( got_sigterm ) + { + MESSAGE( "Got SIGTERM, quitting..." ); + quit(); + } +} + + +void +check_nsm ( void * v ) +{ + nsm->check(); + Fl::repeat_timeout( NSM_CHECK_INTERVAL, check_nsm, v ); +} + +int +main ( int argc, char **argv ) +{ + + printf( "%s %s %s -- %s\n", APP_TITLE, VERSION, "", COPYRIGHT ); + + if ( ! Fl::visual( FL_DOUBLE | FL_RGB ) ) + { + WARNING( "Xdbe not supported, FLTK will fake double buffering." ); + } + +#ifdef HAVE_XPM + fl_open_display(); + Pixmap p, mask; + + XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display), + (char**)icon_16x16, &p, &mask, NULL); +#endif + + ::signal( SIGTERM, sigterm_handler ); + ::signal( SIGHUP, sigterm_handler ); + ::signal( SIGINT, sigterm_handler ); + + config.follow_playhead = true; + config.record_mode = MERGE; + song.play_mode = PATTERN; + song.random.feel = 8; + song.random.probability = 0.33; + + asprintf( &config.user_config_dir, "%s/%s", getenv( "HOME" ), USER_CONFIG_DIR ); + mkdir( config.user_config_dir, 0777 ); + + playlist = new sequence; + + pattern_c = new Canvas; + phrase_c = new Canvas; + trigger_c = new Canvas; + + nsm = new NSM_Client; + + song.filename = NULL; + clear_song(); + + pattern::signal_create_destroy.connect( mem_fun( phrase_c, &Canvas::v_zoom_fit ) ); + pattern::signal_create_destroy.connect( mem_fun( song, &song_settings::set_dirty ) ); + phrase::signal_create_destroy.connect( mem_fun( song, &song_settings::set_dirty ) ); + + // + song.dirty( false ); + + init_colors(); + + ui = new UI; + +#ifdef HAVE_XPM + ui->main_window->icon((char *)p); +#endif + ui->main_window->show( 0, 0 ); + + fl_register_themes(); + + Fl_Theme::set(); + + instance_name = strdup( APP_NAME ); + + const char *nsm_url = getenv( "NSM_URL" ); + + if ( nsm_url ) + { + if ( ! nsm->init( nsm_url ) ) + { + nsm->announce( APP_NAME, ":switch:dirty:", argv[0] ); + + song.signal_dirty.connect( sigc::mem_fun( nsm, &NSM_Client::is_dirty ) ); + song.signal_clean.connect( sigc::mem_fun( nsm, &NSM_Client::is_clean ) ); + + // poll so we can keep OSC handlers running in the GUI thread and avoid extra sync + Fl::add_timeout( NSM_CHECK_INTERVAL, check_nsm, NULL ); + } + else + WARNING( "Error initializing NSM" ); + } + else + { + setup_jack(); + if ( argc > 1 ) + { + /* maybe a filename on the commandline */ + if ( ! load_song( argv[ 1 ] ) ) + ASSERTION( "Could not load song \"%s\" specified on command line", argv[ 1 ] ); + } + } + + MESSAGE( "Initializing GUI" ); + + Fl::add_check( check_sigterm ); + + ui->load_settings(); + ui->run(); + + return 0; +} diff --git a/sequencer/src/mapping.C b/sequencer/src/mapping.C new file mode 100644 index 0000000..a59262a --- /dev/null +++ b/sequencer/src/mapping.C @@ -0,0 +1,168 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "mapping.H" +#include "stdlib.h" +#include "common.h" + +/* Is C++'s dispatching useless or what? */ + +#define IS_INSTRUMENT ( _type == INSTRUMENT ) + +Mapping::Mapping ( ) +{ + _key = 0; + _type = NONE; +} + +bool +Mapping::open ( enum map_type type, const char *name ) +{ + switch ( type ) + { + case INSTRUMENT: + _instrument = Instrument::open( name ); + break; + case SCALE: + _scale = Scale::open( name ); + break; + default: + ASSERTION( "invalid mapping type "); + break; + } + + if ( ! _scale ) + return false; + + _type = type; + + return true; +} + +Mapping::Mapping ( const Mapping &rhs ) +{ + _key = rhs._key; + _type = rhs._type; + _instrument = rhs._instrument; +} + +const char * +Mapping::name ( void ) const +{ + switch ( _type ) + { + case INSTRUMENT: + return _instrument->name(); + case SCALE: + return _scale->name(); + } + + return NULL; +} + + +int +Mapping::height ( void ) const +{ + if ( IS_INSTRUMENT ) + return _instrument->height(); + else + return 0; +} + +void +Mapping::key ( int n ) +{ + if ( n > 11 || n < 0 ) + ASSERTION( "key selection out of range: %d", n ); + + _key = n; +} + +int +Mapping::key ( void ) const +{ + return _type == INSTRUMENT ? -1 : _key; +} + +bool +Mapping::translate ( midievent *e ) const +{ + switch ( _type ) + { + case INSTRUMENT: + return _instrument->translate( e ); + case SCALE: + return _scale->translate( _key, e ); + } + + return false; +} + +int +Mapping::velocity ( int n ) const +{ + switch ( _type ) + { + case INSTRUMENT: + return _instrument->velocity( n ); + case SCALE: + return 0; + } + + return 0; +} + +const char * +Mapping::note_name ( int n ) const +{ + switch ( _type ) + { + case INSTRUMENT: + return _instrument->note_name( n ); + case SCALE: + return _scale->note_name( _key, n ); + } + + return NULL; +} + +/* For the instrument editor... */ +Instrument * +Mapping::instrument ( void ) const +{ + if ( IS_INSTRUMENT ) + return _instrument; + else + return NULL; +} + +/** return a string describing the type of this mapping */ +const char * +Mapping::type ( void ) const +{ + return IS_INSTRUMENT ? "Instrument" : "Scale"; +} + + +bool +Mapping::editable ( void ) const +{ + return IS_INSTRUMENT ? true : false; +} diff --git a/FL/Fl_Arc_Dial.H b/sequencer/src/mapping.H similarity index 55% rename from FL/Fl_Arc_Dial.H rename to sequencer/src/mapping.H index 2df8084..4723eaf 100644 --- a/FL/Fl_Arc_Dial.H +++ b/sequencer/src/mapping.H @@ -17,66 +17,59 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*******************************************************************************/ -/* simple stylistic variation on Fl_Dial */ - #pragma once -#include +#include "scale.H" +#include "instrument.H" -class Fl_Arc_Dial : public Fl_Dial +/* C++'s inheritance system falls down dead for this application, so we + have to do it backwards, using the base class (Mapping) as an interface + to Instrument and Scale */ + + +class Mapping { - static int _default_style; - int _scaleticks; - - void draw_knob ( void ); - void draw_scale ( int ox, int oy, int side ); - void draw_cursor ( int ox, int oy, int sidei ); - - void get_knob_dimensions ( int *X, int *Y, int *S ); - -protected: - - virtual int handle ( int ); - virtual void draw ( void ); - virtual void draw_box ( void ); - public: - void scaleticks ( int tck ); + enum map_type { NONE, INSTRUMENT, SCALE }; - int - type ( void ) const - { - if ( Fl_Dial::type() == DEFAULT ) - return Fl_Arc_Dial::_default_style; - else - return Fl_Dial::type(); - } +private: - void type ( int n ) - { - Fl_Dial::type( n ); - } - - static void default_style ( int n ) { Fl_Arc_Dial::_default_style = n; } - - enum - { - DEFAULT, - BURNISHED_DIAL, - ARC_DIAL, - PLASTIC_DIAL + union { + Instrument *_instrument; + Scale *_scale; }; + int _key; /* used for scales, 0 == A */ - Fl_Arc_Dial ( int X, int Y, int W, int H, const char *L = 0 ) : - Fl_Dial( X, Y, W, H, L ) - { - _scaleticks = 12; - - box( FL_NO_BOX ); - type( DEFAULT ); - } + int _type; + +public: + + Mapping ( ); + Mapping ( const Mapping &rhs ); + + bool open ( map_type type, const char *name ); + + const char * name ( void ) const; + int height ( void ) const; + + Instrument * instrument ( void ) const; + + /* mutation */ + void note ( int from, int to ); + void velocity ( int n, int v ); + void note_name ( int n, char *s ); + void key ( int n ); + + /* inspection */ + bool translate ( midievent *e ) const; + const char * note_name ( int n ) const; + int velocity ( int n ) const; + int key ( void ) const; + bool editable ( void ) const; + + const char * type ( void ) const; }; diff --git a/sequencer/src/midievent.C b/sequencer/src/midievent.C new file mode 100644 index 0000000..3ce2362 --- /dev/null +++ b/sequencer/src/midievent.C @@ -0,0 +1,211 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +/* raw MIDI events + timestamps. Some support for SysEx */ + +#include "common.h" +#include "midievent.H" + +static const char *opcode_names[] = +{ + "Note Off", + "Note On", + "Aftertouch", + "Control Change", + "Program Change", + "Channel Pressure", + "Pitch Wheel" +}; + +midievent::midievent ( void ) +{ + _sysex = NULL; + _timestamp = 0; + _data.status = NOTE_OFF; + _data.msb = _data.lsb = 0; +} + +midievent::~midievent ( void ) +{ + if ( _sysex ) + delete _sysex; + + _sysex = NULL; +} + +int +midievent::pitch ( void ) const +{ + return ((_data.msb << 7) | _data.lsb) - 0x2000; +} + +void +midievent::pitch ( int n ) +{ + n += 0x2000; + + _data.lsb = n & 0x7F; + _data.msb = (n >> 7) & 0x7F; +} + +void +midievent::data ( byte_t D1, byte_t D2 ) +{ + _data.lsb = D1 & 0x7F; + _data.msb = D2 & 0x7F; +} + +void +midievent::data ( byte_t *D1, byte_t *D2 ) const +{ + *D1 = _data.lsb; + *D2 = _data.msb; +} + +void +midievent::raw ( byte_t *p, int l) const +{ + memcpy( p, &_data, l ); +} + +int +midievent::size ( void ) const +{ + return midievent::event_size( opcode() ); +} + +void +midievent::note_velocity ( int vel ) +{ + _data.msb = vel & 0x7F; +} + +void +midievent::note ( char note ) +{ + _data.lsb = note & 0x7F; +} + +unsigned char +midievent::note_velocity ( void ) const +{ + return _data.msb; +} + +bool +midievent::is_same_note ( midievent * e ) const +{ + return channel() == e->channel() && note() == e->note(); +} + +/** get name from opcode */ +const char * +midievent::name ( void ) const +{ + return opcode_names[ (opcode() >> 4) - 8 ]; +} + +/** get opcode from name */ +int +midievent::name ( const char *name ) const +{ + for ( unsigned int i = elementsof( opcode_names ); i--; ) + if ( ! strcmp( name, opcode_names[ i ] ) ) + return (i + 8) << 4; + + return -1; +} + +/** print event in hexadecimal */ +void +midievent::print ( void ) const +{ + printf( "[%06ld] %02X %02X %02X\n", + _timestamp, + _data.status, + _data.lsb, + _data.msb ); +} + +/** print event in english/decimal */ +void +midievent::pretty_print ( void ) const +{ + printf( + "[%06ld] %-15s c: %2d d1: %3d d2: %3d\n", + _timestamp, + name(), + channel(), + _data.lsb, + _data.msb ); +} + + +/*********/ +/* Sysex */ +/*********/ + +midievent::sysex::sysex ( void ) +{ + _data = NULL; + _size = 0; + _alloc = 0; +} + +midievent::sysex::~sysex ( void ) +{ + if ( _data ) + free( _data ); + + _data = NULL; +} + +/** add bytes to sysex message */ +void +midievent::sysex::append ( byte_t *data, size_t size ) +{ + if ( _size + size > _alloc ) + _data = (byte_t *)realloc( _data, _alloc += 256 ); + + memcpy( data + _size, data, size ); + + _size += size; +} + +/** return SysEx data */ +const byte_t * +midievent::sysex::data ( void ) const +{ + return _data; +} + +long +midievent::sysex::size ( void ) const +{ + return _size; +} + + + +bool +midievent::operator== ( const midievent &rhs ) const +{ + return _timestamp == rhs._timestamp && + ! bcmp( (void*)&_data, (void*)&rhs._data, size() ); +} diff --git a/sequencer/src/midievent.H b/sequencer/src/midievent.H new file mode 100644 index 0000000..1164c90 --- /dev/null +++ b/sequencer/src/midievent.H @@ -0,0 +1,238 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include "common.h" + + +/* raw MIDI event + timestamp */ +class midievent +{ + +public: + + class sysex { + size_t _size, _alloc; + byte_t *_data; + + public: + + sysex ( void ); + ~sysex ( void ); + + void append ( byte_t *data, size_t size ); + const byte_t * data ( void ) const; + long size ( void ) const; + + }; + +private: + + sysex *_sysex; + + tick_t _timestamp; /* in ticks */ + struct { + byte_t status, /* full status byte */ + lsb, /* data 1 */ + msb; /* data 2 */ + } _data; + +public: + + static inline int + event_size ( byte_t op ) + { + switch ( op ) + { + case NOTE_ON: case NOTE_OFF: case AFTERTOUCH: + case CONTROL_CHANGE: case PITCH_WHEEL: + return 3; + case PROGRAM_CHANGE: case CHANNEL_PRESSURE: + return 2; + default: + return 1; + } + }; + + /* define MIDI status bytes */ + enum { + STATUS_BIT = 0x80, + NOTE_OFF = 0x80, + NOTE_ON = 0x90, + AFTERTOUCH = 0xA0, + CONTROL_CHANGE = 0xB0, + PROGRAM_CHANGE = 0xC0, + CHANNEL_PRESSURE = 0xD0, + PITCH_WHEEL = 0xE0, + CLEAR_CHAN_MASK = 0xF0, + MIDI_CLOCK = 0xF8, + SYSEX = 0xF0, + SYSEX_END = 0xF7, + META = 0xFF + }; + + midievent ( void ); + virtual ~midievent ( void ); + + tick_t timestamp ( void ) const; + void timestamp ( tick_t time ); + void status ( byte_t status ); + byte_t status ( void ) const; + void channel ( byte_t channel ); + byte_t channel ( void ) const; + byte_t opcode ( void ) const; + void opcode ( byte_t o ); + void lsb ( byte_t n ); + void msb ( byte_t n ); + int lsb ( void ) const; + int msb ( void ) const; + int pitch ( void ) const; + void pitch ( int n ); + void data ( byte_t D1, byte_t D2 ); + void data ( byte_t *D1, byte_t *D2 ) const; + void raw ( byte_t *p, int l) const; + int size ( void ) const; + void note_velocity ( int vel ); + bool is_note_on ( void ) const; + bool is_note_off ( void ) const; + virtual unsigned char note ( void ) const; + virtual void note ( char note ); + unsigned char note_velocity ( void ) const; + bool is_same_note ( midievent * e ) const; + const char * name ( void ) const; + int name ( const char *name ) const; + void print ( void ) const; + void pretty_print ( void ) const; + + bool operator< ( const midievent &rhs ) const; + bool operator>= ( const midievent &rhs ) const; + + bool operator== ( const midievent &rhs ) const; + +}; + + +/**********************/ +/* Inlined accessors */ +/**********************/ + + +inline tick_t +midievent::timestamp ( void ) const +{ + return _timestamp; +} + +inline void +midievent::timestamp ( tick_t time ) +{ + _timestamp = time; +} + +inline void +midievent::status ( byte_t status ) +{ + _data.status = status; +} + +inline byte_t +midievent::status ( void ) const +{ + return _data.status; +} + +inline void +midievent::channel ( byte_t channel ) +{ + _data.status = (_data.status & 0xF0) | (channel & 0x0F); +} + +inline byte_t +midievent::channel ( void ) const +{ + return _data.status & 0x0F; +} + +inline byte_t +midievent::opcode ( void ) const +{ + return _data.status & 0xF0; +} + + +inline void +midievent::opcode ( byte_t opcode ) +{ + _data.status = (_data.status & 0x0F) | (opcode & 0xF0); +} + +inline void +midievent::lsb ( byte_t n ) +{ + _data.lsb = n & 0x7F; +} + +inline void +midievent::msb ( byte_t n ) +{ + _data.msb = n & 0x7F; +} + +inline int +midievent::lsb ( void ) const +{ + return _data.lsb; +} + +inline int +midievent::msb ( void ) const +{ + return _data.msb; +} + +inline bool +midievent::is_note_on ( void ) const +{ + return (opcode() == NOTE_ON); +} + +inline bool +midievent::is_note_off ( void ) const +{ + return (opcode() == NOTE_OFF); +} + +inline unsigned char +midievent::note ( void ) const +{ + return _data.lsb; +} + +inline bool +midievent::operator< ( const midievent &rhs ) const +{ + return _timestamp < rhs._timestamp; +} + +inline bool +midievent::operator>= ( const midievent &rhs ) const +{ + return _timestamp >= rhs._timestamp; +} diff --git a/sequencer/src/non.H b/sequencer/src/non.H new file mode 100644 index 0000000..48c9e79 --- /dev/null +++ b/sequencer/src/non.H @@ -0,0 +1,132 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007,2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include "common.h" +#include "pattern.H" +#include "phrase.H" +#include "sequence.H" + +enum { + PLAY, + MUTE, + SOLO +}; + +class Canvas; +class Lash; + +extern Canvas *pattern_c, *phrase_c; +extern sequence *playlist; +extern Lash lash; + +void quit ( void ); +void init_song ( void ); +void handle_midi_input ( void ); +bool load_song ( const char *name ); +bool save_song ( const char *name ); +void setup_jack ( void ); + +#include "common.h" +#include "const.h" + + +enum play_mode_e { + PATTERN, + SEQUENCE, + TRIGGER, + QUEUE +// PHRASE, +}; + + +enum record_mode_e { + MERGE, + OVERWRITE, + LAYER, + NEW +}; + + +/* program settings (from rc file) */ +struct global_settings { + + enum record_mode_e record_mode; + + bool record_filtered; /* ignore non-note events while recording */ + bool visual_metronome; /* show visual metronome */ + bool follow_playhead; + + char *user_config_dir; + +}; +extern global_settings config; + +/* song settings (from song file) */ +struct song_settings +{ + + enum play_mode_e play_mode; + + char *filename; + + signal signal_dirty; /* emitted when first dirtied */ + signal signal_clean; /* emitted when first cleaned */ + + bool _dirty; + + bool dirty ( void ) + { + return _dirty; + } + + void + dirty( bool b ) + { + if ( _dirty != b ) + { + _dirty = b; + + if ( b ) + { + DMESSAGE( "song is now dirty" ); + signal_dirty(); + } + else + { + DMESSAGE( "song is now clean" ); + signal_clean(); + } + } + } + + void + set_dirty ( void ) + { + dirty( true ); + } + + struct { + int feel; + float probability; + } random; + +}; +extern song_settings song; diff --git a/sequencer/src/pattern.C b/sequencer/src/pattern.C new file mode 100644 index 0000000..803d81d --- /dev/null +++ b/sequencer/src/pattern.C @@ -0,0 +1,752 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "pattern.H" +#include "non.H" +#include "common.h" +#include "smf.H" + +#include "jack.H" +#include "transport.H" +#include + +int pattern::note_shape = SQUARE; + +event_list pattern::_recorded_events; +vector pattern::_patterns; +int pattern::_solo; +int pattern::_pattern_recording; + +signal pattern::signal_create_destroy; + +pattern::pattern ( void ) +{ + viewport.h = 32; + viewport.w = 32; + + viewport.y = 64 - ( viewport.h + ( viewport.h / 2 ) ); + + _channel = _port = 0; + + _ppqn = 4; + _bpb = 4; + _note = 8; + + _queued = -1; + + int _bars = 2; + + // we need to reinitalize this. + data *d = const_cast< data * >( _rd ); + + d->length = x_to_ts( _bpb * _ppqn * _bars ); + +// mapping.open( Mapping::INSTRUMENT, "Default" ); + mapping.open( Mapping::SCALE, "Major" ); + + _add(); + + char *s; + asprintf( &s, "Pattern %d", number() ); + + name( s ); +} + +void +pattern::_add ( void ) +{ + // keep track of all the patterns + pattern::_patterns.push_back( this ); + _number = patterns(); + + signal_create_destroy(); +} + +pattern::~pattern ( void ) +{ + DMESSAGE( "deleting pattern %d", number() ); + signal_create_destroy(); +} + +/* copy constructor */ +pattern::pattern ( const pattern &rhs ) : Grid( rhs ) +{ + _note = rhs._note; + _port = rhs._port; + _channel = rhs._channel; + _queued = rhs._queued; + + mapping = rhs.mapping; + + _add(); +} + +pattern * +pattern::clone ( void ) +{ + return new pattern( *this ); +} + +/******************/ +/* Static methods */ +/******************/ + +int +pattern::solo ( void ) +{ + return pattern::_solo; +} + +int +pattern::patterns ( void ) +{ + return pattern::_patterns.size(); +} + +// this is the static one +pattern * +pattern::pattern_by_number ( int n ) +{ + if ( n <= patterns() && n > 0 ) + { + return pattern::_patterns[ n - 1 ]; + } + return NULL; +} + +/** delete all patterns in preparation for a reload */ +void +pattern::reset ( void ) +{ + for ( int n = pattern::patterns(); n-- ; ) + { + delete pattern::_patterns.back(); + pattern::_patterns.pop_back(); + } +} + +/* records a MIDI event into a temporary buffer. It'll only be + * permanently added to pattern after recording stops or the pattern + * loops. */ +void +pattern::record_event ( const midievent *me ) +{ + /* set the events aside in a dedicated list--the recording pattern + * will decide what to do with them the next time around the + * loop */ + + /* FIXME: how does the pattern decide when to loop? It seems + reasonable that /merge/ and /replace/ modes should be bound to + the previous pattern length, but what about "NEW" mode? Should it + just use this entire list as a new pattern (of whatever length) + when recording is halted? */ + + event *e = new event; + + *e = *me; + + pattern::_recorded_events.append( e ); + + record_mode_e mode = config.record_mode; + + if ( mode == OVERWRITE || mode == LAYER ) + { + pattern *p = pattern::recording(); + + if ( ! p->_cleared ) + { + + if ( mode == LAYER ) + { + p->record_stop(); + + p = p->clone(); + + p->record( 0 ); + } + + p->clear(); + + p->_cleared = true; + } + + mode = MERGE; + } + + /* let's fill in the pattern 'live' in merge mode. looks a little + complicated because we have to wait for a note-off before it's + safe to insert */ + if ( mode == MERGE || mode == NEW ) + { + + pattern *p = pattern::recording(); + + p->lock(); + + event_list *el = &pattern::_recorded_events; + + if ( e->is_note_off() ) + { + event *off = e; + + for ( event *on = el->last(); on; on = on->prev() ) + { + if ( on->is_note_on() && + on->is_same_note( off ) ) + // && + // *on < *e ) + { + el->unlink( on ); + el->unlink( off ); + + tick_t duration = off->timestamp() - on->timestamp(); + + /* place within loop */ + on->timestamp( + fmod( on->timestamp() - p->_start, p->_rw->length ) ); + + on->link( off ); + on->note_duration( duration ); + + p->_rw->events.mix( on ); + + break; + } + } + } + else + if ( ! e->is_note_on() ) + { + + // if ( ! filter ) + + e->timestamp( fmod( e->timestamp(), p->_rw->length ) ); + + el->unlink( e ); + p->_rw->events.insert( e ); + } + + p->_suspend_update = true; + p->unlock(); + p->_suspend_update = false; + } +} + +pattern * +pattern::recording ( void ) +{ + return pattern::pattern_by_number( pattern::_pattern_recording ); +} + + + +/*******************/ +/* Virtual Methods */ +/*******************/ + +/* allows us to create a new pattern/phrase from a base class pointer */ +pattern * +pattern::create ( void ) +{ + if ( pattern::patterns() < 128 ) + { + return new pattern; + } + else + return NULL; +} + +pattern * +pattern::by_number ( int n ) const +{ + return pattern::pattern_by_number( n ); +} + +void +pattern::put ( int x, int y, tick_t l ) +{ + l = l ? l : PPQN * 4 / _note; + + Grid::put( x, y, l ); + + if ( ! transport.rolling ) + { + /* echo note */ + midievent e; + + e.status( event::NOTE_ON ); + e.channel( _channel ); + e.timestamp( l ); + e.note( y_to_note( y ) ); + e.note_velocity( 64 ); + + midi_output_immediate_event ( _port, &e ); + } +} + +const char * +pattern::row_name ( int r ) const +{ + return mapping.note_name( y_to_note( r ) ); +} + +void +pattern::draw_row_names ( Canvas *c ) const +{ + for ( int y = 128; y-- ; ) + c->draw_row_name( y, mapping.note_name( y_to_note( y ) ), mapping.velocity( y_to_note( y ) ) ); +} + +void +pattern::trigger ( tick_t start, tick_t end ) +{ + /* ASSERT( end != -1 && start <= end, "programming error: invalid loop trigger! (%lu-%lu)", start, end ); */ + + _start = start; + _end = end; +} + +/* trigger forever */ +void +pattern::trigger ( void ) +{ + trigger( transport.frame / transport.frames_per_tick, INFINITY ); +} + +void +pattern::stop ( void ) const +{ + _playing = false; + + _start = 0; + _end = 0; + _index = 0; +} + + +void +pattern::mode ( int n ) +{ + if ( QUEUE == song.play_mode ) + { + queue( n ); + return; + } + + if ( n == SOLO ) + { + if ( pattern::_solo ) + ((Grid*)pattern::pattern_by_number( pattern::_solo ))->mode( PLAY ); + pattern::_solo = _number; + Grid::mode( SOLO ); + } + else + { + if ( pattern::_solo == _number ) + pattern::_solo = 0; + + Grid::mode( n ); + } +} + +int +pattern::mode ( void ) const +{ + if ( pattern::_solo ) + { + if ( pattern::_solo == _number ) + return SOLO; + else + return MUTE; + } + else + return Grid::mode(); +} + +/* queue a mode change for the next loop */ +void +pattern::queue ( int m ) +{ + _queued = m; +} + +int +pattern::queue ( void ) const +{ + return _queued; +} + +/* WARNING: runs in the RT thread! */ +// output notes from /start/ to /end/ (absolute) +void +pattern::play ( tick_t start, tick_t end ) const +{ + /* get our own copy of this pointer so UI thread can change it. */ + const data *d = const_cast< const data * >(_rd); + + if ( start > _end ) + { + stop(); +// WARNING( "attempt to play a loop (pattern %d) that has ended (%lu, %lu)", number(), start, _end ); + return; + } + else + if ( end < _start ) + // not ready yet + return; + + if ( start < _start ) + start = _start; + + if ( end > _end ) + end = _end; + + // where we are in the absolute time + tick_t tick = start - _start; + int num_played = tick / d->length; + tick_t offset = _start + (d->length * num_played); + + const event *e; + + _index = fmod( tick, d->length ); + + bool reset_queued = false; + + if ( _index < end - start ) + { + /* period covers the beginning of the loop */ + DMESSAGE( "%s pattern %d at tick %f (ls: %f, le: %f, o: %f)", _playing ? "Looped" : "Triggered", number(), start, _start, _end, offset ); + + _cleared = false; + + if ( PLAY == _queued || SOLO == _queued ) + { + /* set the start point to loop boundary */ + start = start - _index; + _mode = _queued; + + if ( SOLO == _mode ) + { + if ( pattern::_solo ) + ((Grid*)pattern::pattern_by_number( pattern::_solo ))->mode( PLAY ); + + pattern::_solo = _number; + } + else + { + if ( pattern::_solo == _number ) + pattern::_solo = 0; + } + + reset_queued = true; + } + } + else if ( _index >= d->length - ( end - start ) ) + { + if ( MUTE == _queued ) + { + /* set the end point to loop boundary */ + end = end - _index; + + reset_queued = true; + } + } + + _playing = true; + + if ( mode() == MUTE ) + goto done; + +try_again: + + // pattern is empty + if ( d->events.empty() ) + goto done; + + for ( e = d->events.first(); e; e = e->next() ) + { + // MESSAGE( "s[%ld] -> t[%ld] : %ld, len %ld", start, end, e->timestamp(), _length ); // (*e).print(); + + tick_t ts = e->timestamp() + offset; + + if ( ts >= end ) + goto done; + + if ( ts >= start ) + { + midievent me = *e; + + + // MESSAGE( "timestamp %d, tick %d, ts - start == %lu", e->timestamp(), start, + // e->timestamp() - start); + + /* set the channel */ + me.channel( _channel ); + + /* set the in-cycle timestamp */ + me.timestamp ( ts - start ); + + if ( me.is_note_on() ) + { + if ( mapping.translate( &me ) ) + midi_output_event( _port, &me, 1 + e->note_duration() ); + } + else + if ( me.is_note_off() ) + { + if ( mapping.translate( &me ) ) + midi_output_event( _port, &me, 0 ); + } + else + /* any other event type */ + midi_output_event( _port, &me ); + } + } + + // ran out of events, but there's still some loop left to play. + offset += d->length; + goto try_again; + + DMESSAGE( "out of events, resetting to satisfy loop" ); + +done: + + if ( _queued >= 0 && reset_queued ) + { + _mode = _queued; + _queued = -1; + } + + if ( _end == end ) + { + /* we're done playing this trigger */ + DMESSAGE( "Pattern %d ended at tick %f (ls: %f, le: %f, o: %f)", number(), end, _start, _end, offset ); + + stop(); + } + +} + +/* Import /track/ of /f/ as new pattern */ +pattern * +pattern::import ( smf *f, int track ) +{ + if ( ! f->seek_track( track ) ) + return NULL; + + pattern *p = new pattern; + + p->lock(); + + p->load( f ); + + /* file could have any notes in it... Use Chromatic scale to + ensure all are visible */ + p->mapping.open( Mapping::SCALE, "Chromatic" ); + + p->unlock(); + + p->fit(); + + return p; +} + +/** fill pattern from current track of /f/ */ +void +pattern::load ( smf *f ) +{ + lock(); + + f->read_pattern_info( this ); + + tick_t len; + + list *e = f->read_track_events( &len ); + + /* set channel to channel of first event... */ + if ( e->size() ) + _channel = e->front().channel(); + + /* copy events into pattern */ + _rw->events = *e; + delete e; + + if ( len ) + _rw->length = len; + + unlock(); + +// print(); +} + +/** save (export) pattern to file /name/ */ +void +pattern::save ( const char *name ) const +{ + smf f; + + /* open for writing */ + f.open( name, smf::WRITE ); + + /* writing SMF 0 track */ + f.write_header( 0 ); + + f.open_track( _name, _number ); + + Grid::dump( &f, _channel ); + + f.close_track( length() ); +} + +/** dump pattern as a track in an already open MIDI file */ +void +pattern::dump ( smf *f ) const +{ + f->open_track( _name, _number ); + + f->write_pattern_info( this ); + + Grid::dump( f, _channel ); + + f->close_track( length() ); +} + + +void +pattern::randomize_row ( int y, int feel, float probability ) +{ + lock(); + + int l = PPQN * 4 / _note; + + int bx = ts_to_x( _rw->length - l ); + + float *p = (float *)alloca( feel * sizeof( float ) ); + + float prob = probability; + for ( int i = 0; i < feel; i++ ) + { + p[i] = prob; + // reduce probability as we move away from center + prob *= 0.5; + } + + for ( int x = 0; x < bx; x++ ) + { + float r = ((float)rand()) / RAND_MAX; + + if ( p[ x % feel ] + r >= 1 ) + put( x, y, l ); + } + + unlock(); +} + +/*************/ +/* Recording */ +/*************/ + +void +pattern::record ( int mode ) +{ + _recording = true; + pattern::_pattern_recording = _number; +} + +void +pattern::record_stop ( void ) +{ + if ( ! _recording ) + return; + + _recording = false; + + if ( config.record_mode == NEW ) + trim(); + + pattern::_recorded_events.clear(); +} + + + +/*******************************/ +/* Pattern specific accessors. */ +/*******************************/ + + +int +pattern::port ( void ) const +{ + return _port; +} + +void +pattern::port ( int p ) +{ + _port = p; +} + +int +pattern::channel ( void ) const +{ + return _channel; +} + +void +pattern::channel ( int c ) +{ + _channel = c; +} + +int +pattern::note ( void ) const +{ + return _note; +} + +void +pattern::note ( int n ) +{ + _note = n; +} + + +int +pattern::ppqn ( void ) const +{ + return _ppqn; +} + +void +pattern::ppqn ( int n ) +{ + _ppqn = n; +} + +int +pattern::key ( void ) const +{ + return mapping.key(); +} + +void +pattern::key ( int k ) +{ + mapping.key( k ); +} diff --git a/sequencer/src/pattern.H b/sequencer/src/pattern.H new file mode 100644 index 0000000..3e4aaf5 --- /dev/null +++ b/sequencer/src/pattern.H @@ -0,0 +1,119 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007-2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include "grid.H" +#include "canvas.H" +#include "mapping.H" +// #include "event.H" +#include "common.h" + +#include +using std::vector; + +class pattern : public Grid +{ + static event_list _recorded_events; + static vector _patterns; + static int _solo; + static int _pattern_recording; + + + static int solo ( void ); + + int _channel, _port; + + bool _recording; + mutable volatile bool _cleared; + + mutable volatile int _queued; + +// int _key; + + int _note; + + void _add ( void ); + + +public: + + static int note_shape; + + int draw_shape ( void ) const { return pattern::note_shape; } + + static signal signal_create_destroy; + + Mapping mapping; + + pattern ( void ); + ~pattern ( void ); + pattern ( const pattern &rhs ); + + static int patterns ( void ); + static pattern * pattern_by_number ( int n ); + static void reset ( void ); + static pattern * import ( smf *f, int track ); + + static pattern * recording ( void ); + static void record_event ( const midievent *e ); + + pattern * create ( void ); + pattern * by_number ( int n ) const; + + pattern * clone ( void ); + void put ( int x, int y, tick_t l ); + const char * row_name ( int r ) const; + void draw_row_names ( Canvas *c ) const; + void trigger ( tick_t start, tick_t end ); + void trigger ( void ); + void stop ( void ) const; + void play ( tick_t start, tick_t end ) const; + + void load ( smf *f ); + + void record( int mode ); + void record_stop ( void ); + + void queue ( int mode ); + int queue ( void ) const; + + void randomize_row ( int y, int feel, float probability ); + + int port ( void ) const; + void port ( int p ); + int channel ( void ) const; + void channel ( int c ); + int note ( void ) const; + void note ( int n ); + + void mode ( int n ); + int mode ( void ) const; + + int key ( void ) const; + void key ( int k ); + + int load ( const char *name ); + void save ( const char *name ) const; + void dump ( smf *f ) const; + + int ppqn ( void ) const; + void ppqn ( int n ); + +}; diff --git a/sequencer/src/phrase.C b/sequencer/src/phrase.C new file mode 100644 index 0000000..0db6ae2 --- /dev/null +++ b/sequencer/src/phrase.C @@ -0,0 +1,278 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007,2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "phrase.H" +#include "gui/draw.H" +#include "pattern.H" +#include "smf.H" +#include "common.h" +#include + +vector phrase::_phrases; +signal phrase::signal_create_destroy; + +phrase::phrase ( void ) +{ + viewport.h = 32; + viewport.w = 32; + + _add(); + + char *s; + asprintf( &s, "Phrase %d", number() ); + + name( s ); + +} + + +phrase::~phrase ( void ) +{ + DMESSAGE( "deleting phrase %d", number() ); + signal_create_destroy(); +} + +void +phrase::_add ( void ) +{ + // keep track of all the phrases + phrase::_phrases.push_back( this ); + _number = phrases(); + + signal_create_destroy(); +} + +/* copy constructor */ +phrase::phrase ( const phrase &rhs ) : Grid( rhs ) +{ + _add(); +} + +phrase * +phrase::clone ( void ) +{ + return new phrase( *this ); +} + +/******************/ +/* Static methods */ +/******************/ + +int +phrase::phrases ( void ) +{ + return phrase::_phrases.size(); +} + +phrase * +phrase::phrase_by_number ( int n ) +{ + if ( n <= phrases() && n > 0 ) + { + return phrase::_phrases[ n - 1 ]; + } + return NULL; +} + +void +phrase::reset ( void ) +{ + for ( int n = phrase::phrases(); n-- ; ) + { + delete phrase::_phrases.back(); + phrase::_phrases.pop_back(); + } +} + + + + +/*******************/ +/* Virtual Methods */ +/*******************/ + +phrase * +phrase::create ( void ) +{ + if ( phrase::phrases() < 128 ) + { + return new phrase; + } + else + return NULL; +} + +phrase * +phrase::by_number ( int n ) const +{ + return phrase::phrase_by_number( n ); +} + +void +phrase::put ( int x, int y, tick_t l ) +{ + // FIXME: fix insertion length to the length of the pattern + // referred to by this row. + + l = 4; + + // FIXME: use translation here. + pattern *p = pattern::pattern_by_number( y + 1 ); + + if ( ! p ) + return; + + l = p->length(); + + Grid::put( x, y, l ); +} + +const char * +phrase::row_name ( int r ) const +{ + pattern *p = pattern::pattern_by_number( r + 1 ); + + return p ? p->name() : NULL; +} + +void +phrase::draw_row_names ( Canvas *c ) const +{ + for ( int y = viewport.h; y--; ) + { + pattern *p = pattern::pattern_by_number( y + 1 ); + + if ( p && p->name() ) + c->draw_row_name( y, p->name(), 0 ); + } +} + + +void +phrase::trigger ( tick_t start, tick_t end ) +{ + _start = start; + _end = end; +} + +// FIXME: so much of this is copied from pattern.C, there has +// to be a way to share more of this code. +void +phrase::play ( tick_t start, tick_t end ) +{ + /* get our own copy of this pointer so UI thread can change it. */ + const data *d = const_cast< const data * >(_rd); + + if ( start > _end ) + { + _playing = false; + return; + } + + if ( start < _start ) + start = _start; + + if ( end > _end ) + end = _end; + + _playing = true; + + // where we are in the absolute time + tick_t tick = start - _start; + int num_played = tick / d->length; + tick_t offset = _start + (d->length * num_played); + + _index = fmod( tick, d->length ); + + if ( _index < end - start ) + DMESSAGE( "Triggered phrase %d at tick %lu (ls: %lu, le: %lu, o: %lu)", number(), start, _start, _end, offset ); + +try_again: + + // pattern is empty + if ( d->events.empty() ) + goto done; + + for ( const event *e = d->events.first(); e; e = e->next() ) + { + // MESSAGE( "s[%ld] -> t[%ld] : %ld, len %ld", start, end, e->timestamp(), _length ); // (*e).print(); + + const tick_t ts = e->timestamp() + offset; + + if ( ts >= end ) + goto done; + + if ( e->is_note_on() ) + { + const tick_t tse = offset + e->link()->timestamp(); + + if ( tse > start ) + { + pattern *p = pattern::pattern_by_number( 1 + note_to_y( e->note() ) ); + + p->trigger( ts, tse ); + + p->play( start, end ); + } + } + } + + // ran out of events, but there's still some loop left to play. + offset += d->length; + goto try_again; + + MESSAGE( "out of events, resetting to satisfy loop" ); + +done: ; +} + + +void +phrase::load ( smf *f ) +{ + lock(); + + f->read_phrase_info( this ); + + tick_t len; + + list *me = f->read_track_events( &len ); + + _rw->events = *me; + delete me; + + if ( len ) + _rw->length = len; + + unlock(); +} + +void +phrase::dump ( smf *f ) +{ + f->open_track( _name, -1 ); + + f->write_phrase_info( this ); + + f->cue( true ); + + Grid::dump( f, 0 ); + + f->close_track( length() ); +} diff --git a/sequencer/src/phrase.H b/sequencer/src/phrase.H new file mode 100644 index 0000000..f9b6ca2 --- /dev/null +++ b/sequencer/src/phrase.H @@ -0,0 +1,63 @@ + +/*******************************************************************************/ +/* Copyright (C) 2007,2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include "grid.H" +#include "canvas.H" + +class pattern; + +#include +using std::vector; + +class phrase : public Grid +{ + + static vector _phrases; + + void _add ( void ); + +public: + + static signal signal_create_destroy; + + int draw_shape ( void ) const { return SQUARE; } + + phrase ( void ); + ~phrase ( void ); + phrase ( const phrase &rhs ); + + static int phrases ( void ); + static phrase * phrase_by_number ( int n ); + static void reset ( void ); + + phrase *create ( void ); + phrase * by_number ( int n ) const; + + void put ( int x, int y, tick_t l ); + phrase * clone ( void ); + const char * row_name ( int r ) const; + void draw_row_names ( Canvas *c ) const; + void play ( tick_t start, tick_t end ); + void trigger ( tick_t start, tick_t end ); + + void load ( smf *f ); + void dump ( smf *f ); +}; diff --git a/sequencer/src/scale.C b/sequencer/src/scale.C new file mode 100644 index 0000000..81a6659 --- /dev/null +++ b/sequencer/src/scale.C @@ -0,0 +1,207 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "scale.H" +#include "common.h" + +#include "stdlib.h" + +/* Define some scales. These don't really need to be stored on + disk. Scales don't change that often. */ + +const char *Scale::chromatic_names[] = +/* { "A", */ +/* "A#/Bb", */ +/* "B", */ +/* "C", */ +/* "C#/Db", */ +/* "D", */ +/* "D#/Eb", */ +/* "E", */ +/* "F", */ +/* "F#/Gb", */ +/* "G", */ +/* "G#/Ab" }; */ + +/* { "C", */ +/* "C#/Db", */ +/* "D", */ +/* "D#/Eb", */ +/* "E", */ +/* "F", */ +/* "F#/Gb", */ +/* "G", */ +/* "G#/Ab", */ +/* "A", */ +/* "A#/Bb", */ +/* "B" }; */ + + +{ "C", + "C#", + "D", + "D#", + "E", + "F", + "F#", + "G", + "G#", + "A", + "A#", + "B" }; + + +Scale Scale::builtin_scales[] = { + { "Major", + 7, + { 0, 2, 4, 5, 7, 9, 11 } }, + { "Natural Minor", + 7, + { 0, 2, 3, 5, 7, 8, 10 } }, + { "Harmonic Minor", + 7, + { 0, 2, 3, 5, 7, 8, 11 } }, + { "Melodic Minor", + 7, + { 0, 2, 3, 5, 7, 9, 11 } }, + { "Major Pentatonic", + 5, + { 0, 2, 4, 7, 9 } }, + { "Minor Pentatonic", + 5, + { 0, 3, 5, 7, 10 } }, + { "Chromatic", + 12, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 } } +}; + +/* const Scale builtin_chords[] = { */ +/* { "Major Triad", */ +/* { 0, 4, 7, -1 } }, */ +/* { "Major Sixth", */ +/* { 0, 4, 7, 9, -1 } }, */ +/* { "Major Seventh", */ +/* { 0, 4, 7, 11, -1 } }, */ +/* { "Major Ninth", */ +/* { 0, 4, 7, 11, 14, -1 } }, */ +/* { "Major 6/9", */ +/* { 0, 4, 7, 9, 14, -1 } }, */ +/* { "Major Eleventh", */ +/* { 0, 4, 7, 11, 14, 17, -1 } }, */ +/* { "Major Thirteenth", */ +/* { 0, 4, 7, 11, 14, 17, 21, -1 } }, */ + +/* { "Minor Triad", */ +/* { 0, 3, 7, -1 } }, */ +/* { "Minor Sixth", */ +/* { 0, 3, 7, 9, -1 } }, */ +/* { "Minor Seventh", */ +/* { 0, 3, 7, 10, -1 } }, */ +/* { "Minor Ninth", */ +/* { 0, 3, 7, 10, 14, -1 } }, */ +/* { "Minor 6/9", */ +/* { 0, 3, 7, 9, 14, -1 } }, */ +/* { "Minor Eleventh", */ +/* { 0, 3, 7, 10, 14, 17, -1 } }, */ +/* { "Minor Thirteenth", */ +/* { 0, 3, 7, 10, 14, 17, 21, -1 } }, */ + +/* { "Augmented Triad", */ +/* { 0, 4, 8, -1 } }, */ +/* { "Diminished Triad", */ +/* { 0, 3, 6, -1 } } */ +/* }; */ + + +/* "Opens" a scale for compatibility with Instrument class */ +Scale * +Scale::open ( const char *name ) +{ + for ( int i = elementsof( builtin_scales ) - 1; i >= 0; --i ) + if ( 0 == strcmp( name, builtin_scales[i]._name ) ) + return &builtin_scales[i]; + + return NULL; +} + +/* Returns a list of available scales */ +char ** +Scale::listing ( void ) +{ + char **sa; + + int n = elementsof( builtin_scales ); + + sa = (char **)malloc( sizeof ( char * ) * ( n + 1 ) ); + sa[n] = NULL; + + while ( n-- ) + sa[n] = strdup( builtin_scales[n]._name ); + + return sa; +} + +const char * +Scale::chromatic_name ( int n ) +{ + return chromatic_names[ n % 12 ]; +} + +int +Scale::octave ( int n ) +{ + return n / 12; +} + +int +Scale::_degree ( int k, int n ) const +{ + return k + _degrees[ n % _notes ]; +} + +/* translate NOTE event. Behavior is undefined for other event types */ +bool +Scale::translate ( int k, midievent *e ) const +{ + if ( ! note_name( k, e->note() ) ) + return false; + else + return true; +} + +const char * +Scale::note_name ( int k, int n ) const +{ + /* all the magic is here */ + + n %= 12; + + // FIXME: searching is not efficient! + for ( int i = _notes; i-- ; ) + if ( n == (_degrees[ i ] + k) % 12 ) + return chromatic_names[ n ]; + + return NULL; +} + +const char * +Scale::name ( void ) const +{ + return _name; +} diff --git a/sequencer/src/scale.H b/sequencer/src/scale.H new file mode 100644 index 0000000..c6411ff --- /dev/null +++ b/sequencer/src/scale.H @@ -0,0 +1,48 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include "event.H" + +class Scale +{ + + static const char *chromatic_names[]; + static Scale builtin_scales[]; + + int _degree ( int k, int n ) const; + +public: + const char *_name; + int _notes; + int _degrees[13]; + +public: + + static Scale * open ( const char *name ); + static char ** listing ( void ); + static const char * chromatic_name ( int n ); + static int octave ( int n ); + + bool translate ( int k, midievent *e ) const; + int note ( int k, int n ) const; + const char * note_name ( int k, int n ) const; + const char * name ( void ) const; +}; diff --git a/sequencer/src/sequence.C b/sequencer/src/sequence.C new file mode 100644 index 0000000..c6a0c38 --- /dev/null +++ b/sequencer/src/sequence.C @@ -0,0 +1,456 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "sequence.H" +#include "phrase.H" +#include "pattern.H" +#include "smf.H" + +#include "non.H" + +#include + +/* #include */ + +/* using std::string; */ + +sequence::sequence ( void ) +{ + _rd = new data; + _name = _notes = NULL; + + _index = 0; + _playing = 0; +} + + +void +sequence::lock ( void ) +{ + // create a copy of the lock-free data. + _rw = new data; + + data *d = const_cast< data *> (_rd); + + _rw->phrases = d->phrases; + _rw->num = d->num; +} + +void +sequence::unlock ( void ) +{ + _history.push_back( const_cast( _rd ) ); + + if ( _history.size() > MAX_UNDO + 1 ) + { + data *d = _history.front(); + + if ( d == _rw || d == _rd ) + ASSERTION( "something bad has happend." ); + + delete d; + + _history.pop_front(); + } + + // swap the copy back in (atomically). + _rd = _rw; + + _rw = NULL; + + song.set_dirty(); +} + +void +sequence::insert ( unsigned int n, int pn ) +{ + lock(); + +/* if ( n > _rw->phrases.size() ) */ +/* _rw->phrases.resize( n + 10 ); */ + +// MESSAGE( "inserting %d at %d", pn, n ); + + _rw->phrases.insert( _find( n ), pn ); + _rw->num++; + + unlock(); +} + +vector ::iterator +sequence::_find ( int n ) +{ + // boy I hate C++/STL.. So lame. + int i = 0; + for ( vector ::iterator e = _rw->phrases.begin(); e != _rw->phrases.end(); e++ ) + { + if ( i == n ) + return e; + i++; + } + + return _rw->phrases.end(); +} + +void +sequence::remove ( int n ) +{ + lock(); + + _rw->phrases.erase( _find( n ) ); + _rw->num--; + + unlock(); +} + +/** return the number of phrases in this sequence */ +int +sequence::phrases ( void ) const +{ + return _rd->num; +} + +void +sequence::_swap ( int n1, int n2 ) +{ + int x = _rw->phrases[ n1 ]; + _rw->phrases[ n1 ] = _rw->phrases[ n2 ]; + _rw->phrases[ n2 ] = x; +} + +void +sequence::move ( int n, int dir ) +{ + lock(); + + switch ( dir ) + { + case UP: + { + if ( n - 1 >= 0 ) + _swap( n - 1, n ); + break; + } + case DOWN: + { + if ( n + 1 < _rw->num ) + _swap( n + 1, n ); + break; + } + + } + + unlock(); +} + +/* Render sequence to a string.. suitable for display in the UI */ +char * +sequence::dump ( void ) +{ + char *s = (char *)malloc( 256 ); + s[0] = '\0'; + size_t siz = 256; + + int start = 1; + for ( int i = 0; i < _rd->num; i++ ) + { + const int len = 256; + + char line[len]; + + int x = _rd->phrases[ i ]; + + phrase *p = phrase::phrase_by_number( x ); + + if ( ! p ) + return NULL; + + snprintf( line, len, "%d\t%d\t%s\n", start, p->number(), p->name() ); + + start += p->bars(); + + s = (char *)realloc( s, siz += strlen( line ) + 1 ); + + strcat( s, line ); + } + return s; +} + + +void +sequence::play ( tick_t start, tick_t end ) const +{ + // keep our own copy. + data *d = _rd; + + tick_t offset = 0; + for ( int i = 0; i < d->num; i++ ) + { + phrase *p = phrase::phrase_by_number( d->phrases[ i ] ); + if ( p ) + { + tick_t pstart = offset; + tick_t pend = offset + p->length(); + + // this phrase seems to be current. + if ( pend > start && pstart <= end ) + { + p->trigger( pstart, pend ); + + _playing = p->number(); + + _index = start; + + p->play( start, end ); + } + + offset = pend; + } + else + WARNING( "programming error: no such phrase." ); + } +} + +/** return the number of the currently playing phrase, or 0 if none. */ +int +sequence::playing ( void ) const +{ + return _playing; +} + +/** return the location of the playhead for this sequence */ +tick_t +sequence::index ( void ) const +{ + return _index; +} + +/** return the total length of the sequence in ticks */ +tick_t +sequence::length ( void ) const +{ + tick_t l = 0; + + for ( int i = 0; i < _rd->num; i++ ) + { + phrase *p = phrase::phrase_by_number( _rd->phrases[ i ] ); + + if ( ! p ) + break; + + l += p->length(); + } + + return l; +} + +/** return to a blank slate */ +void +sequence::reset ( void ) +{ +// MESSAGE( "reseting" ); + + lock(); + + _rw->num = 0; + + phrase::reset(); + pattern::reset(); + + unlock(); +} + +/** load entire sequence from file, replacing everything */ +bool +sequence::load ( const char *name ) +{ + smf f; + + if ( ! f.open( name, smf::READ ) ) + { + WARNING( "error opening file: %s", strerror( errno ) ); + return false; + } + + f.read_header(); + + if ( f.format() != 2 ) + { + WARNING( "not a Non song file" ); + return false; + } + + f.next_track(); + + DMESSAGE( "reading song info" ); + + /* read song info */ + int mode = PATTERN; + int phrases = 0; + int patterns = 0; + char *sname = NULL; + char *notes = NULL; + + if ( ! f.read_song_info( &mode, &phrases, &patterns, &sname, ¬es ) ) + { + WARNING( "not a Non song file" ); + return false; + } + + song.play_mode = (play_mode_e)mode; + + if ( sname ) + this->name( sname ); + + if ( notes ) + this->notes( notes ); + + /* tear it down */ + reset(); + + DMESSAGE( "reading playlist" ); + +// f.read_playlist( this ); + + lock(); + + char *s; + while ( (s = f.read_cue_point() ) ) + { + int n; + + sscanf( s, "%d:", &n ); + + _rw->phrases.insert( _find( _rw->num++ ), n ); + } + + /* read playlist */ + + DMESSAGE( "reading phrases" ); + + while ( phrases-- && f.next_track() ) + { + phrase *p = new phrase; + + p->load( &f ); + } + + DMESSAGE( "reading patterns" ); + + while ( patterns-- && f.next_track() ) + { + pattern *p = new pattern; + + p->load( &f ); + } + + unlock(); + + signal_new_song(); + + return true; +} + +/** save entire sequence to file */ +void +sequence::save ( const char *name ) const +{ + smf f; + + /* open for writing */ + f.open( name, smf::WRITE ); + + f.write_header( 2 ); + + DMESSAGE( "saving playlist" ); + + f.open_track( NULL, -1 ); + + DMESSAGE( "saving song info" ); + + f.write_song_info( song.play_mode, phrase::phrases(), pattern::patterns(), this->name(), notes() ); + + for ( int i = 0; i < _rd->num; ++i ) + { + char pat[256]; + + phrase *p = phrase::phrase_by_number( _rd->phrases[ i ] ); + + snprintf( pat, 256, "%d: %s", p->number(), p->name() ); + + f.write_meta_event( smf::CUEPOINT, pat ); + } + + f.close_track( 0 ); + + DMESSAGE( "saving phrases" ); + + for ( int i = 0; i < phrase::phrases(); i++ ) + { + phrase *p = phrase::phrase_by_number( i + 1 ); + + p->dump( &f ); + } + + DMESSAGE( "saving patterns" ); + + for ( int i = 0; i < pattern::patterns(); i++ ) + { + pattern *p = pattern::pattern_by_number( i + 1 ); + + p->dump( &f ); + } +} + + +/*************/ +/* Accessors */ +/*************/ + +char * +sequence::name ( void ) const +{ + return _name; +} + +void +sequence::name ( const char *s ) +{ + if ( _name ) free( _name ); + + _name = strdup( s ); + + song.set_dirty(); +} + +char * +sequence::notes ( void ) const +{ + return _notes; +} + +void +sequence::notes ( const char *s ) +{ + if ( _notes ) free( _notes ); + + _notes = strdup( s ); + + song.set_dirty(); +} diff --git a/sequencer/src/sequence.H b/sequencer/src/sequence.H new file mode 100644 index 0000000..321abd4 --- /dev/null +++ b/sequencer/src/sequence.H @@ -0,0 +1,85 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include +#include + +#include + +#include "common.h" + +using std::vector; +using std::list; +using namespace sigc; + +class sequence : public trackable { + + struct data { + vector phrases; + int num; + + data() { num = 0; } + }; + + list _history; + + data *_rd; + data *_rw; + + char * _name; + char * _notes; + + mutable volatile int _playing; + mutable volatile tick_t _index; + + void lock ( void ); + void unlock ( void ); + + vector ::iterator _find ( int n ); + + void _swap ( int n1, int n2 ); + +public: + + signal signal_new_song; + + sequence( void ); + + void reset ( void ); + + void insert ( unsigned int n, int pn ); + void remove ( int n ); + void move ( int n, int dir ); + int phrases ( void ) const; + char * dump ( void ); + bool load ( const char *name ); + void save ( const char *name ) const; + void play ( tick_t start, tick_t end ) const; + int playing ( void ) const; + tick_t index ( void ) const; + tick_t length ( void ) const; + + char * name ( void ) const; + void name ( const char *s ); + char * notes ( void ) const; + void notes ( const char *s ); + +}; diff --git a/sequencer/src/smf.C b/sequencer/src/smf.C new file mode 100644 index 0000000..e79d3fb --- /dev/null +++ b/sequencer/src/smf.C @@ -0,0 +1,1161 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "smf.H" +#include "phrase.H" +#include "pattern.H" + + +smf::smf ( void ) +{ + _name = NULL; + _pos = 0; + + _fp = NULL; + + _length = 0; + _length_pos = 0; + _num_tracks_pos = 0; + _tracks = 0; + _time = 0; + _tally = 0; + _cue = 0; + _track = 0; +} + +smf::~smf ( void ) +{ + /* fill in the number of tracks */ + if ( _num_tracks_pos ) + { + fseek( _fp, _num_tracks_pos, SEEK_SET ); + write_short( _tracks ); + } + + if ( _fp ) + fclose( _fp ); + + if ( _name ) + free( _name ); +} + +int +smf::open ( const char *name, int mode ) +{ + _name = strdup( name ); + + _mode = mode; + + _fp = fopen( _name, mode == smf::WRITE ? "w" : "r" ); + + return _fp != NULL; +} + +/*************************/ +/* Private bit twiddlers */ +/*************************/ + +unsigned long +smf::read_long ( void ) +{ + byte_t buf[4]; + unsigned long ret = 0; + + read_bytes( buf, 4 ); + + ret += *(buf + 0) << 24; + ret += *(buf + 1) << 16; + ret += *(buf + 2) << 8; + ret += *(buf + 3); + + return ret; +} + +unsigned short +smf::read_short ( void ) +{ + byte_t buf[2]; + unsigned short ret = 0; + + read_bytes( buf, 2 ); + + ret += *(buf + 0) << 8; + ret += *(buf + 1); + + return ret; +} + +unsigned long +smf::read_var ( void ) +{ + unsigned long ret = 0; + unsigned char c; + + /* while bit #7 is set */ + while ( ( ( c = read_byte() ) & 0x80 ) != 0x00 ) + { + + /* shift ret 7 bits */ + ret <<= 7; + /* add bits 0-6 */ + ret += c & 0x7F; + } + + /* bit was clear */ + ret <<= 7; + ret += c & 0x7F; + + return ret; +} + +void +smf::read_bytes ( void *p, int l ) +{ + fread( p, l, 1, _fp ); + + _pos += l; +} + +byte_t +smf::read_byte ( void ) +{ + byte_t b; + read_bytes( &b, 1 ); + + return b; +} + +void +smf::write_var ( long var ) +{ + long buffer; + buffer = var & 0x7F; + + /* we shift it right 7, if there is + still set bits, encode into buffer + in reverse order */ + while ( ( var >>= 7) ) + { + buffer <<= 8; + buffer |= ( var & 0x7F ) | 0x80; + } + + for ( ;; ) + { + write_byte( buffer ); + + if ( buffer & 0x80 ) + buffer >>= 8; + else + break; + } +} + + +void +smf::write_long ( unsigned long x ) +{ + byte_t buf[4]; + + buf[0] = ( x & 0xFF000000 ) >> 24; + buf[1] = ( x & 0x00FF0000 ) >> 16; + buf[2] = ( x & 0x0000FF00 ) >> 8; + buf[3] = x & 0x000000FF; + + write_bytes( buf, 4 ); +} + +void +smf::write_ascii ( const char *buf ) +{ + if ( strlen( buf ) != 4 ) + ASSERTION( "invalid MIDI value" ); + + write_bytes( (void *)buf, 4 ); +} + +void +smf::write_short ( unsigned short x ) +{ + byte_t buf[2]; + + buf[0] = (x & 0xFF00 ) >> 8; + buf[1] = x & 0x00FF; + + write_bytes( buf, 2 ); +} + +void +smf::write_byte ( byte_t b ) +{ + write_bytes( &b, 1 ); +} + + +void +smf::write_bytes ( const void *p, size_t l ) +{ + fwrite( p, l, 1, _fp ); + _tally += l; +} + + + +/*************************/ +/* Read and write tracks */ +/*************************/ + +/* write event /e/ to the currently open file (should only be used in a track) + if /cue/ is true, transform a notes-on/off into cue messages */ +void +smf::write_event ( const midievent *e ) +{ + tick_t ts = e->timestamp(); + tick_t delta = ts - _time; + _time = ts; + + write_var( delta ); + + if ( _cue && (e->is_note_off() || e->is_note_on() ) ) + { + /* begin cue message */ + write_byte( 0xF0 ); /* sysex */ + + write_var( 7 ); /* length of this message */ + + static byte_t data[] = { 0x7F, /* MTC */ + 0, /* id */ + 0x05 }; /* cue message */ + + write_bytes( data, sizeof( data ) ); + + write_byte( e->opcode() == event::NOTE_ON ? 0x05 : 0x06 ); + write_short( e->note() ); + + /* terminate */ + write_byte( 0xF7 ); + + _status = 0; + } + else + { + byte_t buf[4]; + + int l = e->size(); + + midievent me = *e; + + if ( me.opcode() == event::NOTE_OFF ) + { + me.opcode( event::NOTE_ON ); + me.note_velocity( 0 ); + } + + me.raw( buf, l ); + + /* write with running status */ + if ( buf[0] != _status ) + { + write_bytes( buf, l ); + _status = buf[0]; + } + else + write_bytes( buf + 1, l - 1 ); + + } +} + +void +smf::write_header ( int fmt ) +{ + write_ascii( "MThd" ); + write_long( 6 ); /* Always 6 bytes of header */ + + _format = fmt; + + write_short( fmt ); /* format, SMF-0 for 1 track SMF-2 for more */ + + _num_tracks_pos = ftell( _fp ); + _tracks = 0; + + write_short( 0xDEAF ); + + write_short( PPQN ); +} + +/* start a new MIDI 'chunk', /id/ is 4 letters of ASCII */ +void +smf::open_chunk ( const char *id ) +{ + if ( _length_pos ) + ASSERTION( "chunks cannot be nested!" ); + + write_ascii( id ); + + /* reset track length counter */ + _length_pos = ftell( _fp ); + + write_long( 0xBEEFCAFE ); /* length, this has to be filled in at track end! */ + + _tally = 0; + _time = 0; +} + +void +smf::close_chunk ( void ) +{ + /* fill in track length */ + long here = ftell( _fp ); + + fseek( _fp, _length_pos, SEEK_SET ); + + write_long( _tally ); + + fseek( _fp, here, SEEK_SET ); + + /* cleanup */ + _length_pos = 0; + _tally = 0; +} + +void +smf::open_track ( const char *name, int num ) +{ + open_chunk( "MTrk" ); + + if ( _format == 2 && num >= 0 ) + write_meta_event ( smf::SEQUENCE, num ); + + if ( name ) + write_meta_event ( smf::NAME, name ); + + ++_tracks; + + _status = 0; + + // FIXME: write time signature here +} + +void +smf::close_track ( tick_t length ) +{ + /* end */ + write_meta_event( smf::END, length ? length - _time : 0 ); + + _cue = 0; + + close_chunk(); +} + +void +smf::write_meta_event ( byte_t type, int n ) +{ + write_var( type == smf::END ? n : 0 ); /* delta time */ + write_short( 0xFF00 + type ); + + /* write length bytes */ + switch ( type ) + { + case smf::TEMPO: + write_byte( 3 ); +// FIXME: + break; + case smf::SEQUENCE: + write_byte( 2 ); + write_short( n ); + break; + case smf::CHANNEL: + case smf::PORT: + write_byte( 1 ); + write_byte( n ); + break; + case smf::END: + write_byte( 0x00 ); + break; + case smf::PROPRIETARY: + // length + write_var( n ); + break; +// FIXME: handle time sig, key sig, proprietary + } + + _status = 0; +} + +void +smf::write_meta_event ( byte_t type, const char *s ) +{ + write_var( 0 ); + write_short( 0xFF00 + type ); + + switch ( type ) + { + case smf::TEXT: + case smf::NAME: + case smf::INSTRUMENT: + case smf::COPYRIGHT: + case smf::LYRIC: + case smf::MARKER: + case smf::CUEPOINT: + { + int l = strlen( s ); + + write_var( l ); + + write_bytes( s, l ); + + break; + } + default: + ASSERTION( "event type does not take text!" ); + break; + } +} + +/** write song gloabl info (only used on playlist track) */ +void +smf::write_song_info ( int mode, int phrases, int patterns, const char *name, const char *notes ) +{ + write_meta_event( smf::PROPRIETARY, 5 + (4 * 2) /* length */ ); + + write_ascii( "Non!" ); + + write_byte( mode ); + write_long( phrases ); + write_long( patterns ); + + if ( name ) + write_meta_event( smf::NAME, name ); + + write_meta_event( smf::TEXT, ":: Created by the Non-Seqeuncer" ); + + if ( notes ) + write_meta_event( smf::TEXT, notes ); +} + +void +smf::write_phrase_info ( const phrase *p ) +{ + if ( p->notes() ) + write_meta_event( smf::TEXT, p->notes() ); + + char *s = p->viewport.dump(); + + char pat[156]; + snprintf( pat, sizeof( pat ), "Non: xywh=%s", + s ); + + free( s ); + + write_meta_event( smf::PROPRIETARY, strlen( pat ) ); + write_bytes( pat, strlen( pat ) ); +} + +/** write proprietary pattern info meta event */ +void +smf::write_pattern_info ( const pattern *p ) +{ + write_meta_event( smf::PORT, p->port() ); + + char pat[256]; + + snprintf( pat, sizeof( pat ), "%s: %s", p->mapping.type(), p->mapping.name() ); + + write_meta_event( smf::INSTRUMENT, pat ); + + if ( p->notes() ) + write_meta_event( smf::TEXT, p->notes() ); + + char *s = p->viewport.dump(); + + snprintf( pat, sizeof( pat ), "Non: xywh=%s, ppqn=%d, key=%d, note=%d, mode=%d", + s, p->ppqn(), p->mapping.key(), p->note(), p->mode() ); + + free( s ); + + write_meta_event( smf::PROPRIETARY, strlen( pat ) ); + write_bytes( pat, strlen( pat ) ); +} + +/* turn on note->cue translation for this track */ +void +smf::cue ( bool b ) +{ + _cue = b; +} + + +/**********/ +/* Reader */ +/**********/ + +char * +smf::read_text ( void ) +{ + int l = read_var(); + + char *s = (char*) malloc( l + 1 ); + + read_bytes( s, l ); + + s[l] = '\0'; + + return s; +} + + +int +smf::read_header ( void ) +{ + char id[4]; + read_bytes( id, 4 ); + + if ( strncmp( id, "MThd", 4 ) ) + return 0; + + if ( read_long() != 6 ) + return 0; + + _format = read_short(); + _tracks = read_short(); + _ppqn = read_short(); + + _pos = 0; + + return 1; +} + +void +smf::home ( void ) +{ + fseek( _fp, 14, SEEK_SET ); + + _track = 0; + _pos = 0; + _length = 0; +} + +void +smf::skip ( size_t l ) +{ + fseek( _fp, l, SEEK_CUR ); + _pos += l; +} + +void +smf::backup ( size_t l ) +{ + skip( 0 - l ); +} + +char * +smf::read_track_name ( void ) +{ + int status; + long where = 0; + int num = 0; + + for ( num = 0; ; ++num ) + { + where = _pos; + + read_var(); /* delta */ + status = read_byte(); + + /* stop at first non meta-event */ + if ( status != midievent::META ) + break; + + int opcode = read_byte(); + + switch ( opcode ) + { + case smf::NAME: + return read_text(); + case smf::TEXT: + return read_text(); + default: + skip( read_var() ); + } + } + + backup( _pos - where ); + + return NULL; +} + +/** read next Cue Point event on track */ +char * +smf::read_cue_point ( void ) +{ + read_var(); /* delta */ + + int status = read_byte(); + + if ( status != midievent::META ) + return NULL; + + int opcode = read_byte(); + + if ( opcode != smf::CUEPOINT ) + return NULL; + + return read_text(); +} + +bool +smf::read_song_info ( int * mode, int * phrases, int *patterns, char **name, char **notes ) +{ + int status; + long where = 0; + int num = 0; + bool r = false; + *notes = NULL; + + for ( num = 0; ; ++num ) + { + where = _pos; + + read_var(); /* delta */ + status = read_byte(); + + /* stop at first non meta-event */ + if ( status != midievent::META ) + break; + + int opcode = read_byte(); + + switch ( opcode ) + { + case smf::PROPRIETARY: + { + int len = read_var(); + + if ( len < 5 + (2 * 4) ) + return false; + + char id[4]; + read_bytes( id, 4 ); + + if ( strncmp( id, "Non!", 4 ) ) + return false; + + *mode = read_byte(); + *phrases = read_long(); + *patterns = read_long(); + + r = true; + + break; + } + case smf::TEXT: + { + char *text = read_text(); + + if ( ! strncmp( text, "::", 2 ) ) + free( text ); + else + *notes = text; + + break; + } + case smf::NAME: + *name = read_text(); + break; + case smf::END: + goto done; + default: + goto semidone; + } + } + +semidone: + + backup( _pos - where ); + +done: + + return r; +} + +bool +smf::read_phrase_info ( phrase *p ) +{ + int status; + long where = 0; + int num = 0; + + for ( num = 0; ; ++num ) + { + where = _pos; + + read_var(); /* delta */ + status = read_byte(); + + /* stop at first non meta-event */ + if ( status != midievent::META ) + break; + + int opcode = read_byte(); + + switch ( opcode ) + { + case smf::SEQUENCE: + /* currently, this is ignored */ + read_var(); + read_short(); + break; + case smf::NAME: + p->name( read_text() ); + DMESSAGE( "Track name: %s", p->name() ); + break; + case smf::INSTRUMENT: + skip( read_var() ); + break; + case smf::TEXT: + p->notes( read_text() ); + break; + case smf::PROPRIETARY: + { + int l = read_var(); + + char *data = (char *) alloca( l ) + 1; + + read_bytes( data, l ); + + data[l] = '\0'; + + char *s; + + if ( 1 != sscanf( data, "Non: xywh=%a[0-9:]", + &s ) ) + WARNING( "Invalid phrase info event" ); + else + { + p->viewport.read( s ); + free( s ); + } + break; + } + case smf::END: + /* Track ends before any non meta-events... */ + read_byte(); + goto done; + default: + int l = read_var(); + skip( l ); + WARNING( "skipping unrecognized meta event %02X", opcode ); + break; + } + } + + backup( _pos - where ); + +done: + + return num ? p : NULL; +} + +/** inform pattern /p/ from meta-events at the beginning of the + current track */ +bool +smf::read_pattern_info ( pattern *p ) +{ + int status; + long where = 0; + int num = 0; + + bool name_set = false; + + for ( num = 0; ; ++num ) + { + where = _pos; + + read_var(); /* delta */ + status = read_byte(); + + /* stop at first non meta-event */ + if ( status != midievent::META ) + break; + + int opcode = read_byte(); + + switch ( opcode ) + { + case smf::SEQUENCE: + /* currently, this is ignored */ + read_var(); + read_short(); + break; + case smf::NAME: + p->name( read_text() ); + DMESSAGE( "Track name: %s", p->name() ); + name_set = true; + break; + case smf::INSTRUMENT: + { + char *s = read_text(); + + char pat[256]; + + if ( 1 == sscanf( s, "Instrument: %[^\n]", pat ) ) + { + if ( ! p->mapping.open( Mapping::INSTRUMENT, pat ) ) + { + p->mapping.open( Mapping::SCALE, "Chromatic" ); + WARNING( "could not find instrument \"%s\"", pat ); + } + } + else + if ( 1 == sscanf( s, "Scale: %[^\n]", pat ) ) + { + if ( ! p->mapping.open( Mapping::SCALE, pat ) ) + { + p->mapping.open( Mapping::SCALE, "Chromatic" ); + WARNING( "could not find scale \"%s\"", pat ); + } + } + break; + } + case smf::PORT: + read_byte(); + p->port( read_byte() ); + break; + case smf::TEXT: + if ( ! name_set ) + { + /* also accept TEXT event as name if no name was + provided--this is found in a number of older MIDI + files. */ + p->name( read_text() ); + name_set = true; + } + else + p->notes( read_text() ); + break; + case smf::PROPRIETARY: + { + int l = read_var(); + + char *data = (char *) alloca( l ) + 1; + + read_bytes( data, l ); + + data[l] = '\0'; + + int ppqn, key, note, mode; + char *s; + + if ( 5 != sscanf( data, "Non: xywh=%a[0-9:], ppqn=%d, key=%d, note=%d, mode=%d", + &s, &ppqn, &key, ¬e, &mode ) ) + WARNING( "Invalid pattern info event" ); + else + { + p->viewport.read( s ); + free( s ); + + p->ppqn( ppqn ); + + if ( key > 0 ) + p->mapping.key( key ); + + p->note( note ); + p->mode( mode ); + } + break; + } + case smf::END: + /* Track ends before any non meta-events... */ + read_byte(); + goto done; + default: + int l = read_var(); + skip( l ); + WARNING( "skipping unrecognized meta event %02X", opcode ); + break; + } + } + + backup( _pos - where ); + +done: + + return num ? p : NULL; +} + +int +smf::next_track ( void ) +{ + /* first, skip to the end of the track we're on, if any */ + if ( _length ) + skip( _length - _pos ); + + while ( ! feof( _fp ) && _track < _tracks ) + { + char id[4]; + read_bytes( id, 4 ); + _length = read_long(); + + if ( strncmp( id, "MTrk", 4 ) ) + { + WARNING( "skipping unrecognized chunk \"%s\"", id ); + /* not a track chunk */ + skip( _length ); + continue; + } + + _pos = 0; + ++_track; + return 1; + } + + return _length = _pos = 0; +} + + +/** locate track number /n/ */ +bool +smf::seek_track ( int n ) +{ + home(); + + if ( n >= _tracks ) + return false; + + for ( int i = 0; next_track(); ++i ) + if ( i == n ) + break; + + return true; +} + +char ** +smf::track_listing ( void ) +{ + if ( _pos != 0 ) + ASSERTION( "attempt to get track listing while in the middle of reading a track." ); + + char **sa = (char**)malloc( sizeof( char* ) * (_tracks + 1) ); + int i; + + long where = ftell( _fp ); + + for ( i = 0; next_track(); ++i ) + { + sa[i] = read_track_name(); + sa[i] = sa[i] ? sa[i] : strdup( "" ); + } + + sa[i] = NULL; + + /* go back to where we started */ + fseek( _fp, where, SEEK_SET ); + _pos = 0; + + return sa; +} + +/* print track list for file /name/ */ +void +smf::print_track_listing ( const char *name ) +{ + smf f; + + f.open( name, smf::READ ); + + f.read_header(); + + char **sa = f.track_listing(); + + char *s; + for ( int i = 0; (s = sa[i]); ++i ) + printf( "Track %3d: \"%s\"\n", i, s ); +} + +/** read all remaining events in current track and return them in a list */ +list * +smf::read_track_events ( tick_t *length ) +{ + list *events = new list ; + event e; + + *length = 0; + + byte_t oldstatus = -1; + tick_t time = 0; + tick_t tick = 0; + tick_t delta; + + while ( _pos < _length ) + { + byte_t data[3]; + + delta = read_var(); + + int status = read_byte(); + + if ( ! (status & 0x80) ) + { + backup( 1 ); + status = oldstatus; + } + else + oldstatus = status; + + time += delta; + tick = (time * PPQN) / _ppqn; + + e.timestamp( tick ); + + int opcode = status & 0xF0; + +// e.status( opcode ); + e.status( status ); + + switch ( opcode ) + { + case event::NOTE_OFF: + case event::NOTE_ON: + case event::AFTERTOUCH: + case event::CONTROL_CHANGE: + case event::PITCH_WHEEL: + + read_bytes( data, 2 ); + + /* handle note off, vel 0 */ + if ( opcode == event::NOTE_ON && 0 == data[1] ) + { + e.opcode( event::NOTE_OFF ); + data[1] = 127; + } + + e.data( data[0], data[1] ); + + events->push_back( e ); + + /* TODO: set MIDI channel here */ + break; + case event::PROGRAM_CHANGE: + case event::CHANNEL_PRESSURE: + + data[0] = read_byte(); + + e.lsb( data[0] ); + + events->push_back( e ); + break; + case 0xF0: + /* TODO: hanlde proprietary events? */ + if ( midievent::META != status ) + { + if ( 0xF0 == status ) + { + /* looks like a sysex */ + int l = read_var(); + + if ( l < 4 ) + ASSERTION( "unrecognized message" ); + + byte_t *data = (byte_t *) alloca( 4 ); + + read_bytes( data, 4 ); + + l -= 4; + + if ( data[0] == 0x7F && + data[2] == 0x05 ) + { + /* looks like a cue message! */ + + switch ( data[3] ) + { + case 0x05: + /* start */ + e.status( event::NOTE_ON ); + e.note( read_short() ); + events->push_back( e ); + l -= 2; + break; + case 0x06: + /* stop */ + e.status( event::NOTE_OFF ); + e.note( read_short() ); + events->push_back( e ); + l -= 2; + break; + default: + ASSERTION( "unrecognized cue message" ); + break; + } + } + + DMESSAGE( "converting MIDI cue to note-on/off n: %d", e.note() ); + + /* just in case */ + skip( l ); + } + else + { + WARNING( "unrecognized opcode %02X", status ); + // FIXME: what now? + } + break; + } + + opcode = read_byte(); + + switch ( opcode ) + { + case smf::END: /* track end */ + /* track extends until this event */ + *length = tick; + + if ( read_byte() ) + WARNING( "corrupt MIDI file in track end" ); + goto done; + break; + default: + WARNING( "unhandled meta-event %02X", opcode ); + skip( read_var() ); + break; + } + } + } + +done: + + return events; +} + + +/**************************/ +/* accessors (for reader) */ +/**************************/ + +int +smf::format ( void ) const +{ + return _format; +} + +int +smf::tracks ( void ) const +{ + return _tracks; +} diff --git a/sequencer/src/smf.H b/sequencer/src/smf.H new file mode 100644 index 0000000..d44f25c --- /dev/null +++ b/sequencer/src/smf.H @@ -0,0 +1,144 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include "grid.H" +#include "event.H" + +class pattern; +class phrase; + +#include + +class smf +{ + + char * _name; + + int _format; /* 0, 1, 2 */ + + FILE *_fp; + + /* reader */ + long _length; /* length of the current chunk */ + long _pos; /* number of bytes read from chunk */ + int _ppqn; /* PPQN of imported files */ + + /* writer */ + unsigned int _tally; /* number of bytes written thus far */ + long _num_tracks_pos; /* where to write the number of tracks when known */ + long _length_pos; /* where to write the chunk length when known */ + int _cue; /* transform note ons to cue events for this track */ + + int _tracks; /* number of tracks */ + int _track; /* current track */ + tick_t _time; /* current timestamp in writer */ + + int _mode; + + byte_t _status; + +public: + + enum { WRITE, READ }; + + unsigned long read_long ( void ); + unsigned short read_short ( void ); + unsigned long read_var ( void ); + void read_bytes ( void *p, int l ); + byte_t read_byte ( void ); + + void write_var ( long var ); + void write_long ( unsigned long x ); + void write_ascii ( const char *buf ); + void write_short ( unsigned short x ); + void write_byte ( byte_t b ); + void write_bytes ( const void *p, size_t l ); + +/* Meta Event codes */ + enum { + SEQUENCE = 0x00, + TEXT = 0x01, + COPYRIGHT = 0x02, + NAME = 0x03, + INSTRUMENT = 0x04, + LYRIC = 0x05, + MARKER = 0x06, + CUEPOINT = 0x07, + PROGRAM = 0x08, + DEVICE = 0x09, + CHANNEL = 0x20, + PORT = 0x21, + END = 0x2F, + TEMPO = 0x51, + SMPTE = 0x54, + TIMESIG = 0x58, + KEYSIG = 0x59, + PROPRIETARY = 0x7F + }; + + smf( void ); + ~smf( void ); + + int open ( const char *name, int mode ); + + static void print_track_listing ( const char *name ); + + void write_meta_event ( byte_t type, int n ); + void write_meta_event ( byte_t type, const char *s ); + + void write_event ( const midievent *e ); + void write_header ( int tracks ); + + void open_chunk ( const char *id ); + void close_chunk ( void ); + void open_track ( const char *name, int num ); + void close_track ( tick_t length ); + + void write_pattern_info ( const pattern *p ); + + void cue ( bool b ); + + list * read_track_events ( tick_t *length ); + + void write_phrase_info ( const phrase *p ); + + bool read_song_info( int *mode, int *phrases, int *patterns, char **name, char **notes ); + void write_song_info( int mode, int phrases, int patterns, const char *name, const char *notes ); + + void home ( void ); + void skip ( size_t l ); + void backup ( size_t l ); + + int next_track ( void ); + bool seek_track ( int n ); + char ** track_listing ( void ); + + char * read_cue_point ( void ); + int read_header ( void ); + char * read_text ( void ); + char * read_track_name ( void ); + bool read_phrase_info ( phrase *p ); + bool read_pattern_info ( pattern *p ); + + int format ( void ) const; + int tracks ( void ) const; + +}; diff --git a/sequencer/src/transport.C b/sequencer/src/transport.C new file mode 100644 index 0000000..25d9e0b --- /dev/null +++ b/sequencer/src/transport.C @@ -0,0 +1,220 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include + +#include +#include +#include + +#include "transport.H" +#include "common.h" +#include "const.h" + +extern jack_client_t *client; + +/* FIXME: use JackSyncCallback instead? (sync-callback) */ + +Transport transport; + +static volatile bool _done; + +/** callback for when we're Timebase Master, mostly taken from + * transport.c in Jack's example clients. */ +/* FIXME: there is a subtle interaction here between the tempo and + * JACK's buffer size. Inflating ticks_per_beat (as jack_transport + * does) diminishes the effect of this correlation, but does not + * eliminate it... This is caused by the accumulation of a precision + * error, and all timebase master routines I've examined appear to + * suffer from this same tempo distortion (and all use the magic + * number of 1920 ticks_per_beat in an attempt to reduce the magnitude + * of the error. Currently, we keep this behaviour. */ +void +Transport::timebase ( jack_transport_state_t, jack_nframes_t nframes, jack_position_t *pos, int new_pos, void * ) +{ + + if ( new_pos || ! _done ) + { + pos->valid = JackPositionBBT; + pos->beats_per_bar = transport._master_beats_per_bar; + pos->ticks_per_beat = 1920.0; /* magic number means what? */ + pos->beat_type = transport._master_beat_type; + pos->beats_per_minute = transport._master_beats_per_minute; + + double wallclock = (double)pos->frame / (pos->frame_rate * 60); + + unsigned long abs_tick = wallclock * pos->beats_per_minute * pos->ticks_per_beat; + unsigned long abs_beat = abs_tick / pos->ticks_per_beat; + + pos->bar = abs_beat / pos->beats_per_bar; + pos->beat = abs_beat - (pos->bar * pos->beats_per_bar) + 1; + pos->tick = abs_tick - (abs_beat * pos->ticks_per_beat); + pos->bar_start_tick = pos->bar * pos->beats_per_bar * pos->ticks_per_beat; + pos->bar++; + + _done = true; + } + else + { + pos->tick += nframes * pos->ticks_per_beat * pos->beats_per_minute / (pos->frame_rate * 60); + + while ( pos->tick >= pos->ticks_per_beat ) + { + pos->tick -= pos->ticks_per_beat; + + if ( ++pos->beat > pos->beats_per_bar ) + { + pos->beat = 1; + + ++pos->bar; + + pos->bar_start_tick += pos->beats_per_bar * pos->ticks_per_beat; + } + } + } +} + + +Transport::Transport ( void ) +{ + _master_beats_per_bar = 4; + _master_beat_type = 4; + _master_beats_per_minute = 120; + _done = false; +} + +void +Transport::poll ( void ) +{ + jack_transport_state_t ts; + jack_position_t pos; + + ts = jack_transport_query( client, &pos ); + + rolling = ts == JackTransportRolling; + + valid = pos.valid & JackPositionBBT; + + bar = pos.bar; + beat = pos.beat; + tick = pos.tick; + + /* bars and beats start at 1.. */ + pos.bar--; + pos.beat--; + + /* FIXME: these probably shouldn't be called from the RT + thread... Anyway, it happens infrequently. */ + if ( pos.beats_per_minute != beats_per_minute ) + signal_tempo_change( pos.beats_per_minute ); + + if ( pos.beats_per_bar != beats_per_bar ) + signal_bpb_change( pos.beats_per_bar ); + + if ( pos.beat_type != beat_type ) + signal_beat_change( pos.beat_type ); + + ticks_per_beat = pos.ticks_per_beat; + beats_per_bar = pos.beats_per_bar; + beat_type = pos.beat_type; + beats_per_minute = pos.beats_per_minute; + + frame = pos.frame; + frame_rate = pos.frame_rate; + + /* FIXME: this only needs to be calculated if bpm or framerate changes */ + { + const double frames_per_beat = frame_rate * 60 / beats_per_minute; + + frames_per_tick = frames_per_beat / (double)PPQN; + ticks_per_period = nframes / frames_per_tick; + } + + tick_t abs_tick = (pos.bar * pos.beats_per_bar + pos.beat) * pos.ticks_per_beat + pos.tick; +// tick_t abs_tick = pos.bar_start_tick + (pos.beat * pos.ticks_per_beat) + pos.tick; + + /* scale Jack's ticks to our ticks */ + + const double pulses_per_tick = PPQN / pos.ticks_per_beat; + + ticks = abs_tick * pulses_per_tick; + tick = tick * pulses_per_tick; + + ticks_per_beat = PPQN; +} + +void +Transport::start ( void ) +{ + MESSAGE( "Starting transport" ); + jack_transport_start( client ); +} + +void +Transport::stop ( void ) +{ + MESSAGE( "Stopping transport" ); + jack_transport_stop( client ); +} + +void +Transport::toggle ( void ) +{ + if ( rolling ) + stop(); + else + start(); +} + +void +Transport::locate ( tick_t ticks ) +{ + jack_nframes_t frame = trunc( ticks * transport.frames_per_tick ); + + MESSAGE( "Relocating transport to %lu, %lu", ticks, frame ); + + jack_transport_locate( client, frame ); +} + +void +Transport::set_beats_per_minute ( double n ) +{ + _master_beats_per_minute = n; + _done = false; +} + +void +Transport::set_beats_per_bar ( int n ) +{ + if ( n < 2 ) + return; + + _master_beats_per_bar = n; + _done = false; +} + +void +Transport::set_beat_type ( int n ) +{ + if ( n < 4 ) + return; + + _master_beat_type = n; + _done = false; +} diff --git a/sequencer/src/transport.H b/sequencer/src/transport.H new file mode 100644 index 0000000..86d3c7e --- /dev/null +++ b/sequencer/src/transport.H @@ -0,0 +1,84 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma once + +#include + +using namespace sigc; + +#include "event.H" // just for tick_t + +#include + +typedef double playhead_t; + +class Transport : public trackable { + + double _master_beats_per_minute; + unsigned _master_beats_per_bar; + unsigned _master_beat_type; + +public: + + signal signal_tempo_change; + signal signal_bpb_change; + signal signal_beat_change; + + bool master; /* are we driving the transport? */ + bool rolling; + bool valid; + volatile bool recording; + + unsigned long bar; + unsigned beat; + unsigned tick; + + playhead_t ticks; + + unsigned beats_per_bar; + unsigned beat_type; + double ticks_per_beat; + double beats_per_minute; + + double ticks_per_period; + double frames_per_tick; + + double frame_rate; + + double frame; + double nframes; + + Transport ( void ); + + void poll ( void ); + void start ( void ); + void stop ( void ); + void toggle ( void ); + void locate ( tick_t ticks ); + + void set_beats_per_minute ( double n ); + void set_beats_per_bar ( int n ); + void set_beat_type ( int n ); + + static void timebase ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos, void *arg ); + +}; + +extern Transport transport; diff --git a/session-manager/configure b/session-manager/configure index 38766a4..3f1587c 100755 --- a/session-manager/configure +++ b/session-manager/configure @@ -14,13 +14,12 @@ ask "Build for debugging" USE_DEBUG no begin_tests -require_FLTK 1.1.7 images -require_command FLUID fluid require_command ar ar require_command makedepend makedepend +require_FLTK 1.3.0 images +require_command FLUID lib/ntk/fluid/fluid suggest_package JACK 0.103.0 jack require_package liblo 0.23 liblo -require_package sigcpp 2.0.0 sigc++-2.0 suggest_package XPM 2.0.0 xpm test_version `version_of liblo` 0.26 || warn "Version $(version_of liblo) of liblo is slow to create servers. Consider upgrading to 0.26 or later" diff --git a/session-manager/doc/API.html b/session-manager/doc/API.html index c23ae1a..71b5837 100644 --- a/session-manager/doc/API.html +++ b/session-manager/doc/API.html @@ -12,7 +12,7 @@
Jonathan Moore Liles <male@tuxfamily.org>
August 1, 2010
-Version 1.0 +Version 1.1
logo
@@ -57,13 +57,17 @@ Version 1.0
  • 1.2.4. Client to Server Informational Messages -
  • 1.2.1.2. Response

    @@ -198,6 +203,7 @@ Presently, the server capabilities are: NameDescription server_controlclient-to-server control broadcastserver responds to /nsm/server/broadcast message +optional-guiserver responds to optional-gui messages--if this capability is not present then clients with optional-guis MUST always keep them visible

    A client should not consider itself to be under session management until it receives this response. For example, the Non applications activate their "SM" blinkers at this time. @@ -355,11 +361,41 @@ Or

    This message does not require a response.

    +

    1.2.3.2. Show Optional Gui

    +

    +If the client has specified the optional-gui capability, then it may receive this message from the server when the user wishes to change the visibility state of the GUI. It doesn't matter if the optional GUI is integrated with the program or if it is a separate program \(as is the case with SooperLooper\). When the GUI is hidden, there should be no window mapped and if the GUI is a separate program, it should be killed. +

    +
    +
    +/nsm/client/show_optional_gui 
    +
    +
    +
    +/nsm/client/hide_optional_gui
    +
    +

    +No response is message is required. +

    1.2.4. Client to Server Informational Messages

    These are optional messages which a client can send to the NSM server to inform it about the client's status. The client should not expect any reply to these messages. If a client intends to send a message described in this section, then it MUST add the appropriate value to its capabilities string when composing the announce message.

    -

    1.2.4.1. Progress

    +

    1.2.4.1. Optional GUI

    +

    +If the client has specified the optional-gui capability, then it MUST send this message whenever the state of visibility of the optional GUI has changed. It also MUST send this message after it's announce message to indicate the initial visibility state of the optional GUI. +

    +
    +
    +/nsm/client/gui_is_hidden
    +
    +
    +
    +/nsm/client/gui_is_shown
    +
    +

    +No response will be delivered. +

    +

    1.2.4.2. Progress

    @@ -376,7 +412,7 @@ Note that even when using the progress feature, the final response to t

    Clients which intend to send progress messages should include :progress: in their announce capability string.

    -

    1.2.4.2. Dirtiness

    +

    1.2.4.3. Dirtiness

     /nsm/client/progress f:progress
     
    @@ -391,7 +427,7 @@ Some clients may be able to inform the server when they have unsaved changes pen

    Clients which have this capability should include :dirty: in their announce capability string.

    -

    1.2.4.3. Status Messages

    +

    1.2.4.4. Status Messages

     /nsm/client/is_dirty
     
    diff --git a/session-manager/doc/API.mu b/session-manager/doc/API.mu index a868b42..ffae33b 100644 --- a/session-manager/doc/API.mu +++ b/session-manager/doc/API.mu @@ -2,7 +2,7 @@ ! title Non Session Management API ! author Jonathan Moore Liles #(email,male@tuxfamily.org) ! date August 1, 2010 -! revision Version 1.0 +! revision Version 1.1 ! extra #(image,logo,icon.png) -- Table Of Contents @@ -156,6 +156,7 @@ [[ dirty, client knows when it has unsaved changes [[ progress, client can send progress updates during time-consuming operations [[ message, client can send textual status updates +[[ optional-gui, client has an optional GUI :::: Response @@ -179,6 +180,7 @@ [[ Name, Description [[ server_control, client-to-server control [[ broadcast, server responds to /nsm/server/broadcast message +[[ optional-gui, server responds to optional-gui messages--if this capability is not present then clients with optional-guis MUST always keep them visible A client should not consider itself to be under session management until it receives this response. For example, the Non applications @@ -366,6 +368,22 @@ This message does not require a response. +:::: Show Optional Gui + + If the client has specified the `optional-gui` capability, then it + may receive this message from the server when the user wishes to + change the visibility state of the GUI. It doesn't matter if the + optional GUI is integrated with the program or if it is a separate + program \(as is the case with SooperLooper\). When the GUI is + hidden, there should be no window mapped and if the GUI is a + separate program, it should be killed. + +> /nsm/client/show_optional_gui + +> /nsm/client/hide_optional_gui + + No response is message is required. + ::: Client to Server Informational Messages These are optional messages which a client can send to the NSM @@ -375,6 +393,20 @@ appropriate value to its `capabilities` string when composing the `announce` message. +:::: Optional GUI + + If the client has specified the `optional-gui` capability, then it + *MUST* send this message whenever the state of visibility of the + optional GUI has changed. It also *MUST* send this message after + it's announce message to indicate the initial visibility state of + the optional GUI. + +> /nsm/client/gui_is_hidden + +> /nsm/client/gui_is_shown + + No response will be delivered. + :::: Progress > /nsm/client/progress f:progress diff --git a/session-manager/doc/Makefile b/session-manager/doc/Makefile index c727c52..7d030b1 100644 --- a/session-manager/doc/Makefile +++ b/session-manager/doc/Makefile @@ -17,8 +17,8 @@ upload: all @ rm -f index.html install: - @ mkdir -p $(DOCUMENT_PATH)/non-session-manager - @ cp $(OBJS) *.png mup.css ../../COPYING $(DOCUMENT_PATH)/non-session-manager + @ install -d "$(DESTDIR)$(DOCUMENT_PATH)"/non-session-manager + @ cp $(OBJS) *.png mup.css ../../COPYING "$(DESTDIR)$(DOCUMENT_PATH)"/non-session-manager # @ ln -sf $(PIXMAP_PATH)/logo.png $(DOCUMENT_PATH) clean: diff --git a/session-manager/lib b/session-manager/lib new file mode 120000 index 0000000..dc598c5 --- /dev/null +++ b/session-manager/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/session-manager/makefile.inc b/session-manager/makefile.inc index a521781..4bdd02a 100644 --- a/session-manager/makefile.inc +++ b/session-manager/makefile.inc @@ -13,36 +13,48 @@ SRCS:=$(SRCS:.fl=.C) SRCS:=$(sort $(SRCS)) OBJS:=$(SRCS:.C=.o) -LIBS := $(LIBLO_LIBS) $(SIGCPP_LIBS) -CFLAGS := $(LIBLO_CFLAGS) $(SIGCPP_CFLAGS) $(XPM_CFLAGS) $(FLTK_CFLAGS) +LIBS += $(LIBLO_LIBS) +CFLAGS += $(LIBLO_CFLAGS) $(XPM_CFLAGS) $(FLTK_CFLAGS) -D_GNU_SOURCE src/nsmd: src/nsmd.o nonlib/libnonlib.a @ echo -n Linking session handler. - @ $(CXX) $(CXXFLAGS) $(LIBS) src/nsmd.o -o $@ -Lnonlib -lnonlib && echo $(DONE) + @ $(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS) -Lnonlib -lnonlib && echo $(DONE) -src/session-manager: src/session-manager.o nonlib/libnonlib.a +src/session-manager: src/session-manager.o nonlib/libnonlib.a $(FLTK_LIBS) @ echo -n Linking session handler. - @ $(CXX) $(CXXFLAGS) $(FLTK_LIBS) $(XPM_LIBS) $(LIBS) src/session-manager.o -o $@ -LFL -lfl_widgets -Lnonlib -lnonlib && echo $(DONE) + @ $(CXX) $(CXXFLAGS) $^ -o $@ $(FLTK_LDFLAGS) $(XPM_LIBS) $(LIBS) -LFL -lfl_widgets -Lnonlib -lnonlib && echo $(DONE) + +src/nsm-proxy: src/nsm-proxy.o nonlib/libnonlib.a + @ echo -n Linking NSM Proxy. + @ $(CXX) $(CXXFLAGS) $^ -o $@ $(LIBLO_LIBS) -Lnonlib -lnonlib && echo $(DONE) + +# src/NSM_Proxy_UI.o: +# @ cd src && $(FLUID) -c NSM_Proxy_UI.fl + +src/nsm-proxy-gui: src/NSM_Proxy_UI.o src/nsm-proxy-gui.o $(FLTK_LIBS) + @ echo -n Linking NSM Proxy... + @ $(CXX) $(CXXFLAGS) $(FLTK_LDFLAGS) $^ -o $@ $(XPM_LIBS) $(LIBLO_LIBS) $(FLTK_LIBS) -LFL -lfl_widgets && echo $(DONE) src/send_osc: src/send_osc.o nonlib/libnonlib.a - @ $(CXX) $(CXXFLAGS) $(LIBS) src/send_osc.o -o $@ -Lnonlib -lnonlib && echo $(DONE) + @ $(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS) -Lnonlib -lnonlib && echo $(DONE) src/jackpatch: src/jackpatch.o - @ $(CXX) $(CXXFLAGS) $(JACK_LIBS) $(LIBLO_LIBS) src/jackpatch.o -o $@ && echo $(DONE) + @ $(CXX) $(CXXFLAGS) $^ -o $@ $(JACK_LIBS) $(LIBLO_LIBS) && echo $(DONE) -Session: src/send_osc src/nsmd src/session-manager src/jackpatch + +Session: src/send_osc src/nsmd src/session-manager src/jackpatch src/nsm-proxy src/nsm-proxy-gui clean: - rm -f $(OBJS) src/nsmd src/session-manager src/jackpatch - - + rm -f $(OBJS) src/nsmd src/session-manager src/jackpatch src/nsm-proxy src/nsm-proxy-gui .deps install: all @ echo -n "Installing..." - @ install src/nsmd "$(DESTDIR)$(prefix)"/bin/nsmd - @ install src/session-manager "$(DESTDIR)$(prefix)"/bin/non-session-manager - @ install src/jackpatch "$(DESTDIR)$(prefix)"/bin/jackpatch - @ mkdir -p "$(DESTDIR)$(SYSTEM_PATH)"/non-session-manager + @ install -Dm755 src/nsmd "$(DESTDIR)$(prefix)"/bin/nsmd + @ install -Dm755 src/session-manager "$(DESTDIR)$(prefix)"/bin/non-session-manager + @ install -Dm755 src/nsm-proxy "$(DESTDIR)$(prefix)"/bin/nsm-proxy + @ install -Dm755 src/nsm-proxy-gui "$(DESTDIR)$(prefix)"/bin/nsm-proxy-gui + @ install -Dm755 src/jackpatch "$(DESTDIR)$(prefix)"/bin/jackpatch + @ install -d "$(DESTDIR)$(SYSTEM_PATH)"/non-session-manager @ $(MAKE) -s -C doc install @ install -d "$(DESTDIR)$(PIXMAP_PATH)/non-session-manager" @ install -m 644 icons/hicolor/256x256/apps/non-session-manager.png "$(DESTDIR)$(PIXMAP_PATH)"/non-session-manager/icon-256x256.png diff --git a/session-manager/src/NSM_Proxy_UI.fl b/session-manager/src/NSM_Proxy_UI.fl new file mode 100644 index 0000000..9627092 --- /dev/null +++ b/session-manager/src/NSM_Proxy_UI.fl @@ -0,0 +1,71 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0300 +header_name {.H} +code_name {.C} +class NSM_Proxy_UI {open +} { + Function {make_window()} {open + } { + Fl_Window {} { + label {NSM Proxy} open + xywh {1011 106 490 665} type Double color 47 labelcolor 55 visible + } { + Fl_Box {} { + label {Command-line options are incompatible with robust session management for a variety of reasons, so the NSM server does not support them directly. This proxy exists to allow programs which require command-line options to be included in an NSM session. Be warned that referring to files outside of the session directory will impair your ability to reliably archive and transport sessions. Patching the program to use NSM natively will result in a better experience. + +The program will be started with its current directory being a uniquely named directory under the current session directory. It is recommended that you only refer to files in the current directory. +} selected + xywh {15 11 460 233} box BORDER_BOX color 41 labelfont 8 labelcolor 55 align 128 + } + Fl_File_Input executable_input { + label {Executable: } + xywh {115 262 350 33} + } + Fl_Input arguments_input { + label {Arguments:} + xywh {115 414 350 28} + } + Fl_Input label_input { + label {Label:} + xywh {115 452 350 28} + } + Fl_Return_Button start_button { + label Start + xywh {380 625 88 25} + } + Fl_Button kill_button { + label Kill + xywh {295 625 80 25} color 72 hide + } + Fl_Choice save_signal_choice { + label {Save Signal:} open + xywh {110 625 170 25} down_box BORDER_BOX + } { + MenuItem {} { + label None + xywh {0 0 40 24} + } + MenuItem {} { + label SIGUSR1 + xywh {10 10 40 24} + } + MenuItem {} { + label SIGUSR2 + xywh {20 20 40 24} + } + MenuItem {} { + label SIGINT + xywh {30 30 40 24} + } + } + Fl_Box {} { + label {The environment variables $NSM_CLIENT_ID and $NSM_SESSION_NAME will contain the unique client ID (suitable for use as e.g. a JACK client name) and the display name for the session, respectively.} + xywh {15 312 460 87} box BORDER_BOX color 41 labelfont 8 labelcolor 55 align 128 + } + Fl_Box {} { + label {Some (very few) programs may respond to a specific Unix signal by somehow saving their state. If 'Save Signal' is set to something other than 'None', then NSM Proxy will deliver the specified signal to the proxied process upon an NSM 'Save' event. Most programs will treat these signals just like SIGTERM and die. You have been warned.} + xywh {15 497 460 114} box BORDER_BOX color 41 labelfont 8 labelcolor 55 align 128 + } + } + } +} diff --git a/session-manager/src/jackpatch.c b/session-manager/src/jackpatch.c index 8b25bf2..9dfe0c0 100644 --- a/session-manager/src/jackpatch.c +++ b/session-manager/src/jackpatch.c @@ -23,7 +23,6 @@ */ -#define _GNU_SOURCE #pragma GCC diagnostic ignored "-Wunused-parameter" #include diff --git a/session-manager/src/nsm-proxy-gui.C b/session-manager/src/nsm-proxy-gui.C new file mode 100644 index 0000000..ba49b5d --- /dev/null +++ b/session-manager/src/nsm-proxy-gui.C @@ -0,0 +1,191 @@ + +/*******************************************************************************/ +/* Copyright (C) 2012 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma GCC diagnostic ignored "-Wunused-parameter" + + +#define _MODULE_ "nsm-proxy-gui" + +#define APP_NAME "NSM Proxy" +#define APP_TITLE "NSM Proxy" + +#include "NSM_Proxy_UI.H" +#include "FL/Fl_Theme.H" +#include "FL/themes.H" +#include +#include +#include +#include +#include + +lo_server losrv; +lo_address nsmp_addr; + +static NSM_Proxy_UI *ui; + +int +osc_update ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + printf( "Got update for %s\n", path ); + + Fl::lock(); + + if (!strcmp( path, "/nsm/proxy/label" )) + ui->label_input->value( &argv[0]->s ); + else if (!strcmp( path, "/nsm/proxy/arguments" )) + ui->arguments_input->value( &argv[0]->s ); + else if (!strcmp( path, "/nsm/proxy/executable" )) + ui->executable_input->value( &argv[0]->s ); + else if (!strcmp( path, "/nsm/proxy/save_signal" )) + { + if ( argv[0]->i == SIGUSR1 ) + ui->save_signal_choice->value( 1 ); + else if ( argv[0]->i == SIGUSR2 ) + ui->save_signal_choice->value( 2 ); + else if ( argv[0]->i == SIGINT ) + ui->save_signal_choice->value( 3 ); + else + ui->save_signal_choice->value( 0 ); + } + + Fl::unlock(); + + return 0; +} + + +void +init_osc ( const char *osc_port ) +{ + + lo_server_thread loth = lo_server_thread_new( osc_port, NULL ); + losrv = lo_server_thread_get_server( loth ); + +//error_handler ); + + char *url = lo_server_get_url(losrv); + printf("OSC: %s\n",url); + free(url); + + /* GUI */ + + lo_server_thread_add_method( loth, "/nsm/proxy/executable", "s", osc_update, NULL ); + lo_server_thread_add_method( loth, "/nsm/proxy/arguments", "s", osc_update, NULL ); + lo_server_thread_add_method( loth, "/nsm/proxy/label", "s", osc_update, NULL ); + lo_server_thread_add_method( loth, "/nsm/proxy/save_signal", "i", osc_update, NULL ); + + lo_server_thread_start( loth ); +} + +/*****************/ +/* GUI Callbacks */ +/*****************/ + +void +handle_kill ( Fl_Widget *o, void *v ) +{ + lo_send_from( nsmp_addr, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/kill", "" ); +} + +void +handle_start ( Fl_Widget *o, void *v ) +{ + lo_send_from( nsmp_addr, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/start", "ss", + ui->executable_input->value(), + ui->arguments_input->value() ); +} + +void +handle_label ( Fl_Widget *o, void *v ) +{ + lo_send_from( nsmp_addr, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/label", "s", + ui->label_input->value() ); +} + +void +handle_executable ( Fl_Widget *o, void *v ) +{ + ui->label_input->value( ui->executable_input->value() ); +} + +void +handle_save_signal ( Fl_Widget *o, void *v ) +{ + int sig = 0; + + const char* picked = ui->save_signal_choice->mvalue()->label(); + + if ( !strcmp( picked, "SIGUSR1" ) ) + sig = SIGUSR1; + else if ( !strcmp( picked, "SIGUSR2" ) ) + sig = SIGUSR2; + else if ( !strcmp( picked, "SIGINT" ) ) + sig = SIGINT; + + lo_send_from( nsmp_addr, losrv, LO_TT_IMMEDIATE,"/nsm/proxy/save_signal", "i", + sig ); +} + +void +connect_ui ( void ) +{ + ui->executable_input->callback( handle_executable, NULL ); + ui->kill_button->callback( handle_kill, NULL ); + ui->start_button->callback( handle_start, NULL ); + ui->save_signal_choice->callback( handle_save_signal, NULL ); + ui->label_input->callback( handle_label, NULL ); +} + + + +int +main ( int argc, char **argv ) +{ + if ( argc != 3 ) + { + fprintf( stderr, "Usage: %s --connect-to url\n", argv[0] ); + return 1; + } + + init_osc( NULL ); + + nsmp_addr = lo_address_new_from_url( argv[2] ); + + printf( "Connecting to nsm-proxy at: %s\n", argv[2] ); + + ui = new NSM_Proxy_UI; + + Fl_Double_Window *w = ui->make_window(); + + connect_ui(); + + lo_send_from( nsmp_addr, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/update", "" ); + + w->show(); + + fl_register_themes(); + + Fl_Theme::set(); + + Fl::lock(); + + Fl::run(); + + return 0; +} diff --git a/session-manager/src/nsm-proxy.C b/session-manager/src/nsm-proxy.C new file mode 100644 index 0000000..65cd45b --- /dev/null +++ b/session-manager/src/nsm-proxy.C @@ -0,0 +1,663 @@ + +/*******************************************************************************/ +/* Copyright (C) 2012 Jonathan Moore Liles */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#pragma GCC diagnostic ignored "-Wunused-parameter" + +#define _MODULE_ "nsm-proxy" +#define APP_NAME "NSM Proxy" +#define APP_TITLE "NSM Proxy" + +#include "debug.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static lo_server losrv; +static lo_address nsm_addr; +static lo_address gui_addr; +static int nsm_is_active; +static char *project_file; +static int die_now = 0; +static int signal_fd; + +static char *nsm_client_id; +static char *nsm_display_name; + +#define CONFIG_FILE_NAME "nsm-proxy.config" + +class NSM_Proxy { + + char *_label; + char *_executable; + char *_arguments; + int _save_signal; + int _pid; + +public: + + NSM_Proxy ( ) + { + _label = _executable = _arguments = 0; + _save_signal = 0; + _pid = 0; + } + + ~NSM_Proxy ( ) + { + } + + void kill ( void ) + { + if ( _pid ) + ::kill( _pid, SIGTERM ); + } + + bool start ( const char *executable, const char *arguments ) + { + if ( _executable ) + free( _executable ); + if ( _arguments ) + free( _arguments ); + + _executable = strdup( executable ); + + if ( arguments ) + _arguments = strdup( arguments ); + else + _arguments = NULL; + + return start(); + } + + bool start ( void ) + { + if ( _pid ) + /* already running */ + return true; + + int pid; + if ( ! (pid = fork()) ) + { + MESSAGE( "Launching %s\n", _executable ); + +// char *args[] = { strdup( executable ), NULL }; + + char *cmd; + + if ( _arguments ) + asprintf( &cmd, "exec %s %s", _executable, _arguments ); + else + asprintf( &cmd, "exec %s", _executable ); + + char *args[] = { _executable, strdup( "-c" ), cmd, NULL }; + + setenv( "NSM_CLIENT_ID", nsm_client_id, 1 ); + setenv( "NSM_SESSION_NAME", nsm_display_name, 1 ); + + if ( -1 == execvp( "/bin/sh", args ) ) + { + WARNING( "Error starting process: %s", strerror( errno ) ); + + exit(-1); + } + } + + _pid = pid; + + return _pid > 0; + } + + void save_signal ( int s ) + { + _save_signal = s; + } + + void label ( const char *s ) + { + if ( _label ) + free( _label ); + + _label = strdup( s ); + + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/nsm/client/label", "s", _label ); + } + + void save ( void ) + { + DMESSAGE( "Sending process save signal" ); + if ( _pid ) + ::kill( _pid, _save_signal ); + } + + + bool dump ( const char *path ) + { + FILE *fp = fopen( path, "w" ); + + if ( !fp ) + { + WARNING( "Error opening file for saving: %s", strerror( errno ) ); + return false; + } + + if ( _executable && strlen(_executable) ) + fprintf( fp, "executable\n\t%s\n", _executable ); + + if ( _arguments && strlen(_arguments) ) + fprintf( fp, "arguments\n\t%s\n", _arguments ); + + fprintf( fp, "save signal\n\t%i\n", _save_signal ); + + if ( _label && strlen(_label) ) + fprintf( fp, "label\n\t%s\n", _label ); + + fclose( fp ); + + return true; + } + + bool restore ( const char *path ) + { + FILE *fp = fopen( path, "r" ); + + if ( ! fp ) + { + WARNING( "Error opening file for restore: %s", strerror( errno ) ); + return false; + } + + char *name; + char *value; + + MESSAGE( "Loading file config \"%s\"", path ); + + while ( 2 == fscanf( fp, "%a[^\n]\n\t%a[^\n]\n", &name, &value ) ) + { + + DMESSAGE( "%s=%s", name, value ); + + if ( !strcmp( name, "executable" ) ) + _executable = value; + else if (!strcmp( name, "arguments" ) ) + _arguments = value; + else if ( !strcmp( name, "save signal" ) ) + { + _save_signal = atoi( value ); + free( value ); + } + else if ( !strcmp( name, "label" ) ) + { + label( value ); + free( value ); + } + else + { + WARNING( "Unknown option \"%s\" in config file", name ); + } + + free( name ); + } + + fclose( fp ); + + start(); + + return true; + } + + void update ( lo_address to ) + { + DMESSAGE( "Sending update" ); + + lo_send_from( to, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/save_signal", "i", _save_signal ); + lo_send_from( to, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/label", "s", _label ? _label : "" ); + lo_send_from( to, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/executable", "s", _executable ? _executable : "" ); + lo_send_from( to, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/arguments", "s", _arguments ? _arguments : "" ); + } +}; + +NSM_Proxy *nsm_proxy; + +void +announce ( const char *nsm_url, const char *client_name, const char *process_name ) +{ + printf( "Announcing to NSM\n" ); + + lo_address to = lo_address_new_from_url( nsm_url ); + + int pid = (int)getpid(); + + lo_send_from( to, losrv, LO_TT_IMMEDIATE, "/nsm/server/announce", "sssiii", + client_name, + ":optional-gui:", + process_name, + 1, /* api_major_version */ + 0, /* api_minor_version */ + pid ); + + lo_address_free( to ); +} + +bool +snapshot ( const char *file ) +{ + /* mkdir( file, 0777 ); */ + + char *path; + asprintf( &path, "%s/%s", file, CONFIG_FILE_NAME ); + + bool r = nsm_proxy->dump( path ); + + free( path ); + + return r; +} + +bool +open ( const char *file ) +{ + char *path; + asprintf( &path, "%s/%s", file, CONFIG_FILE_NAME ); + + bool r = nsm_proxy->restore( path ); + + free( path ); + + return r; +} + +/****************/ +/* OSC HANDLERS */ +/****************/ + +/* NSM */ + +int +osc_announce_error ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + if ( strcmp( types, "sis" ) ) + return -1; + + if ( strcmp( "/nsm/server/announce", &argv[0]->s ) ) + return -1; + + printf( "Failed to register with NSM: %s\n", &argv[2]->s ); + nsm_is_active = 0; + + return 0; +} + + +int +osc_announce_reply ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + if ( strcmp( "/nsm/server/announce", &argv[0]->s ) ) + return -1; + + printf( "Successfully registered. NSM says: %s", &argv[1]->s ); + + nsm_is_active = 1; + nsm_addr = lo_address_new_from_url( lo_address_get_url( lo_message_get_source( msg ) ) ); + + return 0; +} + +int +osc_save ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + bool r = snapshot( project_file ); + + nsm_proxy->save(); + + if ( r ) + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/reply", "ss", path, "OK" ); + else + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/error", "sis", path, -1, "Error saving project file" ); + + return 0; +} + +static int gui_pid; + +void +show_gui ( void ) +{ + + int pid; + if ( ! (pid = fork()) ) + { + char executable[] = "nsm-proxy-gui"; + + MESSAGE( "Launching %s\n", executable ); + + char *url = lo_server_get_url( losrv ); + + char *args[] = { executable, strdup( "--connect-to" ), url, NULL }; + + if ( -1 == execvp( executable, args ) ) + { + WARNING( "Error starting process: %s", strerror( errno ) ); + + exit(-1); + } + } + + gui_pid = pid; + + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/nsm/client/gui_is_shown", "" ); +} + +int +osc_show_gui ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + show_gui(); + + /* FIXME: detect errors */ + + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/reply", "ss", path, "OK" ); + + return 0; +} + +void +hide_gui ( void ) +{ + if ( gui_pid ) + { + kill( gui_pid, SIGTERM ); + } +} + +int +osc_hide_gui ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + hide_gui(); + + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/nsm/client/gui_is_hidden", "" ); + + /* FIXME: detect errors */ + + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/reply", "ss", path, "OK" ); + + return 0; +} + +int +osc_open ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + const char *new_path = &argv[0]->s; + const char *display_name = &argv[1]->s; + const char *client_id = &argv[2]->s; + + if ( nsm_client_id ) + free(nsm_client_id); + + nsm_client_id = strdup( client_id ); + + if ( nsm_display_name ) + free( nsm_display_name ); + + nsm_display_name = strdup( display_name ); + + char *new_filename; + + mkdir( new_path, 0777 ); + + chdir( new_path ); + + asprintf( &new_filename, "%s/%s", new_path, CONFIG_FILE_NAME ); + + struct stat st; + + if ( 0 == stat( new_filename, &st ) ) + { + if ( open( new_path ) ) + { + } + else + { + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/error", "sis", path, -1, "Could not open file" ); + return 0; + } + + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/nsm/client/gui_is_hidden", "" ); + } + else + { + show_gui(); + } + + if ( project_file ) + free( project_file ); + + project_file = strdup( new_path ); + +// new_filename; + + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/reply", "ss", path, "OK" ); + + if ( gui_addr ) + nsm_proxy->update( gui_addr ); + + return 0; +} + + + +/* GUI */ + +int +osc_label ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + nsm_proxy->label( &argv[0]->s ); + + return 0; +} + +int +osc_save_signal ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + nsm_proxy->save_signal( argv[0]->i ); + + return 0; +} + +int +osc_start ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + snapshot( project_file ); + + if ( nsm_proxy->start( &argv[0]->s, &argv[1]->s ) ) + { + hide_gui(); + } + + return 0; +} + +int +osc_kill ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + nsm_proxy->kill(); + + return 0; +} + +int +osc_update ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) +{ + lo_address to = lo_address_new_from_url( lo_address_get_url( lo_message_get_source( msg ) )); + + nsm_proxy->update( to ); + + gui_addr = to; + + return 0; +} + + + +void +signal_handler ( int x ) +{ + die_now = 1; +} + +void +set_traps ( void ) +{ + signal( SIGHUP, signal_handler ); + signal( SIGINT, signal_handler ); +// signal( SIGQUIT, signal_handler ); +// signal( SIGSEGV, signal_handler ); +// signal( SIGPIPE, signal_handler ); + signal( SIGTERM, signal_handler ); +} + + +void +init_osc ( const char *osc_port ) +{ + losrv = lo_server_new( osc_port, NULL ); +//error_handler ); + + char *url = lo_server_get_url(losrv); + printf("OSC: %s\n",url); + free(url); + + /* NSM */ + lo_server_add_method( losrv, "/nsm/client/save", "", osc_save, NULL ); + lo_server_add_method( losrv, "/nsm/client/open", "sss", osc_open, NULL ); + lo_server_add_method( losrv, "/nsm/client/show_optional_gui", "", osc_show_gui, NULL ); + lo_server_add_method( losrv, "/nsm/client/hide_optional_gui", "", osc_hide_gui, NULL ); + lo_server_add_method( losrv, "/error", "sis", osc_announce_error, NULL ); + lo_server_add_method( losrv, "/reply", "ssss", osc_announce_reply, NULL ); + + /* GUI */ + lo_server_add_method( losrv, "/nsm/proxy/label", "s", osc_label, NULL ); + lo_server_add_method( losrv, "/nsm/proxy/save_signal", "i", osc_save_signal, NULL ); + lo_server_add_method( losrv, "/nsm/proxy/kill", "", osc_kill, NULL ); + lo_server_add_method( losrv, "/nsm/proxy/start", "ss", osc_start, NULL ); + lo_server_add_method( losrv, "/nsm/proxy/update", "", osc_update, NULL ); + +} + +void +die ( void ) +{ + if ( gui_pid ) + { + DMESSAGE( "Killing GUI" ); + + kill( gui_pid, SIGTERM ); + } + + nsm_proxy->kill(); + + exit(0); +} + + +void handle_sigchld ( ) +{ + for ( ;; ) + { + int status; + pid_t pid = waitpid(-1, &status, WNOHANG); + + if (pid <= 0) + break; + + if ( pid == gui_pid ) + { + lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/nsm/client/gui_is_hidden", "" ); + + gui_pid = 0; + + /* don't care... */ + continue; + } + + /* otherwise, it was our proxied process that died, so we should die too */ + printf( "proxied process died... nsm-proxy dying too\n" ); + + die_now = 1; + } +} + +int +main ( int argc, char **argv ) +{ + set_traps(); + + sigset_t mask; + + sigemptyset( &mask ); + sigaddset( &mask, SIGCHLD ); + + sigprocmask(SIG_BLOCK, &mask, NULL ); + + signal_fd = signalfd( -1, &mask, SFD_NONBLOCK ); + + nsm_proxy = new NSM_Proxy(); + + init_osc( NULL ); + + const char *nsm_url = getenv( "NSM_URL" ); + + if ( nsm_url ) + { + announce( nsm_url, APP_TITLE, argv[0] ); + } + else + { + fprintf( stderr, "Could not register as NSM client.\n" ); + exit(1); + } + + + struct signalfd_siginfo fdsi; + + /* listen for sigchld signals and process OSC messages forever */ + for ( ;; ) + { + ssize_t s = read(signal_fd, &fdsi, sizeof(struct signalfd_siginfo)); + + if (s == sizeof(struct signalfd_siginfo)) + { + if (fdsi.ssi_signo == SIGCHLD) + handle_sigchld(); + } + + lo_server_recv_noblock( losrv, 500 ); + + if ( die_now ) + die(); + } +} diff --git a/session-manager/src/nsmd.C b/session-manager/src/nsmd.C index 5181d56..1eb8df2 100644 --- a/session-manager/src/nsmd.C +++ b/session-manager/src/nsmd.C @@ -36,9 +36,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -76,6 +74,7 @@ static char *session_root; #define ERR_BAD_PROJECT -9 #define ERR_CREATE_FAILED -10 #define ERR_SESSION_LOCKED -11 +#define ERR_OPERATION_PENDING -12 #define APP_TITLE "Non Session Manager" @@ -84,9 +83,16 @@ enum { COMMAND_QUIT, COMMAND_KILL, COMMAND_SAVE, - COMMAND_OPEN + COMMAND_OPEN, + COMMAND_START, + + COMMAND_CLOSE, + COMMAND_DUPLICATE, + COMMAND_NEW }; +static int pending_operation = COMMAND_NONE; + struct Client { private: @@ -97,6 +103,10 @@ private: int _pending_command; /* */ struct timeval _command_sent_time; + bool _gui_visible; + + char *_label; + public: lo_address addr; /* */ @@ -105,7 +115,6 @@ public: int pid; /* PID of client process */ float progress; /* */ bool active; /* client has registered via announce */ - bool dead_because_we_said; // bool stopped; /* the client quit, but not because we told it to--user still has to decide to remove it from the session */ char *client_id; /* short part of client ID */ char *capabilities; /* client capabilities... will be null for dumb clients */ @@ -113,14 +122,35 @@ public: bool pre_existing; const char *status; + const char *label ( void ) const { return _label; } + void label ( const char *l ) + { + if ( _label ) + free( _label ); + if ( l ) + _label = strdup( l ); + else + _label = NULL; + } + + bool gui_visible ( void ) const + { + return _gui_visible; + } + + void gui_visible ( bool b ) + { + _gui_visible = b; + } + bool - has_error ( void ) + has_error ( void ) const { return _reply_errcode != 0; } int - error_code ( void ) + error_code ( void ) const { return _reply_errcode; } @@ -173,12 +203,21 @@ public: return _pending_command; } +// capability should be enclosed in colons. I.e. ":switch:" + bool + is_capable_of ( const char *capability ) const + { + return capabilities && + strstr( capabilities, capability ); + } + Client ( ) { + _label = 0; + _gui_visible = true; addr = 0; _reply_errcode = 0; _reply_message = 0; - dead_because_we_said = false; pid = 0; progress = -0; _pending_command = 0; @@ -265,10 +304,12 @@ handle_client_process_death ( int pid ) { MESSAGE( "Client %s died.", c->name ); + bool dead_because_we_said = false; + if ( c->pending_command() == COMMAND_KILL || c->pending_command() == COMMAND_QUIT ) { - c->dead_because_we_said = true; + dead_because_we_said = true; } c->pending_command( COMMAND_NONE ); @@ -276,7 +317,7 @@ handle_client_process_death ( int pid ) c->active = false; c->pid = 0; - if ( c->dead_because_we_said ) + if ( dead_because_we_said ) { if ( gui_is_active ) osc_server->send( gui_addr, "/nsm/gui/client/status", c->client_id, c->status = "removed" ); @@ -539,6 +580,7 @@ launch ( const char *executable, const char *client_id ) } } + c->pending_command( COMMAND_START ); c->pid = pid; MESSAGE( "Process has pid: %i", pid ); @@ -565,7 +607,7 @@ command_client_to_save ( Client *c ) if ( gui_is_active ) osc_server->send( gui_addr, "/nsm/gui/client/status", c->client_id, c->status = "save" ); } - else if ( c->is_dumb_client() ) + else if ( c->is_dumb_client() && c->pid ) { // this is a dumb client... if ( gui_is_active ) @@ -714,8 +756,9 @@ OSC_HANDLER( announce ) i != client.end(); ++i ) { - if ( ! strcmp( (*i)->executable_path, executable_path ) - && ! (*i)->active ) + if ( ! strcmp( (*i)->executable_path, executable_path ) && + ! (*i)->active && + (*i)->pending_command() == COMMAND_START ) { // I think we've found the slot we were looking for. MESSAGE( "Client was expected." ); @@ -770,6 +813,9 @@ OSC_HANDLER( announce ) { osc_server->send( gui_addr, "/nsm/gui/client/new", c->client_id, c->name ); osc_server->send( gui_addr, "/nsm/gui/client/status", c->client_id, c->status = "open" ); + + if ( c->is_capable_of( ":optional-gui:" ) ) + osc_server->send( gui_addr, "/nsm/gui/client/has_optional_gui", c->client_id ); } { @@ -824,13 +870,6 @@ client_by_name ( const char *name, return NULL; } -// capability should be enclosed in colons. I.e. ":switch:" -bool -client_is_capable_of ( Client *c, const char *capability ) -{ - return c->capabilities && - strstr( c->capabilities, capability ); -} bool dumb_clients_are_alive ( ) @@ -1109,7 +1148,7 @@ load_session_file ( const char * path ) i != client.end(); ++i ) { - if ( ! client_is_capable_of( *i, ":switch:" ) + if ( ! (*i)->is_capable_of( ":switch:" ) || ! client_by_name( (*i)->name, &new_clients ) ) { @@ -1192,13 +1231,21 @@ load_session_file ( const char * path ) OSC_HANDLER( save ) { + if ( pending_operation != COMMAND_NONE ) + { + osc_server->send( lo_message_get_source( msg ), "/error", path, + ERR_OPERATION_PENDING, + "An operation pending." ); + return 0; + } + if ( ! session_path ) { osc_server->send( lo_message_get_source( msg ), "/error", path, ERR_NO_SESSION_OPEN, "No session to save."); - return 0; + goto done; } command_all_clients_to_save(); @@ -1207,18 +1254,31 @@ OSC_HANDLER( save ) osc_server->send( lo_message_get_source( msg ), "/reply", path, "Saved." ); +done: + + pending_operation = COMMAND_NONE; + return 0; } OSC_HANDLER( duplicate ) { + if ( pending_operation != COMMAND_NONE ) + { + osc_server->send( lo_message_get_source( msg ), "/error", path, + ERR_OPERATION_PENDING, + "An operation pending." ); + return 0; + } + + pending_operation = COMMAND_DUPLICATE; + if ( ! session_path ) { osc_server->send( lo_message_get_source( msg ), "/error", path, ERR_NO_SESSION_OPEN, "No session to duplicate."); - - return 0; + goto done; } if ( ! path_is_valid( &argv[0]->s ) ) @@ -1227,7 +1287,7 @@ OSC_HANDLER( duplicate ) ERR_CREATE_FAILED, "Invalid session name." ); - return 0; + goto done; } command_all_clients_to_save(); @@ -1238,7 +1298,7 @@ OSC_HANDLER( duplicate ) ERR_GENERAL_ERROR, "Some clients could not save" ); - return 0; + goto done; } // save_session_file(); @@ -1279,20 +1339,35 @@ OSC_HANDLER( duplicate ) MESSAGE( "Done" ); - osc_server->send( lo_message_get_source( msg ), "/reply", path, "Duplicated." ); +done: + + pending_operation = COMMAND_NONE; + return 0; } OSC_HANDLER( new ) { + if ( pending_operation != COMMAND_NONE ) + { + osc_server->send( lo_message_get_source( msg ), "/error", path, + ERR_OPERATION_PENDING, + "An operation pending." ); + return 0; + } + + pending_operation = COMMAND_NEW; + if ( ! path_is_valid( &argv[0]->s ) ) { osc_server->send( lo_message_get_source( msg ), "/error", path, ERR_CREATE_FAILED, "Invalid session name." ); + pending_operation = COMMAND_NONE; + return 0; } @@ -1305,7 +1380,6 @@ OSC_HANDLER( new ) MESSAGE( "Creating new session" ); - char *spath; asprintf( &spath, "%s/%s", session_root, &argv[0]->s ); @@ -1317,6 +1391,8 @@ OSC_HANDLER( new ) free(spath); + pending_operation = COMMAND_NONE; + return 0; } @@ -1338,6 +1414,8 @@ OSC_HANDLER( new ) osc_server->send( lo_message_get_source( msg ), "/reply", path, "Session created" ); + + pending_operation = COMMAND_NONE; return 0; } @@ -1391,8 +1469,20 @@ OSC_HANDLER( open ) { DMESSAGE( "Got open" ); + if ( pending_operation != COMMAND_NONE ) + { + osc_server->send( lo_message_get_source( msg ), "/error", path, + ERR_OPERATION_PENDING, + "An operation pending." ); + return 0; + } + + pending_operation = COMMAND_OPEN; + + if ( session_path ) { + command_all_clients_to_save(); if ( clients_have_errors() ) @@ -1400,12 +1490,15 @@ OSC_HANDLER( open ) osc_server->send( lo_message_get_source( msg ), "/error", path, ERR_GENERAL_ERROR, "Some clients could not save" ); + + pending_operation = COMMAND_NONE; return 0; } // save_session_file(); } + char *spath; asprintf( &spath, "%s/%s", session_root, &argv[0]->s ); @@ -1448,6 +1541,8 @@ OSC_HANDLER( open ) MESSAGE( "Done" ); + pending_operation = COMMAND_NONE; + return 0; } @@ -1463,13 +1558,24 @@ OSC_HANDLER( quit ) OSC_HANDLER( abort ) { + if ( pending_operation != COMMAND_NONE ) + { + osc_server->send( lo_message_get_source( msg ), "/error", path, + ERR_OPERATION_PENDING, + "An operation pending." ); + return 0; + } + + pending_operation = COMMAND_CLOSE; + + if ( ! session_path ) { osc_server->send( lo_message_get_source( msg ), "/error", path, ERR_NO_SESSION_OPEN, "No session to abort." ); - return 0; + goto done; } MESSAGE( "Commanding attached clients to quit." ); @@ -1480,19 +1586,32 @@ OSC_HANDLER( abort ) "Aborted." ); MESSAGE( "Done" ); +done: + + pending_operation = COMMAND_NONE; return 0; } OSC_HANDLER( close ) { + if ( pending_operation != COMMAND_NONE ) + { + osc_server->send( lo_message_get_source( msg ), "/error", path, + ERR_OPERATION_PENDING, + "An operation pending." ); + return 0; + } + + pending_operation = COMMAND_CLOSE; + if ( ! session_path ) { osc_server->send( lo_message_get_source( msg ), "/error", path, ERR_NO_SESSION_OPEN, "No session to close." ); - return 0; + goto done; } command_all_clients_to_save(); @@ -1506,6 +1625,10 @@ OSC_HANDLER( close ) MESSAGE( "Done" ); +done: + + pending_operation = COMMAND_NONE; + return 0; } @@ -1636,6 +1759,39 @@ OSC_HANDLER( is_clean ) return 0; } +OSC_HANDLER( gui_is_hidden ) +{ + MESSAGE( "Client sends gui hidden" ); + + Client *c = get_client_by_address( lo_message_get_source( msg ) ); + + if ( ! c ) + return 0; + + c->gui_visible( false ); + + if ( gui_is_active ) + osc_server->send( gui_addr, "/nsm/gui/client/gui_visible", c->client_id, c->gui_visible() ); + + return 0; +} + +OSC_HANDLER( gui_is_shown ) +{ + MESSAGE( "Client sends gui shown" ); + + Client *c = get_client_by_address( lo_message_get_source( msg ) ); + + if ( ! c ) + return 0; + + c->gui_visible( true ); + + if ( gui_is_active ) + osc_server->send( gui_addr, "/nsm/gui/client/gui_visible", c->client_id, c->gui_visible() ); + + return 0; +} OSC_HANDLER( message ) { @@ -1650,6 +1806,24 @@ OSC_HANDLER( message ) return 0; } +OSC_HANDLER( label ) +{ + Client *c = get_client_by_address( lo_message_get_source( msg ) ); + + if ( ! c ) + return 0; + + if ( strcmp( types, "s" ) ) + return -1; + + c->label( &argv[0]->s ); + + if ( gui_is_active ) + osc_server->send( gui_addr, "/nsm/gui/client/label", c->client_id, &argv[0]->s ); + + return 0; +} + /**********************/ /* Response Handlers */ /**********************/ @@ -1713,6 +1887,31 @@ OSC_HANDLER( reply ) /* GUI operations */ /******************/ + +OSC_HANDLER( stop ) +{ + Client *c = get_client_by_id( &client, &argv[0]->s ); + + if ( c ) + { + if ( c->pid != 0 ) + { + kill( c->pid, SIGTERM ); + + if ( gui_is_active ) + osc_server->send( gui_addr, "/reply", "Client stopped." ); + } + } + else + { + if ( gui_is_active ) + osc_server->send( gui_addr, "/error", -10, "No such client." ); + } + + + return 0; +} + OSC_HANDLER( remove ) { Client *c = get_client_by_id( &client, &argv[0]->s ); @@ -1779,6 +1978,38 @@ OSC_HANDLER( client_save ) return 0; } +OSC_HANDLER( client_show_optional_gui ) +{ + Client *c = get_client_by_id( &client, &argv[0]->s ); + + /* FIXME: return error if no such client? */ + if ( c ) + { + if ( c->active ) + { + osc_server->send( c->addr, "/nsm/client/show_optional_gui" ); + } + } + + return 0; +} + +OSC_HANDLER( client_hide_optional_gui ) +{ + Client *c = get_client_by_id( &client, &argv[0]->s ); + + /* FIXME: return error if no such client? */ + if ( c ) + { + if ( c->active ) + { + osc_server->send( c->addr, "/nsm/client/hide_optional_gui" ); + } + } + + return 0; +} + void announce_gui( const char *url, bool is_reply ) { @@ -1927,12 +2158,18 @@ int main(int argc, char *argv[]) osc_server->add_method( "/nsm/client/is_dirty", "", OSC_NAME( is_dirty ), NULL, "dirtiness" ); osc_server->add_method( "/nsm/client/is_clean", "", OSC_NAME( is_clean ), NULL, "dirtiness" ); osc_server->add_method( "/nsm/client/message", "is", OSC_NAME( message ), NULL, "message" ); + osc_server->add_method( "/nsm/client/gui_is_hidden", "", OSC_NAME( gui_is_hidden ), NULL, "message" ); + osc_server->add_method( "/nsm/client/gui_is_shown", "", OSC_NAME( gui_is_shown ), NULL, "message" ); + osc_server->add_method( "/nsm/client/label", "s", OSC_NAME( label ), NULL, "message" ); /* */ osc_server->add_method( "/nsm/gui/gui_announce", "", OSC_NAME( gui_announce ), NULL, "" ); + osc_server->add_method( "/nsm/gui/client/stop", "s", OSC_NAME( stop ), NULL, "client_id" ); osc_server->add_method( "/nsm/gui/client/remove", "s", OSC_NAME( remove ), NULL, "client_id" ); osc_server->add_method( "/nsm/gui/client/resume", "s", OSC_NAME( resume ), NULL, "client_id" ); osc_server->add_method( "/nsm/gui/client/save", "s", OSC_NAME( client_save ), NULL, "client_id" ); + osc_server->add_method( "/nsm/gui/client/show_optional_gui", "s", OSC_NAME( client_show_optional_gui ), NULL, "client_id" ); + osc_server->add_method( "/nsm/gui/client/hide_optional_gui", "s", OSC_NAME( client_hide_optional_gui ), NULL, "client_id" ); osc_server->add_method( "/osc/ping", "", OSC_NAME( ping ), NULL, "" ); diff --git a/session-manager/src/session-manager.C b/session-manager/src/session-manager.C index d200e28..877daca 100644 --- a/session-manager/src/session-manager.C +++ b/session-manager/src/session-manager.C @@ -35,6 +35,7 @@ #include "debug.h" #include #include +#include #include #include @@ -47,9 +48,7 @@ #define APP_NAME "Non Session Manager" -#include "FL/Crystal_Boxtypes.H" -#include "FL/Gleam_Boxtypes.H" -#include "FL/color_scheme.H" +#include "FL/themes.H" #ifdef HAVE_XPM #include "FL/Fl.H" @@ -85,19 +84,57 @@ static std::list daemon_list; /* list class NSM_Client : public Fl_Group { char *_client_id; + char *_client_label; + char *_client_name; // Fl_Box *client_name; Fl_Progress *_progress; Fl_Light_Button *_dirty; + Fl_Light_Button *_gui; Fl_Button *_remove_button; Fl_Button *_restart_button; + Fl_Button *_kill_button; + + void + set_label ( void ) + { + char *l; + + if ( _client_label ) + asprintf( &l, "%s (%s)", _client_name, _client_label ); + else + l = strdup( _client_name ); + + if ( label() ) + free((char*)label()); + + label( l ); + + redraw(); + } public: void name ( const char *v ) { - label( strdup( v ) ); + if ( _client_name ) + free( _client_name ); + + _client_name = strdup( v ); + + set_label(); + } + + void + client_label ( const char *s ) + { + if ( _client_label ) + free( _client_label ); + + _client_label = strdup( s ); + + set_label(); } void @@ -123,6 +160,21 @@ public: _dirty->redraw(); } + void + gui_visible ( bool b ) + { + _gui->value( b ); + _gui->redraw(); + } + + + void + has_optional_gui ( void ) + { + _gui->show(); + _gui->redraw(); + } + void stopped ( bool b ) { @@ -130,11 +182,17 @@ public: { _remove_button->show(); _restart_button->show(); + _kill_button->hide(); + _gui->deactivate(); + _dirty->deactivate(); color( fl_darker( FL_RED ) ); redraw(); } else { + _gui->activate(); + _dirty->activate(); + _kill_button->show(); _restart_button->hide(); _remove_button->hide(); } @@ -195,7 +253,18 @@ public: osc->send( (*d)->addr, "/nsm/gui/client/save", _client_id ); } } - if ( o == _remove_button ) + else if ( o == _gui ) + { + MESSAGE( "Sending hide/show GUI."); + foreach_daemon ( d ) + { + if ( !_gui->value() ) + osc->send( (*d)->addr, "/nsm/gui/client/show_optional_gui", _client_id ); + else + osc->send( (*d)->addr, "/nsm/gui/client/hide_optional_gui", _client_id ); + } + } + else if ( o == _remove_button ) { MESSAGE( "Sending remove."); foreach_daemon ( d ) @@ -211,6 +280,14 @@ public: osc->send( (*d)->addr, "/nsm/gui/client/resume", _client_id ); } } + else if ( o == _kill_button ) + { + MESSAGE( "Sending stop" ); + foreach_daemon ( d ) + { + osc->send( (*d)->addr, "/nsm/gui/client/stop", _client_id ); + } + } } @@ -223,46 +300,130 @@ public: { _client_id = NULL; + _client_name = NULL; + _client_label = NULL; align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); color( fl_darker( FL_RED ) ); box( FL_UP_BOX ); + + int yy = Y + H * 0.25; + int hh = H * 0.50; + int xx = X + W - ( 200 + Fl::box_dw( box() ) ); + int ss = 2; - { Fl_Progress *o = _progress = new Fl_Progress( ( X + W ) - ( W / 4) - 20, Y + 5, ( W / 4 ), H - 10, NULL ); + /* dummy group */ + { Fl_Group *o = new Fl_Group( X, Y, 50, 50 ); + o->end(); + resizable( o ); + } + + { Fl_Progress *o = _progress = new Fl_Progress( xx, Y + H * 0.25, 200, H * 0.50, NULL ); + o->box( FL_FLAT_BOX ); + o->color( FL_BLACK ); o->label( strdup( "launch" ) ); o->minimum( 0.0f ); o->maximum( 1.0f ); } - { Fl_Light_Button *o = _dirty = new Fl_Light_Button( _progress->x() - 30, Y + 7, 25, 25 ); - o->box( FL_UP_BOX ); - o->type(0); - o->color(); - o->selection_color( FL_YELLOW ); - o->value( 0 ); - o->callback( cb_button, this ); + + { Fl_Group *o = new Fl_Group( X + W - 400, Y, 400, H ); + + xx -= 50 + ss; + + { Fl_Light_Button *o = _dirty = new Fl_Light_Button( xx, yy, 50, hh, "SAVE" ); + + o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); + o->labelsize( 9 ); + o->box( FL_UP_BOX ); + o->type(0); + o->color(); + o->selection_color( FL_YELLOW ); + o->value( 0 ); + o->callback( cb_button, this ); + } + + xx -= 40 + ss; + + { Fl_Light_Button *o = _gui = new Fl_Light_Button( xx, yy, 40, hh, "GUI" ); + + o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); + o->labelsize( 9 ); + o->box( FL_UP_BOX ); + o->type(0); + o->color(); + o->selection_color( FL_YELLOW ); + o->value( 0 ); + o->hide(); + o->callback( cb_button, this ); + } + + xx -= 25 + ss; + + { Fl_Button *o = _kill_button = new Fl_Button( xx, yy, 25, hh, "@square" ); + o->labelsize( 9 ); + o->box( FL_UP_BOX ); + o->type(0); + o->color( FL_RED ); + o->value( 0 ); + o->tooltip( "Stop" ); + o->callback( cb_button, this ); + } + + xx -= 25 + ss; + + { Fl_Button *o = _restart_button = new Fl_Button( xx, yy, 25, hh ); + + + o->box( FL_UP_BOX ); + o->type(0); + o->color( FL_GREEN ); + o->value( 0 ); + o->label( "@>" ); + o->tooltip( "Resume" ); + o->hide(); + o->callback( cb_button, this ); + } + + xx -= 25 + ss; + + { Fl_Button *o = _remove_button = new Fl_Button( xx, yy, 25, hh ); + + + o->box( FL_UP_BOX ); + o->type(0); + o->color( FL_RED ); + o->value( 0 ); + o->label( "X" ); + o->tooltip( "Remove" ); + o->hide(); + o->callback( cb_button, this ); + } + + + o->end(); } - { Fl_Button *o = _remove_button = new Fl_Button( _progress->x() - 60, Y + 7, 25, 25 ); - o->box( FL_UP_BOX ); - o->type(0); - o->color( FL_RED ); - o->value( 0 ); - o->label( "X" ); - o->tooltip( "Remove" ); - o->hide(); - o->callback( cb_button, this ); - } - { Fl_Button *o = _restart_button = new Fl_Button( _progress->x() - 90, Y + 7, 25, 25 ); - o->box( FL_UP_BOX ); - o->type(0); - o->color( FL_GREEN ); - o->value( 0 ); - o->label( "@>" ); - o->tooltip( "Resume" ); - o->hide(); - o->callback( cb_button, this ); + end(); + } + + ~NSM_Client ( ) + { + if ( _client_name ) + { + free( _client_name ); + _client_name = NULL; } - end(); + if ( _client_label ) + { + free( _client_label ); + _client_label = NULL; + } + + if ( label() ) + { + free( (char*)label() ); + label( NULL ); + } } }; @@ -286,7 +447,7 @@ public: Fl_Button *add_button; Fl_Button *duplicate_button; - Fl_Hold_Browser *session_browser; + Fl_Tree *session_browser; static void cb_handle ( Fl_Widget *w, void *v ) { @@ -354,16 +515,23 @@ public: } else if ( w == session_browser ) { - const char *name = session_browser->text( session_browser->value()); - - /* strip out formatting codes */ - - if ( !name ) + if ( session_browser->callback_reason() != FL_TREE_REASON_SELECTED ) return; + Fl_Tree_Item *item = session_browser->callback_item(); + + session_browser->deselect( item, 0 ); + + if ( item->children() ) + return; + + char name[1024]; + + session_browser->item_pathname( name, sizeof(name), item ); + foreach_daemon ( d ) { - osc->send( (*d)->addr, "/nsm/server/open", index( name, ' ' ) + 1 ); + osc->send( (*d)->addr, "/nsm/server/open", name ); } } else if ( w == new_button ) @@ -417,23 +585,41 @@ public: if ( ! browser->value() ) return; - const char *name = fl_input( "Add Client" ); + const char *n = fl_input( "Add Client" ); - if ( !name ) + if ( !n ) return; + + char *name = strdup( n ); + + if ( index( name, ' ' ) ) + { + free( name ); + name = strdup( "nsm-proxy" ); + } lo_address nsm_addr = lo_address_new_from_url( browser->text( browser->value() ) ); osc->send( nsm_addr, "/nsm/server/add", name ); + + free( name ); delete win; } else { - const char *name = fl_input( "Add Client" ); + const char *n = fl_input( "Add Client" ); - if ( !name ) + if ( !n ) return; + + char *name = strdup( n ); + + if ( index( name, ' ' ) ) + { + free( name ); + name = strdup( "nsm-proxy" ); + } MESSAGE( "Sending add for: %s", name ); /* FIXME: user should get to choose which system to do the add on */ @@ -441,27 +627,13 @@ public: { osc->send( (*d)->addr, "/nsm/server/add", name ); } + + free( name ); } } } - void - ForwardSort( Fl_Browser *b ) { - for ( int t=1; t<=b->size(); t++ ) { - for ( int r=t+1; r<=b->size(); r++ ) { - if ( strcmp(b->text(t), b->text(r)) > 0 ) { - b->swap(t,r); - } - } - } - } - - void - sort_sessions ( void ) - { - ForwardSort( session_browser ); - } NSM_Client * client_by_id ( const char *id ) @@ -586,20 +758,8 @@ public: void add_session_to_list ( const char *name ) { - char *s; - asprintf( &s, "@S18@C3 %s", name ); - - for ( int i = 1; i <= session_browser->size(); i++ ) - { - if ( !strcmp( session_browser->text( i ), s ) ) - { - free( s ); - return; - } - } - - session_browser->add( s ); - free(s); + session_browser->add( name ); + session_browser->redraw(); } @@ -651,9 +811,13 @@ public: } { Fl_Tile *o = new Fl_Tile( X, Y + 50, W, H - 50 ); { - Fl_Hold_Browser *o = session_browser = new Fl_Hold_Browser( X, Y + 50, W / 3, H - 50 ); + Fl_Tree *o = session_browser = new Fl_Tree( X, Y + 50, W / 3, H - 50 ); o->callback( cb_handle, (void *)this ); o->color( fl_darker( FL_GRAY ) ); + o->item_labelbgcolor( o->color() ); + o->item_labelfgcolor( FL_YELLOW ); + o->sortorder( FL_TREE_SORT_ASCENDING ); + o->showroot( 0 ); o->selection_color( fl_darker( FL_GREEN ) ); o->box( FL_ROUNDED_BOX ); o->label( "Sessions" ); @@ -737,6 +901,9 @@ public: osc->add_method( "/nsm/gui/client/switch", "ss", osc_handler, osc, "path,display_name" ); osc->add_method( "/nsm/gui/client/progress", "sf", osc_handler, osc, "path,display_name" ); osc->add_method( "/nsm/gui/client/dirty", "si", osc_handler, osc, "path,display_name" ); + osc->add_method( "/nsm/gui/client/has_optional_gui", "s", osc_handler, osc, "path,display_name" ); + osc->add_method( "/nsm/gui/client/gui_visible", "si", osc_handler, osc, "path,display_name" ); + osc->add_method( "/nsm/gui/client/label", "ss", osc_handler, osc, "path,display_name" ); osc->start(); @@ -796,7 +963,6 @@ private: ! strcmp( types, "s" ) ) { controller->add_session_to_list( &argv[0]->s ); - controller->sort_sessions(); } else if ( !strcmp( path, "/nsm/gui/gui_announce" ) ) { @@ -841,7 +1007,6 @@ private: if ( !strcmp( &argv[0]->s, "/nsm/server/list" ) ) { controller->add_session_to_list( &argv[1]->s ); - controller->sort_sessions(); } else if ( !strcmp( &argv[0]->s, "/osc/ping" ) ) { @@ -854,7 +1019,7 @@ private: if ( !strncmp( path, "/nsm/gui/client/", strlen( "/nsm/gui/client/" ) ) ) { if ( !strcmp( path, "/nsm/gui/client/new" ) && - !strcmp( types, "ss" ) ) + !strcmp( types, "ss" ) ) { controller->client_new( &argv[0]->s, &argv[1]->s ); } @@ -879,6 +1044,21 @@ private: { c->dirty( argv[1]->i ); } + else if ( !strcmp( path, "/nsm/gui/client/gui_visible" ) && + !strcmp( types, "si" )) + { + c->gui_visible( argv[1]->i ); + } + else if ( !strcmp( path, "/nsm/gui/client/label" ) && + !strcmp( types, "ss" )) + { + c->client_label( &argv[1]->s ); + } + else if ( !strcmp( path, "/nsm/gui/client/has_optional_gui" ) && + !strcmp( types, "s" )) + { + c->has_optional_gui(); + } else if ( !strcmp( path, "/nsm/gui/client/switch" ) && !strcmp( types, "ss" )) { @@ -944,13 +1124,6 @@ main (int argc, char **argv ) (char**)icon_16x16, &p, &mask, NULL); #endif - init_crystal_boxtypes(); - init_gleam_boxtypes(); - - Fl::get_system_colors(); - - color_scheme( "Dark" ); - Fl::scheme( "plastic" ); Fl::lock(); Fl_Double_Window *main_window; @@ -976,6 +1149,10 @@ main (int argc, char **argv ) #endif o->show( 0, NULL ); } + + fl_register_themes(); + + Fl_Theme::set(); static struct option long_options[] = { diff --git a/timeline/configure b/timeline/configure index 6822b72..ad571f2 100755 --- a/timeline/configure +++ b/timeline/configure @@ -21,14 +21,13 @@ using DEBUG && begin_tests -require_FLTK 1.1.7 images -require_command FLUID fluid require_command ar ar require_command makedepend makedepend +require_FLTK 1.3.0 images +require_command FLUID lib/ntk/fluid/fluid require_package JACK 0.103.0 jack require_package sndfile 1.0.17 sndfile require_package liblo 0.23 liblo -require_package sigcpp 2.0.0 sigc++-2.0 suggest_package XPM 2.0.0 xpm if ! hostname_resolvable @@ -44,24 +43,6 @@ then fail "Invalid hostname!" fi -if ! test_version 1.1.10 $FLTK_VERSION -then - warn "*** PERFORMANCE WARNING ***" - warn "" - warn "Your FLTK version is $FLTK_VERSION." - warn "" - warn "FLTK version 1.3.0 introduced a bug which slows down the" - warn "drawing of Non-DAW's timeline by a factor of thousands." - warn "" - warn "Install FLTK 1.1.10 and try again." - warn "" - warn "Alternatively, you can rerun configure and answer 'yes' to" - warn "the question 'Use widget for timeline'. It will be fast, but" - warn "you won't be able to see the playhead." - warn "" - warn "Please send any and all complaints to the FLTK developers!" -fi - test_version `version_of liblo` 0.26 || warn "Version $(version_of liblo) of liblo is slow to create servers. Consider upgrading to 0.26 or later" end diff --git a/timeline/doc/Makefile b/timeline/doc/Makefile index a9871d9..d592e33 100644 --- a/timeline/doc/Makefile +++ b/timeline/doc/Makefile @@ -17,8 +17,8 @@ upload: all @ rm -f index.html install: - @ mkdir -p $(DOCUMENT_PATH)/non-daw - @ cp $(OBJS) *.png mup.css ../../COPYING $(DOCUMENT_PATH)/non-daw + @ install -d "$(DESTDIR)$(DOCUMENT_PATH)"/non-daw + @ cp $(OBJS) *.png mup.css ../../COPYING "$(DESTDIR)$(DOCUMENT_PATH)"/non-daw # @ ln -sf $(PIXMAP_PATH)/logo.png $(DOCUMENT_PATH) clean: diff --git a/timeline/lib b/timeline/lib new file mode 120000 index 0000000..dc598c5 --- /dev/null +++ b/timeline/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/timeline/makefile.inc b/timeline/makefile.inc index 7073a96..132b8fd 100644 --- a/timeline/makefile.inc +++ b/timeline/makefile.inc @@ -12,9 +12,9 @@ SRCS:=$(SRCS:.fl=.C) SRCS:=$(sort $(SRCS)) OBJS:=$(SRCS:.C=.o) -LIBS := $(FLTK_LIBS) $(JACK_LIBS) $(SNDFILE_LIBS) $(LIBLO_LIBS) $(SIGCPP_LIBS) $(XPM_LIBS) +LIBS += $(FLTK_LDFLAGS) $(JACK_LIBS) $(SNDFILE_LIBS) $(LIBLO_LIBS) $(SIGCPP_LIBS) $(XPM_LIBS) -CFLAGS := $(SNDFILE_CFLAGS) $(FLTK_CFLAGS) $(JACK_CFLAGS) $(SIGCPP_CFLAGS) $(XPM_CFLAGS) +CFLAGS += $(SNDFILE_CFLAGS) $(FLTK_CFLAGS) $(JACK_CFLAGS) $(SIGCPP_CFLAGS) $(XPM_CFLAGS) -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ifeq ($(USE_UNOPTIMIZED_DRAWING),yes) CFLAGS+=-DUSE_UNOPTIMIZED_DRAWING @@ -28,23 +28,23 @@ ifeq ($(USE_WIDGET_FOR_TIMELINE),yes) CFLAGS+=-DUSE_WIDGET_FOR_TIMELINE endif -src/timeline: $(OBJS) FL/libfl_widgets.a nonlib/libnonlib.a + +src/timeline: $(OBJS) FL/libfl_widgets.a nonlib/libnonlib.a $(FLTK_LIBS) @ echo -n Linking timeline... - @ $(CXX) $(CXXFLAGS) $(INCLUDES) $(LIBS) $(OBJS) -o $@ -LFL -lfl_widgets -Lnonlib -lnonlib && echo $(DONE) + $(CXX) $(CXXFLAGS) $(INCLUDES) $^ -o $@ $(LIBS) -LFL -lfl_widgets -Lnonlib -lnonlib && echo $(DONE) Timeline: src/timeline clean: - rm -f $(OBJS) src/timeline + rm -f $(OBJS) src/timeline .deps install: all @ echo -n "Installing..." - @ install src/timeline $(prefix)/bin/non-daw - @ mkdir -p $(SYSTEM_PATH)/non-daw - @ mkdir -p $(PIXMAP_PATH)/non-daw + @ install -Dm755 src/timeline "$(DESTDIR)$(prefix)"/bin/non-daw + @ install -d "$(DESTDIR)$(SYSTEM_PATH)"/non-daw @ $(MAKE) -s -C doc install @ install -d "$(DESTDIR)$(PIXMAP_PATH)/non-daw" - @ install -m 644 icons/hicolor/256x256/apps/non-daw.png "$(DESTDIR)$(PIXMAP_PATH)"/non-daw/icon-256x256.png + @ install -Dm644 icons/hicolor/256x256/apps/non-daw.png "$(DESTDIR)$(PIXMAP_PATH)"/non-daw/icon-256x256.png @ install -d "$(DESTDIR)$(ICON_PATH)/hicolor" @ cp -au icons/hicolor/ "$(DESTDIR)$(ICON_PATH)" @ install -d "$(DESTDIR)$(DESKTOP_PATH)" @@ -52,6 +52,6 @@ install: all @ echo "$(DONE)" ifneq ($(USE_DEBUG),yes) @ echo -n "Stripping..." - @ strip $(prefix)/bin/non-daw + @ strip "$(DESTDIR)$(prefix)"/bin/non-daw @ echo "$(DONE)" endif diff --git a/timeline/src/Annotation_Point.H b/timeline/src/Annotation_Point.H index 5d59147..c7f29db 100644 --- a/timeline/src/Annotation_Point.H +++ b/timeline/src/Annotation_Point.H @@ -109,7 +109,7 @@ public: if ( m == FL_RELEASE ) { sequence()->sort(); - timeline->redraw(); + redraw(); } return r; diff --git a/timeline/src/Audio_Region.C b/timeline/src/Audio_Region.C index 36107e7..c119126 100644 --- a/timeline/src/Audio_Region.C +++ b/timeline/src/Audio_Region.C @@ -31,7 +31,7 @@ #include "Track.H" #include "Engine/Audio_File.H" - +#include "Transport.H" #include "const.h" #include "debug.h" @@ -45,10 +45,12 @@ using std::max; extern void draw_full_arrow_symbol ( Fl_Color color ); extern Timeline *timeline; +extern Transport *transport; bool Audio_Region::inherit_track_color = true; +bool Audio_Region::show_box = true; -Fl_Boxtype Audio_Region::_box = FL_UP_BOX; +Fl_Boxtype Audio_Region::_box = FL_FLAT_BOX; Fl_Color Audio_Region::_selection_color = FL_MAGENTA; @@ -92,8 +94,6 @@ Audio_Region::set ( Log_Entry &e ) if ( ! strcmp( s, ":gain" ) ) _scale = atof( v ); - else if ( ! strcmp( s, ":color" ) ) - _box_color = (Fl_Color)atoi( v ); else if ( ! strcmp( s, ":fade-in-type" ) ) _fade_in.type = (Fade::fade_type_e)atoi( v ); else if ( ! strcmp( s, ":fade-in-duration" ) ) @@ -121,13 +121,14 @@ Audio_Region::set ( Log_Entry &e ) void Audio_Region::init ( void ) { + _adjusting_gain = 0; _loop = 0; _sequence = NULL; _scale = 1.0f; _clip = NULL; - _box_color = FL_CYAN; - _color = FL_BLUE; + _color = FL_FOREGROUND_COLOR; + _box_color = FL_GRAY; _fade_in.length = 256; _fade_in.type = Fade::Sigmoid; @@ -148,6 +149,11 @@ Audio_Region::Audio_Region ( const Audio_Region & rhs ) : Sequence_Region( rhs ) _loop = rhs._loop; + _box_color = rhs._box_color; + _color = rhs._color; + + _adjusting_gain = false; + log_create(); } @@ -184,13 +190,7 @@ Audio_Region::Audio_Region ( Audio_File *c, Sequence *t, nframes_t o ) while ( sum >> 8 ) sum = (sum & 0xFF) + (sum >> 8); - _color = (Fl_Color)sum; - -/* _color = fl_color_average( FL_YELLOW, (Fl_Color)sum, 0.80 ); */ - -// _color = FL_YELLOW; - - _box_color = FL_WHITE; + _box_color = (Fl_Color)sum; log_create(); } @@ -237,6 +237,23 @@ Audio_Region::menu_cb ( const Fl_Menu_ *m ) _fade_out.type = Fade::Parabolic; else if ( ! strcmp( picked, "/Color" ) ) box_color( fl_show_colormap( box_color() ) ); + else if ( ! strcmp( picked, "/Split at mouse" ) ) + { + Loggable::block_start(); + + split( timeline->x_to_offset( Fl::event_x() ) ); + + log_end(); + + Loggable::block_end(); + + log_start(); + } + else if ( ! strcmp( picked, "/Crop to range" ) ) + { + trim_left( timeline->range_start() ); + trim_right( timeline->range_end() ); + } else if ( ! strcmp( picked, "/Fade in to mouse" ) ) { nframes_t offset = x_to_offset( Fl::event_x() ); @@ -253,6 +270,12 @@ Audio_Region::menu_cb ( const Fl_Menu_ *m ) if ( offset > 0 ) _fade_out.length = offset; } + else if ( ! strcmp( picked, "/Gain with mouse vertical drag" ) ) + { + /* float g = h() / (y() - Fl::event_y() ); */ + + /* _scale = g; */ + } else if ( ! strcmp( picked, "/Loop point to mouse" ) ) { nframes_t offset = x_to_offset( Fl::event_x() ); @@ -312,6 +335,9 @@ Audio_Region::menu ( void ) { 0 }, { 0 }, { "Color", 0, 0, 0, inherit_track_color ? FL_MENU_INACTIVE : 0 }, + { "Split at mouse", 's', 0, 0 }, + { "Crop to range", 'c', 0, 0 }, + { "Gain with mouse vertical drag", 'g', 0, 0 }, { "Fade in to mouse", FL_F + 3, 0, 0 }, { "Fade out to mouse", FL_F + 4, 0, 0 }, { "Loop point to mouse", 'l', 0, 0 }, @@ -341,93 +367,72 @@ Audio_Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int const int height = dh; const int width = timeline->ts_to_x( fade.length ); - fl_color( fl_lighter( FL_BLACK ) ); - - fl_push_matrix(); - + if ( width < 4 ) + /* too small to draw */ + return; + + int fx; + if ( dir == Fade::In ) - fl_translate( line_x(), dy ); + { + fx = line_x(); + + if ( fx + width < X || + fx > X + W ) + /* clipped */ + return; + } else { - fl_translate( line_x() + abs_w(), dy ); - /* flip */ - fl_scale( -1.0, 1.0 ); - } + fx = line_x() + abs_w(); - fl_scale( width, height ); + if ( fx - width > X + W || + fx < X ) + /* clipped */ + return; + } if ( line ) fl_begin_line(); else fl_begin_polygon(); - fl_vertex( 0.0, 0.0 ); - fl_vertex( 0.0, 1.0 ); + fl_vertex( fx, dy ); + fl_vertex( fx, dy + height ); - -// if ( draw_real_fade_curve ) { nframes_t tsx = timeline->x_to_ts( 1 ); - nframes_t ts = 0; - for ( int i = 0; i < width; ++i, ts += tsx ) - fl_vertex( i / (float)width, 1.0f - fade.gain( ts / (float)fade.length ) ); + if ( dir == Fade::In ) + { + nframes_t ts = 0; + for ( int i = 0; i < width; ++i, ts += tsx ) + fl_vertex( fx + i, dy + height - ( height * fade.gain( ts / (double)fade.length ) )); + } + else + { + nframes_t ts = tsx * width; + + for ( int i = 0; i < width; ++i, ts -= tsx ) + fl_vertex( fx - i, dy + ( height * fade.gain( ts / (double)fade.length ) )); + } } - - fl_vertex( 1.0, 0.0 ); + + if ( dir == Fade::In ) + fl_vertex( fx + width, dy ); + else + fl_vertex( fx - width, dy ); if ( line ) fl_end_line(); else fl_end_polygon(); - - fl_pop_matrix(); -} - -struct Peaks_Redraw_Request { - - Audio_Region *region; - - nframes_t start; - nframes_t end; - - Peaks_Redraw_Request ( Audio_Region *region, nframes_t start, nframes_t end ) : region( region ), start( start), end( end ) - { - } -}; - -/* static wrapper */ -void -Audio_Region::peaks_pending_cb ( void *v ) -{ - Peaks_Redraw_Request *r = (Peaks_Redraw_Request*)v; - - r->region->peaks_pending_cb( r ); -} - -void -Audio_Region::peaks_pending_cb ( Peaks_Redraw_Request *r ) -{ - int npeaks = timeline->ts_to_x( r->end - r->start ); - - if ( _clip->peaks()->ready( r->start, npeaks, timeline->fpp() ) ) - { - printf( "damaging from timeout\n" ); - /* FIXME: only need to damage the affected area! */ - timeline->damage( FL_DAMAGE_ALL, x(), y(), w(), h() ); - - delete r; - } - else - Fl::repeat_timeout( 0.1f, &Audio_Region::peaks_pending_cb, (void*)r ); } void Audio_Region::draw_box( void ) { - /* dirty hack to keep the box from flipping to vertical at small sizes */ - fl_push_clip( x(), y(), w(), h() ); Fl_Color selection_color = _selection_color; @@ -436,7 +441,7 @@ Audio_Region::draw_box( void ) color = fl_color_average( color, sequence()->color(), 0.75f ); - if ( this == ((Audio_Sequence*)sequence())->capture_region() ) + if ( recording() ) { color = FL_RED; } @@ -446,18 +451,39 @@ Audio_Region::draw_box( void ) selection_color = fl_inactive( selection_color ); } - if ( selected() ) - fl_draw_box( fl_down( box() ), x() - ( h() >> 1 ), y(), w() + ( h() >> 1 ) + 50, h(), selection_color ); - else - fl_draw_box( box(), x() - ( h() >> 1 ), y(), w() + ( h() >> 1 ) + 50, h(), color ); + Fl_Boxtype b; + Fl_Color c = selected() ? selection_color : color; - /* draw fades */ - draw_fade( _fade_in, Fade::In, false, x(), w() ); - draw_fade( _fade_out, Fade::Out, false, x(), w() ); + if ( Audio_Region::show_box ) + { + b = box(); + } + else + { + b = FL_DOWN_FRAME; + } + + fl_draw_box( b, x(), y(), w(), h(), c ); fl_pop_clip(); } +void +Audio_Region::peaks_ready_callback ( void *v ) +{ + DMESSAGE("Damaging region from peaks ready callback"); + Fl::lock(); + ((Audio_Region*)v)->redraw(); + Fl::unlock(); + Fl::awake(); +} + +bool +Audio_Region::recording ( void ) const +{ + return this == sequence()->track()->capture_region(); +} + /** Draw (part of) region. X, Y, W and H are the rectangle we're clipped to. */ void Audio_Region::draw ( void ) @@ -472,6 +498,7 @@ Audio_Region::draw ( void ) /* no coverage */ return; + if ( start() > timeline->xoffset + timeline->x_to_ts( sequence()->w() ) || start() + length() < timeline->xoffset ) /* not in viewport */ @@ -479,59 +506,65 @@ Audio_Region::draw ( void ) fl_push_clip( X, Y, W, H ); - /* account for waveform outlines... */ - X -= 2; - W += 4; + /* overdraw a little to avoid artifacts when scrolling */ + W += 2; - /* start with region length... */ -// int rw = timeline->ts_to_x( min( length(), timeline->x_to_ts( sequence()->w() ) ) ); - int rw = W; + Fl_Color c = selected() ? fl_invert_color( _color ) : _color; - /* calculate waveform offset due to scrolling */ - nframes_t offset = 0; - if ( start() < timeline->xoffset ) + if ( sequence()->damage() & FL_DAMAGE_USER1 && + recording() ) { - offset = timeline->xoffset - start(); - -// rw -= timeline->ts_to_x( offset ); + /* TODO: limit drawing. */ } -/* DMESSAGE( "rw = %d", rw ); */ + /* calculate waveform offset due to scrolling */ + /* offset is the number of frames into the waveform the value of X translates to */ + nframes_t x_frame = timeline->xoffset + timeline->x_to_ts( X - _sequence->x() ); + nframes_t offset = 0; - const int rx = x(); - -/* fl_color( FL_RED ); */ -/* fl_line( rx + rw, y(), rx + rw, y() + h() ); */ - - /* draw fade curve outlines--this is only here because of crossfades */ - draw_fade( _fade_in, Fade::In, true, X, W ); - draw_fade( _fade_out, Fade::Out, true, X, W ); - - int xo = 0; + if ( x_frame < start() ) + /* sometimes X is one pixel too soon... */ + offset = 0; + else + offset = x_frame - start(); + nframes_t fo = 0; nframes_t ostart = 0, oend = 0; + const int total_peaks_needed = W; + nframes_t total_frames_needed = timeline->x_to_ts( total_peaks_needed ); - const int total_peaks_needed = rw; + { + Fl_Color c = fl_color_average( FL_DARK1, + Audio_Region::inherit_track_color ? sequence()->track()->color() : _box_color, + 0.75f ); + + fl_color( fl_color_add_alpha( c, 127 ) ); - /* compensate for scrolling */ - if ( X - rx > 0 ) - offset += timeline->x_to_ts( X - rx ); + draw_fade( _fade_in, Fade::In, false, X, W ); + draw_fade( _fade_out, Fade::Out, false, X, W ); + } + int channels = 0; + int peaks = 0; + Peak *pbuf = NULL; do { - - int channels; - int peaks; - Peak *pbuf; - nframes_t start = _r->offset; - int loop_peaks_needed = _loop ? timeline->ts_to_x( _loop ) : timeline->ts_to_x( _clip->length() ); + nframes_t loop_frames_needed = _loop ? _loop : total_frames_needed; + int loop_peaks_needed = timeline->ts_to_x( loop_frames_needed ); + + Fl_Color c = Fl::get_color( _color ); - if ( ! loop_peaks_needed ) - break; + if ( recording() ) + { +// loop_peaks_needed = timeline->ts_to_x( _range.length ); + c = FL_BLACK; + } + + c = fl_color_add_alpha( c, 220 ); - if ( ! xo ) /* first loop... */ + if ( ! fo ) /* first loop... */ { if ( _loop ) start += offset % _loop; @@ -541,64 +574,60 @@ Audio_Region::draw ( void ) /* DMESSAGE( "offset = %lu", (unsigned long) offset ); */ /* DMESSAGE( "loop peaks needed = %d", loop_peaks_needed ); */ - loop_peaks_needed -= timeline->ts_to_x( offset % timeline->x_to_ts( loop_peaks_needed ) ); - - loop_peaks_needed = min( loop_peaks_needed, total_peaks_needed ); - + if ( _loop ) + { + loop_frames_needed -= offset % loop_frames_needed; + loop_peaks_needed = timeline->ts_to_x( loop_frames_needed ); + } /* DMESSAGE( "loop peaks needed = %d", loop_peaks_needed ); */ assert( loop_peaks_needed >= 0 ); - - if ( _loop && offset < _loop ) - { - const int x = timeline->ts_to_x( _loop - offset ); - - /* FIXME: is there no way to draw these symbols direclty? */ - fl_color( FL_WHITE ); - - fl_push_matrix(); - - fl_translate( X + x + 2, y() + h() - 14 ); - fl_scale( - 16, 8 ); - - draw_full_arrow_symbol( FL_BLACK ); - - fl_pop_matrix(); - } } - if ( xo + loop_peaks_needed > total_peaks_needed ) + if ( fo + loop_frames_needed > total_frames_needed ) { - loop_peaks_needed -= ( xo + loop_peaks_needed ) - total_peaks_needed; + loop_frames_needed -= ( fo + loop_frames_needed ) - total_frames_needed; + loop_peaks_needed = timeline->ts_to_x( loop_frames_needed ); } - if ( 0 == loop_peaks_needed ) + if ( !loop_peaks_needed ) break; - const nframes_t end = start + timeline->x_to_ts( loop_peaks_needed ); + const nframes_t end = start + loop_frames_needed; if ( start != ostart || end != oend ) { - if ( _clip->read_peaks( timeline->fpp(), - start, - end, - &peaks, &pbuf, &channels ) ) + if ( _clip->peaks()->peakfile_ready() ) { - Waveform::scale( pbuf, peaks * channels, _scale ); - - ostart = start; - oend = end; + if ( _clip->read_peaks( timeline->fpp(), + start, + end, + &peaks, &pbuf, &channels ) ) + { + Waveform::scale( pbuf, peaks * channels, _scale ); + + ostart = start; + oend = end; + } + } + else + { + if ( ! transport->rolling ) + { + /* create a thread to make the peaks */ + _clip->peaks()->make_peaks_asynchronously( Audio_Region::peaks_ready_callback, this ); + } } } else { // DMESSAGE( "using cached peaks" ); } - + if ( peaks && pbuf ) { int ch = (h() - Fl::box_dh( box() )) / channels; - + int xo = timeline->ts_to_x( fo ); for ( int i = 0; i < channels; ++i ) { @@ -607,36 +636,54 @@ Audio_Region::draw ( void ) loop_peaks_needed, ch, pbuf + i, peaks, channels, - selected() ? fl_invert_color( _color ) : _color ); + c ); } } - + else + WARNING( "Pbuf == %p, peaks = %lu", pbuf, (unsigned long)peaks ); + if ( peaks < loop_peaks_needed ) { - /* couldn't read peaks--perhaps they're being generated. Try again later. */ - Fl::add_timeout( 0.1f, &Audio_Region::peaks_pending_cb, - new Peaks_Redraw_Request( this, start + timeline->x_to_ts( peaks ), end ) ); + DMESSAGE( "Peak read came up %lu peaks short", (unsigned long)loop_peaks_needed - peaks ); } - xo += loop_peaks_needed; - + fo += loop_frames_needed; } - while ( _loop && xo < W ); + while ( _loop && fo < total_frames_needed ); - timeline->draw_measure_lines( X, Y, W, H, _box_color ); - -/* fl_color( FL_BLACK ); */ -/* fl_line( rx, Y, rx, Y + H ); */ -/* fl_line( rx + rw - 1, Y, rx + rw - 1, Y + H ); */ - - if ( _clip->dummy() ) + + if ( _loop && offset < _loop ) { - char pat[256]; - snprintf( pat, sizeof( pat ), "Missing Source!: %s", _clip->name() ); - draw_label( pat, align() ); + const int lx = get_x( start() + _loop ); + + if ( lx < X + W ) + { + fl_color( FL_RED ); + fl_line_style( FL_DASH, 0 ); + fl_line( lx, y(), lx, y() + h() ); + fl_line_style( FL_SOLID, 0 ); + } + } + + if ( _adjusting_gain ) + { + fl_color( fl_color_add_alpha( FL_DARK1, 127 ) ); + + fl_rectf( X, ( y() + h() ) - ( h() * ( _scale * 0.25 ) ), X + W, y() + h() ); + + fl_line_style( FL_DASH, 1 ); + + fl_color( fl_color_add_alpha( FL_GREEN, 200 ) ); + + float j = 5; + + for ( int i = y() + h(); i > y(); i -= j, j *= 1.2 ) + { + fl_line( X, i, X + W, i ); + } + + fl_line_style( FL_SOLID, 0 ); } - else - draw_label( _clip->name(), align() ); /* if ( current() ) */ /* { */ @@ -653,6 +700,19 @@ Audio_Region::draw ( void ) } +void +Audio_Region::draw_label ( void ) +{ + if ( _clip->dummy() ) + { + char pat[256]; + snprintf( pat, sizeof( pat ), "Missing Source!: %s", _clip->name() ); + draw_label( pat, align() ); + } + else + draw_label( _clip->name(), align() ); +} + /** split region at absolute frame /where/ */ void Audio_Region::split ( nframes_t where ) @@ -663,6 +723,8 @@ Audio_Region::split ( nframes_t where ) Audio_Region *copy = new Audio_Region( *this ); + Logger _log( copy ); + _fade_in.length = old_fade_in; _fade_out.length = 256; @@ -687,7 +749,21 @@ Audio_Region::handle ( int m ) case FL_FOCUS: case FL_UNFOCUS: return 1; + case FL_KEYUP: + if ( Fl::event_key() == 'g' ) + { + _adjusting_gain = false; + redraw(); + return 1; + } + break; case FL_KEYBOARD: + if ( Fl::event_key() == 'g' ) + { + _adjusting_gain = true; + redraw(); + return 1; + } return menu().test_shortcut() != 0; case FL_ENTER: return Sequence_Region::handle( m ); @@ -695,6 +771,9 @@ Audio_Region::handle ( int m ) return Sequence_Region::handle( m ); case FL_PUSH: { + if ( Fl::event_key() == 'g' ) + return 1; + /* splitting */ if ( test_press( FL_BUTTON2 | FL_SHIFT ) ) { @@ -748,22 +827,39 @@ Audio_Region::handle ( int m ) return 1; } case FL_DRAG: + if ( ! _drag ) { begin_drag( Drag( x() - X, y() - Y, x_to_offset( X ) ) ); _log.hold(); } + if ( Fl::event_key() == 'g' ) + { + float d = (float)h() / ( y() - Fl::event_y() ); + + _scale = -0.5f * d; + + redraw(); + return 1; + } + if ( test_press( FL_BUTTON1 | FL_SHIFT | FL_CTRL ) ) { /* panning */ int d = (ox + X) - x(); - long td = timeline->x_to_ts( d ); - if ( td > 0 && os < (nframes_t)td ) - _r->offset = 0; + bool negative = d < 0; + + if ( d < 0 ) + _r->offset = os + timeline->x_to_ts( 0 - d ); else - _r->offset = os - td; + { + if ( os < timeline->x_to_ts( d ) ) + _r->offset = 0; + else + _r->offset = os - timeline->x_to_ts( d ); + } redraw(); return 1; diff --git a/timeline/src/Audio_Region.H b/timeline/src/Audio_Region.H index 881f76d..6920fc1 100644 --- a/timeline/src/Audio_Region.H +++ b/timeline/src/Audio_Region.H @@ -23,7 +23,6 @@ #include "Sequence_Region.H" class Audio_File; -class Peaks_Redraw_Request; class Fl_Menu_; class Fl_Menu_Button; @@ -34,9 +33,12 @@ class Audio_Region : public Sequence_Region /* not permitted */ Audio_Region & operator = ( const Audio_Region &rhs ); + static void peaks_ready_callback ( void *v ); + public: static bool inherit_track_color; + static bool show_box; struct Fade { @@ -58,17 +60,17 @@ public: return length < rhs.length; } - float increment ( void ) const + double increment ( void ) const { - return 1.0f / (float)length; + return 1.0f / length; } /** Return gain for frame /index/ of /nframes/ on a gain curve * of type /type/.*/ /* FIXME: calling a function per sample is bad, switching on * type mid fade is bad. */ - inline float - gain ( const float fi ) const + inline double + gain ( const double fi ) const { switch ( type ) { @@ -85,7 +87,7 @@ public: } } - void apply ( sample_t *buf, fade_dir_e dir, long start, nframes_t end, nframes_t nframes ) const; + void apply ( sample_t *buf, fade_dir_e dir, nframes_t start, nframes_t nframes ) const; }; /* struct Fade_In : public Fade; */ @@ -95,6 +97,7 @@ private: Audio_File *_clip; /* clip this region represents */ + bool _adjusting_gain; float _scale; /* amplitude adjustment */ Fade _fade_in; @@ -105,8 +108,6 @@ private: friend class Track; /* for _clip */ Fl_Menu_Button & menu ( void ); - static void peaks_pending_cb ( void *v ); - void peaks_pending_cb ( Peaks_Redraw_Request *r ); static void menu_cb ( Fl_Widget *w, void *v ); void menu_cb ( const Fl_Menu_ *m ); @@ -118,8 +119,14 @@ protected: virtual void get ( Log_Entry &e ) const; virtual void set ( Log_Entry &e ); + void draw_label ( const char *label, Fl_Align align ) + { + Sequence_Widget::draw_label( label, align ); + } + int handle ( int m ); - void draw_box( void ); + void draw_label ( void ); + void draw_box ( void ); void draw ( void ); void resize ( void ); @@ -151,10 +158,11 @@ public: ~Audio_Region ( ); Fl_Boxtype box ( void ) const { return Audio_Region::_box; } - Fl_Align align ( void ) const { return (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE); } + Fl_Align align ( void ) const { return (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM | FL_ALIGN_INSIDE | FL_ALIGN_CLIP ); } void normalize ( void ); void split ( nframes_t where ); + bool recording ( void ) const; /* Engine */ nframes_t read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const; diff --git a/timeline/src/Audio_Sequence.C b/timeline/src/Audio_Sequence.C index 9e5ad32..15316f2 100644 --- a/timeline/src/Audio_Sequence.C +++ b/timeline/src/Audio_Sequence.C @@ -20,9 +20,11 @@ /* An Audio_Sequence is a sequence of Audio_Regions. Takes and 'track * contents' consist of these objects */ +#include "debug.h" + #include #include - +#include #include "Audio_Sequence.H" #include "Waveform.H" @@ -34,6 +36,12 @@ using namespace std; #include "Engine/Audio_File.H" // for ::from_file() #include "Transport.H" // for locate() +#include + +#include // for symlink() + +#include "string_util.h" + Audio_Sequence::Audio_Sequence ( Track *track, const char *name ) : Sequence( track ) @@ -124,35 +132,6 @@ Audio_Sequence::set ( Log_Entry &e ) } -static -void -deurlify ( char *url ) -{ - char *r, *w; - - r = w = url; - - for ( ; *r; r++, w++ ) - { - if ( *r == '%' ) - { - char data[3] = { *(r + 1), *(r + 2), 0 }; - - int c; - - sscanf( data, "%2X", &c ); - - *w = c; - - r += 2; - } - else - *w = *r; - } - - *w = 0; -} - void Audio_Sequence::handle_widget_change ( nframes_t start, nframes_t length ) { @@ -176,6 +155,8 @@ Audio_Sequence::draw ( void ) int xfades = 0; + fl_push_clip( x(), y(), w(), h() ); + /* draw crossfades */ for ( list ::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ ) { @@ -185,7 +166,6 @@ Audio_Sequence::draw ( void ) { if ( *o <= **r ) { - /* if ( o->x() == (*r)->x() && o->w() == (*r)->w() ) */ /* printf( "complete superposition\n" ); */ @@ -200,54 +180,16 @@ Audio_Sequence::draw ( void ) (o->x() + o->w()) - (*r)->x(), o->h() ); - Fl_Color c = fl_color_average( o->box_color(), (*r)->box_color(), 0.50f ); - c = fl_color_average( c, FL_YELLOW, 0.30f ); - - fl_push_clip( b.x, b.y, b.w, b.h ); - - draw_box( FL_FLAT_BOX, b.x - 100, b.y, b.w + 200, b.h, c ); - draw_box( FL_UP_FRAME, b.x - 100, b.y, b.w + 200, b.h, c ); - - - fl_pop_clip(); + Fl_Color c = fl_color_add_alpha( FL_YELLOW, 127 ); + fl_color( c ); + fl_rectf( b.x, b.y, b.w, b.h ); } } } - for ( list ::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ ) - { - Sequence_Widget *o = overlaps( *r ); - - if ( o ) - { - if ( *o <= **r ) - { - - if ( o->contains( *r ) ) - /* completely inside */ - continue; - - Rectangle b( (*r)->x(), o->y(), (o->x() + o->w()) - (*r)->x(), o->h() ); - - /* draw overlapping waveforms in X-ray style. */ - bool t = Waveform::fill; - - Waveform::fill = false; - - fl_push_clip( b.x, b.y, b.w, b.h ); - - o->draw(); - (*r)->draw(); - - fl_pop_clip(); - - Waveform::fill = t; - - } - } - } + fl_pop_clip(); } /** event handler that supports DND of audio clips */ @@ -271,22 +213,63 @@ Audio_Sequence::handle ( int m ) return 0; } - deurlify( file ); + unescape_url( file ); printf( "pasted file \"%s\"\n", file ); fl_cursor( FL_CURSOR_WAIT ); Fl::check(); - Audio_File *c = Audio_File::from_file( file ); + char *t = strdup( file ); + + char *filebase = strdup( basename( t ) ); + + free( t ); + + char *s = 0; + + int i = 0; + + for ( ; ; i++ ) + { + if ( i ) + { + free( s ); + asprintf( &s, "sources/%s-%i", filebase, i ); + } + else + asprintf( &s, "sources/%s", filebase ); + + DMESSAGE( "Symlink %s -> %s", file, s ); + if ( symlink( file, s ) == 0 ) + break; + + if ( errno != EEXIST ) + { + WARNING( "Failed to create symlink: %s", strerror( errno ) ); + break; + } + } + + Audio_File *c = Audio_File::from_file( basename( s ) ); + + free( s ); + free( filebase ); fl_cursor( FL_CURSOR_DEFAULT ); + Fl::check(); - if ( ! c ) + if ( ! c || c->dummy() ) { - fl_alert( "Could not import file \"%s\": Unsupported file type.", file ); - printf( "could not open file\n" ); + fl_alert( "Could not import file \"%s\"", file ); free( file ); + + if ( c ) + { + delete c; + c = NULL; + } + return 0; } @@ -296,6 +279,7 @@ Audio_Sequence::handle ( int m ) new Audio_Region( c, this, timeline->xoffset + timeline->x_to_ts( Fl::event_x() - x() ) ); redraw(); + return 1; } default: diff --git a/timeline/src/Audio_Sequence.H b/timeline/src/Audio_Sequence.H index 8e5a410..f7beea6 100644 --- a/timeline/src/Audio_Sequence.H +++ b/timeline/src/Audio_Sequence.H @@ -53,7 +53,14 @@ public: Fl_Cursor cursor ( void ) const { return FL_CURSOR_DEFAULT; } - Sequence * clone_empty ( const char *name = 0 ) + virtual Sequence * clone_empty ( void ) + { + Audio_Sequence *t = new Audio_Sequence( track() ); + + return t; + } + + virtual Sequence * clone_empty ( const char *name ) { Audio_Sequence *t = new Audio_Sequence( track(), name ); diff --git a/timeline/src/Control_Point.C b/timeline/src/Control_Point.C index 47a37d1..2d385d5 100644 --- a/timeline/src/Control_Point.C +++ b/timeline/src/Control_Point.C @@ -60,7 +60,7 @@ Control_Point::set ( Log_Entry &e ) if ( ! strcmp( s, ":y" ) ) _y = atof( v ); - timeline->redraw(); + redraw(); // _make_label(); } @@ -87,7 +87,19 @@ Control_Point::draw_box ( void ) char val[10]; snprintf( val, sizeof( val ), "%+.2f", 1.0 - _y * 2 ); - draw_label( val, (Fl_Align)( FL_ALIGN_TOP | FL_ALIGN_LEFT ), FL_FOREGROUND_COLOR ); + Fl_Align a = 0; + + if ( x() < _sequence->x() + ( _sequence->w() / 2 ) ) + a |= FL_ALIGN_RIGHT; + else + a |= FL_ALIGN_LEFT; + + if ( y() < _sequence->y() + ( _sequence->h() / 2 ) ) + a |= FL_ALIGN_BOTTOM; + else + a |= FL_ALIGN_TOP; + + draw_label( val, a, FL_FOREGROUND_COLOR ); } } diff --git a/timeline/src/Control_Sequence.C b/timeline/src/Control_Sequence.C index 92afbd3..c3b547c 100644 --- a/timeline/src/Control_Sequence.C +++ b/timeline/src/Control_Sequence.C @@ -34,6 +34,8 @@ using std::list; #include "OSC/Endpoint.H" +#include "string_util.h" + bool Control_Sequence::draw_with_gradient = true; @@ -48,18 +50,12 @@ Control_Sequence::Control_Sequence ( Track *track ) : Sequence( 0 ) _track = track; - _osc_output = 0; - _output = 0; - - _mode = CV; - mode( OSC ); - + if ( track ) track->add( this ); log_create(); - } @@ -114,7 +110,7 @@ Control_Sequence::init ( void ) _highlighted = false; _output = NULL; _osc_output = NULL; - color( fl_darker( FL_YELLOW ) ); + _mode = (Mode)-1; interpolation( Linear ); } @@ -234,6 +230,12 @@ Control_Sequence::mode ( Mode m ) { char *path; asprintf( &path, "/track/%s/control/%i", track()->name(), track()->ncontrols() ); + + char *s = escape_url( path ); + + free( path ); + + path = s; _osc_output = timeline->osc->add_signal( path, OSC::Signal::Output, 0, 1, 0, NULL, NULL ); @@ -248,7 +250,6 @@ Control_Sequence::mode ( Mode m ) void Control_Sequence::draw_curve ( bool flip, bool filled ) { - const int bx = x(); const int by = y() + Fl::box_dy( box() ); const int bw = w(); @@ -303,13 +304,13 @@ Control_Sequence::draw_curve ( bool flip, bool filled ) void Control_Sequence::draw ( void ) { - if ( ! fl_not_clipped( x(), y(), w(), h() ) ) - return; +// draw_box(); fl_push_clip( x(), y(), w(), h() ); + /* draw the box with the ends cut off. */ - draw_box( box(), x() - Fl::box_dx( box() ), y(), w() + Fl::box_dw( box() ) + 1, h(), color() ); +// draw_box( box(), x() - Fl::box_dx( box() ), y(), w() + Fl::box_dw( box() ) + 1, h(), color() ); const int bx = x(); const int by = y() + Fl::box_dy( box() ); @@ -328,11 +329,8 @@ Control_Sequence::draw ( void ) if ( draw_with_gradient ) { -/* const Fl_Color c2 = fl_color_average( selection_color, FL_WHITE, 0.90f ); */ -/* const Fl_Color c1 = fl_color_average( color, c2, 0.60f ); */ - - const Fl_Color c1 = fl_color_average( selection_color, FL_WHITE, 0.90f ); - const Fl_Color c2 = fl_color_average( color, c1, 0.60f ); + const Fl_Color c1 = fl_color_average( selection_color, FL_BLACK, 0.50f ); + const Fl_Color c2 = fl_color_average( color, FL_WHITE, 0.60f ); for ( int gy = 0; gy < bh; gy++ ) { @@ -356,7 +354,7 @@ Control_Sequence::draw ( void ) { if ( draw_with_polygon ) { - fl_color( draw_with_gradient ? color : fl_color_average( color, selection_color, 0.45f ) ); + fl_color( color ); fl_begin_complex_polygon(); draw_curve( draw_with_gradient, true ); @@ -383,7 +381,7 @@ Control_Sequence::draw ( void ) fl_line_style( FL_SOLID, 0 ); } - timeline->draw_measure_lines( x(), y(), w(), h(), color ); + timeline->draw_measure_lines( X, Y, W, H ); if ( interpolation() == None || _highlighted || Fl::focus() == this ) for ( list ::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ ) @@ -540,12 +538,21 @@ Control_Sequence::peer_callback( const char *name, const OSC::Signal *sig ) sig->parameter_limits().max == 1.0 ) ) return; - asprintf( &s, "%s/%s%s", peer_prefix, name, sig->path() ); + + assert( sig->path() ); + + char *path = strdup( sig->path() ); + + unescape_url( path ); + + asprintf( &s, "%s/%s%s", peer_prefix, name, path ); peer_menu->add( s, 0, NULL, (void*)( sig ), FL_MENU_TOGGLE | ( _osc_output->is_connected_to( sig ) ? FL_MENU_VALUE : 0 ) ); + free( path ); + free( s ); connect_osc(); diff --git a/timeline/src/Engine/Audio_File.C b/timeline/src/Engine/Audio_File.C index 82dab02..eeea756 100644 --- a/timeline/src/Engine/Audio_File.C +++ b/timeline/src/Engine/Audio_File.C @@ -37,6 +37,9 @@ Audio_File::~Audio_File ( ) if ( _filename ) free( _filename ); + + if ( _path ) + free( _path ); } const Audio_File::format_desc * @@ -66,23 +69,23 @@ is_absolute ( const char *name ) return *name == '/'; } -/** return a static pointer to /name/ corrected for relative path. */ -const char *Audio_File::realname ( const char *name ) +/** return pointer to /name/ corrected for relative path. */ +char *Audio_File::path ( const char *name ) { - static char rname[512]; + char *path = 0; if ( is_absolute( name ) ) - strncpy( rname, name, sizeof( rname ) ); + path = strdup( name ); else - snprintf( rname, sizeof( rname ), "sources/%s", name ); + asprintf( &path, "sources/%s", name ); - return rname; + return path; } const char * Audio_File::filename ( void ) const { - return realname( _filename ); + return _path; } /** attempt to open any supported filetype */ @@ -144,22 +147,14 @@ Audio_File::release ( void ) bool Audio_File::read_peaks( float fpp, nframes_t start, nframes_t end, int *peaks, Peak **pbuf, int *channels ) { -// Peaks pk; - + *peaks = 0; + *channels = 0; + *pbuf = NULL; + if ( dummy() ) - { - *peaks = (end - start) / fpp; - *channels = 0; - *pbuf = NULL; - return false; - } else { - *peaks = 0; - *channels = 0; - *pbuf = NULL; - *peaks = _peaks.fill_buffer( fpp, start, end ); *channels = this->channels(); diff --git a/timeline/src/Engine/Audio_File.H b/timeline/src/Engine/Audio_File.H index 0242d15..29a2f88 100644 --- a/timeline/src/Engine/Audio_File.H +++ b/timeline/src/Engine/Audio_File.H @@ -52,6 +52,8 @@ protected: }; char *_filename; + char *_path; + volatile nframes_t _length; /* length of file in samples */ nframes_t _samplerate; /* sample rate */ int _channels; @@ -60,13 +62,13 @@ protected: static const format_desc * find_format ( const format_desc *fd, const char *name ); - static const char *realname ( const char *name ); + static char *path ( const char *name ); public: Audio_File ( ) : _peaks( this ) { - _filename = NULL; + _path =_filename = NULL; _samplerate = 0; _length = _channels = 0; _refs = 0; diff --git a/timeline/src/Engine/Audio_File_Dummy.H b/timeline/src/Engine/Audio_File_Dummy.H index 1168ca8..331e3f9 100644 --- a/timeline/src/Engine/Audio_File_Dummy.H +++ b/timeline/src/Engine/Audio_File_Dummy.H @@ -40,7 +40,7 @@ public: bool open ( void ) { return true; } void close ( void ) { } void seek ( nframes_t ) { } - nframes_t read ( sample_t *, int, nframes_t len ) { return len; } - nframes_t read ( sample_t *, int, nframes_t start, nframes_t end ) { return end - start; } + nframes_t read ( sample_t *, int, nframes_t len ) { return 0; } + nframes_t read ( sample_t *, int, nframes_t start, nframes_t end ) { return 0; } nframes_t write ( sample_t *, nframes_t nframes ) { return nframes; } }; diff --git a/timeline/src/Engine/Audio_File_SF.C b/timeline/src/Engine/Audio_File_SF.C index c381411..70f9edd 100644 --- a/timeline/src/Engine/Audio_File_SF.C +++ b/timeline/src/Engine/Audio_File_SF.C @@ -33,6 +33,7 @@ #include "const.h" #include "debug.h" +#include @@ -62,7 +63,9 @@ Audio_File_SF::from_file ( const char *filename ) memset( &si, 0, sizeof( si ) ); - if ( ! ( in = sf_open( realname( filename ), SFM_READ, &si ) ) ) + char *fp = path( filename ); + + if ( ! ( in = sf_open( fp, SFM_READ, &si ) ) ) return NULL; /* if ( si.samplerate != timeline->sample_rate() ) */ @@ -76,6 +79,7 @@ Audio_File_SF::from_file ( const char *filename ) // c->_peak_writer = NULL; c->_current_read = 0; c->_filename = strdup( filename ); + c->_path = fp; c->_length = si.frames; c->_samplerate = si.samplerate; c->_channels = si.channels; @@ -99,6 +103,7 @@ Audio_File_SF::create ( const char *filename, nframes_t samplerate, int channels memset( &si, 0, sizeof( si ) ); + const Audio_File::format_desc *fd = Audio_File::find_format( Audio_File_SF::supported_formats, format ); if ( ! fd ) @@ -111,7 +116,9 @@ Audio_File_SF::create ( const char *filename, nframes_t samplerate, int channels char *name; asprintf( &name, "%s.%s", filename, fd->extension ); - if ( ! ( out = sf_open( realname( name ), SFM_WRITE, &si ) ) ) + char *filepath = path( name ); + + if ( ! ( out = sf_open( filepath, SFM_WRITE, &si ) ) ) { printf( "couldn't create soundfile.\n" ); free( name ); @@ -120,6 +127,7 @@ Audio_File_SF::create ( const char *filename, nframes_t samplerate, int channels Audio_File_SF *c = new Audio_File_SF; + c->_path = filepath; c->_filename = name; c->_length = 0; c->_samplerate = samplerate; @@ -141,7 +149,7 @@ Audio_File_SF::open ( void ) memset( &si, 0, sizeof( si ) ); - if ( ! ( _in = sf_open( realname( _filename ), SFM_READ, &si ) ) ) + if ( ! ( _in = sf_open( _path, SFM_READ, &si ) ) ) return false; _current_read = 0; @@ -234,13 +242,13 @@ Audio_File_SF::write ( sample_t *buf, nframes_t nframes ) { _peaks.write( buf, nframes ); -// lock(); + lock(); nframes_t l = sf_writef_float( _in, buf, nframes ); _length += l; -// unlock(); + unlock(); return l; } diff --git a/timeline/src/Engine/Audio_Region.C b/timeline/src/Engine/Audio_Region.C index 35ca784..1d12d42 100644 --- a/timeline/src/Engine/Audio_Region.C +++ b/timeline/src/Engine/Audio_Region.C @@ -33,31 +33,18 @@ -/** Apply a (portion of) fade from /start/ to /end/ assuming a - * buffer size of /nframes/. /start/ and /end/ are relative to the - * given buffer, and /start/ may be negative. */ +/** Apply a (portion of) fade from /start/ to a buffer up to size /nframes/. */ void -Audio_Region::Fade::apply ( sample_t *buf, Audio_Region::Fade::fade_dir_e dir, long start, nframes_t end, nframes_t nframes ) const +Audio_Region::Fade::apply ( sample_t *buf, Audio_Region::Fade::fade_dir_e dir, nframes_t start, nframes_t nframes ) const { // printf( "apply fade %s: start=%ld end=%lu\n", dir == Fade::Out ? "out" : "in", start, end ); - if ( ! nframes ) return; - const nframes_t i = start > 0 ? start : 0; - const nframes_t e = end > nframes ? nframes : end; + nframes_t n = nframes; - assert( i < nframes ); - - const float inc = increment(); - float fi = ( i - start ) / (float)length; - -// buf += i; - buf = &buf[ i ]; - - nframes_t n = e - i; - - assert( i + n <= nframes ); + const double inc = increment(); + double fi = start / (double)length; if ( dir == Fade::Out ) { @@ -94,18 +81,22 @@ Audio_Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channe /* calculate offsets into file and sample buffer */ - nframes_t sofs, ofs, cnt; + nframes_t sofs, /* offset into source */ + ofs, /* offset into buffer */ + cnt; /* number of frames to read */ cnt = nframes; if ( pos < r.start ) { + /* region starts somewhere after the beginning of this buffer */ sofs = 0; ofs = r.start - pos; cnt -= ofs; } else { + /* region started before this buffer */ ofs = 0; sofs = pos - r.start; } @@ -114,8 +105,8 @@ Audio_Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channe return 0; // const nframes_t start = ofs + r.start + sofs; - const nframes_t start = r.offset + sofs; - const nframes_t len = min( cnt, nframes - ofs ); + const nframes_t start = r.offset + sofs; + const nframes_t len = cnt; if ( len == 0 ) return 0; @@ -124,14 +115,21 @@ Audio_Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channe // printf( "reading region ofs = %lu, sofs = %lu, %lu-%lu\n", ofs, sofs, start, end ); + /* FIXME: keep the declick defults someplace else */ + Fade declick; + + declick.length = 256; + declick.type = Fade::Sigmoid; + if ( _loop ) { nframes_t lofs = sofs % _loop; nframes_t lstart = r.offset + lofs; + if ( lofs + len > _loop ) { - /* this buffer covers a loop bounary */ + /* this buffer covers a loop binary */ /* read the first part */ cnt = _clip->read( buf + ofs, channel, lstart, len - ( ( lofs + len ) - _loop ) ); @@ -144,60 +142,90 @@ Audio_Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channe } else cnt = _clip->read( buf + ofs, channel, lstart, len ); + + /* this buffer is inside declicking proximity to the loop boundary */ + + if ( lofs + cnt + declick.length > _loop /* buffer ends within declick length of the end of loop */ + && + sofs + declick.length < r.length /* not the last loop */ + ) + { + /* */ + /* fixme: what if loop is shorter than declick? */ + const nframes_t declick_start = _loop - declick.length; + + /* when the buffer covers the beginning of the + * declick, how many frames between the beginning of + * the buffer and the beginning of the declick */ + const nframes_t declick_onset_offset = declick_start > lofs ? declick_start - lofs : 0; + + /* how far into the declick we are */ + const nframes_t declick_offset = lofs > declick_start ? lofs - declick_start : 0; + + /* this is the end side of the loop boundary */ + + const nframes_t fl = cnt - declick_onset_offset; + + declick.apply( buf + ofs + declick_onset_offset, + Fade::Out, + declick_offset, fl ); + } + + if ( lofs < declick.length /* buffer begins within declick length of beginning of loop */ + && + sofs > _loop ) /* not the first loop */ + { + + const nframes_t declick_end = declick.length; + + const nframes_t click_len = lofs + cnt > declick_end ? declick_end - lofs : cnt; + + /* this is the beginning of the loop next boundary */ + declick.apply( buf + ofs, Fade::In, lofs, click_len ); + } } else cnt = _clip->read( buf + ofs, channel, start, len ); + if ( ! cnt ) + return 0; + /* apply gain */ buffer_apply_gain( buf + ofs, cnt, _scale ); /* perform declicking if necessary */ - /* FIXME: keep the declick defults someplace else */ - Fade declick; - - declick.length = 256; - declick.type = Fade::Linear; { + assert( cnt <= nframes ); + Fade fade; fade = declick < _fade_in ? _fade_in : declick; /* do fade in if necessary */ if ( sofs < fade.length ) - { - const long d = 0L - (long)sofs; - - assert( cnt <= nframes ); - - fade.apply( buf + ofs, Fade::In, d, d + fade.length, cnt ); - } + fade.apply( buf + ofs, Fade::In, sofs, cnt ); fade = declick < _fade_out ? _fade_out : declick; /* do fade out if necessary */ -// if ( start + cnt + fade.length > r.end ) - if ( start + fade.length > ( r.offset + r.length ) ) - { - const nframes_t d = ( r.offset + r.length ) - start; - - assert( cnt <= nframes ); - - fade.apply( buf, Fade::Out, cnt + (long)d - fade.length, cnt + d, cnt ); - } + if ( start + fade.length > r.offset + r.length ) + fade.apply( buf, Fade::Out, ( start + fade.length ) - ( r.offset + r.length ), cnt ); } -// printf( "read %lu frames\n", cnt ); return cnt; } - /** prepare for capturing */ void Audio_Region::prepare ( void ) { + THREAD_ASSERT( Capture ); + + DMESSAGE( "Preparing capture region" ); + log_start(); } @@ -208,39 +236,25 @@ Audio_Region::write ( nframes_t nframes ) { THREAD_ASSERT( Capture ); - _range.length += nframes; - - /* FIXME: too much? */ -// _track->damage( FL_DAMAGE_EXPOSE, x() + w(), y(), 10/* FIXME: guess */, h() ); - if ( 0 == ( timeline->ts_to_x( _range.length ) % 20 ) ) { - nframes_t oldl = _clip->length(); - - /* get the new size. Remember, this is a read-only handle on the source--not the same - one being written to */ - _clip->close(); - _clip->open(); - - int W = timeline->ts_to_x( _clip->length() - oldl ); - - /* why - 1? */ + int W = 20; if ( W ) { - ++W; Fl::lock(); - sequence()->damage( FL_DAMAGE_ALL, x() + w() - W, y(), W, h() ); -// Fl::awake(); + sequence()->damage(FL_DAMAGE_USER1, x(), y(), w(), h()); Fl::unlock(); } } + _range.length += nframes; + return nframes; } /** finalize region capture. Assumes that this *is* a captured region - and that no other regions refer to the same source */ + and that no other regions refer to the same source */ bool Audio_Region::finalize ( nframes_t frame ) { @@ -250,16 +264,10 @@ Audio_Region::finalize ( nframes_t frame ) _range.length = frame - _range.start; - log_end(); - _clip->close(); _clip->open(); - /* FIXME: should we attempt to truncate the file? */ - Fl::lock(); - redraw(); - Fl::awake(); - Fl::unlock(); + log_end(); return true; } diff --git a/timeline/src/Engine/Disk_Stream.C b/timeline/src/Engine/Disk_Stream.C index bb94fdc..74d3a9c 100644 --- a/timeline/src/Engine/Disk_Stream.C +++ b/timeline/src/Engine/Disk_Stream.C @@ -30,6 +30,7 @@ class Audio_Sequence; #include "const.h" #include "debug.h" +#include @@ -140,13 +141,23 @@ Disk_Stream::detach ( void ) void Disk_Stream::shutdown ( void ) { - _terminate = true; - - /* try to wake the thread so it'll see that it's time to die */ - block_processed(); - if ( _thread.running() ) + { + _terminate = true; + + /* try to wake the thread so it'll see that it's time to die */ + while ( _terminate ) + { + usleep( 100 ); + block_processed(); + } + _thread.join(); + + sem_destroy( &_blocks ); + + sem_init( &_blocks, 0, 0 ); + } } Track * diff --git a/timeline/src/Engine/Disk_Stream.H b/timeline/src/Engine/Disk_Stream.H index 37300c4..fe63524 100644 --- a/timeline/src/Engine/Disk_Stream.H +++ b/timeline/src/Engine/Disk_Stream.H @@ -94,11 +94,12 @@ protected: virtual void flush ( void ) = 0; void run ( void ); - void shutdown ( void ); void detach ( void ); public: + void shutdown ( void ); + /* must be set before any Disk_Streams are created */ static float seconds_to_buffer; static size_t disk_io_kbytes; diff --git a/timeline/src/Engine/Peaks.C b/timeline/src/Engine/Peaks.C index a587f70..b5ae7c5 100644 --- a/timeline/src/Engine/Peaks.C +++ b/timeline/src/Engine/Peaks.C @@ -24,6 +24,8 @@ /* Code for peakfile reading, resampling, generation and streaming */ +#include + #include #include #include @@ -33,8 +35,6 @@ #include #include -#include "../Transport.H" // for .recording - #include "Audio_File.H" #include "Peaks.H" @@ -51,8 +51,19 @@ using std::min; using std::max; +#include + #include + +struct peak_thread_data +{ + void(*callback)(void*); + void *userdata; + Peaks *peaks; +}; + + /* whether to cache peaks at multiple resolutions on disk to @@ -68,42 +79,18 @@ Peaks::peakbuffer Peaks::_peakbuf; static -const char * +char * peakname ( const char *filename ) { - static char file[512]; + char *file; - snprintf( file, 512, "%s.peak", filename ); + asprintf( &file, "%s.peak", filename ); - return (const char*)&file; + return file; } -Peaks::Peaks ( Audio_File *c ) -{ - _clip = c; - _peak_writer = NULL; -} - -Peaks::~Peaks ( ) -{ - if ( _peak_writer ) - delete _peak_writer; -} - - - -/** Prepare a buffer of peaks from /s/ to /e/ for reading. Must be - * called before any calls to operator[] */ -int -Peaks::fill_buffer ( float fpp, nframes_t s, nframes_t e ) const -{ - _fpp = fpp; - - return read_peaks( s, (e - s) / fpp, fpp ); -} - struct peakfile_block_header { @@ -117,16 +104,16 @@ class Peakfile FILE *_fp; nframes_t _chunksize; int _channels; /* number of channels this peakfile represents */ - nframes_t _length; /* length, in frames, of the clip this peakfile represents */ - size_t _offset; - int _blocks; +// nframes_t _length; /* length, in frames, of the clip this peakfile represents */ + off_t _offset; +// int _blocks; struct block_descriptor { nframes_t chunksize; - size_t pos; + off_t pos; - block_descriptor ( nframes_t chunksize, size_t pos ) : chunksize( chunksize ), pos( pos ) + block_descriptor ( nframes_t chunksize, off_t pos ) : chunksize( chunksize ), pos( pos ) { } @@ -136,16 +123,18 @@ class Peakfile } }; + std::list blocks; public: Peakfile ( ) { - _blocks = 0; +// _blocks = 0; _fp = NULL; _offset = 0; _chunksize = 0; _channels = 0; +// _length = 0; } ~Peakfile ( ) @@ -154,52 +143,54 @@ public: close(); } - int blocks ( void ) const { return _blocks; } + /* int blocks ( void ) const { return blocks.size(); } */ /** find the best block for /chunksize/ */ void scan ( nframes_t chunksize ) { - rewind( _fp ); - clearerr( _fp ); - - std::list blocks; - - /* scan all blocks */ - for ( ;; ) + if ( ! blocks.size() ) { - peakfile_block_header bh; - - fread( &bh, sizeof( bh ), 1, _fp ); - - if ( feof( _fp ) ) - break; - -// printf( "chunksize=%lu, skip=%lu\n", (unsigned long)bh.chunksize, (unsigned long) bh.skip ); - - ASSERT( bh.chunksize, "Invalid peak file structure!" ); - - blocks.push_back( block_descriptor( bh.chunksize, ftell( _fp ) ) ); - - if ( ! bh.skip ) - /* last block */ - break; - - if ( fseek( _fp, bh.skip, SEEK_CUR ) ) + rewind( _fp ); + clearerr( _fp ); + + /* scan all blocks */ + for ( ;; ) { - WARNING( "seek failed: %s (%lu)", strerror( errno ), bh.skip ); - break; + peakfile_block_header bh; + + fread( &bh, sizeof( bh ), 1, _fp ); + + if ( feof( _fp ) ) + break; + + DMESSAGE( "Peakfile: chunksize=%lu, skip=%lu", (uint64_t)bh.chunksize, (uint64_t) bh.skip ); + + ASSERT( bh.chunksize, "Chucksize of zero. Invalid peak file structure!" ); + + blocks.push_back( block_descriptor( bh.chunksize, ftello( _fp ) ) ); + + if ( ! bh.skip ) + /* last block */ + break; + + if ( fseeko( _fp, bh.skip, SEEK_CUR ) ) + { + WARNING( "seek failed: %s (%lu)", strerror( errno ), bh.skip ); + break; + } } } if ( ! blocks.size() ) - FATAL( "invalid peak file?" ); + FATAL( "Peak file contains no blocks!" ); + // DMESSAGE( "peakfile has %d blocks.", blocks.size() ); blocks.sort(); /* fall back on the smallest chunksize */ - fseek( _fp, blocks.front().pos, SEEK_SET ); + fseeko( _fp, blocks.front().pos, SEEK_SET ); _chunksize = blocks.front().chunksize; /* search for the best-fit chunksize */ @@ -208,19 +199,19 @@ public: if ( chunksize >= i->chunksize ) { _chunksize = i->chunksize; - fseek( _fp, i->pos, SEEK_SET ); + fseeko( _fp, i->pos, SEEK_SET ); break; } -// DMESSAGE( "using peakfile block for chunksize %lu", _chunksize ); - _blocks = blocks.size(); - _offset = ftell( _fp ); +// DMESSAGE( "using peakfile block for chunksize %lu", _chunksize ); +// _blocks = blocks.size(); + _offset = ftello( _fp ); } /** convert frame number of peak number */ nframes_t frame_to_peak ( nframes_t frame ) { - return frame * _channels / _chunksize; + return ( frame / _chunksize ) * (nframes_t)_channels; } /** return the number of peaks in already open peakfile /fp/ */ @@ -238,7 +229,7 @@ public: bool ready ( nframes_t start, nframes_t npeaks ) { - if ( _blocks > 1 ) + if ( blocks.size() > 1 ) return true; else return this->npeaks() > frame_to_peak( start ) + npeaks; @@ -248,11 +239,19 @@ public: bool open ( const char *name, int channels, nframes_t chunksize ) { - _chunksize = 0; +// _chunksize = 0; _channels = channels; - if ( ! ( _fp = fopen( peakname( name ), "r" ) ) ) + char *pn = peakname( name ); + + if ( ! ( _fp = fopen( pn, "r" ) ) ) + { + WARNING( "Failed to open peakfile for reading: %s", strerror(errno) ); + free( pn ); return false; + } + + free( pn ); scan( chunksize ); @@ -294,16 +293,25 @@ public: * large enough to fit the entire request. Returns the number of * peaks actually read, which may be fewer than were requested. */ nframes_t - read_peaks ( Peak *peaks, nframes_t s, int npeaks, nframes_t chunksize ) + read_peaks ( Peak *peaks, nframes_t s, nframes_t npeaks, nframes_t chunksize ) { if ( ! _fp ) + { + DMESSAGE( "No peakfile open, WTF?" ); return 0; + } const unsigned int ratio = chunksize / _chunksize; /* locate to start position */ - if ( fseek( _fp, _offset + ( frame_to_peak( s ) * sizeof( Peak ) ), SEEK_SET ) ) - /* failed to seek... peaks not ready? */ + + if ( fseeko( _fp, _offset + ( frame_to_peak( s ) * sizeof( Peak ) ), SEEK_SET ) ) + { + DMESSAGE( "failed to seek... peaks not ready?" ); + return 0; + } + + if ( feof( _fp ) ) return 0; if ( ratio == 1 ) @@ -313,7 +321,7 @@ public: nframes_t len = 0; - int i; + nframes_t i; for ( i = 0; i < npeaks; ++i ) { @@ -342,7 +350,7 @@ public: } - if ( len < ratio ) + if ( feof( _fp) || len < ratio ) break; } @@ -352,51 +360,113 @@ public: } }; -bool -Peaks::ready ( nframes_t s, int npeaks, nframes_t chunksize ) const -{ - Peakfile _peakfile; + - if ( ! _peakfile.open( _clip->filename(), _clip->channels(), chunksize ) ) +Peaks::Peaks ( Audio_File *c ) +{ + _pending = false; + _clip = c; + _peak_writer = NULL; + _peakfile = new Peakfile(); +} + +Peaks::~Peaks ( ) +{ + if ( _peak_writer ) + { + delete _peak_writer; + _peak_writer = NULL; + } + + delete _peakfile; + _peakfile = NULL; +} + + + +/** Prepare a buffer of peaks from /s/ to /e/ for reading. Must be + * called before any calls to operator[] */ +int +Peaks::fill_buffer ( float fpp, nframes_t s, nframes_t e ) const +{ + _fpp = fpp; + + return read_peaks( s, (e - s) / fpp, fpp ); +} + + +bool +Peaks::ready ( nframes_t s, nframes_t npeaks, nframes_t chunksize ) const +{ + if ( ! _peakfile->open( _clip->filename(), _clip->channels(), chunksize ) ) return false; - return _peakfile.ready( s, npeaks ); + int r = _peakfile->ready( s, npeaks ); + + _peakfile->close(); + + return r; } -int -Peaks::read_peakfile_peaks ( Peak *peaks, nframes_t s, int npeaks, nframes_t chunksize ) const +/** If this returns false, then the peakfile needs to be built */ +bool +Peaks::peakfile_ready ( void ) const { - /* never try to build peaks while recording */ - if ( ! transport->recording ) + return current() && ! _pending; +} + +void +Peaks::make_peaks_asynchronously ( void(*callback)(void*), void *userdata ) const +{ + /* already working on it... */ + if( _pending ) + return; + +// make_peaks(); + + _pending = true; + + peak_thread_data *pd = new peak_thread_data(); + + pd->callback = callback; + pd->userdata = userdata; + pd->peaks = const_cast(this); + + _make_peaks_thread.clone( &Peaks::make_peaks, pd ); + _make_peaks_thread.detach(); +} + +nframes_t +Peaks::read_peakfile_peaks ( Peak *peaks, nframes_t s, nframes_t npeaks, nframes_t chunksize ) const +{ + /* if ( _pending ) */ + /* return 0; */ + +// Peakfile _peakfile; + + if ( ! _peakfile->open( _clip->filename(), _clip->channels(), chunksize ) ) { - if ( ! current() ) - { - /* Build peaks asyncronously */ - if ( ! fork() ) - exit( make_peaks() ); - else - return 0; - } + DMESSAGE( "Failed to open peakfile!" ); + return 0; } - Peakfile _peakfile; + nframes_t l = _peakfile->read_peaks( peaks, s, npeaks, chunksize ); + + _peakfile->close(); - if ( ! _peakfile.open( _clip->filename(), _clip->channels(), chunksize ) ) - return 0; - - return _peakfile.read_peaks( peaks, s, npeaks, chunksize ); + return l; } -int -Peaks::read_source_peaks ( Peak *peaks, int npeaks, nframes_t chunksize ) const +nframes_t +Peaks::read_source_peaks ( Peak *peaks, nframes_t npeaks, nframes_t chunksize ) const { int channels = _clip->channels(); sample_t *fbuf = new sample_t[ chunksize * channels ]; - size_t len; + off_t len; - int i; + nframes_t i; for ( i = 0; i < npeaks; ++i ) { /* read in a buffer */ @@ -431,19 +501,19 @@ Peaks::read_source_peaks ( Peak *peaks, int npeaks, nframes_t chunksize ) const return i; } -int -Peaks::read_source_peaks ( Peak *peaks, nframes_t s, int npeaks, nframes_t chunksize ) const +nframes_t +Peaks::read_source_peaks ( Peak *peaks, nframes_t s, nframes_t npeaks, nframes_t chunksize ) const { _clip->seek( s ); - int i = read_source_peaks( peaks, npeaks, chunksize ); - - return i; + return read_source_peaks( peaks, npeaks, chunksize ); } -int -Peaks::read_peaks ( nframes_t s, int npeaks, nframes_t chunksize ) const +nframes_t +Peaks::read_peaks ( nframes_t s, nframes_t npeaks, nframes_t chunksize ) const { + THREAD_ASSERT( UI ); /* because _peakbuf cache is static */ + // printf( "reading peaks %d @ %d\n", npeaks, chunksize ); if ( _peakbuf.size < (nframes_t)( npeaks * _clip->channels() ) ) @@ -458,9 +528,13 @@ Peaks::read_peaks ( nframes_t s, int npeaks, nframes_t chunksize ) const /* FIXME: use actual minimum chunksize from peakfile! */ if ( chunksize < (nframes_t)cache_minimum ) + { _peakbuf.len = read_source_peaks( _peakbuf.buf->data, s, npeaks, chunksize ); + } else + { _peakbuf.len = read_peakfile_peaks( _peakbuf.buf->data, s, npeaks, chunksize ); + } return _peakbuf.len; } @@ -469,7 +543,29 @@ Peaks::read_peaks ( nframes_t s, int npeaks, nframes_t chunksize ) const bool Peaks::current ( void ) const { - return ! newer( _clip->filename(), peakname( _clip->filename() ) ); + char *pn = peakname( _clip->filename() ); + + bool b = ! newer( _clip->filename(), pn ); + + free( pn ); + + return b; +} + +/* thread entry point */ +void * +Peaks::make_peaks ( void *v ) +{ + peak_thread_data *pd = (peak_thread_data*)v; + + pd->peaks->make_peaks(); + + if ( pd->callback ) + pd->callback( pd->userdata ); + + delete pd; + + return NULL; } bool @@ -477,7 +573,20 @@ Peaks::make_peaks ( void ) const { Peaks::Builder pb( this ); - return pb.make_peaks(); + int b = pb.make_peaks(); + + _pending = false; + + return b; +} + +/* thread entry point */ +void * +Peaks::make_peaks_mipmap ( void *v ) +{ + ((Peaks*)v)->make_peaks_mipmap(); + + return NULL; } bool @@ -485,7 +594,11 @@ Peaks::make_peaks_mipmap ( void ) const { Peaks::Builder pb( this ); - return pb.make_peaks_mipmap(); + bool b = pb.make_peaks_mipmap(); + + _pending = false; + + return b; } /** return normalization factor for a single peak, assuming the peak @@ -511,7 +624,11 @@ Peaks::prepare_for_writing ( void ) assert( ! _peak_writer ); - _peak_writer = new Peaks::Streamer( _clip->filename(), _clip->channels(), cache_minimum ); + char *pn = peakname( _clip->filename() ); + + _peak_writer = new Peaks::Streamer( pn, _clip->channels(), cache_minimum ); + + free( pn ); } void @@ -522,10 +639,7 @@ Peaks::finish_writing ( void ) delete _peak_writer; _peak_writer = NULL; -/* now fill in the rest of the cache */ - if ( ! fork() ) - exit( make_peaks_mipmap() ); - + make_peaks_mipmap(); } void @@ -556,9 +670,9 @@ Peaks::Streamer::Streamer ( const char *filename, int channels, nframes_t chunks _peak = new Peak[ channels ]; memset( _peak, 0, sizeof( Peak ) * channels ); - if ( ! ( _fp = fopen( peakname( filename ), "w" ) ) ) + if ( ! ( _fp = fopen( filename, "w" ) ) ) { - WARNING( "could not open peakfile for streaming." ); + FATAL( "could not open peakfile for streaming." ); } peakfile_block_header bh; @@ -569,14 +683,19 @@ Peaks::Streamer::Streamer ( const char *filename, int channels, nframes_t chunks fwrite( &bh, sizeof( bh ), 1, _fp ); fflush( _fp ); + fsync( fileno( _fp ) ); } Peaks::Streamer::~Streamer ( ) { /* fwrite( _peak, sizeof( Peak ) * _channels, 1, _fp ); */ + fflush( _fp ); + touch( fileno( _fp ) ); + fsync( fileno( _fp ) ); + fclose( _fp ); delete[] _peak; @@ -594,9 +713,6 @@ Peaks::Streamer::write ( const sample_t *buf, nframes_t nframes ) { fwrite( _peak, sizeof( Peak ) * _channels, 1, _fp ); - /* FIXME: shouldn't we just use write() instead? */ - fflush( _fp ); - memset( _peak, 0, sizeof( Peak ) * _channels ); _index = 0; @@ -622,6 +738,9 @@ Peaks::Streamer::write ( const sample_t *buf, nframes_t nframes ) _index += processed; nframes -= processed; } + + /* FIXME: shouldn't we just use write() instead? */ + fflush( _fp ); } @@ -637,28 +756,28 @@ Peaks::Builder::write_block_header ( nframes_t chunksize ) if ( last_block_pos ) { /* update previous block */ - size_t pos = ftell( fp ); + off_t pos = ftello( fp ); - fseek( fp, last_block_pos - sizeof( peakfile_block_header ), SEEK_SET ); + fseeko( fp, last_block_pos - sizeof( peakfile_block_header ), SEEK_SET ); peakfile_block_header bh; fread( &bh, sizeof( bh ), 1, fp ); - fseek( fp, last_block_pos - sizeof( peakfile_block_header ), SEEK_SET ); -// fseek( fp, 0 - sizeof( bh ), SEEK_CUR ); + fseeko( fp, last_block_pos - sizeof( peakfile_block_header ), SEEK_SET ); +// fseeko( fp, 0 - sizeof( bh ), SEEK_CUR ); -// DMESSAGE( "old block header: chunksize=%lu, skip=%lu", bh.chunksize, bh.skip ); +// DMESSAGE( "old block header: chunksize=%lu, skip=%lu", (unsigned long) bh.chunksize, (unsigned long) bh.skip ); bh.skip = pos - last_block_pos; ASSERT( bh.skip, "Attempt to create empty block. pos=%lu, last_block_pos=%lu", pos, last_block_pos ); -// DMESSAGE( "new block header: chunksize=%lu, skip=%lu", bh.chunksize, bh.skip ); +// DMESSAGE( "new block header: chunksize=%lu, skip=%lu", (unsigned long) bh.chunksize, (unsigned long) bh.skip ); fwrite( &bh, sizeof( bh ), 1, fp ); - fseek( fp, pos, SEEK_SET ); + fseeko( fp, pos, SEEK_SET ); } peakfile_block_header bh; @@ -668,11 +787,14 @@ Peaks::Builder::write_block_header ( nframes_t chunksize ) fwrite( &bh, sizeof( bh ), 1, fp ); - last_block_pos = ftell( fp ); + last_block_pos = ftello( fp ); fflush( fp ); } + + + /** generate additional cache levels for a peakfile with only 1 block (ie. that of a new capture) */ bool Peaks::Builder::make_peaks_mipmap ( void ) @@ -683,26 +805,51 @@ Peaks::Builder::make_peaks_mipmap ( void ) Audio_File *_clip = _peaks->_clip; const char *filename = _clip->filename(); + char *pn = peakname( filename ); FILE *rfp; + + if ( ! ( rfp = fopen( pn, "r" ) ) ) + { + WARNING( "could not open peakfile for reading: %s.", strerror( errno ) ); + free( pn ); + return false; + } - rfp = fopen( peakname( filename ), "r" ); + { + peakfile_block_header bh; + + fread( &bh, sizeof( peakfile_block_header ), 1, rfp ); + + if ( bh.skip ) + { + WARNING( "Peakfile already has multiple blocks..." ); + fclose( rfp ); + free( pn ); + return false; + } + + } last_block_pos = sizeof( peakfile_block_header ); /* open for reading */ // rfp = fopen( peakname( filename ), "r" ); + /* open the file again for appending */ - if ( ! ( fp = fopen( peakname( filename ), "r+" ) ) ) + if ( ! ( fp = fopen( pn, "r+" ) ) ) { - WARNING( "could not open peakfile for appending." ); + WARNING( "could not open peakfile for appending: %s.", strerror( errno ) ); + free( pn ); return false; } - if ( fseek( fp, 0, SEEK_END ) ) + free( pn ); + + if ( fseeko( fp, 0, SEEK_END ) ) FATAL( "error performing seek: %s", strerror( errno ) ); - if ( ftell( fp ) == sizeof( peakfile_block_header ) ) + if ( ftello( fp ) == sizeof( peakfile_block_header ) ) { DWARNING( "truncated peakfile. Programming error?" ); return false; @@ -714,9 +861,10 @@ Peaks::Builder::make_peaks_mipmap ( void ) * preceding level */ nframes_t cs = Peaks::cache_minimum << Peaks::cache_step; + for ( int i = 1; i < Peaks::cache_levels; ++i, cs <<= Peaks::cache_step ) { - DMESSAGE( "building level %d peak cache", i + 1 ); + DMESSAGE( "building level %d peak cache cs=%i", i + 1, cs ); /* DMESSAGE( "%lu", _clip->length() / cs ); */ @@ -726,25 +874,31 @@ Peaks::Builder::make_peaks_mipmap ( void ) break; } - Peakfile pf; /* open the peakfile for the previous cache level */ + pf.open( rfp, _clip->channels(), cs >> Peaks::cache_step ); // pf.open( _clip->filename(), _clip->channels(), cs >> Peaks::cache_step ); write_block_header( cs ); - size_t len; + off_t len; nframes_t s = 0; do { len = pf.read_peaks( buf, s, 1, cs ); + s += cs; fwrite( buf, sizeof( buf ), len, fp ); } - while ( len ); + while ( len > 0 && s < _clip->length() ); + + DMESSAGE( "Last sample was %lu", s ); + + /* fflush( fp ); */ + /* fsync( fileno( fp ) ); */ pf.leave_open(); } @@ -766,8 +920,15 @@ Peaks::Builder::make_peaks ( void ) DMESSAGE( "building peaks for \"%s\"", filename ); - if ( ! ( fp = fopen( peakname( filename ), "w+" ) ) ) + char *pn = peakname( filename ); + + if ( ! ( fp = fopen( pn, "w+" ) ) ) + { + free( pn ); return false; + } + + free( pn ); _clip->seek( 0 ); @@ -778,7 +939,7 @@ Peaks::Builder::make_peaks ( void ) write_block_header( Peaks::cache_minimum ); /* build first level from source */ - size_t len; + off_t len; do { len = _peaks->read_source_peaks( buf, 1, Peaks::cache_minimum ); @@ -787,6 +948,8 @@ Peaks::Builder::make_peaks ( void ) while ( len ); /* reopen for reading */ + /* fflush( fp ); */ + /* fsync( fileno( fp ) ); */ fclose( fp ); make_peaks_mipmap(); diff --git a/timeline/src/Engine/Peaks.H b/timeline/src/Engine/Peaks.H index 423a310..ead005f 100644 --- a/timeline/src/Engine/Peaks.H +++ b/timeline/src/Engine/Peaks.H @@ -27,10 +27,21 @@ #include +#include "Thread.H" + + class Audio_File; +class Peakfile; class Peaks { + mutable volatile bool _pending; + + mutable Thread _make_peaks_thread; + mutable Thread _make_peaks_mipmap_thread; + + static void * make_peaks_mipmap ( void *v ); + static void * make_peaks ( void *v ); struct peakdata { @@ -52,6 +63,8 @@ class Peaks size = len = 0; } }; + + Peakfile *_peakfile; class Streamer { @@ -77,7 +90,7 @@ class Peaks class Builder { FILE *fp; - size_t last_block_pos; + off_t last_block_pos; const Peaks *_peaks; void write_block_header ( nframes_t chunksize ); @@ -90,16 +103,17 @@ class Peaks Builder ( const Peaks *peaks ); }; + /* FIXME: Is this ever accessed by multiple threads? */ static peakbuffer _peakbuf; Audio_File *_clip; mutable float _fpp; - int read_peaks ( nframes_t s, int npeaks, nframes_t chunksize ) const; - int read_source_peaks ( Peak *peaks, nframes_t s, int npeaks, nframes_t chunksize ) const; - int read_source_peaks ( Peak *peaks, int npeaks, nframes_t chunksize ) const; - int read_peakfile_peaks ( Peak *peaks, nframes_t s, int npeaks, nframes_t chunksize ) const; + nframes_t read_peaks ( nframes_t s, nframes_t npeaks, nframes_t chunksize ) const; + nframes_t read_source_peaks ( Peak *peaks, nframes_t s, nframes_t npeaks, nframes_t chunksize ) const; + nframes_t read_source_peaks ( Peak *peaks, nframes_t npeaks, nframes_t chunksize ) const; + nframes_t read_peakfile_peaks ( Peak *peaks, nframes_t s, nframes_t npeaks, nframes_t chunksize ) const; Streamer * volatile _peak_writer; /* exists when streaming peaks to disk */ @@ -107,6 +121,8 @@ class Peaks Peaks ( const Peaks &rhs ); const Peaks &operator= ( const Peaks &rhs ); + bool current ( void ) const; + public: static bool mipmapped_peakfiles; @@ -115,8 +131,6 @@ public: static const int cache_levels; static const int cache_step; - - Peaks ( Audio_File *c ); ~Peaks ( ); @@ -125,14 +139,17 @@ public: int fill_buffer ( float fpp, nframes_t s, nframes_t e ) const; - void read ( int X, float *hi, float *lo ) const; - bool ready ( nframes_t s, int npeaks, nframes_t chunksize ) const; + bool peakfile_ready ( void ) const; + + void read ( int X, float *hi, float *lo ) const; + bool ready ( nframes_t s, nframes_t npeaks, nframes_t chunksize ) const; - bool current ( void ) const; bool make_peaks ( void ) const; - bool make_peaks_mipmap ( void ) const; + bool make_peaks_mipmap ( void ) const; + void make_peaks_asynchronously ( void(*callback)(void*), void *userdata ) const; void prepare_for_writing ( void ); void finish_writing ( void ); void write ( sample_t *buf, nframes_t nframes ); + }; diff --git a/timeline/src/Engine/Record_DS.C b/timeline/src/Engine/Record_DS.C index 5d46ec6..629a49e 100644 --- a/timeline/src/Engine/Record_DS.C +++ b/timeline/src/Engine/Record_DS.C @@ -42,6 +42,12 @@ Record_DS::capture_region ( void ) const return NULL; } +Track::Capture * +Record_DS::capture ( void ) +{ + return _capture; +} + /** write /nframes/ from buf to the capture file of the attached track */ void Record_DS::write_block ( sample_t *buf, nframes_t nframes ) @@ -68,10 +74,10 @@ Record_DS::disk_thread ( void ) { _thread.name( "Capture" ); - track()->record( _capture, _frame ); - DMESSAGE( "capture thread running..." ); + track()->record( _capture, _frame ); + const nframes_t nframes = _nframes * _disk_io_blocks; /* buffer to hold the interleaved data returned by the track reader */ @@ -205,7 +211,10 @@ Record_DS::disk_thread ( void ) delete c; _terminate = false; + DMESSAGE( "capture thread gone" ); + + _thread.exit(); } @@ -252,7 +261,7 @@ Record_DS::stop ( nframes_t frame ) _stop_frame = frame; - detach(); +// detach(); DMESSAGE( "recording finished" ); } diff --git a/timeline/src/Engine/Record_DS.H b/timeline/src/Engine/Record_DS.H index e46f15d..278ada7 100644 --- a/timeline/src/Engine/Record_DS.H +++ b/timeline/src/Engine/Record_DS.H @@ -63,6 +63,7 @@ public: /* bool seek_pending ( void ); */ /* void seek ( nframes_t frame ); */ const Audio_Region * capture_region ( void ) const; + Track::Capture * capture ( void ); void start ( nframes_t frame ); void stop ( nframes_t frame ); diff --git a/timeline/src/Engine/Timeline.C b/timeline/src/Engine/Timeline.C index db80700..783d062 100644 --- a/timeline/src/Engine/Timeline.C +++ b/timeline/src/Engine/Timeline.C @@ -40,6 +40,9 @@ Timeline::record ( void ) nframes_t frame = transport->frame; + if ( transport->punch_enabled() && frame < range_start() ) + frame = range_start(); + DMESSAGE( "Going to record starting at frame %lu", (unsigned long)frame ); for ( int i = tracks->children(); i-- ; ) @@ -61,6 +64,9 @@ Timeline::stop ( void ) { nframes_t frame = transport->frame; + if ( transport->punch_enabled() && frame > range_end() ) + frame = range_end(); + for ( int i = tracks->children(); i-- ; ) { Track *t = (Track*)tracks->child( i ); @@ -69,6 +75,17 @@ Timeline::stop ( void ) t->record_ds->stop( frame ); } + /* wait until finalization is complete before continuing */ + + DMESSAGE( "Waiting for record threads to shutdown" ); + for ( int i = tracks->children(); i-- ; ) + { + Track *t = (Track*)tracks->child( i ); + + if ( t->armed() && t->record_ds ) + t->record_ds->shutdown(); + } + Loggable::block_end(); activate(); diff --git a/timeline/src/Engine/Track.C b/timeline/src/Engine/Track.C index 6e2ad80..1c9c288 100644 --- a/timeline/src/Engine/Track.C +++ b/timeline/src/Engine/Track.C @@ -40,6 +40,15 @@ Track::capture_region ( void ) const return NULL; } +Track::Capture * +Track::capture ( void ) +{ + if ( record_ds ) + return record_ds->capture(); + else + return NULL; +} + void Track::update_port_names ( void ) { @@ -193,7 +202,7 @@ Track::process_output ( nframes_t nframes ) } /* FIXME: should we blank the control output here or leave it floating? */ - for ( int i = control->children(); i--; ) + for ( int i = 0; i < control->children(); i++ ) ((Control_Sequence*)control->child( i ))->process( nframes ); if ( playback_ds ) @@ -249,19 +258,21 @@ Track::record ( Capture *c, nframes_t frame ) { THREAD_ASSERT( Capture ); - char pat[256]; + char *pat; - snprintf( pat, sizeof( pat ), "%s-%llu", name(), uuid() ); + asprintf( &pat, "%s-%llu", name(), uuid() ); c->audio_file = Audio_File_SF::create( pat, engine->sample_rate(), input.size(), Track::capture_format ); + free( pat ); + if ( ! c->audio_file ) FATAL( "Could not create file for new capture!" ); /* open it again for reading in the GUI thread */ - Audio_File *af = Audio_File::from_file( c->audio_file->name() ); + // Audio_File *af = Audio_File::from_file( c->audio_file->name() ); - c->region = new Audio_Region( af, sequence(), frame ); + c->region = new Audio_Region( c->audio_file, sequence(), frame ); c->region->prepare(); } @@ -287,10 +298,14 @@ Track::finalize ( Capture *c, nframes_t frame ) /* adjust region start for latency */ /* FIXME: is just looking at the first channel good enough? */ - c->region->finalize( frame ); DMESSAGE( "finalizing audio file" ); + /* must finalize audio before peaks file, otherwise another thread + * might think the peaks are out of date and attempt to regenerate + * them */ c->audio_file->finalize(); + c->region->finalize( frame ); + nframes_t capture_offset = 0; /* Add the system latency twice. Once for the input (usually @@ -308,5 +323,5 @@ Track::finalize ( Capture *c, nframes_t frame ) c->region->offset( capture_offset ); - delete c->audio_file; +// delete c->audio_file; } diff --git a/timeline/src/NSM.C b/timeline/src/NSM.C index 9218616..af0ee08 100644 --- a/timeline/src/NSM.C +++ b/timeline/src/NSM.C @@ -21,26 +21,22 @@ #include "debug.h" #include "Timeline.H" #include "TLE.H" -#include "NSM.H" #include "Project.H" #include "OSC/Endpoint.H" +#include + #define OSC_INTERVAL 0.2f extern char *instance_name; extern Timeline *timeline; -extern NSM_Client *nsm; +// extern NSM_Client *nsm; -NSM_Client::NSM_Client ( ) -{ -} -int command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg ); -int command_save ( char **out_msg ); -int -NSM_Client::command_save ( char **out_msg ) +static int +command_save ( char **out_msg, void *userdata ) { if ( timeline->command_save() ) return ERR_OK; @@ -51,8 +47,8 @@ NSM_Client::command_save ( char **out_msg ) } } -int -NSM_Client::command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg ) +static int +command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg, void *userdata ) { if ( instance_name ) free( instance_name ); @@ -89,21 +85,21 @@ NSM_Client::command_open ( const char *name, const char *display_name, const cha return r; } -void -NSM_Client::command_session_is_loaded ( void ) +static void +command_session_is_loaded ( void *userdata ) { MESSAGE( "NSM says session is loaded." ); timeline->discover_peers(); } -int -NSM_Client::command_broadcast ( const char *path, lo_message msg ) +static int +command_broadcast ( const char *path, lo_message msg, void *userdata ) { int argc = lo_message_get_argc( msg ); // lo_arg **argv = lo_message_get_argv( msg ); - if ( argc == 1 && !strcmp( path, "/non/finger" ) ) + if ( !strcmp( path, "/non/hello" ) ) { timeline->reply_to_finger( msg ); return 0; @@ -112,3 +108,12 @@ NSM_Client::command_broadcast ( const char *path, lo_message msg ) return -1; } + +void +set_nsm_callbacks ( nsm_client_t *nsm ) +{ + nsm_set_open_callback( nsm, command_open, 0 ); + nsm_set_save_callback( nsm, command_save, 0 ); + nsm_set_broadcast_callback( nsm, command_broadcast, 0 ); + nsm_set_session_is_loaded_callback( nsm, command_session_is_loaded, 0 ); +} diff --git a/timeline/src/OSC_Thread.C b/timeline/src/OSC_Thread.C index f252810..a04aa81 100644 --- a/timeline/src/OSC_Thread.C +++ b/timeline/src/OSC_Thread.C @@ -24,16 +24,23 @@ #include #include +#include "debug.h" + extern Timeline *timeline; OSC_Thread::OSC_Thread ( ) { // _thread.init(); + _shutdown = false; } OSC_Thread::~OSC_Thread ( ) { - + if ( _shutdown == false ) + { + _shutdown = true; + _thread.join(); + } } void @@ -42,21 +49,27 @@ OSC_Thread::start ( ) _thread.clone( &OSC_Thread::process, this ); } +void +OSC_Thread::join ( ) +{ + _thread.join(); +} + void OSC_Thread::process ( void ) { _thread.name( "OSC" ); - for ( ;; ) + DMESSAGE( "OSC Thread starting" ); + + while ( !_shutdown ) { usleep( 100 * 1000 ); - lock(); - timeline->process_osc(); - - unlock(); } + + DMESSAGE( "OSC Thread stopping." ); } void * diff --git a/timeline/src/OSC_Thread.H b/timeline/src/OSC_Thread.H index d75991d..d678028 100644 --- a/timeline/src/OSC_Thread.H +++ b/timeline/src/OSC_Thread.H @@ -26,12 +26,16 @@ class OSC_Thread : public Mutex { Thread _thread; /* io thread */ + volatile bool _shutdown; + public: OSC_Thread ( ); virtual ~OSC_Thread ( ); + void join ( void ); + void shutdown ( void ) { _shutdown = true; } void start ( void ); void process ( void ); static void *process ( void * ); diff --git a/timeline/src/Project.C b/timeline/src/Project.C index f85e832..f516c99 100644 --- a/timeline/src/Project.C +++ b/timeline/src/Project.C @@ -118,7 +118,7 @@ Project::write_info ( void ) strcpy( s, _created_on ); fprintf( fp, "created by\n\t%s\ncreated on\n\t%s\nversion\n\t%d\nsample rate\n\t%lu\n", - APP_TITLE " " VERSION, + APP_NAME " " VERSION, s, PROJECT_VERSION, (unsigned long)timeline->sample_rate() ); @@ -283,7 +283,8 @@ Project::open ( const char *name ) if ( ! read_info( &version, &rate, &creation_date, &created_by ) ) return E_INVALID; - if ( strncmp( created_by, APP_TITLE, strlen( APP_TITLE ) ) ) + if ( strncmp( created_by, APP_TITLE, strlen( APP_TITLE ) ) && + strncmp( created_by, APP_NAME, strlen( APP_NAME ) ) ) return E_INVALID; if ( version != PROJECT_VERSION ) diff --git a/timeline/src/Sequence.C b/timeline/src/Sequence.C index 74b5a6c..40f89d6 100644 --- a/timeline/src/Sequence.C +++ b/timeline/src/Sequence.C @@ -28,8 +28,6 @@ #include "Transport.H" // for locate() -#include "FL/Crystal_Boxtypes.H" - #include "const.h" #include "debug.h" @@ -65,7 +63,7 @@ Sequence::init ( void ) _name = NULL; - box( FL_DOWN_BOX ); + box( FL_FLAT_BOX ); color( FL_BACKGROUND_COLOR ); align( FL_ALIGN_LEFT ); @@ -122,7 +120,11 @@ Sequence::x_to_offset ( int X ) void Sequence::sort ( void ) { + timeline->wrlock(); + _widgets.sort( Sequence_Widget::sort_func ); + + timeline->unlock(); } /** return a pointer to the widget that /r/ overlaps, or NULL if none. */ @@ -142,11 +144,7 @@ Sequence::overlaps ( Sequence_Widget *r ) void Sequence::handle_widget_change ( nframes_t start, nframes_t length ) { - timeline->wrlock(); - sort(); - - timeline->unlock(); // timeline->update_length( start + length ); } @@ -257,42 +255,37 @@ Sequence::snap ( Sequence_Widget *r ) } +void +Sequence::draw_box ( void ) +{ + /* draw the box with the ends cut off. */ + Fl_Widget::draw_box( box(), x() - Fl::box_dx( box() ) - 1, y(), w() + Fl::box_dw( box() ) + 2, h(), color() ); +} + void Sequence::draw ( void ) { - - if ( ! fl_not_clipped( x(), y(), w(), h() ) ) - return; - fl_push_clip( x(), y(), w(), h() ); - /* draw the box with the ends cut off. */ - draw_box( box(), x() - Fl::box_dx( box() ) - 1, y(), w() + Fl::box_dw( box() ) + 2, h(), color() ); + draw_box(); + + for ( list ::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r ) + (*r)->draw_box(); + + + for ( list ::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r ) + (*r)->draw(); int X, Y, W, H; fl_clip_box( x(), y(), w(), h(), X, Y, W, H ); -/* if ( Sequence_Widget::pushed() && Sequence_Widget::pushed()->sequence() == this ) */ -/* { */ -/* /\* make sure the Sequence_Widget::pushed widget is above all others *\/ */ -/* remove( Sequence_Widget::pushed() ); */ -/* add( Sequence_Widget::pushed() ); */ -/* } */ - -// printf( "track::draw %d,%d %dx%d\n", X,Y,W,H ); - - timeline->draw_measure_lines( X, Y, W, H, color() ); + timeline->draw_measure_lines( X, Y, W, H ); for ( list ::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r ) - (*r)->draw_box(); - - - for ( list ::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r ) - (*r)->draw(); + (*r)->draw_label(); fl_pop_clip(); - } #include "FL/test_press.H" diff --git a/timeline/src/Sequence.H b/timeline/src/Sequence.H index 978af7a..54e807a 100644 --- a/timeline/src/Sequence.H +++ b/timeline/src/Sequence.H @@ -109,7 +109,7 @@ public: void remove_selected ( void ); - Fl_Color color ( void ) const { return this == Fl::focus() ? fl_color_average( FL_FOREGROUND_COLOR, Fl_Widget::color(), 0.50f ) : Fl_Widget::color(); } + Fl_Color color ( void ) const { return this == Fl::focus() ? fl_color_average( FL_FOREGROUND_COLOR, Fl_Widget::color(), 0.20f ) : Fl_Widget::color(); } void color ( Fl_Color v ) { Fl_Widget::color( v ); } const std::list widgets ( void ) const { return _widgets; } @@ -136,6 +136,7 @@ public: virtual void snap ( Sequence_Widget *r ); virtual int handle ( int m ); virtual void draw ( void ); + virtual void draw_box ( void ); virtual nframes_t process ( nframes_t ) { return 0; } diff --git a/timeline/src/Sequence_Point.C b/timeline/src/Sequence_Point.C index 272e40e..b461f19 100644 --- a/timeline/src/Sequence_Point.C +++ b/timeline/src/Sequence_Point.C @@ -25,8 +25,10 @@ Sequence_Point::Sequence_Point ( const Sequence_Point &rhs ) : Sequence_Widget( rhs ) { - if ( _label ) + if ( rhs._label ) _label = strdup( rhs._label ); + else + _label = 0; } Sequence_Point::Sequence_Point ( ) @@ -104,24 +106,19 @@ draw_marker ( Fl_Color c ) void Sequence_Point::draw_box ( void ) { -// Sequence_Widget::draw_box(); - const int X = x() - (abs_w() >> 1); -// const int Y = y() + Fl::box_dy( box() ); const int Y = y(); - fl_color( color() ); - fl_push_matrix(); - fl_translate( X, Y + ( h() >> 3 ) ); - fl_scale( w(), h() - ( h() >> 3 ) ); + fl_translate( X, Y ); + fl_scale( abs_w(), h() ); - draw_marker( color() ); + Fl_Color c = selected() ? selection_color() : color(); + + draw_marker( c ); fl_pop_matrix(); - -// fl_line( X, Y, X, Y + h() - Fl::box_dh( box() ) ); } void diff --git a/timeline/src/Sequence_Point.H b/timeline/src/Sequence_Point.H index bd3b628..f87a06e 100644 --- a/timeline/src/Sequence_Point.H +++ b/timeline/src/Sequence_Point.H @@ -60,12 +60,7 @@ public: virtual int x ( void ) const { - const int x = Sequence_Widget::x(); - - if ( x >= sequence()->x() + sequence()->w() ) - return sequence()->x() + sequence()->w() + abs_w(); - else - return x; + return line_x(); } nframes_t length ( void ) const { return timeline->x_to_ts( abs_w() ); } diff --git a/timeline/src/Sequence_Region.C b/timeline/src/Sequence_Region.C index 354bf06..8ecd82f 100644 --- a/timeline/src/Sequence_Region.C +++ b/timeline/src/Sequence_Region.C @@ -247,10 +247,21 @@ Sequence_Region::handle ( int m ) void Sequence_Region::draw_box ( void ) { - fl_draw_box( box(), line_x(), y(), abs_w(), h(), box_color() ); + Fl_Color c = selected() ? selection_color() : box_color(); + fl_draw_box( box(), line_x(), y(), abs_w(), h(), fl_color_add_alpha( c, 127 ) ); } void Sequence_Region::draw ( void ) { + } + +void +Sequence_Region::draw_label ( const char *label, Fl_Align align ) +{ + fl_color( FL_WHITE ); + fl_font( FL_HELVETICA_ITALIC, 10 ); + fl_draw( label, line_x() + Fl::box_dx( box() ), y() + Fl::box_dy( box() ), abs_w() - Fl::box_dw( box() ), h() - Fl::box_dh( box() ), align ); +} + diff --git a/timeline/src/Sequence_Region.H b/timeline/src/Sequence_Region.H index c17e240..1c2d818 100644 --- a/timeline/src/Sequence_Region.H +++ b/timeline/src/Sequence_Region.H @@ -37,9 +37,11 @@ protected: Sequence_Region ( const Sequence_Region &rhs ); virtual ~Sequence_Region ( ); + virtual Fl_Align align ( void ) const { return FL_ALIGN_INSIDE | FL_ALIGN_CENTER | FL_ALIGN_WRAP; } virtual int handle ( int m ); virtual void draw_box( void ); virtual void draw ( void ); + virtual void draw_label ( const char *label, Fl_Align align ); public: diff --git a/timeline/src/Sequence_Widget.C b/timeline/src/Sequence_Widget.C index d6741e7..b8b3722 100644 --- a/timeline/src/Sequence_Widget.C +++ b/timeline/src/Sequence_Widget.C @@ -230,6 +230,11 @@ Sequence_Widget::start ( nframes_t where ) } } +void +Sequence_Widget::draw_label ( void ) +{ +} + void Sequence_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color, int xo, int yo ) { @@ -249,8 +254,8 @@ Sequence_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color, // lab.type = FL_SHADOW_LABEL; lab.type = FL_NORMAL_LABEL; lab.value = label; - lab.font = FL_HELVETICA; - lab.size = 14; + lab.font = FL_HELVETICA_ITALIC; + lab.size = 9; int lw = 0, lh = 0; @@ -263,26 +268,29 @@ Sequence_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color, if ( abs_x() < scroll_x() ) dx = min( 32767, scroll_x() - abs_x() ); - const Fl_Boxtype b = FL_ROUNDED_BOX; - const int bx = Fl::box_dx( b ) + 1; - const int bw = Fl::box_dw( b ) + 1; -// const int by = Fl::box_dy( b ) + 1; - const int bh = Fl::box_dh( b ) + 1; + const Fl_Boxtype b = FL_BORDER_BOX; + const int bx = Fl::box_dx( b ); + const int bw = Fl::box_dw( b ); + const int by = Fl::box_dy( b ); + const int bh = Fl::box_dh( b ); /* FIXME: why do we have to do this here? why doesn't Fl_Label::draw take care of this stuff? */ if ( align & FL_ALIGN_INSIDE ) { - X += Fl::box_dx( box() ); - Y += Fl::box_dy( box() ); - W -= Fl::box_dw( box() ); - H -= Fl::box_dh( box() ); - + if ( align & FL_ALIGN_BOTTOM ) + Y += h() - ( lh + bh ); + else if ( align & FL_ALIGN_TOP ) + Y += by; + else + Y += ( h() / 2 ) - ( lh + bh ); if ( align & FL_ALIGN_RIGHT ) - X += abs_w() - (lw + bw); + X += abs_w() - ( lw + bw ); + else if ( align & FL_ALIGN_LEFT ) + X += bx; + else + X += ( abs_w() / 2 ) - ( ( lw + bw ) / 2 ); - if ( align & FL_ALIGN_BOTTOM ) - Y += h() - (lh + (bh << 1)); } else { @@ -290,17 +298,22 @@ Sequence_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color, X += abs_w(); else if ( align & FL_ALIGN_LEFT ) X -= lw + bw; + else + X += ( abs_w() / 2 ) - ( ( lw + bw ) / 2 ); if ( align & FL_ALIGN_BOTTOM ) Y += h(); else if ( align & FL_ALIGN_TOP ) Y -= lh + bh; + else + Y += ( h() / 2 ) - ( ( lh + bh ) / 2 ); } - fl_draw_box( b, ( X - dx ), Y, lw + bw, lh, FL_GRAY ); + fl_draw_box( b, ( X - dx ), Y - by, lw + bw, lh + bh, fl_color_add_alpha( FL_DARK1, 150 ) ); fl_color( color ); - fl_draw( label, ( X - dx ) + bx, Y, lw, lh, (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_CENTER ) ); + + fl_draw( label, ( X - dx ), Y, lw + bw, lh, (Fl_Align)(FL_ALIGN_CENTER) ); if ( align & FL_ALIGN_CLIP ) fl_pop_clip(); } @@ -376,11 +389,6 @@ Sequence_Widget::handle ( int m ) /* traditional selection model */ if ( Fl::event_ctrl() ) select(); - else if ( ! selected() ) - { - select_none(); - select(); - } fl_cursor( FL_CURSOR_MOVE ); @@ -458,8 +466,7 @@ Sequence_Widget::handle ( int m ) // timeline->update_length( start() + length() ); /* FIXME: why isn't this enough? */ -// sequence()->redraw(); - timeline->redraw(); + sequence()->redraw(); } if ( ! selected() || _selection.size() == 1 ) diff --git a/timeline/src/Sequence_Widget.H b/timeline/src/Sequence_Widget.H index 79b56f6..8da354e 100644 --- a/timeline/src/Sequence_Widget.H +++ b/timeline/src/Sequence_Widget.H @@ -193,9 +193,16 @@ public: virtual int h ( void ) const { return _sequence->h(); } /* used by regions */ + + int get_x( nframes_t frame ) const + { + return frame < timeline->xoffset ? _sequence->x() : min( _sequence->x() + _sequence->w(), _sequence->x() + timeline->ts_to_x( frame - timeline->xoffset ) ); + + } + virtual int x ( void ) const { - return _r->start < timeline->xoffset ? _sequence->x() : min( _sequence->x() + _sequence->w(), _sequence->x() + timeline->ts_to_x( _r->start - timeline->xoffset ) ); + return get_x( _r->start ); } /* use this as x() when you need to draw lines between widgets */ @@ -267,17 +274,21 @@ public: virtual void redraw ( void ) { + if ( ! _sequence ) + return; + if ( ! (align() & FL_ALIGN_INSIDE) ) { // FIXME: to better.. _sequence->redraw(); } else - _sequence->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() ); + _sequence->damage( FL_DAMAGE_ALL, x(), y(), w(), h() ); } virtual void draw_box ( void ); virtual void draw ( void ); + virtual void draw_label ( void ); bool operator< ( const Sequence_Widget & rhs ) const diff --git a/timeline/src/TLE.fl b/timeline/src/TLE.fl index ef21f76..fde1216 100644 --- a/timeline/src/TLE.fl +++ b/timeline/src/TLE.fl @@ -22,15 +22,18 @@ comment {// } {in_source in_header } -decl {const float STATUS_UPDATE_FREQ = 0.1f;} {private local +decl {const float STATUS_UPDATE_FREQ = 0.5f;} {private local +} + +decl {class Fl_Flowpack;} {public global +} + +decl {\#include } {private local } decl {\#include "Fl_Menu_Settings.H"} {private local } -decl {\#include "color_scheme.H"} {private local -} - decl {\#include "Timeline.H"} {private local } @@ -46,6 +49,9 @@ decl {\#include "Project.H"} {private local decl {\#include "Clock.H"} {public local } +decl {\#include "FL/Fl_Flowpack.H"} {private local +} + decl {\#include "New_Project_Dialog.H"} {private local } @@ -61,12 +67,6 @@ decl {\#include "Audio_Region.H" // for options} {private local decl {\#include "Control_Sequence.H" // for options} {private local } -decl {\#include "FL/Crystal_Boxtypes.H"} {private local -} - -decl {\#include "FL/Gleam_Boxtypes.H"} {private local -} - decl {\#include } {private local } @@ -91,15 +91,31 @@ decl {\#include "FL/About_Dialog.H"} {private local decl {extern char project_display_name[256];} {private global } -decl {\#include "NSM.H"} {private local +decl {\#include } {private local } -decl {extern NSM_Client *nsm;} {private global +decl {extern nsm_client_t *nsm;} {private global } decl {extern char *user_config_dir;} {private global } +class TLE_Window {open : {public Fl_Overlay_Window} +} { + Function {TLE_Window(int W, int H, const char *L = 0) : Fl_Overlay_Window( W, H, L )} {open + } { + code {} {} + } + Function {draw_overlay(void)} {open return_type void + } { + code {timeline->draw_overlay();} {} + } + Function {~TLE_Window()} {open return_type virtual + } { + code {} {} + } +} + class TLE {open } { decl {Fl_Color system_colors[3];} {private local @@ -165,18 +181,10 @@ Fl::lock(); } Function {TLE()} {open } { - code {Fl::visual( FL_DOUBLE | FL_RGB8 ); - -make_window(); + code {make_window(); Fl::visible_focus( 0 ); -get_system_colors(); - -Fl::scheme( "gtk+" ); - -color_scheme( "dark" ); - // constrain window to size of screen. { int sx, sy, sw, sh; @@ -241,69 +249,73 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {} label {Non DAW : Timeline} callback {if ( Fl::event_key() != FL_Escape ) timeline->command_quit();} open - public xywh {705 125 1025 770} type Double resizable xclass Non_DAW visible + xywh {551 117 1025 770} type Double resizable + class TLE_Window xclass Non_DAW size_range {900 300 0 0} visible } { - Fl_Menu_Bar menubar {open - private xywh {0 0 1024 25} + Fl_Group {} {open + xywh {0 0 1025 72} box FLAT_BOX } { - Submenu {} { - label {&Project} open - xywh {0 0 74 25} + Fl_Menu_Bar menubar {open + private xywh {0 0 1025 25} } { - MenuItem {} { - label {&Info} - callback {Project_Info_Dialog pi; - -pi.run();} - xywh {0 0 40 25} deactivate - } Submenu {} { - label {Se&ttings} open - xywh {20 20 74 25} + label {&Project} open + xywh {5 5 74 25} } { MenuItem {} { - label {&Follow Playhead} - callback {Timeline::follow_playhead = menu_picked_value( o );} - xywh {40 40 40 25} type Toggle value 1 - } - MenuItem {} { - label {&Center Playhead} - callback {Timeline::center_playhead = menu_picked_value( o );} - xywh {50 50 40 25} type Toggle value 1 + label {&Info} + callback {Project_Info_Dialog pi; + +pi.run();} + xywh {5 5 40 25} deactivate } Submenu {} { - label {&Snap to} open - xywh {20 20 74 25} + label {Se&ttings} open + xywh {25 25 74 25} } { MenuItem {} { - label Bars - callback {Timeline::snap_to = Timeline::Bars;} - xywh {20 20 40 25} type Radio value 1 + label {&Follow Playhead} + callback {Timeline::follow_playhead = menu_picked_value( o );} + xywh {45 45 40 25} type Toggle value 1 } MenuItem {} { - label Beats - callback {Timeline::snap_to = Timeline::Beats;} - xywh {30 30 40 25} type Radio + label {&Center Playhead} + callback {Timeline::center_playhead = menu_picked_value( o );} + xywh {55 55 40 25} type Toggle value 1 + } + Submenu {} { + label {&Snap to} open + xywh {25 25 74 25} + } { + MenuItem {} { + label Bars + callback {Timeline::snap_to = Timeline::Bars;} + xywh {25 25 40 25} type Radio value 1 + } + MenuItem {} { + label Beats + callback {Timeline::snap_to = Timeline::Beats;} + xywh {35 35 40 25} type Radio + } + MenuItem {} { + label Off + callback {Timeline::snap_to = Timeline::None;} + xywh {45 45 40 25} type Radio + } } MenuItem {} { - label Off - callback {Timeline::snap_to = Timeline::None;} - xywh {40 40 40 25} type Radio + label {Magnetic snap} + callback {Timeline::snap_magnetic = menu_picked_value( o );} + xywh {35 35 40 25} type Toggle value 1 } + Submenu {} { + label {Capture Format} open + xywh {25 25 74 25} + } {} } MenuItem {} { - label {Magnetic snap} - callback {Timeline::snap_magnetic = menu_picked_value( o );} - xywh {30 30 40 25} type Toggle value 1 - } - Submenu {} { - label {Capture Format} open - xywh {20 20 74 25} - } {} - } - MenuItem {} { - label {&New} - callback {save_timeline_settings(); + label {&New} + callback {save_timeline_settings(); const char *templates[] = { "Default", NULL }; @@ -334,11 +346,11 @@ load_timeline_settings(); update_menu(); main_window->redraw();} - xywh {0 0 40 25} - } - MenuItem {} { - label {&Open} - callback {char *path; + xywh {5 5 40 25} + } + MenuItem {} { + label {&Open} + callback {char *path; read_line( user_config_dir, "default_path", &path ); @@ -347,293 +359,256 @@ const char *name = fl_dir_chooser( "Open Project", path ); free( path ); open( name );} - xywh {10 10 40 25} - } - MenuItem {} { - label {&Compact} - callback {int n = fl_choice( "Compacting will replace the project history with a snapshot of the current state.\\nYou will not be able to use Undo to go back beyond this point.\\n\\nThis operation is irreversible!", NULL, "&Cancel", "Pr&ocede with compaction" ); + xywh {15 15 40 25} + } + MenuItem {} { + label {&Compact} + callback {int n = fl_choice( "Compacting will replace the project history with a snapshot of the current state.\\nYou will not be able to use Undo to go back beyond this point.\\n\\nThis operation is irreversible!", NULL, "&Cancel", "Pr&ocede with compaction" ); if ( n != 2 ) return; Project::compact();} - xywh {20 20 40 25} + xywh {25 25 40 25} + } + Submenu {} { + label {&Export} open + xywh {5 5 74 25} deactivate + } { + MenuItem {} { + label Project + xywh {5 5 40 25} + } + MenuItem {} { + label Range + xywh {15 15 40 25} + } + } + MenuItem {} { + label {&Quit} + callback {quit()} + xywh {45 45 40 25} shortcut 0x40071 + } } Submenu {} { - label {&Export} open - xywh {0 0 74 25} deactivate + label {&Edit} open + xywh {5 5 74 25} } { MenuItem {} { - label Project - xywh {0 0 40 25} + label Undo + callback {Loggable::undo();} + xywh {5 5 40 25} shortcut 0x4007a divider } MenuItem {} { - label Range - xywh {10 10 40 25} + label {Select None} + callback {timeline->select_none();} + xywh {15 15 40 25} shortcut 0x50061 + } + MenuItem {} { + label {Delete Selected} + callback {timeline->delete_selected();} + xywh {25 25 40 25} shortcut 0xffff } } - MenuItem {} { - label {&Quit} - callback {quit()} - xywh {40 40 40 25} shortcut 0x40071 - } - } - Submenu {} { - label {&Edit} open - xywh {0 0 74 25} - } { - MenuItem {} { - label Undo - callback {Loggable::undo();} - xywh {0 0 40 25} shortcut 0x4007a divider - } - MenuItem {} { - label {Select None} - callback {timeline->select_none();} - xywh {10 10 40 25} shortcut 0x50061 - } - MenuItem {} { - label {Delete Selected} - callback {timeline->delete_selected();} - xywh {20 20 40 25} shortcut 0xffff - } - } - Submenu {} { - label {T&ransport} open - xywh {0 0 74 25} - } { - MenuItem {} { - label Start - callback {transport->locate( 0 );} - xywh {0 0 40 25} shortcut 0xff50 - } - MenuItem {} { - label End - callback {transport->locate( timeline->length() );} - xywh {10 10 40 25} shortcut 0xff57 - } - MenuItem {} { - label {Play/Stop} - callback {transport->toggle();} - xywh {20 20 40 25} shortcut 0x20 - } - MenuItem {} { - label Record - callback {transport->toggle_record();} - xywh {40 40 40 25} shortcut 0x10072 - } - } - MenuItem {} { - label {&Timeline} - xywh {0 0 40 25} - } - Submenu {} { - label {&View} open - xywh {0 0 74 25} - } { Submenu {} { - label {&Zoom} open - xywh {0 0 74 25} + label {T&ransport} open + xywh {5 5 74 25} } { MenuItem {} { - label {&In} - callback {timeline->zoom_in();} - xywh {20 20 40 25} shortcut 0x2b + label Start + callback {transport->locate( 0 );} + xywh {5 5 40 25} shortcut 0xff50 } MenuItem {} { - label {&Out} - callback {timeline->zoom_out();} - xywh {30 30 40 25} shortcut 0x5f + label End + callback {transport->locate( timeline->length() );} + xywh {15 15 40 25} shortcut 0xff57 } MenuItem {} { - label {&Fit} - callback {timeline->zoom_fit();} - xywh {10 10 40 25} shortcut 0x3d divider + label {Play/Stop} + callback {transport->toggle();} + xywh {25 25 40 25} shortcut 0x20 } MenuItem {} { - label {1 sec.} - callback {timeline->zoom( 1 );} - xywh {10 10 40 25} shortcut 0x31 - } - MenuItem {} { - label {1 min.} - callback {timeline->zoom( 60 );} - xywh {20 20 40 25} shortcut 0x32 - } - MenuItem {} { - label {1 hour.} - callback {timeline->zoom( 60 * 60 );} - xywh {30 30 40 25} shortcut 0x33 + label Record + callback {transport->toggle_record();} + xywh {45 45 40 25} shortcut 0x10072 } } - } - Submenu {} { - label {&Options} open - xywh {0 0 74 25} divider - } { + MenuItem {} { + label {&Timeline} + xywh {5 5 40 25} + } Submenu {} { - label {&Display} open - xywh {10 10 74 25} + label {&View} open + xywh {5 5 74 25} } { Submenu {} { - label {&Timeline} open - xywh {10 10 74 25} + label {&Zoom} open + xywh {5 5 74 25} } { MenuItem {} { - label {&Measure lines} - callback {Timeline::draw_with_measure_lines = menu_picked_value( o ); + label {&In} + callback {timeline->zoom_in();} + xywh {25 25 40 25} shortcut 0x2b + } + MenuItem {} { + label {&Out} + callback {timeline->zoom_out();} + xywh {35 35 40 25} shortcut 0x5f + } + MenuItem {} { + label {&Fit} + callback {timeline->zoom_fit();} + xywh {15 15 40 25} shortcut 0x3d divider + } + MenuItem {} { + label {1 sec.} + callback {timeline->zoom( 1 );} + xywh {15 15 40 25} shortcut 0x31 + } + MenuItem {} { + label {1 min.} + callback {timeline->zoom( 60 );} + xywh {25 25 40 25} shortcut 0x32 + } + MenuItem {} { + label {1 hour.} + callback {timeline->zoom( 60 * 60 );} + xywh {35 35 40 25} shortcut 0x33 + } + } + MenuItem {} { + label {&Theme} + callback {fl_theme_chooser();} + xywh {15 15 40 24} + code0 {\#include "FL/Fl_Theme_Chooser.H"} + } + } + Submenu {} { + label {&Options} open + xywh {5 5 74 25} divider + } { + Submenu {} { + label {&Display} open + xywh {15 15 74 25} + } { + Submenu {} { + label {&Timeline} open + xywh {15 15 74 25} + } { + MenuItem {} { + label {&Measure lines} + callback {Timeline::draw_with_measure_lines = menu_picked_value( o ); timeline->redraw();} - xywh {10 10 40 25} type Toggle value 1 + xywh {15 15 40 25} type Toggle value 1 + } + } + Submenu {} { + label {&Waveform} open + xywh {15 15 74 25} + } { + MenuItem {} { + label Fill + callback {Waveform::fill = menu_picked_value( o ); + +timeline->redraw();} + xywh {25 25 40 25} type Toggle value 1 + } + MenuItem {} { + label Outline + callback {Waveform::outline = menu_picked_value( o ); + +timeline->redraw();} + xywh {45 45 40 25} type Toggle value 1 + } + MenuItem {} { + label {Vary color} + callback {Waveform::vary_color = menu_picked_value( o ); + +timeline->redraw();} + xywh {35 35 40 25} type Toggle value 1 + } + } + Submenu {} { + label {&Region} open + xywh {15 15 74 25} + } { + MenuItem {} { + label {Filled fades} + xywh {45 45 40 25} type Toggle value 1 + } + MenuItem {} { + label {Inherit track color} + callback {Audio_Region::inherit_track_color = menu_picked_value( o ); + +timeline->redraw();} + xywh {55 55 40 25} type Toggle value 1 + } + MenuItem {} { + label {Show box} + callback {Audio_Region::show_box = menu_picked_value( o ); + +timeline->redraw();} + xywh {55 55 40 25} type Toggle value 1 + } + } + Submenu {} { + label {&Control Sequence} open + xywh {15 15 74 25} + } { + MenuItem {} { + label Polygon + callback {Control_Sequence::draw_with_polygon = menu_picked_value( o ); + +timeline->redraw();} + xywh {35 35 40 25} type Toggle value 1 + } + MenuItem {} { + label Graded + callback {Control_Sequence::draw_with_gradient = menu_picked_value( o ); + +timeline->redraw();} + xywh {45 45 40 25} type Toggle value 1 + } + MenuItem {} { + label Ruled + callback {Control_Sequence::draw_with_grid = menu_picked_value( o ); + +timeline->redraw();} + xywh {55 55 40 25} type Toggle value 1 + } } } Submenu {} { - label {&Waveform} open - xywh {10 10 74 25} + label {&Behavior} open + xywh {5 5 74 25} } { - MenuItem {} { - label Fill - callback {Waveform::fill = menu_picked_value( o ); - -timeline->redraw();} - xywh {20 20 40 25} type Toggle value 1 - } - MenuItem {} { - label Outline - callback {Waveform::outline = menu_picked_value( o ); - -timeline->redraw();} - xywh {40 40 40 25} type Toggle value 1 - } - MenuItem {} { - label {Vary color} - callback {Waveform::vary_color = menu_picked_value( o ); - -timeline->redraw();} - xywh {30 30 40 25} type Toggle value 1 - } - } - Submenu {} { - label {&Region} open - xywh {10 10 74 25} - } { - MenuItem {} { - label {Filled fades} - xywh {40 40 40 25} type Toggle value 1 - } - MenuItem {} { - label {Inherit track color} - callback {Audio_Region::inherit_track_color = menu_picked_value( o ); - -timeline->redraw();} - xywh {50 50 40 25} type Toggle value 1 - } - } - Submenu {} { - label {&Control Sequence} open - xywh {10 10 74 25} - } { - MenuItem {} { - label Polygon - callback {Control_Sequence::draw_with_polygon = menu_picked_value( o ); - -timeline->redraw();} - xywh {30 30 40 25} type Toggle value 1 - } - MenuItem {} { - label Graded - callback {Control_Sequence::draw_with_gradient = menu_picked_value( o ); - -timeline->redraw();} - xywh {40 40 40 25} type Toggle value 1 - } - MenuItem {} { - label Ruled - callback {Control_Sequence::draw_with_grid = menu_picked_value( o ); - -timeline->redraw();} - xywh {50 50 40 25} type Toggle value 1 - } - } - Submenu {} { - label {&Style} open - xywh {10 10 74 25} - } { - MenuItem {} { - label Default - callback {Fl::scheme( "gtk+" );} - xywh {10 10 40 25} type Radio value 1 - } - MenuItem {} { - label Flat - callback {Fl::scheme( "gtk+" );} - xywh {20 20 40 25} type Radio - } - MenuItem {} { - label Round - callback {Fl::scheme( "plastic" );} - xywh {30 30 40 25} type Radio - } - } - Submenu {} { - label {C&olors} open - xywh {10 10 74 25} - } { - MenuItem {} { - label Dark - callback {color_scheme( "dark" );} - xywh {20 20 40 25} type Radio value 1 - } - MenuItem {} { - label {Very Dark} - callback {color_scheme( "very dark" );} - xywh {20 20 40 25} type Radio - } - MenuItem {} { - label Light - callback {color_scheme( "light" );} - xywh {30 30 40 25} type Radio - } - MenuItem {} { - label Gray - callback {color_scheme( "gray" );} - xywh {30 30 40 25} type Radio - } - MenuItem {} { - label System - callback {color_scheme( "system" );} - xywh {10 10 40 25} type Radio + Submenu {} { + label {&Transport} open + xywh {5 5 74 25} + } { + MenuItem {} { + label {Stop Disables Record} + callback {transport->stop_disables_record( ((Fl_Menu_*)o)->mvalue()->flags & FL_MENU_VALUE );} + xywh {10 10 40 25} type Toggle value 1 + } } } } Submenu {} { - label {&Behavior} open - xywh {0 0 74 25} + label {&Help} open + xywh {5 5 74 25} } { - Submenu {} { - label {&Transport} open - xywh {0 0 74 25} - } { - MenuItem {} { - label {Stop Disables Record} - callback {transport->stop_disables_record( ((Fl_Menu_*)o)->mvalue()->flags & FL_MENU_VALUE );} - xywh {5 5 40 25} type Toggle value 1 - } + MenuItem {} { + label {&Manual} + callback {show_help_dialog( "MANUAL" );} + xywh {15 15 40 25} divider } - } - } - Submenu {} { - label {&Help} open - xywh {0 0 74 25} - } { - MenuItem {} { - label {&Manual} - callback {show_help_dialog( "MANUAL" );} - xywh {10 10 40 25} divider - } - MenuItem {} { - label {&About} - callback {About_Dialog ab( PIXMAP_PATH "/non-daw/icon-256x256.png" ); + MenuItem {} { + label {&About} + callback {About_Dialog ab( PIXMAP_PATH "/non-daw/icon-256x256.png" ); ab.logo_box->label( VERSION ); @@ -646,38 +621,36 @@ timeline->redraw();} ab.run();} - xywh {0 0 40 25} + xywh {5 5 40 25} + } } } - } - Fl_Group {} {open - xywh {0 1 1025 73} - } { Fl_Pack {} {open - xywh {0 23 483 46} type HORIZONTAL + xywh {3 28 477 44} type HORIZONTAL code0 {o->spacing( 10 );} } { Fl_Box {} { label {} - xywh {5 23 189 46} color 30 + xywh {5 30 185 37} color 30 code0 {transport = o;} code1 {o->labeltype( FL_NO_LABEL );} + code2 {o->spacing( 1 );} class Transport } - Fl_Pack clocks_pack { - private xywh {195 23 288 46} type HORIZONTAL + Fl_Pack clocks_pack {open + private xywh {195 28 285 44} type HORIZONTAL code0 {o->spacing( 2 );} } { Fl_Box {} { label PLAYHEAD - private xywh {195 29 137 40} box BORDER_BOX color 40 + private xywh {196 28 137 40} box BORDER_BOX color 40 code0 {o->type( Clock::HMS );} code1 {o->run( &transport->frame );} class Clock } Fl_Box {} { label PLAYHEAD - xywh {335 29 142 40} box BORDER_BOX color 40 + xywh {335 32 137 37} box BORDER_BOX color 40 code0 {o->type( Clock::BBT );} code1 {o->run( &transport->frame );} class Clock @@ -686,79 +659,84 @@ ab.run();} } Fl_Box {} { label {} - xywh {487 27 148 42} resizable + xywh {475 32 265 40} resizable code0 {o->labeltype( FL_NO_LABEL );} } Fl_Group {} {open - xywh {745 26 280 44} + xywh {850 23 175 50} } { Fl_Box {} { label {capture:} - xywh {865 26 56 14} labelsize 10 align 24 + xywh {910 27 56 14} labelsize 10 align 24 } Fl_Box {} { label {playback:} - xywh {865 42 56 14} labelsize 10 align 24 + xywh {910 43 56 14} labelsize 10 align 24 } Fl_Box {} { label {DSP:} - xywh {865 56 56 14} labelsize 10 align 24 + xywh {910 57 56 14} labelsize 10 align 24 + } + Fl_Box {} { + label filesystem + xywh {855 28 55 18} labelsize 10 align 16 } Fl_Progress capture_buffer_progress { label {50%} - private xywh {921 26 104 14} labelsize 10 + private xywh {965 27 60 14} labelsize 10 } Fl_Progress cpu_load_progress { label {50%} - private xywh {921 56 104 14} labelsize 9 + private xywh {965 57 60 14} labelsize 9 } Fl_Progress playback_buffer_progress { label {50%} - private xywh {921 41 104 14} labelsize 10 - } - Fl_Box {} { - label {filesystem} - xywh {810 27 55 18} labelsize 10 align 16 + private xywh {965 42 60 14} labelsize 10 } Fl_Progress disk_usage_progress { label {50%} - private xywh {810 43 55 26} labelsize 10 + private xywh {855 43 55 28} labelsize 10 + code0 {o->type( FL_VERTICAL );} } } - Fl_Button solo_blinker { - label SOLO - xywh {750 30 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 74 selection_color 92 labelfont 2 labelcolor 39 deactivate - code0 {\#include "FL/Fl_Blinker.H"} - class Fl_Blinker - } - Fl_Button rec_blinker { - label REC - xywh {750 50 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 72 selection_color 88 labelfont 2 labelcolor 39 deactivate - code0 {\#include "FL/Fl_Blinker.H"} - class Fl_Blinker - } - Fl_Button sm_blinker { - label SM - xywh {695 30 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 75 selection_color 86 labelfont 2 labelcolor 39 deactivate - code0 {\#include "FL/Fl_Blinker.H"} - class Fl_Blinker - } - Fl_Button selected_blinker { - label SEL - xywh {695 50 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 13 selection_color 5 labelfont 2 labelcolor 39 deactivate - code0 {\#include "FL/Fl_Blinker.H"} - class Fl_Blinker - } - Fl_Button seek_blinker { - label SEEK - xywh {640 50 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 10 selection_color 2 labelfont 2 labelcolor 39 hide deactivate - code0 {\#include "FL/Fl_Blinker.H"} - code1 {o->interval( Fl_Blinker::FAST );} - class Fl_Blinker + Fl_Group {} {open + xywh {740 31 115 40} + } { + Fl_Button solo_blinker { + label SOLO + xywh {800 33 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 74 selection_color 92 labelfont 2 labelcolor 39 deactivate + code0 {\#include "FL/Fl_Blink_Button.H"} + class Fl_Blink_Button + } + Fl_Button rec_blinker { + label REC + xywh {800 53 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 72 selection_color 88 labelfont 2 labelcolor 39 deactivate + code0 {\#include "FL/Fl_Blink_Button.H"} + class Fl_Blink_Button + } + Fl_Button selected_blinker { + label SEL + xywh {745 53 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 13 selection_color 5 labelfont 2 labelcolor 39 deactivate + code0 {\#include "FL/Fl_Blink_Button.H"} + code1 {o->blink( false );} + class Fl_Blink_Button + } + Fl_Button seek_blinker { + label SEEK + xywh {745 33 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 10 selection_color 2 labelfont 2 labelcolor 39 deactivate + code0 {\#include "FL/Fl_Blink_Button.H"} + code1 {o->blink_interval( Fl_Blink_Button::FAST );} + class Fl_Blink_Button + } } Fl_Box stats_box { label {} - xywh {810 1 215 21} labelsize 13 labelcolor 53 align 88 + xywh {745 0 235 25} labelsize 13 labelcolor 53 align 88 + } + Fl_Button sm_blinker { + label SM + xywh {985 6 35 15} box ROUNDED_BOX down_box ROUNDED_BOX color 45 selection_color 93 labelfont 3 labelcolor 39 deactivate + class Fl_Button } } Fl_Progress progress { @@ -766,14 +744,14 @@ ab.run();} private xywh {15 394 995 41} hide } Fl_Box {} { - label {} - xywh {0 72 1024 695} box FLAT_BOX color 47 labelsize 100 resizable + label {} selected + xywh {0 75 1025 692} box FLAT_BOX color 47 labeltype NO_LABEL labelsize 100 resizable code0 {timeline = o;} class Timeline } Fl_Box project_name { label {} - private xywh {450 0 365 22} labeltype SHADOW_LABEL labelfont 2 + private xywh {440 0 305 24} labeltype SHADOW_LABEL labelfont 2 code0 {o->label( Project::name() );} } } @@ -824,11 +802,15 @@ project_name->redraw();} {} } Function {update_progress( Fl_Progress *p, char *s, float v )} {private return_type {static void} } { - code {p->value( v ); + code {if ( p->value() != v ) +{ +p->value( v ); snprintf( s, 5, "%d%%", (int)v ); -p->label( s );} {} +p->label( s ); + +}} {} } Function {update_status()} {open private } { @@ -873,7 +855,15 @@ if ( engine && engine->zombified() && ! zombie ) } solo_blinker->value( Track::soloing() ); -rec_blinker->value( transport->rolling && transport->rec_enabled() ); + +if ( transport->punch_enabled() ) + rec_blinker->value( transport->rolling && + transport->rec_enabled() && + transport->frame >= timeline->range_start() && + transport->frame <= timeline->range_end() ); +else + rec_blinker->value( transport->rolling && transport->rec_enabled() ); + sm_blinker->value( timeline->session_manager_name() != NULL ); sm_blinker->tooltip( timeline->session_manager_name() ); selected_blinker->value( timeline->nselected() ); @@ -885,7 +875,7 @@ if ( timeline->session_manager_name() != NULL ) find_item( menubar, "&Project/&Open" )->deactivate(); } -project_name->redraw();} {} +// project_name->redraw();} {} } Function {update_cb( void *v )} {open private return_type {static void} } { @@ -922,7 +912,7 @@ else if ( 0 == p ) static char pat[10]; -nsm->progress( p / 100.0f ); +nsm_send_progress( nsm, p / 100.0f ); update_progress( progress, pat, p ); progress->redraw(); @@ -943,9 +933,7 @@ Function {set_theme_dark()} {C return_type void } { code {Fl::background2( 100, 100, 100 ); Fl::background( 50, 50, 50 ); - Fl::foreground( 255, 255, 255 ); - - Fl::scheme( Fl::scheme() );} {} + Fl::foreground( 255, 255, 255 );} {} } class Project_Info_Dialog {open @@ -972,7 +960,7 @@ if ( logo_box->image() ) ((Fl_Shared_Image*)logo_box->image())->release(); logo_box->image( NULL ); }} open - private xywh {761 214 520 775} type Double modal visible + private xywh {105 612 520 775} type Double modal visible } { Fl_Value_Output {} { label {Sample Rate} @@ -1005,7 +993,7 @@ if ( logo_box->image() ) code0 {o->value( timeline->ntracks() );} } Fl_Box logo_box { - label {} selected + label {} private xywh {20 173 485 268} color 53 labelfont 1 labelsize 18 align 16 code0 {o->image( Fl_Shared_Image::get( PIXMAP_PATH "non-daw/icon-256x256.png" ) );} code1 {o->label( NULL );} diff --git a/timeline/src/Timeline.C b/timeline/src/Timeline.C index d822ff8..e7f50d0 100644 --- a/timeline/src/Timeline.C +++ b/timeline/src/Timeline.C @@ -21,6 +21,7 @@ * provides cursor overlays, scrolling, zooming, measure lines, tempo * map and just about everything else. */ +#include #include #include #include @@ -54,14 +55,14 @@ #include "OSC_Thread.H" #include "OSC/Endpoint.H" -#include "NSM.H" -extern NSM_Client *nsm; +#include +extern nsm_client_t *nsm; #ifdef USE_WIDGET_FOR_TIMELINE #define BASE Fl_Group -#define redraw_overlay() -#define BX x() -#define BY y() +#define redraw_overlay() ((Fl_Overlay_Window*)window())->redraw_overlay() +#define BX this->x() +#define BY this->y() #else #ifdef USE_SINGLEBUFFERED_TIMELINE #warning Using singlebuffered timeline window. This may cause flicker and makes the cursors invisible. @@ -83,7 +84,7 @@ bool Timeline::snap_magnetic = true; bool Timeline::follow_playhead = true; bool Timeline::center_playhead = true; -const float UPDATE_FREQ = 0.02f; +const float UPDATE_FREQ = 1.0 / 18.0f; extern const char *instance_name; extern TLE *tle; @@ -307,6 +308,8 @@ Timeline::menu_cb ( Fl_Menu_ *m ) p1 = xoffset + x_to_ts( X ); } + fix_range(); + /* FIXME: only needs to damage the location of the old cursor! */ redraw(); } @@ -319,6 +322,8 @@ Timeline::menu_cb ( Fl_Menu_ *m ) p2 = xoffset + x_to_ts( X ); } + fix_range(); + /* FIXME: only needs to damage the location of the old cursor! */ redraw(); } @@ -382,6 +387,10 @@ Timeline::menu_cb ( Fl_Menu_ *m ) redraw(); } + else if ( ! strcmp( picked, "Redraw" ) ) + { + redraw(); + } else WARNING( "programming error: Unknown menu item" ); } @@ -393,14 +402,14 @@ Timeline::ntracks ( void ) const } +Timeline::~Timeline ( ) +{ + delete osc_thread; + osc_thread = 0; +} + Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : BASE( X, Y, W, H, L ) { - - if ( ! can_do_overlay() ) - { - WARNING( "Display lacks hardware overlay visual. Playhead and selection rectangle will flicker." ); - } - Loggable::snapshot_callback( &Timeline::snapshot, this ); osc_thread = 0; @@ -436,6 +445,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : BASE( X, Y, W menu->add( "Swap P2 and playhead", FL_CTRL + FL_SHIFT + ']', 0, 0 ); menu->add( "P1 to playhead", FL_CTRL + '[', 0, 0 ); menu->add( "P2 to playhead", FL_CTRL + ']', 0, 0 ); + menu->add( "Redraw", FL_CTRL + 'l', 0, 0 ); menu_set_callback( const_cast(menu->menu()), &Timeline::menu_cb, (void*)this ); @@ -693,23 +703,18 @@ Timeline::x_to_offset ( int x ) const /** draws a single measure line */ static void -draw_measure_cb ( nframes_t frame, const BBT &bbt, void *arg ) +draw_measure_cb ( nframes_t frame, const BBT &bbt, void * ) { - Fl_Color *color = (Fl_Color*)arg; - - fl_color( FL_BLACK ); - fl_line_style( FL_DASH, 0 ); + Fl_Color c = FL_LIGHT3; if ( bbt.beat ) - ++color; - - fl_color( *color ); + c = FL_DARK1; + fl_color( fl_color_add_alpha( c, 64 ) ); + const int x = timeline->ts_to_x( frame - timeline->xoffset ) + Track::width(); - fl_line( x, 0, x, 5000 ); - - fl_line_style( FL_SOLID, 0 ); + fl_line( x, 0, x, 2000 ); } /* FIXME: wrong place for this */ @@ -854,25 +859,21 @@ done: /** maybe draw appropriate measure lines in rectangle defined by X, Y, W, and H, using color /color/ as a base */ void -Timeline::draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color ) +Timeline::draw_measure_lines ( int X, int Y, int W, int H ) { if ( ! draw_with_measure_lines ) return; - Fl_Color colors[2]; - - colors[1] = fl_color_average( FL_BLACK, color, 0.65f ); - colors[0] = fl_color_average( FL_RED, colors[1], 0.65f ); + fl_line_style( FL_SOLID, 0 ); const nframes_t start = x_to_offset( X ); const nframes_t length = x_to_ts( W ); fl_push_clip( X, Y, W, H ); - render_tempomap( start, length, draw_measure_cb, &colors ); + render_tempomap( start, length, draw_measure_cb, NULL ); fl_pop_clip(); - } void @@ -891,6 +892,7 @@ Timeline::draw_clip ( void * v, int X, int Y, int W, int H ) fl_push_clip( tl->tracks->x(), tl->rulers->y() + tl->rulers->h(), tl->tracks->w(), tl->h() - tl->rulers->h() - tl->hscroll->h() ); tl->draw_child( *tl->tracks ); + fl_pop_clip(); fl_pop_clip(); @@ -939,7 +941,7 @@ Timeline::draw ( void ) adjust_vscroll(); #ifndef USE_UNOPTIMIZED_DRAWING - if ( ( damage() & FL_DAMAGE_ALL ) || ( damage() & FL_DAMAGE_EXPOSE ) ) + if ( ( damage() & FL_DAMAGE_ALL ) ) #else #warning Optimized drawing of timeline disabled. This will waste your CPU. #endif @@ -954,6 +956,7 @@ Timeline::draw ( void ) fl_push_clip( tracks->x(), rulers->y() + rulers->h(), tracks->w(), hscroll->y() - (rulers->y() + rulers->h()) ); draw_child( *tracks ); + fl_pop_clip(); draw_child( *hscroll ); @@ -991,9 +994,12 @@ Timeline::draw ( void ) update_child( *rulers ); fl_pop_clip(); - fl_push_clip( tracks->x(), rulers->y() + rulers->h(), tracks->w(), h() - rulers->h() - hscroll->h() ); - update_child( *tracks ); - fl_pop_clip(); + if ( ! ( damage() & FL_DAMAGE_SCROLL ) ) + { + fl_push_clip( tracks->x(), rulers->y() + rulers->h(), tracks->w(), h() - rulers->h() - hscroll->h() ); + update_child( *tracks ); + fl_pop_clip(); + } update_child( *hscroll ); update_child( *vscroll ); @@ -1023,34 +1029,25 @@ Timeline::draw_cursor ( nframes_t frame, Fl_Color color, void (*symbol)(Fl_Color if ( x > tracks->x() + tracks->w() ) return; - fl_color( color ); - const int y = rulers->y() + rulers->h(); - const int h = this->h() - hscroll->h() - 1; + const int h = this->h() - rulers->h() - hscroll->h(); fl_push_clip( tracks->x() + Track::width(), y, tracks->w(), h ); - fl_line( x, y, x, h ); - - fl_color( fl_darker( color ) ); - - fl_line( x - 1, y, x - 1, h ); - - fl_color( FL_BLACK ); - - fl_line( x + 1, y, x + 1, h ); + fl_line_style( FL_SOLID, 0 ); + fl_color( color ); + fl_line( x, y, x, y + h ); fl_push_matrix(); - + fl_translate( x, y ); - fl_scale( 16, 8 ); - + fl_scale( 8, 4 ); + symbol( color ); - + fl_pop_matrix(); - + fl_pop_clip(); - } void @@ -1064,18 +1061,31 @@ void Timeline::redraw_playhead ( void ) { static nframes_t last_playhead = -1; + static int last_playhead_x = -1; - if ( last_playhead != transport->frame ) + + /* FIXME: kind of a hackish way to invoke punch stop from the UI thread... */ + + if ( transport->rolling && + transport->rec_enabled() && + transport->punch_enabled() && + transport->frame > range_end() ) + transport->stop(); + + int playhead_x = ts_to_x( transport->frame ); + + if ( last_playhead_x != playhead_x ) { redraw_overlay(); last_playhead = transport->frame; + last_playhead_x = playhead_x; if ( follow_playhead ) { if ( center_playhead && active() ) - xposition( max( 0, ts_to_x( transport->frame ) - ( ( tracks->w() - Track::width() ) >> 1 ) ) ); - else if ( ts_to_x( transport->frame ) > ts_to_x( xoffset ) + ( tracks->w() - Track::width() ) ) - xposition( ts_to_x( transport->frame ) ); + xposition( max( 0, playhead_x - ( ( tracks->w() - Track::width() ) >> 1 ) ) ); + else if ( playhead_x > ts_to_x( xoffset ) + ( tracks->w() - Track::width() ) ) + xposition( playhead_x ); } } } @@ -1095,33 +1105,27 @@ Timeline::update_cb ( void *arg ) void Timeline::draw_overlay ( void ) { + fl_push_no_clip(); draw_playhead(); if ( ! ( _selection.w && _selection.h ) ) + { + fl_pop_clip(); return; + } fl_push_clip( tracks->x() + Track::width(), rulers->y() + rulers->h(), tracks->w() - Track::width(), h() - rulers->h() - hscroll->h() ); const Rectangle &r = _selection; - fl_color( FL_BLACK ); - - fl_line_style( FL_SOLID, 2 ); - - fl_rect( r.x + 2, r.y + 2, r.w, r.h ); fl_color( FL_MAGENTA ); - fl_line_style( FL_DASH, 2 ); - fl_rect( r.x, r.y, r.w, r.h ); - - fl_line( r.x, r.y, r.x + r.w, r.y + r.h ); - - fl_line( r.x + r.w, r.y, r.x, r.y + r.h ); - fl_line_style( FL_SOLID, 0 ); + fl_rect( r.x, r.y, r.w, r.h ); fl_pop_clip(); + fl_pop_clip(); } /** select sequence widgets within rectangle /r/ */ @@ -1406,7 +1410,10 @@ Timeline::xposition ( int X ) { xoffset = x_to_ts( X ); - damage( FL_DAMAGE_SCROLL ); + int dx = ts_to_x( _old_xposition ) - ts_to_x( xoffset ); + + if ( dx ) + damage( FL_DAMAGE_SCROLL ); } /** set vertical scroll position to absolute pixel coordinate /Y/ */ @@ -1415,7 +1422,10 @@ Timeline::yposition ( int Y ) { _yposition = Y; - damage( FL_DAMAGE_SCROLL ); + int dy = _old_yposition - _yposition; + + if ( dy ) + damage( FL_DAMAGE_SCROLL ); } /** zoom in by one zoom step */ @@ -1466,38 +1476,128 @@ Timeline::add_track ( Track *track ) { DMESSAGE( "added new track to the timeline" ); - engine->lock(); + wrlock(); - osc_thread->lock(); + engine->lock(); tracks->add( track ); - osc_thread->unlock(); +// update_track_order(); engine->unlock(); + unlock(); + /* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */ redraw(); } +void +Timeline::insert_track ( Track *track, int n ) +{ + if ( n > tracks->children() || n < 0 ) + return; + + wrlock(); + + engine->lock(); + + tracks->insert( *track, n ); + + update_track_order(); + + tracks->redraw(); + + engine->unlock(); + + unlock(); + + /* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */ +// redraw(); +} + +static +bool +compare_tracks ( Track *a, Track *b ) +{ + return *a < *b; +} + +void +Timeline::apply_track_order ( void ) +{ + wrlock(); + + engine->lock(); + + std::list tl; + + for ( int i = 0; i < tracks->children(); i++ ) + tl.push_back( (Track*)tracks->child( i ) ); + + tl.sort(compare_tracks); + + Fl_Widget **a = const_cast(tracks->array()); + + int j = 0; + for ( std::list::const_iterator i = tl.begin(); + i != tl.end(); + i++, j++ ) + a[j] = *i; + + update_track_order(); + + engine->unlock(); + + unlock(); +} + +void +Timeline::update_track_order ( void ) +{ + for ( int i = 0; i < tracks->children(); i++ ) + ((Track*)tracks->child( i ))->row( i ); +} + +int +Timeline::find_track ( const Track *track ) const +{ + return tracks->find( *track ); +} + +void +Timeline::move_track_up ( Track *track ) +{ + insert_track( track, find_track( track ) - 1 ); +} + +void +Timeline::move_track_down ( Track *track ) +{ + insert_track( track, find_track( track ) + 2 ); +} + /** remove /track/ from the timeline */ void Timeline::remove_track ( Track *track ) { DMESSAGE( "removed track from the timeline" ); - engine->lock(); + wrlock(); - osc_thread->lock(); + engine->lock(); /* FIXME: what to do about track contents? */ tracks->remove( track ); - osc_thread->unlock(); + update_track_order(); engine->unlock(); + unlock(); + + /* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */ redraw(); } @@ -1535,6 +1635,8 @@ Timeline::command_load ( const char *name, const char *display_name ) Project::set_name ( display_name ? display_name : name ); + apply_track_order(); + return true; } @@ -1564,7 +1666,7 @@ Timeline::command_new ( const char *name, const char *display_name ) const char * Timeline::session_manager_name ( void ) { - return nsm->session_manager_name(); + return nsm_get_session_manager_name( nsm ); } @@ -1600,7 +1702,7 @@ Timeline::init_osc ( const char *osc_port ) /* poll so we can keep OSC handlers running in the GUI thread and avoid extra sync */ Fl::add_timeout( OSC_INTERVAL, &Timeline::check_osc, this ); - osc->signal_peer_scan_complete.connect( sigc::mem_fun( this, &Timeline::connect_osc ) ); + osc->peer_scan_complete_callback( &Timeline::handle_peer_scan_complete, this ); if ( ! osc_thread ) { @@ -1653,9 +1755,17 @@ Timeline::reply_to_finger ( lo_message msg ) VERSION, instance_name ); + osc->hello( &argv[0]->s ); + lo_address_free( reply ); } +void +Timeline::handle_peer_scan_complete ( void *o ) +{ + ((Timeline*)o)->connect_osc(); +} + void Timeline::connect_osc ( void ) { @@ -1675,16 +1785,18 @@ Timeline::connect_osc ( void ) void Timeline::discover_peers ( void ) { - if ( nsm->is_active() ) + if ( nsm_is_active( nsm ) ) { lo_message m = lo_message_new(); - lo_message_add_string( m, "/non/finger" ); - lo_message_add_string( m, osc->url() ); - - nsm->broadcast( m ); + lo_message_add( m, "sssss", + "/non/hello", + osc->url(), + APP_NAME, + VERSION, + instance_name ); - lo_message_free( m ); + nsm_send_broadcast( nsm, m ); } } @@ -1695,16 +1807,23 @@ Timeline::process_osc ( void ) { THREAD_ASSERT( OSC ); + rdlock(); + /* reconnect OSC signals */ for ( int i = tracks->children(); i-- ; ) { Track *t = (Track*)tracks->child( i ); - for ( int j = t->control->children(); j--; ) + if ( t->control ) { - Control_Sequence *c = (Control_Sequence*)t->control->child( j ); - c->process_osc(); + for ( int j = t->control->children(); j--; ) + { + Control_Sequence *c = (Control_Sequence*)t->control->child( j ); + c->process_osc(); + } } } + + unlock(); } diff --git a/timeline/src/Timeline.H b/timeline/src/Timeline.H index 51a7e2f..6c50256 100644 --- a/timeline/src/Timeline.H +++ b/timeline/src/Timeline.H @@ -55,6 +55,9 @@ class Sequence_Widget; namespace OSC { class Endpoint; } +#define USE_WIDGET_FOR_TIMELINE + + #include #ifndef USE_SINGLEBUFFERED_TIMELINE @@ -114,6 +117,7 @@ class Timeline : public Fl_Single_Window, public RWLock int _fpp; /* frames per pixel, power of two */ nframes_t p1, p2; /* cursors */ + nframes_t _playhead; /* not permitted */ Timeline ( const Timeline &rhs ); @@ -121,6 +125,12 @@ class Timeline : public Fl_Single_Window, public RWLock std::list _tempomap; + static void handle_peer_scan_complete ( void * v ); + + void update_track_order ( void ); + void apply_track_order ( void ); + void insert_track ( Track *track, int n ); + public: OSC::Endpoint *osc; @@ -157,13 +167,19 @@ public: nframes_t _sample_rate; Timeline ( int X, int Y, int W, int H, const char *L=0 ); + + virtual ~Timeline ( ); void update_tempomap ( void ); const char *session_manager_name ( void ); + nframes_t fpp ( void ) const { return 1 << _fpp; } void range ( nframes_t start, nframes_t length ); + nframes_t range_start ( void ) const { return p1; } + nframes_t range_end ( void ) const { return p2; } +// nframes_t playhead ( void ) const { return transport->frame; } nframes_t length ( void ) const; void sample_rate ( nframes_t r ) { _sample_rate = r; } nframes_t sample_rate ( void ) const { return _sample_rate; } @@ -182,8 +198,8 @@ public: typedef void (measure_line_callback)( nframes_t frame, const BBT & bbt, void *arg ); position_info solve_tempomap ( nframes_t when ) const; - void draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color ); - void draw_measure_BBT ( int X, int Y, int W, int H, Fl_Color color ); + void draw_measure_lines ( int X, int Y, int W, int H ); + void draw_measure_BBT ( int X, int Y, int W, int H ); position_info render_tempomap ( nframes_t start, nframes_t length, measure_line_callback *cb, void *arg ) const; void xposition ( int X ); @@ -210,6 +226,11 @@ public: void add_track ( Track *track ); void remove_track ( Track *track ); + void move_track_up ( Track *track ); + void move_track_down ( Track *track ); + + int find_track ( const Track * track ) const; + int ntracks ( void ) const; void zoom ( float secs ); diff --git a/timeline/src/Track.C b/timeline/src/Track.C index 04f2f29..e18144a 100644 --- a/timeline/src/Track.C +++ b/timeline/src/Track.C @@ -106,11 +106,10 @@ Track::~Track ( ) Loggable::block_end(); } -#include "FL/Crystal_Boxtypes.H" - void Track::init ( void ) { + _row = 0; _sequence = NULL; _name = NULL; _selected = false; @@ -127,7 +126,7 @@ Track::init ( void ) Fl_Group::size( timeline->w(), height() ); Track *o = this; - o->box( FL_NO_BOX ); + o->box( FL_FLAT_BOX ); { Fl_Group *o = new Fl_Group( 0, 0, 149, 70 ); @@ -151,10 +150,10 @@ Track::init ( void ) Fl_Button *o = record_button = new Fl_Button( 6, 28, 26, 24, "@circle" ); o->type( 1 ); - o->box( FL_ROUNDED_BOX ); - o->down_box( FL_ROUNDED_BOX ); - o->color( FL_LIGHT1 ); + o->box( FL_ASYM_BOX ); + o->down_box( FL_ASYM_BOX ); o->selection_color( FL_RED ); + o->color( fl_color_average( FL_GRAY, o->selection_color(), 0.80 ) ); o->labelsize( 9 ); o->callback( cb_button, this ); } @@ -162,10 +161,10 @@ Track::init ( void ) Fl_Button *o = mute_button = new Fl_Button( 35, 28, 26, 24, "m" ); o->selection_color( fl_color_average( FL_YELLOW, FL_GREEN, 0.50 ) ); + o->color( fl_color_average( FL_GRAY, o->selection_color(), 0.80 ) ); o->type( 1 ); - o->box( FL_ROUNDED_BOX ); - o->down_box( FL_ROUNDED_BOX ); - o->color( FL_LIGHT1 ); + o->box( FL_ASYM_BOX ); + o->down_box( FL_ASYM_BOX ); o->labelsize( 15 ); o->callback( cb_button, this ); } @@ -173,17 +172,17 @@ Track::init ( void ) Fl_Button *o = solo_button = new Fl_Button( 66, 28, 26, 24, "s" ); o->selection_color( fl_color_average( FL_YELLOW, FL_RED, 0.50 ) ); + o->color( fl_color_average( FL_GRAY, o->selection_color(), 0.80 ) ); o->type( 1 ); - o->box( FL_ROUNDED_BOX ); - o->down_box( FL_ROUNDED_BOX ); - o->color( FL_LIGHT1 ); + o->box( FL_ASYM_BOX ); + o->down_box( FL_ASYM_BOX ); o->labelsize( 15 ); o->callback( cb_button, this ); } { Fl_Menu_Button *o = take_menu = new Fl_Menu_Button( 97, 28, 47, 24, "T" ); - o->box( FL_THIN_UP_BOX ); + o->box( FL_UP_BOX ); o->color( FL_LIGHT1 ); o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); o->callback( cb_button, this ); @@ -205,24 +204,27 @@ Track::init ( void ) } { Fl_Pack *o = pack = new Fl_Pack( width(), 0, 1006, 115 ); + o->type( Fl_Pack::VERTICAL ); o->labeltype( FL_NO_LABEL ); o->resize( x() + width(), y(), w() - width(), h() ); resizable( o ); { -// Fl_Pack *o = annotation = new Fl_Pack( width(), 0, pack->w(), 0 ); Fl_Pack *o = annotation = new Fl_Pack( width(), 0, pack->w(), 1 ); + o->type( Fl_Pack::VERTICAL ); o->end(); } { - Fl_Pack *o = control = new Fl_Pack( width(), 0, pack->w(), 0 ); + Fl_Pack *o = control = new Fl_Pack( width(), 0, pack->w(), 1 ); + o->type( Fl_Pack::VERTICAL ); o->end(); } { - Fl_Pack *o = takes = new Fl_Pack( width(), 0, pack->w(), 0 ); + Fl_Pack *o = takes = new Fl_Pack( width(), 0, pack->w(), 1 ); + o->type( Fl_Pack::VERTICAL ); o->end(); o->hide(); } @@ -247,7 +249,7 @@ Track::set ( Log_Entry &e ) if ( ! strcmp( s, ":height" ) ) { size( atoi( v ) ); - resize(); + adjust_size(); } else if ( ! strcmp( s, ":selected" ) ) _selected = atoi( v ); @@ -293,7 +295,8 @@ Track::set ( Log_Entry &e ) } } - + else if ( ! strcmp( s, ":row" ) ) + row( atoi( v ) ); } } @@ -316,6 +319,19 @@ Track::get_unjournaled ( Log_Entry &e ) const e.add( ":armed", armed() ); e.add( ":mute", mute() ); e.add( ":solo", solo() ); + e.add( ":row", timeline->find_track( this ) ); +} + +int +Track::row ( void ) const +{ + return _row; +} + +void +Track::row ( int n ) +{ + _row = n; } void @@ -443,7 +459,7 @@ static int pack_visible( Fl_Pack *p ) /* adjust size of widget and children */ void -Track::resize ( void ) +Track::adjust_size ( void ) { for ( int i = takes->children(); i--; ) takes->child( i )->size( w(), height() ); @@ -495,7 +511,7 @@ Track::size ( int v ) _size = v; - resize(); + adjust_size(); } void @@ -557,7 +573,7 @@ Track::remove ( Audio_Sequence *t ) timeline->unlock(); - resize(); + adjust_size(); update_take_menu(); } @@ -570,7 +586,7 @@ Track::remove ( Annotation_Sequence *t ) annotation->remove( t ); - resize(); + adjust_size(); } void @@ -579,17 +595,17 @@ Track::remove ( Control_Sequence *t ) if ( ! control ) return; - engine->lock(); + timeline->wrlock(); - timeline->osc_thread->lock(); + engine->lock(); control->remove( t ); - timeline->osc_thread->unlock(); - engine->unlock(); - resize(); + timeline->unlock(); + + adjust_size(); } void @@ -608,7 +624,7 @@ Track::sequence ( Audio_Sequence * t ) update_take_menu(); - resize(); + adjust_size(); } void @@ -621,10 +637,12 @@ Track::add ( Control_Sequence *t ) t->track( this ); control->add( t ); + + t->color( color() ); engine->unlock(); - resize(); + adjust_size(); } void @@ -636,7 +654,7 @@ Track::add ( Annotation_Sequence *t ) annotation->add( t ); - resize(); + adjust_size(); } /** add all widget on this track falling within the given rectangle to @@ -777,6 +795,14 @@ Track::menu_cb ( const Fl_Menu_ *m ) { ((Fl_Sometimes_Input*)name_field)->take_focus(); } + else if ( ! strcmp( picked, "/Move Up" ) ) + { + timeline->move_track_up( this ); + } + else if ( ! strcmp( picked, "/Move Down" ) ) + { + timeline->move_track_down( this ); + } } #include "FL/menu_popup.H" @@ -813,6 +839,8 @@ Track::menu ( void ) const { "Mute", FL_CTRL + 'm', 0, 0, FL_MENU_TOGGLE | ( mute() ? FL_MENU_VALUE : 0 ) }, { "Solo", FL_CTRL + 's', 0, 0, FL_MENU_TOGGLE | ( solo() ? FL_MENU_VALUE : 0 ) }, { 0 }, + { "Move Up", FL_SHIFT + '1', 0, 0 }, + { "Move Down", FL_SHIFT + '2', 0, 0 }, { "Remove", 0, 0, 0 }, // transport->rolling ? FL_MENU_INACTIVE : 0 }, { 0 }, }; @@ -830,6 +858,12 @@ Track::menu ( void ) const void Track::draw ( void ) { + int X, Y, W, H; + + fl_push_clip( x(), y(), w(), h() ); + + fl_clip_box( x(), y(), w(), h(), X, Y, W, H ); + if ( _selected ) { Fl_Color c = color(); @@ -842,6 +876,8 @@ Track::draw ( void ) } else Fl_Group::draw(); + + fl_pop_clip(); } int @@ -870,7 +906,7 @@ Track::handle ( int m ) Logger log( this ); if ( ! Fl::event_shift() ) - return 0; + return Fl_Group::handle( m ); int d = Fl::event_dy(); diff --git a/timeline/src/Track.H b/timeline/src/Track.H index 5982b4f..523165f 100644 --- a/timeline/src/Track.H +++ b/timeline/src/Track.H @@ -72,11 +72,22 @@ public: { Audio_File *audio_file; Audio_Region *region; + + Capture ( ) + { + region = 0; + audio_file = 0; + } }; Fl_Color color ( void ) const { return child(0)->color(); } void color ( Fl_Color c ) { child(0)->color( c ); } + bool operator< ( const Track &rhs ) const + { + return _row < rhs._row; + } + private: static int _soloing; @@ -89,6 +100,8 @@ private: int _size; + int _row; + enum { AUDIO } _type; Audio_Sequence *_sequence; @@ -150,7 +163,7 @@ public: int ncontrols ( void ) { return control->children(); } - void resize ( void ); + void adjust_size ( void ); void size ( int v ); int height ( void ) const @@ -163,7 +176,7 @@ public: void show_all_takes ( bool b ) { _show_all_takes = b; - resize(); + adjust_size(); } void name ( const char *name ) @@ -190,6 +203,8 @@ public: bool selected ( void ) const { return _selected; } + int row ( void ) const; + void row ( int ); static void cb_input_field ( Fl_Widget *w, void *v ); void cb_input_field ( void ); @@ -213,6 +228,7 @@ public: /* Engine */ const Audio_Region *capture_region ( void ) const; + Capture *capture ( void ); void resize_buffers ( nframes_t nframes ); nframes_t process_input ( nframes_t nframes ); diff --git a/timeline/src/Transport.C b/timeline/src/Transport.C index d578aa5..7490271 100644 --- a/timeline/src/Transport.C +++ b/timeline/src/Transport.C @@ -20,6 +20,7 @@ /* Controls the audio transport */ #include "Transport.H" +#include "Timeline.H" #include "Engine/Engine.H" @@ -44,7 +45,7 @@ Transport::Transport ( int X, int Y, int W, int H, const char *L ) frame_rate = 48000; frame = 0; - const int bw = W / 3; + const int bw = W / 5; type( HORIZONTAL ); @@ -76,6 +77,16 @@ Transport::Transport ( int X, int Y, int W, int H, const char *L ) o->when( FL_WHEN_CHANGED ); o->box( FL_UP_BOX ); + _punch_button = o = new Fl_Button( 0, 0, bw, 0, "Punch" ); + o->type( FL_TOGGLE_BUTTON ); + o->labelsize( 9 ); + o->labeltype( FL_NORMAL_LABEL ); + o->shortcut( 'P' ); + o->callback( cb_button, this ); + o->when( FL_WHEN_CHANGED ); + o->color2( FL_GREEN ); + o->box( FL_UP_BOX ); + end(); } @@ -146,6 +157,12 @@ Transport::rec_enabled ( void ) const return _record_button->value(); } +bool +Transport::punch_enabled ( void ) const +{ + return _punch_button->value(); +} + int Transport::handle ( int m ) { diff --git a/timeline/src/Transport.H b/timeline/src/Transport.H index 563fa2d..d653ac1 100644 --- a/timeline/src/Transport.H +++ b/timeline/src/Transport.H @@ -23,14 +23,12 @@ #include #include "types.h" -#include "Timeline.H" - #include #include #include -struct Transport : public jack_position_t, public Fl_Pack +class Transport : public jack_position_t, public Fl_Pack { private: @@ -48,6 +46,7 @@ private: Fl_Button *_end_button; Fl_Button *_play_button; Fl_Button *_record_button; + Fl_Button *_punch_button; void update_record_state ( void ); @@ -56,6 +55,7 @@ public: Transport ( int X, int Y, int W, int H, const char *L=0 ); bool rec_enabled ( void ) const; + bool punch_enabled ( void ) const; void stop_disables_record ( bool b ) { _stop_disables_record = b; } bool stop_disables_record ( void ) const { return _stop_disables_record; } diff --git a/timeline/src/Waveform.C b/timeline/src/Waveform.C index 402924f..5a683e9 100644 --- a/timeline/src/Waveform.C +++ b/timeline/src/Waveform.C @@ -19,8 +19,8 @@ /* routines to draw a waveform from peak data */ +#include #include - #include "Waveform.H" #include @@ -63,45 +63,70 @@ Waveform::draw ( int X, int Y, int W, int H, const int halfheight = H / 2; const int mid = Y + halfheight; + const int ty = Y + halfheight; W = min( peaks, W ); + if ( ! W ) + return; + if ( Waveform::fill ) { - j = start; - for ( int x = X; x < X + W; ++x, j += skip ) + if ( Waveform::vary_color ) { - const Peak p = pbuf[ j ]; + j = start; + for ( int x = X; x < X + W; ++x, j += skip ) + { + const Peak p = pbuf[ j ]; - const float diff = fabs( p.max - p.min ); - - if ( diff > 2.0f ) - fl_color( FL_RED ); - else - if ( Waveform::vary_color ) - fl_color( fl_color_average( FL_WHITE, color, diff * 0.5f ) ); + const float diff = fabs( p.max - p.min ); + + if ( diff > 2.0f ) + fl_color( FL_RED ); else - fl_color( color ); + if ( Waveform::vary_color ) + fl_color( fl_color_average( FL_WHITE, color, diff * 0.5f ) ); + else + fl_color( color ); - const int ty = mid - ( halfheight * p.min ); - const int by = mid - ( halfheight * p.max ); - fl_line( x, ty, x, by ); + const int ty = mid - ( halfheight * p.min ); + const int by = mid - ( halfheight * p.max ); + fl_line( x, ty, x, by ); + } + } + else + { + fl_color( color ); + + fl_begin_complex_polygon(); + + j = start; + + for ( int x = X; x <= X + W; x++, j += skip ) + fl_vertex( x, ty - ( halfheight * pbuf[ j ].min ) ); + + j -= skip; + + for ( int x = X + W; x >= X; x--, j -= skip ) + fl_vertex( x, ty - ( halfheight * pbuf[ j ].max ) ); + + fl_end_complex_polygon(); } } - const int ty = Y + halfheight; - if ( Waveform::outline ) { fl_color( fl_darker( fl_darker( color ) ) ); - fl_line_style( FL_SOLID | FL_CAP_FLAT, 2 ); + fl_line_style( FL_SOLID, 0 ); fl_begin_line(); + unsigned long end = start + W; + j = start; - for ( int x = X; x < X + W; ++x, j += skip ) + for ( int x = X; x < X + W; x++, j += skip ) fl_vertex( x, ty - ( halfheight * pbuf[ j ].min ) ); fl_end_line(); @@ -110,7 +135,7 @@ Waveform::draw ( int X, int Y, int W, int H, j = start; - for ( int x = X; x < X + W; ++x, j += skip ) + for ( int x = X; x < X + W; x++, j += skip ) fl_vertex( x, ty - ( halfheight * pbuf[ j ].max ) ); fl_end_line(); diff --git a/timeline/src/main.C b/timeline/src/main.C index 2a4bbbe..00d4868 100644 --- a/timeline/src/main.C +++ b/timeline/src/main.C @@ -42,8 +42,8 @@ #include "TLE.H" #include "Timeline.H" -#include "FL/Crystal_Boxtypes.H" -#include "FL/Gleam_Boxtypes.H" +#include "FL/themes.H" +#include "FL/Fl_Theme.H" #include "Project.H" #include "Transport.H" @@ -51,7 +51,9 @@ #include "Thread.H" -#include "NSM.H" +#include + +extern void set_nsm_callbacks ( nsm_client_t *nsm ); #ifdef HAVE_XPM #include "FL/Fl.H" @@ -64,7 +66,7 @@ Engine *engine; Timeline *timeline; Transport *transport; TLE *tle; -NSM_Client *nsm; +nsm_client_t *nsm; char *instance_name = NULL; @@ -118,7 +120,7 @@ extern Timeline *timeline; void check_nsm ( void * v ) { - nsm->check(); + nsm_check_nowait( nsm ); Fl::repeat_timeout( NSM_CHECK_INTERVAL, check_nsm, v ); } @@ -145,6 +147,14 @@ int main ( int argc, char **argv ) { + printf( "%s %s -- %s\n", APP_TITLE, VERSION, COPYRIGHT ); + + if ( ! Fl::visual( FL_DOUBLE | FL_RGB ) ) + { + WARNING( "Xdbe not supported, FLTK will fake double buffering." ); + } + + #ifdef HAVE_XPM fl_open_display(); Pixmap p, mask; @@ -153,8 +163,6 @@ main ( int argc, char **argv ) (char**)icon_16x16, &p, &mask, NULL); #endif - Fl::visual(FL_RGB8); - Thread::init(); Thread thread( "UI" ); @@ -178,17 +186,11 @@ main ( int argc, char **argv ) LOG_REGISTER_CREATE( Time_Point ); LOG_REGISTER_CREATE( Track ); - init_crystal_boxtypes(); - init_gleam_boxtypes(); - signal( SIGPIPE, SIG_IGN ); if ( ! ensure_dirs() ) FATAL( "Cannot create required directories" ); - printf( "%s %s -- %s\n", APP_TITLE, VERSION, COPYRIGHT ); - - instance_name = strdup( APP_NAME ); bool instance_override = false; @@ -234,7 +236,8 @@ main ( int argc, char **argv ) tle = new TLE; - nsm = new NSM_Client; + nsm = nsm_new(); + set_nsm_callbacks( nsm ); MESSAGE( "Starting GUI" ); @@ -246,12 +249,16 @@ main ( int argc, char **argv ) tle->main_window->icon((char *)p); #endif tle->main_window->show( 0, NULL ); + + fl_register_themes(); + + Fl_Theme::set(); char *nsm_url = getenv( "NSM_URL" ); if ( nsm_url ) { - if ( ! nsm->init( nsm_url ) ) + if ( ! nsm_init( nsm, nsm_url ) ) { if ( instance_override ) WARNING( "--instance option is not available when running under session management, ignoring." ); @@ -259,7 +266,7 @@ main ( int argc, char **argv ) if ( optind < argc ) WARNING( "Loading files from the command-line is incompatible with session management, ignoring." ); - nsm->announce( APP_NAME, ":progress:switch:", argv[0] ); + nsm_send_announce( nsm, APP_NAME, ":progress:switch:", argv[0] ); /* poll so we can keep OSC handlers running in the GUI thread and avoid extra sync */ Fl::add_timeout( NSM_CHECK_INTERVAL, check_nsm, NULL ); @@ -293,7 +300,7 @@ main ( int argc, char **argv ) delete tle; tle = NULL; - delete nsm; + nsm_free( nsm ); nsm = NULL; MESSAGE( "Your fun is over" );
     /nsm/client/message i:priority s:message