LMMS
Loading...
Searching...
No Matches
Osc_IntModel.h
Go to the documentation of this file.
1/*
2 ZynAddSubFX - a software synthesizer
3
4 Osc_IntModel.h - OSC Updated Integer
5 Copyright (C) 2016 Mark McCurry
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11*/
12#pragma once
13#include "Fl_Osc_Widget.H"
14#include <functional>
15#include <vector>
16#include <rtosc/rtosc.h>
17
19{
20 public:
22 :Fl_Osc_Widget("", osc_), value(0)
23 {
24 assert(osc);
25 }
26
27 typedef int value_t;
29 std::function<void(value_t)> callback;
30
32 {
33 value = v;
34 oscWrite(ext, "i", v);
35 }
36
37 void doUpdate(std::string url)
38 {
39 if(!ext.empty())
40 osc->removeLink(this);
41 ext = url;
42
43 oscRegister(ext.c_str());
44 }
45
46 //Raw messages
47 virtual void OSC_raw(const char *msg)
48 {
49 std::string args = rtosc_argument_string(msg);
50 if(args == "i") {
52 if(callback)
54 } else if(args == "T") {
55 value = 1;
56 if(callback)
58 } else if(args == "F") {
59 value = 0;
60 if(callback)
62 }
63 }
64};
assert(0)
Definition Fl_Osc_Interface.h:56
Fl_Osc_Interface * osc
Definition Fl_Osc_Widget.H:65
std::string ext
Definition Fl_Osc_Widget.H:64
Fl_Osc_Widget(void)
Definition Fl_Osc_Widget.cpp:16
void oscRegister(const char *path)
Definition Fl_Osc_Widget.cpp:91
void oscWrite(std::string path, const char *args,...)
Definition Fl_Osc_Widget.cpp:60
std::function< void(value_t)> callback
Definition Osc_IntModel.h:29
Osc_IntModel(Fl_Osc_Interface *osc_)
Definition Osc_IntModel.h:21
value_t value
Definition Osc_IntModel.h:28
int value_t
Definition Osc_IntModel.h:27
void updateVal(value_t v)
Definition Osc_IntModel.h:31
virtual void OSC_raw(const char *msg)
Definition Osc_IntModel.h:47
void doUpdate(std::string url)
Definition Osc_IntModel.h:37
unsigned v[N_MAX]
Definition inflate.c:1584
const char * msg
Definition missing_descriptor.c:20
const char * rtosc_argument_string(const char *msg)
Definition rtosc.c:11
rtosc_arg_t rtosc_argument(const char *msg, unsigned idx)
Definition rtosc.c:732
int32_t i
Definition rtosc.h:47
#define void
Definition unzip.h:396