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
|
//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id: bb.h 4823 2011-09-28 16:38:17Z wschweer $
//
// Copyright (C) 2009-2011 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#ifndef __BB_H__
#define __BB_H__
#include "midi/midifile.h"
namespace Ms {
const int MAX_BARS = 255;
class BBFile;
struct MNote;
class Score;
//---------------------------------------------------------
// BBTrack
//---------------------------------------------------------
class BBTrack {
BBFile* bb;
EventList _events;
int _outChannel;
bool _drumTrack;
void quantize(int startTick, int endTick, EventList* dst);
public:
BBTrack(BBFile*);
~BBTrack();
bool empty() const;
const EventList events() const { return _events; }
EventList& events() { return _events; }
int outChannel() const { return _outChannel; }
void setOutChannel(int n) { _outChannel = n; }
void insert(const Event& e) { _events.insert(e); }
void append(const Event& e) { _events.append(e); }
void findChords();
int separateVoices(int);
void cleanup();
friend class BBFile;
};
//---------------------------------------------------------
// BBChord
//---------------------------------------------------------
struct BBChord {
int beat;
unsigned char bass;
unsigned char root;
unsigned char extension;
BBChord() {
beat = 0;
bass = 0;
root = 0;
extension = 0;
}
};
//---------------------------------------------------------
// BBStyle
//---------------------------------------------------------
struct BBStyle {
int timesigZ, timesigN;
};
//---------------------------------------------------------
// BBStyle
//---------------------------------------------------------
static const BBStyle styles[] = {
{ 4, 4 }, // Jazz Swing
{ 12, 8 }, // Country 12/8
{ 4, 4 }, // Country 4/4
{ 4, 4 }, // Bossa Nova
{ 4, 4 }, // Ethnic
{ 4, 4 }, // Blues Shuffle
{ 4, 4 }, // Blues Straight
{ 3, 4 }, // Waltz
{ 4, 4 }, // Pop Ballad
{ 4, 4 }, // should be Rock Shuffle
{ 4, 4 }, // lite Rock
{ 4, 4 }, // medium Rock
{ 4, 4 }, // Heavy Rock
{ 4, 4 }, // Miami Rock
{ 4, 4 }, // Milly Pop
{ 4, 4 }, // Funk
{ 3, 4 }, // Jazz Waltz
{ 4, 4 }, // Rhumba
{ 4, 4 }, // Cha Cha
{ 4, 4 }, // Bouncy
{ 4, 4 }, // Irish
{ 12, 8 }, // Pop Ballad 12/8
{ 12, 8 }, // Country12/8 old
{ 4, 4 }, // Reggae
};
//---------------------------------------------------------
// BBFile
//---------------------------------------------------------
class BBFile {
QString _path;
unsigned char _version;
char* _title;
int _style, _key, _bpm;
unsigned char _barType[MAX_BARS];
QList<BBChord> _chords;
int _startChorus;
int _endChorus;
int _repeats;
#if 0 // yet(?) unused
int _flags;
#endif
char* _styleName;
QList<BBTrack*> _tracks;
int _measures;
TimeSigMap _siglist;
QByteArray ba;
const unsigned char* a;
int size;
int bbDivision;
int timesigZ() { return styles[_style].timesigZ; }
int timesigN() { return styles[_style].timesigN; }
int processPendingNotes(Score*, QList<MNote*>* notes, int, int);
public:
BBFile();
~BBFile();
bool read(const QString&);
QList<BBTrack*>* tracks() { return &_tracks; }
int measures() const { return _measures; }
const char* title() const { return _title; }
TimeSigMap siglist() const { return _siglist; }
QList<BBChord> chords() { return _chords; }
int startChorus() const { return _startChorus; }
int endChorus() const { return _endChorus; }
int repeats() const { return _repeats; }
int key() const { return _key; }
void convertTrack(Score* score, BBTrack* track, int staffIdx);
};
} // namespace Ms
#endif
|