Skip to content

Commit

Permalink
Merge branch 'master' of github.com:musescore/MuseScore
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Jul 3, 2012
2 parents 9a0c98c + de36470 commit e01abe4
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 68 deletions.
7 changes: 7 additions & 0 deletions libmscore/part.cpp
Expand Up @@ -114,6 +114,13 @@ void Part::read(const QDomElement& de)
}
if (_partName.isEmpty())
_partName = instr(0)->trackName();

// for compatibility with old scores:
if(score()->mscVersion() <= 114 && instr(0)->useDrumset()) {
foreach(Staff* staff, _staves) {
staff->setStaffType(score()->staffTypes().value(PERCUSSION_STAFF_TYPE));
}
}
}

//---------------------------------------------------------
Expand Down
13 changes: 13 additions & 0 deletions libmscore/repeatlist.cpp
Expand Up @@ -121,6 +121,19 @@ RepeatList::RepeatList(Score* s)
idx2 = 0;
}

//---------------------------------------------------------
// ticks
//---------------------------------------------------------

int RepeatList::ticks()
{
if (length() > 0) {
RepeatSegment* s = last();
return s->utick + s->len;
}
return 0;
}

//---------------------------------------------------------
// update
//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions libmscore/repeatlist.h
Expand Up @@ -54,6 +54,7 @@ class RepeatList: public QList<RepeatSegment*>
int utime2utick(qreal) const;
qreal utick2utime(int) const;
void update();
int ticks();
};

#endif
Expand Down
9 changes: 0 additions & 9 deletions libmscore/staff.cpp
Expand Up @@ -425,15 +425,6 @@ void Staff::read(const QDomElement& de)
else
domError(e);
}
//
// for compatibility with old scores:
//
/* if (!_clefList->empty()) {
ClefType ct = clef(0);
if (ct == CLEF_PERC2 || ct == CLEF_PERC)
_staffType = staffTypes[PERCUSSION_STAFF_TYPE];
}
*/
}

