本文整理汇总了C++中TrackList::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackList::Remove方法的具体用法?C++ TrackList::Remove怎么用?C++ TrackList::Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackList
的用法示例。
在下文中一共展示了TrackList::Remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
示例2: OnRecord
void ControlToolBar::OnRecord(wxCommandEvent &evt)
{
if (gAudioIO->IsBusy()) {
mRecord->PopUp();
return;
}
AudacityProject *p = GetActiveProject();
if( evt.GetInt() == 1 ) // used when called by keyboard shortcut. Default (0) ignored.
mRecord->SetShift(true);
if( evt.GetInt() == 2 )
mRecord->SetShift(false);
SetRecord(true, mRecord->WasShiftDown());
if (p) {
TrackList *t = p->GetTracks();
TrackListIterator it(t);
if(it.First() == NULL)
mRecord->SetShift(false);
double t0 = p->GetSel0();
double t1 = p->GetSel1();
if (t1 == t0)
t1 = 1000000000.0; // record for a long, long time (tens of years)
/* TODO: set up stereo tracks if that is how the user has set up
* their preferences, and choose sample format based on prefs */
WaveTrackArray newRecordingTracks, playbackTracks;
#ifdef EXPERIMENTAL_MIDI_OUT
NoteTrackArray midiTracks;
#endif
bool duplex;
gPrefs->Read(wxT("/AudioIO/Duplex"), &duplex, true);
if(duplex){
playbackTracks = t->GetWaveTrackArray(false);
#ifdef EXPERIMENTAL_MIDI_OUT
midiTracks = t->GetNoteTrackArray(false);
#endif
}
else {
playbackTracks = WaveTrackArray();
#ifdef EXPERIMENTAL_MIDI_OUT
midiTracks = NoteTrackArray();
#endif
}
// If SHIFT key was down, the user wants append to tracks
int recordingChannels = 0;
bool shifted = mRecord->WasShiftDown();
if (shifted) {
bool sel = false;
double allt0 = t0;
// Find the maximum end time of selected and all wave tracks
// Find whether any tracks were selected. (If any are selected,
// record only into them; else if tracks exist, record into all.)
for (Track *tt = it.First(); tt; tt = it.Next()) {
if (tt->GetKind() == Track::Wave) {
WaveTrack *wt = static_cast<WaveTrack *>(tt);
if (wt->GetEndTime() > allt0) {
allt0 = wt->GetEndTime();
}
if (tt->GetSelected()) {
sel = true;
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
// Remove recording tracks from the list of tracks for duplex ("overdub")
// playback.
for (Track *tt = it.First(); tt; tt = it.Next()) {
if (tt->GetKind() == Track::Wave && (tt->GetSelected() || !sel)) {
WaveTrack *wt = static_cast<WaveTrack *>(tt);
if (duplex)
playbackTracks.Remove(wt);
t1 = wt->GetEndTime();
if (t1 < t0) {
WaveTrack *newTrack = p->GetTrackFactory()->NewWaveTrack();
newTrack->InsertSilence(0.0, t0 - t1);
newTrack->Flush();
wt->Clear(t1, t0);
bool bResult = wt->Paste(t1, newTrack);
wxASSERT(bResult); // TO DO: Actually handle this.
delete newTrack;
}
newRecordingTracks.Add(wt);
}
}
//.........这里部分代码省略.........
示例3: OnRecord
void ControlToolBar::OnRecord(wxCommandEvent &evt)
{
if (gAudioIO->IsBusy()) {
mRecord->PopUp();
return;
}
AudacityProject *p = GetActiveProject();
if (p && p->GetCleanSpeechMode()) {
size_t numProjects = gAudacityProjects.Count();
bool tracks = (p && !p->GetTracks()->IsEmpty());
if (tracks || (numProjects > 1)) {
wxMessageBox(_("Recording in CleanSpeech mode is not possible when a track, or more than one project, is already open."),
_("Recording not permitted"),
wxOK | wxICON_INFORMATION,
this);
mRecord->PopUp();
mRecord->Disable();
return;
}
}
if( evt.GetInt() == 1 ) // used when called by keyboard shortcut. Default (0) ignored.
mRecord->SetShift(true);
if( evt.GetInt() == 2 )
mRecord->SetShift(false);
SetRecord(true);
if (p) {
TrackList *t = p->GetTracks();
TrackListIterator it(t);
if(it.First() == NULL)
mRecord->SetShift(false);
double t0 = p->GetSel0();
double t1 = p->GetSel1();
if (t1 == t0)
t1 = 1000000000.0; // record for a long, long time (tens of years)
/* TODO: set up stereo tracks if that is how the user has set up
* their preferences, and choose sample format based on prefs */
WaveTrackArray newRecordingTracks, playbackTracks;
/* REQUIRES PORTMIDI */
// NoteTrackArray midiTracks;
bool duplex;
gPrefs->Read(wxT("/AudioIO/Duplex"), &duplex, true);
if(duplex){
playbackTracks = t->GetWaveTrackArray(false);
/* REQUIRES PORTMIDI */
// midiTracks = t->GetNoteTrackArray(false);
}
else {
playbackTracks = WaveTrackArray();
/* REQUIRES PORTMIDI */
// midiTracks = NoteTrackArray();
}
// If SHIFT key was down, the user wants append to tracks
int recordingChannels = 0;
bool shifted = mRecord->WasShiftDown();
if (shifted) {
TrackListIterator it(t);
WaveTrack *wt;
bool sel = false;
double allt0 = t0;
// Find the maximum end time of selected and all wave tracks
for (Track *tt = it.First(); tt; tt = it.Next()) {
if (tt->GetKind() == Track::Wave) {
wt = (WaveTrack *)tt;
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();
//.........这里部分代码省略.........