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.
23 lines
550 B
23 lines
550 B
import argparse
|
|
import math
|
|
|
|
from pythonosc.dispatcher import Dispatcher
|
|
from pythonosc import osc_server
|
|
|
|
OSC_PORT = 8787
|
|
|
|
|
|
def start_osc_server(queue):
|
|
|
|
def onReceivePrompt(address, *args):
|
|
prompt = " ".join(args)
|
|
print(f"Received prompt: {prompt}")
|
|
queue.put(prompt)
|
|
|
|
dispatcher = Dispatcher()
|
|
dispatcher.map("/prompt", onReceivePrompt)
|
|
|
|
|
|
server = osc_server.ThreadingOSCUDPServer(("localhost", OSC_PORT), dispatcher)
|
|
print(f"OSC server is running on port {OSC_PORT}")
|
|
server.serve_forever() |