Skip to content

Commit

Permalink
Simulate document data updates in ARATestPlugIn
Browse files Browse the repository at this point in the history
  • Loading branch information
sgretscher committed Jun 13, 2024
1 parent 5bb57ee commit ff194ea
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
26 changes: 26 additions & 0 deletions TestPlugIn/ARATestDocumentController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,32 @@ void ARATestDocumentController::doUpdateMusicalContextContent (ARA::PlugIn::Musi
#endif
}

/*******************************************************************************/
// Here we're simulating to have some document data that depends on the playback region positioning,
// just like some alignment plug-in would have - this state would be updated when adding or removing
// regions to the arrangement or when their time ranges or stretching mode changes.

void ARATestDocumentController::didAddPlaybackRegionToRegionSequence (ARA::PlugIn::RegionSequence* /*regionSequence*/, ARA::PlugIn::PlaybackRegion* /*playbackRegion*/) noexcept
{
notifyDocumentDataChanged ();
}

void ARATestDocumentController::willRemovePlaybackRegionFromRegionSequence (ARA::PlugIn::RegionSequence* /*regionSequence*/, ARA::PlugIn::PlaybackRegion* /*playbackRegion*/) noexcept
{
notifyDocumentDataChanged ();
}

void ARATestDocumentController::willUpdatePlaybackRegionProperties (ARA::PlugIn::PlaybackRegion* playbackRegion, ARA::PlugIn::PropertiesPtr<ARA::ARAPlaybackRegionProperties> newProperties) noexcept
{
if ((playbackRegion->isTimestretchEnabled () != ((newProperties->transformationFlags & ARA::kARAPlaybackTransformationTimestretch) != 0) ) ||
(playbackRegion->isTimeStretchReflectingTempo () != ((newProperties->transformationFlags & ARA::kARAPlaybackTransformationTimestretchReflectingTempo) != 0) ) ||
(playbackRegion->getStartInAudioModificationTime () != newProperties->startInModificationTime) ||
(playbackRegion->getDurationInAudioModificationTime () != newProperties->durationInModificationTime) ||
(playbackRegion->getStartInPlaybackTime () != newProperties->startInPlaybackTime) ||
(playbackRegion->getDurationInPlaybackTime () != newProperties->durationInPlaybackTime))
notifyDocumentDataChanged ();
}

/*******************************************************************************/

ARA::PlugIn::AudioSource* ARATestDocumentController::doCreateAudioSource (ARA::PlugIn::Document* document, ARA::ARAAudioSourceHostRef hostRef) noexcept
Expand Down
7 changes: 7 additions & 0 deletions TestPlugIn/ARATestDocumentController.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ class ARATestDocumentController : public ARA::PlugIn::DocumentController
// Musical Context Management
void doUpdateMusicalContextContent (ARA::PlugIn::MusicalContext* musicalContext, const ARA::ARAContentTimeRange* range, ARA::ContentUpdateScopes scopeFlags) noexcept override;

// Region Sequence Management
void didAddPlaybackRegionToRegionSequence (ARA::PlugIn::RegionSequence* /*regionSequence*/, ARA::PlugIn::PlaybackRegion* /*playbackRegion*/) noexcept override;
void willRemovePlaybackRegionFromRegionSequence (ARA::PlugIn::RegionSequence* /*regionSequence*/, ARA::PlugIn::PlaybackRegion* /*playbackRegion*/) noexcept override;

// Playback Region Management
void willUpdatePlaybackRegionProperties (ARA::PlugIn::PlaybackRegion* playbackRegion, ARA::PlugIn::PropertiesPtr<ARA::ARAPlaybackRegionProperties> newProperties) noexcept override;

// Audio Source Management
ARA::PlugIn::AudioSource* doCreateAudioSource (ARA::PlugIn::Document* document, ARA::ARAAudioSourceHostRef hostRef) noexcept override;
void willUpdateAudioSourceProperties (ARA::PlugIn::AudioSource* audioSource, ARA::PlugIn::PropertiesPtr<ARA::ARAAudioSourceProperties> newProperties) noexcept override;
Expand Down

0 comments on commit ff194ea

Please sign in to comment.