mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Campbell Barton's patch to turn many, many tabs to our 3-space convenbtion
This commit is contained in:
parent
63788f4b2d
commit
9d0daf8662
@ -231,7 +231,7 @@ void AboutDialog::PopulateAudacityPage( ShuttleGui & S )
|
||||
wxT("<body bgcolor=\"#ffffff\"><center>") +
|
||||
wxT("<h3>Audacity ") + versionStr + wxT("</h3>")+
|
||||
_("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("<p>") + par2Str +
|
||||
wxT("<p><center><b>") + _("Credits") + wxT("</b></center>")
|
||||
@ -274,7 +274,7 @@ void AboutDialog::PopulateAudacityPage( ShuttleGui & S )
|
||||
wxT("</b><br>") +
|
||||
GetCreditsByRole(roleThanks) +
|
||||
wxT("<p><br></center>") +
|
||||
|
||||
|
||||
_("<b>Audacity®</b> software is copyright")+
|
||||
wxT("© 1999-2013 Audacity Team.<br>") +
|
||||
|
||||
|
@ -161,9 +161,9 @@ class AudacityApp:public wxApp {
|
||||
void OnMacOpenFile(wxCommandEvent & event);
|
||||
#endif
|
||||
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__)
|
||||
void AssociateFileTypes();
|
||||
#endif
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__)
|
||||
void AssociateFileTypes();
|
||||
#endif
|
||||
|
||||
/** \brief A list of directories that should be searched for Audacity files
|
||||
* (plug-ins, help files, etc.).
|
||||
|
@ -583,7 +583,7 @@ AudioIO::AudioIO()
|
||||
errStr += _("Error: ") + pmErrStr;
|
||||
// XXX: we are in libaudacity, popping up dialogs not allowed! A
|
||||
// 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
|
||||
}
|
||||
|
@ -40,14 +40,14 @@ class BatchCommandDialog:public wxDialog {
|
||||
public:
|
||||
// constructors and destructors
|
||||
BatchCommandDialog(wxWindow *parent, wxWindowID id);
|
||||
void SetCommandAndParams(const wxString &Command, const wxString &Params);
|
||||
void SetCommandAndParams(const wxString &Command, const wxString &Params);
|
||||
public:
|
||||
wxString mSelectedCommand;
|
||||
wxString mSelectedParameters;
|
||||
private:
|
||||
void Populate();
|
||||
void PopulateOrExchange(ShuttleGui &S);
|
||||
void OnEditParams(wxCommandEvent &event);
|
||||
void OnEditParams(wxCommandEvent &event);
|
||||
void OnChoice(wxCommandEvent &event);
|
||||
void OnOk(wxCommandEvent &event);
|
||||
void OnCancel(wxCommandEvent &event);
|
||||
|
@ -266,11 +266,11 @@ void BatchProcessDialog::OnApplyToFiles(wxCommandEvent &event)
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog dlog(this,
|
||||
prompt,
|
||||
path,
|
||||
wxT(""),
|
||||
mask,
|
||||
FileDialog dlog(this,
|
||||
prompt,
|
||||
path,
|
||||
wxT(""),
|
||||
mask,
|
||||
wxFD_OPEN | wxFD_MULTIPLE | wxRESIZE_BORDER);
|
||||
|
||||
dlog.SetFilterIndex(index);
|
||||
|
@ -72,7 +72,7 @@ private:
|
||||
void Populate();
|
||||
void PopulateOrExchange(ShuttleGui &S);
|
||||
void PopulateChains();
|
||||
void PopulateList();
|
||||
void PopulateList();
|
||||
void AddItem(const wxString &command, wxString const ¶ms);
|
||||
bool ChangeOK();
|
||||
|
||||
|
@ -39,23 +39,23 @@ CrossFader::~CrossFader()
|
||||
|
||||
|
||||
bool CrossFader::GetSamples(samplePtr buffer, sampleFormat format,
|
||||
sampleCount start, sampleCount len)
|
||||
sampleCount start, sampleCount len)
|
||||
{
|
||||
switch (mType)
|
||||
{
|
||||
case FT_MIX:
|
||||
return CrossFadeMix(buffer,format, start,len);
|
||||
break;
|
||||
case FT_TRIANGULAR:
|
||||
return CrossFadeMix(buffer,format, start,len);
|
||||
break;
|
||||
case FT_EXPONENTIAL:
|
||||
default:
|
||||
return CrossFadeMix(buffer,format, start,len);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
switch (mType)
|
||||
{
|
||||
case FT_MIX:
|
||||
return CrossFadeMix(buffer,format, start,len);
|
||||
break;
|
||||
case FT_TRIANGULAR:
|
||||
return CrossFadeMix(buffer,format, start,len);
|
||||
break;
|
||||
case FT_EXPONENTIAL:
|
||||
default:
|
||||
return CrossFadeMix(buffer,format, start,len);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool CrossFader::CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len)
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
|
||||
enum FadeType
|
||||
{
|
||||
FT_MIX,
|
||||
FT_TRIANGULAR,
|
||||
FT_EXPONENTIAL
|
||||
};
|
||||
{
|
||||
FT_MIX,
|
||||
FT_TRIANGULAR,
|
||||
FT_EXPONENTIAL
|
||||
};
|
||||
|
||||
class CrossFader
|
||||
{
|
||||
@ -44,7 +44,7 @@ class CrossFader
|
||||
void ClearClips();
|
||||
//Produces samples according to crossfading rules.
|
||||
bool GetSamples(samplePtr buffer, sampleFormat format,
|
||||
sampleCount start, sampleCount len);
|
||||
sampleCount start, sampleCount len);
|
||||
|
||||
protected:
|
||||
WaveClipList mClips;
|
||||
|
@ -45,13 +45,13 @@
|
||||
WX_DEFINE_OBJARRAY( AliasedFileArray );
|
||||
|
||||
WX_DECLARE_HASH_MAP(wxString, AliasedFile *,
|
||||
wxStringHash, wxStringEqual, AliasedFileHash);
|
||||
wxStringHash, wxStringEqual, AliasedFileHash);
|
||||
|
||||
WX_DECLARE_HASH_MAP(BlockFile *, BlockFile *,
|
||||
wxPointerHash, wxPointerEqual, ReplacedBlockFileHash);
|
||||
wxPointerHash, wxPointerEqual, ReplacedBlockFileHash);
|
||||
|
||||
WX_DECLARE_HASH_MAP(BlockFile *, bool,
|
||||
wxPointerHash, wxPointerEqual, BoolBlockFileHash);
|
||||
wxPointerHash, wxPointerEqual, BoolBlockFileHash);
|
||||
|
||||
// Given a project, returns a single array of all SeqBlocks
|
||||
// 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
|
||||
// process of making a project self-contained is actually undoable.
|
||||
void ReplaceBlockFiles(AudacityProject *project,
|
||||
ReplacedBlockFileHash &hash)
|
||||
ReplacedBlockFileHash &hash)
|
||||
{
|
||||
DirManager *dirManager = project->GetDirManager();
|
||||
BlockArray blocks;
|
||||
@ -158,7 +158,7 @@ void FindDependencies(AudacityProject *project,
|
||||
// longer be external dependencies (selected by the user), replace
|
||||
// all of those alias block files with disk block files.
|
||||
void RemoveDependencies(AudacityProject *project,
|
||||
AliasedFileArray *aliasedFiles)
|
||||
AliasedFileArray *aliasedFiles)
|
||||
{
|
||||
DirManager *dirManager = project->GetDirManager();
|
||||
|
||||
|
@ -37,7 +37,7 @@ DeviceManager DeviceManager::dm;
|
||||
/// Gets the singleton instance
|
||||
DeviceManager* DeviceManager::Instance()
|
||||
{
|
||||
return &dm;
|
||||
return &dm;
|
||||
}
|
||||
|
||||
/// Releases memory assosiated with the singleton
|
||||
@ -294,13 +294,13 @@ void DeviceManager::Rescan()
|
||||
dt->RefillCombos();
|
||||
}
|
||||
}
|
||||
m_inited = true;
|
||||
m_inited = true;
|
||||
}
|
||||
|
||||
//private constructor - Singleton.
|
||||
DeviceManager::DeviceManager()
|
||||
{
|
||||
m_inited = false;
|
||||
m_inited = false;
|
||||
}
|
||||
|
||||
DeviceManager::~DeviceManager()
|
||||
|
@ -944,12 +944,12 @@ BlockFile *DirManager::CopyBlockFile(BlockFile *b)
|
||||
{
|
||||
if (!b->IsLocked()) {
|
||||
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.
|
||||
//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.
|
||||
//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.
|
||||
//but it's something to watch out for.
|
||||
//
|
||||
// LLL: Except for silent block files which have uninitialized filename.
|
||||
if (b->GetFileName().IsOk())
|
||||
if (b->GetFileName().IsOk())
|
||||
mBlockFileHash[b->GetFileName().GetName()]=b;
|
||||
return b;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public:
|
||||
}
|
||||
#else
|
||||
/* Library names and file filters for other platforms, basically Linux and
|
||||
* other *nix platforms */
|
||||
* other *nix platforms */
|
||||
wxString GetLibraryTypeString()
|
||||
{
|
||||
return _("Only libavformat.so|libavformat.so*|Dynamically Linked Libraries (*.so*)|*.so*|All Files (*)|*");
|
||||
|
@ -27,11 +27,11 @@ public:
|
||||
// originally an ExportMultiple method. Append suffix if newName appears in otherNames.
|
||||
static void MakeNameUnique(wxArrayString &otherNames, wxFileName &newName);
|
||||
|
||||
/** \brief Audacity user data directory
|
||||
*
|
||||
* Where audacity keeps it's settings and other user data squirreled away,
|
||||
* by default ~/.audacity-data/ on Unix, Application Data/Audacity on
|
||||
* windows system */
|
||||
/** \brief Audacity user data directory
|
||||
*
|
||||
* Where audacity keeps it's settings and other user data squirreled away,
|
||||
* by default ~/.audacity-data/ on Unix, Application Data/Audacity on
|
||||
* windows system */
|
||||
static wxString DataDir();
|
||||
static wxString AutoSaveDir();
|
||||
static wxString HtmlHelpDir();
|
||||
@ -42,10 +42,10 @@ public:
|
||||
static wxString PluginsCache();
|
||||
|
||||
/** \brief The user plug-in directory (not a system one)
|
||||
*
|
||||
* 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
|
||||
* <DataDir>/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
|
||||
* <DataDir>/Plug-Ins/ */
|
||||
static wxString PlugInDir();
|
||||
static wxString ThemeDir();
|
||||
static wxString ThemeComponentsDir();
|
||||
|
@ -74,7 +74,7 @@ BEGIN_EVENT_TABLE(Lyrics, wxPanel)
|
||||
EVT_SIZE(Lyrics::OnSize)
|
||||
|
||||
//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()
|
||||
|
||||
IMPLEMENT_CLASS(Lyrics, wxPanel)
|
||||
|
@ -299,7 +299,7 @@ Matrix MatrixMultiply(const Matrix &left, const Matrix &right)
|
||||
}
|
||||
|
||||
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);
|
||||
int i, j;
|
||||
|
@ -103,7 +103,7 @@ Matrix ScalarMultiply(const Matrix &left, const Matrix &right);
|
||||
Matrix MatrixMultiply(const Matrix &left, const Matrix &right);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -317,13 +317,13 @@ Mixer::~Mixer()
|
||||
delete[] mEnvValues;
|
||||
delete[] mFloatBuffer;
|
||||
delete[] mGains;
|
||||
delete[] mSamplePos;
|
||||
delete[] mSamplePos;
|
||||
|
||||
for(i=0; i<mNumInputTracks; i++) {
|
||||
delete mResample[i];
|
||||
delete[] mSampleQueue[i];
|
||||
}
|
||||
delete[] mResample;
|
||||
delete[] mResample;
|
||||
delete[] mSampleQueue;
|
||||
delete[] mQueueStart;
|
||||
delete[] mQueueLen;
|
||||
|
@ -39,7 +39,7 @@ double FreqToMIDInoteNumber(double freq)
|
||||
// of the integer part of (pitchNum + 0.5), so 0=C, 1=C#, etc.
|
||||
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;
|
||||
}
|
||||
|
||||
*pPitchName = wxT('\0');
|
||||
*pPitchName = wxT('\0');
|
||||
|
||||
return gPitchName;
|
||||
}
|
||||
@ -134,10 +134,10 @@ wxChar * PitchName(double pitchNum, bool bWantFlats /* = false */)
|
||||
// Sharps are the default, unless, bWantFlats is true.
|
||||
wxChar * PitchName_Absolute(double pitchNum, bool bWantFlats /* = false */)
|
||||
{
|
||||
PitchName(pitchNum, bWantFlats);
|
||||
PitchName(pitchNum, bWantFlats);
|
||||
|
||||
// PitchName sets pPitchName to the next available char in gPitchName,
|
||||
// so it's ready to append the register number.
|
||||
// PitchName sets pPitchName to the next available char in gPitchName,
|
||||
// so it's ready to append the register number.
|
||||
int octaveNum = ((int)((pitchNum + 0.5) / 12) - 1);
|
||||
wxSnprintf(pPitchName, 8, wxT("%d"), octaveNum);
|
||||
|
||||
|
@ -78,7 +78,7 @@ bool AudacityPrintout::OnPrintPage(int page)
|
||||
|
||||
TrackArtist artist;
|
||||
artist.SetBackgroundBrushes(*wxWHITE_BRUSH, *wxWHITE_BRUSH,
|
||||
*wxWHITE_PEN, *wxWHITE_PEN);
|
||||
*wxWHITE_PEN, *wxWHITE_PEN);
|
||||
ViewInfo viewInfo;
|
||||
viewInfo.sel0 = viewInfo.sel1 = 0;
|
||||
viewInfo.vpos = 0;
|
||||
|
@ -2702,8 +2702,8 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
if (!value || !XMLValueChecker::IsGoodString(value))
|
||||
break;
|
||||
|
||||
if (!wxStrcmp(attr, wxT("datadir")))
|
||||
{
|
||||
if (!wxStrcmp(attr, wxT("datadir")))
|
||||
{
|
||||
//
|
||||
// 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;
|
||||
bFileVersionFound = true;
|
||||
requiredTags++;
|
||||
|
@ -58,8 +58,8 @@ HFFT InitializeFFT(int fftlen)
|
||||
|
||||
if((h=(HFFT)malloc(sizeof(FFTParam)))==NULL)
|
||||
{
|
||||
fprintf(stderr,"Error allocating memory for FFT\n");
|
||||
exit(8);
|
||||
fprintf(stderr,"Error allocating memory for FFT\n");
|
||||
exit(8);
|
||||
}
|
||||
/*
|
||||
* FFT size is only half the number of data points
|
||||
@ -101,12 +101,12 @@ HFFT InitializeFFT(int fftlen)
|
||||
*/
|
||||
void EndFFT(HFFT h)
|
||||
{
|
||||
if(h->Points>0) {
|
||||
free(h->BitReversed);
|
||||
free(h->SinTable);
|
||||
}
|
||||
h->Points=0;
|
||||
free(h);
|
||||
if(h->Points>0) {
|
||||
free(h->BitReversed);
|
||||
free(h->SinTable);
|
||||
}
|
||||
h->Points=0;
|
||||
free(h);
|
||||
}
|
||||
|
||||
#define MAX_HFFT 10
|
||||
@ -210,13 +210,13 @@ void RealFFTf(fft_type *buffer,HFFT h)
|
||||
{
|
||||
v1=*B*cos + *(B+1)*sin;
|
||||
v2=*B*sin - *(B+1)*cos;
|
||||
*B=(*A+v1);
|
||||
*(A++)=*(B++)-2*v1;
|
||||
*B=(*A-v2);
|
||||
*(A++)=*(B++)+2*v2;
|
||||
}
|
||||
A=B;
|
||||
B+=ButterfliesPerGroup*2;
|
||||
*B=(*A+v1);
|
||||
*(A++)=*(B++)-2*v1;
|
||||
*B=(*A-v2);
|
||||
*(A++)=*(B++)+2*v2;
|
||||
}
|
||||
A=B;
|
||||
B+=ButterfliesPerGroup*2;
|
||||
sptr+=2;
|
||||
}
|
||||
ButterfliesPerGroup >>= 1;
|
||||
@ -228,7 +228,7 @@ void RealFFTf(fft_type *buffer,HFFT h)
|
||||
while(br1<br2)
|
||||
{
|
||||
sin=h->SinTable[*br1];
|
||||
cos=h->SinTable[*br1+1];
|
||||
cos=h->SinTable[*br1+1];
|
||||
A=buffer+*br1;
|
||||
B=buffer+*br2;
|
||||
HRplus = (HRminus = *A - *B ) + (*B * 2);
|
||||
@ -346,13 +346,13 @@ void InverseRealFFTf(fft_type *buffer,HFFT h)
|
||||
while(A<endptr2)
|
||||
{
|
||||
v1=*B*cos - *(B+1)*sin;
|
||||
v2=*B*sin + *(B+1)*cos;
|
||||
*B=(*A+v1)*(fft_type)0.5;
|
||||
*(A++)=*(B++)-v1;
|
||||
*B=(*A+v2)*(fft_type)0.5;
|
||||
*(A++)=*(B++)-v2;
|
||||
v2=*B*sin + *(B+1)*cos;
|
||||
*B=(*A+v1)*(fft_type)0.5;
|
||||
*(A++)=*(B++)-v1;
|
||||
*B=(*A+v2)*(fft_type)0.5;
|
||||
*(A++)=*(B++)-v2;
|
||||
}
|
||||
A=B;
|
||||
A=B;
|
||||
B+=ButterfliesPerGroup*2;
|
||||
}
|
||||
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)
|
||||
{
|
||||
// Copy the data into the real and imaginary outputs
|
||||
for(int i=1;i<hFFT->Points;i++) {
|
||||
RealOut[i]=buffer[hFFT->BitReversed[i] ];
|
||||
ImagOut[i]=buffer[hFFT->BitReversed[i]+1];
|
||||
for(int i=1;i<hFFT->Points;i++) {
|
||||
RealOut[i]=buffer[hFFT->BitReversed[i] ];
|
||||
ImagOut[i]=buffer[hFFT->BitReversed[i]+1];
|
||||
}
|
||||
RealOut[0] = buffer[0]; // DC component
|
||||
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)
|
||||
{
|
||||
// Copy the data into the real outputs
|
||||
for(int i=0;i<hFFT->Points;i++) {
|
||||
TimeOut[i*2 ]=buffer[hFFT->BitReversed[i] ];
|
||||
TimeOut[i*2+1]=buffer[hFFT->BitReversed[i]+1];
|
||||
for(int i=0;i<hFFT->Points;i++) {
|
||||
TimeOut[i*2 ]=buffer[hFFT->BitReversed[i] ];
|
||||
TimeOut[i*2+1]=buffer[hFFT->BitReversed[i]+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
#define fft_type float
|
||||
typedef struct FFTParamType {
|
||||
int *BitReversed;
|
||||
fft_type *SinTable;
|
||||
int Points;
|
||||
int *BitReversed;
|
||||
fft_type *SinTable;
|
||||
int Points;
|
||||
} FFTParam;
|
||||
#define HFFT FFTParam *
|
||||
|
||||
|
@ -895,8 +895,8 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
if (!wxStrcmp(attr, wxT("maxsamples")))
|
||||
{
|
||||
// Dominic, 12/10/2006:
|
||||
// Let's check that maxsamples is >= 1024 and <= 64 * 1024 * 1024
|
||||
// - that's a pretty wide range of reasonable values.
|
||||
// Let's check that maxsamples is >= 1024 and <= 64 * 1024 * 1024
|
||||
// - that's a pretty wide range of reasonable values.
|
||||
if ((nValue < 1024) || (nValue > 64 * 1024 * 1024))
|
||||
{
|
||||
mErrorOpening = true;
|
||||
|
@ -2117,11 +2117,11 @@ AttachableScrollBar * ShuttleGui::AddAttachableScrollBar( long style )
|
||||
AttachableScrollBar * pAttachableScrollBar;
|
||||
miProp=0;
|
||||
mpWind = pAttachableScrollBar = new AttachableScrollBar(
|
||||
mpParent,
|
||||
mpParent,
|
||||
miId,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
style
|
||||
style
|
||||
);
|
||||
mpWind->SetMinSize(wxSize(10,20));
|
||||
UpdateSizers();
|
||||
|
@ -25,7 +25,7 @@ const int nMaxNestedSizers = 20;
|
||||
|
||||
enum teShuttleMode
|
||||
{
|
||||
eIsCreating,
|
||||
eIsCreating,
|
||||
eIsGettingFromDialog,
|
||||
eIsSettingToDialog,
|
||||
eIsSavingViaShuttle,
|
||||
@ -84,10 +84,10 @@ public:
|
||||
wxSlider * AddSlider(const wxString &Prompt, int pos, int Max, int Min = 0);
|
||||
wxSlider * AddVSlider(const wxString &Prompt, int pos, int Max);
|
||||
wxSpinCtrl * AddSpinCtrl(const wxString &Prompt, int Value, int Max, int Min);
|
||||
wxTreeCtrl * AddTree();
|
||||
wxRadioButton * AddRadioButton( const wxString & Prompt );
|
||||
wxRadioButton * AddRadioButtonToGroup( const wxString & Prompt);
|
||||
wxButton * AddButton( const wxString & Text, int PositionFlags = wxALIGN_CENTRE );
|
||||
wxTreeCtrl * AddTree();
|
||||
wxRadioButton * AddRadioButton( const wxString & Prompt );
|
||||
wxRadioButton * AddRadioButtonToGroup( const wxString & Prompt);
|
||||
wxButton * AddButton( const wxString & Text, int PositionFlags = wxALIGN_CENTRE );
|
||||
wxBitmapButton * AddBitmapButton(const wxBitmap &Bitmap, int PositionFlags = wxALIGN_CENTRE);
|
||||
wxStaticText * AddVariableText(const wxString &Str, bool bCenter = false, int PositionFlags = 0);
|
||||
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 );
|
||||
wxMenuBar * AddMenuBar( );
|
||||
wxMenu * AddMenu( const wxString & Title );
|
||||
void AddIcon( wxBitmap * pBmp);
|
||||
void AddIconButton( const wxString & Command, const wxString & Params,wxBitmap * pBmp );
|
||||
void AddFixedText( const wxString & Str, bool bCenter = false );
|
||||
void AddIcon( wxBitmap * pBmp);
|
||||
void AddIconButton( const wxString & Command, const wxString & Params,wxBitmap * pBmp );
|
||||
void AddFixedText( const wxString & Str, bool bCenter = false );
|
||||
void AddConstTextBox( const wxString &Caption, const wxString & Value );
|
||||
|
||||
//-- 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, const wxString &Selected );
|
||||
wxCheckBox * TieCheckBox( const wxString &Prompt, bool & Var );
|
||||
wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, WrappedType & WrappedRef );
|
||||
wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, bool & Var );
|
||||
wxCheckBox * TieCheckBox( const wxString &Prompt, bool & Var );
|
||||
wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, WrappedType & WrappedRef );
|
||||
wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, bool & Var );
|
||||
|
||||
wxChoice * TieChoice( const wxString &Prompt, WrappedType & WrappedRef, const wxArrayString * pChoices );
|
||||
wxChoice * TieChoice( const wxString &Prompt, wxString &Selected, const wxArrayString * pChoices );
|
||||
@ -262,9 +262,9 @@ public:
|
||||
protected:
|
||||
void SetProportions( int Default );
|
||||
void PushSizer();
|
||||
void PopSizer();
|
||||
void PopSizer();
|
||||
|
||||
void UpdateSizersCore( bool bPrepend, int Flags );
|
||||
void UpdateSizersCore( bool bPrepend, int Flags );
|
||||
void UpdateSizers();
|
||||
void UpdateSizersC();
|
||||
void UpdateSizersAtStart();
|
||||
@ -272,8 +272,8 @@ protected:
|
||||
long Style( long Style );
|
||||
|
||||
wxWindow * mpLastWind;
|
||||
wxWindow * mpDlg;
|
||||
wxSizer * pSizerStack[ nMaxNestedSizers ];
|
||||
wxWindow * mpDlg;
|
||||
wxSizer * pSizerStack[ nMaxNestedSizers ];
|
||||
wxString mBoxName;
|
||||
|
||||
Shuttle * mpShuttle; /*! Controls source/destination of shuttled data. You can
|
||||
|
@ -306,8 +306,8 @@ void TimeTrack::testMe()
|
||||
if( t0 > t1 )
|
||||
{
|
||||
printf( "TimeTrack: Warping reverses an interval! [%.2f,%.2f] -> [%.2f,%.2f]\n",
|
||||
reqt0, reqt1,
|
||||
t0, t1 );
|
||||
reqt0, reqt1,
|
||||
t0, t1 );
|
||||
}*/
|
||||
}
|
||||
|
||||
|
@ -326,11 +326,11 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
|
||||
S.StartVerticalLay(true);
|
||||
{
|
||||
/* 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
|
||||
* 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
|
||||
* displayed is minutes, and the 's' indicates that the third number displayed is seconds.
|
||||
*/
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
wxString strFormat = _("099 h 060 m 060 s");
|
||||
S.StartStatic(_("Start Date and Time"), true);
|
||||
{
|
||||
@ -372,14 +372,14 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
|
||||
|
||||
S.StartStatic(_("Duration"), true);
|
||||
{
|
||||
/* 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
|
||||
* 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,
|
||||
* 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
|
||||
* seconds.
|
||||
*/
|
||||
/* 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
|
||||
* 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,
|
||||
* 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
|
||||
* seconds.
|
||||
*/
|
||||
wxString strFormat1 = _("099 days 024 h 060 m 060 s");
|
||||
m_pTimeTextCtrl_Duration = new TimeTextCtrl(this, ID_TIMETEXT_DURATION, strFormat1);
|
||||
m_pTimeTextCtrl_Duration->SetName(_("Duration"));
|
||||
@ -451,7 +451,7 @@ int TimerRecordDialog::WaitForStart()
|
||||
{
|
||||
wxString strMsg;
|
||||
/* 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"),
|
||||
GetDisplayDate(m_DateTime_Start).c_str());
|
||||
wxDateTime startWait_DateTime = wxDateTime::UNow();
|
||||
|
@ -84,7 +84,7 @@ class AUDACITY_DLL_API TrackArtist {
|
||||
void SetSpectrumLogMaxFreq(int freq);
|
||||
|
||||
void SetBackgroundBrushes(wxBrush unselectedBrush, wxBrush selectedBrush,
|
||||
wxPen unselectedPen, wxPen selectedPen) {
|
||||
wxPen unselectedPen, wxPen selectedPen) {
|
||||
this->unselectedBrush = unselectedBrush;
|
||||
this->selectedBrush = selectedBrush;
|
||||
this->unselectedPen = unselectedPen;
|
||||
@ -239,8 +239,8 @@ class AUDACITY_DLL_API TrackArtist {
|
||||
};
|
||||
|
||||
extern int GetWaveYPos(float value, float min, float max,
|
||||
int height, bool dB, bool outer, float dBr,
|
||||
bool clip);
|
||||
int height, bool dB, bool outer, float dBr,
|
||||
bool clip);
|
||||
|
||||
#endif // define __AUDACITY_TRACKARTIST__
|
||||
|
||||
|
@ -978,7 +978,7 @@ void TrackPanel::OnTimer()
|
||||
MakeParentRedrawScrollbars();
|
||||
p->SetAudioIOToken(0);
|
||||
p->RedrawProject();
|
||||
//ANSWER-ME: Was DisplaySelection added to solve a repaint problem?
|
||||
//ANSWER-ME: Was DisplaySelection added to solve a repaint problem?
|
||||
DisplaySelection();
|
||||
}
|
||||
|
||||
@ -3459,7 +3459,7 @@ void TrackPanel::HandleVZoomButtonUp( wxMouseEvent & event )
|
||||
}
|
||||
else {
|
||||
if(spectrumLog)
|
||||
{
|
||||
{
|
||||
float p1;
|
||||
p1 = (mZoomStart - ypos) / (float)height;
|
||||
c = 1.0-p1;
|
||||
@ -3616,7 +3616,7 @@ void TrackPanel::HandleSampleEditingClick( wxMouseEvent & event )
|
||||
t = FindTrack(event.m_x, event.m_y, false, false, &r);
|
||||
|
||||
if (!t || (t->GetKind() != Track::Wave))
|
||||
return;
|
||||
return;
|
||||
|
||||
if( !IsSampleEditingPossible( event, t ) )
|
||||
{
|
||||
@ -7284,7 +7284,7 @@ const int nRates=12;
|
||||
/// gRates MUST CORRESPOND DIRECTLY TO THE RATES AS LISTED IN THE MENU!!
|
||||
/// IN THE SAME ORDER!!
|
||||
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
|
||||
/// submenu of the track menu, except for "Other" (/see OnRateOther).
|
||||
|
@ -317,8 +317,8 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel {
|
||||
// AS: Selection handling
|
||||
virtual void HandleSelect(wxMouseEvent & event);
|
||||
virtual void SelectionHandleDrag(wxMouseEvent &event, Track *pTrack);
|
||||
virtual void SelectionHandleClick(wxMouseEvent &event,
|
||||
Track* pTrack, wxRect r);
|
||||
virtual void SelectionHandleClick(wxMouseEvent &event,
|
||||
Track* pTrack, wxRect r);
|
||||
virtual void StartSelection (int mouseXCoordinate, int trackLeftEdge);
|
||||
virtual void ExtendSelection(int mouseXCoordinate, int trackLeftEdge,
|
||||
Track *pTrack);
|
||||
|
128
src/VoiceKey.cpp
128
src/VoiceKey.cpp
@ -45,9 +45,9 @@ VoiceKey::VoiceKey(){
|
||||
mEnergySD = .0002; // 44100 hertz
|
||||
mSignChangesMean = .08;
|
||||
mSignChangesSD= .02;
|
||||
mDirectionChangesMean = .25;
|
||||
mDirectionChangesMean = .25;
|
||||
mDirectionChangesSD = .2;
|
||||
|
||||
|
||||
AdjustThreshold(2);
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection
|
||||
lastsubthresholdsample = start; //start this off at the selection start
|
||||
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.
|
||||
|
||||
for(i = start; samplesleft >=10; i+=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){
|
||||
|
||||
|
||||
//Set blocksize so that it is the right size
|
||||
if((unsigned int)samplesleft < WindowSizeInt){
|
||||
blocksize = samplesleft;
|
||||
@ -132,17 +132,17 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
|
||||
blockruns=0; //Miss--start over
|
||||
lastsubthresholdsample = i;
|
||||
}
|
||||
|
||||
|
||||
//If the blockrun is long enough, break out of the loop early:
|
||||
if(blockruns > mSignalWindowSize/mWindowSize)
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully
|
||||
if(samplesleft > 10){
|
||||
|
||||
|
||||
|
||||
|
||||
//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.
|
||||
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.
|
||||
sampleFormat *buffer = new sampleFormat[samplesleft];
|
||||
t.Get((samplePtr)buffer, floatSample,lastsubthresholdsample,samplesleft);
|
||||
|
||||
|
||||
|
||||
|
||||
//Initialize these trend markers atrend and ztrend. They keep track of the
|
||||
//up/down trends at the start and end of the evaluation window.
|
||||
int atrend = sgn(buffer[1]-buffer[0]);
|
||||
int ztrend = sgn(buffer[WindowSizeInt+1]-buffer[WindowSizeInt]);
|
||||
|
||||
|
||||
|
||||
double erg=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.
|
||||
for(i=0; i<SignalWindowSizeInt-WindowSizeInt;i++){
|
||||
|
||||
|
||||
int tests = 0;
|
||||
int testThreshold = 0;
|
||||
//Update the test statistics
|
||||
if(mUseEnergy)
|
||||
{
|
||||
TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]);
|
||||
TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]);
|
||||
tests += (int)(erg>mThresholdEnergy);
|
||||
testThreshold++;
|
||||
}
|
||||
@ -233,7 +233,7 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Move backward from end to find an ON region.
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection
|
||||
lastsubthresholdsample = end; //start this off at the end
|
||||
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.
|
||||
//If there are fewer than 10 samples leftover, don't bother.
|
||||
for(i = end - WindowSizeInt; samplesleft >=10; i-=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){
|
||||
|
||||
|
||||
//Set blocksize so that it is the right size
|
||||
if(samplesleft < (int)WindowSizeInt){
|
||||
blocksize = samplesleft;
|
||||
@ -272,7 +272,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
|
||||
else{
|
||||
blocksize = WindowSizeInt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Test whether we are above threshold
|
||||
if(AboveThreshold(t,i,blocksize))
|
||||
@ -284,16 +284,16 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
|
||||
blockruns=0; //Miss--start over
|
||||
lastsubthresholdsample = i+WindowSizeInt;
|
||||
}
|
||||
|
||||
|
||||
//If the blockrun is long enough, break out of the loop early:
|
||||
if(blockruns > mSilentWindowSize/mWindowSize)
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully
|
||||
if(samplesleft > 10){
|
||||
|
||||
|
||||
//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.
|
||||
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.
|
||||
sampleFormat *buffer = new sampleFormat[samplesleft];
|
||||
t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample-samplesleft,samplesleft);
|
||||
|
||||
|
||||
//Initialize these trend markers atrend and ztrend. They keep track of the
|
||||
//up/down trends at the start and end of the evaluation window.
|
||||
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
|
||||
if(mUseEnergy)
|
||||
{
|
||||
TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]);
|
||||
TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]);
|
||||
tests += (int)(erg>mThresholdEnergy);
|
||||
testThreshold++;
|
||||
}
|
||||
@ -379,7 +379,7 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
|
||||
|
||||
if((mWindowSize) >= len+10){
|
||||
wxMessageBox(_("Selection is too small to use voice key."));
|
||||
|
||||
|
||||
return start;
|
||||
}
|
||||
else{
|
||||
@ -391,7 +391,7 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
|
||||
double rate = t.GetRate(); //Translates seconds to samples
|
||||
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
|
||||
|
||||
|
||||
int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection
|
||||
lastsubthresholdsample = start; //start this off at the selection start
|
||||
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.
|
||||
//If there are fewer than 10 samples leftover, don't bother.
|
||||
for(i = start; samplesleft >=10; i+=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){
|
||||
|
||||
|
||||
//Set blocksize so that it is the right size
|
||||
if(samplesleft < (int)WindowSizeInt){
|
||||
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
|
||||
if(samplesleft > 10){
|
||||
|
||||
|
||||
|
||||
|
||||
//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.
|
||||
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.
|
||||
sampleFormat *buffer = new sampleFormat[samplesleft];
|
||||
t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample,samplesleft);
|
||||
|
||||
|
||||
//Initialize these trend markers atrend and ztrend. They keep track of the
|
||||
//up/down trends at the start and end of the evaluation window.
|
||||
int atrend = sgn(buffer[1]-buffer[0]);
|
||||
int ztrend = sgn(buffer[WindowSizeInt+1]-buffer[WindowSizeInt]);
|
||||
|
||||
|
||||
|
||||
double erg=0;
|
||||
double sc=0;
|
||||
@ -466,7 +466,7 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
|
||||
//Update the test statistics
|
||||
if(mUseEnergy)
|
||||
{
|
||||
TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]);
|
||||
TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]);
|
||||
tests += (int)(erg>mThresholdEnergy);
|
||||
testThreshold++;
|
||||
}
|
||||
@ -511,14 +511,14 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Move backward from the end to find an OFF region
|
||||
sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount len) {
|
||||
|
||||
|
||||
if((mWindowSize) >= len+10){
|
||||
|
||||
|
||||
wxMessageBox(_("Selection is too small to use voice key."));
|
||||
return end;
|
||||
}
|
||||
@ -530,7 +530,7 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
|
||||
double rate = t.GetRate(); //Translates seconds to samples
|
||||
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
|
||||
|
||||
|
||||
int samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection
|
||||
lastsubthresholdsample = end; //start this off at the end
|
||||
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.
|
||||
//If there are fewer than 10 samples leftover, don't bother.
|
||||
for(i = end - WindowSizeInt; samplesleft >=10; i-=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){
|
||||
|
||||
|
||||
//Set blocksize so that it is the right size
|
||||
if(samplesleft < (int)WindowSizeInt){
|
||||
blocksize = samplesleft;
|
||||
@ -553,25 +553,25 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
|
||||
|
||||
if(!AboveThreshold(t,i,blocksize))
|
||||
{
|
||||
|
||||
|
||||
blockruns++; //Hit
|
||||
}
|
||||
else
|
||||
{
|
||||
blockruns=0; //Miss--start over
|
||||
lastsubthresholdsample = i+WindowSizeInt;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//If the blockrun is long enough, break out of the loop early:
|
||||
if(blockruns > mSilentWindowSize/mWindowSize)
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully
|
||||
if(samplesleft > 10){
|
||||
|
||||
|
||||
//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.
|
||||
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.
|
||||
sampleFormat *buffer = new sampleFormat[samplesleft];
|
||||
t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample-samplesleft,samplesleft);
|
||||
|
||||
|
||||
//Initialize these trend markers atrend and ztrend. They keep track of the
|
||||
//up/down trends at the start and end of the evaluation window.
|
||||
int atrend = sgn(buffer[samplesleft - 2]-buffer[samplesleft - 1]);
|
||||
int ztrend = sgn(buffer[samplesleft - WindowSizeInt-2]-buffer[samplesleft - WindowSizeInt-2]);
|
||||
|
||||
|
||||
double erg=0;
|
||||
double sc=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.
|
||||
for(i=samplesleft-1; i>WindowSizeInt; i--){
|
||||
|
||||
|
||||
int tests = 0;
|
||||
int testThreshold = 0;
|
||||
//Update the test statistics
|
||||
@ -633,8 +633,8 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
|
||||
tests += (int)(dc > mThresholdDirectionChangesUpper);
|
||||
testThreshold++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(tests < testThreshold)
|
||||
{ //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
|
||||
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
|
||||
|
||||
|
||||
//Now, change the millisecond-based parameters into sample-based parameters
|
||||
//(This depends on WaveTrack t)
|
||||
double rate = t.GetRate();
|
||||
unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize);
|
||||
// unsigned int SignalWindowSizeInt = (unsigned int)(rate * mSignalWindowSize);
|
||||
|
||||
|
||||
|
||||
//Get the first test statistics
|
||||
|
||||
@ -831,7 +831,7 @@ void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
mEnergyMean = sumerg / samples;
|
||||
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.
|
||||
double VoiceKey::TestEnergy (WaveTrack & t, sampleCount start, sampleCount len)
|
||||
{
|
||||
|
||||
|
||||
double sum = 1;
|
||||
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)
|
||||
@ -919,24 +919,24 @@ void VoiceKey::TestEnergyUpdate (double & prevErg, int len, const sampleFormat &
|
||||
|
||||
double VoiceKey::TestSignChanges(WaveTrack & t, sampleCount start, sampleCount len)
|
||||
{
|
||||
|
||||
|
||||
|
||||
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 blockSize = t.GetMaxBlockSize(); //Determine size of sampling buffer
|
||||
unsigned long signchanges = 1;
|
||||
int currentsign=0;
|
||||
|
||||
|
||||
|
||||
if( blockSize > len)
|
||||
blockSize = len;
|
||||
sampleFormat *buffer = new sampleFormat[blockSize]; //Get a sampling buffer
|
||||
|
||||
while(len > 0) {
|
||||
|
||||
|
||||
sampleCount block = t.GetBestBlockSize(s); //Figure out how much to grab
|
||||
if(block > len) block = len; //Don't grab too much!
|
||||
|
||||
|
||||
t.Get((samplePtr)buffer,floatSample, s,block); //grab the block;
|
||||
|
||||
if (len == originalLen)
|
||||
@ -964,10 +964,10 @@ double VoiceKey::TestSignChanges(WaveTrack & t, sampleCount start, sampleCount l
|
||||
}
|
||||
|
||||
void VoiceKey::TestSignChangesUpdate(double & currentsignchanges, int len,
|
||||
const sampleFormat & a1,
|
||||
const sampleFormat & a2,
|
||||
const sampleFormat & z1,
|
||||
const sampleFormat & z2)
|
||||
const sampleFormat & a1,
|
||||
const sampleFormat & a2,
|
||||
const sampleFormat & z1,
|
||||
const sampleFormat & z2)
|
||||
{
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
|
||||
|
||||
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)
|
||||
@ -992,10 +992,10 @@ double VoiceKey::TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCo
|
||||
sampleFormat *buffer = new sampleFormat[blockSize]; //Get a sampling buffer
|
||||
|
||||
while(len > 0) {
|
||||
|
||||
|
||||
sampleCount block = t.GetBestBlockSize(s); //Figure out how much to grab
|
||||
if(block > len) block = len; //Don't grab too much!
|
||||
|
||||
|
||||
t.Get((samplePtr)buffer,floatSample, s,block); //grab the block;
|
||||
|
||||
if (len == originalLen) {
|
||||
@ -1013,7 +1013,7 @@ double VoiceKey::TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCo
|
||||
lastdirection = sgn(buffer[i] - lastval);
|
||||
}
|
||||
lastval = buffer[i];
|
||||
|
||||
|
||||
}
|
||||
len -= 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 will change currentdirections and atrend/trend, so be warned.
|
||||
void VoiceKey::TestDirectionChangesUpdate(double & currentdirectionchanges, int len,
|
||||
int & atrend, const sampleFormat & a1, const sampleFormat & a2,
|
||||
int & ztrend, const sampleFormat & z1, const sampleFormat & z2)
|
||||
int & atrend, const sampleFormat & a1, const sampleFormat & a2,
|
||||
int & ztrend, const sampleFormat & z1, const sampleFormat & z2)
|
||||
{
|
||||
|
||||
if(sgn(a2 - a1)!= atrend ) {
|
||||
|
@ -31,63 +31,63 @@ enum VoiceKeyTypes
|
||||
class VoiceKey {
|
||||
|
||||
public:
|
||||
VoiceKey();
|
||||
~VoiceKey();
|
||||
sampleCount OnForward (WaveTrack & t, sampleCount start, sampleCount len);
|
||||
sampleCount OnBackward (WaveTrack & t, sampleCount start, sampleCount len);
|
||||
sampleCount OffForward (WaveTrack & t, sampleCount start, sampleCount len);
|
||||
sampleCount OffBackward (WaveTrack & t, sampleCount start, sampleCount len);
|
||||
VoiceKey();
|
||||
~VoiceKey();
|
||||
sampleCount OnForward (WaveTrack & t, sampleCount start, sampleCount len);
|
||||
sampleCount OnBackward (WaveTrack & t, sampleCount start, sampleCount len);
|
||||
sampleCount OffForward (WaveTrack & t, sampleCount start, sampleCount len);
|
||||
sampleCount OffBackward (WaveTrack & t, sampleCount start, sampleCount len);
|
||||
|
||||
void CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len);
|
||||
void AdjustThreshold(double t);
|
||||
void CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len);
|
||||
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,
|
||||
bool dcLow, bool dcHigh);
|
||||
void SetKeyType(bool erg, bool scLow, bool scHigh,
|
||||
bool dcLow, bool dcHigh);
|
||||
|
||||
private:
|
||||
|
||||
double mWindowSize; //Size of analysis window, in milliseconds
|
||||
|
||||
double mThresholdAdjustment; //User-accessible sensitivity calibration variable
|
||||
|
||||
double mEnergyMean;
|
||||
double mEnergySD;
|
||||
double mSignChangesMean;
|
||||
double mSignChangesSD;
|
||||
double mDirectionChangesMean;
|
||||
double mDirectionChangesSD;
|
||||
double mWindowSize; //Size of analysis window, in milliseconds
|
||||
|
||||
double mThresholdEnergy; // Threshold[*] is equal to [*]Mean + [*]SD * ThresholdAdjustment
|
||||
double mThresholdSignChangesLower;
|
||||
double mThresholdSignChangesUpper;
|
||||
double mThresholdDirectionChangesLower;
|
||||
double mThresholdDirectionChangesUpper;
|
||||
double mThresholdAdjustment; //User-accessible sensitivity calibration variable
|
||||
|
||||
//These determine which statistics should be used.
|
||||
bool mUseEnergy;
|
||||
bool mUseSignChangesLow;
|
||||
bool mUseSignChangesHigh;
|
||||
bool mUseDirectionChangesLow;
|
||||
bool mUseDirectionChangesHigh;
|
||||
double mEnergyMean;
|
||||
double mEnergySD;
|
||||
double mSignChangesMean;
|
||||
double mSignChangesSD;
|
||||
double mDirectionChangesMean;
|
||||
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 mSignalWindowSize; //Time in milliseconds of above-threshold windows required for speech
|
||||
|
||||
double TestEnergy (WaveTrack & t, sampleCount start,sampleCount len);
|
||||
double TestSignChanges (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 TestSignChangesUpdate(double & currentsignchanges,int length, const sampleFormat & a1,
|
||||
const sampleFormat & a2, const sampleFormat & z1, const sampleFormat & z2);
|
||||
void TestDirectionChangesUpdate(double & currentdirectionchanges,int length,
|
||||
int & atrend, const sampleFormat & a1, const sampleFormat & a2,
|
||||
int & ztrend, const sampleFormat & z1, const sampleFormat & z2);
|
||||
|
||||
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 TestEnergy (WaveTrack & t, sampleCount start,sampleCount len);
|
||||
double TestSignChanges (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 TestSignChangesUpdate(double & currentsignchanges,int length, const sampleFormat & a1,
|
||||
const sampleFormat & a2, const sampleFormat & z1, const sampleFormat & z2);
|
||||
void TestDirectionChangesUpdate(double & currentdirectionchanges,int length,
|
||||
int & atrend, const sampleFormat & a1, const sampleFormat & a2,
|
||||
int & ztrend, const sampleFormat & z1, const sampleFormat & z2);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -625,12 +625,12 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
|
||||
int i;
|
||||
|
||||
sampleFormat seqFormat = mSequence->GetSampleFormat();
|
||||
bool didUpdate = false;
|
||||
bool didUpdate = false;
|
||||
for(i=a; i<p1; i++) {
|
||||
sampleCount left;
|
||||
left = mWaveCache->where[i] - numSamples;
|
||||
left = mWaveCache->where[i] - numSamples;
|
||||
sampleCount right;
|
||||
right = mWaveCache->where[i+1] - numSamples;
|
||||
right = mWaveCache->where[i+1] - numSamples;
|
||||
|
||||
//wxCriticalSectionLocker locker(mAppendCriticalSection);
|
||||
|
||||
@ -672,16 +672,16 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
|
||||
|
||||
if (seqFormat != floatSample)
|
||||
delete[] b;
|
||||
|
||||
didUpdate=true;
|
||||
|
||||
didUpdate=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// So that the sequence doesn't try to write any
|
||||
// of these values
|
||||
//mchinen: but only do this if we've updated pixels in the cache.
|
||||
if(didUpdate)
|
||||
p1 = a;
|
||||
p1 = a;
|
||||
}
|
||||
|
||||
if (p1 > p0) {
|
||||
|
@ -129,15 +129,15 @@ public:
|
||||
Sequence* GetSequence() { return mSequence; }
|
||||
|
||||
/** WaveTrack calls this whenever data in the wave clip changes. It is
|
||||
* called automatically when WaveClip has a chance to know that something
|
||||
* has changed, like when member functions SetSamples() etc. are called. */
|
||||
* called automatically when WaveClip has a chance to know that something
|
||||
* has changed, like when member functions SetSamples() etc. are called. */
|
||||
void MarkChanged() { mDirty++; }
|
||||
|
||||
/// Create clip from copy, discarding previous information in the clip
|
||||
bool CreateFromCopy(double t0, double t1, WaveClip* other);
|
||||
|
||||
/** 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,
|
||||
int numPixels, double t0, double pixelsPerSecond, bool &isLoadingOD);
|
||||
bool GetSpectrogram(float *buffer, sampleCount *where,
|
||||
@ -154,8 +154,8 @@ public:
|
||||
void GetDisplayRect(wxRect* r);
|
||||
|
||||
/** 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
|
||||
* function to tell the envelope about it. */
|
||||
* of samples (that is, the length of the clip), you will want to call this
|
||||
* function to tell the envelope about it. */
|
||||
void UpdateEnvelopeTrackLen();
|
||||
|
||||
/// You must call Flush after the last Append
|
||||
@ -182,22 +182,22 @@ public:
|
||||
bool Paste(double t0, WaveClip* other);
|
||||
|
||||
/** Insert silence - note that this is an efficient operation for large
|
||||
* amounts of silence */
|
||||
* amounts of silence */
|
||||
bool InsertSilence(double t, double len);
|
||||
|
||||
/// Get access to cut lines list
|
||||
WaveClipList* GetCutLines() { return &mCutLines; }
|
||||
|
||||
/** Find cut line at (approximately) this position. Returns true and fills
|
||||
* in cutLineStart and cutLineEnd (if specified) if a cut line at this
|
||||
* position could be found. Return false otherwise. */
|
||||
* in cutLineStart and cutLineEnd (if specified) if a cut line at this
|
||||
* position could be found. Return false otherwise. */
|
||||
bool FindCutLine(double cutLinePosition,
|
||||
double* cutLineStart = NULL,
|
||||
double *cutLineEnd = NULL);
|
||||
|
||||
/** 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
|
||||
* expanded, false otherwise */
|
||||
* cut line). Returns true if a cut line could be found and sucessfully
|
||||
* expanded, false otherwise */
|
||||
bool ExpandCutLine(double cutLinePosition);
|
||||
|
||||
/// Remove cut line, without expanding the audio in it
|
||||
|
@ -89,15 +89,15 @@ class AUDACITY_DLL_API WaveTrack: public Track {
|
||||
virtual void SetOffset (double o);
|
||||
|
||||
/** @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();
|
||||
|
||||
/** @brief Get the time at which the last clip in the track ends, plus
|
||||
* 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();
|
||||
|
||||
@ -375,7 +375,7 @@ class AUDACITY_DLL_API WaveTrack: public Track {
|
||||
WaveformDisplay,
|
||||
WaveformDBDisplay,
|
||||
SpectrumDisplay,
|
||||
SpectrumLogDisplay,
|
||||
SpectrumLogDisplay,
|
||||
PitchDisplay
|
||||
} WaveTrackDisplay;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user