本文整理汇总了C++中Track::GetKind方法的典型用法代码示例。如果您正苦于以下问题:C++ Track::GetKind方法的具体用法?C++ Track::GetKind怎么用?C++ Track::GetKind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::GetKind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Track *SyncLockedTracksIterator::Prev(bool skiplinked)
{
Track *t = TrackListIterator::Prev(skiplinked);
//
// Ways to end a sync-locked group in reverse
//
// Beginning of tracks
if (!t)
return NULL;
// In wave section, encounter a label track
if (!mInLabelSection && t->GetKind() == Track::Label) {
cur = NULL;
return NULL;
}
#ifndef USE_MIDI
// Encounter a non-wave non-label track
if (t->GetKind() != Track::Wave && t->GetKind() != Track::Label) {
cur = NULL;
return NULL;
}
#endif
// Otherwise, check if we're in the label section
mInLabelSection = (t->GetKind() == Track::Label);
return t;
}
示例2: EnableDisableButtons
void ControlToolBar::EnableDisableButtons()
{
//TIDY-ME: Button logic could be neater.
AudacityProject *p = GetActiveProject();
bool tracks = false;
bool playing = mPlay->IsDown();
bool recording = mRecord->IsDown();
bool busy = gAudioIO->IsBusy() || playing || recording;
// Only interested in audio type tracks
if (p) {
TrackListIterator iter( p->GetTracks() );
for (Track *t = iter.First(); t; t = iter.Next()) {
if (t->GetKind() == Track::Wave
#if defined(USE_MIDI)
|| t->GetKind() == Track::Note
#endif
) {
tracks = true;
break;
}
}
}
mPlay->SetEnabled((!recording) || (tracks && !busy));
mRecord->SetEnabled(!busy && !playing);
mStop->SetEnabled(busy);
mRewind->SetEnabled(!busy);
mFF->SetEnabled(tracks && !busy);
mPause->SetEnabled(true);
}
示例3: TransferDataFromWindow
bool LabelDialog::TransferDataFromWindow()
{
int cnt = mData.size();
int i;
TrackListIterator iter(mTracks);
Track *t;
int tndx = 0;
// Clear all label tracks of labels
for (t = iter.First(); t; t = iter.Next()) {
if (t->GetKind() == Track::Label) {
LabelTrack *lt = (LabelTrack *)t;
tndx++;
for (i = lt->GetNumLabels() - 1; i >= 0 ; i--) {
lt->DeleteLabel(i);
}
}
}
// Create any added tracks
while (tndx < (int)mTrackNames.GetCount() - 1) {
// Extract the name
wxString name = mTrackNames[tndx + 1].AfterFirst(wxT('-')).Mid(1);
// Create the NEW track and add to track list
auto newTrack = mFactory.NewLabelTrack();
newTrack->SetName(name);
mTracks->Add(std::move(newTrack));
tndx++;
}
// Repopulate with updated labels
for (i = 0; i < cnt; i++) {
RowData &rd = mData[i];
// Look for track with matching index
tndx = 1;
for (t = iter.First(); t; t = iter.Next()) {
if (t->GetKind() == Track::Label && rd.index == tndx++) {
break;
}
}
wxASSERT(t);
if (!t)
return false;
// Add the label to it
((LabelTrack *) t)->AddLabel(rd.selectedRegion, rd.title);
((LabelTrack *) t)->Unselect();
}
return true;
}
示例4: 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;
}
示例5: TransferDataFromWindow
bool LabelDialog::TransferDataFromWindow()
{
int cnt = mData.GetCount();
int i;
TrackListIterator iter(mTracks);
Track *t;
int tndx = 0;
// Clear all label tracks of labels
for (t = iter.First(); t; t = iter.Next()) {
if (t->GetKind() == Track::Label) {
LabelTrack *lt = (LabelTrack *)t;
tndx++;
for (i = lt->GetNumLabels() - 1; i >= 0 ; i--) {
lt->DeleteLabel(i);
}
}
}
// Create any added tracks
while (tndx < (int)mTrackNames.GetCount() - 1) {
// Extract the name
wxString name = mTrackNames[tndx + 1].AfterFirst(wxT('-')).Mid(1);
// Create the new track and add to track list
LabelTrack *newTrack = new LabelTrack(mDirManager);
newTrack->SetName(name);
mTracks->Add(newTrack);
tndx++;
}
// Repopulate with updated labels
for (i = 0; i < cnt; i++) {
RowData *rd = mData[i];
// Look for track with matching index
tndx = 1;
for (t = iter.First(); t; t = iter.Next()) {
if (t->GetKind() == Track::Label && rd->index == tndx++) {
break;
}
}
// Add the label to it
if (!rd->title.IsEmpty()) {
((LabelTrack *) t)->AddLabel(rd->stime, rd->etime, rd->title);
((LabelTrack *) t)->Unselect();
}
}
return true;
}
示例6: CountTracksAndLabels
void ExportMultiple::CountTracksAndLabels()
{
mLabels = NULL;
mNumLabels = 0;
mNumWaveTracks = 0;
Track* pTrack;
for (pTrack = mIterator.First(mTracks); pTrack != NULL; pTrack = mIterator.Next())
{
switch (pTrack->GetKind())
{
// Count WaveTracks, and for linked pairs, count only the second of the pair.
case Track::Wave:
{
if (pTrack->GetLinked() == false)
mNumWaveTracks++;
break;
}
case Track::Label:
{
// Supports only one LabelTrack.
if (mLabels == NULL) {
mLabels = (LabelTrack*)pTrack;
mNumLabels = mLabels->GetNumLabels();
}
break;
}
}
}
}
示例7: iter
UIHandle::Result LabelDefaultClickHandle::Click
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
{
using namespace RefreshCode;
// Redraw to show the change of text box selection status
UIHandle::Result result = RefreshAll;
if (evt.event.LeftDown())
{
SaveState( pProject );
TrackList *const tracks = pProject->GetTracks();
TrackListIterator iter(tracks);
Track *n = iter.First();
while (n) {
if (n->GetKind() == Track::Label && evt.pCell.get() != n) {
LabelTrack *const lt = static_cast<LabelTrack*>(n);
lt->ResetFlags();
lt->Unselect();
}
n = iter.Next();
}
}
return result;
}
示例8: CountTracksAndLabels
void ExportMultiple::CountTracksAndLabels()
{
mLabels = NULL;
mNumLabels = 0;
mNumWaveTracks = 0;
Track* pTrack;
for (pTrack = mIterator->First(mTracks); pTrack != NULL; pTrack = mIterator->Next())
{
switch (pTrack->GetKind())
{
// Count WaveTracks, and for linked pairs, count only the second of the pair.
case Track::Wave:
{
if (!pTrack->GetMute() && !pTrack->GetLinked()) // Don't count muted tracks.
mNumWaveTracks++;
break;
}
// Only support one label track???
case Track::Label:
{
// Supports only one LabelTrack.
if (mLabels == NULL) {
mLabels = (LabelTrack*)pTrack;
mNumLabels = mLabels->GetNumLabels();
}
break;
}
}
}
}
示例9: 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;
}
示例10: IsTaskAssociatedWithProject
bool ODTask::IsTaskAssociatedWithProject(AudacityProject* proj)
{
TrackList *tracks = proj->GetTracks();
TrackListIterator iter1(tracks);
Track *tr = iter1.First();
while (tr)
{
//go over all tracks in the project
if (tr->GetKind() == Track::Wave)
{
//look inside our task's track list for one that matches this projects one.
mWaveTrackMutex.Lock();
for(int i=0;i<(int)mWaveTracks.size();i++)
{
if(mWaveTracks[i]==tr)
{
//if we find one, then the project is associated with us;return true
mWaveTrackMutex.Unlock();
return true;
}
}
mWaveTrackMutex.Unlock();
}
tr = iter1.Next();
}
return false;
}
示例11: ShowModal
int ExportMultiple::ShowModal()
{
Track *tr;
mLabels = NULL;
mNumLabels = 0;
mNumTracks = 0;
// Examine the track list looking for Wave and Label tracks
for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) {
switch (tr->GetKind())
{
// Only count WaveTracks, and for linked pairs, only count the
// second one of the pair
case Track::Wave:
{
if (tr->GetLinked() == false) {
mNumTracks++;
}
break;
}
// Only support one label track???
case Track::Label:
{
if (mLabels == NULL) {
mLabels = (LabelTrack *)tr;
mNumLabels = mLabels->GetNumLabels();
}
break;
}
}
}
if (mNumTracks < 2 && mNumLabels < 1) {
::wxMessageBox(_("If you have more than one Audio Track, you can export each track as a separate file,\nor if you have a Label Track, you can export a new file for each label.\n\nThis project does not have multiple tracks or a Label Track, so you cannot export multiple files."),
_("Can't export multiple files"),
wxOK | wxCENTRE, this);
return wxID_CANCEL;
}
if (mNumLabels < 1) {
mLabel->Enable(false);
mTrack->SetValue(true);
mLabel->SetValue(false);
}
if (mNumTracks < 2) {
mTrack->Enable(false);
mLabel->SetValue(true);
mTrack->SetValue(false);
}
EnableControls();
return wxDialog::ShowModal();
}
示例12: 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);
}
}
示例13: EnableDisableButtons
void ControlToolBar::EnableDisableButtons()
{
AudacityProject *p = GetActiveProject();
bool tracks = false;
bool playing = mPlay->IsDown();
bool recording = mRecord->IsDown();
bool busy = gAudioIO->IsBusy();
// Only interested in audio type tracks
if (p) {
TrackListIterator iter( p->GetTracks() );
for (Track *t = iter.First(); t; t = iter.Next()) {
if (t->GetKind() == Track::Wave
#if defined(USE_MIDI)
|| t->GetKind() == Track::Note
#endif
) {
tracks = true;
break;
}
}
}
if (p) {
TranscriptionToolBar *const playAtSpeedTB = p->GetTranscriptionToolBar();
if (playAtSpeedTB)
playAtSpeedTB->SetEnabled(CanStopAudioStream() && tracks && !recording);
}
mPlay->SetEnabled(CanStopAudioStream() && tracks && !recording);
mRecord->SetEnabled(
CanStopAudioStream() &&
!(busy && !recording) &&
!playing
);
mStop->SetEnabled(CanStopAudioStream() && (playing || recording));
mRewind->SetEnabled(!playing && !recording);
mFF->SetEnabled(tracks && !playing && !recording);
auto pProject = GetActiveProject();
mPause->SetEnabled(CanStopAudioStream());
}
示例14: EnableDisableButtons
void ControlToolBar::EnableDisableButtons()
{
//TIDY-ME: Button logic could be neater.
AudacityProject *p = GetActiveProject();
size_t numProjects = gAudacityProjects.Count();
bool tracks = false;
bool cleaningSpeech = mBatch->IsDown();
bool playing = mPlay->IsDown();
bool recording = mRecord->IsDown();
bool busy = gAudioIO->IsBusy() || playing || recording;
// Only interested in audio type tracks
if (p) {
TrackListIterator iter( p->GetTracks() );
for (Track *t = iter.First(); t; t = iter.Next()) {
if (t->GetKind() == Track::Wave
#if defined(USE_MIDI)
|| t->GetKind() == Track::Note
#endif
) {
tracks = true;
break;
}
}
}
mPlay->SetEnabled((!recording) || (tracks && !busy && !cleaningSpeech));
mRecord->SetEnabled(!busy && !playing);
if (p && GetActiveProject()->GetCleanSpeechMode()) {
bool canRecord = !tracks;
canRecord &= !cleaningSpeech;
canRecord &= !busy;
canRecord &= ((numProjects == 0) || ((numProjects == 1) && !tracks));
mRecord->SetEnabled(canRecord);
mBatch->SetEnabled(!busy && !recording);
}
mStop->SetEnabled(busy && !cleaningSpeech);
mRewind->SetEnabled(tracks && !busy);
mFF->SetEnabled(tracks && !busy);
mPause->SetEnabled(true);
}
示例15: 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;
}