-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Scene - Final fixes #197
Merged
Merged
Conversation
This file contains 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
|
|
|
|
|
|
|
|
My logic would populate all the channels it could. The old logic wouldn't populate any if not all could due to OOB. Tests expect that logic.
From PR #200 - branch bad_get_refactor-mf-prog_ids * EarTabbedComponent supports ID's * programme_internal_id.hpp helper * programme_internal_id in Programme proto * Existing components use new Programme ID's Needs further work to remove any reliance on indexes. This commit ONLY does the bare minimum to make use of Programme ID's. * Ensure ID's used where appropriate in metadata and listener methods * Fix mutexes in Metadata class * ProgrammeObjects id() method * ProgrammesContainer listeners use ID's over indexes * Differentiate var names between connection IDs and Programme IDs * Fix bounds checks on programmeStore_.selected_programme_index() * Update selected programme index when programmes moved * ProgrammeStore has selected_programme_internal_id instead of selected_programme_index * Use of ProgrammeInternalId type * Replace "move" events with "set order" events A full order update is far less likely to go wrong and easier to debug than trying to keep things in sync with individual moves by index. * Correct headers in plugin lib cmake * Remove use of index in ProgrammesContainer::updateElementOverview Pretty sure this is the last use of index from ProgrammeStatus/ProgrammeObject * Remove index field from ProgrammeStatus to discourage use of indices * Fix lookup of ElementViewLists associated ProgrammeView * Remove unnecessary comment/suggestion I initially went with this approach, but it isn't ideal. Not all ElementViews will have an ID - it depends what they're representing. Objects will have an ID, and that is already accessible via ObjectView->getConnectionId. Use of index in these callbacks is fine, because the ElementViewList which calls moveElementUiInteraction is not authoritative on order (in fact, it doesn't even explicitly track it) and only knows of drag/drop indices. Sync of ordering is guaranteed since reordering elements in the store will fire programmeUpdated, which in turn ensures that the ElementView displayed order is representative of the store order. * Don't require listener overrides for ElementsContainer * ProgrammesContainer::elementMoved sets full ordering - not individual moves * Remove Metadata::moveElement method Shouldn't be used - always send a full list via setElementOrder * Fix ProgrammesContainer::removeElementClicked Use same ancestor component tracing logic as ProgrammesContainer::elementMoved * Fix deleting last programme
AutoModeController set as backendListener to sync with PendingStore and prevent race condition between PendingStores setStore call, and AutoModeController inputAdded listener calls
Previous check only removed duplicates from item list passed as arg. Should check if the item is already in the selected programme, otherwise it's still possible to add something twice.
Prevents needlessly firing ItemsAddedToProgramme listeners
Can not use flag sent by input plugin. Not all updates are forwarded to the monitoring plugins (depends on playback state). End up with the case when stopped, that if an input changes, it sends changed metadata which is stored by the scene. Following metadata updated have changed set to false. This replaces the metadata in the scene. When playback starts, the scene sends it's latest copy of the metadata, where changed is false. Therefore the monitoring plugins do not act upon it. Solution is to track which items have changed since the last send, and set that changed flag state. Also factors out the class-wide changed flag, and exporting state is handled in a more readable way.
reduces glitch at start of playback
Monitoring an empty programme still monitors previous programme since 4600907 (implementation of itemsChangedSinceLastSend). This is a reintroduction of previous bug symptoms but with a different cause. We must add everything that was in the store to itemsChangedSinceLastSend before calling store_.clear_monitoring_items(), otherwise we don't flag that anything changed.
|
It should update according to what the underlying data model logic decides to do. This used to set off many selectedProgramme listeners when removeAllTabs was called, which end up competing with each other in loops (via selectProgramme->listeners->selectTab->selectProgramme).
This prevents the selectProgramme->listeners->selectTab->selectProgramme loop ever occurring even if competing events are set off.
723c2fa
to
67b64b2
Compare
|
|
not required anyway
|
PR description updated with fixes for specific issues. Ready for review. |
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.
Intermittent crash when plugin is placed on a track
MetadataThread
messages vector and thread, so occasionally the thread would attempt to access the vector before it had been initialised.unique_ptr
and constructed in theMetadataThread
constructor body. thread is already stopped inMetadataThread
destructor which ensures it will not access the messages vector as it is destroyed.Programmes not being added to Scene for some imports
AutoModeController
would not add it to the default programme.PendingStore
was waiting to see everything it needs in the default programme before setting the store.PendingStore
should not be reliant onAutoModeController
and the default programme. Now, it instead listens for anyitemAdded
oritemUpdated
event (as an aside, the same logic was applied for missing elements inRestoredPendingStore
too). The logic inAutoModeController
was reworked, which essentially led to the "Refactor AutoModeController" task.Items which do not belong in the first programme sometimes get added to the first programme anyway during import
AutoModeController
was listening for this event to toggle it's internal enabled state. Sometimes, aninputUpdated
event would occur before theautoModeChanged
listener was fired, soAutoModeController
internal enabled state was still true, and it just stuck this item in the first programme anyway.Refactor AutoModeController
AutoModeController
to track item state or auto mode enabled state when this is already held by the store as it could lead to tricky bugs with timing (see above) and with state synchronisation.AutoModeController
significantly stripped back.Some methods implemented inMetadata
class for directly querying the store.AutoModeController
only listens forinputAdded
andinputUpdated
events which fire a newaddItemIfNecessary
method. This checks the AutoMode enabled state directly from the store (Metadata::getAutoMode()
), and will add the item only if it does not already exist in the selected programme (usingMetadata::getSelectedProgrammeIndex()
andMetadata::programmeHasElement(...)
). It does not do any ordering. A skeleton method is waiting inMetadata
(sortProgrammeElements
) - this was not populated as it is to be discussed whether sorting is actually a good thing or more of a hinderance.AutoModeController
is still significantly stripped back. It does not do any item reordering as we discussed this was probably no help and could in fact be a hindrance.AutoModeController
just listens toinputAdded
and this event was modified to pass the automode enablement state to listeners.AutoModeController
does not need to concern itself with whether the active programme already contains the item, firstly due to the event type it is listening for, and secondly becauseaddItemsToSelectedProgramme
(viaMetadata::doAddItemsToSelectedProgramme
) already does the existence check, as it should never be allowed to happen anyway.Items displayed in programmes do not reflect updated item state (e.g, name, colour, config). This can also leave "no name" items in programmes loaded from saved projects until the GUI is forcibly refreshed.
ObjectView
to respond to item updates - they only get their initial state.ProgrammesContainer::programmeItemUpdated
listener retrieves theElementsContainer
for the programme and then theObjectView
for the item (via the newElementsContainer::getObjectView(...)
method). The existing code to set theObjectView
has been broken up in to two stages, responding toData::object
changes (i.e, interaction settings) andData::item
changes (i.e, object metadata). This reduces the amount of work done for a particular type of update. The newObjectView::setInputItemMetadata(...)
method only concerns the latter, and is called fromProgrammesContainer::programmeItemUpdated
.repaint()
is only called if changes were actually made.ObjectView
inheritMetadataListener
. This was decided against since it would make events harder to debug with many extra listeners, and the implemented method more closely resembles the mechanism implemented inItemContainer
already. Also, we would need to pass theMetadataDispatcher
object down through the classes to apply the listeners which would be a little untidy.Switching to a blank programme still monitors previous programme
SceneStore::programmeSelected
listener, thechanged
flag is only set by thesetMonitoringItemFrom
method (called viaaddMonitoringItem
). If there are no items in the newly selected programme, this is not called so thechanged
flag is never set.changed
flag inSceneStore::programmeSelected
regardless of what the new programme contains.Programme delete dialog shows empty string for programme
EarTabbedComponent::getName()
which is actually just the JUCE base class method for getting the component name (if present)EarTabbedComponent
Adding a new item mid-playback does not make that item contribute to the monitoring mix
SceneStore::itemsAddedToProgramme
did not set the overallchanged
flag, sotriggerMetadataSend
did not bother sending the update.itemsChangedSinceLastSend
set.Related bugs: "Switching to a different programme whilst playback is stopped makes items from the previously selected programme audible in monitoring" and "Removing an item from a programme does not remove it from monitoring"
SceneGainsCalculator
but notchanged
(as reported by incoming metadata) were never added toroutingCache
, and therefore gains were not reset when those items were removed.SceneGainsCalculator::update
with comments to make the flow more logical and easier to understand. There is now acachedIdsChecklist
vector which is populated with every item we already know about. We then check these off as we go through items in the incoming metadata. Anything then remaining incachedIdsChecklist
must have been removed, and so we remove them fromroutingCache
and reset gains for them (viaremoveItem
call.) Anything marked aschanged
is also removed viaremoveItem
to force it to be re-evaluated. Then we get to the actual processing of items, which is now greatly simplified - we iterate through items in the incoming metadata and see if it's in theroutingCache
- if not, it's processed via the newaddOrUpdateItem
method.Monitoring plugins not updating to new object static location if location was changed whilst stopped.
changed
flag to determine whether to recalculate gains. However, we can not rely on the state of thechanged
flag sent in metadata from the input plugins, because not all of those updates reach the monitoring plugins. If the Input plugins send a follow-up when nothing has changed, thechanged
flag is reset to false and overwrites the item metadata in the Scene plugin. This is the one that gets sent to the monitoring plugins when playback starts. They seechanged
is false and don't recalculate gains even though it should actually be true from their perspective, because it has changed since they were last notified.itemsChangedSinceLastSend
set), and use that tracking to overridechanged
flag state before sending on to monitoring plugins. Removes need for the overallchanged
state tracking too (count of items initemsChangedSinceLastSend
set being >0 tells you this.)Switching to a new, blank programme does not remove items from previous programme from the monitoring mix.
routingCache
fixitemsChangedSinceLastSend
work - same symptoms, different cause - removed items were not being added toitemsChangedSinceLastSend
itemsChangedSinceLastSend
is populated with everything about to be removed before callingstore_.clear_monitoring_items()
Selecting a programme monitors incorrect programme after programmes have been reordered.
Editable text for EarSliders positions to wrong vertical location
Scene GUI seems quite hoggy on Protest ADM
ElementOverview::paint
using quite a lot of CPU time, so focused optimisations around there.Meters in Scene are all mono
ProgrammesContainer::addObjectView
had correct logic to set meter channel count initially, but thenProgrammesContainer::programmeItemUpdated
had no channel-counting logic and just immediately reverted them all to single channel.ProgrammesContainer::addObjectView
orProgrammesContainer::programmeItemUpdated
(or anywhere else we need it in future)Scenes bottom-left orientation representation rotates in the opposite direction to the main view
getSectorIndex
function returning incorrect label indices.Selecting any programme other than the first and then loading the Binaural plugin can cause a dead loop with rapid cycling of programmes.
selectedProgramme
events. In this case the problem was fired from aremoveAllTabs
call, which calledremoveTab
multiple times. There was logic inremoveTab
code to select another programme viaselectProgramme
(this was wrong anyway - UI code should not make this decision). There is a loop in there whereselectProgramme
calls listeners, one of which callsselectTab
, which callsselectProgramme
. Normally the loop is broken when the secondselectProgramme
call realises that programme is already selected - but obviously this doesn't work when you have queued, competing events which are switching to other programmes.removeTab
selecting another programme. Instead, the UI responds to whatever the store code decides to select in that case. Second fix was to implement ajuce::NotificationType
parameter inselectTab
, which prevents the calling of listeners (an thereforeprogrammeSelected
) if the notification type isdontSendNotification
.