[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/kmid/alsa
From:       Pedro Lopez-Cabanillas <pedro.lopez.cabanillas () gmail ! com>
Date:       2010-06-07 12:12:00
Message-ID: 20100607121200.38F70AC8CE () svn ! kde ! org
[Download RAW message or body]

SVN commit 1135471 by pedrol:

Player object signals should be always queued to other objects.

CCBUG: 240391

 M  +6 -4      alsamidiobject.cpp  
 M  +3 -3      alsamidioutput.cpp  
 M  +3 -1      player.cpp  


--- trunk/extragear/multimedia/kmid/alsa/alsamidiobject.cpp #1135470:1135471
@@ -31,6 +31,7 @@
 #include <QTextCodec>
 #include <QTime>
 #include <QMutex>
+#include <QMutexLocker>
 #include <KIO/NetAccess>
 
 using namespace drumstick;
@@ -168,8 +169,10 @@
         d->m_port->setTimestampQueue(d->m_queueId);
         d->m_port->subscribeFromAnnounce();
         d->m_player = new Player(d->m_client, d->m_portId);
-        connect(d->m_player, SIGNAL(finished()), SLOT(songFinished()));
-        connect(d->m_player, SIGNAL(stopped()), d->m_out, SLOT(allNotesOff()));
+        connect( d->m_player, SIGNAL(finished()),
+                 SLOT(songFinished()), Qt::QueuedConnection );
+        connect( d->m_player, SIGNAL(stopped()),
+                 d->m_out, SLOT(allNotesOff()), Qt::QueuedConnection );
         d->m_client->setHandler(this);
         d->m_client->startSequencerInput();
     }
@@ -650,8 +653,8 @@
 
     void ALSAMIDIObject::openFile(const QString &fileName)
     {
+        QMutexLocker locker(&d->m_openMutex);
         QString tmpFile;
-        d->m_openMutex.lock();
         if(KIO::NetAccess::download(fileName, tmpFile, 0)) {
             updateState( LoadingState );
             d->m_song.clear();
@@ -695,7 +698,6 @@
             d->m_loadingMessages << KIO::NetAccess::lastErrorString();
             updateState( ErrorState );
         }
-        d->m_openMutex.unlock();
     }
 
     void ALSAMIDIObject::songFinished()
--- trunk/extragear/multimedia/kmid/alsa/alsamidioutput.cpp #1135470:1135471
@@ -28,6 +28,7 @@
 #include <QString>
 #include <QStringList>
 #include <QMutex>
+#include <QMutexLocker>
 
 using namespace drumstick;
 
@@ -366,12 +367,12 @@
 
     void ALSAMIDIOutput::sendEvent(SequencerEvent *ev)
     {
-        d->m_outMutex.lock();
+        QMutexLocker locker(&d->m_outMutex);
         d->transformEvent(ev);
         bool discard(false);
         if (SequencerEvent::isChannel(ev)) {
             ChannelEvent *cev = static_cast<ChannelEvent*>(ev);
-            discard = d->m_muted[ cev->getChannel() ] |
+            discard = d->m_muted[ cev->getChannel() ] ||
                       ( (cev->getSequencerType() == SND_SEQ_EVENT_PGMCHANGE)
                          && d->m_locked[ cev->getChannel() ] );
         }
@@ -381,7 +382,6 @@
             ev->setDirect();
             d->m_client->outputDirect(ev);
         }
-        d->m_outMutex.unlock();
     }
 
     void ALSAMIDIOutput::sendNoteOn(int chan, int note, int vel)
--- trunk/extragear/multimedia/kmid/alsa/player.cpp #1135470:1135471
@@ -28,7 +28,9 @@
         m_songIterator(0),
         m_songPosition(0),
         m_echoResolution(0)
-    { }
+    {
+        moveToThread(this);
+    }
 
     Player::~Player()
     {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic