From 3bc0fbe478dd117e265dd020e417b54cadd544b1 Mon Sep 17 00:00:00 2001 From: Werner Schweer Date: Sun, 1 Oct 2006 18:56:08 +0000 Subject: updates --- muse/muse/arranger/tlwidget.cpp | 8 +++++--- muse/muse/arranger/trackinfo.cpp | 10 +++++----- muse/muse/audio.cpp | 19 ++++++++----------- muse/muse/audio.h | 4 ++-- muse/muse/conf.cpp | 1 - muse/muse/mixer/mixer.cpp | 22 +++++++++++----------- muse/muse/seqmsg.cpp | 18 +++++------------- muse/muse/thread.cpp | 4 ++-- muse/muse/track.h | 1 + 9 files changed, 39 insertions(+), 48 deletions(-) diff --git a/muse/muse/arranger/tlwidget.cpp b/muse/muse/arranger/tlwidget.cpp index 6b9f80ef..d72856f2 100644 --- a/muse/muse/arranger/tlwidget.cpp +++ b/muse/muse/arranger/tlwidget.cpp @@ -629,7 +629,8 @@ void TLWidget::paintEvent(QPaintEvent* ev) QColor color(_track->selected() ? selectBgColor : bgColor); p.fillRect(r, color); - if (r==rect()) // only draw on full redraw +// does not work if scrolled: +// if (r==rect()) // only draw on full redraw paintHLine(p, r.x(), r.x() + r.width(), height() - splitWidth); QPalette pl = nameEdit->palette(); pl.setColor(QPalette::Window, color); @@ -637,9 +638,10 @@ void TLWidget::paintEvent(QPaintEvent* ev) nameEdit->setPalette(pl); // The selected track will get a 4 pixel red bar to the left - if ( _track->selected() && r==rect() /* only draw on full redraw */) { +// if ( _track->selected() && r==rect() /* only draw on full redraw */) { + if ( _track->selected()) { QColor color(200,10,10); - QRect qr(0, 0, 4,r.height()-splitWidth); + QRect qr(0, 0, 4, r.height()-splitWidth); p.fillRect(qr, color); } } diff --git a/muse/muse/arranger/trackinfo.cpp b/muse/muse/arranger/trackinfo.cpp index fb0f3127..fb563b8a 100644 --- a/muse/muse/arranger/trackinfo.cpp +++ b/muse/muse/arranger/trackinfo.cpp @@ -62,6 +62,7 @@ TrackInfo* Arranger::createTrackInfo() TrackInfo::TrackInfo() : QWidget() { + track = 0; label = new QLabel; label->setToolTip(tr("Track Type")); label->setLineWidth(2); @@ -78,6 +79,7 @@ TrackInfo::TrackInfo() grid->addWidget(label, 0, 0, 1, 2); grid->addWidget(name, 1, 0, 1, 2); connect(name, SIGNAL(contentChanged(QString)), SLOT(nameChanged(QString))); + connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); resize(QSize(infoWidth, height())); } @@ -98,13 +100,11 @@ void TrackInfo::nameChanged(QString s) void TrackInfo::init(Track* t) { track = t; + if (t == 0) + return; label->setText(track->clname()); name->setText(track->name()); - // - //TD disconnect previous tracks - // connect(track, SIGNAL(nameChanged(const QString&)), name, SLOT(setText(const QString&))); - connect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int))); } //--------------------------------------------------------- @@ -113,7 +113,7 @@ void TrackInfo::init(Track* t) void TrackInfo::songChanged(int val) { - if (val & SC_ROUTE) + if ((val & SC_ROUTE) && track) init(track); } diff --git a/muse/muse/audio.cpp b/muse/muse/audio.cpp index d46786d7..2d25e61f 100644 --- a/muse/muse/audio.cpp +++ b/muse/muse/audio.cpp @@ -129,8 +129,9 @@ Audio::Audio() perror("creating pipe0"); fatalError("cannot create pipe0"); } - fromThreadFdw = filedes[1]; - fromThreadFdr = filedes[0]; + fromThreadFdw = filedes[1]; // blocking file descriptor + fromThreadFdr = filedes[0]; // non blocking file descriptor + int rv = fcntl(fromThreadFdw, F_SETFL, O_NONBLOCK); if (rv == -1) perror("set pipe O_NONBLOCK"); @@ -322,12 +323,10 @@ void Audio::process(unsigned frames) ++watchAudio; // make a simple watchdog happy if (msg) { -// printf("---msg\n"); - processMsg(msg); - int sn = msg->serialNo; + processMsg(); msg = 0; // dont process again - int rv = write(fromThreadFdw, &sn, sizeof(int)); - if (rv != sizeof(int)) { + int rv = write(fromThreadFdw, "x", 1); + if (rv != 1) { fprintf(stderr, "audio: write(%d) pipe failed: %s\n", fromThreadFdw, strerror(errno)); } @@ -566,11 +565,9 @@ printf("invalidate prefetch buffer\n"); // processMsg //--------------------------------------------------------- -void Audio::processMsg(AudioMsg* msg) +void Audio::processMsg() { -// if (_running) -// printf("audio process %d\n", msg->id); - +// printf("---msg %d\n", msg->id); switch(msg->id) { case AUDIO_ROUTEADD: addRoute(msg->sroute, msg->droute); diff --git a/muse/muse/audio.h b/muse/muse/audio.h index a4066b26..1012710d 100644 --- a/muse/muse/audio.h +++ b/muse/muse/audio.h @@ -178,7 +178,7 @@ class Audio { State state; - AudioMsg* msg; + AudioMsg* volatile msg; int fromThreadFdw, fromThreadFdr; // message pipe int sigFd; // pipe fd for messages to gui @@ -188,8 +188,8 @@ class Audio { void startRolling(); void stopRolling(); - void processMsg(AudioMsg* msg); void collectEvents(MidiTrack*, unsigned startTick, unsigned endTick); + void processMsg(); public: Audio(); diff --git a/muse/muse/conf.cpp b/muse/muse/conf.cpp index 29092f0a..3db8f3bc 100644 --- a/muse/muse/conf.cpp +++ b/muse/muse/conf.cpp @@ -27,7 +27,6 @@ #include "gconfig.h" #include "al/xml.h" #include "widgets/midisync.h" -// #include "genset.h" #include "sync.h" #include "mixer/mixer.h" #include "globals.h" diff --git a/muse/muse/mixer/mixer.cpp b/muse/muse/mixer/mixer.cpp index 16137697..dea62c5d 100644 --- a/muse/muse/mixer/mixer.cpp +++ b/muse/muse/mixer/mixer.cpp @@ -66,17 +66,6 @@ Mixer::Mixer(QWidget* parent, MixerConfig* c) showAuxTracksId->setCheckable(true); showSyntiTracksId->setCheckable(true); - showMidiTracksId->setChecked(cfg->showMidiTracks); - showMidiInPortId->setChecked(cfg->showMidiInPorts); - showMidiOutPortId->setChecked(cfg->showMidiOutPorts); - showMidiChannelId->setChecked(cfg->showMidiChannels); - showWaveTracksId->setChecked(cfg->showWaveTracks); - showOutputTracksId->setChecked(cfg->showOutputTracks); - showGroupTracksId->setChecked(cfg->showGroupTracks); - showInputTracksId->setChecked(cfg->showInputTracks); - showAuxTracksId->setChecked(cfg->showAuxTracks); - showSyntiTracksId->setChecked(cfg->showSyntiTracks); - QScrollArea* view = new QScrollArea; view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setCentralWidget(view); @@ -168,6 +157,17 @@ void Mixer::clear() void Mixer::updateMixer(int action) { + showMidiTracksId->setChecked(cfg->showMidiTracks); + showMidiInPortId->setChecked(cfg->showMidiInPorts); + showMidiOutPortId->setChecked(cfg->showMidiOutPorts); + showMidiChannelId->setChecked(cfg->showMidiChannels); + showWaveTracksId->setChecked(cfg->showWaveTracks); + showOutputTracksId->setChecked(cfg->showOutputTracks); + showGroupTracksId->setChecked(cfg->showGroupTracks); + showInputTracksId->setChecked(cfg->showInputTracks); + showAuxTracksId->setChecked(cfg->showAuxTracks); + showSyntiTracksId->setChecked(cfg->showSyntiTracks); + int auxsSize = song->auxs()->size(); if (action == STRIP_REMOVED && auxsSize == oldAuxsSize) { StripList::iterator si = stripList.begin(); diff --git a/muse/muse/seqmsg.cpp b/muse/muse/seqmsg.cpp index c4e947cc..70b088ef 100644 --- a/muse/muse/seqmsg.cpp +++ b/muse/muse/seqmsg.cpp @@ -41,26 +41,18 @@ void Audio::sendMsg(AudioMsg* m) { - static int sno = 0; - if (audioState == AUDIO_RUNNING) { - m->serialNo = sno++; - //DEBUG: msg = m; - // wait for next audio "process" call to finish operation - int no = -1; - int rv = read(fromThreadFdr, &no, sizeof(int)); - if (rv != sizeof(int)) + char c; + int rv = read(fromThreadFdr, &c, 1); + if (rv != 1) perror("Audio: read pipe failed"); - else if (no != (sno-1)) { - fprintf(stderr, "audio: bad serial number, read %d expected %d\n", - no, sno-1); - } } else { // if audio is not running (during initialization) // process commands immediatly - processMsg(m); + msg = m; + processMsg(); } } diff --git a/muse/muse/thread.cpp b/muse/muse/thread.cpp index e2039248..8291613b 100644 --- a/muse/muse/thread.cpp +++ b/muse/muse/thread.cpp @@ -258,7 +258,7 @@ void Thread::loop() } //--------------------------------------------------------- -// send +// sendMsg // send request from gui to thread // wait until request is processed //--------------------------------------------------------- @@ -300,7 +300,7 @@ bool Thread::sendMsg(const ThreadMsg* m) } //--------------------------------------------------------- -// send +// sendMsg1 // send request from gui to thread // do __not__ wait until request is processed //--------------------------------------------------------- diff --git a/muse/muse/track.h b/muse/muse/track.h index 2a051a06..78d445fe 100644 --- a/muse/muse/track.h +++ b/muse/muse/track.h @@ -164,6 +164,7 @@ class Track : public QObject { void setAutoWrite(bool); public: + Track(); Track(TrackType); virtual ~Track(); -- cgit v1.2.3