Repository navigation
Midi looping, speed play, cut preview - #2378
Paul-Licameli wants to merge 9 commits into
Conversation
94ff670 to
16c48a7
Compare
ad4d78f to
86c095e
Compare
e51f0b5 to
371b056
Compare
pietro68
left a comment
There was a problem hiding this comment.
Quite honestly this code is beyond me and I would need quite some time to understand what is going on here.
I did some QA in the sense that I tried looping and speed changes on a midi file and it seems to work.
One thing I noticed (out of the scope of this PR) is that although I selected my laptop speakers as playback device, a wave track will be played through them like it should, but the midi file gets played through my wireless headphones. This happens also in the current released 3.1.3
371b056 to
bd7e7b6
Compare
bd7e7b6 to
f807dd4
Compare
... of AudioIoCallback. This is done to avoid dependency cycle problems. PlaybackSchedule::TimeQueue will need this array but should not need AudioIoCallback to get it. So AudioIoCallback can still have PlaybackSchedule with its TimeQueue as members. AudioIOExtensions does need PlaybackSchedule to initialize itself, but it can treat that as an opaque type.
... Which will allow the same division of labor between threads for MIDI play as for audio. A producer thread without low-latency constraints decides what to play, and produces a message; the low-latency consumer thread will dequeue the message and interpret it quickly.
... This will allow the main thread to detect when it is safe to destroy state
... Getting the use of the atomics right, and a forward-list as an unbounded queue of information between them. Note that the communication is lock-free and the low-latency consumer side does no free store allocation or freeing.
... Which will be consumer-thread side, that won't make the decisions about which parts of the track to play. They stop using the function MidiLoopOffset(), which will be eliminated. Instead some information is stored in the iterator, and this may need updating by the producer even after the consumer has made some use of the iterator. So use atomics in the iterator.
... They may be shared across successive entries, but must not be shared where there is a discontinuity in movement of the play head. The consumer will later use those iterators. The allocation in make_shared will not happen in the low-latency thread.
... as consumer-side usage of the iterators in the queue replaces the old system for computing the time stamps for MIDI events.
f807dd4 to
e4a4712
Compare
|
This PR has been sitting in approved for quite some time now, can it be merged? |
Would likely need a difficult rebasing and re-review for 3.3 Which I would like to see happen |
Resolves: #2359
Resolves: #2081
Fix the cooperation of MIDI with the adjustable looping region, and also make it work with the speed slider and cut preview.
These kinds of play should now remain synchronized with any audio tracks that also play simultaneously.
Change of speed means MIDI events like note-on and -off are more rapid, but pitch will be the same.
Still to do: make MIDI work with scrubbing too.
Recommended: