Threads in C++11 (2)

Selection_082

Now sound capture is from another thread.

void thread_test(Sound* s) {
	while(1) {
		usleep(100000);
		s->loop_count = s->asound_read();
	}
}

MyDrawingAreaS::MyDrawingAreaS(Sound* ss) : s {ss} {
	thread t1{bind(thread_test, s)};
	t1.detach();
}

This is quite a dirty hack, but it seems to work. Note that the waveforms looks funny because of the inappropriate setting of the input level.

Leave a Reply

Your email address will not be published. Required fields are marked *