i have an idea, stolen from ardour.

there are three threads:
GUI
audio
prefetch

there is 'the model', containing every information about our song. This
is shared among GUI and prefetch thread. audio never touches it.

GUI and prefetch do mutex locking when operationg on the model.

All data, (also MIDI data), is read from the prefetch thread and written
into ringbuffers, to be read and played by the audio thread. the audio
thread does effects etc.



There are three kinds of operations:

fast operations: are executed immediately, with low latency.
    Implemented by the GUI sending a message over a ringbuffer directly
    to the audio thread, like we do everything currently.

    Examples: sliding mixer controls
              muting/unmuting tracks

slow oeprations: might take up to some seconds to apply.
    Implemented by mutex-locking and editing the model. The prefetcher
    might wait for a moment, but no problem because our prefetch buffer
    is large enough. (*)

    Examples: moving, creating, deleting notes or new wave parts.
              turning on/off tracks

offline operations: cannot be executed while playing back
    require the audio thread to be msgIdled; used for "large", seldomly
    Examples: adding/removing (but not bypassing) effects,
              adding/removing tracks


*) in case of a audio buffer underflow, we de-click the thing:
The ringbuffer always holds some hundred frames more than it actually
needs. If the number of available frames in the ringbuf drops under a
few hundred, then a soft underrun occurs and MusE will play back the
remaining samples, but fading out (thus, de-clicking everything).
If the buffer comes back again, MusE will fade-in for ~100 samples.



Also, time-stretching is done inside the audio thread, and not inside
the prefetching thread, to be able to quickly adapt new tempi (->
external synchronisation). The prefetcher must prefetch an appropriate
number of samples, obviously. (We may assume that the external tempo
does not deviate by more than 10% from the tempo map).


Work in progress, share your thoughts!

A Happy MusE 3.0

Florian

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Lmuse-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lmuse-developer

Reply via email to