diff options
author | Nil Geisweiller <a-lin@sourceforge.net> | 2007-10-20 19:22:28 +0000 |
---|---|---|
committer | Nil Geisweiller <a-lin@sourceforge.net> | 2007-10-20 19:22:28 +0000 |
commit | 53d9e3fab182004169a9582ae60c9fcdad15344f (patch) | |
tree | 643c78915806c145dcc3cb2df3ca835aafbee7b7 | |
parent | 06c20e05c194e165cfd75c2d9d24fe9a0be15c01 (diff) |
fix temporarly the segfault at the launch of muse
-rw-r--r-- | muse/al/pos.cpp | 12 | ||||
-rw-r--r-- | muse/awl/tcanvas.cpp | 1 | ||||
-rw-r--r-- | muse/muse/instruments/minstrument.cpp | 43 |
3 files changed, 32 insertions, 24 deletions
diff --git a/muse/al/pos.cpp b/muse/al/pos.cpp index e723c2f7..8e9fcf87 100644 --- a/muse/al/pos.cpp +++ b/muse/al/pos.cpp @@ -253,8 +253,8 @@ unsigned Pos::tick() const unsigned Pos::frame() const { - if (_type == TICKS) - _frame = tempomap.tick2frame(_tick, _frame, &sn); + if (_type == TICKS) + _frame = tempomap.tick2frame(_tick, _frame, &sn); return _frame; } @@ -516,10 +516,14 @@ void Pos::mbt(int* bar, int* beat, int* tk) const void Pos::msf(int* min, int* sec, int* fr, int* subFrame) const { - double time = double(frame()) / double(AL::sampleRate); + //double has been replaced by float because it prevents (mysteriously) + //from a segfault that occurs at the launching of muse + /*double*/ float time = double(frame()) / double(AL::sampleRate); *min = int(time) / 60; *sec = int(time) % 60; - double rest = time - (*min * 60 + *sec); + //double has been replaced by float because it prevents (mysteriously) + //from a segfault that occurs at the launching of muse + /*double*/ float rest = time - (*min * 60 + *sec); switch(AL::mtcType) { case 0: // 24 frames sec rest *= 24; diff --git a/muse/awl/tcanvas.cpp b/muse/awl/tcanvas.cpp index d0da4c7f..f5ce2100 100644 --- a/muse/awl/tcanvas.cpp +++ b/muse/awl/tcanvas.cpp @@ -61,6 +61,7 @@ TimeCanvas::TimeCanvas(TimeCanvasType t) _yFit = false; _tool = PointerTool; type = t; + _timeType = AL::TICKS; marker = 0; showCursor = false; ctrlHeight = 0; diff --git a/muse/muse/instruments/minstrument.cpp b/muse/muse/instruments/minstrument.cpp index 66705211..05220d37 100644 --- a/muse/muse/instruments/minstrument.cpp +++ b/muse/muse/instruments/minstrument.cpp @@ -40,26 +40,29 @@ int string2sysex(const QString& s, unsigned char** data) char buffer[2048]; char* dst = buffer; - while (*src) { - while (*src == ' ' || *src == '\n') - ++src; - char* ep; - long val = strtol(src, &ep, 16); - if (ep == src) { - QMessageBox::information(0, - QString("MusE"), - QWidget::tr("Cannot convert sysex string")); - return 0; - } - src = ep; - *dst++ = val; - if (dst - buffer >= 2048) { - QMessageBox::information(0, - QString("MusE"), - QWidget::tr("Hex String too long (2048 bytes limit)")); - return 0; - } - } + if(src) { + while (*src) { + while (*src == ' ' || *src == '\n') { + ++src; + } + char* ep; + long val = strtol(src, &ep, 16); + if (ep == src) { + QMessageBox::information(0, + QString("MusE"), + QWidget::tr("Cannot convert sysex string")); + return 0; + } + src = ep; + *dst++ = val; + if (dst - buffer >= 2048) { + QMessageBox::information(0, + QString("MusE"), + QWidget::tr("Hex String too long (2048 bytes limit)")); + return 0; + } + } + } int len = dst - buffer; unsigned char* b = new unsigned char[len+1]; memcpy(b, buffer, len); |