Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some needed std:: to run in macOS (chrono, thread, etc) #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example_graincloud/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ endif

# make sure the the OF_ROOT location is defined
ifndef OF_ROOT
OF_ROOT=$(realpath ../../..)
OF_ROOT=../../..
endif

# call the project makefile!
Expand Down
2 changes: 1 addition & 1 deletion example_graincloud/config.make
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# The location of your root openFrameworks installation
# (default) OF_ROOT = ../../..
################################################################################
# OF_ROOT = ../../..
OF_ROOT = ../../..

################################################################################
# PROJECT ROOT
Expand Down
2 changes: 1 addition & 1 deletion example_midi_polysynth/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ endif

# make sure the the OF_ROOT location is defined
ifndef OF_ROOT
OF_ROOT=$(realpath ../../..)
OF_ROOT=../../..
endif

# call the project makefile!
Expand Down
2 changes: 1 addition & 1 deletion example_midi_polysynth/config.make
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# The location of your root openFrameworks installation
# (default) OF_ROOT = ../../..
################################################################################
# OF_ROOT = ../../..
OF_ROOT = ../../..

################################################################################
# PROJECT ROOT
Expand Down
2 changes: 1 addition & 1 deletion example_wavesynth_pc_keys/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ endif

# make sure the the OF_ROOT location is defined
ifndef OF_ROOT
OF_ROOT=$(realpath ../../..)
OF_ROOT=../../..
endif

# call the project makefile!
Expand Down
2 changes: 1 addition & 1 deletion example_wavesynth_pc_keys/config.make
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# The location of your root openFrameworks installation
# (default) OF_ROOT = ../../..
################################################################################
# OF_ROOT = ../../..
OF_ROOT = ../../..

