1
//=========================================================
4
// $Id: rhythm.h,v 1.1 2002/02/27 11:52:59 muse Exp $
6
// (C) Copyright 2001 Werner Schweer (ws@seh.de)
8
// This code is an adaption of the random rhythm generator taken
9
// from "The JAZZ++ Midi Sequencer"
10
// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all
12
// Distributed under the GNU General Public License
13
//=========================================================
18
#include "rhythmbase.h"
31
//---------------------------------------------------------
33
//---------------------------------------------------------
43
// void write(int, Xml&);
47
//---------------------------------------------------------
49
//---------------------------------------------------------
52
tRhyGroup g[MAX_GROUPS];
53
tRhyGroup& operator [] (int i) { return g[i]; }
55
// void write(int, Xml&);
59
//---------------------------------------------------------
61
//---------------------------------------------------------
65
friend class tRhythmWin;
89
// void GenGroup(tRndArray& out, int grp, tBarInfo &bi, tRhythm *rhy[], int n_rhy);
90
int Clock2i(long clock, tBarInfo &bi) const;
91
int ClocksPerStep(tBarInfo &bi) const;
95
tRhythm(const tRhythm &o);
96
tRhythm & operator= (const tRhythm &o);
99
char const * GetLabel() { return label; }
100
void SetLabel(char const *);
102
void Generate(tTrack *track, long fr_clock, long to_clock, long ticks_per_bar);
103
void Generate(tTrack *track, tBarInfo &bi, tRhythm *rhy[], int n_rhy);
104
void GenInit(long start_clock);
105
void GenerateEvent(tTrack *track, long clock, short vel, short len);
107
void write(int, Xml&);
112
//---------------------------------------------------------
114
//---------------------------------------------------------
116
class RhythmGen : public RhythmBase
122
wxSlider *steps_per_count;
123
wxSlider *count_per_bar;
125
wxListBox *instrument_list;
126
wxCheckBox *rand_checkbox;
128
wxPanel *group_panel;
129
wxListBox *group_list;
130
wxSlider *group_contrib;
131
wxSlider *group_listen;
134
tArrayEdit *length_edit;
135
tArrayEdit *veloc_edit;
136
tRhyArrayEdit *rhythm_edit;
138
enum { MAX_INSTRUMENTS = 20 };
139
tRhythm *instruments[MAX_INSTRUMENTS];
141
int act_instrument; // -1 if none
143
// this one is edited and copied from/to instruments[i]
146
// ignore Updates while creating the window (motif)
150
static void ItemCallback(wxItem& item, wxCommandEvent& event);
151
static void SelectInstr(wxListBox& list, wxCommandEvent& event);
152
static void SelectGroup(wxListBox& list, wxCommandEvent& event);
153
static void Add(wxButton &but, wxCommandEvent& event);
154
static void Del(wxButton &but, wxCommandEvent& event);
155
static void Generate(wxButton &but, wxCommandEvent& event);
158
void Instrument2Win(int i = -1); // instrument[act_instrument] -> win
159
void Win2Instrument(int i = -1); // win -> instrument[act_instrument]
160
void AddInstrumentDlg();
161
void AddInstrument(tRhythm *r);
162
void DelInstrument();
164
tEventWin *event_win;
169
char *default_filename;
172
float tb_width, tb_height;
175
void DownInstrument();
176
void InitInstrumentList();
178
virtual void closeEvent(QCloseEvent*);
184
// virtual void OnMenuCommand(int id);
185
// virtual void OnSize(int w, int h);
186
RhythmGen(QWidget* parent = 0, const char* name = 0, WFlags fo = WType_TopLevel);
187
virtual ~RhythmGen();