本文整理汇总了C++中Track::GetOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ Track::GetOffset方法的具体用法?C++ Track::GetOffset怎么用?C++ Track::GetOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::GetOffset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMinOffset
double TrackList::GetMinOffset() const
{
if (IsEmpty())
return 0.0;
double len = head->t->GetOffset();
ConstTrackListIterator iter(this);
for (Track *t = iter.First(); t; t = iter.Next()) {
double l = t->GetOffset();
if (l < len)
len = l;
}
return len;
}
示例2: ExportCommon
/*
* This first function contains the code common to both
* Export() and ExportLossy()
*
* For safety, if the file already exists it stores the filename
* the user wants in actualName, and returns a temporary file name.
* The calling function should rename the file when it's successfully
* exported.
*/
wxString ExportCommon(AudacityProject *project,
wxString format, wxString defaultExtension,
bool selectionOnly, double *t0, double *t1,
bool *isStereo,
wxString &actualName)
{
TrackList *tracks = project->GetTracks();
/* First analyze the selected audio, perform sanity checks, and provide
* information as appropriate. */
/* Tally how many are right, left, mono, and make sure at
least one track is selected (if selectionOnly==true) */
int numSelected = 0, numLeft = 0, numRight = 0, numMono = 0;
float earliestBegin = *t1;
float latestEnd = *t0;
TrackListIterator iter1(tracks);
Track *tr = iter1.First();
while (tr) {
if (tr->GetKind() == Track::Wave) {
if (tr->GetSelected() || !selectionOnly) {
numSelected++;
if (tr->GetChannel() == Track::LeftChannel)
numLeft++;
else if (tr->GetChannel() == Track::RightChannel)
numRight++;
else if (tr->GetChannel() == Track::MonoChannel)
{
// It's a mono channel, but it may be panned
float pan = ((WaveTrack*)tr)->GetPan();
if (pan == -1.0)
numLeft++;
else if (pan == 1.0)
numRight++;
else if (pan == 0)
numMono++;
else {
numLeft++;
numRight++;
}
}
if(tr->GetOffset() < earliestBegin)
earliestBegin = tr->GetOffset();
if(tr->GetEndTime() > latestEnd)
latestEnd = tr->GetEndTime();
}
}
tr = iter1.Next();
}
if(*t0 < earliestBegin)
*t0 = earliestBegin;
if(*t1 > latestEnd)
*t1 = latestEnd;
if (numSelected == 0 && selectionOnly) {
wxMessageBox(_("No tracks are selected!\n"
"Choose Export... to export all tracks."));
return "";
}
/* Detemine if exported file will be stereo or mono,
and if mixing will occur */
bool stereo = false;
if (numRight > 0 || numLeft > 0)
stereo = true;
numRight += numMono;
numLeft += numMono;
if (numLeft > 1 || numRight > 1)
if (stereo) {
ShowWarningDialog(project, "MixStereo",
_("Your tracks will be mixed down to two "
"stereo channels in the exported file."));
}
else {
ShowWarningDialog(project, "MixMono",
_("Your tracks will be mixed down to a "
//.........这里部分代码省略.........
示例3: ExportCommon
/*
* This first function contains the code common to both
* Export() and ExportLossy()
*
* For safety, if the file already exists it stores the filename
* the user wants in actualName, and returns a temporary file name.
* The calling function should rename the file when it's successfully
* exported.
*/
wxString ExportCommon( AudacityProject *project, wxString format,
wxString defaultExtension, bool selectionOnly, double *t0, double *t1,
int *numChannels, wxString &actualName, int maxNumChannels,
MixerSpec **mixerSpec )
{
TrackList *tracks = project->GetTracks();
/* First analyze the selected audio, perform sanity checks, and provide
* information as appropriate. */
/* Tally how many are right, left, mono, and make sure at
least one track is selected (if selectionOnly==true) */
int numSelected = 0, numLeft = 0, numRight = 0, numMono = 0;
float earliestBegin = *t1;
float latestEnd = *t0;
TrackListIterator iter1(tracks);
Track *tr = iter1.First();
while (tr) {
if (tr->GetKind() == Track::Wave) {
if (tr->GetSelected() || !selectionOnly) {
numSelected++;
if (tr->GetChannel() == Track::LeftChannel)
numLeft++;
else if (tr->GetChannel() == Track::RightChannel)
numRight++;
else if (tr->GetChannel() == Track::MonoChannel) {
// It's a mono channel, but it may be panned
float pan = ((WaveTrack*)tr)->GetPan();
if (pan == -1.0)
numLeft++;
else if (pan == 1.0)
numRight++;
else if (pan == 0)
numMono++;
else {
// Panned partially off-center. Mix as stereo.
numLeft++;
numRight++;
}
}
if(tr->GetOffset() < earliestBegin)
earliestBegin = tr->GetOffset();
if(tr->GetEndTime() > latestEnd)
latestEnd = tr->GetEndTime();
}
}
tr = iter1.Next();
}
if(*t0 < earliestBegin)
*t0 = earliestBegin;
if(*t1 > latestEnd)
*t1 = latestEnd;
if (numSelected == 0 && selectionOnly) {
wxMessageBox(_("No tracks are selected! Use Ctrl-A (Select All)\nChoose Export... to export all tracks."),
_("Unable to export"),
wxOK | wxICON_INFORMATION);
return wxT("");
}
/* Detemine if exported file will be stereo or mono or multichannel,
and if mixing will occur */
bool downMix = (gPrefs->Read( wxT("/FileFormats/ExportDownMix" ), true ) !=0) ? true:false ;
int channels;
if( downMix || !mixerSpec )
{
if (numRight > 0 || numLeft > 0)
channels = 2;
else
channels = 1;
numRight += numMono;
numLeft += numMono;
if (numLeft > 1 || numRight > 1)
if (channels == 2) {
ShowWarningDialog(project, wxT("MixStereo"),
//.........这里部分代码省略.........
示例4: ExamineTracks
bool Exporter::ExamineTracks()
{
// Init
mNumSelected = 0;
mNumLeft = 0;
mNumRight = 0;
mNumMono = 0;
// First analyze the selected audio, perform sanity checks, and provide
// information as appropriate.
// Tally how many are right, left, mono, and make sure at
// least one track is selected (if selectedOnly==true)
float earliestBegin = mT1;
float latestEnd = mT0;
TrackList *tracks = mProject->GetTracks();
TrackListIterator iter1(tracks);
Track *tr = iter1.First();
while (tr) {
if (tr->GetKind() == Track::Wave) {
if (tr->GetSelected() || !mSelectedOnly) {
mNumSelected++;
if (tr->GetChannel() == Track::LeftChannel) {
mNumLeft++;
}
else if (tr->GetChannel() == Track::RightChannel) {
mNumRight++;
}
else if (tr->GetChannel() == Track::MonoChannel) {
// It's a mono channel, but it may be panned
float pan = ((WaveTrack*)tr)->GetPan();
if (pan == -1.0)
mNumLeft++;
else if (pan == 1.0)
mNumRight++;
else if (pan == 0)
mNumMono++;
else {
// Panned partially off-center. Mix as stereo.
mNumLeft++;
mNumRight++;
}
}
if (tr->GetOffset() < earliestBegin) {
earliestBegin = tr->GetOffset();
}
if (tr->GetEndTime() > latestEnd) {
latestEnd = tr->GetEndTime();
}
}
}
tr = iter1.Next();
}
if (mSelectedOnly && mNumSelected == 0) {
wxMessageBox(_("No tracks are selected! Use Ctrl-A (Select All)\nChoose Export... to export all tracks."),
_("Unable to export"),
wxOK | wxICON_INFORMATION);
return false;
}
if (mT0 < earliestBegin)
mT0 = earliestBegin;
if (mT1 > latestEnd)
mT1 = latestEnd;
return true;
}