"""Small example OSC client
This program sends 10 random values between 0.0 and 1.0 to the /filter address,
waiting for 1 seconds between each value.
"""
import argparse
import random
import time

from pythonosc import osc_message_builder
from pythonosc import udp_client
import global_variables


def init_osc() :
    parser = argparse.ArgumentParser()
    parser.add_argument("--ip", default="10.255.255.255",help="The ip of the OSC server")
    parser.add_argument("--port", type=int, default=2222,help="The port the OSC server is listening on")
    args = parser.parse_args()

    client = udp_client.SimpleUDPClient(args.ip, args.port)
    return client

def send_osc_float(client,message,stringy,value) :
    client.send_message(str(message),[stringy,value])

def send_osc_string(client,message,stringy) :
    client.send_message(str(message),str(stringy))

def send_osc(client,message,value) :
    if value[1] == None :
        client.send_message(str(message),value[0])
    else :
        client.send_message(str(message),value)