diff --git a/app/process_thread.cpp b/app/process_thread.cpp index e053514..3687da8 100644 --- a/app/process_thread.cpp +++ b/app/process_thread.cpp @@ -26,9 +26,10 @@ using namespace spiralcore; using namespace std; -static void _process(void *c) { +static void* _process(void *c) { process_thread *p=(process_thread*)c; p->process(); + return NULL; } process_thread::process_thread() : diff --git a/brain/src/block_stream.cpp b/brain/src/block_stream.cpp index 0bf1e13..482e0a8 100644 --- a/brain/src/block_stream.cpp +++ b/brain/src/block_stream.cpp @@ -113,8 +113,9 @@ const block &block_stream::get_block(u32 index) const { //----------------------------------------------------------- -void _run_worker(void *p) { +void *_run_worker(void *p) { ((block_stream::worker *)p)->run(); + return NULL; } block_stream::worker::worker(u32 id, window *w) : diff --git a/brain/src/brain.cpp b/brain/src/brain.cpp index c591c6b..b57db1b 100644 --- a/brain/src/brain.cpp +++ b/brain/src/brain.cpp @@ -53,7 +53,7 @@ void brain::load_sound(std::string filename, stereo_mode mode) { for(u32 i=0; iupdate_period) { status::update("processing sample %d: %d%%",count,(int)(pos/(float)s.m_sample.get_length()*100)); update_tick=0; @@ -248,16 +248,16 @@ void brain::build_synapses_thresh(search_params ¶ms, double thresh) { status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100)); for (auto &j : m_blocks) { if (index!=outer_index) { - // collect connections that are under threshold in closeness - double diff = i.compare(j,params); - if (diff=m_blocks.size()) num_synapses=m_blocks.size()-1; + // need to stop the progress updates flooding osc + u32 update_period = 100; + u32 update_tick = 0; + for (auto &i:m_blocks) { - status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100)); + if (update_tick>update_period) { + status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100)); + update_tick=0; + } + update_tick++; + u32 index = 0; vector> collect; diff --git a/brain/src/spiralcore/ring_buffer.cpp b/brain/src/spiralcore/ring_buffer.cpp index d7f953a..ffda583 100644 --- a/brain/src/spiralcore/ring_buffer.cpp +++ b/brain/src/spiralcore/ring_buffer.cpp @@ -27,48 +27,42 @@ ring_buffer::ring_buffer(unsigned int size): m_write_pos(0), m_size(size), m_size_mask(size-1), - m_buffer(NULL) -{ + m_buffer(NULL) { m_buffer = new char[m_size]; memset(m_buffer,'Z',m_size); } -ring_buffer::~ring_buffer() -{ +ring_buffer::~ring_buffer() { delete[] m_buffer; } -bool ring_buffer::write(char *src, unsigned int size) -{ +bool ring_buffer::write(char *src, unsigned int size) { //cerr<<"write pos: "<m_size) return false; - if (size