Repository navigation
Disentangle midi play from audio io - #1637
Merged
Paul-Licameli merged 20 commits intoSep 23, 2021
Merged
Paul-Licameli merged 20 commits into
Paul-Licameli merged 20 commits into
Conversation
6 tasks done
Paul-Licameli
force-pushed
the
Disentangle-MIDI-play-from-AudioIO
branch
3 times, most recently
from
September 15, 2021 14:48
ce43b70 to
1e86096
Compare
Paul-Licameli
force-pushed
the
Disentangle-MIDI-play-from-AudioIO
branch
3 times, most recently
from
September 21, 2021 00:18
0586c40 to
73ee6d6
Compare
Collaborator
Author
|
Now rebased, with build fixes, and also removing use of deprecated std::iterator. |
crsib
reviewed
Sep 22, 2021
Contributor
There was a problem hiding this comment.
Maybe we should something else in place of Other? Like ExtensionStream or whatever?
crsib
approved these changes
Sep 22, 2021
crsib
left a comment
Contributor
There was a problem hiding this comment.
MidiCode is much easier to understand now!
... so it might be called from the same low-latency thread as AudioIoCallback::AudioCallback
... And certain variables that no longer communicate inter-thread lose their volatile qualifier (which wasn't even proper use of volatile anyway)
...duplicating mUsingAlsa The move of the call to ComputeOtherTimings is allowable because the override does not use the number of pause frames For the moved data members: remove unused mSeq, added in-class initializers, modernized some casting
... And AudioIO does not depend on portmidi.h
Paul-Licameli
force-pushed
the
Disentangle-MIDI-play-from-AudioIO
branch
from
September 23, 2021 03:09
73ee6d6 to
f891676
Compare
6 of 7 tasks
kryksyh
added a commit
that referenced
this pull request
Aug 19, 2026
…11696) Resolves: #11664 Resolves: #2359 When the playback is restarted with a click on a timeline, it stops all streams first. During stop we wait for all midi events to be drained. But if the playback is restarted twice in quick succession, the first midi playback doesnt have time to fully initialize which results in a 1000s wait. Introduced in #1637 Call stack: ``` (anonymous namespace)::MIDIPlay::MidiTime() (libraries/lib-note-track/MIDIPlay.cpp:1059) (anonymous namespace)::MIDIPlay::StopOtherStream() (libraries/lib-note-track/MIDIPlay.cpp:760) AudioIO::StopStream() (libraries/lib-audio-io/AudioIO.cpp:1535) ProjectAudioManager::Stop(bool) (src/ProjectAudioManager.cpp:531) AdornedRulerPanel::StartQPPlay(bool, bool, double const*) (src/AdornedRulerPanel.cpp:2111) AdornedRulerPanel::CommonRulerHandle::StartPlay(AudacityProject&, wxMouseEvent const&) (src/AdornedRulerPanel.cpp:192) AdornedRulerPanel::PlayRegionAdjustingHandle::Release(TrackPanelMouseEvent const&, AudacityProject*, wxWindow*) (src/AdornedRulerPanel.cpp:296) CellularPanel::OnMouseEvent(wxMouseEvent&) (src/CellularPanel.cpp:814) wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const (.conan2/p/b/wxwid222b45a67b428/b/src/src/common/appbase.cpp:657) wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const ``` <!-- Use "x" to fill the checkboxes below like [x] --> - [x] I signed [CLA](https://www.audacityteam.org/cla/) - [x] The title of the pull request describes an issue it addresses - [x] If changes are extensive, then there is a sequence of easily reviewable commits - [x] Each commit's message describes its purpose and effects - [x] There are no behavior changes unnecessary for the stated purpose of the PR Recommended: - [x] Each commit compiles and runs on my machine without known undesirable changes of behavior QA: - [ ] Testflow test cases have been run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #1581
Next refactoring steps for AudioIO.
All of the logic specific to MIDI playback is removed from AudioIO.cpp, and invoked instead through an abstract base class AudioIOExt. A new, separate file MIDIPlay.cpp registers its extension policy with AudioIO.
These steps shrink the big file AudioIO.cpp from 4797 to 3596 lines, and are also preparations for putting Note track into its own optional extension module.
The unnecessary separate thread for MIDI playback is removed for simplicity, and some callbacks happen directly in the Portaudio thread. That means some memory allocations may happen on that thread, when MIDI plays! (See PrepareMidiIterator().) But future refactorings will correct that.
The dependency of lib-audio-devices on portmidi is severed.
A few other changes remove some dependencies on NoteTrack, and use Settings objects from Prefs.cpp to eliminate some duplicated literals and direct use of gPrefs in MIDIPlay.cpp.
Recommended: