LMMS
Loading...
Searching...
No Matches
Osc_ListModel.h
Go to the documentation of this file.
1/*
2 ZynAddSubFX - a software synthesizer
3
4 Osc_ListModel.h - OSC List View
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_), list_size(0)
23 {
24 assert(osc);
25 }
26
27 typedef std::vector<std::tuple<std::string, std::string, std::string>> list_t;
29 std::function<void(list_t)> callback;
30 unsigned list_size;
31
32 void doUpdate(std::string url)
33 {
34 if(!ext.empty())
35 osc->removeLink(this);
36 ext = url;
37
38 oscRegister(ext.c_str());
39 }
40
41 //Raw messages
42 virtual void OSC_raw(const char *msg)
43 {
44 std::string args = rtosc_argument_string(msg);
45 if(args == "i") {
47 list.clear();
48 list.resize(list_size);
49 } else if(args == "isss") {
50 int idx = rtosc_argument(msg,0).i;
51 std::get<0>(list[idx]) = rtosc_argument(msg,1).s;
52 std::get<1>(list[idx]) = rtosc_argument(msg,2).s;
53 std::get<2>(list[idx]) = rtosc_argument(msg,3).s;
54 if(idx == (int)list_size-1 && callback)
56 }
57 }
58};
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
Osc_ListModel(Fl_Osc_Interface *osc_)
Definition Osc_ListModel.h:21
unsigned list_size
Definition Osc_ListModel.h:30
list_t list
Definition Osc_ListModel.h:28
std::vector< std::tuple< std::string, std::string, std::string > > list_t
Definition Osc_ListModel.h:27
void doUpdate(std::string url)
Definition Osc_ListModel.h:32
virtual void OSC_raw(const char *msg)
Definition Osc_ListModel.h:42
std::function< void(list_t)> callback
Definition Osc_ListModel.h:29
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
const char * s
Definition rtosc.h:54
#define void
Definition unzip.h:396