Audacity 3.2.0
Namespaces | Classes | Functions
PackedArray Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  Deleter
 Deleter for an array of elements and optional contiguous header structure. More...
 
struct  Ptr
 Smart pointer type that deallocates with Deleter. More...
 
struct  Traits
 Primary template used in Deleter that can be specialized. More...
 
struct  Traits< AudioBufferList >
 
struct  Traits< AudioUnitCocoaViewInfo >
 

Functions

template<typename Type , template< typename > typename BaseDeleter>
size_t Count (const Ptr< Type, BaseDeleter > &p)
 Find out how many elements were allocated with a Ptr. More...
 
template<typename Type , template< typename > typename BaseDeleter>
auto begin (const Ptr< Type, BaseDeleter > &p)
 Enables range-for. More...
 
template<typename Type , template< typename > typename BaseDeleter>
auto end (const Ptr< Type, BaseDeleter > &p)
 Enables range-for. More...
 
template<typename Type >
auto AllocateBytes (size_t enlarged)
 Allocate a Ptr<Type> holding at least enlarged bytes. More...
 
template<typename Type >
auto AllocateCount (size_t count)
 Allocate a Ptr<Type> holding count elements. More...
 

Function Documentation

◆ AllocateBytes()

template<typename Type >
auto PackedArray::AllocateBytes ( size_t  enlarged)

Allocate a Ptr<Type> holding at least enlarged bytes.

Usage: AllocateBytes<Type>(bytes)(constructor arguments for Type) Meant to resemble placement-new syntax with separation of allocator and constructor arguments

Definition at line 192 of file PackedArray.h.

193{
194 return [enlarged](auto &&...args) {
195 return Ptr<Type>{
196 safenew(PackedArrayArg, enlarged)
197 Type{ std::forward<decltype(args)>(args)... },
198 std::max(sizeof(Type), enlarged) // Deleter's constructor argument
199 };
200 };
201}
#define safenew
Definition: MemoryX.h:10
static constexpr PackedArray_t PackedArrayArg
Tag argument to distinguish an overload of operator new.
Definition: PackedArray.h:171
Smart pointer type that deallocates with Deleter.
Definition: PackedArray.h:130

References PackedArrayArg, and safenew.

◆ AllocateCount()

template<typename Type >
auto PackedArray::AllocateCount ( size_t  count)

Allocate a Ptr<Type> holding count elements.

Usage: AllocateCount<Type>(count)(constructor arguments for Type) Meant to resemble placement-new syntax with separation of allocator and constructor arguments

If Traits<Type> defines a nonempty header, the result always holds at least one element

Definition at line 212 of file PackedArray.h.

213{
214 using traits_type = detail::ExtendedTraits<Type>;
215 const auto bytes = traits_type::element_offset()
216 + count * sizeof(typename traits_type::element_type);
217 return AllocateBytes<Type>(bytes);
218}
Primary template of metafunction deducing other things from Traits<T>
Definition: PackedArray.h:26

◆ begin()

template<typename Type , template< typename > typename BaseDeleter>
auto PackedArray::begin ( const Ptr< Type, BaseDeleter > &  p)
inline

Enables range-for.

Definition at line 150 of file PackedArray.h.

151{
152 using traits_type = detail::ExtendedTraits<Type>;
153 auto ptr = p.get();
154 return ptr ? traits_type::begin(ptr) : nullptr;
155}
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:150

References begin().

