1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 00:20:06 +02:00

Campbell Barton's patch to turn many, many tabs to our 3-space convenbtion

This commit is contained in:
v.audacity 2013-02-20 23:42:58 +00:00
parent 63788f4b2d
commit 9d0daf8662
35 changed files with 282 additions and 282 deletions

View File

@ -231,7 +231,7 @@ void AboutDialog::PopulateAudacityPage( ShuttleGui & S )
wxT("<body bgcolor=\"#ffffff\"><center>") + wxT("<body bgcolor=\"#ffffff\"><center>") +
wxT("<h3>Audacity ") + versionStr + wxT("</h3>")+ wxT("<h3>Audacity ") + versionStr + wxT("</h3>")+
_("A Free Digital Audio Editor<br>") + _("A Free Digital Audio Editor<br>") +
wxT("<a href=\"http://audacity.sourceforge.net/\">http://audacity.sourceforge.net/</a>") + wxT("<a href=\"http://audacity.sourceforge.net/\">http://audacity.sourceforge.net/</a>") +
wxT("</center><p>") + par1Str + wxT("</center><p>") + par1Str +
wxT("<p>") + par2Str + wxT("<p>") + par2Str +
wxT("<p><center><b>") + _("Credits") + wxT("</b></center>") wxT("<p><center><b>") + _("Credits") + wxT("</b></center>")
@ -274,7 +274,7 @@ void AboutDialog::PopulateAudacityPage( ShuttleGui & S )
wxT("</b><br>") + wxT("</b><br>") +
GetCreditsByRole(roleThanks) + GetCreditsByRole(roleThanks) +
wxT("<p><br></center>") + wxT("<p><br></center>") +
_("<b>Audacity&reg;</b> software is copyright")+ _("<b>Audacity&reg;</b> software is copyright")+
wxT("&copy; 1999-2013 Audacity Team.<br>") + wxT("&copy; 1999-2013 Audacity Team.<br>") +

View File

