Skip to content

Commit

Permalink
Disable piano roll key preview during playback
Browse files Browse the repository at this point in the history
  • Loading branch information
L3337 committed Nov 27, 2022
1 parent fc532fe commit 6b5d565
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/sgui/daw/item_editor/notes/key.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from sglib import constants
from sglib.log import LOG
from sgui import shared as glbl_shared
from sgui.daw import shared
from sgui.sgqt import QGraphicsRectItem, QApplication, QColor

Expand All @@ -25,7 +25,6 @@ def __init__(
self.setAcceptHoverEvents(True)
self.hover_brush = QColor(120, 120, 120)
self.note = note
LOG.info(note)

def hoverEnterEvent(self, a_event):
super().hoverEnterEvent(a_event)
Expand All @@ -38,14 +37,26 @@ def hoverLeaveEvent(self, a_event):
self.setBrush(self.o_brush)

def mousePressEvent(self, ev):
if shared.CURRENT_ITEM_TRACK is None:
if (
shared.CURRENT_ITEM_TRACK is None
or
glbl_shared.IS_PLAYING
or
glbl_shared.IS_RECORDING
):
return
self.channel = shared.ITEM_EDITOR.get_midi_channel()
self.rack = shared.CURRENT_ITEM_TRACK
constants.DAW_IPC.note_on(self.rack, self.note, self.channel)

def mouseReleaseEvent(self, ev):
if shared.CURRENT_ITEM_TRACK is None:
if (
shared.CURRENT_ITEM_TRACK is None
or
glbl_shared.IS_PLAYING
or
glbl_shared.IS_RECORDING
):
return
constants.DAW_IPC.note_off(self.rack, self.note, self.channel)

0 comments on commit 6b5d565

Please sign in to comment.