2007-12-18 05:09:02 +01:00
|
|
|
|
|
|
|
/*******************************************************************************/
|
|
|
|
/* 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"
|
2012-04-28 03:31:06 +02:00
|
|
|
#include "common.h"
|
2007-12-18 05:09:02 +01:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
using std::vector;
|
|
|
|
|
|
|
|
class pattern : public Grid
|
|
|
|
{
|
|
|
|
static event_list _recorded_events;
|
|
|
|
static vector <pattern *> _patterns;
|
|
|
|
static int _solo;
|
|
|
|
static int _pattern_recording;
|
|
|
|
|
2012-03-01 05:46:57 +01:00
|
|
|
|
2007-12-18 05:09:02 +01:00
|
|
|
static int solo ( void );
|
|
|
|
|
|
|
|
int _channel, _port;
|
|
|
|
|
|
|
|
bool _recording;
|
|
|
|
mutable volatile bool _cleared;
|
|
|
|
|
2012-02-29 10:02:48 +01:00
|
|
|
mutable volatile int _queued;
|
2007-12-18 05:09:02 +01:00
|
|
|
|
|
|
|
// int _key;
|
|
|
|
|
|
|
|
int _note;
|
|
|
|
|
|
|
|
void _add ( void );
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2012-03-01 05:46:57 +01:00
|
|
|
static int note_shape;
|
|
|
|
|
|
|
|
int draw_shape ( void ) const { return pattern::note_shape; }
|
|
|
|
|
2007-12-18 05:09:02 +01:00
|
|
|
static signal <void> 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 );
|
2012-02-28 04:43:49 +01:00
|
|
|
void trigger ( void );
|
2007-12-18 05:09:02 +01:00
|
|
|
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 );
|
|
|
|
|
2012-02-29 10:02:48 +01:00
|
|
|
void queue ( int mode );
|
|
|
|
int queue ( void ) const;
|
2007-12-18 05:09:02 +01:00
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
};
|