void ExportMultiple::CountTracksAndLabels() { mLabels = NULL; mNumLabels = 0; mNumWaveTracks = 0; const Track* pTrack; TrackListConstIterator iter; for (pTrack = iter.First(mTracks); pTrack != NULL; pTrack = iter.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; } } } }
int TrackList::GetNumExportChannels(bool selectionOnly) const { /* counters for tracks panned different places */ int numLeft = 0; int numRight = 0; int numMono = 0; /* track iteration kit */ const Track *tr; TrackListConstIterator 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; }