1 /* 2 * Copyright (C) 2017-2018 Len Ovens <len@ovenwerks.net> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License along 15 * with this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 */ 18 19 #ifndef __osc_osccueobserver_h__ 20 #define __osc_osccueobserver_h__ 21 22 #include <string> 23 #include <boost/shared_ptr.hpp> 24 #include <sigc++/sigc++.h> 25 #include <lo/lo.h> 26 27 #include "pbd/controllable.h" 28 #include "pbd/stateful.h" 29 #include "ardour/types.h" 30 31 class OSCCueObserver 32 { 33 34 public: 35 OSCCueObserver (ArdourSurface::OSC& o, ArdourSurface::OSC::OSCSurface* sur); 36 ~OSCCueObserver (); 37 strip()38 boost::shared_ptr<ARDOUR::Stripable> strip () const { return _strip; } address()39 lo_address address() const { return addr; }; 40 void tick (void); 41 typedef std::vector<boost::shared_ptr<ARDOUR::Stripable> > Sorted; 42 Sorted sends; 43 void clear_observer (void); 44 void refresh_strip (boost::shared_ptr<ARDOUR::Stripable> new_strip, Sorted new_sends, bool force); 45 46 private: 47 48 boost::shared_ptr<ARDOUR::Stripable> _strip; 49 ArdourSurface::OSC& _osc; 50 51 PBD::ScopedConnectionList strip_connections; 52 PBD::ScopedConnectionList send_connections; 53 54 lo_address addr; 55 std::string path; 56 ArdourSurface::OSC::OSCSurface* sur; 57 float _last_meter; 58 float _last_signal; 59 std::vector<uint32_t> gain_timeout; 60 bool tick_enable; 61 std::vector<float> _last_gain; 62 63 void name_changed (const PBD::PropertyChange& what_changed, uint32_t id); 64 void send_change_message (std::string path, uint32_t id, boost::shared_ptr<PBD::Controllable> controllable); 65 void send_gain_message (uint32_t id, boost::shared_ptr<PBD::Controllable> controllable, bool force); 66 void send_enabled_message (std::string path, uint32_t id, boost::shared_ptr<ARDOUR::Processor> proc); 67 void send_init (void); 68 void send_end (uint32_t new_sends_size); 69 void send_restart (void); 70 }; 71 72 #endif /* __osc_osccueobserver_h__ */ 73