Referenced by VampEffect::AddFeatures(), TrackList::ApplyPendingTracks(), begin(), MacroCommandsCatalog::ByCommandId(), MacroCommandsCatalog::ByFriendlyName(), TrackList::cbegin(), TrackList::ClearPendingTracks(), Envelope::CollapseRegion(), OverlayPanel::Compress(), Envelope::CopyRange(), ExportMultipleDialog::CountTracksAndLabels(), ShuttleGuiBase::DoInsertListColumns(), anonymous_namespace{TrackMenus.cpp}::DoMixAndRender(), TimeShiftHandle::DoSlideVertical(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawWaveformBackground(), end(), Envelope::EqualRange(), EstimateRemovedBlocks(), CommandManager::ExcludedList(), anonymous_namespace{ProjectSerializer.cpp}::FastStringConvert(), TrackList::FindById(), CellularPanel::FindCell(), anonymous_namespace{ProjectFileManager.cpp}::FindHelpUrl(), SubViewAdjuster::FindIndex(), anonymous_namespace{Scrubbing.cpp}::FindMenuItem(), BasicMenu::anonymous_namespace{BasicMenu.cpp}::FindPathName(), ToolBarConfiguration::FindPeers(), SubViewAdjuster::FindPermutation(), RealtimeEffectList::FindState(), Ruler::FindZero(), for(), anonymous_namespace{WaveTrackViewConstants.cpp}::Registry::Get(), TrackList::getBegin(), CommonTrackView::GetMinimizedHeight(), anonymous_namespace{EffectsPrefs.cpp}::GetModuleData(), WaveTrackView::GetSubViews(), CellularPanel::HandleMotion(), wxArrayStringEx::insert(), anonymous_namespace{Registry.cpp}::CollectedItems::InsertNewItemUsingHint(), SyncLock::IsSyncLockSelected(), ThemeBase::LoadOneThemeComponents(), NumericConverter::LookupFormat(), anonymous_namespace{WaveTrackView.cpp}::NextClipLooped(), SqliteSampleBlockFactory::OnBeginPurge(), anonymous_namespace{WindowMenus.cpp}::OnWindow(), PackedArray::Ptr< Type, BaseDeleter >::operator[](), SpectralDataManager::Worker::OvertonesProcessor(), Envelope::PasteEnvelope(), TimeTrack::PasteInto(), NyquistEffect::ProcessOne(), audacity::network_manager::IResponse::readAll(), anonymous_namespace{ProjectSerializer.cpp}::ReadBigEndian(), audacity::network_manager::CurlResponse::readData(), AllProjects::Remove(), UndoManager::RemoveStates(), BasicMenu::anonymous_namespace{BasicMenu.cpp}::ReplayPopup(), Importer::SelectDefaultOpenType(), WaveTrackUtils::SelectedClip(), anonymous_namespace{WaveTrackAffordanceControls.cpp}::SelectedClipOfFocusedTrack(), TrackPanelAx::SetFocus(), LabelTrack::SortLabels(), Journal::WindowPaths::anonymous_namespace{JournalWindowPaths.cpp}::UniqueWindowAmongPeers(), Journal::anonymous_namespace{Journal.cpp}::VersionCheck(), CellularPanel::Visit(), UndoManager::VisitStates(), and anonymous_namespace{ProjectSerializer.cpp}::WriteBigEndian().

Here is the call graph for this function:

◆ Count()

template<typename Type , template< typename > typename BaseDeleter>
size_t PackedArray::Count ( const Ptr< Type, BaseDeleter > &  p)
inline

Find out how many elements were allocated with a Ptr.

Definition at line 143 of file PackedArray.h.

144{
145 return p.get_deleter().GetCount();
146}

Referenced by end(), AudioUnitEffect::InitializePlugin(), AudioUnitInstance::ProcessBlock(), and AudioUnitInstance::Render().

Here is the caller graph for this function:

◆ end()

template<typename Type , template< typename > typename BaseDeleter>
auto PackedArray::end ( const Ptr< Type, BaseDeleter > &  p)
inline

Enables range-for.

Definition at line 159 of file PackedArray.h.

160{
161 auto result = begin(p);
162 if (result)
163 result += Count(p);
164 return result;
165}
size_t Count(const Ptr< Type, BaseDeleter > &p)
Find out how many elements were allocated with a Ptr.
Definition: PackedArray.h:143

References begin(), and Count().

Referenced by CommandDirectory::AddCommand(), anonymous_namespace{PluginMenus.cpp}::AddEffectMenuItemGroup(), PluginManager::Iterator::Advance(), AudioGraph::Buffers::Advance(), EffectNormalize::AnalyseTrackData(), EffectTruncSilence::Analyze(), SelectTimeCommand::Apply(), EffectAutoDuck::ApplyDuckFade(), ProjectSelectionManager::AS_ModifySelection(), RingBuffer::AvailForGet(), MacroCommandsCatalog::ByCommandId(), MacroCommandsCatalog::ByFriendlyName(), AttachedVirtualFunction< Tag, Return, This, Arguments >::Call(), TrackList::cend(), LV2FeaturesListBase::CheckFeatures(), LV2InstanceFeaturesList::CheckOptions(), RingBuffer::Clear(), AudioGraph::Buffers::ClearBuffer(), TrackList::ClearPendingTracks(), SubViewAdjustHandle::Click(), Envelope::CollapseRegion(), OverlayPanel::Compress(), Envelope::CopyRange(), audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::DataStreamRead(), AudioGraph::Buffers::Discard(), RingBuffer::Discard(), WaveTrack::Disjoin(), anonymous_namespace{SelectMenus.cpp}::DoBoundaryMove(), anonymous_namespace{TrackMenus.cpp}::DoMixAndRender(), TimeShiftHandle::DoSlideVertical(), anonymous_namespace{TrackMenus.cpp}::DoSortTracks(), SampleHandle::Drag(), anonymous_namespace{TrackPanel.cpp}::VRulersAndChannels::Draw(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawWaveformBackground(), Envelope::EqualRange(), EstimateRemovedBlocks(), CommandManager::ExcludedList(), WaveClip::ExpandCutLine(), WaveTrack::ExpandCutLine(), anonymous_namespace{ProjectSerializer.cpp}::FastStringConvert(), RingBuffer::Filled(), anonymous_namespace{Registry.cpp}::CollectedItems::Find(), ToolBarConfiguration::Find(), ChoiceSetting::Find(), TrackList::FindById(), Journal::WindowPaths::FindByPath(), CellularPanel::FindCell(), anonymous_namespace{WaveTrack.cpp}::FindClip(), anonymous_namespace{WaveClipTrimHandle.cpp}::FindClipsInChannels(), anonymous_namespace{ProjectFileManager.cpp}::FindHelpUrl(), SubViewAdjuster::FindIndex(), anonymous_namespace{Scrubbing.cpp}::FindMenuItem(), BasicMenu::anonymous_namespace{BasicMenu.cpp}::FindPathName(), ToolBarConfiguration::FindPeers(), SubViewAdjuster::FindPermutation(), RealtimeEffectList::FindState(), anonymous_namespace{WaveformView.cpp}::FindWavePortions(), Ruler::FindZero(), for(), RingBuffer::Free(), anonymous_namespace{WaveTrackViewConstants.cpp}::Registry::Get(), MeterUpdateQueue::Get(), RingBuffer::Get(), SqliteSampleBlockFactory::GetActiveBlockIDs(), FrequencyPlotDialog::GetAudio(), Effect::GetBounds(), TrackList::getEnd(), LabelTrack::GetEndTime(), SampleTrackCache::GetFloats(), anonymous_namespace{ImportMP3_MPG123.cpp}::GetId3v2Genre(), Languages::GetLanguages(), anonymous_namespace{EffectsPrefs.cpp}::GetModuleData(), GetNextWindowPlacement(), TranscriptionToolBar::GetSamples(), WaveTrackView::GetSubViews(), FFmpegAPIResolver::GetSuportedAVFormatVersions(), RingBuffer::GetUnflushed(), ProjectWindow::GetZoomOfToFit(), CellularPanel::HandleMotion(), Identifier::Identifier(), Importer::Import(), anonymous_namespace{Registry.cpp}::CollectedItems::InsertNewItemUsingHint(), WaveTrack::InsertSilence(), EffectTruncSilence::Intersect(), TrackList::isNull(), WaveTrack::Join(), ThemeBase::LoadOneThemeComponents(), CommandDirectory::LookUp(), NumericConverter::LookupFormat(), anonymous_namespace{SelectMenus.cpp}::MoveWhenAudioInactive(), anonymous_namespace{WaveTrackView.cpp}::NextClipLooped(), NoteTrackTCPLines::NoteTrackTCPLines(), VoiceKey::OffBackward(), Ruler::OfflimitsPixels(), VoiceKey::OnBackward(), SqliteSampleBlockFactory::OnBeginPurge(), NavigationActions::Handler::OnNextWindow(), NavigationActions::Handler::OnPrevWindow(), AudacityPrintout::OnPrintPage(), ProjectAudioManager::OnRecord(), anonymous_namespace{WindowMenus.cpp}::OnWindow(), FFTDeleter::operator()(), anonymous_namespace{MIDIPlay.h}::Iterator::OutputEvent(), SpectralDataManager::Worker::OvertonesProcessor(), AudioUnitWrapper::ParameterInfo::ParseKey(), audacity::ParseRFC822Date(), Envelope::PasteEnvelope(), audacity::network_manager::CurlResponseFactory::performRequest(), TrackList::Permute(), PrefsDialog::PrefsDialog(), RealtimeEffectManager::Process(), EffectAutoDuck::Process(), EffectChangeSpeed::Process(), EffectClickRemoval::Process(), EffectEqualization::Process(), EffectFindClipping::Process(), EffectNoiseRemoval::Process(), NyquistEffect::Process(), EffectRepeat::Process(), EffectReverse::Process(), EffectSBSMS::Process(), EffectSimpleMono::Process(), EffectStereoToMono::Process(), Mixer::Process(), EffectNoiseReduction::Worker::Process(), EffectStereoToMono::ProcessOne(), EffectLoudness::ProcessOne(), EffectNormalize::ProcessOne(), EffectChangeSpeed::ProcessOne(), EffectSimpleMono::ProcessOne(), EffectTwoPassSimpleMono::ProcessOne(), EffectPaulstretch::ProcessOne(), EffectReverse::ProcessOneWave(), EffectTwoPassSimpleMono::ProcessPass(), RingBuffer::Put(), MeterUpdateQueue::Put(), audacity::network_manager::IResponse::readAll(), audacity::network_manager::CurlResponse::readData(), ThemeBase::ReadImageCache(), MultiFormatReader::ReadSamples(), PrefsDialog::RecordExpansionState(), Registry::RegisterItem(), AllProjects::Remove(), RealtimeEffectList::RemoveState(), UndoManager::RemoveStates(), BasicMenu::anonymous_namespace{BasicMenu.cpp}::ReplayPopup(), WaveTrack::RightmostOrNewClip(), anonymous_namespace{SampleHandle.cpp}::SampleResolutionTest(), anonymous_namespace{SelectMenus.cpp}::SeekWhenAudioInactive(), WaveTrackUtils::SelectedClip(), anonymous_namespace{WaveTrackAffordanceControls.cpp}::SelectedClipOfFocusedTrack(), PlayRegion::SetAllTimes(), PlayRegion::SetEnd(), LabelTrackView::SetTextSelection(), PlayRegion::SetTimes(), SelectionBar::SetTimes(), WaveTrack::Silence(), AdornedRulerPanel::StartQPPlay(), SelectHandle::StartSnappingFreqSelection(), TranslatableString::Strip(), anonymous_namespace{CellularPanel.cpp}::Subdivide(), Track::SubstituteOriginalTrack(), Track::SubstitutePendingChangedTrack(), XMLAttributeValueView::TryGet(), XMLAttributeValueView::TryGetInteger(), MenuManager::TryToMakeActionAllowed(), Journal::WindowPaths::anonymous_namespace{JournalWindowPaths.cpp}::UniqueWindowAmongPeers(), RingBuffer::Unput(), internal::x11::RunLoop::unregisterEventHandler(), UnregisterProviderFactory(), internal::x11::RunLoop::unregisterTimer(), anonymous_namespace{ScrubState.cpp}::ScrubQueue::Update(), Ruler::Updater::UpdateNonlinear(), TrackPanel::UpdateTrackVRuler(), audacity::UrlDecode(), Journal::anonymous_namespace{Journal.cpp}::VersionCheck(), CellularPanel::Visit(), ToolDock::VisitLayout(), UndoManager::VisitStates(), WaveTrackTCPLines::WaveTrackTCPLines(), NoteTrack::ZoomTo(), and SelectionStateChanger::~SelectionStateChanger().

Here is the call graph for this function: