1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: rhythm.h,v 1.1.1.1 2003/10/27 18:52:44 wschweer Exp $
//
// (C) Copyright 2001 Werner Schweer (ws@seh.de)
//
// This code is an adaption of the random rhythm generator taken
// from "The JAZZ++ Midi Sequencer"
// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all
// rights reserved.
// Distributed under the GNU General Public License
//=========================================================
#ifndef __RHYTHM_H__
#define __RHYTHM_H__
#include "ui_rhythmbase.h"
#include <QMainWindow>
class QCloseEvent;
class tTrack;
class tEventWin;
class tSong;
class tBarInfo;
#define MAX_GROUPS 5
#define MAX_KEYS 20
class Xml;
#if 0
//---------------------------------------------------------
// tRhyGroup
//---------------------------------------------------------
struct tRhyGroup {
int contrib;
int listen;
tRhyGroup() {
listen = 0;
contrib = 0;
}
// void write(int, Xml&);
// void read(Xml&);
};
//---------------------------------------------------------
// tRhyGroups
//---------------------------------------------------------
struct tRhyGroups {
tRhyGroup g[MAX_GROUPS];
tRhyGroup& operator [] (int i) { return g[i]; }
// void write(int, Xml&);
// void read(Xml&);
};
//---------------------------------------------------------
// tRhythm
//---------------------------------------------------------
class tRhythm
{
friend class tRhythmWin;
char* label;
// tRndArray rhythm;
// tRndArray length;
// tRndArray veloc;
int steps_per_count;
int count_per_bar;
int n_bars;
int keys[MAX_KEYS];
int n_keys;
int mode;
int parm;
int randomize;
tRhyGroups groups;
// tRndArray history;
// set by GenInit()
long start_clock;
long next_clock;
// void GenGroup(tRndArray& out, int grp, tBarInfo &bi, tRhythm *rhy[], int n_rhy);
int Clock2i(long clock, tBarInfo &bi) const;
int ClocksPerStep(tBarInfo &bi) const;
public:
tRhythm(int key);
tRhythm(const tRhythm &o);
tRhythm & operator= (const tRhythm &o);
virtual ~tRhythm();
char const * GetLabel() { return label; }
void SetLabel(char const *);
void Generate(tTrack *track, long fr_clock, long to_clock, long ticks_per_bar);
void Generate(tTrack *track, tBarInfo &bi, tRhythm *rhy[], int n_rhy);
void GenInit(long start_clock);
void GenerateEvent(tTrack *track, long clock, short vel, short len);
void write(int, Xml&);
void read(Xml&);
};
#endif
//---------------------------------------------------------
// RhythmGen
//---------------------------------------------------------
class RhythmGen : public QMainWindow, public Ui::RhythmBase
{
Q_OBJECT
#if 0
wxPanel *inst_panel;
wxText *label;
wxSlider *steps_per_count;
wxSlider *count_per_bar;
wxSlider *n_bars;
wxListBox *instrument_list;
wxCheckBox *rand_checkbox;
wxPanel *group_panel;
wxListBox *group_list;
wxSlider *group_contrib;
wxSlider *group_listen;
int act_group;
tArrayEdit *length_edit;
tArrayEdit *veloc_edit;
tRhyArrayEdit *rhythm_edit;
enum { MAX_INSTRUMENTS = 20 };
tRhythm *instruments[MAX_INSTRUMENTS];
int n_instruments;
int act_instrument; // -1 if none
// this one is edited and copied from/to instruments[i]
tRhythm edit;
// ignore Updates while creating the window (motif)
Bool in_create;
// callbacks
static void ItemCallback(wxItem& item, wxCommandEvent& event);
static void SelectInstr(wxListBox& list, wxCommandEvent& event);
static void SelectGroup(wxListBox& list, wxCommandEvent& event);
static void Add(wxButton &but, wxCommandEvent& event);
static void Del(wxButton &but, wxCommandEvent& event);
static void Generate(wxButton &but, wxCommandEvent& event);
static void Help();
void Instrument2Win(int i = -1); // instrument[act_instrument] -> win
void Win2Instrument(int i = -1); // win -> instrument[act_instrument]
void AddInstrumentDlg();
void AddInstrument(tRhythm *r);
void DelInstrument();
tEventWin *event_win;
tSong *song;
void RndEnable();
char *default_filename;
int has_changed;
wxToolBar *tool_bar;
float tb_width, tb_height;
void UpInstrument();
void DownInstrument();
void InitInstrumentList();
#endif
virtual void closeEvent(QCloseEvent*);
signals:
void hideWindow();
public:
// virtual void OnMenuCommand(int id);
// virtual void OnSize(int w, int h);
RhythmGen(QWidget* parent = 0, Qt::WFlags fo = Qt::Window);
virtual ~RhythmGen();
// void OnPaint();
// void GenRhythm();
// bool OnClose();
};
#endif
|