Hi, I wonder whether MusE can use multiple CPU cores for Audio processing, like plugins or my AudioStretchers.
Audio stretching is placed in void AudioPrefetch::prefetch(bool doSeek). Instead of reading from the file, I'm now reading from the AudioStream, which reads from the file, handles MP3/codecs, and handles stretching internally. I guess that we can easily make the AudioPrefetch multithreaded (just create multiple objects, and instead of iterating through song->allWavetracks(), do some kind of load balancing.) Comments on this? But can we support multithreading with the audio effects as well? My thoughts on this: - it would be cool! - instead of having Audio::process1() iterate through all tracks, let it communicate with his "worker threads". - each of them may call AudioTracks::copyData on just some of all AudioTracks - If inter-dependencies occur, solve them using Mutexes (*) - Communication with the workers works like this: each worker has a "new data available"-semaphore and a "i'm done"-semaphore. Audio::process1 will feed the data into the workers, and then release the "new data avail". This will cause the worker to start. - After all workers are running, Audio::process will wait for all workers' semaphores (*), when all are done, continue. You probably though "whoa, no, we may not use mutexes or semaphores inside the realtime thread!" (*). Are you sure? I think this rule only applies when the Mutex is shared between a "realtime" thread and a "non-realtime" thread. However, our workers are "realtime threads" as well. So the worst thing that can happen is: No parallelisation is possible, all workers except one are waiting for a mutex. Then we have effectively serialized the work, and we have what Audio::process1() is doing right now anyway (with a little added overhead, though). A worker thread may not call any "slow" system calls that might block, nor may it do any bad worst-case-operations Note that this is a plan for the future, I have plenty to do right now. (audiostreams :)). But i'd like to know whether this is possible, or whether i made a mistake in thinking. Please comment :) Cheers, flo
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. Consolidate legacy IT systems to a single system of record for IT 2. Standardize and globalize service processes across IT 3. Implement zero-touch automation to replace manual, redundant tasks http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________ Lmuse-developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lmuse-developer
