6 #ifndef OFXPDSPMIDI_PDSPOSCINPUT_H_INCLUDED 7 #define OFXPDSPMIDI_PDSPOSCINPUT_H_INCLUDED 14 #include <condition_variable> 16 #include "../DSP/pdspCore.h" 17 #include "../sequencer/SequencerSection.h" 19 #include "helper/OscParser.h" 28 typedef osc::ReceivedMessage _PDSPOscReceivedMessage_t;
29 typedef osc::IpEndpointName _PDSPIpEndpointName_t;
30 typedef osc::osc_bundle_element_size_t _PDSPosc_bundle_element_size_t;
39 namespace pdsp{
namespace osc {
46 class _PositionedOscMessage {
48 _PositionedOscMessage(){ sample = -1; };
49 _PositionedOscMessage(ofxOscMessage message,
int sample) : message(message), sample(sample){};
52 std::chrono::time_point<std::chrono::high_resolution_clock> timepoint;
53 ofxOscMessage message;
57 class CustomOscReceiver :
public ofxOscReceiver {
59 std::vector<_PositionedOscMessage> * circularBuffer;
60 std::atomic<int> * index;
62 void ProcessMessage(
const _PDSPOscReceivedMessage_t &m,
const _PDSPIpEndpointName_t &remoteEndpoint)
override;
98 void linkTempo(
string oscAddress,
int argument=0 );
119 std::function<float(float)> &
parser(
string oscAddress,
int argument=0 );
127 void initTo(
string oscAddress,
int argument,
float value );
137 void processOsc(
int bufferSize ) noexcept;
138 bool hasTempoChange();
145 void prepareToPlay(
int expectedBufferSize,
double sampleRate )
override;
146 void releaseResources()
override;
149 CustomOscReceiver receiver;
151 std::vector<OscParser*> parsers;
156 bool sendClearMessages;
158 std::atomic<int> index;
160 std::vector<_PositionedOscMessage> circularBuffer;
161 std::vector<_PositionedOscMessage> readVector;
163 double oneSlashMicrosecForSample;
165 chrono::time_point<chrono::high_resolution_clock> bufferChrono;
169 std::string tempoAddress;
174 void pushToReadVector( _PositionedOscMessage & message );
175 int checkParser( std::string oscAddress );
177 static std::vector<Input*> instances;
182 #endif // OFXPDSPMIDI_PDSPOSCINPUT_H_INCLUDED
Takes messages from a MessageBuffer and convert them in an optionally smoothed value output...
Definition: SequencerValueOutput.h:23
Takes messages from a MessageBuffer and convert them in a trigger output.
Definition: SequencerGateOutput.h:20
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
Definition: Preparable.h:36