本文整理汇总了C++中WaveClip::GetSequence方法的典型用法代码示例。如果您正苦于以下问题:C++ WaveClip::GetSequence方法的具体用法?C++ WaveClip::GetSequence怎么用?C++ WaveClip::GetSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WaveClip
的用法示例。
在下文中一共展示了WaveClip::GetSequence方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
///by default creates the order of the wavetrack to load.
void ODDecodeTask::Update()
{
std::vector<ODDecodeBlockFile*> tempBlocks;
mWaveTrackMutex.Lock();
for(size_t j=0;j<mWaveTracks.size();j++)
{
if(mWaveTracks[j])
{
WaveClip *clip;
BlockArray *blocks;
Sequence *seq;
//gather all the blockfiles that we should process in the wavetrack.
WaveClipList::compatibility_iterator node = mWaveTracks[j]->GetClipIterator();
while(node) {
clip = node->GetData();
seq = clip->GetSequence();
//TODO:this lock is way to big since the whole file is one sequence. find a way to break it down.
seq->LockDeleteUpdateMutex();
//See Sequence::Delete() for why need this for now..
blocks = clip->GetSequenceBlockArray();
int i;
int insertCursor;
insertCursor =0;//OD TODO:see if this works, removed from inner loop (bfore was n*n)
for(i=0; i<(int)blocks->GetCount(); i++)
{
//since we have more than one ODBlockFile, we will need type flags to cast.
if(!blocks->Item(i)->f->IsDataAvailable() && ((ODDecodeBlockFile*)blocks->Item(i)->f)->GetDecodeType()==this->GetODType())
{
blocks->Item(i)->f->Ref();
((ODDecodeBlockFile*)blocks->Item(i)->f)->SetStart(blocks->Item(i)->start);
((ODDecodeBlockFile*)blocks->Item(i)->f)->SetClipOffset((sampleCount)(clip->GetStartTime()*clip->GetRate()));
//these will always be linear within a sequence-lets take advantage of this by keeping a cursor.
while(insertCursor<(int)tempBlocks.size()&&
(sampleCount)(tempBlocks[insertCursor]->GetStart()+tempBlocks[insertCursor]->GetClipOffset()) <
(sampleCount)(((ODDecodeBlockFile*)blocks->Item(i)->f)->GetStart()+((ODDecodeBlockFile*)blocks->Item(i)->f)->GetClipOffset()))
insertCursor++;
tempBlocks.insert(tempBlocks.begin()+insertCursor++,(ODDecodeBlockFile*)blocks->Item(i)->f);
}
}
seq->UnlockDeleteUpdateMutex();
node = node->GetNext();
}
}
}
mWaveTrackMutex.Unlock();
//get the new order.
OrderBlockFiles(tempBlocks);
}
示例2: GetSequenceAtX
Sequence* WaveTrack::GetSequenceAtX(int xcoord)
{
WaveClip* clip = GetClipAtX(xcoord);
if (clip)
return clip->GetSequence();
else
return NULL;
}
示例3: GetMaxBlockSize
sampleCount WaveTrack::GetMaxBlockSize()
{
int maxblocksize = 0;
for (WaveClipList::Node* it=GetClipIterator(); it; it=it->GetNext())
{
WaveClip* clip = it->GetData();
if (clip->GetSequence()->GetMaxBlockSize() > maxblocksize)
maxblocksize = clip->GetSequence()->GetMaxBlockSize();
}
if (maxblocksize == 0)
{
// We really need the maximum block size, so create a
// temporary sequence to get it.
Sequence *tempseq = new Sequence(mDirManager, mFormat);
maxblocksize = tempseq->GetMaxBlockSize();
delete tempseq;
}
wxASSERT(maxblocksize > 0);
return maxblocksize;
}
示例4: GetBestBlockSize
sampleCount WaveTrack::GetBestBlockSize(longSampleCount s)
{
sampleCount bestBlockSize = GetMaxBlockSize();
for (WaveClipList::Node* it=GetClipIterator(); it; it=it->GetNext())
{
WaveClip* clip = it->GetData();
longSampleCount startSample = (longSampleCount)floor(clip->GetStartTime()*mRate + 0.5);
longSampleCount endSample = startSample + clip->GetNumSamples();
if (s >= startSample && s < endSample)
{
bestBlockSize = clip->GetSequence()->GetMaxBlockSize();
break;
}
}
return bestBlockSize;
}
示例5: Update
///by default creates the order of the wavetrack to load.
void ODComputeSummaryTask::Update()
{
std::vector<ODPCMAliasBlockFile*> tempBlocks;
mWaveTrackMutex.Lock();
if(mWaveTrack)
{
WaveClip *clip;
BlockArray *blocks;
Sequence *seq;
//gather all the blockfiles that we should process in the wavetrack.
WaveClipList::Node* node = mWaveTrack->GetClipIterator();
while(node) {
clip = node->GetData();
seq = clip->GetSequence();
//TODO:this lock is way to big since the whole file is one sequence. find a way to break it down.
seq->LockDeleteUpdateMutex();
//See Sequence::Delete() for why need this for now..
blocks = clip->GetSequenceBlockArray();
int i;
for(i=0; i<(int)blocks->GetCount(); i++)
{
//in the future if we have more than one ODBlockFile, we will need type flags to cast.
if(!blocks->Item(i)->f->IsSummaryAvailable())
{
blocks->Item(i)->f->Ref();
((ODPCMAliasBlockFile*)blocks->Item(i)->f)->SetStart(blocks->Item(i)->start);
tempBlocks.push_back((ODPCMAliasBlockFile*)blocks->Item(i)->f);
}
}
seq->UnlockDeleteUpdateMutex();
node = node->GetNext();
}
}
mWaveTrackMutex.Unlock();
//get the new order.
OrderBlockFiles(tempBlocks);
}
示例6: Silence
bool WaveTrack::Silence(double t0, double t1)
{
if (t1 < t0)
return false;
longSampleCount start = (longSampleCount)floor(t0 * mRate + 0.5);
longSampleCount len = (longSampleCount)floor(t1 * mRate + 0.5) - start;
bool result = true;
for (WaveClipList::Node* it=GetClipIterator(); it; it=it->GetNext())
{
WaveClip *clip = it->GetData();
longSampleCount clipStart = clip->GetStartSample();
longSampleCount clipEnd = clip->GetEndSample();
if (clipEnd > start && clipStart < start+len)
{
// Clip sample region and Get/Put sample region overlap
sampleCount samplesToCopy = start+len - clipStart;
if (samplesToCopy > clip->GetNumSamples())
samplesToCopy = clip->GetNumSamples();
longSampleCount inclipDelta = 0;
longSampleCount startDelta = clipStart - start;
if (startDelta < 0)
{
inclipDelta = -startDelta; // make positive value
samplesToCopy -= inclipDelta;
startDelta = 0;
}
if (!clip->GetSequence()->SetSilence(inclipDelta, samplesToCopy))
{
wxASSERT(false); // should always work
return false;
}
clip->MarkChanged();
}
}
return result;
}
示例7: GetAllSeqBlocks
// Given a project, returns a single array of all SeqBlocks
// in the current set of tracks. Enumerating that array allows
// you to process all block files in the current set.
void GetAllSeqBlocks(AudacityProject *project,
BlockArray *outBlocks)
{
TrackList *tracks = project->GetTracks();
TrackListIterator iter(tracks);
Track *t = iter.First();
while (t) {
if (t->GetKind() == Track::Wave) {
WaveTrack *waveTrack = (WaveTrack *)t;
WaveClipList::compatibility_iterator node = waveTrack->GetClipIterator();
while(node) {
WaveClip *clip = node->GetData();
Sequence *sequence = clip->GetSequence();
BlockArray *blocks = sequence->GetBlockArray();
int i;
for (i = 0; i < (int)blocks->GetCount(); i++)
outBlocks->Add(blocks->Item(i));
node = node->GetNext();
}
}
t = iter.Next();
}
}
示例8: Update
///creates the order of the wavetrack to load.
///by default left to right, or frome the point the user has clicked.
void ODComputeSummaryTask::Update()
{
std::vector<ODPCMAliasBlockFile*> tempBlocks;
mWaveTrackMutex.Lock();
for(size_t j=0;j<mWaveTracks.size();j++)
{
if(mWaveTracks[j])
{
WaveClip *clip;
BlockArray *blocks;
Sequence *seq;
//gather all the blockfiles that we should process in the wavetrack.
WaveClipList::compatibility_iterator node = mWaveTracks[j]->GetClipIterator();
while(node) {
clip = node->GetData();
seq = clip->GetSequence();
//This lock may be way too big since the whole file is one sequence.
//TODO: test for large files and find a way to break it down.
Sequence::DeleteUpdateMutexLocker locker(*seq);
//See Sequence::Delete() for why need this for now..
//We don't need the mBlockFilesMutex here because it is only for the vector list.
//These are existing blocks, and its wavetrack or blockfiles won't be deleted because
//of the respective mWaveTrackMutex lock and LockDeleteUpdateMutex() call.
blocks = clip->GetSequenceBlockArray();
int i;
int insertCursor;
insertCursor =0;//OD TODO:see if this works, removed from inner loop (bfore was n*n)
for(i=0; i<(int)blocks->size(); i++)
{
//if there is data but no summary, this blockfile needs summarizing.
SeqBlock &block = (*blocks)[i];
BlockFile *const file = block.f;
if(file->IsDataAvailable() && !file->IsSummaryAvailable())
{
file->Ref();
ODPCMAliasBlockFile *const odpcmaFile = static_cast<ODPCMAliasBlockFile*>(file);
odpcmaFile->SetStart(block.start);
odpcmaFile->SetClipOffset((sampleCount)(clip->GetStartTime()*clip->GetRate()));
//these will always be linear within a sequence-lets take advantage of this by keeping a cursor.
while(insertCursor<(int)tempBlocks.size()&&
(sampleCount)(tempBlocks[insertCursor]->GetStart()+tempBlocks[insertCursor]->GetClipOffset()) <
(sampleCount)(odpcmaFile->GetStart()+odpcmaFile->GetClipOffset()))
insertCursor++;
tempBlocks.insert(tempBlocks.begin() + insertCursor++, odpcmaFile);
}
}
node = node->GetNext();
}
}
}
mWaveTrackMutex.Unlock();
//get the NEW order.
mBlockFilesMutex.Lock();
OrderBlockFiles(tempBlocks);
mBlockFilesMutex.Unlock();
MarkUpdateRan();
}