################################################################################
# PROJECT ROOT
Expand Down
2 changes: 1 addition & 1 deletion src/DSP/control/ValueControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pdsp::ValueControl::ValueControl(){
updateOutputNodes();
slewInitValue = 0.0f;
value = 0.0f;
lastValue = numeric_limits<float>::infinity();
lastValue = std::numeric_limits<float>::infinity();
this->deactivateSlew();

if(dynamicConstruction){
Expand Down
4 changes: 2 additions & 2 deletions src/DSP/control/ValueControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class ValueControl : public pdsp::Unit, public pdsp::UsesSlew {
void releaseResources () override ;
void process (int bufferSize) noexcept override;

atomic<float> lastValue;
atomic<float> value;
std::atomic<float> lastValue;
std::atomic<float> value;

};

Expand Down
2 changes: 1 addition & 1 deletion src/ofx/OscInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void pdsp::osc::Input::openPort( int port ) {

receiver.setup( port );
connected = true;
bufferChrono = chrono::high_resolution_clock::now();
bufferChrono = std::chrono::high_resolution_clock::now();
}


Expand Down
2 changes: 1 addition & 1 deletion src/ofx/OscInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class Input : public pdsp::Preparable {

double oneSlashMicrosecForSample;

chrono::time_point<chrono::high_resolution_clock> bufferChrono;
std::chrono::time_point<std::chrono::high_resolution_clock> bufferChrono;


bool tempoLinked;
Expand Down
14 changes: 7 additions & 7 deletions src/ofx/OscOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pdsp::osc::Output::ScheduledOscMessage::ScheduledOscMessage(){
this->scheduledTime = std::chrono::time_point<std::chrono::high_resolution_clock>::min();
};

pdsp::osc::Output::ScheduledOscMessage::ScheduledOscMessage(ofxOscMessage message, chrono::high_resolution_clock::time_point schedule) {
pdsp::osc::Output::ScheduledOscMessage::ScheduledOscMessage(ofxOscMessage message, std::chrono::high_resolution_clock::time_point schedule) {
this->message = message;
this->scheduledTime = schedule;
};
Expand Down Expand Up @@ -141,10 +141,10 @@ void pdsp::osc::Output::process( int bufferSize ) noexcept{

//add note messages
if(chronoStarted){
chrono::nanoseconds bufferOffset = chrono::nanoseconds (static_cast<long> ( bufferSize * usecPerSample ));
std::chrono::nanoseconds bufferOffset = std::chrono::nanoseconds (static_cast<long> ( bufferSize * usecPerSample ));
bufferChrono = bufferChrono + bufferOffset;
}else{
bufferChrono = chrono::high_resolution_clock::now();
bufferChrono = std::chrono::high_resolution_clock::now();
chronoStarted = true;
}

Expand All @@ -158,8 +158,8 @@ void pdsp::osc::Output::process( int bufferSize ) noexcept{
float msg_value = messageBuffer->messages[n].value;
int msg_sample = messageBuffer->messages[n].sample;

chrono::nanoseconds offset = chrono::nanoseconds (static_cast<long> ( msg_sample * usecPerSample ));
chrono::high_resolution_clock::time_point scheduleTime = bufferChrono + offset;
std::chrono::nanoseconds offset = std::chrono::nanoseconds (static_cast<long> ( msg_sample * usecPerSample ));
std::chrono::high_resolution_clock::time_point scheduleTime = bufferChrono + offset;

ofxOscMessage osc;
osc.setAddress( addresses[i] );
Expand All @@ -185,7 +185,7 @@ void pdsp::osc::Output::process( int bufferSize ) noexcept{
void pdsp::osc::Output::startDaemon(){ // OK

runDaemon = true;
daemonThread = thread( daemonFunctionWrapper, this );
daemonThread = std::thread( daemonFunctionWrapper, this );

}

Expand All @@ -199,7 +199,7 @@ void pdsp::osc::Output::daemonFunction() noexcept{

while (runDaemon){

while( send!=writeindex && circularBuffer[send].scheduledTime < chrono::high_resolution_clock::now() ){
while( send!=writeindex && circularBuffer[send].scheduledTime < std::chrono::high_resolution_clock::now() ){

#ifndef NDEBUG
if(verbose) cout << "[pdsp] OSC message: address = "<< circularBuffer[send].message.getAddress() << " | value = "<<(int)circularBuffer[send].message.getArgAsFloat(0)<<"\n";
Expand Down
6 changes: 3 additions & 3 deletions src/ofx/OscOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class Output : public pdsp::ExtSequencer, public pdsp::Preparable {
class ScheduledOscMessage{
public:
ScheduledOscMessage();
ScheduledOscMessage(ofxOscMessage message, chrono::high_resolution_clock::time_point schedule);
ScheduledOscMessage(ofxOscMessage message, std::chrono::high_resolution_clock::time_point schedule);
ScheduledOscMessage(const ScheduledOscMessage &other);
ScheduledOscMessage& operator= (const ScheduledOscMessage &other);
~ScheduledOscMessage();

ofxOscMessage message;
chrono::high_resolution_clock::time_point scheduledTime;
std::chrono::high_resolution_clock::time_point scheduledTime;
};


Expand Down Expand Up @@ -126,7 +126,7 @@ class Output : public pdsp::ExtSequencer, public pdsp::Preparable {
void daemonFunction() noexcept;
static void daemonFunctionWrapper(Output* parent);

thread daemonThread;
std::thread daemonThread;
std::atomic<bool> runDaemon;

//serial output processing members
Expand Down
14 changes: 6 additions & 8 deletions src/ofx/SerialOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

#define OFXPDSP_SERIALOUTPUTCIRCULARBUFFERSIZE 4096


pdsp::serial::Output::ScheduledSerialMessage::ScheduledSerialMessage(){ };

pdsp::serial::Output::ScheduledSerialMessage::ScheduledSerialMessage(int channel, float message, chrono::high_resolution_clock::time_point schedule) {
pdsp::serial::Output::ScheduledSerialMessage::ScheduledSerialMessage(int channel, float message, std::chrono::high_resolution_clock::time_point schedule) {
if (channel<1) channel = 1;
if (channel>127) channel = 127;
int msg = (int) message;
Expand Down Expand Up @@ -172,7 +171,6 @@ void pdsp::serial::Output::releaseResources() {}
// OK -----------------------------------------------^^^^^^^^^^^-------------

void pdsp::serial::Output::process( int bufferSize ) noexcept{

if(connected){
//clear messages
messagesToSend.clear();
Expand All @@ -181,10 +179,10 @@ void pdsp::serial::Output::process( int bufferSize ) noexcept{
int maxBuffer = inputs.size();

if(chronoStarted){
chrono::nanoseconds bufferOffset = chrono::nanoseconds (static_cast<long> ( bufferSize * usecPerSample ));
std::chrono::nanoseconds bufferOffset = std::chrono::nanoseconds (static_cast<long> ( bufferSize * usecPerSample ));
bufferChrono = bufferChrono + bufferOffset;
}else{
bufferChrono = chrono::high_resolution_clock::now();
bufferChrono = std::chrono::high_resolution_clock::now();
chronoStarted = true;
}

Expand All @@ -204,8 +202,8 @@ void pdsp::serial::Output::process( int bufferSize ) noexcept{
float msg_value = messageBuffer->messages[n].value;
int msg_sample = messageBuffer->messages[n].sample;

chrono::nanoseconds offset = chrono::nanoseconds (static_cast<long> ( msg_sample * usecPerSample ));
chrono::high_resolution_clock::time_point scheduleTime = bufferChrono + offset;
std::chrono::nanoseconds offset = std::chrono::nanoseconds (static_cast<long> ( msg_sample * usecPerSample ));
std::chrono::high_resolution_clock::time_point scheduleTime = bufferChrono + offset;

messagesToSend.push_back( ScheduledSerialMessage(msg_channel, msg_value, scheduleTime) );
}
Expand All @@ -227,7 +225,7 @@ void pdsp::serial::Output::process( int bufferSize ) noexcept{
void pdsp::serial::Output::startDaemon(){ // OK

runDaemon = true;
daemonThread = thread( daemonFunctionWrapper, this );
daemonThread = std::thread( daemonFunctionWrapper, this );

}

Expand Down
6 changes: 3 additions & 3 deletions src/ofx/SerialOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class Output : public pdsp::ExtSequencer, public pdsp::Preparable {
class ScheduledSerialMessage{
public:
ScheduledSerialMessage();
ScheduledSerialMessage(int channel, float message, chrono::high_resolution_clock::time_point schedule);
ScheduledSerialMessage(int channel, float message, std::chrono::high_resolution_clock::time_point schedule);
ScheduledSerialMessage(const ScheduledSerialMessage &other);
ScheduledSerialMessage& operator= (const ScheduledSerialMessage &other);
~ScheduledSerialMessage();

signed char channel;
signed char message;
chrono::high_resolution_clock::time_point scheduledTime;
std::chrono::high_resolution_clock::time_point scheduledTime;
};


Expand Down Expand Up @@ -142,7 +142,7 @@ class Output : public pdsp::ExtSequencer, public pdsp::Preparable {
std::atomic<bool> runDaemon;

//serial output processing members
std::chrono::time_point<chrono::high_resolution_clock> bufferChrono;
std::chrono::time_point<std::chrono::high_resolution_clock> bufferChrono;
bool chronoStarted;
double usecPerSample;
std::vector<ScheduledSerialMessage> circularBuffer;
Expand Down