00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef SONG_H
00026 #define SONG_H
00027
00028
00029 #include <string>
00030 using std::string;
00031
00032 #include <vector>
00033 using std::vector;
00034
00035 #include "Object.h"
00036 #include "Sample.h"
00037 #include "LocalFileMng.h"
00038
00039
00040 class Note;
00041 class Instrument;
00042 class Sequence;
00043 class Pattern;
00044 class Song;
00045
00046 #define LIVE_MODE 1
00047 #define SONG_MODE 2
00048
00049
00053 class SequenceList : public Object {
00054 private:
00055 vector<Sequence*> list;
00056 public:
00057 virtual string getClassName() { return "SequenceList"; }
00058
00059 SequenceList();
00060 ~SequenceList();
00061
00062 void add(Sequence* newSequence);
00063 Sequence* get(unsigned int pos);
00064 unsigned int getSize();
00065
00066 SequenceList* copy();
00067 };
00068
00069
00070
00071
00072
00076 class PatternList : public Object {
00077 private:
00078 vector<Pattern*> list;
00079
00080 public:
00081 virtual string getClassName() { return "PatternList"; }
00082
00083 PatternList();
00084 ~PatternList();
00085
00086 void add(Pattern* newPattern);
00087 Pattern* get(unsigned int pos);
00088 unsigned int getSize();
00089 void clear();
00090
00091 void replace( Pattern* newPattern, unsigned int pos );
00092
00093 void del(Pattern *pattern);
00094 void del(uint index);
00095 };
00096
00097
00098
00099
00100
00104 class InstrumentList : public Object {
00105 private:
00106 vector<Instrument*> list;
00107 public:
00108 virtual string getClassName() { return "InstrumentList"; }
00109
00110 InstrumentList();
00111 ~InstrumentList();
00112
00113 void add(Instrument* newPattern);
00114 Instrument* get(unsigned int pos);
00115 unsigned int getSize();
00116 void replaceSample(Instrument* newInstrument, int pos);
00117
00118 };
00119
00120
00121
00122
00123
00124
00128 class Note : public Object{
00129 private:
00131 unsigned int position;
00132
00134 float velocity;
00135
00137 float pan_L;
00138
00140 float pan_R;
00141
00142 Instrument* instrument;
00143
00145 uint humanizeDelay;
00146
00147 public:
00148 virtual string getClassName() { return "Note"; }
00149
00151 Note(unsigned int position,
00152 float velocity,
00153 float pan_L,
00154 float pan_R
00155 );
00156
00158 ~Note();
00159
00160 unsigned int getPosition(){ return position; }
00161 void setPosition(unsigned int pos) { this->position = pos; }
00162
00163 float getPan_L(){ return pan_L; }
00164 void setPan_L( float val );
00165
00166 float getPan_R(){ return pan_R; }
00167 void setPan_R( float val );
00168
00169 unsigned int samplePosition;
00170
00171 void setInstrument(Instrument* instrument);
00172 Instrument* getInstrument();
00173
00174 Note* copy();
00175
00176 float getVelocity(){ return velocity; }
00177 void setVelocity( float val );
00178
00179 uint getHumanizeDelay() { return humanizeDelay; }
00180 void setHumanizeDelay( uint val ) { humanizeDelay = val; }
00181 };
00182
00183
00184
00185
00189 class Instrument : public Object{
00190 public:
00191 virtual string getClassName() { return "Instrument"; }
00192
00194 Instrument( string id, string name, string author, int type, float volume );
00195
00197 ~Instrument();
00198
00200 float getVolume(){ return volume; }
00201 void setVolume(float volume);
00202
00203 void setId(string id) { this->id = id; }
00204 string getId(){ return id; }
00205
00206 string getName(){ return name; }
00207 void setName(string name) { this->name = name; }
00208
00209 string getAuthor(){ return author; }
00210
00211 void setSample(Sample *newSample){ sample = newSample; }
00212 Sample* getSample(){ return sample; }
00213
00214 bool isMuted() { return muted; }
00215 void setMuted(bool muted) { this->muted = muted; }
00216
00217 static Instrument* load(string filename);
00218
00220 void save(string filename);
00221
00222 void setPeak_L( float p ) { this->peak_L = p; }
00223 float getPeak_L() { return peak_L; }
00224
00225 void setPeak_R(float p) { this->peak_R = p; }
00226 float getPeak_R() { return peak_R; }
00227
00228 float getPan_L(){ return pan_L; }
00229 void setPan_L( float val );
00230
00231 float getPan_R(){ return pan_R; }
00232 void setPan_R( float val );
00233
00234 float getDelayLevel(){ return delayLevel; }
00235 void setDelayLevel( float value ) { this->delayLevel = value; }
00236
00237 void setDrumkitName( string drumkitName ) { this->drumkitName = drumkitName; }
00238 string getDrumkitName() { return drumkitName; }
00239
00240
00241 vector<Instrument*> getExcludeVect() { return excludeVect; }
00242
00244 vector<Instrument*> excludeVect;
00245
00246 private:
00248 string id;
00249
00251 float volume;
00252
00254 string name;
00255
00257 string author;
00258
00259 Sample *sample;
00260
00261 bool muted;
00262
00264 float peak_L;
00265
00267 float peak_R;
00268
00270 float pan_L;
00271
00273 float pan_R;
00274
00276 float delayLevel;
00277
00279 string drumkitName;
00280
00281 };
00282
00283
00284
00285
00286
00287
00291 class Sequence : public Object{
00292 public:
00293 Note* noteList[MAX_NOTES];
00294
00295 virtual string getClassName() { return "Sequence"; }
00296
00298 Sequence(string name);
00299
00301 ~Sequence();
00302
00303 string getName(){ return name; }
00304 void setName(string newName){ name = newName; }
00305
00306 Sequence* copy();
00307
00308 private:
00309 string name;
00310 };
00311
00312
00313
00314
00315
00316
00320 class Pattern : public Object
00321 {
00322 public:
00323 virtual string getClassName() { return "Pattern"; }
00324
00326 Pattern(string name);
00327
00329 ~Pattern();
00330
00331 void setName(string name);
00332 string getName();
00333
00334 SequenceList* getSequenceList(){ return sequenceList; }
00335 void setSequenceList( SequenceList *vett ){ sequenceList = vett; }
00336
00337 static Pattern* getEmptyPattern();
00338 Pattern* copy();
00339
00340 uint getPatternSize() { return patternSize; }
00341 private:
00342 string name;
00343 uint patternSize;
00344 SequenceList *sequenceList;
00345
00346 };
00347
00348
00349
00350
00351
00352
00353
00357 class Song : public Object{
00358 public:
00359 virtual string getClassName() { return "Song"; }
00360
00362 Song(string id, string name, string author, unsigned int bpm, float volume);
00363
00365 ~Song();
00366
00367 string getId(){ return id; }
00368
00369 unsigned int getBpm(){ return bpm; }
00370 void setBpm(unsigned int bpm);
00371
00372 void setVolume(float volume) { this->volume = volume; }
00373 float getVolume() { return volume; }
00374
00375 void setMetronomeVolume(float volume) { this->metronomeVolume = volume; }
00376 float getMetronomeVolume() { return metronomeVolume; }
00377
00378 unsigned int getResolution(){ return resolution; }
00379
00380 string getName(){ return name; }
00381 void setName(string name) { this->name = name; }
00382
00383 void setAuthor(string author) { this->author = author; }
00384 string getAuthor(){ return author; }
00385
00386 PatternList* getPatternList(){ return patternList; }
00387 void setPatternList( PatternList *vett ){ patternList = vett; }
00388
00389 PatternList* getPatternSequence(){ return patternSequence; }
00390 void setPatternSequence( PatternList *vett ){ patternSequence = vett; }
00391
00392 static Song* load(string filename);
00393 void save(string filename);
00394
00395 InstrumentList* getInstrumentList(){ return instrumentList; }
00396 void setInstrumentList( InstrumentList *vett ){ instrumentList = vett; }
00397
00399 unsigned int estimateSongSize();
00400
00401 static Song* getEmptySong();
00402
00403 void setNotes(string newNotes) { notes = newNotes; }
00404 string getNotes() { return notes; }
00405
00406 string getFilename() { return filename; }
00407 void setFilename(string filename) { this->filename = filename; }
00408
00409 bool isModified() { return modified; }
00410 void setModified(bool status) { this->modified = status; }
00411
00412 bool isLoopEnabled() { return loopEnabled; }
00413 void setLoopEnabled( bool enabled ) { loopEnabled = enabled; }
00414
00415 float getHumanizeTimeValue();
00416 void setHumanizeTimeValue(float value);
00417
00418 float getHumanizeVelocityValue();
00419 void setHumanizeVelocityValue(float value);
00420
00421 float getSwingFactor() { return swingFactor; }
00422 void setSwingFactor(float factor);
00423
00424 int getMode() { return mode; }
00425 void setMode( int newMode ) { mode = newMode; }
00426
00427 float getDelayWetLevel() { return delayWetLevel; }
00428 void setDelayWetLevel( float value ) { this->delayWetLevel = value; }
00429
00430 int getDelayTime() { return delayTime; }
00431 void setDelayTime( int nTicks ) { this->delayTime = nTicks; }
00432
00433 float getDelayFeedbackLevel() { return delayFeedbackLevel; }
00434 void setDelayFeedbackLevel( float level ) { this->delayFeedbackLevel = level; }
00435
00436 bool isDelayEnabled() { return delayEnabled; }
00437 void setDelayEnabled( bool enabled ) { this->delayEnabled = enabled; }
00438
00439 bool isHumanizeTimeEnabled() { return humanizeTimeEnabled; }
00440 void setHumanizeTimeEnabled( bool enabled ) { humanizeTimeEnabled = enabled; }
00441
00442 bool isHumanizeVelocityEnabled() { return humanizeVelocityEnabled; }
00443 void setHumanizeVelocityEnabled( bool enabled ) { humanizeVelocityEnabled = enabled; }
00444
00445 bool isSwingEnabled() { return swingEnabled; }
00446 void setSwingEnabled( bool enabled ) { swingEnabled = enabled; }
00447
00448 private:
00450 string id;
00451
00453 unsigned int bpm;
00454
00456 unsigned int resolution;
00457
00458
00459 float volume;
00460
00461
00462 float metronomeVolume;
00463
00465 string name;
00466
00468 string author;
00469
00471 string notes;
00472
00474 PatternList *patternList;
00475
00477 PatternList *patternSequence;
00478
00480 InstrumentList *instrumentList;
00481
00483 string filename;
00484
00486 bool modified;
00487
00488 bool loopEnabled;
00489
00490 bool humanizeTimeEnabled;
00491 float humanizeTimeValue;
00492
00493 bool humanizeVelocityEnabled;
00494 float humanizeVelocityValue;
00495
00496 bool swingEnabled;
00497 float swingFactor;
00498
00500 int mode;
00501
00502 float delayWetLevel;
00503 int delayTime;
00504 float delayFeedbackLevel;
00505 bool delayEnabled;
00506 };
00507
00508
00509
00510
00511
00515 class DrumkitInfo : public Object {
00516 public:
00517 virtual string getClassName() { return "DrumkitInfo"; }
00518
00520 DrumkitInfo();
00521
00523 ~DrumkitInfo();
00524
00525 InstrumentList *getInstrumentList() { return instrumentList; }
00526 void setInstrumentList( InstrumentList* instr ) { this->instrumentList = instr; }
00527
00528 void setName( string name ) { this->name = name; }
00529 string getName() { return name; }
00530
00531 void setAuthor( string author ) { this->author = author; }
00532 string getAuthor() { return author; }
00533
00534 void setInfo( string info ) { this->info = info; }
00535 string getInfo() { return info; }
00536
00537 void dump();
00538
00539 private:
00540 InstrumentList *instrumentList;
00541 string name;
00542 string author;
00543 string info;
00544 };
00545
00546
00547 #endif
00548
00549