本文整理汇总了C++中WaveTrack::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ WaveTrack::SetName方法的具体用法?C++ WaveTrack::SetName怎么用?C++ WaveTrack::SetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WaveTrack
的用法示例。
在下文中一共展示了WaveTrack::SetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MixAndRender
bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
double rate, sampleFormat format,
double startTime, double endTime,
WaveTrack **newLeft, WaveTrack **newRight)
{
// This function was formerly known as "Quick Mix". It takes one or
// more tracks as input; of all tracks that are selected, it mixes
// them together, applying any envelopes, amplitude gain, panning,
// and real-time effects in the process. The resulting pair of
// tracks (stereo) are "rendered" and have no effects, gain, panning,
// or envelopes.
WaveTrack **waveArray;
Track *t;
int numWaves = 0;
int numMono = 0;
bool mono = false;
int w;
TrackListIterator iter(tracks);
t = iter.First();
while (t) {
if (t->GetSelected() && t->GetKind() == Track::Wave) {
numWaves++;
float pan = ((WaveTrack*)t)->GetPan();
if (t->GetChannel() == Track::MonoChannel && pan == 0)
numMono++;
}
t = iter.Next();
}
if (numMono == numWaves)
mono = true;
double totalTime = 0.0;
waveArray = new WaveTrack *[numWaves];
w = 0;
t = iter.First();
while (t) {
if (t->GetSelected() && t->GetKind() == Track::Wave) {
waveArray[w++] = (WaveTrack *) t;
if (t->GetEndTime() > totalTime)
totalTime = t->GetEndTime();
}
t = iter.Next();
}
WaveTrack *mixLeft = trackFactory->NewWaveTrack(format, rate);
mixLeft->SetName(_("Mix"));
WaveTrack *mixRight = 0;
if (mono) {
mixLeft->SetChannel(Track::MonoChannel);
}
else {
mixRight = trackFactory->NewWaveTrack(format, rate);
mixRight->SetName(_("Mix"));
mixLeft->SetChannel(Track::LeftChannel);
mixRight->SetChannel(Track::RightChannel);
mixLeft->SetLinked(true);
mixRight->SetTeamed(true);
}
int maxBlockLen = mixLeft->GetIdealBlockSize();
if (startTime == endTime) {
startTime = 0.0;
endTime = totalTime;
}
Mixer *mixer = new Mixer(numWaves, waveArray, tracks->GetTimeTrack(),
startTime, endTime, mono ? 1 : 2, maxBlockLen, false,
rate, format);
wxYield();
GetActiveProject()->ProgressShow(_NoAcc("&Mix and Render"),
_("Mixing and rendering tracks"));
wxBusyCursor busy;
bool cancelling = false;
while(!cancelling) {
sampleCount blockLen = mixer->Process(maxBlockLen);
if (blockLen == 0)
break;
if (mono) {
samplePtr buffer = mixer->GetBuffer();
mixLeft->Append(buffer, format, blockLen);
}
else {
samplePtr buffer;
buffer = mixer->GetBuffer(0);
mixLeft->Append(buffer, format, blockLen);
buffer = mixer->GetBuffer(1);
mixRight->Append(buffer, format, blockLen);
}
int progressvalue = int (1000 * (mixer->MixGetCurrentTime() / totalTime));
//.........这里部分代码省略.........
示例2: QuickMix
bool QuickMix(TrackList *tracks, DirManager *dirManager,
double rate, sampleFormat format)
{
WaveTrack **waveArray;
VTrack *t;
int numWaves = 0;
int numLeft = 0;
int numRight = 0;
int numMono = 0;
bool mono = false;
int w;
TrackListIterator iter(tracks);
t = iter.First();
while (t) {
if (t->GetSelected() && t->GetKind() == VTrack::Wave) {
numWaves++;
switch (t->GetChannel()) {
case VTrack::MonoChannel:
numLeft++;
numRight++;
numMono++;
break;
case VTrack::LeftChannel:
numLeft++;
break;
case VTrack::RightChannel:
numRight++;
break;
}
}
t = iter.Next();
}
if (numMono == numWaves || numLeft == numWaves || numRight == numWaves)
mono = true;
double totalTime = 0.0;
waveArray = new WaveTrack *[numWaves];
w = 0;
t = iter.First();
while (t) {
if (t->GetSelected() && t->GetKind() == VTrack::Wave) {
waveArray[w++] = (WaveTrack *) t;
if (t->GetMaxLen() > totalTime)
totalTime = t->GetMaxLen();
}
t = iter.Next();
}
WaveTrack *mixLeft = new WaveTrack(dirManager);
mixLeft->SetSampleFormat(format);
mixLeft->SetRate(rate);
mixLeft->SetChannel(VTrack::MonoChannel);
mixLeft->SetName(_("Mix"));
WaveTrack *mixRight = 0;
if (!mono) {
mixRight = new WaveTrack(dirManager);
mixRight->SetSampleFormat(format);
mixRight->SetRate(rate);
mixRight->SetName(_("Mix"));
mixLeft->SetChannel(VTrack::LeftChannel);
mixRight->SetChannel(VTrack::RightChannel);
mixLeft->SetLinked(true);
}
int maxBlockLen = mixLeft->GetIdealBlockSize();
double maxBlockTime = maxBlockLen / mixLeft->GetRate();
Mixer *mixer = new Mixer(mono ? 1 : 2, maxBlockLen, false,
rate, format);
wxProgressDialog *progress = NULL;
wxYield();
wxStartTimer();
wxBusyCursor busy;
double tt = 0.0;
while (tt < totalTime) {
double blockTime = maxBlockTime;
if (tt + blockTime > totalTime)
blockTime = totalTime - tt;
int blockLen = int (blockTime * mixLeft->GetRate());
mixer->Clear();
for (int i = 0; i < numWaves; i++) {
if (mono)
mixer->MixMono(waveArray[i], tt, tt + blockTime);
else {
switch (waveArray[i]->GetChannel()) {
case VTrack::LeftChannel:
mixer->MixLeft(waveArray[i], tt, tt + blockTime);
break;
case VTrack::RightChannel:
mixer->MixRight(waveArray[i], tt, tt + blockTime);
break;
//.........这里部分代码省略.........
示例3: MixAndRender
//TODO-MB: wouldn't it make more sense to delete the time track after 'mix and render'?
bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
double rate, sampleFormat format,
double startTime, double endTime,
WaveTrack **newLeft, WaveTrack **newRight)
{
// This function was formerly known as "Quick Mix".
WaveTrack **waveArray;
Track *t;
int numWaves = 0; /* number of wave tracks in the selection */
int numMono = 0; /* number of mono, centre-panned wave tracks in selection*/
bool mono = false; /* flag if output can be mono without loosing anything*/
bool oneinput = false; /* flag set to true if there is only one input track
(mono or stereo) */
int w;
TrackListIterator iter(tracks);
SelectedTrackListOfKindIterator usefulIter(Track::Wave, tracks);
// this only iterates tracks which are relevant to this function, i.e.
// selected WaveTracks. The tracklist is (confusingly) the list of all
// tracks in the project
t = iter.First();
while (t) {
if (t->GetSelected() && t->GetKind() == Track::Wave) {
numWaves++;
float pan = ((WaveTrack*)t)->GetPan();
if (t->GetChannel() == Track::MonoChannel && pan == 0)
numMono++;
}
t = iter.Next();
}
if (numMono == numWaves)
mono = true;
/* the next loop will do two things at once:
* 1. build an array of all the wave tracks were are trying to process
* 2. determine when the set of WaveTracks starts and ends, in case we
* need to work out for ourselves when to start and stop rendering.
*/
double mixStartTime = 0.0; /* start time of first track to start */
bool gotstart = false; // flag indicates we have found a start time
double mixEndTime = 0.0; /* end time of last track to end */
double tstart, tend; // start and end times for one track.
waveArray = new WaveTrack *[numWaves];
w = 0;
t = iter.First();
while (t) {
if (t->GetSelected() && t->GetKind() == Track::Wave) {
waveArray[w++] = (WaveTrack *) t;
tstart = t->GetStartTime();
tend = t->GetEndTime();
if (tend > mixEndTime)
mixEndTime = tend;
// try and get the start time. If the track is empty we will get 0,
// which is ambiguous because it could just mean the track starts at
// the beginning of the project, as well as empty track. The give-away
// is that an empty track also ends at zero.
if (tstart != tend) {
// we don't get empty tracks here
if (!gotstart) {
// no previous start, use this one unconditionally
mixStartTime = tstart;
gotstart = true;
} else if (tstart < mixStartTime)
mixStartTime = tstart; // have a start, only make it smaller
} // end if start and end are different
} // end if track is a selected WaveTrack.
/** @TODO: could we not use a SelectedTrackListOfKindIterator here? */
t = iter.Next();
}
/* create the destination track (new track) */
if ((numWaves == 1) || ((numWaves == 2) && (usefulIter.First()->GetLink() != NULL)))
oneinput = true;
// only one input track (either 1 mono or one linked stereo pair)
WaveTrack *mixLeft = trackFactory->NewWaveTrack(format, rate);
if (oneinput)
mixLeft->SetName(usefulIter.First()->GetName()); /* set name of output track to be the same as the sole input track */
else
mixLeft->SetName(_("Mix"));
mixLeft->SetOffset(mixStartTime);
WaveTrack *mixRight = 0;
if (mono) {
mixLeft->SetChannel(Track::MonoChannel);
}
else {
mixRight = trackFactory->NewWaveTrack(format, rate);
if (oneinput) {
if (usefulIter.First()->GetLink() != NULL) // we have linked track
mixLeft->SetName(usefulIter.First()->GetLink()->GetName()); /* set name to match input track's right channel!*/
else
mixLeft->SetName(usefulIter.First()->GetName()); /* set name to that of sole input channel */
}
//.........这里部分代码省略.........