@ -161,9 +161,9 @@ class AudacityApp:public wxApp {
void OnMacOpenFile(wxCommandEvent & event); void OnMacOpenFile(wxCommandEvent & event);
#endif #endif
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__) #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__)
void AssociateFileTypes(); void AssociateFileTypes();
#endif #endif
/** \brief A list of directories that should be searched for Audacity files /** \brief A list of directories that should be searched for Audacity files
* (plug-ins, help files, etc.). * (plug-ins, help files, etc.).

View File

@ -583,7 +583,7 @@ AudioIO::AudioIO()
errStr += _("Error: ") + pmErrStr; errStr += _("Error: ") + pmErrStr;
// XXX: we are in libaudacity, popping up dialogs not allowed! A // XXX: we are in libaudacity, popping up dialogs not allowed! A
// long-term solution will probably involve exceptions // long-term solution will probably involve exceptions
wxMessageBox(errStr, _("Error Initializing Midi"), wxICON_ERROR|wxOK); wxMessageBox(errStr, _("Error Initializing Midi"), wxICON_ERROR|wxOK);
// Same logic for PortMidi as described above for PortAudio // Same logic for PortMidi as described above for PortAudio
} }

View File

@ -40,14 +40,14 @@ class BatchCommandDialog:public wxDialog {
public: public:
// constructors and destructors // constructors and destructors
BatchCommandDialog(wxWindow *parent, wxWindowID id); BatchCommandDialog(wxWindow *parent, wxWindowID id);
void SetCommandAndParams(const wxString &Command, const wxString &Params); void SetCommandAndParams(const wxString &Command, const wxString &Params);
public: public:
wxString mSelectedCommand; wxString mSelectedCommand;
wxString mSelectedParameters; wxString mSelectedParameters;
private: private:
void Populate(); void Populate();
void PopulateOrExchange(ShuttleGui &S); void PopulateOrExchange(ShuttleGui &S);
void OnEditParams(wxCommandEvent &event); void OnEditParams(wxCommandEvent &event);
void OnChoice(wxCommandEvent &event); void OnChoice(wxCommandEvent &event);
void OnOk(wxCommandEvent &event); void OnOk(wxCommandEvent &event);
void OnCancel(wxCommandEvent &event); void OnCancel(wxCommandEvent &event);

View File

@ -266,11 +266,11 @@ void BatchProcessDialog::OnApplyToFiles(wxCommandEvent &event)
} }
} }
FileDialog dlog(this, FileDialog dlog(this,
prompt, prompt,
path, path,
wxT(""), wxT(""),
mask, mask,
wxFD_OPEN | wxFD_MULTIPLE | wxRESIZE_BORDER); wxFD_OPEN | wxFD_MULTIPLE | wxRESIZE_BORDER);
dlog.SetFilterIndex(index); dlog.SetFilterIndex(index);

View File

@ -72,7 +72,7 @@ private:
void Populate(); void Populate();
void PopulateOrExchange(ShuttleGui &S); void PopulateOrExchange(ShuttleGui &S);
void PopulateChains(); void PopulateChains();
void PopulateList(); void PopulateList();
void AddItem(const wxString &command, wxString const &params); void AddItem(const wxString &command, wxString const &params);
bool ChangeOK(); bool ChangeOK();

View File

@ -39,23 +39,23 @@ CrossFader::~CrossFader()
bool CrossFader::GetSamples(samplePtr buffer, sampleFormat format, bool CrossFader::GetSamples(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len) sampleCount start, sampleCount len)
{ {
switch (mType) switch (mType)
{ {
case FT_MIX: case FT_MIX:
return CrossFadeMix(buffer,format, start,len); return CrossFadeMix(buffer,format, start,len);
break; break;
case FT_TRIANGULAR: case FT_TRIANGULAR:
return CrossFadeMix(buffer,format, start,len); return CrossFadeMix(buffer,format, start,len);
break; break;
case FT_EXPONENTIAL: case FT_EXPONENTIAL:
default: default:
return CrossFadeMix(buffer,format, start,len); return CrossFadeMix(buffer,format, start,len);
break; break;
} }
} }
bool CrossFader::CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len) bool CrossFader::CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len)

View File

@ -21,11 +21,11 @@
enum FadeType enum FadeType
{ {
FT_MIX, FT_MIX,
FT_TRIANGULAR, FT_TRIANGULAR,
FT_EXPONENTIAL FT_EXPONENTIAL
}; };
class CrossFader class CrossFader
{ {
@ -44,7 +44,7 @@ class CrossFader
void ClearClips(); void ClearClips();
//Produces samples according to crossfading rules. //Produces samples according to crossfading rules.
bool GetSamples(samplePtr buffer, sampleFormat format, bool GetSamples(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len); sampleCount start, sampleCount len);
protected: protected:
WaveClipList mClips; WaveClipList mClips;

View File

@ -45,13 +45,13 @@
WX_DEFINE_OBJARRAY( AliasedFileArray ); WX_DEFINE_OBJARRAY( AliasedFileArray );
WX_DECLARE_HASH_MAP(wxString, AliasedFile *, WX_DECLARE_HASH_MAP(wxString, AliasedFile *,
wxStringHash, wxStringEqual, AliasedFileHash); wxStringHash, wxStringEqual, AliasedFileHash);
WX_DECLARE_HASH_MAP(BlockFile *, BlockFile *, WX_DECLARE_HASH_MAP(BlockFile *, BlockFile *,
wxPointerHash, wxPointerEqual, ReplacedBlockFileHash); wxPointerHash, wxPointerEqual, ReplacedBlockFileHash);
WX_DECLARE_HASH_MAP(BlockFile *, bool, WX_DECLARE_HASH_MAP(BlockFile *, bool,
wxPointerHash, wxPointerEqual, BoolBlockFileHash); wxPointerHash, wxPointerEqual, BoolBlockFileHash);
// Given a project, returns a single array of all SeqBlocks // Given a project, returns a single array of all SeqBlocks
// in the current set of tracks. Enumerating that array allows // in the current set of tracks. Enumerating that array allows
@ -86,7 +86,7 @@ void GetAllSeqBlocks(AudacityProject *project,
// Note that this code respects reference-counting and thus the // Note that this code respects reference-counting and thus the
// process of making a project self-contained is actually undoable. // process of making a project self-contained is actually undoable.
void ReplaceBlockFiles(AudacityProject *project, void ReplaceBlockFiles(AudacityProject *project,
ReplacedBlockFileHash &hash) ReplacedBlockFileHash &hash)
{ {
DirManager *dirManager = project->GetDirManager(); DirManager *dirManager = project->GetDirManager();
BlockArray blocks; BlockArray blocks;
@ -158,7 +158,7 @@ void FindDependencies(AudacityProject *project,
// longer be external dependencies (selected by the user), replace // longer be external dependencies (selected by the user), replace
// all of those alias block files with disk block files. // all of those alias block files with disk block files.
void RemoveDependencies(AudacityProject *project, void RemoveDependencies(AudacityProject *project,
AliasedFileArray *aliasedFiles) AliasedFileArray *aliasedFiles)
{ {
DirManager *dirManager = project->GetDirManager(); DirManager *dirManager = project->GetDirManager();

View File

@ -37,7 +37,7 @@ DeviceManager DeviceManager::dm;
/// Gets the singleton instance /// Gets the singleton instance
DeviceManager* DeviceManager::Instance() DeviceManager* DeviceManager::Instance()
{ {
return &dm; return &dm;
} }
/// Releases memory assosiated with the singleton /// Releases memory assosiated with the singleton
@ -294,13 +294,13 @@ void DeviceManager::Rescan()
dt->RefillCombos(); dt->RefillCombos();
} }
} }
m_inited = true; m_inited = true;
} }
//private constructor - Singleton. //private constructor - Singleton.
DeviceManager::DeviceManager() DeviceManager::DeviceManager()
{ {
m_inited = false; m_inited = false;
} }
DeviceManager::~DeviceManager() DeviceManager::~DeviceManager()

View File

@ -944,12 +944,12 @@ BlockFile *DirManager::CopyBlockFile(BlockFile *b)
{ {
if (!b->IsLocked()) { if (!b->IsLocked()) {
b->Ref(); b->Ref();
//mchinen:July 13 2009 - not sure about this, but it needs to be added to the hash to be able to save if not locked. //mchinen:July 13 2009 - not sure about this, but it needs to be added to the hash to be able to save if not locked.
//note that this shouldn't hurt mBlockFileHash's that already contain the filename, since it should just overwrite. //note that this shouldn't hurt mBlockFileHash's that already contain the filename, since it should just overwrite.
//but it's something to watch out for. //but it's something to watch out for.
// //
// LLL: Except for silent block files which have uninitialized filename. // LLL: Except for silent block files which have uninitialized filename.
if (b->GetFileName().IsOk()) if (b->GetFileName().IsOk())
mBlockFileHash[b->GetFileName().GetName()]=b; mBlockFileHash[b->GetFileName().GetName()]=b;
return b; return b;
} }

View File

@ -269,7 +269,7 @@ public:
} }
#else #else
/* Library names and file filters for other platforms, basically Linux and /* Library names and file filters for other platforms, basically Linux and
* other *nix platforms */ * other *nix platforms */
wxString GetLibraryTypeString() wxString GetLibraryTypeString()
{ {
return _("Only libavformat.so|libavformat.so*|Dynamically Linked Libraries (*.so*)|*.so*|All Files (*)|*"); return _("Only libavformat.so|libavformat.so*|Dynamically Linked Libraries (*.so*)|*.so*|All Files (*)|*");

View File

@ -27,11 +27,11 @@ public:
// originally an ExportMultiple method. Append suffix if newName appears in otherNames. // originally an ExportMultiple method. Append suffix if newName appears in otherNames.
static void MakeNameUnique(wxArrayString &otherNames, wxFileName &newName); static void MakeNameUnique(wxArrayString &otherNames, wxFileName &newName);
/** \brief Audacity user data directory /** \brief Audacity user data directory
* *
* Where audacity keeps it's settings and other user data squirreled away, * Where audacity keeps it's settings and other user data squirreled away,
* by default ~/.audacity-data/ on Unix, Application Data/Audacity on * by default ~/.audacity-data/ on Unix, Application Data/Audacity on
* windows system */ * windows system */
static wxString DataDir(); static wxString DataDir();
static wxString AutoSaveDir(); static wxString AutoSaveDir();
static wxString HtmlHelpDir(); static wxString HtmlHelpDir();
@ -42,10 +42,10 @@ public:
static wxString PluginsCache(); static wxString PluginsCache();
/** \brief The user plug-in directory (not a system one) /** \brief The user plug-in directory (not a system one)
* *
* This returns the string path to where the user may have put plug-ins * This returns the string path to where the user may have put plug-ins
* if they don't have system admin rights. Under default settings, it's * if they don't have system admin rights. Under default settings, it's
* <DataDir>/Plug-Ins/ */ * <DataDir>/Plug-Ins/ */
static wxString PlugInDir(); static wxString PlugInDir();
static wxString ThemeDir(); static wxString ThemeDir();
static wxString ThemeComponentsDir(); static wxString ThemeComponentsDir();

View File

@ -74,7 +74,7 @@ BEGIN_EVENT_TABLE(Lyrics, wxPanel)
EVT_SIZE(Lyrics::OnSize) EVT_SIZE(Lyrics::OnSize)
//v Doesn't seem to be a way to capture a selection event in a read-only wxTextCtrl. //v Doesn't seem to be a way to capture a selection event in a read-only wxTextCtrl.
// EVT_COMMAND_LEFT_CLICK(kHighlightTextCtrlID, Lyrics::OnHighlightTextCtrl) // EVT_COMMAND_LEFT_CLICK(kHighlightTextCtrlID, Lyrics::OnHighlightTextCtrl)
END_EVENT_TABLE() END_EVENT_TABLE()
IMPLEMENT_CLASS(Lyrics, wxPanel) IMPLEMENT_CLASS(Lyrics, wxPanel)

View File

@ -299,7 +299,7 @@ Matrix MatrixMultiply(const Matrix &left, const Matrix &right)
} }
Matrix MatrixSubset(const Matrix &input, Matrix MatrixSubset(const Matrix &input,
int startRow, int numRows, int startCol, int numCols) int startRow, int numRows, int startCol, int numCols)
{ {
Matrix M(numRows, numCols); Matrix M(numRows, numCols);
int i, j; int i, j;

View File

@ -103,7 +103,7 @@ Matrix ScalarMultiply(const Matrix &left, const Matrix &right);
Matrix MatrixMultiply(const Matrix &left, const Matrix &right); Matrix MatrixMultiply(const Matrix &left, const Matrix &right);
Matrix MatrixSubset(const Matrix &M, Matrix MatrixSubset(const Matrix &M,
int startRow, int numRows, int startCol, int numCols); int startRow, int numRows, int startCol, int numCols);
Matrix MatrixConcatenateCols(const Matrix& left, const Matrix& right); Matrix MatrixConcatenateCols(const Matrix& left, const Matrix& right);

View File

@ -317,13 +317,13 @@ Mixer::~Mixer()
delete[] mEnvValues; delete[] mEnvValues;
delete[] mFloatBuffer; delete[] mFloatBuffer;
delete[] mGains; delete[] mGains;
delete[] mSamplePos; delete[] mSamplePos;
for(i=0; i<mNumInputTracks; i++) { for(i=0; i<mNumInputTracks; i++) {
delete mResample[i]; delete mResample[i];
delete[] mSampleQueue[i]; delete[] mSampleQueue[i];
} }
delete[] mResample; delete[] mResample;
delete[] mSampleQueue; delete[] mSampleQueue;
delete[] mQueueStart; delete[] mQueueStart;
delete[] mQueueLen; delete[] mQueueLen;

View File

@ -39,7 +39,7 @@ double FreqToMIDInoteNumber(double freq)
// of the integer part of (pitchNum + 0.5), so 0=C, 1=C#, etc. // of the integer part of (pitchNum + 0.5), so 0=C, 1=C#, etc.
unsigned int PitchIndex(double pitchNum) unsigned int PitchIndex(double pitchNum)
{ {
return ((int)(pitchNum + 0.5) % 12); return ((int)(pitchNum + 0.5) % 12);
} }
@ -122,7 +122,7 @@ wxChar * PitchName(double pitchNum, bool bWantFlats /* = false */)
break; break;
} }
*pPitchName = wxT('\0'); *pPitchName = wxT('\0');
return gPitchName; return gPitchName;
} }
@ -134,10 +134,10 @@ wxChar * PitchName(double pitchNum, bool bWantFlats /* = false */)
// Sharps are the default, unless, bWantFlats is true. // Sharps are the default, unless, bWantFlats is true.
wxChar * PitchName_Absolute(double pitchNum, bool bWantFlats /* = false */) wxChar * PitchName_Absolute(double pitchNum, bool bWantFlats /* = false */)
{ {
PitchName(pitchNum, bWantFlats); PitchName(pitchNum, bWantFlats);
// PitchName sets pPitchName to the next available char in gPitchName, // PitchName sets pPitchName to the next available char in gPitchName,
// so it's ready to append the register number. // so it's ready to append the register number.
int octaveNum = ((int)((pitchNum + 0.5) / 12) - 1); int octaveNum = ((int)((pitchNum + 0.5) / 12) - 1);
wxSnprintf(pPitchName, 8, wxT("%d"), octaveNum); wxSnprintf(pPitchName, 8, wxT("%d"), octaveNum);

View File

@ -78,7 +78,7 @@ bool AudacityPrintout::OnPrintPage(int page)
TrackArtist artist; TrackArtist artist;
artist.SetBackgroundBrushes(*wxWHITE_BRUSH, *wxWHITE_BRUSH, artist.SetBackgroundBrushes(*wxWHITE_BRUSH, *wxWHITE_BRUSH,
*wxWHITE_PEN, *wxWHITE_PEN); *wxWHITE_PEN, *wxWHITE_PEN);
ViewInfo viewInfo; ViewInfo viewInfo;
viewInfo.sel0 = viewInfo.sel1 = 0; viewInfo.sel0 = viewInfo.sel1 = 0;
viewInfo.vpos = 0; viewInfo.vpos = 0;

View File

@ -2702,8 +2702,8 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
if (!value || !XMLValueChecker::IsGoodString(value)) if (!value || !XMLValueChecker::IsGoodString(value))
break; break;
if (!wxStrcmp(attr, wxT("datadir"))) if (!wxStrcmp(attr, wxT("datadir")))
{ {
// //
// This is an auto-saved version whose data is in another directory // This is an auto-saved version whose data is in another directory
// //
@ -2718,8 +2718,8 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
} }
} }
if (!wxStrcmp(attr, wxT("version"))) if (!wxStrcmp(attr, wxT("version")))
{ {
fileVersion = value; fileVersion = value;
bFileVersionFound = true; bFileVersionFound = true;
requiredTags++; requiredTags++;

View File

@ -58,8 +58,8 @@ HFFT InitializeFFT(int fftlen)
if((h=(HFFT)malloc(sizeof(FFTParam)))==NULL) if((h=(HFFT)malloc(sizeof(FFTParam)))==NULL)
{ {
fprintf(stderr,"Error allocating memory for FFT\n"); fprintf(stderr,"Error allocating memory for FFT\n");
exit(8); exit(8);
} }
/* /*
* FFT size is only half the number of data points * FFT size is only half the number of data points
@ -101,12 +101,12 @@ HFFT InitializeFFT(int fftlen)
*/ */
void EndFFT(HFFT h) void EndFFT(HFFT h)
{ {
if(h->Points>0) { if(h->Points>0) {
free(h->BitReversed); free(h->BitReversed);
free(h->SinTable); free(h->SinTable);
} }
h->Points=0; h->Points=0;
free(h); free(h);
} }
#define MAX_HFFT 10 #define MAX_HFFT 10
@ -210,13 +210,13 @@ void RealFFTf(fft_type *buffer,HFFT h)
{ {
v1=*B*cos + *(B+1)*sin; v1=*B*cos + *(B+1)*sin;
v2=*B*sin - *(B+1)*cos; v2=*B*sin - *(B+1)*cos;
*B=(*A+v1); *B=(*A+v1);
*(A++)=*(B++)-2*v1; *(A++)=*(B++)-2*v1;
*B=(*A-v2); *B=(*A-v2);
*(A++)=*(B++)+2*v2; *(A++)=*(B++)+2*v2;
} }
A=B; A=B;
B+=ButterfliesPerGroup*2; B+=ButterfliesPerGroup*2;
sptr+=2; sptr+=2;
} }
ButterfliesPerGroup >>= 1; ButterfliesPerGroup >>= 1;
@ -228,7 +228,7 @@ void RealFFTf(fft_type *buffer,HFFT h)
while(br1<br2) while(br1<br2)
{ {
sin=h->SinTable[*br1]; sin=h->SinTable[*br1];
cos=h->SinTable[*br1+1]; cos=h->SinTable[*br1+1];
A=buffer+*br1; A=buffer+*br1;
B=buffer+*br2; B=buffer+*br2;
HRplus = (HRminus = *A - *B ) + (*B * 2); HRplus = (HRminus = *A - *B ) + (*B * 2);
@ -346,13 +346,13 @@ void InverseRealFFTf(fft_type *buffer,HFFT h)
while(A<endptr2) while(A<endptr2)
{ {
v1=*B*cos - *(B+1)*sin; v1=*B*cos - *(B+1)*sin;
v2=*B*sin + *(B+1)*cos; v2=*B*sin + *(B+1)*cos;
*B=(*A+v1)*(fft_type)0.5; *B=(*A+v1)*(fft_type)0.5;
*(A++)=*(B++)-v1; *(A++)=*(B++)-v1;
*B=(*A+v2)*(fft_type)0.5; *B=(*A+v2)*(fft_type)0.5;
*(A++)=*(B++)-v2; *(A++)=*(B++)-v2;
} }
A=B; A=B;
B+=ButterfliesPerGroup*2; B+=ButterfliesPerGroup*2;
} }
ButterfliesPerGroup >>= 1; ButterfliesPerGroup >>= 1;
@ -362,9 +362,9 @@ void InverseRealFFTf(fft_type *buffer,HFFT h)
void ReorderToFreq(HFFT hFFT, fft_type *buffer, fft_type *RealOut, fft_type *ImagOut) void ReorderToFreq(HFFT hFFT, fft_type *buffer, fft_type *RealOut, fft_type *ImagOut)
{ {
// Copy the data into the real and imaginary outputs // Copy the data into the real and imaginary outputs
for(int i=1;i<hFFT->Points;i++) { for(int i=1;i<hFFT->Points;i++) {
RealOut[i]=buffer[hFFT->BitReversed[i] ]; RealOut[i]=buffer[hFFT->BitReversed[i] ];
ImagOut[i]=buffer[hFFT->BitReversed[i]+1]; ImagOut[i]=buffer[hFFT->BitReversed[i]+1];
} }
RealOut[0] = buffer[0]; // DC component RealOut[0] = buffer[0]; // DC component
ImagOut[0] = 0; ImagOut[0] = 0;
@ -375,8 +375,8 @@ void ReorderToFreq(HFFT hFFT, fft_type *buffer, fft_type *RealOut, fft_type *Ima
void ReorderToTime(HFFT hFFT, fft_type *buffer, fft_type *TimeOut) void ReorderToTime(HFFT hFFT, fft_type *buffer, fft_type *TimeOut)
{ {
// Copy the data into the real outputs // Copy the data into the real outputs
for(int i=0;i<hFFT->Points;i++) { for(int i=0;i<hFFT->Points;i++) {
TimeOut[i*2 ]=buffer[hFFT->BitReversed[i] ]; TimeOut[i*2 ]=buffer[hFFT->BitReversed[i] ];
TimeOut[i*2+1]=buffer[hFFT->BitReversed[i]+1]; TimeOut[i*2+1]=buffer[hFFT->BitReversed[i]+1];
} }
} }

View File

@ -3,9 +3,9 @@
#define fft_type float #define fft_type float
typedef struct FFTParamType { typedef struct FFTParamType {
int *BitReversed; int *BitReversed;
fft_type *SinTable; fft_type *SinTable;
int Points; int Points;
} FFTParam; } FFTParam;
#define HFFT FFTParam * #define HFFT FFTParam *

View File

@ -895,8 +895,8 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
if (!wxStrcmp(attr, wxT("maxsamples"))) if (!wxStrcmp(attr, wxT("maxsamples")))
{ {
// Dominic, 12/10/2006: // Dominic, 12/10/2006:
// Let's check that maxsamples is >= 1024 and <= 64 * 1024 * 1024 // Let's check that maxsamples is >= 1024 and <= 64 * 1024 * 1024
// - that's a pretty wide range of reasonable values. // - that's a pretty wide range of reasonable values.
if ((nValue < 1024) || (nValue > 64 * 1024 * 1024)) if ((nValue < 1024) || (nValue > 64 * 1024 * 1024))
{ {
mErrorOpening = true; mErrorOpening = true;

View File

@ -2117,11 +2117,11 @@ AttachableScrollBar * ShuttleGui::AddAttachableScrollBar( long style )
AttachableScrollBar * pAttachableScrollBar; AttachableScrollBar * pAttachableScrollBar;
miProp=0; miProp=0;
mpWind = pAttachableScrollBar = new AttachableScrollBar( mpWind = pAttachableScrollBar = new AttachableScrollBar(
mpParent, mpParent,
miId, miId,
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
style style
); );
mpWind->SetMinSize(wxSize(10,20)); mpWind->SetMinSize(wxSize(10,20));
UpdateSizers(); UpdateSizers();

View File

@ -25,7 +25,7 @@ const int nMaxNestedSizers = 20;
enum teShuttleMode enum teShuttleMode
{ {
eIsCreating, eIsCreating,
eIsGettingFromDialog, eIsGettingFromDialog,
eIsSettingToDialog, eIsSettingToDialog,
eIsSavingViaShuttle, eIsSavingViaShuttle,
@ -84,10 +84,10 @@ public:
wxSlider * AddSlider(const wxString &Prompt, int pos, int Max, int Min = 0); wxSlider * AddSlider(const wxString &Prompt, int pos, int Max, int Min = 0);
wxSlider * AddVSlider(const wxString &Prompt, int pos, int Max); wxSlider * AddVSlider(const wxString &Prompt, int pos, int Max);
wxSpinCtrl * AddSpinCtrl(const wxString &Prompt, int Value, int Max, int Min); wxSpinCtrl * AddSpinCtrl(const wxString &Prompt, int Value, int Max, int Min);
wxTreeCtrl * AddTree(); wxTreeCtrl * AddTree();
wxRadioButton * AddRadioButton( const wxString & Prompt ); wxRadioButton * AddRadioButton( const wxString & Prompt );
wxRadioButton * AddRadioButtonToGroup( const wxString & Prompt); wxRadioButton * AddRadioButtonToGroup( const wxString & Prompt);
wxButton * AddButton( const wxString & Text, int PositionFlags = wxALIGN_CENTRE ); wxButton * AddButton( const wxString & Text, int PositionFlags = wxALIGN_CENTRE );
wxBitmapButton * AddBitmapButton(const wxBitmap &Bitmap, int PositionFlags = wxALIGN_CENTRE); wxBitmapButton * AddBitmapButton(const wxBitmap &Bitmap, int PositionFlags = wxALIGN_CENTRE);
wxStaticText * AddVariableText(const wxString &Str, bool bCenter = false, int PositionFlags = 0); wxStaticText * AddVariableText(const wxString &Str, bool bCenter = false, int PositionFlags = 0);
wxTextCtrl * AddTextBox(const wxString &Caption, const wxString &Value, const int nChars); wxTextCtrl * AddTextBox(const wxString &Caption, const wxString &Value, const int nChars);
@ -103,9 +103,9 @@ public:
wxChoice * AddChoice( const wxString &Prompt, const wxString &Selected, const wxArrayString * pChoices ); wxChoice * AddChoice( const wxString &Prompt, const wxString &Selected, const wxArrayString * pChoices );
wxMenuBar * AddMenuBar( ); wxMenuBar * AddMenuBar( );
wxMenu * AddMenu( const wxString & Title ); wxMenu * AddMenu( const wxString & Title );
void AddIcon( wxBitmap * pBmp); void AddIcon( wxBitmap * pBmp);
void AddIconButton( const wxString & Command, const wxString & Params,wxBitmap * pBmp ); void AddIconButton( const wxString & Command, const wxString & Params,wxBitmap * pBmp );
void AddFixedText( const wxString & Str, bool bCenter = false ); void AddFixedText( const wxString & Str, bool bCenter = false );
void AddConstTextBox( const wxString &Caption, const wxString & Value ); void AddConstTextBox( const wxString &Caption, const wxString & Value );
//-- Start and end functions. These are used for sizer, or other window containers //-- Start and end functions. These are used for sizer, or other window containers
@ -166,9 +166,9 @@ public:
wxCheckBox * TieCheckBox( const wxString &Prompt, WrappedType & WrappedRef ); wxCheckBox * TieCheckBox( const wxString &Prompt, WrappedType & WrappedRef );
wxCheckBox * TieCheckBox( const wxString &Prompt, const wxString &Selected ); wxCheckBox * TieCheckBox( const wxString &Prompt, const wxString &Selected );
wxCheckBox * TieCheckBox( const wxString &Prompt, bool & Var ); wxCheckBox * TieCheckBox( const wxString &Prompt, bool & Var );
wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, WrappedType & WrappedRef ); wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, WrappedType & WrappedRef );
wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, bool & Var ); wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, bool & Var );
wxChoice * TieChoice( const wxString &Prompt, WrappedType & WrappedRef, const wxArrayString * pChoices ); wxChoice * TieChoice( const wxString &Prompt, WrappedType & WrappedRef, const wxArrayString * pChoices );
wxChoice * TieChoice( const wxString &Prompt, wxString &Selected, const wxArrayString * pChoices ); wxChoice * TieChoice( const wxString &Prompt, wxString &Selected, const wxArrayString * pChoices );
@ -262,9 +262,9 @@ public:
protected: protected:
void SetProportions( int Default ); void SetProportions( int Default );
void PushSizer(); void PushSizer();
void PopSizer(); void PopSizer();
void UpdateSizersCore( bool bPrepend, int Flags ); void UpdateSizersCore( bool bPrepend, int Flags );
void UpdateSizers(); void UpdateSizers();
void UpdateSizersC(); void UpdateSizersC();
void UpdateSizersAtStart(); void UpdateSizersAtStart();
@ -272,8 +272,8 @@ protected:
long Style( long Style ); long Style( long Style );
wxWindow * mpLastWind; wxWindow * mpLastWind;
wxWindow * mpDlg; wxWindow * mpDlg;
wxSizer * pSizerStack[ nMaxNestedSizers ]; wxSizer * pSizerStack[ nMaxNestedSizers ];
wxString mBoxName; wxString mBoxName;
Shuttle * mpShuttle; /*! Controls source/destination of shuttled data. You can Shuttle * mpShuttle; /*! Controls source/destination of shuttled data. You can

View File

@ -306,8 +306,8 @@ void TimeTrack::testMe()
if( t0 > t1 ) if( t0 > t1 )
{ {
printf( "TimeTrack: Warping reverses an interval! [%.2f,%.2f] -> [%.2f,%.2f]\n", printf( "TimeTrack: Warping reverses an interval! [%.2f,%.2f] -> [%.2f,%.2f]\n",
reqt0, reqt1, reqt0, reqt1,
t0, t1 ); t0, t1 );
}*/ }*/
} }

View File

@ -326,11 +326,11 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
S.StartVerticalLay(true); S.StartVerticalLay(true);
{ {
/* i18n-hint: This string is used to configure the controls for times when the recording is /* i18n-hint: This string is used to configure the controls for times when the recording is
* started and stopped. As such it is important that only the alphabetic parts of the string * started and stopped. As such it is important that only the alphabetic parts of the string
* are translated, with the numbers left exactly as they are. * are translated, with the numbers left exactly as they are.
* The 'h' indicates the first number displayed is hours, the 'm' indicates the second number * The 'h' indicates the first number displayed is hours, the 'm' indicates the second number
* displayed is minutes, and the 's' indicates that the third number displayed is seconds. * displayed is minutes, and the 's' indicates that the third number displayed is seconds.
*/ */
wxString strFormat = _("099 h 060 m 060 s"); wxString strFormat = _("099 h 060 m 060 s");
S.StartStatic(_("Start Date and Time"), true); S.StartStatic(_("Start Date and Time"), true);
{ {
@ -372,14 +372,14 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
S.StartStatic(_("Duration"), true); S.StartStatic(_("Duration"), true);
{ {
/* i18n-hint: This string is used to configure the controls which shows the recording /* i18n-hint: This string is used to configure the controls which shows the recording
* duration. As such it is important that only the alphabetic parts of the string * duration. As such it is important that only the alphabetic parts of the string
* are translated, with the numbers left exactly as they are. * are translated, with the numbers left exactly as they are.
* The string 'days' indicates that the first number in the control will be the number of days, * The string 'days' indicates that the first number in the control will be the number of days,
* then the 'h' indicates the second number displayed is hours, the 'm' indicates the third * then the 'h' indicates the second number displayed is hours, the 'm' indicates the third
* number displayed is minutes, and the 's' indicates that the fourth number displayed is * number displayed is minutes, and the 's' indicates that the fourth number displayed is
* seconds. * seconds.
*/ */
wxString strFormat1 = _("099 days 024 h 060 m 060 s"); wxString strFormat1 = _("099 days 024 h 060 m 060 s");
m_pTimeTextCtrl_Duration = new TimeTextCtrl(this, ID_TIMETEXT_DURATION, strFormat1); m_pTimeTextCtrl_Duration = new TimeTextCtrl(this, ID_TIMETEXT_DURATION, strFormat1);
m_pTimeTextCtrl_Duration->SetName(_("Duration")); m_pTimeTextCtrl_Duration->SetName(_("Duration"));
@ -451,7 +451,7 @@ int TimerRecordDialog::WaitForStart()
{ {
wxString strMsg; wxString strMsg;
/* i18n-hint: A time specification like "Sunday 28th October 2007 15:16:17 GMT" /* i18n-hint: A time specification like "Sunday 28th October 2007 15:16:17 GMT"
* but hopefully translated by wxwidgets will be inserted into this */ * but hopefully translated by wxwidgets will be inserted into this */
strMsg.Printf(_("Waiting to start recording at %s.\n"), strMsg.Printf(_("Waiting to start recording at %s.\n"),
GetDisplayDate(m_DateTime_Start).c_str()); GetDisplayDate(m_DateTime_Start).c_str());
wxDateTime startWait_DateTime = wxDateTime::UNow(); wxDateTime startWait_DateTime = wxDateTime::UNow();

View File

@ -84,7 +84,7 @@ class AUDACITY_DLL_API TrackArtist {
void SetSpectrumLogMaxFreq(int freq); void SetSpectrumLogMaxFreq(int freq);
void SetBackgroundBrushes(wxBrush unselectedBrush, wxBrush selectedBrush, void SetBackgroundBrushes(wxBrush unselectedBrush, wxBrush selectedBrush,
wxPen unselectedPen, wxPen selectedPen) { wxPen unselectedPen, wxPen selectedPen) {
this->unselectedBrush = unselectedBrush; this->unselectedBrush = unselectedBrush;
this->selectedBrush = selectedBrush; this->selectedBrush = selectedBrush;
this->unselectedPen = unselectedPen; this->unselectedPen = unselectedPen;
@ -239,8 +239,8 @@ class AUDACITY_DLL_API TrackArtist {
}; };
extern int GetWaveYPos(float value, float min, float max, extern int GetWaveYPos(float value, float min, float max,
int height, bool dB, bool outer, float dBr, int height, bool dB, bool outer, float dBr,
bool clip); bool clip);
#endif // define __AUDACITY_TRACKARTIST__ #endif // define __AUDACITY_TRACKARTIST__

View File

@ -978,7 +978,7 @@ void TrackPanel::OnTimer()
MakeParentRedrawScrollbars(); MakeParentRedrawScrollbars();
p->SetAudioIOToken(0); p->SetAudioIOToken(0);
p->RedrawProject(); p->RedrawProject();
//ANSWER-ME: Was DisplaySelection added to solve a repaint problem? //ANSWER-ME: Was DisplaySelection added to solve a repaint problem?
DisplaySelection(); DisplaySelection();
} }
@ -3459,7 +3459,7 @@ void TrackPanel::HandleVZoomButtonUp( wxMouseEvent & event )
} }
else { else {
if(spectrumLog) if(spectrumLog)
{ {
float p1; float p1;
p1 = (mZoomStart - ypos) / (float)height; p1 = (mZoomStart - ypos) / (float)height;
c = 1.0-p1; c = 1.0-p1;
@ -3616,7 +3616,7 @@ void TrackPanel::HandleSampleEditingClick( wxMouseEvent & event )
t = FindTrack(event.m_x, event.m_y, false, false, &r); t = FindTrack(event.m_x, event.m_y, false, false, &r);
if (!t || (t->GetKind() != Track::Wave)) if (!t || (t->GetKind() != Track::Wave))
return; return;
if( !IsSampleEditingPossible( event, t ) ) if( !IsSampleEditingPossible( event, t ) )
{ {
@ -7284,7 +7284,7 @@ const int nRates=12;
/// gRates MUST CORRESPOND DIRECTLY TO THE RATES AS LISTED IN THE MENU!! /// gRates MUST CORRESPOND DIRECTLY TO THE RATES AS LISTED IN THE MENU!!
/// IN THE SAME ORDER!! /// IN THE SAME ORDER!!
int gRates[nRates] = { 8000, 11025, 16000, 22050, 44100, 48000, 88200, 96000, int gRates[nRates] = { 8000, 11025, 16000, 22050, 44100, 48000, 88200, 96000,
176400, 192000, 352800, 384000 }; 176400, 192000, 352800, 384000 };
/// This method handles the selection from the Rate /// This method handles the selection from the Rate
/// submenu of the track menu, except for "Other" (/see OnRateOther). /// submenu of the track menu, except for "Other" (/see OnRateOther).

View File

@ -317,8 +317,8 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel {
// AS: Selection handling // AS: Selection handling
virtual void HandleSelect(wxMouseEvent & event); virtual void HandleSelect(wxMouseEvent & event);
virtual void SelectionHandleDrag(wxMouseEvent &event, Track *pTrack); virtual void SelectionHandleDrag(wxMouseEvent &event, Track *pTrack);
virtual void SelectionHandleClick(wxMouseEvent &event, virtual void SelectionHandleClick(wxMouseEvent &event,
Track* pTrack, wxRect r); Track* pTrack, wxRect r);
virtual void StartSelection (int mouseXCoordinate, int trackLeftEdge); virtual void StartSelection (int mouseXCoordinate, int trackLeftEdge);
virtual void ExtendSelection(int mouseXCoordinate, int trackLeftEdge, virtual void ExtendSelection(int mouseXCoordinate, int trackLeftEdge,
Track *pTrack); Track *pTrack);

View File

@ -45,9 +45,9 @@ VoiceKey::VoiceKey(){
mEnergySD = .0002; // 44100 hertz mEnergySD = .0002; // 44100 hertz
mSignChangesMean = .08; mSignChangesMean = .08;
mSignChangesSD= .02; mSignChangesSD= .02;
mDirectionChangesMean = .25; mDirectionChangesMean = .25;
mDirectionChangesSD = .2; mDirectionChangesSD = .2;
AdjustThreshold(2); AdjustThreshold(2);
mSilentWindowSize = .05; //Amount of time (in seconds) below threshold to call it silence mSilentWindowSize = .05; //Amount of time (in seconds) below threshold to call it silence
@ -101,7 +101,7 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
double rate = t.GetRate(); //Translates seconds to samples double rate = t.GetRate(); //Translates seconds to samples
unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); //Size of window to examine unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); //Size of window to examine
unsigned int SignalWindowSizeInt = (unsigned int)(rate * mSignalWindowSize); //This much signal is necessary to trip key unsigned int SignalWindowSizeInt = (unsigned int)(rate * mSignalWindowSize); //This much signal is necessary to trip key
int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection
lastsubthresholdsample = start; //start this off at the selection start lastsubthresholdsample = start; //start this off at the selection start
unsigned int i; //iterates through waveblock unsigned int i; //iterates through waveblock
@ -115,7 +115,7 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
//If there are fewer than 10 samples leftover, don't bother. //If there are fewer than 10 samples leftover, don't bother.
for(i = start; samplesleft >=10; i+=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){ for(i = start; samplesleft >=10; i+=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){
//Set blocksize so that it is the right size //Set blocksize so that it is the right size
if((unsigned int)samplesleft < WindowSizeInt){ if((unsigned int)samplesleft < WindowSizeInt){
blocksize = samplesleft; blocksize = samplesleft;
@ -132,17 +132,17 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
blockruns=0; //Miss--start over blockruns=0; //Miss--start over
lastsubthresholdsample = i; lastsubthresholdsample = i;
} }
//If the blockrun is long enough, break out of the loop early: //If the blockrun is long enough, break out of the loop early:
if(blockruns > mSignalWindowSize/mWindowSize) if(blockruns > mSignalWindowSize/mWindowSize)
break; break;
} }
//Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully //Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully
if(samplesleft > 10){ if(samplesleft > 10){
//Calculate how many to scan through--we only have to go through (at most) //Calculate how many to scan through--we only have to go through (at most)
//the first window + 1 samples--but we need another window samples to draw from. //the first window + 1 samples--but we need another window samples to draw from.
samplesleft = 2*WindowSizeInt+1; samplesleft = 2*WindowSizeInt+1;
@ -151,14 +151,14 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
//Only go through the first SignalWindowSizeInt samples, and choose the first that trips the key. //Only go through the first SignalWindowSizeInt samples, and choose the first that trips the key.
sampleFormat *buffer = new sampleFormat[samplesleft]; sampleFormat *buffer = new sampleFormat[samplesleft];
t.Get((samplePtr)buffer, floatSample,lastsubthresholdsample,samplesleft); t.Get((samplePtr)buffer, floatSample,lastsubthresholdsample,samplesleft);
//Initialize these trend markers atrend and ztrend. They keep track of the //Initialize these trend markers atrend and ztrend. They keep track of the
//up/down trends at the start and end of the evaluation window. //up/down trends at the start and end of the evaluation window.
int atrend = sgn(buffer[1]-buffer[0]); int atrend = sgn(buffer[1]-buffer[0]);
int ztrend = sgn(buffer[WindowSizeInt+1]-buffer[WindowSizeInt]); int ztrend = sgn(buffer[WindowSizeInt+1]-buffer[WindowSizeInt]);
double erg=0; double erg=0;
double sc=0; double sc=0;
@ -177,13 +177,13 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
//Now, go through the sound again, sample by sample. //Now, go through the sound again, sample by sample.
for(i=0; i<SignalWindowSizeInt-WindowSizeInt;i++){ for(i=0; i<SignalWindowSizeInt-WindowSizeInt;i++){
int tests = 0; int tests = 0;
int testThreshold = 0; int testThreshold = 0;
//Update the test statistics //Update the test statistics
if(mUseEnergy) if(mUseEnergy)
{ {
TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]); TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]);
tests += (int)(erg>mThresholdEnergy); tests += (int)(erg>mThresholdEnergy);
testThreshold++; testThreshold++;
} }
@ -233,7 +233,7 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
} }
} }
} }
//Move backward from end to find an ON region. //Move backward from end to find an ON region.
sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount len) { sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount len) {
@ -251,7 +251,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
double rate = t.GetRate(); //Translates seconds to samples double rate = t.GetRate(); //Translates seconds to samples
unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); //Size of window to examine unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); //Size of window to examine
//unsigned int SilentWindowSizeInt = (unsigned int)(rate * mSilentWindowSize); //This much signal is necessary to trip key //unsigned int SilentWindowSizeInt = (unsigned int)(rate * mSilentWindowSize); //This much signal is necessary to trip key
int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection
lastsubthresholdsample = end; //start this off at the end lastsubthresholdsample = end; //start this off at the end
unsigned int i; //iterates through waveblock unsigned int i; //iterates through waveblock
@ -264,7 +264,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
//go through one sample at a time. //go through one sample at a time.
//If there are fewer than 10 samples leftover, don't bother. //If there are fewer than 10 samples leftover, don't bother.
for(i = end - WindowSizeInt; samplesleft >=10; i-=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){ for(i = end - WindowSizeInt; samplesleft >=10; i-=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){
//Set blocksize so that it is the right size //Set blocksize so that it is the right size
if(samplesleft < (int)WindowSizeInt){ if(samplesleft < (int)WindowSizeInt){
blocksize = samplesleft; blocksize = samplesleft;
@ -272,7 +272,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
else{ else{
blocksize = WindowSizeInt; blocksize = WindowSizeInt;
} }
//Test whether we are above threshold //Test whether we are above threshold
if(AboveThreshold(t,i,blocksize)) if(AboveThreshold(t,i,blocksize))
@ -284,16 +284,16 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
blockruns=0; //Miss--start over blockruns=0; //Miss--start over
lastsubthresholdsample = i+WindowSizeInt; lastsubthresholdsample = i+WindowSizeInt;
} }
//If the blockrun is long enough, break out of the loop early: //If the blockrun is long enough, break out of the loop early:
if(blockruns > mSilentWindowSize/mWindowSize) if(blockruns > mSilentWindowSize/mWindowSize)
break; break;
} }
//Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully //Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully
if(samplesleft > 10){ if(samplesleft > 10){
//Calculate how many to scan through--we only have to go through (at most) //Calculate how many to scan through--we only have to go through (at most)
//the first window + 1 samples--but we need another window samples to draw from. //the first window + 1 samples--but we need another window samples to draw from.
samplesleft = 2*WindowSizeInt+1; samplesleft = 2*WindowSizeInt+1;
@ -302,7 +302,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
//Only go through the first mSilentWindowSizeInt samples, and choose the first that trips the key. //Only go through the first mSilentWindowSizeInt samples, and choose the first that trips the key.
sampleFormat *buffer = new sampleFormat[samplesleft]; sampleFormat *buffer = new sampleFormat[samplesleft];
t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample-samplesleft,samplesleft); t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample-samplesleft,samplesleft);
//Initialize these trend markers atrend and ztrend. They keep track of the //Initialize these trend markers atrend and ztrend. They keep track of the
//up/down trends at the start and end of the evaluation window. //up/down trends at the start and end of the evaluation window.
int atrend = sgn(buffer[samplesleft - 2]-buffer[samplesleft - 1]); int atrend = sgn(buffer[samplesleft - 2]-buffer[samplesleft - 1]);
@ -327,7 +327,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
//Update the test statistics //Update the test statistics
if(mUseEnergy) if(mUseEnergy)
{ {
TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]); TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]);
tests += (int)(erg>mThresholdEnergy); tests += (int)(erg>mThresholdEnergy);
testThreshold++; testThreshold++;
} }
@ -379,7 +379,7 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
if((mWindowSize) >= len+10){ if((mWindowSize) >= len+10){
wxMessageBox(_("Selection is too small to use voice key.")); wxMessageBox(_("Selection is too small to use voice key."));
return start; return start;
} }
else{ else{
@ -391,7 +391,7 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
double rate = t.GetRate(); //Translates seconds to samples double rate = t.GetRate(); //Translates seconds to samples
unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); //Size of window to examine unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); //Size of window to examine
unsigned int SilentWindowSizeInt = (unsigned int)(rate * mSilentWindowSize); //This much signal is necessary to trip key unsigned int SilentWindowSizeInt = (unsigned int)(rate * mSilentWindowSize); //This much signal is necessary to trip key
int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection
lastsubthresholdsample = start; //start this off at the selection start lastsubthresholdsample = start; //start this off at the selection start
unsigned int i; //iterates through waveblock unsigned int i; //iterates through waveblock
@ -403,7 +403,7 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
//go through one sample at a time. //go through one sample at a time.
//If there are fewer than 10 samples leftover, don't bother. //If there are fewer than 10 samples leftover, don't bother.
for(i = start; samplesleft >=10; i+=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){ for(i = start; samplesleft >=10; i+=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){
//Set blocksize so that it is the right size //Set blocksize so that it is the right size
if(samplesleft < (int)WindowSizeInt){ if(samplesleft < (int)WindowSizeInt){
blocksize = samplesleft; blocksize = samplesleft;
@ -430,8 +430,8 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
//Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully //Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully
if(samplesleft > 10){ if(samplesleft > 10){
//Calculate how many to scan through--we only have to go through (at most) //Calculate how many to scan through--we only have to go through (at most)
//the first window + 1 samples--but we need another window samples to draw from. //the first window + 1 samples--but we need another window samples to draw from.
samplesleft = 2*WindowSizeInt+1; samplesleft = 2*WindowSizeInt+1;
@ -440,12 +440,12 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
//Only go through the first SilentWindowSizeInt samples, and choose the first that trips the key. //Only go through the first SilentWindowSizeInt samples, and choose the first that trips the key.
sampleFormat *buffer = new sampleFormat[samplesleft]; sampleFormat *buffer = new sampleFormat[samplesleft];
t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample,samplesleft); t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample,samplesleft);
//Initialize these trend markers atrend and ztrend. They keep track of the //Initialize these trend markers atrend and ztrend. They keep track of the
//up/down trends at the start and end of the evaluation window. //up/down trends at the start and end of the evaluation window.
int atrend = sgn(buffer[1]-buffer[0]); int atrend = sgn(buffer[1]-buffer[0]);
int ztrend = sgn(buffer[WindowSizeInt+1]-buffer[WindowSizeInt]); int ztrend = sgn(buffer[WindowSizeInt+1]-buffer[WindowSizeInt]);
double erg=0; double erg=0;
double sc=0; double sc=0;
@ -466,7 +466,7 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
//Update the test statistics //Update the test statistics
if(mUseEnergy) if(mUseEnergy)
{ {
TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]); TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]);
tests += (int)(erg>mThresholdEnergy); tests += (int)(erg>mThresholdEnergy);
testThreshold++; testThreshold++;
} }
@ -511,14 +511,14 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
} }
} }
} }
//Move backward from the end to find an OFF region //Move backward from the end to find an OFF region
sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount len) { sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount len) {
if((mWindowSize) >= len+10){ if((mWindowSize) >= len+10){
wxMessageBox(_("Selection is too small to use voice key.")); wxMessageBox(_("Selection is too small to use voice key."));
return end; return end;
} }
@ -530,7 +530,7 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
double rate = t.GetRate(); //Translates seconds to samples double rate = t.GetRate(); //Translates seconds to samples
unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); //Size of window to examine unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); //Size of window to examine
//unsigned int SilentWindowSizeInt = (unsigned int)(rate * mSilentWindowSize); //This much signal is necessary to trip key //unsigned int SilentWindowSizeInt = (unsigned int)(rate * mSilentWindowSize); //This much signal is necessary to trip key
int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection
lastsubthresholdsample = end; //start this off at the end lastsubthresholdsample = end; //start this off at the end
unsigned int i; //iterates through waveblock unsigned int i; //iterates through waveblock
@ -542,7 +542,7 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
//go through one sample at a time. //go through one sample at a time.
//If there are fewer than 10 samples leftover, don't bother. //If there are fewer than 10 samples leftover, don't bother.
for(i = end - WindowSizeInt; samplesleft >=10; i-=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){ for(i = end - WindowSizeInt; samplesleft >=10; i-=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){
//Set blocksize so that it is the right size //Set blocksize so that it is the right size
if(samplesleft < (int)WindowSizeInt){ if(samplesleft < (int)WindowSizeInt){
blocksize = samplesleft; blocksize = samplesleft;
@ -553,25 +553,25 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
if(!AboveThreshold(t,i,blocksize)) if(!AboveThreshold(t,i,blocksize))
{ {
blockruns++; //Hit blockruns++; //Hit
} }
else else
{ {
blockruns=0; //Miss--start over blockruns=0; //Miss--start over
lastsubthresholdsample = i+WindowSizeInt; lastsubthresholdsample = i+WindowSizeInt;
} }
//If the blockrun is long enough, break out of the loop early: //If the blockrun is long enough, break out of the loop early:
if(blockruns > mSilentWindowSize/mWindowSize) if(blockruns > mSilentWindowSize/mWindowSize)
break; break;
} }
//Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully //Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully
if(samplesleft > 10){ if(samplesleft > 10){
//Calculate how many to scan through--we only have to go through (at most) //Calculate how many to scan through--we only have to go through (at most)
//the first window + 1 samples--but we need another window samples to draw from. //the first window + 1 samples--but we need another window samples to draw from.
samplesleft = 2*WindowSizeInt+1; samplesleft = 2*WindowSizeInt+1;
@ -580,12 +580,12 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
//Only go through the first SilentWindowSizeInt samples, and choose the first that trips the key. //Only go through the first SilentWindowSizeInt samples, and choose the first that trips the key.
sampleFormat *buffer = new sampleFormat[samplesleft]; sampleFormat *buffer = new sampleFormat[samplesleft];
t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample-samplesleft,samplesleft); t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample-samplesleft,samplesleft);
//Initialize these trend markers atrend and ztrend. They keep track of the //Initialize these trend markers atrend and ztrend. They keep track of the
//up/down trends at the start and end of the evaluation window. //up/down trends at the start and end of the evaluation window.
int atrend = sgn(buffer[samplesleft - 2]-buffer[samplesleft - 1]); int atrend = sgn(buffer[samplesleft - 2]-buffer[samplesleft - 1]);
int ztrend = sgn(buffer[samplesleft - WindowSizeInt-2]-buffer[samplesleft - WindowSizeInt-2]); int ztrend = sgn(buffer[samplesleft - WindowSizeInt-2]-buffer[samplesleft - WindowSizeInt-2]);
double erg=0; double erg=0;
double sc=0; double sc=0;
double dc=0; double dc=0;
@ -599,7 +599,7 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
//Now, go through the sound again, sample by sample. //Now, go through the sound again, sample by sample.
for(i=samplesleft-1; i>WindowSizeInt; i--){ for(i=samplesleft-1; i>WindowSizeInt; i--){
int tests = 0; int tests = 0;
int testThreshold = 0; int testThreshold = 0;
//Update the test statistics //Update the test statistics
@ -633,8 +633,8 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
tests += (int)(dc > mThresholdDirectionChangesUpper); tests += (int)(dc > mThresholdDirectionChangesUpper);
testThreshold++; testThreshold++;
} }
if(tests < testThreshold) if(tests < testThreshold)
{ //Finish off on the first hit { //Finish off on the first hit
@ -753,13 +753,13 @@ void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len)
// sampleFormat z2=0; // keeps track of initial and final samples of window to enable updating formulae // sampleFormat z2=0; // keeps track of initial and final samples of window to enable updating formulae
int atrend=0; // equals sgn(a2-a1); Keeps track of trend at start of window int atrend=0; // equals sgn(a2-a1); Keeps track of trend at start of window
int ztrend=0; // equals sgn(z2-z1); Keeps track of trend at end of window int ztrend=0; // equals sgn(z2-z1); Keeps track of trend at end of window
//Now, change the millisecond-based parameters into sample-based parameters //Now, change the millisecond-based parameters into sample-based parameters
//(This depends on WaveTrack t) //(This depends on WaveTrack t)
double rate = t.GetRate(); double rate = t.GetRate();
unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize);
// unsigned int SignalWindowSizeInt = (unsigned int)(rate * mSignalWindowSize); // unsigned int SignalWindowSizeInt = (unsigned int)(rate * mSignalWindowSize);
//Get the first test statistics //Get the first test statistics
@ -831,7 +831,7 @@ void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len)
} }
mEnergyMean = sumerg / samples; mEnergyMean = sumerg / samples;
mEnergySD = sqrt(sumerg2/samples - mEnergyMean*mEnergyMean); mEnergySD = sqrt(sumerg2/samples - mEnergyMean*mEnergyMean);
@ -875,7 +875,7 @@ void VoiceKey::SetKeyType(bool erg, bool scLow , bool scHigh,
//This might continue over a number of blocks. //This might continue over a number of blocks.
double VoiceKey::TestEnergy (WaveTrack & t, sampleCount start, sampleCount len) double VoiceKey::TestEnergy (WaveTrack & t, sampleCount start, sampleCount len)
{ {
double sum = 1; double sum = 1;
sampleCount s = start; //Keep track of start sampleCount s = start; //Keep track of start
sampleCount originalLen = len; //Keep track of the length of block to process (its not the length of t) sampleCount originalLen = len; //Keep track of the length of block to process (its not the length of t)
@ -919,24 +919,24 @@ void VoiceKey::TestEnergyUpdate (double & prevErg, int len, const sampleFormat &
double VoiceKey::TestSignChanges(WaveTrack & t, sampleCount start, sampleCount len) double VoiceKey::TestSignChanges(WaveTrack & t, sampleCount start, sampleCount len)
{ {
sampleCount s = start; //Keep track of start sampleCount s = start; //Keep track of start
sampleCount originalLen = len; //Keep track of the length of block to process (its not the length of t) sampleCount originalLen = len; //Keep track of the length of block to process (its not the length of t)
sampleCount blockSize = t.GetMaxBlockSize(); //Determine size of sampling buffer sampleCount blockSize = t.GetMaxBlockSize(); //Determine size of sampling buffer
unsigned long signchanges = 1; unsigned long signchanges = 1;
int currentsign=0; int currentsign=0;
if( blockSize > len) if( blockSize > len)
blockSize = len; blockSize = len;
sampleFormat *buffer = new sampleFormat[blockSize]; //Get a sampling buffer sampleFormat *buffer = new sampleFormat[blockSize]; //Get a sampling buffer
while(len > 0) { while(len > 0) {
sampleCount block = t.GetBestBlockSize(s); //Figure out how much to grab sampleCount block = t.GetBestBlockSize(s); //Figure out how much to grab
if(block > len) block = len; //Don't grab too much! if(block > len) block = len; //Don't grab too much!
t.Get((samplePtr)buffer,floatSample, s,block); //grab the block; t.Get((samplePtr)buffer,floatSample, s,block); //grab the block;
if (len == originalLen) if (len == originalLen)
@ -964,10 +964,10 @@ double VoiceKey::TestSignChanges(WaveTrack & t, sampleCount start, sampleCount l
} }
void VoiceKey::TestSignChangesUpdate(double & currentsignchanges, int len, void VoiceKey::TestSignChangesUpdate(double & currentsignchanges, int len,
const sampleFormat & a1, const sampleFormat & a1,
const sampleFormat & a2, const sampleFormat & a2,
const sampleFormat & z1, const sampleFormat & z1,
const sampleFormat & z2) const sampleFormat & z2)
{ {
if(sgn(a1)!=sgn(a2)) currentsignchanges -= 1.0/len; if(sgn(a1)!=sgn(a2)) currentsignchanges -= 1.0/len;
@ -978,7 +978,7 @@ void VoiceKey::TestSignChangesUpdate(double & currentsignchanges, int len,
double VoiceKey::TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCount len) double VoiceKey::TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCount len)
{ {
sampleCount s = start; //Keep track of start sampleCount s = start; //Keep track of start
sampleCount originalLen = len; //Keep track of the length of block to process (its not the length of t) sampleCount originalLen = len; //Keep track of the length of block to process (its not the length of t)
@ -992,10 +992,10 @@ double VoiceKey::TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCo
sampleFormat *buffer = new sampleFormat[blockSize]; //Get a sampling buffer sampleFormat *buffer = new sampleFormat[blockSize]; //Get a sampling buffer
while(len > 0) { while(len > 0) {
sampleCount block = t.GetBestBlockSize(s); //Figure out how much to grab sampleCount block = t.GetBestBlockSize(s); //Figure out how much to grab
if(block > len) block = len; //Don't grab too much! if(block > len) block = len; //Don't grab too much!
t.Get((samplePtr)buffer,floatSample, s,block); //grab the block; t.Get((samplePtr)buffer,floatSample, s,block); //grab the block;
if (len == originalLen) { if (len == originalLen) {
@ -1013,7 +1013,7 @@ double VoiceKey::TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCo
lastdirection = sgn(buffer[i] - lastval); lastdirection = sgn(buffer[i] - lastval);
} }
lastval = buffer[i]; lastval = buffer[i];
} }
len -= block; len -= block;
s += block; s += block;
@ -1028,8 +1028,8 @@ double VoiceKey::TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCo
// This method does an updating by looking at the trends // This method does an updating by looking at the trends
// This will change currentdirections and atrend/trend, so be warned. // This will change currentdirections and atrend/trend, so be warned.
void VoiceKey::TestDirectionChangesUpdate(double & currentdirectionchanges, int len, void VoiceKey::TestDirectionChangesUpdate(double & currentdirectionchanges, int len,
int & atrend, const sampleFormat & a1, const sampleFormat & a2, int & atrend, const sampleFormat & a1, const sampleFormat & a2,
int & ztrend, const sampleFormat & z1, const sampleFormat & z2) int & ztrend, const sampleFormat & z1, const sampleFormat & z2)
{ {
if(sgn(a2 - a1)!= atrend ) { if(sgn(a2 - a1)!= atrend ) {

View File

@ -31,63 +31,63 @@ enum VoiceKeyTypes
class VoiceKey { class VoiceKey {
public: public:
VoiceKey(); VoiceKey();
~VoiceKey(); ~VoiceKey();
sampleCount OnForward (WaveTrack & t, sampleCount start, sampleCount len); sampleCount OnForward (WaveTrack & t, sampleCount start, sampleCount len);
sampleCount OnBackward (WaveTrack & t, sampleCount start, sampleCount len); sampleCount OnBackward (WaveTrack & t, sampleCount start, sampleCount len);
sampleCount OffForward (WaveTrack & t, sampleCount start, sampleCount len); sampleCount OffForward (WaveTrack & t, sampleCount start, sampleCount len);
sampleCount OffBackward (WaveTrack & t, sampleCount start, sampleCount len); sampleCount OffBackward (WaveTrack & t, sampleCount start, sampleCount len);
void CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len); void CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len);
void AdjustThreshold(double t); void AdjustThreshold(double t);
bool AboveThreshold(WaveTrack & t, sampleCount start,sampleCount len); bool AboveThreshold(WaveTrack & t, sampleCount start,sampleCount len);
void SetKeyType(bool erg, bool scLow, bool scHigh, void SetKeyType(bool erg, bool scLow, bool scHigh,
bool dcLow, bool dcHigh); bool dcLow, bool dcHigh);
private: private:
double mWindowSize; //Size of analysis window, in milliseconds
double mThresholdAdjustment; //User-accessible sensitivity calibration variable
double mEnergyMean; double mWindowSize; //Size of analysis window, in milliseconds
double mEnergySD;
double mSignChangesMean;
double mSignChangesSD;
double mDirectionChangesMean;
double mDirectionChangesSD;
double mThresholdEnergy; // Threshold[*] is equal to [*]Mean + [*]SD * ThresholdAdjustment double mThresholdAdjustment; //User-accessible sensitivity calibration variable
double mThresholdSignChangesLower;
double mThresholdSignChangesUpper;
double mThresholdDirectionChangesLower;
double mThresholdDirectionChangesUpper;
//These determine which statistics should be used. double mEnergyMean;
bool mUseEnergy; double mEnergySD;
bool mUseSignChangesLow; double mSignChangesMean;
bool mUseSignChangesHigh; double mSignChangesSD;
bool mUseDirectionChangesLow; double mDirectionChangesMean;
bool mUseDirectionChangesHigh; double mDirectionChangesSD;
double mThresholdEnergy; // Threshold[*] is equal to [*]Mean + [*]SD * ThresholdAdjustment
double mThresholdSignChangesLower;
double mThresholdSignChangesUpper;
double mThresholdDirectionChangesLower;
double mThresholdDirectionChangesUpper;
//These determine which statistics should be used.
bool mUseEnergy;
bool mUseSignChangesLow;
bool mUseSignChangesHigh;
bool mUseDirectionChangesLow;
bool mUseDirectionChangesHigh;
double mSilentWindowSize; //Time in milliseconds of below-threshold windows required for silence double mSilentWindowSize; //Time in milliseconds of below-threshold windows required for silence
double mSignalWindowSize; //Time in milliseconds of above-threshold windows required for speech double mSignalWindowSize; //Time in milliseconds of above-threshold windows required for speech
double TestEnergy (WaveTrack & t, sampleCount start,sampleCount len); double TestEnergy (WaveTrack & t, sampleCount start,sampleCount len);
double TestSignChanges (WaveTrack & t, sampleCount start, sampleCount len); double TestSignChanges (WaveTrack & t, sampleCount start, sampleCount len);
double TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCount len); double TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCount len);
void TestEnergyUpdate (double & prevErg, int length, const sampleFormat & drop, const sampleFormat & add); void TestEnergyUpdate (double & prevErg, int length, const sampleFormat & drop, const sampleFormat & add);
void TestSignChangesUpdate(double & currentsignchanges,int length, const sampleFormat & a1, void TestSignChangesUpdate(double & currentsignchanges,int length, const sampleFormat & a1,
const sampleFormat & a2, const sampleFormat & z1, const sampleFormat & z2); const sampleFormat & a2, const sampleFormat & z1, const sampleFormat & z2);
void TestDirectionChangesUpdate(double & currentdirectionchanges,int length, void TestDirectionChangesUpdate(double & currentdirectionchanges,int length,
int & atrend, const sampleFormat & a1, const sampleFormat & a2, int & atrend, const sampleFormat & a1, const sampleFormat & a2,
int & ztrend, const sampleFormat & z1, const sampleFormat & z2); int & ztrend, const sampleFormat & z1, const sampleFormat & z2);
}; };

View File

@ -625,12 +625,12 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
int i; int i;
sampleFormat seqFormat = mSequence->GetSampleFormat(); sampleFormat seqFormat = mSequence->GetSampleFormat();
bool didUpdate = false; bool didUpdate = false;
for(i=a; i<p1; i++) { for(i=a; i<p1; i++) {
sampleCount left; sampleCount left;
left = mWaveCache->where[i] - numSamples; left = mWaveCache->where[i] - numSamples;
sampleCount right; sampleCount right;
right = mWaveCache->where[i+1] - numSamples; right = mWaveCache->where[i+1] - numSamples;
//wxCriticalSectionLocker locker(mAppendCriticalSection); //wxCriticalSectionLocker locker(mAppendCriticalSection);
@ -672,16 +672,16 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
if (seqFormat != floatSample) if (seqFormat != floatSample)
delete[] b; delete[] b;
didUpdate=true; didUpdate=true;
} }
} }
// So that the sequence doesn't try to write any // So that the sequence doesn't try to write any
// of these values // of these values
//mchinen: but only do this if we've updated pixels in the cache. //mchinen: but only do this if we've updated pixels in the cache.
if(didUpdate) if(didUpdate)
p1 = a; p1 = a;
} }
if (p1 > p0) { if (p1 > p0) {

View File

@ -129,15 +129,15 @@ public:
Sequence* GetSequence() { return mSequence; } Sequence* GetSequence() { return mSequence; }
/** WaveTrack calls this whenever data in the wave clip changes. It is /** WaveTrack calls this whenever data in the wave clip changes. It is
* called automatically when WaveClip has a chance to know that something * called automatically when WaveClip has a chance to know that something
* has changed, like when member functions SetSamples() etc. are called. */ * has changed, like when member functions SetSamples() etc. are called. */
void MarkChanged() { mDirty++; } void MarkChanged() { mDirty++; }
/// Create clip from copy, discarding previous information in the clip /// Create clip from copy, discarding previous information in the clip
bool CreateFromCopy(double t0, double t1, WaveClip* other); bool CreateFromCopy(double t0, double t1, WaveClip* other);
/** Getting high-level data from the for screen display and clipping /** Getting high-level data from the for screen display and clipping
* calculations and Contrast */ * calculations and Contrast */
bool GetWaveDisplay(float *min, float *max, float *rms,int* bl, sampleCount *where, bool GetWaveDisplay(float *min, float *max, float *rms,int* bl, sampleCount *where,
int numPixels, double t0, double pixelsPerSecond, bool &isLoadingOD); int numPixels, double t0, double pixelsPerSecond, bool &isLoadingOD);
bool GetSpectrogram(float *buffer, sampleCount *where, bool GetSpectrogram(float *buffer, sampleCount *where,
@ -154,8 +154,8 @@ public:
void GetDisplayRect(wxRect* r); void GetDisplayRect(wxRect* r);
/** Whenever you do an operation to the sequence that will change the number /** Whenever you do an operation to the sequence that will change the number
* of samples (that is, the length of the clip), you will want to call this * of samples (that is, the length of the clip), you will want to call this
* function to tell the envelope about it. */ * function to tell the envelope about it. */
void UpdateEnvelopeTrackLen(); void UpdateEnvelopeTrackLen();
/// You must call Flush after the last Append /// You must call Flush after the last Append
@ -182,22 +182,22 @@ public:
bool Paste(double t0, WaveClip* other); bool Paste(double t0, WaveClip* other);
/** Insert silence - note that this is an efficient operation for large /** Insert silence - note that this is an efficient operation for large
* amounts of silence */ * amounts of silence */
bool InsertSilence(double t, double len); bool InsertSilence(double t, double len);
/// Get access to cut lines list /// Get access to cut lines list
WaveClipList* GetCutLines() { return &mCutLines; } WaveClipList* GetCutLines() { return &mCutLines; }
/** Find cut line at (approximately) this position. Returns true and fills /** Find cut line at (approximately) this position. Returns true and fills
* in cutLineStart and cutLineEnd (if specified) if a cut line at this * in cutLineStart and cutLineEnd (if specified) if a cut line at this
* position could be found. Return false otherwise. */ * position could be found. Return false otherwise. */
bool FindCutLine(double cutLinePosition, bool FindCutLine(double cutLinePosition,
double* cutLineStart = NULL, double* cutLineStart = NULL,
double *cutLineEnd = NULL); double *cutLineEnd = NULL);
/** Expand cut line (that is, re-insert audio, then delete audio saved in /** Expand cut line (that is, re-insert audio, then delete audio saved in
* cut line). Returns true if a cut line could be found and sucessfully * cut line). Returns true if a cut line could be found and sucessfully
* expanded, false otherwise */ * expanded, false otherwise */
bool ExpandCutLine(double cutLinePosition); bool ExpandCutLine(double cutLinePosition);
/// Remove cut line, without expanding the audio in it /// Remove cut line, without expanding the audio in it

View File

@ -89,15 +89,15 @@ class AUDACITY_DLL_API WaveTrack: public Track {
virtual void SetOffset (double o); virtual void SetOffset (double o);
/** @brief Get the time at which the first clip in the track starts /** @brief Get the time at which the first clip in the track starts
* *
* @return time in seconds, or zero if there are no clips in the track * @return time in seconds, or zero if there are no clips in the track
*/ */
double GetStartTime(); double GetStartTime();
/** @brief Get the time at which the last clip in the track ends, plus /** @brief Get the time at which the last clip in the track ends, plus
* recorded stuff * recorded stuff
* *
* @return time in seconds, or zero if there are no clips in the track. * @return time in seconds, or zero if there are no clips in the track.
*/ */
double GetEndTime(); double GetEndTime();
@ -375,7 +375,7 @@ class AUDACITY_DLL_API WaveTrack: public Track {
WaveformDisplay, WaveformDisplay,
WaveformDBDisplay, WaveformDBDisplay,
SpectrumDisplay, SpectrumDisplay,
SpectrumLogDisplay, SpectrumLogDisplay,
PitchDisplay PitchDisplay
} WaveTrackDisplay; } WaveTrackDisplay;