[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src common/Tsar.cpp common/Tsar.h core...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src common/Tsar.cpp common/Tsar.h core... |
Date: |
Mon, 11 Feb 2008 10:11:53 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 08/02/11 10:11:53
Modified files:
src/common : Tsar.cpp Tsar.h
src/core : InputEngine.cpp
Log message:
* empty the Tsar event buffer more quickly up to 50 events at a time to
avoid overflowing the buffer to quickly. Since tsar event processing has become
so fast due using APILinkedList, this can be done without overloading the real
time thread.
* add_event returns a bool now, to indicate success of adding the event.
THREAD_SAVE_INVOKE loops now on trying to add new events. (else we'll
loose events in very rare cases which we do not want)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/common/Tsar.cpp?cvsroot=traverso&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/traverso/src/common/Tsar.h?cvsroot=traverso&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/InputEngine.cpp?cvsroot=traverso&r1=1.67&r2=1.68
Patches:
Index: common/Tsar.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/common/Tsar.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- common/Tsar.cpp 11 Dec 2007 17:30:11 -0000 1.3
+++ common/Tsar.cpp 11 Feb 2008 10:11:52 -0000 1.4
@@ -17,12 +17,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: Tsar.cpp,v 1.3 2007/12/11 17:30:11 r_sijrier Exp $
+$Id: Tsar.cpp,v 1.4 2008/02/11 10:11:52 r_sijrier Exp $
*/
#include "Tsar.h"
#include "AudioDevice.h"
+#include "InputEngine.h"
#include <QMetaMethod>
#include <QMessageBox>
#include <QCoreApplication>
@@ -59,6 +60,7 @@
m_events.append(new RingBufferNPT<TsarEvent>(1000));
m_events.append(new RingBufferNPT<TsarEvent>(100));
oldEvents = new RingBufferNPT<TsarEvent>(1000);
+ m_retryCount = 0;
#if defined (THREAD_CHECK)
m_threadId = QThread::currentThreadId ();
@@ -84,13 +86,17 @@
* Note: This function should be called ONLY from the GUI thread!
* @param event The event to add to the event queue
*/
-void Tsar::add_event(TsarEvent& event )
+bool Tsar::add_event(TsarEvent& event )
{
#if defined (THREAD_CHECK)
Q_ASSERT_X(m_threadId == QThread::currentThreadId (),
"Tsar::add_event", "Adding event from other then GUI thread!!");
#endif
- m_events.at(0)->write(&event, 1);
+ if (m_events.at(0)->write(&event, 1) == 1) {
m_eventCounter++;
+ return true;
+ }
+ m_retryCount = 0;
+ return false;
}
/**
@@ -123,7 +129,7 @@
int processedCount = 0;
int newEventCount = newEvents->read_space();
- while((newEventCount > 0) && (processedCount < 10)) {
+ while((newEventCount > 0) && (processedCount < 50)) {
#if defined (profile)
trav_time_t starttime = get_microseconds();
#endif
@@ -163,11 +169,13 @@
// printf("finish_processed_objects:: Count is %d\n",
m_eventCounter);
}
- static int retryCount;
+ m_retryCount++;
- retryCount++;
+ if (m_retryCount > 200) {
+ if (ie().is_holding()) {
+ ie().suspend();
+ }
- if (retryCount > 100) {
if (audiodevice().get_driver_type() != "Null Driver") {
QMessageBox::critical( 0,
tr("Traverso - Malfunction!"),
@@ -181,7 +189,7 @@
"OK",
0 );
audiodevice().set_parameters(44100, 1024, "Null
Driver", true, true);
- retryCount = 0;
+ m_retryCount = 0;
} else {
QMessageBox::critical( 0,
tr("Traverso - Fatal!"),
@@ -193,7 +201,7 @@
}
if (m_eventCounter <= 0) {
- retryCount = 0;
+ m_retryCount = 0;
}
}
Index: common/Tsar.h
===================================================================
RCS file: /sources/traverso/traverso/src/common/Tsar.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- common/Tsar.h 11 Dec 2007 17:30:11 -0000 1.3
+++ common/Tsar.h 11 Feb 2008 10:11:52 -0000 1.4
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: Tsar.h,v 1.3 2007/12/11 17:30:11 r_sijrier Exp $
+$Id: Tsar.h,v 1.4 2008/02/11 10:11:52 r_sijrier Exp $
*/
#ifndef TSAR_H
@@ -30,7 +30,7 @@
#define THREAD_SAVE_INVOKE(caller, argument, slotSignature) { \
TsarEvent event = tsar().create_event(caller, argument,
#slotSignature, ""); \
- tsar().add_event(event);\
+ while (!tsar().add_event(event)) { printf("THREAD_SAVE_INVOKE:
failed to add event, trying again\n");} \
}
#define RT_THREAD_EMIT(cal, arg, signalSignature) {\
@@ -78,7 +78,7 @@
public:
TsarEvent create_event(QObject* caller, void* argument, const char*
slotSignature, const char* signalSignature);
- void add_event(TsarEvent& event);
+ bool add_event(TsarEvent& event);
void add_rt_event(TsarEvent& event);
void process_event_slot(const TsarEvent& event);
void process_event_signal(const TsarEvent& event);
@@ -99,6 +99,8 @@
RingBufferNPT<TsarEvent>* oldEvents;
QTimer finishOldEventsTimer;
int m_eventCounter;
+ int m_retryCount;
+
#if defined (THREAD_CHECK)
unsigned long m_threadId;
#endif
Index: core/InputEngine.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/InputEngine.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- core/InputEngine.cpp 21 Jan 2008 16:22:14 -0000 1.67
+++ core/InputEngine.cpp 11 Feb 2008 10:11:52 -0000 1.68
@@ -227,6 +227,7 @@
{
PENTER3;
active=false;
+ set_jogging(false);
}
int InputEngine::broadcast_action_from_contextmenu(const QString& keySequence)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src common/Tsar.cpp common/Tsar.h core...,
Remon Sijrier <=