本文整理汇总了C++中TrackList::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackList::Add方法的具体用法?C++ TrackList::Add怎么用?C++ TrackList::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackList
的用法示例。
在下文中一共展示了TrackList::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PushState
void UndoManager::PushState(TrackList * l, double sel0, double sel1)
{
int i;
for (i = current + 1; i < stack.Count(); i++) {
TrackListIterator iter(stack[i]->tracks);
VTrack *t = iter.First();
while (t) {
delete t;
t = iter.Next();
}
}
i = stack.Count() - 1;
while (i > current)
stack.RemoveAt(i--);
TrackList *tracksCopy = new TrackList();
TrackListIterator iter(l);
VTrack *t = iter.First();
while (t) {
tracksCopy->Add(t->Duplicate());
t = iter.Next();
}
UndoStackElem *push = new UndoStackElem();
push->tracks = tracksCopy;
push->sel0 = sel0;
push->sel1 = sel1;
stack.Add(push);
current++;
}
示例2: ModifyState
void UndoManager::ModifyState(TrackList * l, double sel0, double sel1)
{
// Delete current
TrackListIterator iter(stack[current]->tracks);
Track *t = iter.First();
while (t) {
delete t;
t = iter.Next();
}
// Duplicate
TrackList *tracksCopy = new TrackList();
TrackListIterator iter2(l);
t = iter2.First();
while (t) {
tracksCopy->Add(t->Duplicate());
t = iter2.Next();
}
// Replace
stack[current]->tracks = tracksCopy;
stack[current]->sel0 = sel0;
stack[current]->sel1 = sel1;
}
示例3: OnDuplicate
void AudacityProject::OnDuplicate(wxCommandEvent & event)
{
TrackListIterator iter(mTracks);
VTrack *n = iter.First();
VTrack *dest = 0;
TrackList newTracks;
while (n) {
if (n->GetSelected()) {
n->Copy(mViewInfo.sel0, mViewInfo.sel1, &dest);
if (dest) {
dest->Init(*n);
dest->SetOffset(wxMax(mViewInfo.sel0, n->GetOffset()));
newTracks.Add(dest);
}
}
n = iter.Next();
}
TrackListIterator nIter(&newTracks);
n = nIter.First();
while (n) {
mTracks->Add(n);
n = nIter.Next();
}
PushState(_("Duplicated"));
FixScrollbars();
mTrackPanel->Refresh(false);
}
示例4: Pitch
void AudioView::Pitch()
{
VTrack *t;
bool success = false;
TrackList *tracks = GetTracks();
t = tracks->First();
while(t) {
if (t->selected && t->GetKind() == VTrack::Wave) {
NoteTrack *note = PitchExtract((WaveTrack *)t,
&((AudioDoc *)GetDocument())->dirManager);
if (note) {
success = true;
tracks->Add(note);
}
}
t = tracks->Next();
}
if (success) {
PushState();
FixScrollbars();
REDRAW(trackPanel);
REDRAW(rulerPanel);
}
}
示例5: ModifyState
void UndoManager::ModifyState(TrackList * l,
const SelectedRegion &selectedRegion)
{
if (current == wxNOT_FOUND) {
return;
}
SonifyBeginModifyState();
// Delete current
stack[current]->tracks->Clear(true);
delete stack[current]->tracks;
// Duplicate
TrackList *tracksCopy = new TrackList();
TrackListIterator iter(l);
Track *t = iter.First();
while (t) {
tracksCopy->Add(t->Duplicate());
t = iter.Next();
}
// Replace
stack[current]->tracks = tracksCopy;
stack[current]->selectedRegion = selectedRegion;
SonifyEndModifyState();
}
示例6: PushState
void UndoManager::PushState(TrackList * l, double sel0, double sel1,
wxString longDescription,
wxString shortDescription,
bool consolidate)
{
unsigned int i;
// If consolidate is set to true
if (consolidate && lastAction == longDescription &&
consolidationCount < 2) {
consolidationCount++;
ModifyState(l, sel0, sel1);
return;
}
consolidationCount = 0;
for (i = current + 1; i < stack.Count(); i++) {
TrackListIterator iter(stack[i]->tracks);
Track *t = iter.First();
while (t) {
delete t;
t = iter.Next();
}
}
i = stack.Count() - 1;
while (i > (unsigned int)current)
stack.RemoveAt(i--);
TrackList *tracksCopy = new TrackList();
TrackListIterator iter(l);
Track *t = iter.First();
while (t) {
tracksCopy->Add(t->Duplicate());
t = iter.Next();
}
UndoStackElem *push = new UndoStackElem();
push->tracks = tracksCopy;
push->sel0 = sel0;
push->sel1 = sel1;
push->description = longDescription;
push->shortDescription = shortDescription;
stack.Add(push);
current++;
if (saved >= current)
saved = -1;
lastAction = longDescription;
}
示例7: PushState
void UndoManager::PushState(TrackList * l, double sel0, double sel1,
wxString longDescription,
wxString shortDescription,
int flags)
{
unsigned int i;
// If consolidate is set to true, group up to 3 identical operations.
if (((flags&PUSH_CONSOLIDATE)!=0) && lastAction == longDescription &&
consolidationCount < 2) {
consolidationCount++;
ModifyState(l, sel0, sel1);
// MB: If the "saved" state was modified by ModifyState, reset
// it so that UnsavedChanges returns true.
if (current == saved) {
saved = -1;
}
return;
}
consolidationCount = 0;
i = current + 1;
while (i < stack.Count()) {
RemoveStateAt(i);
}
TrackList *tracksCopy = new TrackList();
TrackListIterator iter(l);
Track *t = iter.First();
while (t) {
tracksCopy->Add(t->Duplicate());
t = iter.Next();
}
UndoStackElem *push = new UndoStackElem();
push->tracks = tracksCopy;
push->sel0 = sel0;
push->sel1 = sel1;
push->description = longDescription;
push->shortDescription = shortDescription;
push->spaceUsage = 0; // Calculate actual value after it's on the stack.
stack.Add(push);
current++;
if( (flags&PUSH_CALC_SPACE)!=0)
push->spaceUsage = this->CalculateSpaceUsage(current);
if (saved >= current) {
saved = -1;
}
lastAction = longDescription;
}
示例8: PushState
void UndoManager::PushState(TrackList * l,
const SelectedRegion &selectedRegion,
const wxString &longDescription,
const wxString &shortDescription,
int flags)
{
unsigned int i;
// If consolidate is set to true, group up to 3 identical operations.
if (((flags&PUSH_CONSOLIDATE)!=0) && lastAction == longDescription &&
consolidationCount < 2) {
consolidationCount++;
ModifyState(l, selectedRegion);
// MB: If the "saved" state was modified by ModifyState, reset
// it so that UnsavedChanges returns true.
if (current == saved) {
saved = -1;
}
return;
}
consolidationCount = 0;
i = current + 1;
while (i < stack.Count()) {
RemoveStateAt(i);
}
TrackList *tracksCopy = new TrackList();
TrackListIterator iter(l);
Track *t = iter.First();
while (t) {
tracksCopy->Add(t->Duplicate());
t = iter.Next();
}
UndoStackElem *push = new UndoStackElem();
push->tracks = tracksCopy;
push->selectedRegion = selectedRegion;
push->description = longDescription;
push->shortDescription = shortDescription;
stack.Add(push);
current++;
if (saved >= current) {
saved = -1;
}
lastAction = longDescription;
}
示例9: PopState
void AudioView::PopState(TrackList *l)
{
TrackList *tracks = GetTracks();
tracks->Clear();
VTrack *t = l->First();
while(t) {
// printf("Popping track with %d samples\n",
// ((WaveTrack *)t)->numSamples);
// ((WaveTrack *)t)->Debug();
tracks->Add(t->Duplicate());
t = l->Next();
}
}
示例10: OnSplit
void AudacityProject::OnSplit(wxCommandEvent & event)
{
TrackListIterator iter(mTracks);
VTrack *n = iter.First();
VTrack *dest = 0;
TrackList newTracks;
while (n) {
if (n->GetSelected()) {
double sel0 = mViewInfo.sel0;
double sel1 = mViewInfo.sel1;
n->Copy(sel0, sel1, &dest);
if (dest) {
dest->Init(*n);
dest->SetOffset(wxMax(sel0, n->GetOffset()));
if (sel1 >= n->GetMaxLen())
n->Clear(sel0, sel1);
else if (sel0 <= n->GetOffset()) {
n->Clear(sel0, sel1);
n->SetOffset(sel1);
} else
n->Silence(sel0, sel1);
newTracks.Add(dest);
}
}
n = iter.Next();
}
TrackListIterator nIter(&newTracks);
n = nIter.First();
while (n) {
mTracks->Add(n);
n = nIter.Next();
}
PushState(_("Split"));
FixScrollbars();
mTrackPanel->Refresh(false);
}
示例11: QuickMix
void AudioView::QuickMix()
{
WaveTrack **waveArray;
VTrack *t;
int numWaves = 0;
int w;
TrackList *tracks = GetTracks();
t = tracks->First();
while(t) {
if (t->selected && t->GetKind() == VTrack::Wave)
numWaves++;
t = tracks->Next();
}
if (numWaves == 0)
return;
waveArray = new WaveTrack*[numWaves];
w = 0;
t = tracks->First();
while(t) {
if (t->selected && t->GetKind() == VTrack::Wave)
waveArray[w++] = (WaveTrack *)t;
t = tracks->Next();
}
WaveTrack *mix = ::QuickMix(numWaves, waveArray,
&((AudioDoc *)GetDocument())->dirManager);
if (mix) {
tracks->Add(mix);
PushState();
FixScrollbars();
REDRAW(trackPanel);
REDRAW(rulerPanel);
}
}
示例12: ModifyState
void UndoManager::ModifyState(TrackList * l, double sel0, double sel1)
{
SonifyBeginModifyState();
// Delete current
stack[current]->tracks->Clear(true);
delete stack[current]->tracks;
// Duplicate
TrackList *tracksCopy = new TrackList();
TrackListIterator iter(l);
Track *t = iter.First();
while (t) {
tracksCopy->Add(t->Duplicate());
t = iter.Next();
}
// Replace
stack[current]->tracks = tracksCopy;
stack[current]->sel0 = sel0;
stack[current]->sel1 = sel1;
SonifyEndModifyState();
}
示例13: PushState
void UndoManager::PushState(TrackList * l, double sel0, double sel1,
wxString desc)
{
unsigned int i;
for (i = current + 1; i < stack.Count(); i++) {
TrackListIterator iter(stack[i]->tracks);
Track *t = iter.First();
while (t) {
delete t;
t = iter.Next();
}
}
i = stack.Count() - 1;
while (i > (unsigned int)current)
stack.RemoveAt(i--);
TrackList *tracksCopy = new TrackList();
TrackListIterator iter(l);
Track *t = iter.First();
while (t) {
tracksCopy->Add(t->Duplicate());
t = iter.Next();
}
UndoStackElem *push = new UndoStackElem();
push->tracks = tracksCopy;
push->sel0 = sel0;
push->sel1 = sel1;
push->description = desc;
stack.Add(push);
current++;
if (saved >= current)
saved = -1;
}
示例14: OnRecord
//.........这里部分代码省略.........
if (wt->GetEndTime() > allt0) {
allt0 = wt->GetEndTime();
}
if (tt->GetSelected()) {
sel = true;
if (duplex)
playbackTracks.Remove(wt);
if (wt->GetEndTime() > t0) {
t0 = wt->GetEndTime();
}
}
}
}
// 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 {
示例15: OnRecord
//.........这里部分代码省略.........
wxString nameSuffix = wxString(wxT(""));
if (useTrackNumber) {
nameSuffix += wxString::Format(wxT("%d"), numTracks + c);
}
if (useDateStamp) {
if (!nameSuffix.IsEmpty()) {
nameSuffix += wxT("_");
}
nameSuffix += wxDateTime::Now().FormatISODate();
}
if (useTimeStamp) {
if (!nameSuffix.IsEmpty()) {
nameSuffix += wxT("_");
}
nameSuffix += wxDateTime::Now().FormatISOTime();
}
// ISO standard would be nice, but ":" is unsafe for file name.
nameSuffix.Replace(wxT(":"), wxT("-"));
if (baseTrackName.IsEmpty()) {
newTrack->SetName(nameSuffix);
}
else if (nameSuffix.IsEmpty()) {
newTrack->SetName(baseTrackName);
}
else {
newTrack->SetName(baseTrackName + wxT("_") + nameSuffix);
}
if (recordingChannels > 2)
newTrack->SetMinimized(true);
if (recordingChannels == 2) {
if (c == 0) {
newTrack->SetChannel(Track::LeftChannel);
newTrack->SetLinked(true);
}
else {
newTrack->SetChannel(Track::RightChannel);
}
}
else {
newTrack->SetChannel( Track::MonoChannel );
}
// Let the list hold the track, and keep a pointer to it
newRecordingTracks.push_back(
static_cast<WaveTrack*>(
trackList->Add(
std::move(newTrack))));
}
}
//Automated Input Level Adjustment Initialization
#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
gAudioIO->AILAInitialize();
#endif
AudioIOStartStreamOptions options(p->GetDefaultPlayOptions());
int token = gAudioIO->StartStream(playbackTracks,
newRecordingTracks,
#ifdef EXPERIMENTAL_MIDI_OUT
midiTracks,
#endif
t0, t1, options);
bool success = (token != 0);
if (success) {
p->SetAudioIOToken(token);
mBusyProject = p;
}
else {
if (shifted) {
// Restore the tracks to remove any inserted silence
if (tracksCopied)
*trackList = std::move(tracksCopy);
}
else {
// msmeyer: Delete recently added tracks if opening stream fails
for (unsigned int i = 0; i < newRecordingTracks.size(); i++) {
trackList->Remove(newRecordingTracks[i]);
}
}
// msmeyer: Show error message if stream could not be opened
wxMessageBox(_("Error while opening sound device. Please check the recording device settings and the project sample rate."),
_("Error"), wxOK | wxICON_EXCLAMATION, this);
SetPlay(false);
SetStop(false);
SetRecord(false);
}
}
UpdateStatusBar(GetActiveProject());
}