diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-02 22:38:52 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-02 22:38:52 +0000 |
commit | 458efa7b0c935cbaafa2791021a5f8f7241aa876 (patch) | |
tree | 624583f2873febe23770bee3fa94b5c24bd59f4f /src/sequencer | |
parent | 747037b72944ae2c02962b7c5c96e0a7f8852e38 (diff) | |
download | rosegarden-458efa7b0c935cbaafa2791021a5f8f7241aa876.tar.gz rosegarden-458efa7b0c935cbaafa2791021a5f8f7241aa876.zip |
Initial TQt4 port of Rosegarden
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/rosegarden@1230242 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/sequencer')
-rw-r--r-- | src/sequencer/ControlBlockMmapper.cpp | 6 | ||||
-rw-r--r-- | src/sequencer/MmappedSegment.cpp | 6 | ||||
-rw-r--r-- | src/sequencer/RosegardenSequencerApp.cpp | 84 | ||||
-rw-r--r-- | src/sequencer/RosegardenSequencerApp.h | 15 | ||||
-rw-r--r-- | src/sequencer/RosegardenSequencerIface.h | 2 | ||||
-rw-r--r-- | src/sequencer/SequencerMmapper.cpp | 6 | ||||
-rw-r--r-- | src/sequencer/main.cpp | 30 |
7 files changed, 75 insertions, 74 deletions
diff --git a/src/sequencer/ControlBlockMmapper.cpp b/src/sequencer/ControlBlockMmapper.cpp index 95f2a16..51389de 100644 --- a/src/sequencer/ControlBlockMmapper.cpp +++ b/src/sequencer/ControlBlockMmapper.cpp @@ -45,7 +45,7 @@ ControlBlockMmapper::ControlBlockMmapper(TQString fileName) m_fd = ::open(m_fileName.latin1(), O_RDWR); if (m_fd < 0) { - SEQMAN_DEBUG << "ControlBlockMmapper : Couldn't open " << m_fileName + SETQMAN_DEBUG << "ControlBlockMmapper : Couldn't open " << m_fileName << endl; throw Exception(std::string("Couldn't open ") + m_fileName.latin1()); @@ -60,12 +60,12 @@ ControlBlockMmapper::ControlBlockMmapper(TQString fileName) if (m_mmappedBuffer == (void*) - 1) { SEQUENCER_DEBUG << TQString("mmap failed : (%1) %2\n"). - arg(errno).arg(strerror(errno)); + tqarg(errno).tqarg(strerror(errno)); throw Exception("mmap failed"); } - SEQMAN_DEBUG << "ControlBlockMmapper : mmap size : " << m_mmappedSize + SETQMAN_DEBUG << "ControlBlockMmapper : mmap size : " << m_mmappedSize << " at " << (void*)m_mmappedBuffer << endl; // Create new control block on file diff --git a/src/sequencer/MmappedSegment.cpp b/src/sequencer/MmappedSegment.cpp index 2176bdd..2cdffe0 100644 --- a/src/sequencer/MmappedSegment.cpp +++ b/src/sequencer/MmappedSegment.cpp @@ -49,7 +49,7 @@ MmappedSegment::MmappedSegment(const TQString filename) bool MmappedSegment::isMetronome() { - return (getFileName().contains("metronome", false) > 0); + return (getFileName().tqcontains("metronome", false) > 0); } @@ -71,7 +71,7 @@ void MmappedSegment::map() if (m_mmappedRegion == (void*) - 1) { SEQUENCER_DEBUG << TQString("mmap failed : (%1) %2\n"). - arg(errno).arg(strerror(errno)); + tqarg(errno).tqarg(strerror(errno)); throw Exception("mmap failed"); } @@ -146,7 +146,7 @@ bool MmappedSegment::remap(size_t newSize) if (m_mmappedRegion == (void*) - 1) { SEQUENCER_DEBUG << TQString("mremap failed : (%1) %2\n"). - arg(errno).arg(strerror(errno)); + tqarg(errno).tqarg(strerror(errno)); throw Exception("mremap failed"); } diff --git a/src/sequencer/RosegardenSequencerApp.cpp b/src/sequencer/RosegardenSequencerApp.cpp index 179820f..0aabda1 100644 --- a/src/sequencer/RosegardenSequencerApp.cpp +++ b/src/sequencer/RosegardenSequencerApp.cpp @@ -66,7 +66,7 @@ namespace Rosegarden RosegardenSequencerApp::RosegardenSequencerApp() : DCOPObject("RosegardenSequencerIface"), m_driver(0), - m_transportStatus(STOPPED), + m_transporttqStatus(STOPPED), m_songPosition(0, 0), m_lastFetchSongPosition(0, 0), m_readAhead(0, 80000000), // default value @@ -143,7 +143,7 @@ RosegardenSequencerApp::quit() close(); // and break out of the loop next time around - m_transportStatus = QUIT; + m_transporttqStatus = TQUIT; } @@ -152,7 +152,7 @@ RosegardenSequencerApp::stop() { // set our state at this level to STOPPING (pending any // unfinished NOTES) - m_transportStatus = STOPPING; + m_transporttqStatus = STOPPING; // report // @@ -186,7 +186,7 @@ RosegardenSequencerApp::fetchEvents(MappedComposition &composition, { // Always return nothing if we're stopped // - if ( m_transportStatus == STOPPED || m_transportStatus == STOPPING ) + if ( m_transporttqStatus == STOPPED || m_transporttqStatus == STOPPING ) return ; // If we're looping then we should get as much of the rest of @@ -361,8 +361,8 @@ RosegardenSequencerApp::updateClocks() // If we're not playing etc. then that's all we need to do // - if (m_transportStatus != PLAYING && - m_transportStatus != RECORDING) + if (m_transporttqStatus != PLAYING && + m_transporttqStatus != RECORDING) return ; RealTime newPosition = m_driver->getSequencerTime(); @@ -409,19 +409,19 @@ RosegardenSequencerApp::updateClocks() } void -RosegardenSequencerApp::notifySequencerStatus() +RosegardenSequencerApp::notifySequencertqStatus() { TQByteArray data, replyData; TQCString replyType; TQDataStream arg(data, IO_WriteOnly); - arg << (int)m_transportStatus; + arg << (int)m_transporttqStatus; if (!kapp->dcopClient()->send(ROSEGARDEN_GUI_APP_NAME, ROSEGARDEN_GUI_IFACE_NAME, - "notifySequencerStatus(int)", + "notifySequencertqStatus(int)", data)) { - SEQUENCER_DEBUG << "RosegardenSequencer::notifySequencerStatus()" + SEQUENCER_DEBUG << "RosegardenSequencer::notifySequencertqStatus()" << " - can't send to RosegardenGUI client" << endl; @@ -645,12 +645,12 @@ RosegardenSequencerApp::record(const RealTime &time, long smallFileSize, long recordMode) { - TransportStatus localRecordMode = (TransportStatus) recordMode; + TransporttqStatus localRecordMode = (TransporttqStatus) recordMode; - SEQUENCER_DEBUG << "RosegardenSequencerApp::record - recordMode is " << recordMode << ", transport status is " << m_transportStatus << endl; + SEQUENCER_DEBUG << "RosegardenSequencerApp::record - recordMode is " << recordMode << ", transport status is " << m_transporttqStatus << endl; // punch in recording - if (m_transportStatus == PLAYING) { + if (m_transporttqStatus == PLAYING) { if (localRecordMode == STARTING_TO_RECORD) { SEQUENCER_DEBUG << "RosegardenSequencerApp::record: punching in" << endl; localRecordMode = RECORDING; // no need to start playback @@ -758,7 +758,7 @@ RosegardenSequencerApp::record(const RealTime &time, // Now set the local transport status to the record mode // // - m_transportStatus = localRecordMode; + m_transporttqStatus = localRecordMode; if (localRecordMode == RECORDING) { // punch in return 1; @@ -787,14 +787,14 @@ RosegardenSequencerApp::play(const RealTime &time, const RealTime &audioWrite, long smallFileSize) { - if (m_transportStatus == PLAYING || - m_transportStatus == STARTING_TO_PLAY) + if (m_transporttqStatus == PLAYING || + m_transporttqStatus == STARTING_TO_PLAY) return true; // Check for record toggle (punch out) // - if (m_transportStatus == RECORDING) { - m_transportStatus = PLAYING; + if (m_transporttqStatus == RECORDING) { + m_transporttqStatus = PLAYING; return punchOut(); } @@ -809,9 +809,9 @@ RosegardenSequencerApp::play(const RealTime &time, (m_songPosition); } - if (m_transportStatus != RECORDING && - m_transportStatus != STARTING_TO_RECORD) { - m_transportStatus = STARTING_TO_PLAY; + if (m_transporttqStatus != RECORDING && + m_transporttqStatus != STARTING_TO_RECORD) { + m_transporttqStatus = STARTING_TO_PLAY; } m_driver->stopClocks(); @@ -898,9 +898,9 @@ RosegardenSequencerApp::punchOut() { // Check for record toggle (punch out) // - if (m_transportStatus == RECORDING) { + if (m_transporttqStatus == RECORDING) { m_driver->punchOut(); - m_transportStatus = PLAYING; + m_transporttqStatus = PLAYING; return true; } return false; @@ -943,7 +943,7 @@ void RosegardenSequencerApp::cleanupMmapData() void RosegardenSequencerApp::remapSegment(const TQString& filename, size_t newSize) { - if (m_transportStatus != PLAYING) + if (m_transporttqStatus != PLAYING) return ; SEQUENCER_DEBUG << "RosegardenSequencerApp::remapSegment(" << filename << ")\n"; @@ -955,7 +955,7 @@ void RosegardenSequencerApp::remapSegment(const TQString& filename, size_t newSi void RosegardenSequencerApp::addSegment(const TQString& filename) { - if (m_transportStatus != PLAYING) + if (m_transporttqStatus != PLAYING) return ; SEQUENCER_DEBUG << "MmappedSegment::addSegment(" << filename << ")\n"; @@ -968,7 +968,7 @@ void RosegardenSequencerApp::addSegment(const TQString& filename) void RosegardenSequencerApp::deleteSegment(const TQString& filename) { - if (m_transportStatus != PLAYING) + if (m_transporttqStatus != PLAYING) return ; SEQUENCER_DEBUG << "MmappedSegment::deleteSegment(" << filename << ")\n"; @@ -1097,18 +1097,18 @@ RosegardenSequencerApp::setLoop(long loopStartSec, // Return the status of the sound systems (audio and MIDI) // unsigned int -RosegardenSequencerApp::getSoundDriverStatus(const TQString &guiVersion) +RosegardenSequencerApp::getSoundDrivertqStatus(const TQString &guiVersion) { - unsigned int driverStatus = m_driver->getStatus(); + unsigned int drivertqStatus = m_driver->gettqStatus(); if (guiVersion == VERSION) - driverStatus |= VERSION_OK; + drivertqStatus |= VERSION_OK; else { - std::cerr << "WARNING: RosegardenSequencerApp::getSoundDriverStatus: " + std::cerr << "WARNING: RosegardenSequencerApp::getSoundDrivertqStatus: " << "GUI version \"" << guiVersion << "\" does not match sequencer version \"" << VERSION << "\"" << std::endl; } - return driverStatus; + return drivertqStatus; } @@ -1250,7 +1250,7 @@ RosegardenSequencerApp::getConnections(int type, unsigned int direction) (MidiDevice::DeviceDirection)direction); } -QString +TQString RosegardenSequencerApp::getConnection(int type, unsigned int direction, unsigned int connectionNo) { @@ -1279,13 +1279,13 @@ RosegardenSequencerApp::getTimers() return m_driver->getTimers(); } -QString +TQString RosegardenSequencerApp::getTimer(unsigned int n) { return m_driver->getTimer(n); } -QString +TQString RosegardenSequencerApp::getCurrentTimer() { return m_driver->getCurrentTimer(); @@ -1483,7 +1483,7 @@ RosegardenSequencerApp::getPluginInformation() return list; } -QString +TQString RosegardenSequencerApp::getPluginProgram(int id, int bank, int program) { MappedObject *object = m_studio->getObjectById(id); @@ -1561,8 +1561,8 @@ RosegardenSequencerApp::connectMappedObjects(int id1, int id2) // When this happens we need to resynchronise our audio processing, // and this is the easiest (and most brutal) way to do it. - if (m_transportStatus == PLAYING || - m_transportStatus == RECORDING) { + if (m_transporttqStatus == PLAYING || + m_transporttqStatus == RECORDING) { RealTime seqTime = m_driver->getSequencerTime(); jumpTo(seqTime.sec, seqTime.nsec); } @@ -1637,8 +1637,8 @@ RosegardenSequencerApp::slotCheckForNewClients() { // Don't do this check if any of these conditions hold // - if (m_transportStatus == PLAYING || - m_transportStatus == RECORDING) + if (m_transporttqStatus == PLAYING || + m_transporttqStatus == RECORDING) return ; if (m_driver->checkForNewClients()) { @@ -1659,7 +1659,7 @@ RosegardenSequencerApp::setQuarterNoteLength(long timeSec, long timeNSec) RealTime(timeSec, timeNSec) / 24); } -QString +TQString RosegardenSequencerApp::getStatusLog() { return m_driver->getStatusLog(); @@ -1795,8 +1795,8 @@ RosegardenSequencerApp::checkExternalTransport() "jumpToTime(int, int)", data); - if (m_transportStatus == PLAYING || - m_transportStatus != RECORDING) { + if (m_transporttqStatus == PLAYING || + m_transporttqStatus != RECORDING) { jumpTo(pair.second.sec, pair.second.usec() * 1000); } diff --git a/src/sequencer/RosegardenSequencerApp.h b/src/sequencer/RosegardenSequencerApp.h index 72208d3..0926911 100644 --- a/src/sequencer/RosegardenSequencerApp.h +++ b/src/sequencer/RosegardenSequencerApp.h @@ -34,7 +34,7 @@ // -// include files for Qt +// include files for TQt #include <tqstrlist.h> // include files for KDE @@ -80,6 +80,7 @@ class RosegardenSequencerApp : public KMainWindow, public ExternalTransport { Q_OBJECT + TQ_OBJECT public: RosegardenSequencerApp(); @@ -161,7 +162,7 @@ public: // Return the Sound system status (audio/MIDI) // - virtual unsigned int getSoundDriverStatus(const TQString &guiVersion); + virtual unsigned int getSoundDrivertqStatus(const TQString &guiVersion); // Add and remove Audio files on the sequencer // @@ -329,9 +330,9 @@ public: - void setStatus(TransportStatus status) - { m_transportStatus = status; } - TransportStatus getStatus() { return m_transportStatus; } + void settqStatus(TransporttqStatus status) + { m_transporttqStatus = status; } + TransporttqStatus gettqStatus() { return m_transporttqStatus; } // Process the first chunk of Sequencer events bool startPlaying(); @@ -345,7 +346,7 @@ public: bool checkExternalTransport(); // Sends status changes up to GUI - void notifySequencerStatus(); + void notifySequencertqStatus(); // Send latest slice information back to GUI for display void notifyVisuals(MappedComposition *mC); @@ -460,7 +461,7 @@ protected: //--------------- Data members --------------------------------- SoundDriver *m_driver; - TransportStatus m_transportStatus; + TransporttqStatus m_transporttqStatus; // Position pointer RealTime m_songPosition; diff --git a/src/sequencer/RosegardenSequencerIface.h b/src/sequencer/RosegardenSequencerIface.h index ac401ae..f66c7e8 100644 --- a/src/sequencer/RosegardenSequencerIface.h +++ b/src/sequencer/RosegardenSequencerIface.h @@ -104,7 +104,7 @@ public: // Get the status of the Sequencer // - virtual unsigned int getSoundDriverStatus(const TQString &guiVersion) = 0; + virtual unsigned int getSoundDrivertqStatus(const TQString &guiVersion) = 0; // Add and delete audio files on the Sequencer // diff --git a/src/sequencer/SequencerMmapper.cpp b/src/sequencer/SequencerMmapper.cpp index 047878f..bc34642 100644 --- a/src/sequencer/SequencerMmapper.cpp +++ b/src/sequencer/SequencerMmapper.cpp @@ -67,7 +67,7 @@ SequencerMmapper::SequencerMmapper(): if (m_fd < 0) { SEQUENCER_DEBUG << "SequencerMmapper : Couldn't open " << m_fileName << endl; - throw Exception("Couldn't open " + std::string(m_fileName.data())); + throw Exception("Couldn't open " + std::string(m_fileName.ascii())); } setFileSize(m_mmappedSize); @@ -81,7 +81,7 @@ SequencerMmapper::SequencerMmapper(): if (m_mmappedBuffer == (void*) - 1) { SEQUENCER_DEBUG << - TQString("mmap failed : (%1) %2\n").arg(errno).arg(strerror(errno)); + TQString("mmap failed : (%1) %2\n").tqarg(errno).tqarg(strerror(errno)); throw Exception("mmap failed"); } @@ -135,7 +135,7 @@ SequencerMmapper::setFileSize(size_t size) } } -QString +TQString SequencerMmapper::createFileName() { return KGlobal::dirs()->resourceDirs("tmp").last() + diff --git a/src/sequencer/main.cpp b/src/sequencer/main.cpp index dd97510..3b6daec 100644 --- a/src/sequencer/main.cpp +++ b/src/sequencer/main.cpp @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) srandom((unsigned int)time(0) * (unsigned int)getpid()); // Block signals during startup, so that child threads (inheriting - // this mask) ignore them; then after startup we can unblock them + // this tqmask) ignore them; then after startup we can unblock them // for this thread only. This trick picked up from the jackd code. sigemptyset (&_signals); sigaddset(&_signals, SIGHUP); @@ -131,21 +131,21 @@ int main(int argc, char *argv[]) // make sure the loop doesn't eat up all the // processor - we're not in that much of a rush! // - TransportStatus lastSeqStatus = roseSeq->getStatus(); + TransporttqStatus lastSeqtqStatus = roseSeq->gettqStatus(); RealTime sleepTime = RealTime(0, 10000000); - while (!_exiting && roseSeq && roseSeq->getStatus() != QUIT) { + while (!_exiting && roseSeq && roseSeq->gettqStatus() != TQUIT) { bool atLeisure = true; - switch (roseSeq->getStatus()) { + switch (roseSeq->gettqStatus()) { case STARTING_TO_PLAY: if (!roseSeq->startPlaying()) { // send result failed and stop Sequencer - roseSeq->setStatus(STOPPING); + roseSeq->settqStatus(STOPPING); } else { - roseSeq->setStatus(PLAYING); + roseSeq->settqStatus(PLAYING); } break; @@ -153,7 +153,7 @@ int main(int argc, char *argv[]) if (!roseSeq->keepPlaying()) { // there's a problem or the piece has // finished - so stop playing - roseSeq->setStatus(STOPPING); + roseSeq->settqStatus(STOPPING); } else { // process any async events // @@ -163,9 +163,9 @@ int main(int argc, char *argv[]) case STARTING_TO_RECORD: if (!roseSeq->startPlaying()) { - roseSeq->setStatus(STOPPING); + roseSeq->settqStatus(STOPPING); } else { - roseSeq->setStatus(RECORDING); + roseSeq->settqStatus(RECORDING); } break; @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) if (!roseSeq->keepPlaying()) { // there's a problem or the piece has // finished - so stop playing - roseSeq->setStatus(STOPPING); + roseSeq->settqStatus(STOPPING); } else { // Now process any incoming MIDI events // and return them to the gui @@ -196,7 +196,7 @@ int main(int argc, char *argv[]) // There's no call to roseSeq to actually process the // stop, because this arises from a DCOP call from the GUI // direct to roseSeq to start with - roseSeq->setStatus(STOPPED); + roseSeq->settqStatus(STOPPED); SEQUENCER_DEBUG << "RosegardenSequencer - Stopped" << endl; break; @@ -226,10 +226,10 @@ int main(int argc, char *argv[]) // we want to process transport changes immediately if (roseSeq->checkExternalTransport()) { atLeisure = false; - } else if (lastSeqStatus != roseSeq->getStatus()) { - SEQUENCER_DEBUG << "Sequencer status changed from " << lastSeqStatus << " to " << roseSeq->getStatus() << endl; - roseSeq->notifySequencerStatus(); - lastSeqStatus = roseSeq->getStatus(); + } else if (lastSeqtqStatus != roseSeq->gettqStatus()) { + SEQUENCER_DEBUG << "Sequencer status changed from " << lastSeqtqStatus << " to " << roseSeq->gettqStatus() << endl; + roseSeq->notifySequencertqStatus(); + lastSeqtqStatus = roseSeq->gettqStatus(); atLeisure = false; } |