summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-04-26 15:35:33 +0000
committerFlorian Jung <flo@windfisch.org>2011-04-26 15:35:33 +0000
commitcea0fdb5f411c7af11f588191bccf4b643536594 (patch)
treefb56a6afb824ee8de9f6b318012e9370de0ccde6
parenta828a98957d94b706f1719fd0478959dd672e69b (diff)
debugging output is only displayed with the -D option
added heavyDebugMsg, which is enabled with specifying -D twice beautified usage hint cleaned up the code a bit
-rw-r--r--muse2/muse/globals.cpp1
-rw-r--r--muse2/muse/globals.h1
-rw-r--r--muse2/muse/main.cpp15
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp336
-rw-r--r--muse2/muse/midiedit/scoreedit.h1
5 files changed, 186 insertions, 168 deletions
diff --git a/muse2/muse/globals.cpp b/muse2/muse/globals.cpp
index 80990f0e..6c0bbbc6 100644
--- a/muse2/muse/globals.cpp
+++ b/muse2/muse/globals.cpp
@@ -87,6 +87,7 @@ QString lastMidiPath(".");
bool debugMode = false;
bool debugMsg = false;
+bool heavyDebugMsg = false;
bool midiInputTrace = false;
bool midiOutputTrace = false;
bool realTimeScheduling = false;
diff --git a/muse2/muse/globals.h b/muse2/muse/globals.h
index 151e7800..894f1baf 100644
--- a/muse2/muse/globals.h
+++ b/muse2/muse/globals.h
@@ -59,6 +59,7 @@ extern bool debugMode;
extern bool midiInputTrace;
extern bool midiOutputTrace;
extern bool debugMsg;
+extern bool heavyDebugMsg;
extern bool debugSync;
extern bool loadPlugins;
extern bool loadVST;
diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp
index e1b30d0c..53f8961b 100644
--- a/muse2/muse/main.cpp
+++ b/muse2/muse/main.cpp
@@ -190,12 +190,14 @@ static void usage(const char* prog, const char* txt)
fprintf(stderr, " -v print version\n");
fprintf(stderr, " -d debug mode: no threads, no RT\n");
fprintf(stderr, " -D debug mode: enable some debug messages\n");
+ fprintf(stderr, " specify twice for lots of debug messages\n");
+ fprintf(stderr, " this may slow down MusE massively!\n");
fprintf(stderr, " -m debug mode: trace midi Input\n");
fprintf(stderr, " -M debug mode: trace midi Output\n");
fprintf(stderr, " -s debug mode: trace sync\n");
fprintf(stderr, " -a no audio\n");
- //fprintf(stderr, " -P n set real time priority to n (default: 50)\n");
- fprintf(stderr, " -P n set audio driver real time priority to n (Dummy only, default 40. Else fixed by Jack.)\n");
+ fprintf(stderr, " -P n set audio driver real time priority to n\n");
+ fprintf(stderr, " (Dummy only, default 40. Else fixed by Jack.)\n");
fprintf(stderr, " -Y n force midi real time priority to n (default: audio driver prio +2)\n");
fprintf(stderr, " -p don't load LADSPA plugins\n");
#ifdef ENABLE_PYTHON
@@ -210,7 +212,8 @@ static void usage(const char* prog, const char* txt)
#ifdef HAVE_LASH
fprintf(stderr, " -L don't use LASH\n");
#endif
- fprintf(stderr, " -l xx force locale to the given language/country code (xx = %s)\n", localeList().toLatin1().constData());
+ fprintf(stderr, " -l xx force locale to the given language/country code\n");
+ fprintf(stderr, " (xx = %s)\n", localeList().toLatin1().constData());
}
//---------------------------------------------------------
@@ -303,7 +306,11 @@ int main(int argc, char* argv[])
case 'a':
noAudio = true;
break;
- case 'D': debugMsg = true; break;
+ case 'D':
+ if (!debugMsg)
+ debugMsg=true;
+ else
+ heavyDebugMsg=true;
case 'm': midiInputTrace = true; break;
case 'M': midiOutputTrace = true; break;
case 's': debugSync = true; break;
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 3e144189..98568325 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -71,7 +71,7 @@ QString IntToQStr(int i);
#define SPLIT_NOTE 60
-//TODO: let the user specify that somehow?
+
@@ -332,13 +332,6 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos)
-/* FINDMICHJETZT
- addToolBarBreak();
- info = new NoteInfo(this);
- addToolBar(info);
-*/
-
-
score_canvas->song_changed(SC_EVENT_INSERTED);
@@ -473,7 +466,7 @@ void ScoreCanvas::add_staves(PartList* pl, bool all_in_one)
staff.split_note=SPLIT_NOTE;
- staff.type=GRAND_TOP; //FINDMICH
+ staff.type=GRAND_TOP; //FINDME_INITCLEF
staff.clef=VIOLIN;
staves.push_back(staff);
@@ -498,7 +491,7 @@ void ScoreCanvas::add_staves(PartList* pl, bool all_in_one)
staff.split_note=SPLIT_NOTE;
- staff.type=GRAND_TOP; //FINDMICH
+ staff.type=GRAND_TOP; //FINDME_INITCLEF
staff.clef=VIOLIN;
staves.push_back(staff);
@@ -606,7 +599,7 @@ void ScoreCanvas::set_staffmode(list<staff_t>::iterator it, staff_mode_t mode)
{
it--;
if (it->type!=GRAND_TOP)
- cout << "THIS SHOULD NEVER HAPPEN: grand_bottom without top!"<<endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: grand_bottom without top!"<<endl;
}
if (it->type==GRAND_TOP)
@@ -614,7 +607,7 @@ void ScoreCanvas::set_staffmode(list<staff_t>::iterator it, staff_mode_t mode)
list<staff_t>::iterator tmp=it;
tmp++;
if (tmp->type!=GRAND_BOTTOM)
- cout << "THIS SHOULD NEVER HAPPEN: grand_top without bottom!"<<endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: grand_top without bottom!"<<endl;
staves.erase(tmp);
}
@@ -639,7 +632,7 @@ void ScoreCanvas::set_staffmode(list<staff_t>::iterator it, staff_mode_t mode)
break;
default:
- cout << "ILLEGAL FUNCTION CALL: invalid mode in set_staffmode" << endl;
+ cerr << "ERROR: ILLEGAL FUNCTION CALL: invalid mode in set_staffmode" << endl;
}
recalc_staff_pos();
@@ -652,7 +645,7 @@ void ScoreCanvas::remove_staff(list<staff_t>::iterator it)
{
it--;
if (it->type!=GRAND_TOP)
- cout << "THIS SHOULD NEVER HAPPEN: grand_bottom without top!"<<endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: grand_bottom without top!"<<endl;
}
if (it->type == NORMAL)
@@ -663,7 +656,7 @@ void ScoreCanvas::remove_staff(list<staff_t>::iterator it)
{
staves.erase(it++);
if (it->type!=GRAND_BOTTOM)
- cout << "THIS SHOULD NEVER HAPPEN: grand_top without bottom!"<<endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: grand_top without bottom!"<<endl;
staves.erase(it);
}
@@ -678,14 +671,14 @@ void ScoreCanvas::merge_staves(list<staff_t>::iterator dest, list<staff_t>::iter
{
dest--;
if (dest->type!=GRAND_TOP)
- cout << "THIS SHOULD NEVER HAPPEN: grand_bottom without top!"<<endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: grand_bottom without top!"<<endl;
}
if (src->type == GRAND_BOTTOM)
{
src--;
if (src->type!=GRAND_TOP)
- cout << "THIS SHOULD NEVER HAPPEN: grand_bottom without top!"<<endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: grand_bottom without top!"<<endl;
}
if (dest==src) //dragged to itself?
@@ -698,7 +691,7 @@ void ScoreCanvas::merge_staves(list<staff_t>::iterator dest, list<staff_t>::iter
{
dest++;
if (dest->type != GRAND_BOTTOM)
- cout << "THIS SHOULD NEVER HAPPEN: grand_top without bottom!"<<endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: grand_top without bottom!"<<endl;
dest->parts.insert(src->parts.begin(), src->parts.end());
}
@@ -810,6 +803,8 @@ void ScoreCanvas::init_pixmaps()
{
if (!pixmaps_initalized)
{
+ if (debugMsg) cout << "initalizing colors..." << endl;
+
mycolors=new QColor[NUM_MYCOLORS];
mycolors[0]=Qt::black;
@@ -823,7 +818,8 @@ void ScoreCanvas::init_pixmaps()
for (int i=64; i<128; i++)
mycolors[i+VELO_PIXMAP_BEGIN]=QColor(0xff,0,(127-i)*4);
- cout << "loading pixmaps..." << endl;
+
+ if (debugMsg) cout << "loading pixmaps..." << endl;
pix_whole=new QPixmap[NUM_MYCOLORS];
pix_half=new QPixmap[NUM_MYCOLORS];
@@ -878,6 +874,8 @@ void ScoreCanvas::init_pixmaps()
pix_num[i].load(museGlobalShare + "/scoreglyphs/"+IntToQStr(i)+".png");
pixmaps_initalized=true;
+
+ if (debugMsg) cout << "done" << endl;
}
}
@@ -889,11 +887,11 @@ int modulo(int a, int b) // similar to a % b
}
int divide_floor(int a, int b) // similar to a / b
-{ //TODO can be done better :/
+{
return int(floor(float(a)/float(b)));
}
-#define DEFAULT_REST_HEIGHT 6 // TODO
+#define DEFAULT_REST_HEIGHT 6
bool operator< (const note_pos_t& a, const note_pos_t& b)
@@ -957,7 +955,7 @@ void staff_t::create_appropriate_eventlist()
unsigned begin, end;
begin=flo_quantize(event.tick()+part->tick(), parent->quant_ticks());
end=flo_quantize(event.endTick()+part->tick(), parent->quant_ticks());
- cout <<"inserting note on at "<<begin<<" with pitch="<<event.pitch()<<" and len="<<end-begin<<endl;
+ if (heavyDebugMsg) cout << "inserting note on at "<<begin<<" with pitch="<<event.pitch()<<" and len="<<end-begin<<endl;
eventlist.insert(pair<unsigned, FloEvent>(begin, FloEvent(begin,event.pitch(), event.velo(),end-begin,FloEvent::NOTE_ON,part,&it->second)));
}
//else ignore it
@@ -972,12 +970,9 @@ void staff_t::create_appropriate_eventlist()
unsigned ticks_per_measure=sigmap.ticksMeasure(it->second->tick);
if (to > unsigned(SONG_LENGTH))
- {
- cout << "time signature's end-of-validness is outside of our song, limiting it." << endl;
to=SONG_LENGTH;
- }
- cout << "new signature from tick "<<from<<" to " << to << ": "<<it->second->sig.z<<"/"<<it->second->sig.n<<"; ticks per measure = "<<ticks_per_measure<<endl;
+ if (heavyDebugMsg) cout << "new signature from tick "<<from<<" to " << to << ": "<<it->second->sig.z<<"/"<<it->second->sig.n<<"; ticks per measure = "<<ticks_per_measure<<endl;
eventlist.insert(pair<unsigned, FloEvent>(from, FloEvent(from, FloEvent::TIME_SIG, it->second->sig.z, it->second->sig.n) ) );
for (unsigned t=from; t<to; t+=ticks_per_measure)
eventlist.insert(pair<unsigned, FloEvent>(t, FloEvent(t,0,0,ticks_per_measure,FloEvent::BAR) ) );
@@ -1042,7 +1037,7 @@ note_pos_t note_pos_(int note, key_enum key)
int foo[12]={0,-1, 1,-1, 2,3,-1, 4,-1, 5, -1,6};
if ((note<0) || (note>=12))
- cout << "WARNING: ILLEGAL FUNCTION CALL (note_pos, note out of range)" << endl;
+ cerr << "ERROR: ILLEGAL FUNCTION CALL (note_pos, note out of range)" << endl;
if (foo[note]!=-1)
{
@@ -1141,14 +1136,6 @@ int calc_len(int l, int d)
return tmp;
}
-bool operator< (const note_len_t& a,const note_len_t& b) //TODO sane sorting order
-{
- if (a.len<b.len) return true;
- else if (a.dots<b.dots) return true;
- else return false;
-}
-
-
int calc_measure_len(const list<int>& nums, int denom)
{
@@ -1162,10 +1149,13 @@ int calc_measure_len(const list<int>& nums, int denom)
vector<int> create_emphasize_list(const list<int>& nums, int denom)
{
- cout << "creating emphasize list for ";
- for (list<int>::const_iterator it=nums.begin(); it!=nums.end(); it++)
- cout << *it << " ";
- cout << "/ "<<denom;
+ if (heavyDebugMsg)
+ {
+ cout << "creating emphasize list for ";
+ for (list<int>::const_iterator it=nums.begin(); it!=nums.end(); it++)
+ cout << *it << " ";
+ cout << "/ "<<denom;
+ }
// |----- 8th -----|
int foo[]={4,7,6,7,5,7,6,7}; //if 64 changes, this also must change
@@ -1187,13 +1177,16 @@ vector<int> create_emphasize_list(const list<int>& nums, int denom)
result[0]=0;
- for (int i=0;i<len;i++)
+ if (heavyDebugMsg)
{
- if (i%8==0)
- cout << endl<<i<<":\t";
- cout << result[i]<<" ";
+ for (int i=0;i<len;i++)
+ {
+ if (i%8==0)
+ cout << endl<<i<<":\t";
+ cout << result[i]<<" ";
+ }
+ cout << endl;
}
- cout << endl;
return result;
}
@@ -1232,9 +1225,9 @@ list<note_len_t> parse_note_len(int len_ticks, int begin_tick, vector<int>& foo,
list<note_len_t> retval;
if (len_ticks<0)
- cout << "WARNING: ILLEGAL FUNCTION CALL in parse_note_len: len_ticks < 0" << endl;
+ cerr << "ERROR: ILLEGAL FUNCTION CALL in parse_note_len: len_ticks < 0" << endl;
if (begin_tick<0)
- cout << "WARNING: ILLEGAL FUNCTION CALL in parse_note_len: begin_tick < 0" << endl;
+ cerr << "ERROR: ILLEGAL FUNCTION CALL in parse_note_len: begin_tick < 0" << endl;
if (allow_normal)
{
@@ -1266,7 +1259,7 @@ list<note_len_t> parse_note_len(int len_ticks, int begin_tick, vector<int>& foo,
len_now=len_now*TICKS_PER_WHOLE/64;
- cout << "add " << len_now << " ticks" << endl;
+ if (heavyDebugMsg) cout << "add " << len_now << " ticks" << endl;
if (allow_dots)
{
for (int i=0;i<=quant_power2;i++)
@@ -1293,7 +1286,7 @@ list<note_len_t> parse_note_len(int len_ticks, int begin_tick, vector<int>& foo,
}
if (len_now!=0)
- cout << "WARNING: THIS SHOULD NEVER HAPPEN. wasn't able to split note len properly; len_now="<<len_now << endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN. wasn't able to split note len properly; len_now="<<len_now << endl;
if (pos==foo.size()) //we cross measure boundaries?
pos=0;
@@ -1409,9 +1402,11 @@ void staff_t::create_itemlist()
note_pos_t notepos=note_pos(pitch,tmp_key,clef);
- printf("FLO: t=%i\ttype=%i\tpitch=%i\tvel=%i\tlen=%i\n",it->first, it->second.type, it->second.pitch, it->second.vel, it->second.len);
- cout << "\tline="<<notepos.height<<"\tvorzeichen="<<notepos.vorzeichen << endl;
-
+ if (heavyDebugMsg)
+ {
+ printf("FLO: t=%i\ttype=%i\tpitch=%i\tvel=%i\tlen=%i\n",it->first, it->second.type, it->second.pitch, it->second.vel, it->second.len);
+ cout << "\tline="<<notepos.height<<"\tvorzeichen="<<notepos.vorzeichen << endl;
+ }
if (type==FloEvent::BAR)
{
@@ -1420,7 +1415,7 @@ void staff_t::create_itemlist()
if (lastevent==last_measure) //there was no note?
{
unsigned tmppos=(last_measure+t-parent->quant_ticks())/2;
- cout << "\tend-of-measure: this was an empty measure. inserting rest in between at t="<<tmppos << endl;
+ if (heavyDebugMsg) cout << "\tend-of-measure: this was an empty measure. inserting rest in between at t="<<tmppos << endl;
itemlist[tmppos].insert( FloItem(FloItem::REST,notepos,0,0) );
itemlist[t].insert( FloItem(FloItem::REST_END,notepos,0,0) );
}
@@ -1430,13 +1425,13 @@ void staff_t::create_itemlist()
int rest=t-lastevent;
if (rest)
{
- printf("\tend-of-measure: set rest at %i with len %i\n",lastevent,rest);
+ if (heavyDebugMsg) printf("\tend-of-measure: set rest at %i with len %i\n",lastevent,rest);
list<note_len_t> lens=parse_note_len(rest,lastevent-last_measure,emphasize_list,parent->quant_power2(),DOTTED_RESTS,UNSPLIT_RESTS);
unsigned tmppos=lastevent;
for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++)
{
- cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl;
+ if (heavyDebugMsg) cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl;
itemlist[tmppos].insert( FloItem(FloItem::REST,notepos,x->len,x->dots) );
tmppos+=calc_len(x->len,x->dots);
itemlist[tmppos].insert( FloItem(FloItem::REST_END,notepos,0,0) );
@@ -1456,7 +1451,7 @@ void staff_t::create_itemlist()
int rest=t-lastevent;
if (rest)
{
- printf("\tset rest at %i with len %i\n",lastevent,rest);
+ if (heavyDebugMsg) printf("\tset rest at %i with len %i\n",lastevent,rest);
// no need to check if the rest crosses measure boundaries;
// it can't.
@@ -1464,7 +1459,7 @@ void staff_t::create_itemlist()
unsigned tmppos=lastevent;
for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++)
{
- cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl;
+ if (heavyDebugMsg) cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl;
itemlist[tmppos].insert( FloItem(FloItem::REST,notepos,x->len,x->dots) );
tmppos+=calc_len(x->len,x->dots);
itemlist[tmppos].insert( FloItem(FloItem::REST_END,notepos,0,0) );
@@ -1473,7 +1468,7 @@ void staff_t::create_itemlist()
- printf("\tset note at %i with len=%i\n", t, len);
+ if (heavyDebugMsg) printf("\tset note at %i with len=%i\n", t, len);
int tmplen;
bool tied_note;
@@ -1490,14 +1485,14 @@ void staff_t::create_itemlist()
eventlist.insert(pair<unsigned, FloEvent>(next_measure, FloEvent(actual_tick,pitch, velo,0,FloEvent::NOTE_OFF, it->second.source_part, it->second.source_event)));
eventlist.insert(pair<unsigned, FloEvent>(next_measure, FloEvent(actual_tick,pitch, velo,newlen,FloEvent::NOTE_ON, it->second.source_part, it->second.source_event)));
- cout << "\t\tnote was split to length "<<tmplen<<" + " << newlen<<endl;
+ if (heavyDebugMsg) cout << "\t\tnote was split to length "<<tmplen<<" + " << newlen<<endl;
}
else
{
tmplen=len;
tied_note=false;
- cout << "\t\tinserting NOTE OFF at "<<t+len<<endl;
+ if (heavyDebugMsg) cout << "\t\tinserting NOTE OFF at "<<t+len<<endl;
eventlist.insert(pair<unsigned, FloEvent>(t+len, FloEvent(t+len,pitch, velo,0,FloEvent::NOTE_OFF,it->second.source_part, it->second.source_event)));
}
@@ -1507,7 +1502,7 @@ void staff_t::create_itemlist()
int count=0;
for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++)
{
- cout << "\t\tpartial note with len="<<x->len<<", dots="<<x->dots<<endl;
+ if (heavyDebugMsg) cout << "\t\tpartial note with len="<<x->len<<", dots="<<x->dots<<endl;
count++;
bool tie;
@@ -1528,14 +1523,14 @@ void staff_t::create_itemlist()
}
else if (type==FloEvent::TIME_SIG)
{
- cout << "inserting TIME SIGNATURE "<<it->second.num<<"/"<<it->second.denom<<" at "<<t<<endl;
+ if (heavyDebugMsg) cout << "inserting TIME SIGNATURE "<<it->second.num<<"/"<<it->second.denom<<" at "<<t<<endl;
itemlist[t].insert( FloItem(FloItem::TIME_SIG, it->second.num, it->second.denom) );
emphasize_list=create_emphasize_list(it->second.num, it->second.denom);
}
else if (type==FloEvent::KEY_CHANGE)
{
- cout << "inserting KEY CHANGE ("<<it->second.key<<") at "<<t<<endl;
+ if (heavyDebugMsg) cout << "inserting KEY CHANGE ("<<it->second.key<<") at "<<t<<endl;
itemlist[t].insert( FloItem(FloItem::KEY_CHANGE, it->second.key) );
tmp_key=it->second.key;
}
@@ -1553,7 +1548,7 @@ void staff_t::process_itemlist()
{
set<FloItem, floComp>& curr_items=it2->second;
- cout << "at t="<<it2->first<<endl;
+ if (heavyDebugMsg) cout << "at t="<<it2->first<<endl;
// phase 0: keep track of active notes, rests -------------------
// (and occupied lines) and the last measure
@@ -1570,10 +1565,13 @@ void staff_t::process_itemlist()
emphasize_list=create_emphasize_list(it->num, it->denom);
}
- cout << "occupied: ";
- for (map<int,int>::iterator i=occupied.begin(); i!=occupied.end(); i++)
- if (i->second) cout << i->first << "("<<i->second<<") ";
- cout << endl;
+ if (heavyDebugMsg)
+ {
+ cout << "occupied: ";
+ for (map<int,int>::iterator i=occupied.begin(); i!=occupied.end(); i++)
+ if (i->second) cout << i->first << "("<<i->second<<") ";
+ cout << endl;
+ }
@@ -1593,7 +1591,7 @@ void staff_t::process_itemlist()
//(can be seen on already_grouped)
if ((it->type==FloItem::REST) && (it->already_grouped==false))
{
- cout << "trying to group" << endl;
+ if (heavyDebugMsg) cout << "trying to group" << endl;
int lastheight;
int height_cumulative=0;
@@ -1604,12 +1602,12 @@ void staff_t::process_itemlist()
set<FloItem, floComp>::iterator tmp;
for (tmp=it; tmp!=curr_items.end();)
{
- cout << "checking if we can proceed with an item at height="<<tmp->pos.height<<endl;
+ if (heavyDebugMsg) cout << "checking if we can proceed with an item at height="<<tmp->pos.height<<endl;
for (int i=lastheight+1; i<=tmp->pos.height-1; i++)
if (occupied[i]!=0)
{
- cout << "we can NOT, because occ["<<i<<"] != 0" << endl;
+ if (heavyDebugMsg) cout << "we can NOT, because occ["<<i<<"] != 0" << endl;
//stop grouping that rest
goto get_out_here;
}
@@ -1621,7 +1619,7 @@ void staff_t::process_itemlist()
{
// füge diese pause zur gruppe dazu und entferne sie von diesem set hier
// entfernen aber nur, wenn sie nicht it, also die erste pause ist, die brauchen wir noch!
- cout << "\tgrouping rest at height="<<tmp->pos.height<<endl;
+ if (heavyDebugMsg) cout << "\tgrouping rest at height="<<tmp->pos.height<<endl;
height_cumulative+=tmp->pos.height;
counter++;
if (tmp!=it)
@@ -1631,12 +1629,12 @@ void staff_t::process_itemlist()
}
else //it's something else? well, we can stop grouping that rest then
{
- cout << "we can NOT, because that item is not a rest" << endl;
+ if (heavyDebugMsg) cout << "we can NOT, because that item is not a rest" << endl;
//stop grouping that rest
goto get_out_here;
}
}
- cout << "no items to proceed on left, continuing" << endl;
+ if (heavyDebugMsg) cout << "no items to proceed on left, continuing" << endl;
get_out_here:
n_groups++;
@@ -1651,7 +1649,7 @@ void staff_t::process_itemlist()
// have we grouped all available rests into one single?
if ( (n_groups==1) && (tmp==curr_items.end()) && !dont_group)
{
- cout << "wow, we were able to group all rests into one single" << endl;
+ if (heavyDebugMsg) cout << "wow, we were able to group all rests into one single" << endl;
if (temp.len==0) //the whole rest is shifted one line (one space and one line)
temp.pos.height=DEFAULT_REST_HEIGHT+2;
else
@@ -1659,7 +1657,7 @@ void staff_t::process_itemlist()
}
else
{
- cout << "creating group #"<<n_groups<<endl;
+ if (heavyDebugMsg) cout << "creating group #"<<n_groups<<endl;
temp.pos.height=nearbyint((float)height_cumulative/counter);
}
@@ -1670,7 +1668,7 @@ void staff_t::process_itemlist()
// the item. effect: you don't have the rest at all
curr_items.erase(it++);
- cout << "replacing all grouped rests with a rest at height="<<temp.pos.height<<endl;
+ if (heavyDebugMsg) cout << "replacing all grouped rests with a rest at height="<<temp.pos.height<<endl;
curr_items.insert(temp);
}
@@ -1694,8 +1692,8 @@ void staff_t::process_itemlist()
groupbegin=invalid;
int count;
- //TODO FINDMICH MARKER: is "grouping" notes and rests together okay?
- // or is it better to ignore rests when grouping?
+ //TODO: is "grouping" notes and rests together okay?
+ // or is it better to ignore rests when grouping?
for (set<FloItem, floComp>::iterator it=curr_items.begin(); it!=curr_items.end(); it++)
if ( (it->type==FloItem::NOTE) || (it->type==FloItem::REST) )
{
@@ -1761,24 +1759,27 @@ group_them_again:
if (it->type==FloItem::NOTE)
lengths[it->len].add(it->pos.height);
- cout << "note lengths at that time are:";
- for (map<int, cumulative_t>::iterator it=lengths.begin(); it!=lengths.end(); it++)
- cout << it->first << "("<< it->second.mean() <<") ";
- cout << endl;
+ if (heavyDebugMsg)
+ {
+ cout << "note lengths at that time are:";
+ for (map<int, cumulative_t>::iterator it=lengths.begin(); it!=lengths.end(); it++)
+ cout << it->first << "("<< it->second.mean() <<") ";
+ cout << endl;
+ }
if (lengths.erase(0)) // in case "0" is in the set, erase it
has_whole=true; // but remember there were whole notes
if (lengths.size()==0)
{
- cout << "no notes other than wholes, or no notes at all. we can relax" << endl;
+ if (heavyDebugMsg) cout << "no notes other than wholes, or no notes at all. we can relax" << endl;
}
else if (lengths.size()==1)
{
pair<const int, cumulative_t>& group=*(lengths.begin());
stem_t stem;
int shift=0;
- cout << "only one non-whole note group (len="<<group.first<<") at height="<<group.second.mean()<< endl;
+ if (heavyDebugMsg) cout << "only one non-whole note group (len="<<group.first<<") at height="<<group.second.mean()<< endl;
if (group.second.mean()>=6)
{
@@ -1809,7 +1810,7 @@ group_them_again:
pair<const int, cumulative_t>& group2=*it;
stem_t stem1, stem2;
int shift1=0, shift2=0;
- cout << "two non-whole note group: len="<<group1.first<<" at height="<<group1.second.mean()<<" and len="<<group2.first<<" at height="<<group2.second.mean()<< endl;
+ if (heavyDebugMsg) cout << "two non-whole note group: len="<<group1.first<<" at height="<<group1.second.mean()<<" and len="<<group2.first<<" at height="<<group2.second.mean()<< endl;
if (group1.second.mean()<group2.second.mean())
{
@@ -1867,17 +1868,17 @@ group_them_again:
group1_len_ticks=calc_len(group1_len,0);
group2_len_ticks=calc_len(group2_len,0);
- cout << "we have "<<lengths.size()<<" groups. putting the "<<group1_n<<" longest and the "<<group2_n<<"shortest groups together"<<endl;
- cout << "\tgroup1 will have len="<<group1_len<<" ("<<group1_len_ticks<<" ticks), group2 will have len="<<group2_len<<" ("<<group2_len_ticks<<" ticks)"<<endl;
+ if (heavyDebugMsg) cout << "we have "<<lengths.size()<<" groups. putting the "<<group1_n<<" longest and the "<<group2_n<<"shortest groups together"<<endl <<
+ "\tgroup1 will have len="<<group1_len<<" ("<<group1_len_ticks<<" ticks), group2 will have len="<<group2_len<<" ("<<group2_len_ticks<<" ticks)"<<endl;
for (set<FloItem, floComp>::iterator it=curr_items.begin(); it!=curr_items.end();)
if (it->type==FloItem::NOTE)
{
//if *it belongs to group1 and has not already its destination length
- cout << "\tprocessing note-item with len="<<it->len<<endl;
+ if (heavyDebugMsg) cout << "\tprocessing note-item with len="<<it->len<<endl;
if (it->len<group1_len)
{
- cout << "\t\thas to be changed to fit into group 1" << endl;
+ if (heavyDebugMsg) cout << "\t\thas to be changed to fit into group 1" << endl;
FloItem tmp=*it;
curr_items.erase(it++);
@@ -1902,7 +1903,7 @@ group_them_again:
int count=0;
for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++)
{
- cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl;
+ if (heavyDebugMsg) cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl;
count++;
bool tie;
@@ -1921,7 +1922,7 @@ group_them_again:
//else if *it belongs to group2 and has not already its destination length
else if ((it->len<group2_len) && (it->len>group1_len))
{
- cout << "\t\thas to be changed to fit into group 2" << endl;
+ if (heavyDebugMsg) cout << "\t\thas to be changed to fit into group 2" << endl;
FloItem tmp=*it;
curr_items.erase(it++);
@@ -1947,7 +1948,7 @@ group_them_again:
int count=0;
for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++)
{
- cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl;
+ if (heavyDebugMsg) cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl;
count++;
bool tie;
@@ -1965,7 +1966,7 @@ group_them_again:
}
else //nothing to do?
{
- cout << "\t\tnothing to do" << endl;
+ if (heavyDebugMsg) cout << "\t\tnothing to do" << endl;
it++;
}
}
@@ -1981,7 +1982,7 @@ group_them_again:
//draw a pixmap centered
void ScoreCanvas::draw_pixmap(QPainter& p, int x, int y, const QPixmap& pm)
{
- cout << "drawing pixmap width size="<<pm.width()<<"/"<<pm.height()<<" at "<<x<<"/"<<y<<endl;
+ if (heavyDebugMsg) cout << "drawing pixmap with size="<<pm.width()<<"/"<<pm.height()<<" at "<<x<<"/"<<y<<endl;
p.drawPixmap(x-pm.width()/2,y-pm.height()/2,pm);
}
@@ -2058,7 +2059,7 @@ void staff_t::calc_item_pos()
}
if (dest==desttime.end())
- cout << "THIS SHOULD NEVER HAPPEN: did not find destination note for tie!" << endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: did not find destination note for tie!" << endl;
}
}
else if (it->type==FloItem::REST)
@@ -2186,7 +2187,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte
for (ScoreItemList::iterator it2=from_it; it2!=to_it; it2++)
{
- cout << "at t="<<it2->first << endl;
+ if (heavyDebugMsg) cout << "at t="<<it2->first << endl;
int upstem_y1 = -1, upstem_y2=-1, upstem_x=-1, upflag=-1;
int downstem_y1 = -1, downstem_y2=-1, downstem_x=-1, downflag=-1;
@@ -2195,17 +2196,20 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte
{
if (it->type==FloItem::NOTE)
{
- cout << "\tNOTE at line"<<it->pos.height<<" with acc.="<<it->pos.vorzeichen<<", len="<<pow(2,it->len);
- for (int i=0;i<it->dots;i++) cout << ".";
- cout << " , stem=";
- if (it->stem==UPWARDS)
- cout << "UPWARDS";
- else
- cout << "DOWNWARDS";
-
- cout << " , shift="<<it->shift<<", ausweich="<<it->ausweich<<", ";
- if (!it->tied) cout << "un";
- cout << "tied, is_tie_dest="<<it->is_tie_dest<<endl;
+ if (heavyDebugMsg)
+ {
+ cout << "\tNOTE at line"<<it->pos.height<<" with acc.="<<it->pos.vorzeichen<<", len="<<pow(2,it->len);
+ for (int i=0;i<it->dots;i++) cout << ".";
+ cout << " , stem=";
+ if (it->stem==UPWARDS)
+ cout << "UPWARDS";
+ else
+ cout << "DOWNWARDS";
+
+ cout << " , shift="<<it->shift<<", ausweich="<<it->ausweich<<", ";
+ if (!it->tied) cout << "un";
+ cout << "tied, is_tie_dest="<<it->is_tie_dest<<endl;
+ }
if (it->len!=0) //only for non-whole notes the stems are relevant!
{
@@ -2218,11 +2222,11 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte
if ((upflag!=-1) && (upflag!=it->len))
- cout << "WARNING: THIS SHOULD NEVER HAPPEN: upflag != this->flag" << endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: upflag != this->flag" << endl;
upflag=it->len;
if ((upstem_x!=-1) && (upstem_x!=it->stem_x ))
- cout << "WARNING: THIS SHOULD NEVER HAPPEN: upstem_x != x_result" << endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: upstem_x != x_result" << endl;
upstem_x=it->stem_x;
}
else
@@ -2234,11 +2238,11 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte
if ((downflag!=-1) && (downflag!=it->len))
- cout << "WARNING: THIS SHOULD NEVER HAPPEN: downflag != this->flag" << endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: downflag != this->flag" << endl;
downflag=it->len;
if ((downstem_x!=-1) && (downstem_x!=it->stem_x))
- cout << "WARNING: THIS SHOULD NEVER HAPPEN: downstem_x != x_result" << endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: downstem_x != x_result" << endl;
downstem_x=it->stem_x; //important: before the below calculation!
}
}
@@ -2280,8 +2284,6 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte
color_index=HIGHLIGHTED_PIXMAP;
draw_pixmap(p,it->x -x_pos+x_left,y_offset + it->y,it->pix[color_index]);
- //TODO FINDMICH maybe draw a margin around bright colors?
- //maybe draw the default color in black?
//draw dots
@@ -2323,7 +2325,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte
//if needed, draw tie
if (it->is_tie_dest)
{
- cout << "drawing tie" << endl;
+ if (heavyDebugMsg) cout << "drawing tie" << endl;
draw_tie(p,it->tie_from_x-x_pos+x_left,it->x -x_pos+x_left,y_offset + it->y, (it->len==0) ? true : (it->stem==DOWNWARDS) , mycolors[color_index]);
// in english: "if it's a whole note, tie is upwards (true). if not, tie is upwards if
// stem is downwards and vice versa"
@@ -2331,9 +2333,12 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte
}
else if (it->type==FloItem::REST)
{
- cout << "\tREST at line"<<it->pos.height<<" with len="<<pow(2,it->len);
- for (int i=0;i<it->dots;i++) cout << ".";
- cout << " , ausweich="<<it->ausweich<<endl;
+ if (heavyDebugMsg)
+ {
+ cout << "\tREST at line"<<it->pos.height<<" with len="<<pow(2,it->len);
+ for (int i=0;i<it->dots;i++) cout << ".";
+ cout << " , ausweich="<<it->ausweich<<endl;
+ }
draw_pixmap(p,it->x -x_pos+x_left,y_offset + it->y,*it->pix);
@@ -2358,7 +2363,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte
}
else if (it->type==FloItem::BAR)
{
- cout << "\tBAR" << endl;
+ if (heavyDebugMsg) cout << "\tBAR" << endl;
p.setPen(Qt::black);
p.drawLine(it->x -x_pos+x_left,y_offset -2*YLEN,it->x -x_pos+x_left,y_offset +2*YLEN);
@@ -2368,14 +2373,14 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte
}
else if (it->type==FloItem::TIME_SIG)
{
- cout << "\tTIME SIGNATURE: "<<it->num<<"/"<<it->denom<<endl;
+ if (heavyDebugMsg) cout << "\tTIME SIGNATURE: "<<it->num<<"/"<<it->denom<<endl;
draw_timesig(p, it->x - x_pos+x_left, y_offset, it->num, it->denom);
}
else if (it->type==FloItem::KEY_CHANGE)
{
key_enum new_key=it->key;
- cout << "\tKEY CHANGE: from "<<curr_key<<" to "<<new_key<<endl;
+ if (heavyDebugMsg) cout << "\tKEY CHANGE: from "<<curr_key<<" to "<<new_key<<endl;
list<int> aufloes_list=calc_accidentials(curr_key, staff.clef, new_key);
list<int> new_acc_list=calc_accidentials(new_key, staff.clef);
@@ -2478,7 +2483,7 @@ int clef_height(clef_t clef)
case VIOLIN: return 4;
case BASS: return 8;
default:
- cout << "WARNING: ILLEGAL FUNCTION CALL in clef_height()" << endl;
+ cerr << "ERROR: ILLEGAL FUNCTION CALL in clef_height()" << endl;
return 6;
}
}
@@ -2583,7 +2588,7 @@ void ScoreCanvas::draw_number(QPainter& p, int x, int y, int n)
void ScoreCanvas::draw(QPainter& p, const QRect&)
{
- cout <<"now in ScoreCanvas::draw"<<endl;
+ if (debugMsg) cout <<"now in ScoreCanvas::draw"<<endl;
@@ -2598,6 +2603,8 @@ void ScoreCanvas::draw(QPainter& p, const QRect&)
draw_items(p,it->y_draw - y_pos, *it);
p.setClipping(false);
}
+
+ if (debugMsg) cout << "drawing done." << endl;
}
@@ -2664,11 +2671,8 @@ int ScoreCanvas::x_to_tick(int x)
int t=TICKS_PER_WHOLE * x/pixels_per_whole();
int min_t=0;
- cout << "t="<<t<<endl;
-
for (std::map<int,int>::iterator it=pos_add_list.begin(); it!=pos_add_list.end() && it->first<t; it++)
{
- cout << "at pos_add event at t="<<it->first<<", add="<<it->second<<endl;
min_t=it->first;
x-=it->second;
t=TICKS_PER_WHOLE * x/pixels_per_whole();
@@ -2703,7 +2707,7 @@ int ScoreCanvas::height_to_pitch(int h, clef_t clef)
case VIOLIN: return foo[modulo(h,7)] + ( divide_floor(h,7)*12 ) + 60;
case BASS: return foo[modulo((h-5),7)] + ( divide_floor(h-5,7)*12 ) + 48;
default:
- cout << "WARNING: THIS SHOULD NEVER HAPPEN: unknown clef in height_to_pitch" << endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: unknown clef in height_to_pitch" << endl;
return 60;
}
}
@@ -2775,7 +2779,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event)
{
ScoreItemList& itemlist=staff_it->itemlist;
- cout << "mousePressEvent at "<<x<<"/"<<y<<"; tick="<<tick<<endl;
+ if (debugMsg) cout << "mousePressEvent at "<<x<<"/"<<y<<"; tick="<<tick<<endl;
set<FloItem, floComp>::iterator set_it;
for (set_it=itemlist[tick].begin(); set_it!=itemlist[tick].end(); set_it++)
if (set_it->type==FloItem::NOTE)
@@ -2814,11 +2818,14 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event)
mouse_x_drag_operation=NO_OP;
}
- cout << "you clicked at a note with begin at "<<set_it->begin_tick<<" and end at "<<tick<<endl;
- cout << "x-drag-operation will be "<<mouse_x_drag_operation<<endl;
- cout << "pointer to part is "<<set_it->source_part;
- if (set_it->source_part == NULL) cout << " (WARNING! THIS SHOULD NEVER HAPPEN!)";
- cout << endl;
+ if (debugMsg)
+ cout << "you clicked at a note with begin at "<<set_it->begin_tick<<" and end at "<<tick<<endl
+ << "x-drag-operation will be "<<mouse_x_drag_operation<<endl
+ << "pointer to part is "<<set_it->source_part << endl;
+
+ if (set_it->source_part == NULL) cerr << "ERROR: THIS SHOULD NEVER HAPPEN: set_it->source_part is NULL!" << endl;
+
+
dragged_event=*set_it->source_event;
dragged_event_part=set_it->source_part;
@@ -2861,7 +2868,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event)
{
signed int relative_tick=(signed) tick - curr_part->tick();
if (relative_tick<0)
- cout << "THIS SHOULD NEVER HAPPEN: relative_tick is negative!" << endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: relative_tick is negative!" << endl;
song->startUndo();
//stopping undo at the end of this function is unneccessary
//because we'll begin a drag right after it. finishing
@@ -2877,13 +2884,13 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event)
if (flo_quantize(newevent.lenTick(), quant_ticks()) <= 0)
{
newevent.setLenTick(quant_ticks());
- cout << "DEBUG: inserted note's length would be invisible after quantisation (too short)." << endl <<
- " setting it to " << newevent.lenTick() << endl;
+ if (debugMsg) cout << "inserted note's length would be invisible after quantisation (too short)." << endl <<
+ " setting it to " << newevent.lenTick() << endl;
}
if (newevent.endTick() > curr_part->lenTick())
{
- cout << "DEBUG: clipping inserted note from len="<<newevent.endTick()<<" to len="<<(curr_part->lenTick() - newevent.tick())<<endl;
+ if (debugMsg) cout << "clipping inserted note from len="<<newevent.endTick()<<" to len="<<(curr_part->lenTick() - newevent.tick())<<endl;
newevent.setLenTick(curr_part->lenTick() - newevent.tick());
}
@@ -2919,7 +2926,7 @@ void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event)
{
if (flo_quantize(dragged_event.lenTick(), quant_ticks()) <= 0)
{
- cout << "DEBUG: new length <= 0, erasing item" << endl;
+ if (debugMsg) cout << "new length <= 0, erasing item" << endl;
audio->msgDeleteEvent(dragged_event, dragged_event_part, false, false, false);
}
else
@@ -2963,12 +2970,12 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event)
{
if ((abs(dx)>DRAG_INIT_DISTANCE) && (mouse_x_drag_operation!=NO_OP))
{
- cout << "mouse-operation is now "<<mouse_x_drag_operation<<endl;
+ if (debugMsg) cout << "mouse-operation is now "<<mouse_x_drag_operation<<endl;
mouse_operation=mouse_x_drag_operation;
}
else if (abs(dy)>DRAG_INIT_DISTANCE)
{
- cout << "mouse-operation is now PITCH" << endl;
+ if (debugMsg) cout << "mouse-operation is now PITCH" << endl;
mouse_operation=PITCH;
}
}
@@ -2981,7 +2988,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event)
break;
case PITCH:
- cout << "changing pitch, delta="<<nearbyint((float)dy/PITCH_DELTA)<<endl;
+ if (debugMsg) cout << "changing pitch, delta="<<nearbyint((float)dy/PITCH_DELTA)<<endl;
new_pitch=dragged_event_original_pitch - nearbyint((float)dy/PITCH_DELTA);
if (dragged_event.pitch()!=new_pitch)
@@ -2998,7 +3005,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event)
break;
case BEGIN:
- if (dragged_event.tick()+dragged_event_part->tick() != unsigned(tick)) //TODO FINDMICHJETZT tick kann unsigned werden
+ if (dragged_event.tick()+dragged_event_part->tick() != unsigned(tick))
{
Event tmp=dragged_event.clone();
signed relative_tick=tick-signed(dragged_event_part->tick());
@@ -3008,7 +3015,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event)
else
{
tmp.setTick(0);
- cout << "DEBUG: not moving note before begin of part; setting it directly to the begin" << endl;
+ if (debugMsg) cout << "not moving note before begin of part; setting it directly to the begin" << endl;
}
if (tmp.endTick() > dragged_event_part->lenTick())
@@ -3017,12 +3024,12 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event)
if (new_len>=0)
{
tmp.setLenTick(dragged_event_part->lenTick() - tmp.tick());
- cout << "DEBUG: moved note would exceed its part; clipping length to " << tmp.lenTick() << endl;
+ if (debugMsg) cout << "moved note would exceed its part; clipping length to " << tmp.lenTick() << endl;
}
else
{
tmp.setLenTick(0);
- cout << "DEBUG: moved note would exceed its part; clipping length to 0 (actually negative)" << endl;
+ if (debugMsg) cout << "moved note would exceed its part; clipping length to 0 (actually negative)" << endl;
}
}
@@ -3047,13 +3054,13 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event)
else
{
tmp.setLenTick(0);
- cout << "DEBUG: not setting len to a negative value. using 0 instead" << endl;
+ if (debugMsg) cout << "not setting len to a negative value. using 0 instead" << endl;
}
if (tmp.endTick() > dragged_event_part->lenTick())
{
tmp.setLenTick(dragged_event_part->lenTick() - tmp.tick());
- cout << "DEBUG: resized note would exceed its part; limiting length to " << tmp.lenTick() << endl;
+ if (debugMsg) cout << "resized note would exceed its part; limiting length to " << tmp.lenTick() << endl;
}
audio->msgChangeEvent(dragged_event, tmp, dragged_event_part, false, false, false);
@@ -3149,14 +3156,14 @@ void ScoreCanvas::heartbeat_timer_event()
void ScoreCanvas::x_scroll_event(int x)
{
- cout << "SCROLL EVENT: x="<<x<<endl;
+ if (debugMsg) cout << "SCROLL EVENT: x="<<x<<endl;
x_pos=x;
redraw();
}
void ScoreCanvas::y_scroll_event(int y)
{
- cout << "SCROLL EVENT: y="<<y<<endl;
+ if (debugMsg) cout << "SCROLL EVENT: y="<<y<<endl;
y_pos=y;
redraw();
}
@@ -3203,7 +3210,7 @@ void ScoreCanvas::goto_tick(int tick, bool force)
void ScoreCanvas::resizeEvent(QResizeEvent* ev)
{
- QWidget::resizeEvent(ev); //TODO is this really neccessary?
+ QWidget::resizeEvent(ev);
emit viewport_width_changed( viewport_width() );
emit viewport_height_changed( viewport_height() );
@@ -3251,7 +3258,7 @@ void ScoreCanvas::recalc_staff_pos()
it->y_bottom = it->y_draw + STAFF_DISTANCE/2;
break;
default:
- cout << "THIS SHOULD NEVER HAPPEN: invalid staff type!" << endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: invalid staff type!" << endl;
}
y=it->y_bottom;
}
@@ -3286,7 +3293,7 @@ void ScoreCanvas::set_tool(int tool)
case RubberTool: mouse_erases_notes=true; mouse_inserts_notes=false; break;
case PencilTool: mouse_erases_notes=false; mouse_inserts_notes=true; break;
default:
- cout << "THIS SHOULD NEVER HAPPEN: set_tool called with unknown tool ("<<tool<<")"<<endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: set_tool called with unknown tool ("<<tool<<")"<<endl;
}
}
@@ -3305,7 +3312,7 @@ void ScoreCanvas::menu_command(int cmd)
case CMD_NOTELEN_32: new_len=TICKS_PER_WHOLE/32; break;
case CMD_NOTELEN_LAST: new_len=-1; break;
default:
- cout << "ILLEGAL FUNCTION CALL: ScoreCanvas::menu_command called with unknown command ("<<cmd<<")"<<endl;
+ cerr << "ERROR: ILLEGAL FUNCTION CALL: ScoreCanvas::menu_command called with unknown command ("<<cmd<<")"<<endl;
}
}
@@ -3336,13 +3343,13 @@ void ScoreCanvas::set_quant(int val)
}
else
{
- cout << "ILLEGAL FUNCTION CALL: set_quant called with invalid value of "<<val<<endl;
+ cerr << "ERROR: ILLEGAL FUNCTION CALL: set_quant called with invalid value of "<<val<<endl;
}
}
void ScoreCanvas::set_pixels_per_whole(int val)
{
- cout << "DEBUG: setting px per whole to " << val << endl;
+ if (debugMsg) cout << "setting px per whole to " << val << endl;
_pixels_per_whole=val;
for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++)
@@ -3371,7 +3378,7 @@ void ScoreCanvas::maybe_close_if_empty()
if (staves.empty())
{
if (!parent->close())
- cout << "THIS SHOULD NEVER HAPPEN: tried to close, but event hasn't been accepted!" << endl;
+ cerr << "ERROR: THIS SHOULD NEVER HAPPEN: tried to close, but event hasn't been accepted!" << endl;
}
}
@@ -3456,28 +3463,31 @@ set<Part*> staff_t::parts_at_tick(unsigned tick)
* between, for example, when a cis is tied to a des
*
* CURRENT TODO
- * x nothing atm
+ * o clean up code (find TODOs)
*
* IMPORTANT TODO
* x nothing atm
*
* less important stuff
+ * o use the proper quantisation functions instead of
+ * flo_quantize() and flo_quantize_floor()
+ * o let the user set up SPLIT_NOTE
+ * o let the user decide about the initial clef (search for FINDME_INITCLEF)
+ * o deal with expanding parts or clip (expanding is better)
+ * o offer functions like in the pianoroll: quantize etc.
* o support selections
- * o more fine-grained redrawing in song_changed: sometimes,
- * only a redraw and not a recalc is needed
* o do all the song_changed(SC_EVENT_INSERTED) properly
+ * o add tracks in correct order to score
+ * o draw measure numbers
+ * o use timesig_t in all timesig-stuff
+ * o use bars instead of flags over groups of 8ths / 16ths etc
* o support different keys in different tracks at the same time
* calc_pos_add_list and calc_item_pos will be affected by this
* calc_pos_add_list must be called before calc_item_pos then,
* and calc_item_pos must respect the pos_add_list instead of
* keeping its own pos_add variable (which is only an optimisation)
- * o draw measure numbers
- * o use timesig_t in all timesig-stuff
* o draw a margin around notes which are in a bright color
- * o use bars instead of flags over groups of 8ths / 16ths etc
- * o deal with expanding parts or clip (expanding is better)
* o refuse to resize so that width gets smaller or equal than x_left
- * o add tracks in correct order to score
*
* stuff for the other muse developers
* o process accurate timesignatures from muse's list (has to be implemented first in muse)
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index cf46443c..255e09d5 100644
--- a/muse2/muse/midiedit/scoreedit.h
+++ b/muse2/muse/midiedit/scoreedit.h
@@ -377,7 +377,6 @@ struct note_len_t
}
};
-bool operator< (const note_len_t& a,const note_len_t& b);
struct cumulative_t
{