You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
661 B
30 lines
661 B
from pynput import mouse
|
|
from AppKit import NSScreen
|
|
import rtmidi
|
|
|
|
midiout = rtmidi.MidiOut()
|
|
available_ports = midiout.get_ports()
|
|
|
|
midiout.open_port(0)
|
|
midiout.send_message([0xB0, 1, 127])
|
|
# for i, port in enumerate(available_ports):
|
|
# print(port)
|
|
# if "IAC Driver" in port:
|
|
# midiout.open_port(i)
|
|
|
|
def get_screen_size():
|
|
screen = NSScreen.mainScreen()
|
|
frame = screen.frame()
|
|
width = int(frame.size.width)
|
|
height = int(frame.size.height)
|
|
return width, height
|
|
|
|
|
|
def on_move(x, y):
|
|
w, h = get_screen_size()
|
|
print(128*x/w)
|
|
print(128*y/h)
|
|
|
|
# with mouse.Listener(on_move=on_move) as listener:
|
|
# listener.join()
|