本文整理汇总了C++中WaveTrack::SetTeamed方法的典型用法代码示例。如果您正苦于以下问题:C++ WaveTrack::SetTeamed方法的具体用法?C++ WaveTrack::SetTeamed怎么用?C++ WaveTrack::SetTeamed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WaveTrack
的用法示例。
在下文中一共展示了WaveTrack::SetTeamed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: OnRecord
//.........这里部分代码省略.........
}
// Use end time of all wave tracks if none selected
if (!sel) {
t0 = allt0;
}
// Pad selected/all wave tracks to make them all the same length
for (Track *tt = it.First(); tt; tt = it.Next()) {
if (tt->GetKind() == Track::Wave && (tt->GetSelected() || !sel)) {
wt = (WaveTrack *)tt;
t1 = wt->GetEndTime();
if (t1 < t0) {
WaveTrack *newTrack = p->GetTrackFactory()->NewWaveTrack();
newTrack->InsertSilence(0.0, t0 - t1);
newTrack->Flush();
wt->Clear(t1, t0);
wt->Paste(t1, newTrack);
delete newTrack;
}
newRecordingTracks.Add(wt);
}
}
t1 = 1000000000.0; // record for a long, long time (tens of years)
}
else {
recordingChannels = gPrefs->Read(wxT("/AudioIO/RecordChannels"), 2);
for (int c = 0; c < recordingChannels; c++) {
WaveTrack *newTrack = p->GetTrackFactory()->NewWaveTrack();
int initialheight = newTrack->GetHeight();
newTrack->SetOffset(t0);
if (recordingChannels <= 2) {
newTrack->SetHeight(initialheight/recordingChannels);
}
else {
newTrack->SetMinimized(true);
}
if (recordingChannels == 2) {
if (c == 0) {
newTrack->SetChannel(Track::LeftChannel);
newTrack->SetLinked(true);
}
else {
newTrack->SetChannel(Track::RightChannel);
newTrack->SetTeamed(true);
}
}
else {
newTrack->SetChannel( Track::MonoChannel );
}
newRecordingTracks.Add(newTrack);
}
// msmeyer: StartStream calls a callback which triggers auto-save, so
// we add the tracks where recording is done into now. We remove them
// later if starting the stream fails
for (unsigned int i = 0; i < newRecordingTracks.GetCount(); i++)
t->Add(newRecordingTracks[i]);
}
int token = gAudioIO->StartStream(playbackTracks,
newRecordingTracks,
/* REQUIRES PORTMIDI */
// midiTracks,
t->GetTimeTrack(),
p->GetRate(), t0, t1, p);
bool success = (token != 0);
if (success) {
p->SetAudioIOToken(token);
mBusyProject = p;
SetVUMeters(p);
}
else {
// msmeyer: Delete recently added tracks if opening stream fails
if (!shifted) {
for (unsigned int i = 0; i < newRecordingTracks.GetCount(); i++) {
t->Remove(newRecordingTracks[i]);
delete newRecordingTracks[i];
}
}
// msmeyer: Show error message if stream could not be opened
wxMessageBox(_("Error while opening sound device. "
wxT("Please check the input device settings and the project sample rate.")),
_("Error"), wxOK | wxICON_EXCLAMATION, this);
SetPlay(false);
SetStop(false);
SetRecord(false);
}
}
}