Browse Source

XYController: Fix cursor stuck when sending too many data

tags/v0.9.0
falkTX 13 years ago
parent
commit
d1698206a6
3 changed files with 20 additions and 15 deletions
  1. +1
    -1
      c++/jack_utils.h
  2. +10
    -8
      c++/widgets/pixmapdial.h
  3. +9
    -6
      c++/xycontroller/xycontroller.cpp

+ 1
- 1
c++/jack_utils.h View File

@@ -23,7 +23,7 @@
#include <jack/transport.h> #include <jack/transport.h>


#ifdef HAVE_JACKSESSION #ifdef HAVE_JACKSESSION
#include <jack/session.h>
# include <jack/session.h>
#endif #endif


#include <cstring> #include <cstring>


+ 10
- 8
c++/widgets/pixmapdial.h View File

@@ -24,11 +24,6 @@
class PixmapDial : public QDial class PixmapDial : public QDial
{ {
public: public:
enum Orientation {
HORIZONTAL = 0,
VERTICAL = 1
};

enum CustomPaint { enum CustomPaint {
CUSTOM_PAINT_NULL = 0, CUSTOM_PAINT_NULL = 0,
CUSTOM_PAINT_CARLA_WET = 1, CUSTOM_PAINT_CARLA_WET = 1,
@@ -57,6 +52,16 @@ protected:
void resizeEvent(QResizeEvent* event); void resizeEvent(QResizeEvent* event);


private: private:
enum Orientation {
HORIZONTAL = 0,
VERTICAL = 1
};

static const unsigned short HOVER_MIN = 0;
static const unsigned short HOVER_MAX = 9;

// -------------------------------------

QPixmap m_pixmap; QPixmap m_pixmap;
QString m_pixmap_n_str; QString m_pixmap_n_str;


@@ -79,9 +84,6 @@ private:
QColor m_colorT[2]; QColor m_colorT[2];


int p_width, p_height, p_size, p_count; int p_width, p_height, p_size, p_count;

static const unsigned short HOVER_MIN = 0;
static const unsigned short HOVER_MAX = 9;
}; };


#endif // PIXMAPDIAL_H #endif // PIXMAPDIAL_H

+ 9
- 6
c++/xycontroller/xycontroller.cpp View File

@@ -56,24 +56,27 @@ public:


void copyDataFrom(Queue* queue) void copyDataFrom(Queue* queue)
{ {
mutex.lock();
// lock mutexes
queue->mutex.lock(); queue->mutex.lock();
mutex.lock();


// copy data from queue // copy data from queue
memcpy(data, queue->data, sizeof(datatype)*MAX_SIZE); memcpy(data, queue->data, sizeof(datatype)*MAX_SIZE);
index = queue->index;
empty = queue->empty; empty = queue->empty;
full = queue->full; full = queue->full;


// unlock our mutex, no longer needed
mutex.unlock();

// reset queque // reset queque
memset(queue->data, 0, sizeof(datatype)*MAX_SIZE); memset(queue->data, 0, sizeof(datatype)*MAX_SIZE);
queue->index = 0;
queue->empty = true; queue->empty = true;
queue->full = false; queue->full = false;


// reset indexes
index = queue->index = 0;

// unlock queque mutex
queue->mutex.unlock(); queue->mutex.unlock();
mutex.unlock();
} }


bool isEmpty() bool isEmpty()
@@ -133,7 +136,7 @@ public:
if (lock) if (lock)
mutex.lock(); mutex.lock();


full = false;
full = false;


if (data[index].d1 == 0) if (data[index].d1 == 0)
{ {


Loading…
Cancel
Save