本文整理汇总了C++中Track::GetSelected方法的典型用法代码示例。如果您正苦于以下问题:C++ Track::GetSelected方法的具体用法?C++ Track::GetSelected怎么用?C++ Track::GetSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::GetSelected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
bool EffectAutoDuck::Init()
{
mControlTrack = NULL;
TrackListIterator iter(inputTracks());
Track *t = iter.First();
bool lastWasSelectedWaveTrack = false;
const WaveTrack *controlTrackCandidate = NULL;
while(t)
{
if (lastWasSelectedWaveTrack && !t->GetSelected() &&
t->GetKind() == Track::Wave)
{
// This could be the control track, so remember it
controlTrackCandidate = (WaveTrack*)t;
}
lastWasSelectedWaveTrack = false;
if (t->GetSelected())
{
if (t->GetKind() == Track::Wave)
{
lastWasSelectedWaveTrack = true;
}
else
{
Effect::MessageBox(
_("You selected a track which does not contain audio. AutoDuck can only process audio tracks."),
/* i18n-hint: Auto duck is the name of an effect that 'ducks' (reduces the volume)
* of the audio automatically when there is sound on another track. Not as
* in 'Donald-Duck'!*/
wxICON_ERROR);
return false;
}
}
t = iter.Next();
}
if (!controlTrackCandidate)
{
Effect::MessageBox(
_("Auto Duck needs a control track which must be placed below the selected track(s)."),
wxICON_ERROR);
return false;
}
mControlTrack = controlTrackCandidate;
return true;
}
示例2: GetState
// Returns a state constant.
wxAccStatus TrackPanelAx::GetState( int childId, long* state )
{
#if defined(__WXMSW__)
if( childId > 0 )
{
Track *t = FindTrack( childId );
*state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE;
if (t)
{
if( t == mFocusedTrack )
{
*state |= wxACC_STATE_SYSTEM_FOCUSED;
}
if( t->GetSelected() )
{
*state |= wxACC_STATE_SYSTEM_SELECTED;
}
}
}
else // childId == wxACC_SELF
{
*state = wxACC_STATE_SYSTEM_FOCUSABLE + wxACC_STATE_SYSTEM_FOCUSED;
}
#endif
#if defined(__WXMAC__)
*state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE;
if( childId > 0 )
{
Track *t = FindTrack( childId );
if (t)
{
if( t == mFocusedTrack )
{
*state |= wxACC_STATE_SYSTEM_FOCUSED;
}
if( t->GetSelected() )
{
*state |= wxACC_STATE_SYSTEM_SELECTED;
}
}
}
#endif
return wxACC_OK;
}
示例3: CopyInputTracks
//
// private methods
//
// Use these two methods to copy the input tracks to mOutputTracks, if
// doing the processing on them, and replacing the originals only on success (and not cancel).
// Copy the group tracks that have tracks selected
void Effect::CopyInputTracks(int trackType)
{
// Reset map
mIMap.Clear();
mOMap.Clear();
mOutputTracks = new TrackList();
mOutputTracksType = trackType;
//iterate over tracks of type trackType (All types if Track::All)
TrackListOfKindIterator aIt(trackType, mTracks);
t2bHash added;
for (Track *aTrack = aIt.First(); aTrack; aTrack = aIt.Next()) {
// Include selected tracks, plus sync-lock selected tracks for Track::All.
if (aTrack->GetSelected() ||
(trackType == Track::All && aTrack->IsSyncLockSelected()))
{
Track *o = aTrack->Duplicate();
mOutputTracks->Add(o);
mIMap.Add(aTrack);
mOMap.Add(o);
}
}
}
示例4: GetNumExportChannels
int TrackList::GetNumExportChannels(bool selectionOnly)
{
/* counters for tracks panned different places */
int numLeft = 0;
int numRight = 0;
int numMono = 0;
/* track iteration kit */
Track *tr;
TrackListIterator iter;
for (tr = iter.First(this); tr != NULL; tr = iter.Next()) {
// Want only unmuted wave tracks.
if ((tr->GetKind() != Track::Wave) || tr->GetMute())
continue;
// do we only want selected ones?
if (selectionOnly && !(tr->GetSelected())) {
//want selected but this one is not
continue;
}
// Found a left channel
if (tr->GetChannel() == Track::LeftChannel) {
numLeft++;
}
// Found a right channel
else if (tr->GetChannel() == Track::RightChannel) {
numRight++;
}
// Found a mono channel, but it may be panned
else if (tr->GetChannel() == Track::MonoChannel) {
float pan = ((WaveTrack*)tr)->GetPan();
// Figure out what kind of channel it should be
if (pan == -1.0) { // panned hard left
numLeft++;
}
else if (pan == 1.0) { // panned hard right
numRight++;
}
else if (pan == 0) { // panned dead center
numMono++;
}
else { // panned somewhere else
numLeft++;
numRight++;
}
}
}
// if there is stereo content, report 2, else report 1
if (numRight > 0 || numLeft > 0) {
return 2;
}
return 1;
}
示例5: GetAudio
void FreqWindow::GetAudio()
{
mData.reset();
mDataLen = 0;
int selcount = 0;
bool warning = false;
TrackListIterator iter(p->GetTracks());
Track *t = iter.First();
while (t) {
if (t->GetSelected() && t->GetKind() == Track::Wave) {
WaveTrack *track = (WaveTrack *)t;
if (selcount==0) {
mRate = track->GetRate();
auto start = track->TimeToLongSamples(p->mViewInfo.selectedRegion.t0());
auto end = track->TimeToLongSamples(p->mViewInfo.selectedRegion.t1());
auto dataLen = end - start;
if (dataLen > 10485760) {
warning = true;
mDataLen = 10485760;
}
else
// dataLen is not more than 10 * 2 ^ 20
mDataLen = dataLen.as_size_t();
mData = Floats{ mDataLen };
// Don't allow throw for bad reads
track->Get((samplePtr)mData.get(), floatSample, start, mDataLen,
fillZero, false);
}
else {
if (track->GetRate() != mRate) {
AudacityMessageBox(_("To plot the spectrum, all selected tracks must be the same sample rate."));
mData.reset();
mDataLen = 0;
return;
}
auto start = track->TimeToLongSamples(p->mViewInfo.selectedRegion.t0());
Floats buffer2{ mDataLen };
// Again, stop exceptions
track->Get((samplePtr)buffer2.get(), floatSample, start, mDataLen,
fillZero, false);
for (size_t i = 0; i < mDataLen; i++)
mData[i] += buffer2[i];
}
selcount++;
}
t = iter.Next();
}
if (selcount == 0)
return;
if (warning) {
wxString msg;
msg.Printf(_("Too much audio was selected. Only the first %.1f seconds of audio will be analyzed."),
(mDataLen / mRate));
AudacityMessageBox(msg);
}
}
示例6: GetName
// Gets the name of the specified object.
wxAccStatus TrackPanelAx::GetName( int childId, wxString* name )
{
#if defined(__WXMSW__)
if( childId == wxACC_SELF )
{
*name = _( "TrackView" );
}
else
{
Track *t = FindTrack( childId );
if( t == NULL )
{
return wxACC_FAIL;
}
else
{
*name = t->GetName();
if( *name == t->GetDefaultName() )
{
/* i18n-hint: The %d is replaced by th enumber of the track.*/
name->Printf(_("Track %d"), TrackNum( t ) );
}
// LLL: Remove these during "refactor"
if( t->GetMute() )
{
/* i18n-hint: This is for screen reader software and indicates that
on this track mute is on.*/
*name->Append( _( " Mute On" ) );
}
if( t->GetSolo() )
{
/* i18n-hint: This is for screen reader software and indicates that
on this track solo is on.*/
*name->Append( _( " Solo On" ) );
}
if( t->GetSelected() )
{
/* i18n-hint: This is for screen reader software and indicates that
this track is selected.*/
*name->Append( _( " Select On" ) );
}
}
}
return wxACC_OK;
#endif
#if defined(__WXMAC__)
return wxACC_NOT_IMPLEMENTED;
#endif
}
示例7: Process
bool EffectReverse::Process()
{
//Track::All is needed because Reverse should move the labels too
this->CopyInputTracks(Track::All); // Set up mOutputTracks.
bool bGoodResult = true;
TrackListIterator iter(mOutputTracks);
Track *t = iter.First();
int count = 0;
while (t) {
if (t->GetKind() == Track::Wave &&
(t->GetSelected() || t->IsSyncLockSelected()))
{
WaveTrack *track = (WaveTrack*)t;
if (mT1 > mT0) {
sampleCount start = track->TimeToLongSamples(mT0);
sampleCount end = track->TimeToLongSamples(mT1);
sampleCount len = (sampleCount)(end - start);
if (!ProcessOneWave(count, track, start, len))
{
bGoodResult = false;
break;
}
}
}
else if (t->GetKind() == Track::Label &&
(t->GetSelected() || t->IsSyncLockSelected()))
{
LabelTrack *track = (LabelTrack*)t;
track->ChangeLabelsOnReverse(mT0, mT1);
}
t = iter.Next();
count++;
}
this->ReplaceProcessedTracks(bGoodResult);
return bGoodResult;
}
示例8: OnUseSelectionB
void ContrastDialog::OnUseSelectionB(wxCommandEvent & event)
{
AudacityProject *p = GetActiveProject();
TrackListIterator iter(p->GetTracks());
Track *t = iter.First();
while (t) {
if (t->GetSelected() && t->GetKind() == Track::Wave) {
mBackgroundStartT->SetTimeValue(p->mViewInfo.sel0);
mBackgroundEndT->SetTimeValue(p->mViewInfo.sel1);
break;
}
t = iter.Next();
}
bBGset = true;
OnGetBackgroundDB(event);
}
示例9: EnableDisableButtons
void EditToolBar::EnableDisableButtons()
{
AudacityProject *p = GetActiveProject();
if (!p) return;
// Is anything selected?
bool selection = false;
TrackListIterator iter(p->GetTracks());
for (Track *t = iter.First(); t; t = iter.Next())
if (t->GetSelected()) {
selection = true;
break;
}
selection &= (p->GetSel0() < p->GetSel1());
mButtons[ETBCutID]->SetEnabled(selection);
mButtons[ETBCopyID]->SetEnabled(selection);
mButtons[ETBTrimID]->SetEnabled(selection);
mButtons[ETBSilenceID]->SetEnabled(selection);
mButtons[ETBUndoID]->SetEnabled(p->GetUndoManager()->UndoAvailable());
mButtons[ETBRedoID]->SetEnabled(p->GetUndoManager()->RedoAvailable());
bool tracks = (!p->GetTracks()->IsEmpty());
mButtons[ETBZoomInID]->SetEnabled(tracks && (p->ZoomInAvailable()));
mButtons[ETBZoomOutID]->SetEnabled(tracks && (p->ZoomOutAvailable()) );
#if 0 // Disabled for version 1.2.0 since it doesn't work quite right...
mButtons[ETBZoomToggleID]->SetEnabled(tracks);
#endif
mButtons[ETBZoomSelID]->SetEnabled(selection);
mButtons[ETBZoomFitID]->SetEnabled(tracks);
mButtons[ETBPasteID]->SetEnabled(p->Clipboard());
#ifdef EXPERIMENTAL_SYNC_LOCK
bool bSyncLockTracks;
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &bSyncLockTracks, false);
if (bSyncLockTracks)
mButtons[ETBSyncLockID]->PushDown();
else
mButtons[ETBSyncLockID]->PopUp();
#endif
}
示例10: GetValue
wxAccStatus TrackPanelAx::GetValue( int WXUNUSED(childId), wxString* WXUNUSED(strValue) )
#endif
{
#if defined(__WXMSW__)
return wxACC_NOT_IMPLEMENTED;
#endif
#if defined(__WXMAC__)
if( childId == wxACC_SELF )
{
*strValue = _( "TrackView" );
}
else
{
Track *t = FindTrack( childId );
if( t == NULL )
{
return wxACC_FAIL;
}
else
{
*strValue = t->GetName();
if( *strValue == t->GetDefaultName() )
{
strValue->Printf(_("Track %d"), TrackNum( t ) );
}
// LLL: Remove these during "refactor"
if( t->GetMute() )
{
strValue->Append( _( " Mute On" ) );
}
if( t->GetSolo() )
{
strValue->Append( _( " Solo On" ) );
}
if( t->GetSelected() )
{
strValue->Append( _( " Select On" ) );
}
}
}
return wxACC_OK;
#endif
}
示例11: EnableDisableButtons
void TranscriptionToolBar::EnableDisableButtons()
{
#ifdef EXPERIMENTAL_VOICE_DETECTION
AudacityProject *p = GetActiveProject();
if (!p) return;
// Is anything selected?
bool selection = false;
TrackListIterator iter(p->GetTracks());
for (Track *t = iter.First(); t; t = iter.Next())
if (t->GetSelected()) {
selection = true;
break;
}
selection &= (p->GetSel0() < p->GetSel1());
mButtons[TTB_Calibrate]->SetEnabled(selection);
#endif
}
示例12: GetName
// Gets the name of the specified object.
wxAccStatus TrackPanelAx::GetName( int childId, wxString* name )
{
if( childId == wxACC_SELF )
{
*name = _( "TrackView" );
}
else
{
Track *t = FindTrack( childId );
if( t == NULL )
{
*name = _( "Track Accessible out of sync" );
return wxACC_FAIL;
}
else
{
*name = t->GetName();
if( *name == t->GetDefaultName() )
{
name->Printf(_("Track %d"), TrackNum( t ) );
}
// LLL: Remove these during "refactor"
if( t->GetMute() )
{
*name->Append( _( " Mute On" ) );
}
if( t->GetSolo() )
{
*name->Append( _( " Solo On" ) );
}
if( t->GetSelected() )
{
*name->Append( _( " Select On" ) );
}
}
}
return wxACC_OK;
}
示例13: Process
bool EffectSilence::Process()
{
double length = mT1 - mT0;
if (length <= 0.0)
length = sDefaultGenerateLen;
//Iterate over each track
TrackListIterator iter(mTracks);
Track *track = iter.First();
while (track) {
if (track->GetSelected())
track->InsertSilence(mT0, length);
//Iterate to the next track
track = iter.Next();
}
return true;
}
示例14: OnToggle
void OnToggle(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &selectionState = project.GetSelectionState();
Track *t;
t = trackPanel->GetFocusedTrack(); // Get currently focused track
if (!t)
return;
selectionState.SelectTrack
( *t, !t->GetSelected(), true );
trackPanel->EnsureVisible( t );
project.ModifyState(false);
trackPanel->GetAx().Updated();
return;
}
示例15: CountWaveTracks
void Effect::CountWaveTracks()
{
mNumTracks = 0;
mNumGroups = 0;
TrackListOfKindIterator iter(Track::Wave, mTracks);
Track *t = iter.First();
while(t) {
if (!t->GetSelected()) {
t = iter.Next();
continue;
}
if (t->GetKind() == Track::Wave) {
mNumTracks++;
if (!t->GetLinked())
mNumGroups++;
}
t = iter.Next();
}
}