Audacity 3.2.0
Private Member Functions | Private Attributes | List of all members
MockSampleBlockFactory Class Referencefinal

#include <MockSampleBlockFactory.h>

Inheritance diagram for MockSampleBlockFactory:
[legend]
Collaboration diagram for MockSampleBlockFactory:
[legend]

Private Member Functions

SampleBlockIDs GetActiveBlockIDs () override
 
SampleBlockPtr DoCreate (constSamplePtr src, size_t numsamples, sampleFormat srcformat) override
 
SampleBlockPtr DoCreateSilent (size_t numsamples, sampleFormat srcformat) override
 
SampleBlockPtr DoCreateFromXML (sampleFormat srcformat, const AttributesList &attrs) override
 
SampleBlockPtr DoCreateFromId (sampleFormat srcformat, SampleBlockID id) override
 

Private Attributes

long long blockIdCount = 0
 

Additional Inherited Members

- Public Types inherited from SampleBlockFactory
using SampleBlockIDs = std::unordered_set< SampleBlockID >
 
- Public Types inherited from Observer::Publisher< SampleBlockCreateMessage >
using message_type = SampleBlockCreateMessage
 
using CallbackReturn = std::conditional_t< true, void, bool >
 
using Callback = std::function< CallbackReturn(const SampleBlockCreateMessage &) >
 Type of functions that can be connected to the Publisher. More...
 
- Public Member Functions inherited from SampleBlockFactory
virtual ~SampleBlockFactory ()
 
SampleBlockPtr Create (constSamplePtr src, size_t numsamples, sampleFormat srcformat)
 
SampleBlockPtr CreateSilent (size_t numsamples, sampleFormat srcformat)
 
SampleBlockPtr CreateFromXML (sampleFormat srcformat, const AttributesList &attrs)
 
SampleBlockPtr CreateFromId (sampleFormat srcformat, SampleBlockID id)
 
virtual SampleBlockIDs GetActiveBlockIDs ()=0
 
- Public Member Functions inherited from Observer::Publisher< SampleBlockCreateMessage >
 Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={})
 Constructor supporting type-erased custom allocation/deletion. More...
 
 Publisher (Publisher &&)=default
 
Publisheroperator= (Publisher &&)=default
 
Subscription Subscribe (Callback callback)
 Connect a callback to the Publisher; later-connected are called earlier. More...
 
Subscription Subscribe (Object &obj, Return(Object::*callback)(Args...))
 Overload of Subscribe takes an object and pointer-to-member-function. More...
 
- Static Public Member Functions inherited from SampleBlockFactory
static SampleBlockFactoryPtr New (AudacityProject &project)
 
- Static Public Attributes inherited from Observer::Publisher< SampleBlockCreateMessage >
static constexpr bool notifies_all
 
virtual SampleBlockPtr DoCreate (constSamplePtr src, size_t numsamples, sampleFormat srcformat)=0
 
virtual SampleBlockPtr DoCreateSilent (size_t numsamples, sampleFormat srcformat)=0
 
virtual SampleBlockPtr DoCreateFromXML (sampleFormat srcformat, const AttributesList &attrs)=0
 
virtual SampleBlockPtr DoCreateFromId (sampleFormat srcformat, SampleBlockID id)=0
 
- Protected Member Functions inherited from Observer::Publisher< SampleBlockCreateMessage >
CallbackReturn Publish (const SampleBlockCreateMessage &message)
 Send a message to connected callbacks. More...
 

Detailed Description


Audacity: A Digital Audio Editor

MockSampleBlockFactory.h

Matthieu Hodgkinson

Definition at line 16 of file MockSampleBlockFactory.h.

Member Function Documentation

◆ DoCreate()

SampleBlockPtr MockSampleBlockFactory::DoCreate ( constSamplePtr  src,
size_t  numsamples,
sampleFormat  srcformat 
)
inlineoverrideprivatevirtual

Implements SampleBlockFactory.

Definition at line 25 of file MockSampleBlockFactory.h.

27 {
28 return std::make_shared<MockSampleBlock>(
29 blockIdCount++, src, numsamples, srcformat);
30 }

References blockIdCount.

◆ DoCreateFromId()

SampleBlockPtr MockSampleBlockFactory::DoCreateFromId ( sampleFormat  srcformat,
SampleBlockID  id 
)
inlineoverrideprivatevirtual

Implements SampleBlockFactory.

Definition at line 47 of file MockSampleBlockFactory.h.

48 {
49 return nullptr;
50 }

◆ DoCreateFromXML()

SampleBlockPtr MockSampleBlockFactory::DoCreateFromXML ( sampleFormat  srcformat,
const AttributesList attrs 
)
inlineoverrideprivatevirtual

Implements SampleBlockFactory.

Definition at line 41 of file MockSampleBlockFactory.h.

42 {
43 return nullptr;
44 }

◆ DoCreateSilent()

SampleBlockPtr MockSampleBlockFactory::DoCreateSilent ( size_t  numsamples,
sampleFormat  srcformat 
)
inlineoverrideprivatevirtual

Implements SampleBlockFactory.

Definition at line 33 of file MockSampleBlockFactory.h.

34 {
35 std::vector<char> silence(numsamples * SAMPLE_SIZE(srcformat));
36 return std::make_shared<MockSampleBlock>(
37 blockIdCount++, silence.data(), numsamples, srcformat);
38 }
#define SAMPLE_SIZE(SampleFormat)
Definition: SampleFormat.h:52

References blockIdCount, and SAMPLE_SIZE.

◆ GetActiveBlockIDs()

SampleBlockIDs MockSampleBlockFactory::GetActiveBlockIDs ( )
inlineoverrideprivatevirtual
Returns
ids of all sample blocks created by this factory and still extant

Implements SampleBlockFactory.

Definition at line 18 of file MockSampleBlockFactory.h.

19 {
20 std::vector<long long> ids(blockIdCount);
21 std::iota(ids.begin(), ids.end(), 1LL);
22 return { ids.begin(), ids.end() };
23 }

References blockIdCount.

Member Data Documentation

◆ blockIdCount

long long MockSampleBlockFactory::blockIdCount = 0
private

Definition at line 52 of file MockSampleBlockFactory.h.

Referenced by DoCreate(), DoCreateSilent(), and GetActiveBlockIDs().


The documentation for this class was generated from the following file: