Browse Source

Slightly better mini-canvas look; RtAudio fixes

tags/1.9.4
falkTX 11 years ago
parent
commit
27ce5f027f
5 changed files with 56 additions and 20 deletions
  1. +3
    -0
      resources/ui/carla.ui
  2. +17
    -11
      source/backend/engine/CarlaEngineRtAudio.cpp
  3. +6
    -2
      source/carla.py
  4. +2
    -2
      source/utils/CarlaBackendUtils.hpp
  5. +28
    -5
      source/widgets/canvaspreviewframe.py

+ 3
- 0
resources/ui/carla.ui View File

@@ -141,6 +141,9 @@
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QTabWidget" name="tabUtils">
<property name="sizePolicy">


+ 17
- 11
source/backend/engine/CarlaEngineRtAudio.cpp View File

@@ -38,14 +38,8 @@ static std::vector<RtAudio::Api> gRtAudioApis;

static void initRtApis()
{
static bool initiated = false;

if (! initiated)
{
initiated = true;

if (gRtAudioApis.size() == 0)
RtAudio::getCompiledApi(gRtAudioApis);
}
}

RtMidi::Api getMatchedAudioMidiAPi(const RtAudio::Api rtApi)
@@ -791,7 +785,7 @@ protected:
CARLA_ASSERT(nframes == fBufferSize);
CARLA_ASSERT(outsPtr != nullptr);

if (kData->curPluginCount == 0 || ! (fAudioIsReady && fConnectAudioLock.tryLock()))
if (kData->curPluginCount == 0 || ! fAudioIsReady)
{
carla_zeroFloat(outsPtr, nframes*fAudioCountOut);
return proccessPendingEvents();
@@ -842,7 +836,9 @@ protected:
engineEvent.channel = midiChannel;

if (midiEvent.time < fTimeInfo.frame)
{
engineEvent.time = 0;
}
else if (midiEvent.time >= fTimeInfo.frame + nframes)
{
engineEvent.time = fTimeInfo.frame + nframes-1;
@@ -851,8 +847,6 @@ protected:
else
engineEvent.time = midiEvent.time - fTimeInfo.frame;

carla_stdout("Got midi, time %f vs %i", midiEvent.time, engineEvent.time);

if (MIDI_IS_STATUS_CONTROL_CHANGE(midiStatus))
{
const uint8_t midiControl = midiEvent.data[1];
@@ -914,6 +908,8 @@ protected:
fMidiInEvents.mutex.unlock();
}

fConnectAudioLock.lock();

// connect input buffers
if (fConnectedAudioIns[0].count() == 0)
{
@@ -982,6 +978,17 @@ protected:
}
}

if (fConnectedAudioOuts[1].count() != 0)
{
for (auto it = fConnectedAudioOuts[1].begin(); it.valid(); it.next())
{
const uint& port(*it);
CARLA_ASSERT(port < fAudioCountOut);

carla_addFloat(fAudioBufOut[port], fAudioBufRackOut[1], nframes);
}
}

fConnectAudioLock.unlock();

// output audio
@@ -1008,7 +1015,6 @@ protected:
}

proccessPendingEvents();

return;

// unused


+ 6
- 2
source/carla.py View File

@@ -752,7 +752,7 @@ class CarlaMainW(QMainWindow):

self.ui.miniCanvasPreview.setRealParent(self)
self.ui.miniCanvasPreview.setViewTheme(patchcanvas.canvas.theme.canvas_bg, patchcanvas.canvas.theme.rubberband_brush, patchcanvas.canvas.theme.rubberband_pen.color())
self.ui.miniCanvasPreview.init(self.scene, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT)
self.ui.miniCanvasPreview.init(self.scene, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT, self.fSavedSettings["UseCustomMiniCanvasPaint"])
QTimer.singleShot(100, self, SLOT("slot_miniCanvasInit()"))