//---------------------------------------------------------
Expand Down
24 changes: 9 additions & 15 deletions mscore/debugger.ui
Expand Up @@ -138,21 +138,15 @@
</property>
</column>
</widget>
<widget class="QWidget" name="widget" native="true">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QStackedWidget" name="stack">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
</layout>
<widget class="QStackedWidget" name="stack">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</widget>
</item>
Expand Down
8 changes: 7 additions & 1 deletion mscore/element.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>412</width>
<height>231</height>
<height>212</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -32,6 +32,9 @@
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="topMargin">
<number>9</number>
</property>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
Expand Down Expand Up @@ -114,6 +117,9 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
Expand Down
3 changes: 2 additions & 1 deletion mscore/exportly.cpp
Expand Up @@ -4156,7 +4156,7 @@ void ExportLy::writeScore()
{

out << "\n";

relativ="";
switch(staff->clef(0))
{
case CLEF_G:
Expand All @@ -4165,6 +4165,7 @@ void ExportLy::writeScore()
break;
case CLEF_TAB:
case CLEF_PERC:
case CLEF_PERC2:
case CLEF_G3:
case CLEF_F:
relativ="";
Expand Down
2 changes: 1 addition & 1 deletion mscore/exportmp3.cpp
Expand Up @@ -186,7 +186,7 @@ bool MP3Exporter::initLibrary(QString libpath)
qDebug("Loading LAME from %s\n", qPrintable(libpath));
lame_lib = new QLibrary(libpath, 0);
if (!lame_lib->load()) {
qDebug("load failed\n");
qDebug("load failed <%s>\n", qPrintable(lame_lib->errorString()));
return false;
}

Expand Down
5 changes: 3 additions & 2 deletions mscore/instrdialog.cpp
Expand Up @@ -630,9 +630,10 @@ void MuseScore::editInstrList()
Staff* staff = new Staff(cs, part, rstaff);
sli->staff = staff;
staff->setRstaff(rstaff);

staff->init(t, cidx);

staff->setInitialClef(sli->clef());

cs->undoInsertStaff(staff, staffIdx + rstaff);
if (sli->linked()) {
// TODO: link staff
Expand Down
3 changes: 2 additions & 1 deletion mscore/newwizard.cpp
Expand Up @@ -361,7 +361,8 @@ void InstrumentWizard::createInstruments(Score* cs)
++rstaff;

staff->init(t, cidx);

staff->setInitialClef(sli->clef());

if (sli->linked() && !part->staves()->isEmpty()) {
Staff* linkedStaff = part->staves()->back();
linkedStaff->linkTo(staff);
Expand Down
67 changes: 40 additions & 27 deletions mscore/playpanel.cpp
Expand Up @@ -21,6 +21,7 @@
#include "playpanel.h"
#include "libmscore/sig.h"
#include "libmscore/score.h"
#include "libmscore/repeatlist.h"
#include "seq.h"
#include "musescore.h"
#include "libmscore/measure.h"
Expand Down Expand Up @@ -78,21 +79,14 @@ void PlayPanel::setScore(Score* s)
if (cs != 0 && cs == s)
return;
cs = s;
if (cs) {
MeasureBase* lm = cs->last();
if (lm)
setEndpos(lm->tick() + lm->ticks());
}
bool enable = cs != 0;
volumeSlider->setEnabled(enable);
posSlider->setEnabled(enable);
tempoSlider->setEnabled(enable);
if (cs) {
if (cs && seq && seq->canStart()) {
setTempo(cs->tempomap()->tempo(0));
setRelTempo(cs->tempomap()->relTempo());
Measure* m = cs->lastMeasure();
if (m)
setEndpos(m ? m->tick() + m->ticks() : 0);
setEndpos(cs->repeatList()->ticks());
int tick = cs->playPos();
heartBeat(tick, tick);
}
Expand All @@ -101,11 +95,8 @@ void PlayPanel::setScore(Score* s)
setRelTempo(1.0);
setEndpos(0);
heartBeat(0, 0);
updatePosLabel(0);
}
// heartBeat2(seq->getCurTime());
// int tick, utick;
// seq->getCurTick(&tick, &utick);
// heartBeat(tick, utick);
update();
}

Expand Down Expand Up @@ -161,11 +152,14 @@ void PlayPanel::volumeChanged(double val, int)
// setPos
//---------------------------------------------------------

void PlayPanel::setPos(int tick)
void PlayPanel::setPos(int utick)
{
if (cachedTickPosition != tick)
emit posChange(tick);
heartBeat(tick, tick);
if(!cs)
return;
if (cachedTickPosition != utick)
emit posChange(utick);
updatePosLabel(utick);
updateTimeLabel(cs->utick2utime(utick));
}

//---------------------------------------------------------
Expand All @@ -176,16 +170,7 @@ void PlayPanel::heartBeat(int tick, int utick)
{
if (cachedTickPosition == utick)
return;
if (cs == 0)
return;
cachedTickPosition = utick;

int bar, beat, t;
cs->sigmap()->tickValues(tick, &bar, &beat, &t);

char buffer[32];
sprintf(buffer, "%03d.%02d", bar+1, beat+1);
posLabel->setText(QString(buffer));
updatePosLabel(utick);
posSlider->setValue(utick);
}

Expand All @@ -198,6 +183,15 @@ void PlayPanel::heartBeat2(int samples)
int sec = samples/MScore::sampleRate;
if (sec == cachedTimePosition)
return;
updateTimeLabel(sec);
}

//---------------------------------------------------------
// updateTime
//---------------------------------------------------------

void PlayPanel::updateTimeLabel(int sec)
{
cachedTimePosition = sec;
int m = sec / 60;
sec = sec % 60;
Expand All @@ -208,3 +202,22 @@ void PlayPanel::heartBeat2(int samples)
timeLabel->setText(QString(buffer));
}

//---------------------------------------------------------
// updatePos
//---------------------------------------------------------

void PlayPanel::updatePosLabel(int utick)
{
cachedTickPosition = utick;
int bar = 0;
int beat = 0;
int t = 0;
int tick = 0;
if (cs) {
tick = cs->repeatList()->utick2tick(utick);
cs->sigmap()->tickValues(tick, &bar, &beat, &t);
}
char buffer[32];
sprintf(buffer, "%03d.%02d", bar+1, beat+1);
posLabel->setText(QString(buffer));
}
3 changes: 3 additions & 0 deletions mscore/playpanel.h
Expand Up @@ -61,6 +61,9 @@ class PlayPanel : public QWidget, private Ui::PlayPanelBase {

void setEndpos(int);
void setScore(Score* s);
private:
void updateTimeLabel(int sec);
void updatePosLabel(int utick);
};

#endif
Expand Down
4 changes: 2 additions & 2 deletions mscore/plugins.cpp
Expand Up @@ -337,7 +337,7 @@ ScriptEngine::ScriptEngine()
foreach(QString s, sl)
qDebug("available script extension: <%s>\n", qPrintable(s));
#endif
static const char* xts[] = {
/*static const char* xts[] = {
"qt.core", "qt.gui", "qt.xml", "qt.network", "qt.uitools", "qt.webkit"
};
for (unsigned i = 0; i < sizeof(xts)/sizeof(*xts); ++i) {
Expand All @@ -347,7 +347,7 @@ ScriptEngine::ScriptEngine()
qDebug("Error loading Script extension <%s>: %s\n",
xts[i], qPrintable(val.toString()));
}
}
}*/

//
// create MuseScore bindings
Expand Down
19 changes: 10 additions & 9 deletions mscore/seq.cpp
Expand Up @@ -951,29 +951,29 @@ void Seq::setPos(int utick)
// send seek message to sequencer
//---------------------------------------------------------

void Seq::seek(int tick)
void Seq::seek(int utick)
{
int tick = cs->repeatList()->utick2tick(utick);
if (cs == 0)
return;
Segment* seg = cs->tick2segment(tick);
if (seg) {
mscore->currentScoreView()->moveCursor(seg, -1);
}
cs->setPlayPos(tick);
cs->setPlayPos(utick);
cs->setLayoutAll(false);
cs->end();

tick = cs->repeatList()->tick2utick(tick);

if (cs->playMode() == PLAYMODE_AUDIO) {
ogg_int64_t sp = cs->utick2utime(tick) * MScore::sampleRate;
ogg_int64_t sp = cs->utick2utime(utick) * MScore::sampleRate;
ov_pcm_seek(&vf, sp);
}

SeqMsg msg;
msg.data.intVal = tick;
msg.data.intVal = utick;
msg.id = SEQ_SEEK;
guiToSeq(msg);
mscore->setPos(tick);
mscore->setPos(utick);
foreach(const Note* n, markedNotes) {
((Note*)n)->setSelected(false); // HACK
cs->addRefresh(n->canvasBoundingRect());
Expand Down Expand Up @@ -1376,11 +1376,12 @@ void Seq::heartBeat()
}
}

int tick = cs->repeatList()->utick2tick(guiPos.key());
int utick = guiPos.key();
int tick = cs->repeatList()->utick2tick(utick);
mscore->currentScoreView()->moveCursor(tick);
mscore->setPos(tick);
if (pp)
pp->heartBeat(tick, playPos.key());
pp->heartBeat(tick, utick);

PianorollEditor* pre = mscore->getPianorollEditor();
if (pre && pre->isVisible())
Expand Down

0 comments on commit e01abe4

Please sign in to comment.