# -------------------------------------------------------------
@@ -1953,6 +1953,9 @@ class CarlaMainW(QMainWindow):
}
""" % (col1, col2))

useCustomMiniCanvasPaint = bool(settings.value("Main/UseProTheme", True, type=bool) and
settings.value("Main/ProThemeColor", "Black", type=str) == "Black")

self.fSavedSettings = {
"Main/DefaultProjectFolder": settings.value("Main/DefaultProjectFolder", HOME, type=str),
"Main/RefreshInterval": settings.value("Main/RefreshInterval", 50, type=int),
@@ -1962,7 +1965,8 @@ class CarlaMainW(QMainWindow):
"Canvas/EyeCandy": settings.value("Canvas/EyeCandy", patchcanvas.EYECANDY_SMALL, type=int),
"Canvas/UseOpenGL": settings.value("Canvas/UseOpenGL", False, type=bool),
"Canvas/Antialiasing": settings.value("Canvas/Antialiasing", patchcanvas.ANTIALIASING_SMALL, type=int),
"Canvas/HighQualityAntialiasing": settings.value("Canvas/HighQualityAntialiasing", False, type=bool)
"Canvas/HighQualityAntialiasing": settings.value("Canvas/HighQualityAntialiasing", False, type=bool),
"UseCustomMiniCanvasPaint": useCustomMiniCanvasPaint
}

# ---------------------------------------------


+ 2
- 2
source/utils/CarlaBackendUtils.hpp View File

@@ -448,7 +448,7 @@ static inline
PluginType getPluginTypeFromString(const char* const stype)
{
CARLA_ASSERT(stype != nullptr);
carla_debug("CarlaBackend::getPluginTypeFromString(%s)", stype);
carla_debug("CarlaBackend::getPluginTypeFromString(\"%s\")", stype);

if (stype == nullptr)
{
@@ -477,7 +477,7 @@ PluginType getPluginTypeFromString(const char* const stype)
if (std::strcmp(stype, "SFZ") == 0)
return PLUGIN_SFZ;

carla_stderr("CarlaBackend::getPluginTypeFromString(%s) - invalid string type", stype);
carla_stderr("CarlaBackend::getPluginTypeFromString(\"%s\") - invalid string type", stype);
return PLUGIN_NONE;
}



+ 28
- 5
source/widgets/canvaspreviewframe.py View File

@@ -37,6 +37,8 @@ class CanvasPreviewFrame(QFrame):
def __init__(self, parent):
QFrame.__init__(self, parent)

self.fUseCustomPaint = False

self.fMouseDown = False

self.fViewBg = QColor(0, 0, 0)
@@ -56,7 +58,7 @@ class CanvasPreviewFrame(QFrame):
self.fViewPadY = 0.0
self.fViewRect = [0.0, 0.0, 10.0, 10.0]

def init(self, scene, realWidth, realHeight):
def init(self, scene, realWidth, realHeight, useCustomPaint):
padding = 6

self.fScene = scene
@@ -69,6 +71,10 @@ class CanvasPreviewFrame(QFrame):
self.fRenderTarget.setWidth(realWidth)
self.fRenderTarget.setHeight(realHeight)

if self.fUseCustomPaint != useCustomPaint:
self.fUseCustomPaint = useCustomPaint
self.repaint()

def setRealParent(self, parent):
self.fRealParent = parent

@@ -154,9 +160,23 @@ class CanvasPreviewFrame(QFrame):
def paintEvent(self, event):
painter = QPainter(self)

painter.setBrush(self.fViewBg)
painter.setPen(self.fViewBg)
painter.drawRoundRect(2, 2, self.width()-6, self.height()-6, 3, 3)
if self.fUseCustomPaint:
painter.setBrush(self.fViewBg)
painter.setPen(QColor(12, 12, 12))
painter.drawRect(0, 0, self.width(), self.height()-2)

painter.setBrush(QColor(36, 36, 36))
painter.setPen(QColor(62, 62, 62))
painter.drawRect(1, 1, self.width()-2, self.height()-4)

painter.setBrush(self.fViewBg)
painter.setPen(self.fViewBg)
painter.drawRect(2, 3, self.width()-5, self.height()-7)

else:
painter.setBrush(self.fViewBg)
painter.setPen(self.fViewBg)
painter.drawRoundRect(2, 2, self.width()-6, self.height()-6, 3, 3)

self.fScene.render(painter, self.fRenderSource, self.fRenderTarget, Qt.KeepAspectRatio)

@@ -172,7 +192,10 @@ class CanvasPreviewFrame(QFrame):
painter.setPen(self.fViewPen)
painter.drawRect(self.fViewRect[iX], self.fViewRect[iY], maxWidth, maxHeight)

QFrame.paintEvent(self, event)
if self.fUseCustomPaint:
event.accept()
else:
QFrame.paintEvent(self, event)

def resizeEvent(self, event):
self.fRenderSource = self.getRenderSource()


Loading…
Cancel
Save