Remove trailing spaces.
This commit is contained in:
parent
d921c4969b
commit
277932dccb
|
@ -91,12 +91,12 @@ void AColor::Arrow(wxDC & dc, wxCoord x, wxCoord y, int width, bool down)
|
|||
pt[1].x = half; pt[1].y = 0;
|
||||
pt[2].x = width; pt[2].y = half;
|
||||
}
|
||||
|
||||
|
||||
dc.DrawPolygon(3, pt, x, y);
|
||||
}
|
||||
|
||||
//
|
||||
// Draw a line while accounting for differences in wxWidgets versions
|
||||
// Draw a line while accounting for differences in wxWidgets versions
|
||||
//
|
||||
void AColor::Line(wxDC & dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
|
||||
{
|
||||
|
@ -407,20 +407,20 @@ void AColor::Init()
|
|||
|
||||
// These colors were modified to avoid using reserved colors red and green
|
||||
// for the buttons.
|
||||
theTheme.SetBrushColour( muteBrush[0], clrMuteButtonActive);
|
||||
theTheme.SetBrushColour( muteBrush[1], clrMuteButtonVetoed);
|
||||
theTheme.SetBrushColour( soloBrush, clrMuteButtonActive);
|
||||
|
||||
theTheme.SetBrushColour( muteBrush[0], clrMuteButtonActive);
|
||||
theTheme.SetBrushColour( muteBrush[1], clrMuteButtonVetoed);
|
||||
theTheme.SetBrushColour( soloBrush, clrMuteButtonActive);
|
||||
|
||||
theTheme.SetPenColour( cursorPen, clrCursorPen);
|
||||
theTheme.SetPenColour( indicatorPen[0], clrRecordingPen);
|
||||
theTheme.SetPenColour( indicatorPen[1], clrPlaybackPen);
|
||||
theTheme.SetBrushColour( indicatorBrush[0], clrRecordingBrush);
|
||||
theTheme.SetBrushColour( indicatorBrush[1], clrPlaybackBrush);
|
||||
|
||||
theTheme.SetBrushColour( playRegionBrush[0],clrRulerRecordingBrush);
|
||||
theTheme.SetPenColour( playRegionPen[0], clrRulerRecordingPen);
|
||||
theTheme.SetBrushColour( playRegionBrush[1],clrRulerPlaybackBrush);
|
||||
theTheme.SetPenColour( playRegionPen[1], clrRulerPlaybackPen);
|
||||
theTheme.SetBrushColour( indicatorBrush[0], clrRecordingBrush);
|
||||
theTheme.SetBrushColour( indicatorBrush[1], clrPlaybackBrush);
|
||||
|
||||
theTheme.SetBrushColour( playRegionBrush[0],clrRulerRecordingBrush);
|
||||
theTheme.SetPenColour( playRegionPen[0], clrRulerRecordingPen);
|
||||
theTheme.SetBrushColour( playRegionBrush[1],clrRulerPlaybackBrush);
|
||||
theTheme.SetPenColour( playRegionPen[1], clrRulerPlaybackPen);
|
||||
|
||||
//Determine tooltip color
|
||||
tooltipBrush.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOBK) );
|
||||
|
@ -500,7 +500,7 @@ const int AColor_midicolors[16][3] = {
|
|||
{255, 102, 102}, // 1=salmon
|
||||
{204, 0, 0}, // 2=red
|
||||
{255, 117, 23}, // 3=orange
|
||||
{255, 255, 0}, // 4=yellow
|
||||
{255, 255, 0}, // 4=yellow
|
||||
{0, 204, 0}, // 5=green
|
||||
{0, 204, 204}, // 6=turquoise
|
||||
{0, 0, 204}, // 7=blue
|
||||
|
@ -595,11 +595,11 @@ void AColor::PreComputeGradient() {
|
|||
{float(0.90), float(0.10), float(0.90)}, // violet
|
||||
{float(1.00), float(0.00), float(0.00)}, // red
|
||||
{float(1.00), float(1.00), float(1.00)} // white
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
int left = int (value * gsteps);
|
||||
int right = (left == gsteps ? gsteps : left + 1);
|
||||
|
||||
|
||||
float rweight = (value * gsteps) - left;
|
||||
float lweight = 1.0 - rweight;
|
||||
|
||||
|
@ -607,7 +607,7 @@ void AColor::PreComputeGradient() {
|
|||
g = (gradient[left][1] * lweight) + (gradient[right][1] * rweight);
|
||||
b = (gradient[left][2] * lweight) + (gradient[right][2] * rweight);
|
||||
}
|
||||
|
||||
|
||||
if (selected) {
|
||||
r *= 0.77f;
|
||||
g *= 0.77f;
|
||||
|
|
|
@ -118,7 +118,7 @@ inline void GetColorGradient(float value,
|
|||
|
||||
*red = AColor::gradient_pre[selected][grayscale][idx][0];
|
||||
*green = AColor::gradient_pre[selected][grayscale][idx][1];
|
||||
*blue = AColor::gradient_pre[selected][grayscale][idx][2];
|
||||
*blue = AColor::gradient_pre[selected][grayscale][idx][2];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,7 @@ close it.
|
|||
*//*****************************************************************//**
|
||||
|
||||
\class AboutDialogCreditItem
|
||||
\brief AboutDialogCreditItem is a structure used by the AboutDialog to
|
||||
\brief AboutDialogCreditItem is a structure used by the AboutDialog to
|
||||
hold information about one contributor to Audacity.
|
||||
|
||||
*//********************************************************************/
|
||||
|
@ -70,7 +70,7 @@ void AboutDialog::CreateCreditsList()
|
|||
// Emeritus: people who were "lead developers" or made an
|
||||
// otherwise distinguished contribution, but who are no
|
||||
// longer active.
|
||||
|
||||
|
||||
AddCredit(wxT("Matt Brubeck"), roleEmeritusDeveloper);
|
||||
AddCredit(wxT("Michael Chinen"), roleEmeritusDeveloper);
|
||||
AddCredit(wxT("Al Dimond"), roleEmeritusDeveloper);
|
||||
|
@ -84,7 +84,7 @@ void AboutDialog::CreateCreditsList()
|
|||
AddCredit(wxT("Alexandre Prokoudine"), roleEmeritusSupport);
|
||||
|
||||
// All other contributors
|
||||
|
||||
|
||||
AddCredit(wxT("Lynn Allan"), roleContributor);
|
||||
AddCredit(wxT("David Bailes"), roleContributor);
|
||||
AddCredit(wxT("William Bland"), roleContributor);
|
||||
|
@ -119,7 +119,7 @@ void AboutDialog::CreateCreditsList()
|
|||
AddCredit(wxT("Jun Wan"), roleContributor);
|
||||
AddCredit(wxT("Tom Woodhams"), roleContributor);
|
||||
AddCredit(wxT("Wing Yu"), roleContributor);
|
||||
|
||||
|
||||
AddCredit(wxT("expat"), roleLibrary);
|
||||
AddCredit(wxT("FLAC"), roleLibrary);
|
||||
AddCredit(wxT("LAME"), roleLibrary);
|
||||
|
@ -194,10 +194,10 @@ AboutDialog::AboutDialog(wxWindow * parent)
|
|||
PopulateLicensePage( S );
|
||||
}
|
||||
S.EndNotebook();
|
||||
/* i18n-hint: "OK... Audacious" appears on a button at the
|
||||
/* i18n-hint: "OK... Audacious" appears on a button at the
|
||||
* foot of the 'About Audacity' dialog box, after some text to read.
|
||||
* In English it is slightly humorous alternative to an 'OK' button.
|
||||
* If the humour doesn't work in your language, then just use whatever
|
||||
* In English it is slightly humorous alternative to an 'OK' button.
|
||||
* If the humour doesn't work in your language, then just use whatever
|
||||
* you would use for a translation for 'OK' on a button. */
|
||||
wxButton *ok = new wxButton(S.GetParent(), wxID_OK, _("OK... Audacious!"));
|
||||
ok->SetDefault();
|
||||
|
@ -239,23 +239,23 @@ visit our <a href=\"http://forum.audacityteam.org/\">forum</a>.");
|
|||
* your own name(s) to the credits.
|
||||
*
|
||||
* For example: "English translation by Dominic Mazzoni." */
|
||||
if (_("translator_credits") != wxString(wxT("translator_credits")))
|
||||
if (_("translator_credits") != wxString(wxT("translator_credits")))
|
||||
{
|
||||
translatorCredits = _("translator_credits");
|
||||
}
|
||||
wxString localeStr = wxLocale::GetSystemEncodingName();
|
||||
|
||||
wxString creditStr =
|
||||
wxT("<html><head><META http-equiv=\"Content-Type\" content=\"text/html; charset=") +
|
||||
localeStr +
|
||||
wxT("\"></head>") +
|
||||
wxT("<body bgcolor=\"#ffffff\"><center>") +
|
||||
wxT("<h3>Audacity ") + wxString(AUDACITY_VERSION_STRING) + wxT("</h3>")+
|
||||
_("free, open source, cross-platform software for recording and editing sounds<br>") +
|
||||
wxString creditStr =
|
||||
wxT("<html><head><META http-equiv=\"Content-Type\" content=\"text/html; charset=") +
|
||||
localeStr +
|
||||
wxT("\"></head>") +
|
||||
wxT("<body bgcolor=\"#ffffff\"><center>") +
|
||||
wxT("<h3>Audacity ") + wxString(AUDACITY_VERSION_STRING) + wxT("</h3>")+
|
||||
_("free, open source, cross-platform software for recording and editing sounds<br>") +
|
||||
wxT("<a href=\"http://audacity.sourceforge.net/\">http://audacity.sourceforge.net/</a>") +
|
||||
wxT("<p><br>") + par1Str +
|
||||
wxT("<p>") + par2Str +
|
||||
wxT("<h3>") + _("Credits") + wxT("</h3>") +
|
||||
wxT("<h3>") + _("Credits") + wxT("</h3>") +
|
||||
wxT("<p>") + translatorCredits +
|
||||
|
||||
wxT("<p><b>") + wxString::Format(_("Audacity Developers")) + wxT("</b><br>") +
|
||||
|
@ -266,7 +266,7 @@ visit our <a href=\"http://forum.audacityteam.org/\">forum</a>.");
|
|||
|
||||
wxT("<p><b>") + _("Emeritus Developers") + wxT("</b><br>") +
|
||||
GetCreditsByRole(roleEmeritusDeveloper) +
|
||||
|
||||
|
||||
wxT("<p><b>") + _(" Emeritus Team Members") + wxT("</b><br>") +
|
||||
GetCreditsByRole(roleEmeritusSupport) +
|
||||
|
||||
|
@ -275,13 +275,13 @@ visit our <a href=\"http://forum.audacityteam.org/\">forum</a>.");
|
|||
|
||||
wxT("<p><b>") + _("Audacity is based on code from the following projects:") + wxT("</b><br>") +
|
||||
GetCreditsByRole(roleLibrary) +
|
||||
|
||||
|
||||
wxT("<p><b>") + _("Special thanks:") + wxT("</b><br>") +
|
||||
GetCreditsByRole(roleThanks) +
|
||||
|
||||
|
||||
wxT("<p><br>") + _("<b>Audacity®</b> software is copyright")+
|
||||
wxT("© 1999-2014 Audacity Team.<br>") +
|
||||
_("The name <b>Audacity®</b> is a registered trademark of Dominic Mazzoni.") +
|
||||
_("The name <b>Audacity®</b> is a registered trademark of Dominic Mazzoni.") +
|
||||
wxT("</center></font></body></html>");
|
||||
|
||||
|
||||
|
@ -305,19 +305,19 @@ visit our <a href=\"http://forum.audacityteam.org/\">forum</a>.");
|
|||
wxBitmap RescaledBitmap( RescaledImage );
|
||||
|
||||
icon =
|
||||
new wxStaticBitmap(S.GetParent(), -1,
|
||||
new wxStaticBitmap(S.GetParent(), -1,
|
||||
//*logo, //v
|
||||
//v theTheme.Bitmap(bmpAudacityLogo), wxPoint(93, 10), wxSize(215, 190));
|
||||
//v theTheme.Bitmap(bmpAudacityLogoWithName),
|
||||
//v theTheme.Bitmap(bmpAudacityLogoWithName),
|
||||
RescaledBitmap,
|
||||
wxDefaultPosition,
|
||||
wxDefaultPosition,
|
||||
wxSize(int(LOGOWITHNAME_WIDTH*fScale), int(LOGOWITHNAME_HEIGHT*fScale)));
|
||||
delete logo;
|
||||
S.Prop(0).AddWindow( icon );
|
||||
|
||||
HtmlWindow *html = new LinkingHtmlWindow(S.GetParent(), -1,
|
||||
wxDefaultPosition,
|
||||
wxSize(ABOUT_DIALOG_WIDTH, 359),
|
||||
wxSize(ABOUT_DIALOG_WIDTH, 359),
|
||||
wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER);
|
||||
html->SetFocus();
|
||||
html->SetPage(creditStr);
|
||||
|
@ -329,7 +329,7 @@ visit our <a href=\"http://forum.audacityteam.org/\">forum</a>.");
|
|||
S.EndNotebookPage();
|
||||
}
|
||||
|
||||
/** \brief: Fills out the "Information" tab of the preferences dialogue
|
||||
/** \brief: Fills out the "Information" tab of the preferences dialogue
|
||||
* Provides as much information as possible about build-time options and
|
||||
* the libraries used, to try and make Linux support easier. Basically anything
|
||||
* about the build we might wish to know should be visible here */
|
||||
|
@ -339,19 +339,19 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S )
|
|||
S.StartNotebookPage( _("Build Information") ); // start the tab
|
||||
S.StartVerticalLay(2); // create the window
|
||||
HtmlWindow *html = new HtmlWindow(S.GetParent(), -1, wxDefaultPosition,
|
||||
wxSize(ABOUT_DIALOG_WIDTH, 264),
|
||||
wxSize(ABOUT_DIALOG_WIDTH, 264),
|
||||
wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER);
|
||||
// create a html pane in it to put the content in.
|
||||
wxString enabled = _("Enabled");
|
||||
wxString disabled = _("Disabled");
|
||||
wxString blank = wxT("");
|
||||
|
||||
|
||||
/* this builds up the list of information to go in the window in the string
|
||||
* informationStr */
|
||||
informationStr = wxT("<h2><center>");
|
||||
informationStr += _("Build Information");
|
||||
informationStr += wxT("</center></h2>\n");
|
||||
// top level heading
|
||||
// top level heading
|
||||
informationStr += wxT("<h3>");
|
||||
informationStr += _("File Format Support");
|
||||
informationStr += wxT("</h3>\n<p>");
|
||||
|
@ -368,7 +368,7 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S )
|
|||
AddBuildinfoRow(&informationStr, wxT("libmad"), _("MP3 Importing"), disabled);
|
||||
#endif
|
||||
|
||||
/* i18n-hint: Ogg is the container format. Vorbis is the compression codec.
|
||||
/* i18n-hint: Ogg is the container format. Vorbis is the compression codec.
|
||||
* Both are proper nouns and shouldn't be translated */
|
||||
#ifdef USE_LIBVORBIS
|
||||
AddBuildinfoRow(&informationStr, wxT("libvorbis"),
|
||||
|
@ -385,7 +385,7 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S )
|
|||
AddBuildinfoRow(&informationStr, wxT("libid3tag"), _("ID3 tag support"),
|
||||
disabled);
|
||||
#endif
|
||||
|
||||
|
||||
/* i18n-hint: FLAC stands for Free Lossless Audio Codec, but is effectively
|
||||
* a proper noun and so shouldn't be translated */
|
||||
# if USE_LIBFLAC
|
||||
|
@ -543,7 +543,7 @@ void AboutDialog::PopulateLicensePage( ShuttleGui & S )
|
|||
S.StartVerticalLay(1);
|
||||
HtmlWindow *html = new HtmlWindow(S.GetParent(), -1,
|
||||
wxDefaultPosition,
|
||||
wxSize(ABOUT_DIALOG_WIDTH, 264),
|
||||
wxSize(ABOUT_DIALOG_WIDTH, 264),
|
||||
wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER);
|
||||
|
||||
// I tried using <pre> here to get a monospaced font,
|
||||
|
@ -855,7 +855,7 @@ void AboutDialog::AddCredit(const wxString& description, Role role)
|
|||
wxString AboutDialog::GetCreditsByRole(AboutDialog::Role role)
|
||||
{
|
||||
wxString s;
|
||||
|
||||
|
||||
for (AboutDialogCreditItemsList::compatibility_iterator p=creditItems.GetFirst(); p; p = p->GetNext())
|
||||
{
|
||||
AboutDialogCreditItem* item = p->GetData();
|
||||
|
@ -865,7 +865,7 @@ wxString AboutDialog::GetCreditsByRole(AboutDialog::Role role)
|
|||
s += wxT("<br>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Strip last <br>, if any
|
||||
if (s.Right(4) == wxT("<br>"))
|
||||
s = s.Left(s.Length() - 4);
|
||||
|
|
|
@ -39,7 +39,7 @@ class AboutDialog:public wxDialog {
|
|||
wxBitmap *logo; //v
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
|
||||
private:
|
||||
enum Role {
|
||||
roleTeamDeveloper,
|
||||
|
@ -50,7 +50,7 @@ class AboutDialog:public wxDialog {
|
|||
roleLibrary,
|
||||
roleThanks
|
||||
};
|
||||
|
||||
|
||||
AboutDialogCreditItemsList creditItems;
|
||||
void PopulateAudacityPage( ShuttleGui & S );
|
||||
void PopulateLicensePage( ShuttleGui & S );
|
||||
|
|
|
@ -19,22 +19,22 @@ and grids used by Audacity.
|
|||
This will be split up into separate include files to reduce the amount
|
||||
of recompilation on a change.
|
||||
|
||||
Meantime, do NOT delete any of these declarations, even if they're
|
||||
Meantime, do NOT delete any of these declarations, even if they're
|
||||
unused, as they're all offset by prior declarations.
|
||||
|
||||
To add an image, you give its size and name like so:
|
||||
|
||||
\code
|
||||
DEFINE_IMAGE( bmpPause, wxImage( 16, 16 ), wxT("Pause"));
|
||||
\endcode
|
||||
\endcode
|
||||
|
||||
If you do this and run the program the image will be black to start
|
||||
with, but you can go into ThemePrefs and load it (load components)
|
||||
from there. Audacity will look for a file called "Pause.png".
|
||||
If you do this and run the program the image will be black to start
|
||||
with, but you can go into ThemePrefs and load it (load components)
|
||||
from there. Audacity will look for a file called "Pause.png".
|
||||
|
||||
- Now save into ImageCache.
|
||||
- From here on you can get the image by loading ImageCache.
|
||||
- To burn it into the program defaults, use the
|
||||
- To burn it into the program defaults, use the
|
||||
'Output Sourcery' button.
|
||||
|
||||
\see \ref Themability in DOxygen documentation for more details.
|
||||
|
@ -209,7 +209,7 @@ from there. Audacity will look for a file called "Pause.png".
|
|||
#define LOGOWITHNAME_WIDTH 506
|
||||
#define LOGOWITHNAME_HEIGHT 200
|
||||
|
||||
DEFINE_IMAGE( bmpAudacityLogo, wxImage( 215, 190 ), wxT("AudacityLogo"));
|
||||
DEFINE_IMAGE( bmpAudacityLogo, wxImage( 215, 190 ), wxT("AudacityLogo"));
|
||||
DEFINE_IMAGE( bmpAudacityLogo48x48, wxImage( 48, 48 ), wxT("AudacityLogo48x48"));
|
||||
|
||||
DEFINE_IMAGE( bmpSyncLockSelTile, wxImage(20, 22), wxT("SyncLockSelTile"));
|
||||
|
@ -222,7 +222,7 @@ from there. Audacity will look for a file called "Pause.png".
|
|||
DEFINE_COLOUR( clrSample, wxColour( 50, 50, 200), wxT("Sample"));
|
||||
DEFINE_COLOUR( clrSelSample, wxColour( 50, 50, 200), wxT("SelSample"));
|
||||
DEFINE_COLOUR( clrDragSample, wxColour( 0, 0, 0), wxT("DragSample"));
|
||||
|
||||
|
||||
DEFINE_COLOUR( clrMuteSample, wxColour(136, 136, 144), wxT("MuteSample"));
|
||||
DEFINE_COLOUR( clrRms, wxColour(100, 100, 220), wxT("Rms"));
|
||||
DEFINE_COLOUR( clrMuteRms, wxColour(136, 136, 144), wxT("MuteRms"));
|
||||
|
@ -234,7 +234,7 @@ from there. Audacity will look for a file called "Pause.png".
|
|||
DEFINE_COLOUR( clrSample, wxColour( 63, 77, 155), wxT("Sample"));
|
||||
DEFINE_COLOUR( clrSelSample, wxColour( 50, 50, 200), wxT("SelSample"));
|
||||
DEFINE_COLOUR( clrDragSample, wxColour( 0, 100, 0), wxT("DragSample"));
|
||||
|
||||
|
||||
DEFINE_COLOUR( clrMuteSample, wxColour(136, 136, 144), wxT("MuteSample"));
|
||||
DEFINE_COLOUR( clrRms, wxColour(107, 154, 247), wxT("Rms"));
|
||||
DEFINE_COLOUR( clrMuteRms, wxColour(136, 136, 144), wxT("MuteRms"));
|
||||
|
@ -246,21 +246,21 @@ from there. Audacity will look for a file called "Pause.png".
|
|||
DEFINE_COLOUR( clrTrackPanelText, wxColour(153, 153, 153), wxT("TrackPanelText"));
|
||||
DEFINE_COLOUR( clrLabelTrackText, wxColour( 0, 0, 0), wxT("LabelTrackText"));
|
||||
|
||||
|
||||
|
||||
DEFINE_COLOUR( clrMeterPeak, wxColour(102, 102, 255), wxT("MeterPeak"));
|
||||
DEFINE_COLOUR( clrMeterDisabledPen, wxColour(192, 192, 192), wxT("MeterDisabledPen"));
|
||||
DEFINE_COLOUR( clrMeterDisabledBrush, wxColour(160, 160, 160), wxT("MeterDisabledBrush"));
|
||||
|
||||
DEFINE_COLOUR( clrMeterInputPen, wxColour(204, 70, 70), wxT("MeterInputPen") );
|
||||
DEFINE_COLOUR( clrMeterInputBrush, wxColour(204, 70, 70), wxT("MeterInputBrush") );
|
||||
DEFINE_COLOUR( clrMeterInputRMSBrush, wxColour(255, 102, 102), wxT("MeterInputRMSBrush") );
|
||||
DEFINE_COLOUR( clrMeterInputPen, wxColour(204, 70, 70), wxT("MeterInputPen") );
|
||||
DEFINE_COLOUR( clrMeterInputBrush, wxColour(204, 70, 70), wxT("MeterInputBrush") );
|
||||
DEFINE_COLOUR( clrMeterInputRMSBrush, wxColour(255, 102, 102), wxT("MeterInputRMSBrush") );
|
||||
DEFINE_COLOUR( clrMeterInputClipBrush, wxColour(255, 53, 53), wxT("MeterInputClipBrush") );
|
||||
DEFINE_COLOUR( clrMeterInputLightPen, wxColour(255, 153, 153), wxT("MeterInputLightPen") );
|
||||
DEFINE_COLOUR( clrMeterInputDarkPen, wxColour(153, 61, 61), wxT("MeterInputDarkPen") );
|
||||
|
||||
DEFINE_COLOUR( clrMeterOutputPen, wxColour(70, 204, 70), wxT("MeterOutputPen") );
|
||||
DEFINE_COLOUR( clrMeterOutputBrush, wxColour(70, 204, 70), wxT("MeterOutputBrush") );
|
||||
DEFINE_COLOUR( clrMeterOutputRMSBrush, wxColour(102, 255, 102), wxT("MeterOutputRMSBrush") );
|
||||
DEFINE_COLOUR( clrMeterInputLightPen, wxColour(255, 153, 153), wxT("MeterInputLightPen") );
|
||||
DEFINE_COLOUR( clrMeterInputDarkPen, wxColour(153, 61, 61), wxT("MeterInputDarkPen") );
|
||||
|
||||
DEFINE_COLOUR( clrMeterOutputPen, wxColour(70, 204, 70), wxT("MeterOutputPen") );
|
||||
DEFINE_COLOUR( clrMeterOutputBrush, wxColour(70, 204, 70), wxT("MeterOutputBrush") );
|
||||
DEFINE_COLOUR( clrMeterOutputRMSBrush, wxColour(102, 255, 102), wxT("MeterOutputRMSBrush") );
|
||||
DEFINE_COLOUR( clrMeterOutputClipBrush, wxColour(255, 53, 53), wxT("MeterOutputClipBrush") );
|
||||
DEFINE_COLOUR( clrMeterOutputLightPen, wxColour(153, 255, 153), wxT("MeterOutputLightPen") );
|
||||
DEFINE_COLOUR( clrMeterOutputDarkPen, wxColour(61, 164, 61), wxT("MeterOutputDarkPen") );
|
||||
|
@ -276,20 +276,20 @@ from there. Audacity will look for a file called "Pause.png".
|
|||
|
||||
DEFINE_COLOUR( clrMuteButtonActive, wxColour( 160, 170, 210), wxT("MuteButtonActive") );
|
||||
DEFINE_COLOUR( clrMuteButtonVetoed, wxColour( 180, 180, 185), wxT("MuteButtonVetoed") );
|
||||
|
||||
|
||||
DEFINE_COLOUR( clrCursorPen, wxColour( 0, 0, 0), wxT("CursorPen") );
|
||||
DEFINE_COLOUR( clrRecordingPen, wxColour( 176, 0, 28), wxT("RecordingPen") );
|
||||
DEFINE_COLOUR( clrPlaybackPen, wxColour( 36, 96, 46), wxT("PlaybackPen") );
|
||||
DEFINE_COLOUR( clrRecordingBrush, wxColour( 190,129,129), wxT("RecordingBrush") );
|
||||
DEFINE_COLOUR( clrPlaybackBrush, wxColour( 28,171, 51), wxT("PlaybackBrush") );
|
||||
|
||||
|
||||
DEFINE_COLOUR( clrRulerRecordingBrush, wxColour( 196,196,196), wxT("RulerRecordingBrush") );
|
||||
DEFINE_COLOUR( clrRulerRecordingPen, wxColour( 128,128,128), wxT("RulerRecordingPen") );
|
||||
DEFINE_COLOUR( clrRulerPlaybackBrush, wxColour( 190,129,129), wxT("RulerPlaybackBrush") );
|
||||
DEFINE_COLOUR( clrRulerPlaybackPen, wxColour( 176, 0, 28), wxT("RulerPlaybackPen") );
|
||||
|
||||
DEFINE_COLOUR( clrTimeFont, wxColour( 0, 0,180), wxT("TimeFont") );
|
||||
DEFINE_COLOUR( clrTimeBack, wxColour( 160,160,160), wxT("TimeBack") );
|
||||
DEFINE_COLOUR( clrTimeFont, wxColour( 0, 0,180), wxT("TimeFont") );
|
||||
DEFINE_COLOUR( clrTimeBack, wxColour( 160,160,160), wxT("TimeBack") );
|
||||
DEFINE_COLOUR( clrTimeFontFocus, wxColour( 0, 0, 0), wxT("TimeFontFocus") );
|
||||
DEFINE_COLOUR( clrTimeBackFocus, wxColour( 242,242,255), wxT("TimeBackFocus") );
|
||||
|
||||
|
@ -330,10 +330,10 @@ from there. Audacity will look for a file called "Pause.png".
|
|||
DEFINE_COLOUR( clrProgressNotYet, wxColour(255, 255, 255,220), wxT("ProgressNotYet"));
|
||||
DEFINE_COLOUR( clrSyncLockSel, wxColour(192, 192, 192), wxT("SyncLockSel"));
|
||||
|
||||
// Vaughan, 2010-09-20: clrTrackInfoSyncLockSel is unused so this is cruft, but
|
||||
// Vaughan, 2010-09-20: clrTrackInfoSyncLockSel is unused so this is cruft, but
|
||||
// do NOT delete it as it's in the theme image, so offsets subsequent colors.
|
||||
DEFINE_COLOUR( clrTrackInfoSyncLockSel, wxColour( 64, 64, 64), wxT("TrackInfoSyncLockSel"));
|
||||
|
||||
|
||||
DEFINE_COLOUR( clrSelTranslucent, wxColour(104, 104, 148, 127), wxT("SelTranslucent"));
|
||||
// This is for waveform drawing, selected outside of clips
|
||||
DEFINE_COLOUR( clrBlankSelected, wxColour(170, 170, 192), wxT("BlankSelected"));
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef __AUDACITY_H__
|
||||
#define __AUDACITY_H__
|
||||
|
||||
// We only do alpha builds and release versions.
|
||||
// We only do alpha builds and release versions.
|
||||
// Most of the time we're in development, so IS_ALPHA should be defined
|
||||
// to 1.
|
||||
#define IS_ALPHA 1
|
||||
|
@ -35,7 +35,7 @@
|
|||
#define AUDACITY_MODLEVEL 0
|
||||
|
||||
#if IS_ALPHA
|
||||
#define AUDACITY_SUFFIX wxT("-alpha-") __TDATE__
|
||||
#define AUDACITY_SUFFIX wxT("-alpha-") __TDATE__
|
||||
#else
|
||||
#define AUDACITY_SUFFIX wxT("") // for a stable release
|
||||
#endif
|
||||
|
@ -70,8 +70,8 @@ void QuitAudacity(bool bForce);
|
|||
void QuitAudacity();
|
||||
|
||||
// Please try to support unlimited path length instead of using PLATFORM_MAX_PATH!
|
||||
// Define one constant for maximum path value, so we don't have to do
|
||||
// platform-specific conditionals everywhere we want to check it.
|
||||
// Define one constant for maximum path value, so we don't have to do
|
||||
// platform-specific conditionals everywhere we want to check it.
|
||||
#define PLATFORM_MAX_PATH 260 // Play it safe for default, with same value as Windows' MAX_PATH.
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
@ -122,7 +122,7 @@ void QuitAudacity();
|
|||
/* The GCC-elf implementation */
|
||||
#ifdef HAVE_VISIBILITY // this is provided by the configure script, is only
|
||||
// enabled for suitable GCC versions
|
||||
/* The incantation is a bit weird here because it uses ELF symbol stuff. If we
|
||||
/* The incantation is a bit weird here because it uses ELF symbol stuff. If we
|
||||
* make a symbol "default" it makes it visible (for import or export). Making it
|
||||
* "hidden" means it is invisible outside the shared object. */
|
||||
#ifndef AUDACITY_DLL_API
|
||||
|
@ -154,11 +154,11 @@ void QuitAudacity();
|
|||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
// Mainly for MSVC developers.
|
||||
//
|
||||
// This precompilation is only done for non-unicode debug builds.
|
||||
// This precompilation is only done for non-unicode debug builds.
|
||||
// The rationale is that this is where there is the big time saving
|
||||
// because that's what you build whilst debugging.
|
||||
// Whilst disabling precompilation for other builds will ensure
|
||||
// that missing headers that would affect other platforms do get
|
||||
// that missing headers that would affect other platforms do get
|
||||
// seen by MSVC developers too.
|
||||
|
||||
#ifndef UNICODE
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
******************************************************************//**
|
||||
|
||||
\class AudacityApp
|
||||
\brief AudacityApp is the 'main' class for Audacity
|
||||
\brief AudacityApp is the 'main' class for Audacity
|
||||
|
||||
It handles initialization and termination by subclassing wxApp.
|
||||
|
||||
|
@ -232,7 +232,7 @@ static bool gInited = false;
|
|||
bool gIsQuitting = false;
|
||||
|
||||
void QuitAudacity(bool bForce)
|
||||
{
|
||||
{
|
||||
if (gIsQuitting)
|
||||
return;
|
||||
|
||||
|
@ -285,14 +285,14 @@ void QuitAudacity(bool bForce)
|
|||
CloseScoreAlignDialog();
|
||||
#endif
|
||||
CloseScreenshotTools();
|
||||
|
||||
|
||||
//release ODManager Threads
|
||||
ODManager::Quit();
|
||||
|
||||
//print out profile if we have one by deleting it
|
||||
//temporarilly commented out till it is added to all projects
|
||||
//delete Profiler::Instance();
|
||||
|
||||
|
||||
//delete the static lock for audacity projects
|
||||
AudacityProject::DeleteAllProjectsDeleteLock();
|
||||
|
||||
|
@ -306,7 +306,7 @@ void QuitAudacity(bool bForce)
|
|||
}
|
||||
|
||||
void QuitAudacity()
|
||||
{
|
||||
{
|
||||
QuitAudacity(false);
|
||||
}
|
||||
|
||||
|
@ -397,8 +397,8 @@ void SaveWindowSize()
|
|||
// Most of this was taken from nsNativeAppSupportUnix.cpp from Mozilla.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// TODO: May need updating. Is this code too obsolete (relying on Gnome2 so's) to be
|
||||
// worth keeping anymore?
|
||||
// TODO: May need updating. Is this code too obsolete (relying on Gnome2 so's) to be
|
||||
// worth keeping anymore?
|
||||
// CB suggests we use libSM directly ref:
|
||||
// http://www.x.org/archive/X11R7.7/doc/libSM/SMlib.html#The_Save_Yourself_Callback
|
||||
|
||||
|
@ -599,7 +599,7 @@ public:
|
|||
|
||||
wxString cmd(data);
|
||||
|
||||
// We queue a command event to the project responsible for
|
||||
// We queue a command event to the project responsible for
|
||||
// opening the file since it can be a long process and we
|
||||
// only have 5 seconds to return the Execute message to the
|
||||
// client.
|
||||
|
@ -696,7 +696,7 @@ void AudacityApp::MacNewFile()
|
|||
|
||||
// This method should only be used on the Mac platform
|
||||
// when no project windows are open.
|
||||
|
||||
|
||||
if (gAudacityProjects.GetCount() == 0) {
|
||||
CreateNewAudacityProject();
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ BEGIN_EVENT_TABLE(AudacityApp, wxApp)
|
|||
EVT_MENU(wxID_PREFERENCES, AudacityApp::OnMenuPreferences)
|
||||
EVT_MENU(wxID_EXIT, AudacityApp::OnMenuExit)
|
||||
#endif
|
||||
// Recent file event handlers.
|
||||
// Recent file event handlers.
|
||||
EVT_MENU(ID_RECENT_CLEAR, AudacityApp::OnMRUClear)
|
||||
EVT_MENU_RANGE(ID_RECENT_FIRST, ID_RECENT_LAST, AudacityApp::OnMRUFile)
|
||||
|
||||
|
@ -735,32 +735,32 @@ BEGIN_EVENT_TABLE(AudacityApp, wxApp)
|
|||
EVT_APP_COMMAND(wxID_ANY, AudacityApp::OnReceiveCommand)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// backend for OnMRUFile
|
||||
// backend for OnMRUFile
|
||||
// TODO: Would be nice to make this handle not opening a file with more panache.
|
||||
// - Inform the user if DefaultOpenPath not set.
|
||||
// - Switch focus to correct instance of project window, if already open.
|
||||
bool AudacityApp::MRUOpen(wxString fullPathStr) {
|
||||
// Most of the checks below are copied from AudacityProject::OpenFiles.
|
||||
// - some rationalisation might be possible.
|
||||
|
||||
|
||||
AudacityProject *proj = GetActiveProject();
|
||||
|
||||
if (!fullPathStr.IsEmpty())
|
||||
{
|
||||
// verify that the file exists
|
||||
if (wxFile::Exists(fullPathStr))
|
||||
|
||||
if (!fullPathStr.IsEmpty())
|
||||
{
|
||||
// verify that the file exists
|
||||
if (wxFile::Exists(fullPathStr))
|
||||
{
|
||||
if (!gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fullPathStr)) ||
|
||||
if (!gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fullPathStr)) ||
|
||||
!gPrefs->Flush())
|
||||
return false;
|
||||
|
||||
|
||||
// Make sure it isn't already open.
|
||||
// Test here even though AudacityProject::OpenFile() also now checks, because
|
||||
// that method does not return the bad result.
|
||||
// Test here even though AudacityProject::OpenFile() also now checks, because
|
||||
// that method does not return the bad result.
|
||||
// That itself may be a FIXME.
|
||||
if (AudacityProject::IsAlreadyOpen(fullPathStr))
|
||||
return false;
|
||||
|
||||
|
||||
// DMM: If the project is dirty, that means it's been touched at
|
||||
// all, and it's not safe to open a new project directly in its
|
||||
// place. Only if the project is brand-new clean and the user
|
||||
|
@ -781,7 +781,7 @@ bool AudacityApp::MRUOpen(wxString fullPathStr) {
|
|||
}
|
||||
else {
|
||||
// File doesn't exist - remove file from history
|
||||
wxMessageBox(wxString::Format(_("%s could not be found.\n\nIt has been removed from the list of recent files."),
|
||||
wxMessageBox(wxString::Format(_("%s could not be found.\n\nIt has been removed from the list of recent files."),
|
||||
fullPathStr.c_str()));
|
||||
return(false);
|
||||
}
|
||||
|
@ -794,18 +794,18 @@ void AudacityApp::OnMRUClear(wxCommandEvent& WXUNUSED(event))
|
|||
mRecentFiles->Clear();
|
||||
}
|
||||
|
||||
//vvv Basically, anything from Recent Files is treated as a .aup, until proven otherwise,
|
||||
// then it tries to Import(). Very questionable handling, imo.
|
||||
//vvv Basically, anything from Recent Files is treated as a .aup, until proven otherwise,
|
||||
// then it tries to Import(). Very questionable handling, imo.
|
||||
// Better, for example, to check the file type early on.
|
||||
void AudacityApp::OnMRUFile(wxCommandEvent& event) {
|
||||
int n = event.GetId() - ID_RECENT_FIRST;
|
||||
wxString fullPathStr = mRecentFiles->GetHistoryFile(n);
|
||||
|
||||
// Try to open only if not already open.
|
||||
// Test IsAlreadyOpen() here even though AudacityProject::MRUOpen() also now checks,
|
||||
// Try to open only if not already open.
|
||||
// Test IsAlreadyOpen() here even though AudacityProject::MRUOpen() also now checks,
|
||||
// because we don't want to RemoveFileFromHistory() just because it already exists,
|
||||
// and AudacityApp::OnMacOpenFile() calls MRUOpen() directly.
|
||||
// that method does not return the bad result.
|
||||
// that method does not return the bad result.
|
||||
if (!AudacityProject::IsAlreadyOpen(fullPathStr) && !MRUOpen(fullPathStr))
|
||||
mRecentFiles->RemoveFileFromHistory(n);
|
||||
}
|
||||
|
@ -813,7 +813,7 @@ void AudacityApp::OnMRUFile(wxCommandEvent& event) {
|
|||
void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event))
|
||||
{
|
||||
#if defined(__WXMAC__)
|
||||
// Filenames are queued when Audacity receives the a few of the
|
||||
// Filenames are queued when Audacity receives the a few of the
|
||||
// AppleEvent messages (via wxWidgets). So, open any that are
|
||||
// in the queue and clean the queue.
|
||||
if (ofqueue.GetCount()) {
|
||||
|
@ -833,7 +833,7 @@ void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event))
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Check if a warning for missing aliased files should be displayed
|
||||
if (ShouldShowMissingAliasedFileWarning()) {
|
||||
// find which project owns the blockfile
|
||||
|
@ -862,7 +862,7 @@ void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event))
|
|||
if (offendingProject) {
|
||||
offendingProject->Iconize(false);
|
||||
offendingProject->Raise();
|
||||
|
||||
|
||||
wxString errorMessage = wxString::Format(_(
|
||||
"One or more external audio files could not be found.\n\
|
||||
It is possible they were moved, deleted, or the drive they \
|
||||
|
@ -874,7 +874,7 @@ There may be additional missing files.\n\
|
|||
Choose File > Check Dependencies to view a list of \
|
||||
locations of the missing files."), missingFileName.c_str());
|
||||
|
||||
// if an old dialog exists, raise it if it is
|
||||
// if an old dialog exists, raise it if it is
|
||||
if (offendingProject->GetMissingAliasFileDialog()) {
|
||||
offendingProject->GetMissingAliasFileDialog()->Raise();
|
||||
} else {
|
||||
|
@ -965,7 +965,7 @@ void AudacityApp::InitLang( const wxString & lang )
|
|||
// catalogs are search in LIFO order, so add wxstd first.
|
||||
mLocale->AddCatalog(wxT("wxstd"));
|
||||
|
||||
// AUDACITY_NAME is legitimately used on some *nix configurations.
|
||||
// AUDACITY_NAME is legitimately used on some *nix configurations.
|
||||
#ifdef AUDACITY_NAME
|
||||
mLocale->AddCatalog(wxT(AUDACITY_NAME));
|
||||
#else
|
||||
|
@ -998,7 +998,7 @@ int AudacityApp::FilterEvent(wxEvent & event)
|
|||
if (event.GetEventType() == wxEVT_ACTIVATE)
|
||||
{
|
||||
wxActivateEvent & e = (wxActivateEvent &) event;
|
||||
|
||||
|
||||
if (e.GetEventObject() && e.GetActive() && e.GetEventObject()->IsKindOf(CLASSINFO(wxDialog)))
|
||||
{
|
||||
((wxWindow *)e.GetEventObject())->SetFocus();
|
||||
|
@ -1065,7 +1065,7 @@ bool AudacityApp::OnInit()
|
|||
InitPreferences();
|
||||
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__)
|
||||
this->AssociateFileTypes();
|
||||
this->AssociateFileTypes();
|
||||
#endif
|
||||
|
||||
// TODO - read the number of files to store in history from preferences
|
||||
|
@ -1080,7 +1080,7 @@ bool AudacityApp::OnInit()
|
|||
theTheme.EnsureInitialised();
|
||||
|
||||
// AColor depends on theTheme.
|
||||
AColor::Init();
|
||||
AColor::Init();
|
||||
|
||||
/* Search path (for plug-ins, translations etc) is (in this order):
|
||||
* The AUDACITY_PATH environment variable
|
||||
|
@ -1090,7 +1090,7 @@ bool AudacityApp::OnInit()
|
|||
#ifdef __WXGTK__
|
||||
/* On Unix systems, the default temp dir is in /var/tmp. */
|
||||
defaultTempDir.Printf(wxT("/var/tmp/audacity-%s"), wxGetUserId().c_str());
|
||||
|
||||
|
||||
wxString pathVar = wxGetenv(wxT("AUDACITY_PATH"));
|
||||
if (pathVar != wxT(""))
|
||||
AddMultiPathsToPathList(pathVar, audacityPathList);
|
||||
|
@ -1134,8 +1134,8 @@ bool AudacityApp::OnInit()
|
|||
wxString progPath = wxPathOnly(argv[0]);
|
||||
AddUniquePathToPathList(progPath, audacityPathList);
|
||||
AddUniquePathToPathList(progPath+wxT("\\Languages"), audacityPathList);
|
||||
|
||||
defaultTempDir.Printf(wxT("%s\\audacity_temp"),
|
||||
|
||||
defaultTempDir.Printf(wxT("%s\\audacity_temp"),
|
||||
tmpDirLoc.c_str());
|
||||
#endif //__WXWSW__
|
||||
|
||||
|
@ -1152,7 +1152,7 @@ bool AudacityApp::OnInit()
|
|||
AddUniquePathToPathList(progPath+wxT("/../"), audacityPathList);
|
||||
AddUniquePathToPathList(progPath+wxT("/../Resources"), audacityPathList);
|
||||
|
||||
defaultTempDir.Printf(wxT("%s/audacity-%s"),
|
||||
defaultTempDir.Printf(wxT("%s/audacity-%s"),
|
||||
tmpDirLoc.c_str(),
|
||||
wxGetUserId().c_str());
|
||||
#endif //__WXMAC__
|
||||
|
@ -1248,14 +1248,14 @@ bool AudacityApp::OnInit()
|
|||
}
|
||||
|
||||
delete temporarywindow;
|
||||
|
||||
|
||||
if( project->mShowSplashScreen )
|
||||
project->OnHelpWelcome();
|
||||
|
||||
// JKC 10-Sep-2007: Enable monitoring from the start.
|
||||
// (recommended by lprod.org).
|
||||
// Monitoring stops again after any
|
||||
// PLAY or RECORD completes.
|
||||
// Monitoring stops again after any
|
||||
// PLAY or RECORD completes.
|
||||
// So we also call StartMonitoring when STOP is called.
|
||||
project->MayStartMonitoring();
|
||||
|
||||
|
@ -1343,12 +1343,12 @@ bool AudacityApp::OnInit()
|
|||
} // if (argc>1)
|
||||
|
||||
#else //__CYGWIN__
|
||||
|
||||
|
||||
// Cygwin command line parser (by Dave Fancella)
|
||||
if (argc > 1 && !didRecoverAnything) {
|
||||
int optionstart = 1;
|
||||
bool startAtOffset = false;
|
||||
|
||||
|
||||
// Scan command line arguments looking for trouble
|
||||
for (int option = 1; option < argc; option++) {
|
||||
if (!argv[option])
|
||||
|
@ -1360,14 +1360,14 @@ bool AudacityApp::OnInit()
|
|||
optionstart = option + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int option = optionstart; option < argc; option++) {
|
||||
if (!argv[option])
|
||||
continue;
|
||||
bool handled = false;
|
||||
bool openThisFile = false;
|
||||
wxString fileToOpen;
|
||||
|
||||
|
||||
if (!wxString(wxT("-help")).CmpNoCase(argv[option])) {
|
||||
PrintCommandLineHelp(); // print the help message out
|
||||
exit(0);
|
||||
|
@ -1397,10 +1397,10 @@ bool AudacityApp::OnInit()
|
|||
wxPrintf(_("Unknown command line option: %s\n"), argv[option]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
if(handled)
|
||||
fileToOpen.Clear();
|
||||
|
||||
|
||||
if (!handled)
|
||||
fileToOpen = fileToOpen + wxT(" ") + argv[option];
|
||||
if(wxString(argv[option]).Lower().Contains(wxT(".aup")))
|
||||
|
@ -1422,7 +1422,7 @@ bool AudacityApp::OnInit()
|
|||
#endif // __CYGWIN__ (Cygwin command-line parser)
|
||||
|
||||
gInited = true;
|
||||
|
||||
|
||||
ModuleManager::Dispatch(AppInitialized);
|
||||
|
||||
mWindowRectAlreadySaved = FALSE;
|
||||
|
@ -1588,7 +1588,7 @@ bool AudacityApp::CreateSingleInstanceChecker(wxString dir)
|
|||
}
|
||||
#endif
|
||||
// There is another copy of Audacity running. Force quit.
|
||||
|
||||
|
||||
wxString prompt =
|
||||
_("The system has detected that another copy of Audacity is running.\n") +
|
||||
runningTwoCopiesStr +
|
||||
|
@ -1820,7 +1820,7 @@ int AudacityApp::OnExit()
|
|||
// where it's possible to have a menu bar but no windows open.
|
||||
// It doesn't hurt any other platforms, though.
|
||||
|
||||
// ...That is, as long as you check to see if no windows are open
|
||||
// ...That is, as long as you check to see if no windows are open
|
||||
// before executing the stuff.
|
||||
// To fix this, check to see how many project windows are open,
|
||||
// and skip the event unless none are open (which should only happen
|
||||
|
@ -1830,7 +1830,7 @@ void AudacityApp::OnMenuAbout(wxCommandEvent & event)
|
|||
{
|
||||
// This function shadows a similar function
|
||||
// in Menus.cpp, but should only be used on the Mac platform
|
||||
// when no project windows are open. This check assures that
|
||||
// when no project windows are open. This check assures that
|
||||
// this happens, and enable the same code to be present on
|
||||
// all platforms.
|
||||
if(gAudacityProjects.GetCount() == 0) {
|
||||
|
@ -1845,10 +1845,10 @@ void AudacityApp::OnMenuNew(wxCommandEvent & event)
|
|||
{
|
||||
// This function shadows a similar function
|
||||
// in Menus.cpp, but should only be used on the Mac platform
|
||||
// when no project windows are open. This check assures that
|
||||
// when no project windows are open. This check assures that
|
||||
// this happens, and enable the same code to be present on
|
||||
// all platforms.
|
||||
|
||||
|
||||
if(gAudacityProjects.GetCount() == 0)
|
||||
CreateNewAudacityProject();
|
||||
else
|
||||
|
@ -1860,7 +1860,7 @@ void AudacityApp::OnMenuOpen(wxCommandEvent & event)
|
|||
{
|
||||
// This function shadows a similar function
|
||||
// in Menus.cpp, but should only be used on the Mac platform
|
||||
// when no project windows are open. This check assures that
|
||||
// when no project windows are open. This check assures that
|
||||
// this happens, and enable the same code to be present on
|
||||
// all platforms.
|
||||
|
||||
|
@ -1877,7 +1877,7 @@ void AudacityApp::OnMenuPreferences(wxCommandEvent & event)
|
|||
{
|
||||
// This function shadows a similar function
|
||||
// in Menus.cpp, but should only be used on the Mac platform
|
||||
// when no project windows are open. This check assures that
|
||||
// when no project windows are open. This check assures that
|
||||
// this happens, and enable the same code to be present on
|
||||
// all platforms.
|
||||
|
||||
|
@ -1887,33 +1887,33 @@ void AudacityApp::OnMenuPreferences(wxCommandEvent & event)
|
|||
}
|
||||
else
|
||||
event.Skip();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void AudacityApp::OnMenuExit(wxCommandEvent & event)
|
||||
{
|
||||
// This function shadows a similar function
|
||||
// in Menus.cpp, but should only be used on the Mac platform
|
||||
// when no project windows are open. This check assures that
|
||||
// when no project windows are open. This check assures that
|
||||
// this happens, and enable the same code to be present on
|
||||
// all platforms.
|
||||
|
||||
// LL: Removed "if" to allow closing based on final project count.
|
||||
// if(gAudacityProjects.GetCount() == 0)
|
||||
QuitAudacity();
|
||||
|
||||
|
||||
// LL: Veto quit if projects are still open. This can happen
|
||||
// if the user selected Cancel in a Save dialog.
|
||||
event.Skip(gAudacityProjects.GetCount() == 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//BG: On Windows, associate the aup file type with Audacity
|
||||
/* We do this in the Windows installer now,
|
||||
to avoid issues where user doesn't have admin privileges, but
|
||||
/* We do this in the Windows installer now,
|
||||
to avoid issues where user doesn't have admin privileges, but
|
||||
in case that didn't work, allow the user to decide at startup.
|
||||
|
||||
//v Should encapsulate this & allow access from Prefs, too,
|
||||
//v Should encapsulate this & allow access from Prefs, too,
|
||||
// if people want to manually change associations.
|
||||
*/
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__)
|
||||
|
@ -1927,18 +1927,18 @@ void AudacityApp::AssociateFileTypes()
|
|||
associateFileTypes.SetName(wxT("HKCU\\Software\\Classes\\.AUP"));
|
||||
bKeyExists = associateFileTypes.Exists();
|
||||
}
|
||||
if (!bKeyExists) {
|
||||
// File types are not currently associated.
|
||||
if (!bKeyExists) {
|
||||
// File types are not currently associated.
|
||||
// Check pref in case user has already decided against it.
|
||||
bool bWantAssociateFiles = true;
|
||||
if (!gPrefs->Read(wxT("/WantAssociateFiles"), &bWantAssociateFiles) ||
|
||||
if (!gPrefs->Read(wxT("/WantAssociateFiles"), &bWantAssociateFiles) ||
|
||||
bWantAssociateFiles) {
|
||||
// Either there's no pref or user does want associations
|
||||
// Either there's no pref or user does want associations
|
||||
// and they got stepped on, so ask.
|
||||
int wantAssoc =
|
||||
int wantAssoc =
|
||||
wxMessageBox(
|
||||
_("Audacity project (.AUP) files are not currently \nassociated with Audacity. \n\nAssociate them, so they open on double-click?"),
|
||||
_("Audacity Project Files"),
|
||||
_("Audacity project (.AUP) files are not currently \nassociated with Audacity. \n\nAssociate them, so they open on double-click?"),
|
||||
_("Audacity Project Files"),
|
||||
wxYES_NO | wxICON_QUESTION);
|
||||
if (wantAssoc == wxYES) {
|
||||
gPrefs->Write(wxT("/WantAssociateFiles"), true);
|
||||
|
@ -1952,7 +1952,7 @@ void AudacityApp::AssociateFileTypes()
|
|||
// Not at HKEY_CLASSES_USER. Try HKEY_CURRENT_ROOT.
|
||||
root_key = wxT("HKCR\\");
|
||||
associateFileTypes.SetName(root_key + wxT(".AUP"));
|
||||
if (!associateFileTypes.Create(true)) {
|
||||
if (!associateFileTypes.Create(true)) {
|
||||
// Actually, can't create keys. Empty root_key to flag failure.
|
||||
root_key.Empty();
|
||||
}
|
||||
|
@ -1984,7 +1984,7 @@ void AudacityApp::AssociateFileTypes()
|
|||
if(associateFileTypes.Exists()) {
|
||||
tmpRegAudPath = wxString(associateFileTypes).Lower();
|
||||
}
|
||||
if (!associateFileTypes.Exists() ||
|
||||
if (!associateFileTypes.Exists() ||
|
||||
(tmpRegAudPath.Find(wxT("audacity.exe")) >= 0)) {
|
||||
associateFileTypes.Create(true);
|
||||
associateFileTypes = (wxString)argv[0] + (wxString)wxT(" \"%1\"");
|
||||
|
|
|
@ -54,12 +54,12 @@ DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_CAPTURE_KEY, -1);
|
|||
|
||||
// These flags represent the majority of the states that affect
|
||||
// whether or not items in menus are enabled or disabled.
|
||||
enum
|
||||
enum
|
||||
{
|
||||
AlwaysEnabledFlag = 0x00000000,
|
||||
|
||||
AudioIONotBusyFlag = 0x00000001,
|
||||
TimeSelectedFlag = 0x00000002, // This is equivalent to check if there is a valid selection, so it's used for Zoom to Selection too
|
||||
TimeSelectedFlag = 0x00000002, // This is equivalent to check if there is a valid selection, so it's used for Zoom to Selection too
|
||||
TracksSelectedFlag = 0x00000004,
|
||||
TracksExistFlag = 0x00000008,
|
||||
LabelTracksExistFlag = 0x00000010,
|
||||
|
@ -144,11 +144,11 @@ class AudacityApp:public wxApp {
|
|||
/** \brief Changes the behavior of missing aliased blockfiles warnings
|
||||
*/
|
||||
void SetMissingAliasedFileWarningShouldShow(bool b);
|
||||
|
||||
|
||||
/** \brief Returns true if the user should be notified of missing alias warnings
|
||||
*/
|
||||
bool ShouldShowMissingAliasedFileWarning();
|
||||
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// In response to Apple Events
|
||||
virtual void MacOpenFile(const wxString &fileName) ;
|
||||
|
@ -161,7 +161,7 @@ class AudacityApp:public wxApp {
|
|||
#endif
|
||||
|
||||
/** \brief A list of directories that should be searched for Audacity files
|
||||
* (plug-ins, help files, etc.).
|
||||
* (plug-ins, help files, etc.).
|
||||
*
|
||||
* On Unix this will include the directory Audacity was installed into,
|
||||
* plus the current user's .audacity-data/Plug-Ins directory. Additional
|
||||
|
@ -207,10 +207,10 @@ class AudacityApp:public wxApp {
|
|||
wxSingleInstanceChecker *mChecker;
|
||||
|
||||
wxTimer *mTimer;
|
||||
|
||||
|
||||
bool m_aliasMissingWarningShouldShow;
|
||||
BlockFile *m_LastMissingBlockFile;
|
||||
|
||||
|
||||
ODLock m_LastMissingBlockFileLock;
|
||||
|
||||
void InitCommandHandler();
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
|
||||
//#ifdef __WXMSW__
|
||||
// Enable this to diagnose memory leaks too!
|
||||
// #include <wx/msw/msvcrt.h> // redefines the new() operator
|
||||
// #include <wx/msw/msvcrt.h> // redefines the new() operator
|
||||
//#endif
|
||||
|
||||
#if __WXMSW__
|
||||
|
|
370
src/AudioIO.cpp
370
src/AudioIO.cpp
File diff suppressed because it is too large
Load Diff
|
@ -57,7 +57,7 @@ class AUDACITY_DLL_API AudioIOListener {
|
|||
public:
|
||||
AudioIOListener() {}
|
||||
virtual ~AudioIOListener() {}
|
||||
|
||||
|
||||
virtual void OnAudioIORate(int rate) = 0;
|
||||
virtual void OnAudioIOStartRecording() = 0;
|
||||
virtual void OnAudioIOStopRecording() = 0;
|
||||
|
@ -87,11 +87,11 @@ class AUDACITY_DLL_API AudioIO {
|
|||
|
||||
AudioIOListener* GetListener() { return mListener; }
|
||||
void SetListener(AudioIOListener* listener);
|
||||
|
||||
|
||||
/** \brief Start up Portaudio for capture and recording as needed for
|
||||
* input monitoring and software playthrough only
|
||||
*
|
||||
* This uses the Default project sample format, current sample rate, and
|
||||
* This uses the Default project sample format, current sample rate, and
|
||||
* selected number of input channels to open the recording device and start
|
||||
* reading input data. If software playthrough is enabled, it also opens
|
||||
* the output device in stereo to play the data through */
|
||||
|
@ -124,7 +124,7 @@ class AUDACITY_DLL_API AudioIO {
|
|||
/** \brief Move the playback / recording position of the current stream
|
||||
* by the specified amount from where it is now */
|
||||
void SeekStream(double seconds) { mSeek = seconds; };
|
||||
|
||||
|
||||
/** \brief Returns true if audio i/o is busy starting, stopping, playing,
|
||||
* or recording.
|
||||
*
|
||||
|
@ -142,7 +142,7 @@ class AUDACITY_DLL_API AudioIO {
|
|||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
/** \brief Compute the current PortMidi timestamp time.
|
||||
*
|
||||
*
|
||||
* This is used by PortMidi to synchronize midi time to audio samples
|
||||
*/
|
||||
PmTimestamp MidiTime();
|
||||
|
@ -152,14 +152,14 @@ class AUDACITY_DLL_API AudioIO {
|
|||
// We do the same for Midi, but it seems wasteful for at least two
|
||||
// threads to be frequently polling to update status. This could be
|
||||
// eliminated (also with a reduction in code I think) by updating mHasSolo
|
||||
// each time a solo button is activated or deactivated. For now, I'm
|
||||
// each time a solo button is activated or deactivated. For now, I'm
|
||||
// going to do this polling in the FillMidiBuffer routine to localize
|
||||
// changes for midi to the midi code, but I'm declaring the variable
|
||||
// here so possibly in the future, Audio code can use it too. -RBD
|
||||
private:
|
||||
bool mHasSolo; // is any playback solo button pressed?
|
||||
public:
|
||||
bool SetHasSolo(bool hasSolo);
|
||||
bool SetHasSolo(bool hasSolo);
|
||||
bool GetHasSolo() { return mHasSolo; }
|
||||
void SetMidiPlaySpeed(double s) { mMidiPlaySpeed = s * 0.01; }
|
||||
#endif
|
||||
|
@ -171,7 +171,7 @@ class AUDACITY_DLL_API AudioIO {
|
|||
* recorded, and it's safe to flush to disk. */
|
||||
bool IsAudioTokenActive(int token);
|
||||
|
||||
/** \brief Returns true if we're monitoring input (but not recording or
|
||||
/** \brief Returns true if we're monitoring input (but not recording or
|
||||
* playing actual audio) */
|
||||
bool IsMonitoring();
|
||||
|
||||
|
@ -183,7 +183,7 @@ class AUDACITY_DLL_API AudioIO {
|
|||
/* Mixer services are always available. If no stream is running, these
|
||||
* methods use whatever device is specified by the preferences. If a
|
||||
* stream *is* running, naturally they manipulate the mixer associated
|
||||
* with that stream. If no mixer is available, output is emulated and
|
||||
* with that stream. If no mixer is available, output is emulated and
|
||||
* input is stuck at 1.0f (a gain is applied to output samples).
|
||||
*/
|
||||
void SetMixer(int inputSource);
|
||||
|
@ -209,11 +209,11 @@ class AUDACITY_DLL_API AudioIO {
|
|||
|
||||
/** \brief Get the list of inputs to the current mixer device
|
||||
*
|
||||
* Returns an array of strings giving the names of the inputs to the
|
||||
* Returns an array of strings giving the names of the inputs to the
|
||||
* soundcard mixer (driven by PortMixer) */
|
||||
wxArrayString GetInputSourceNames();
|
||||
|
||||
/** \brief update state after changing what audio devices are selected
|
||||
/** \brief update state after changing what audio devices are selected
|
||||
*
|
||||
* Called when the devices stored in the preferences are changed to update
|
||||
* the audio mixer capabilities
|
||||
|
@ -223,10 +223,10 @@ class AUDACITY_DLL_API AudioIO {
|
|||
* GetSupported*Rate functions considerably */
|
||||
void HandleDeviceChange();
|
||||
|
||||
/** \brief Set the current VU meters - this should be done once after
|
||||
/** \brief Set the current VU meters - this should be done once after
|
||||
* each call to StartStream currently */
|
||||
void SetMeters(Meter *inputMeter, Meter *outputMeter);
|
||||
|
||||
|
||||
/** \brief Get a list of sample rates the output (playback) device
|
||||
* supports.
|
||||
*
|
||||
|
@ -380,7 +380,7 @@ private:
|
|||
/** \brief Get the number of audio samples ready in all of the recording
|
||||
* buffers.
|
||||
*
|
||||
* Returns the smallest of the number of samples available for storage in
|
||||
* Returns the smallest of the number of samples available for storage in
|
||||
* the recording buffers (i.e. the number of samples that can be read from
|
||||
* all record buffers without underflow). */
|
||||
int GetCommonlyAvailCapture();
|
||||
|
@ -539,7 +539,7 @@ private:
|
|||
bool mEmulateMixerOutputVol;
|
||||
/** @brief Can we control the hardware input level?
|
||||
*
|
||||
* This flag is set to true if using portmixer to control the
|
||||
* This flag is set to true if using portmixer to control the
|
||||
* input volume seems to be working (and so we offer the user the control),
|
||||
* and to false (locking the control out) otherwise. This avoids stupid
|
||||
* scaled clipping problems when trying to do software emulated input volume
|
||||
|
@ -550,10 +550,10 @@ private:
|
|||
bool mPlayLooped;
|
||||
double mCutPreviewGapStart;
|
||||
double mCutPreviewGapLen;
|
||||
|
||||
|
||||
samplePtr mSilentBuf;
|
||||
sampleCount mLastSilentBufSize;
|
||||
|
||||
|
||||
AudioIOListener* mListener;
|
||||
|
||||
friend class AudioThread;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*******************************************************************//**
|
||||
|
||||
\class AutoRecoveryDialog
|
||||
\brief The AutoRecoveryDialog prompts the user whether to
|
||||
\brief The AutoRecoveryDialog prompts the user whether to
|
||||
recover previous Audacity projects that were closed incorrectly.
|
||||
|
||||
*//********************************************************************/
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
private:
|
||||
void PopulateList();
|
||||
void PopulateOrExchange(ShuttleGui & S);
|
||||
|
||||
|
||||
void OnQuitAudacity(wxCommandEvent &evt);
|
||||
void OnRecoverNone(wxCommandEvent &evt);
|
||||
void OnRecoverAll(wxCommandEvent &evt);
|
||||
|
@ -75,7 +75,7 @@ void AutoRecoveryDialog::PopulateOrExchange(ShuttleGui& S)
|
|||
S.AddVariableText(_("Some projects were not saved properly the last time Audacity was run.\nFortunately, the following projects can automatically be recovered:"), false);
|
||||
|
||||
S.StartStatic(_("Recoverable projects"));
|
||||
{
|
||||
{
|
||||
mFileList = S.Id(ID_FILE_LIST).AddListControlReportMode();
|
||||
/*i18n-hint: (noun). It's the name of the project to recover.*/
|
||||
mFileList->InsertColumn(0, _("Name"));
|
||||
|
@ -105,17 +105,17 @@ void AutoRecoveryDialog::PopulateOrExchange(ShuttleGui& S)
|
|||
void AutoRecoveryDialog::PopulateList()
|
||||
{
|
||||
mFileList->DeleteAllItems();
|
||||
|
||||
|
||||
wxDir dir(FileNames::AutoSaveDir());
|
||||
if (!dir.IsOpened())
|
||||
return;
|
||||
|
||||
|
||||
wxString filename;
|
||||
int i = 0;
|
||||
for (bool c = dir.GetFirst(&filename, wxT("*.autosave"), wxDIR_FILES);
|
||||
c; c = dir.GetNext(&filename))
|
||||
mFileList->InsertItem(i++, wxFileName(filename).GetName());
|
||||
|
||||
|
||||
mFileList->SetColumnWidth(0, wxLIST_AUTOSIZE);
|
||||
}
|
||||
|
||||
|
@ -150,10 +150,10 @@ static bool HaveFilesToRecover()
|
|||
_("Error"), wxICON_STOP);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
wxString filename;
|
||||
bool c = dir.GetFirst(&filename, wxT("*.autosave"), wxDIR_FILES);
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ static bool RemoveAllAutoSaveFiles()
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -187,11 +187,11 @@ static bool RecoverAllProjects(AudacityProject** pproj)
|
|||
_("Error"), wxICON_STOP);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Open a project window for each auto save file
|
||||
wxString filename;
|
||||
AudacityProject* proj = NULL;
|
||||
|
||||
|
||||
wxArrayString files;
|
||||
wxDir::GetAllFiles(FileNames::AutoSaveDir(), &files,
|
||||
wxT("*.autosave"), wxDIR_FILES);
|
||||
|
@ -214,7 +214,7 @@ static bool RecoverAllProjects(AudacityProject** pproj)
|
|||
// is created.
|
||||
proj->OpenFile(files[i], false);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -227,12 +227,12 @@ bool ShowAutoRecoveryDialogIfNeeded(AudacityProject** pproj,
|
|||
{
|
||||
AutoRecoveryDialog dlg(*pproj);
|
||||
int ret = dlg.ShowModal();
|
||||
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case ID_RECOVER_NONE:
|
||||
return RemoveAllAutoSaveFiles();
|
||||
|
||||
|
||||
case ID_RECOVER_ALL:
|
||||
if (didRecoverAnything)
|
||||
*didRecoverAnything = true;
|
||||
|
@ -284,7 +284,7 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
|
|||
WaveTrack* track = tracks.Item(index);
|
||||
WaveClip* clip = track->GetLastOrCreateClip();
|
||||
Sequence* seq = clip->GetSequence();
|
||||
|
||||
|
||||
// Load the blockfile from the XML
|
||||
BlockFile* blockFile = NULL;
|
||||
DirManager* dirManager = mProject->GetDirManager();
|
||||
|
@ -312,7 +312,7 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
|
|||
|
||||
if (!value)
|
||||
break;
|
||||
|
||||
|
||||
const wxString strValue = value;
|
||||
//this channels value does not correspond to WaveTrack::Left/Right/Mono, but which channel of the recording device
|
||||
//it came from, and thus we can't use XMLValueChecker::IsValidChannel on it. Rather we compare to the next attribute value.
|
||||
|
@ -324,17 +324,17 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
|
|||
}
|
||||
else if (wxStrcmp(attr, wxT("numchannels")) == 0)
|
||||
{
|
||||
if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) ||
|
||||
if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) ||
|
||||
(nValue < 1))
|
||||
return false;
|
||||
if(mChannel >= nValue )
|
||||
return false;
|
||||
return false;
|
||||
mNumChannels = nValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -342,6 +342,6 @@ XMLTagHandler* RecordingRecoveryHandler::HandleXMLChild(const wxChar *tag)
|
|||
{
|
||||
if (wxStrcmp(tag, wxT("simpleblockfile")) == 0)
|
||||
return this; // HandleXMLTag also handles <simpleblockfile>
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
// Returns: True, if the start of Audacity should continue as normal
|
||||
// False if Audacity should be quit immediately
|
||||
//
|
||||
// The didRecoverAnything param is strictly for a return value.
|
||||
// The didRecoverAnything param is strictly for a return value.
|
||||
// Any value passed in is ignored.
|
||||
//
|
||||
//
|
||||
bool ShowAutoRecoveryDialogIfNeeded(AudacityProject** pproj,
|
||||
bool *didRecoverAnything);
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
RecordingRecoveryHandler(AudacityProject* proj);
|
||||
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs);
|
||||
virtual XMLTagHandler *HandleXMLChild(const wxChar *tag);
|
||||
|
||||
|
||||
// This class only knows reading tags
|
||||
virtual void WriteXML(XMLWriter & WXUNUSED(xmlFile)) { wxASSERT(false); }
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
\class BatchCommandDialog
|
||||
\brief Provides a list of configurable commands for use with BatchCommands
|
||||
|
||||
Provides a list of commands, mostly effects, which can be chained
|
||||
Provides a list of commands, mostly effects, which can be chained
|
||||
together in a simple linear sequence. Can configure parameters on each
|
||||
selected command.
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ See also BatchCommandDialog and BatchProcessDialog.
|
|||
// - Specials (which we deal with specially here)
|
||||
enum eCommandType { CtEffect, CtMenu, CtSpecial };
|
||||
|
||||
// TIDY-ME: Not currently translated,
|
||||
// TIDY-ME: Not currently translated,
|
||||
// but there are issues to address if we do.
|
||||
// CLEANSPEECH remnant
|
||||
static wxString SpecialCommands[] = {
|
||||
|
@ -134,7 +134,7 @@ bool BatchCommands::ReadChain(const wxString & chain)
|
|||
// Parse and clean
|
||||
wxString cmd = tf[i].Left(splitAt).Strip(wxString::both);
|
||||
wxString parm = tf[i].Mid(splitAt + 1).Strip(wxString::trailing);
|
||||
|
||||
|
||||
// Backward compatibility for old Chain scripts
|
||||
// Please comment the version of audacity these are introduced in, so
|
||||
// that old ones can easily be removed once users have had a chance to
|
||||
|
@ -250,7 +250,7 @@ bool BatchCommands::RenameChain(const wxString & oldchain, const wxString & newc
|
|||
void BatchCommands::SetWavToMp3Chain() // a function per default chain? This is flawed design! MJS
|
||||
{
|
||||
ResetChain();
|
||||
|
||||
|
||||
AddToChain( wxT("Normalize") );
|
||||
AddToChain( wxT("ExportMP3") );
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ wxArrayString BatchCommands::GetAllCommands()
|
|||
commands.Add( SpecialCommands[i] );
|
||||
}
|
||||
// end CLEANSPEECH remnant
|
||||
|
||||
|
||||
int additionalEffects=ADVANCED_EFFECT;
|
||||
|
||||
effects = EffectManager::Get().GetEffects(PROCESS_EFFECT | BUILTIN_EFFECT | PLUGIN_EFFECT | additionalEffects);
|
||||
|
@ -419,7 +419,7 @@ bool BatchCommands::WriteMp3File( const wxString Name, int bitrate )
|
|||
// commands take a selection as their parameter.
|
||||
//
|
||||
// If you find yourself adding lots of existing commands from the menus here, STOP
|
||||
// and think again.
|
||||
// and think again.
|
||||
// ======= IMPORTANT ========
|
||||
// CLEANSPEECH remnant
|
||||
bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString command,const wxString params)
|
||||
|
@ -446,7 +446,7 @@ bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString c
|
|||
extension = wxT(".flac");
|
||||
else extension = wxT(".mp3");
|
||||
|
||||
if (mFileName.IsEmpty()) {
|
||||
if (mFileName.IsEmpty()) {
|
||||
filename = project->BuildCleanFileName(project->GetFileName(), extension);
|
||||
}
|
||||
else {
|
||||
|
@ -508,7 +508,7 @@ bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString c
|
|||
wxMessageBox(_("FLAC support is not included in this build of Audacity"));
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
wxMessageBox(wxString::Format(_("Command %s not implemented yet"),command.c_str()));
|
||||
return false;
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ bool BatchCommands::ApplyEffectCommand( Effect * f, const wxString command, co
|
|||
AudacityProject *project = GetActiveProject();
|
||||
|
||||
//FIXME: for later versions may want to not select-all in batch mode.
|
||||
//IF nothing selected, THEN select everything
|
||||
//IF nothing selected, THEN select everything
|
||||
// (most effects require that you have something selected).
|
||||
project->SelectAllIfNone();
|
||||
|
||||
|
@ -562,7 +562,7 @@ bool BatchCommands::ApplyCommand(const wxString command, const wxString params)
|
|||
return ApplySpecialCommand( i, command, params );
|
||||
}
|
||||
// end CLEANSPEECH remnant
|
||||
|
||||
|
||||
// Test for an effect.
|
||||
Effect * f = EffectManager::Get().GetEffectByIdentifier( command );
|
||||
if( f!=NULL )
|
||||
|
|
|
@ -44,7 +44,7 @@ class BatchCommands {
|
|||
static bool SetCurrentParametersFor( Effect * f, const wxString command, const wxString params);
|
||||
static wxArrayString GetAllCommands();
|
||||
|
||||
// These commands do depend on the command list.
|
||||
// These commands do depend on the command list.
|
||||
void ResetChain();
|
||||
|
||||
bool ReadChain(const wxString & chain);
|
||||
|
|
|
@ -90,7 +90,7 @@ void BatchProcessDialog::PopulateOrExchange(ShuttleGui &S)
|
|||
{
|
||||
S.StartVerticalLay(true);
|
||||
{
|
||||
/*i18n-hint: A chain is a sequence of commands that can be applied
|
||||
/*i18n-hint: A chain is a sequence of commands that can be applied
|
||||
* to one or more audio files.*/
|
||||
S.StartStatic(_("&Select Chain"), true);
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ void BatchProcessDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
|
|||
|
||||
wxString path = gPrefs->Read(wxT("/DefaultOpenPath"), ::wxGetCwd());
|
||||
wxString prompt = _("Select file(s) for batch processing...");
|
||||
|
||||
|
||||
FormatList l;
|
||||
wxString filter;
|
||||
wxString all;
|
||||
|
@ -387,9 +387,9 @@ BEGIN_EVENT_TABLE(EditChainsDialog, wxDialog)
|
|||
END_EVENT_TABLE()
|
||||
|
||||
enum {
|
||||
BlankColumn,
|
||||
ItemNumberColumn,
|
||||
ActionColumn,
|
||||
BlankColumn,
|
||||
ItemNumberColumn,
|
||||
ActionColumn,
|
||||
ParamsColumn,
|
||||
};
|
||||
|
||||
|
@ -457,12 +457,12 @@ void EditChainsDialog::PopulateOrExchange(ShuttleGui & S)
|
|||
// JKC: Experimenting with an alternative way to get multiline
|
||||
// translated strings to work correctly without very long lines.
|
||||
// My appologies Alexandre if this way didn't work either.
|
||||
//
|
||||
//
|
||||
// With this method:
|
||||
// 1) it compiles fine under windows unicode and normal mode.
|
||||
// 2) xgettext source code has handling for the trailing '\'
|
||||
//
|
||||
// It remains to see if linux and mac can cope and if xgettext
|
||||
// It remains to see if linux and mac can cope and if xgettext
|
||||
// actually does do fine with strings presented like this.
|
||||
// If it doesn't work out, revert to all-on-one-line.
|
||||
S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_SINGLE_SEL |
|
||||
|
@ -485,7 +485,7 @@ void EditChainsDialog::PopulateOrExchange(ShuttleGui & S)
|
|||
wxLC_SINGLE_SEL);
|
||||
mList = S.Id(CommandsListID).AddListControlReportMode();
|
||||
|
||||
//An empty first column is a workaround - under Win98 the first column
|
||||
//An empty first column is a workaround - under Win98 the first column
|
||||
//can't be right aligned.
|
||||
mList->InsertColumn(BlankColumn, wxT(""), wxLIST_FORMAT_LEFT);
|
||||
/* i18n-hint: This is the number of the command in the list */
|
||||
|
@ -663,7 +663,7 @@ void EditChainsDialog::FitColumns()
|
|||
mList->SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER);
|
||||
mList->SetColumnWidth(2, wxLIST_AUTOSIZE_USEHEADER);
|
||||
mList->SetColumnWidth(3, wxLIST_AUTOSIZE);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int bestfit = mList->GetColumnWidth(3);
|
||||
int clientsize = mList->GetClientSize().GetWidth();
|
||||
|
@ -703,7 +703,7 @@ void EditChainsDialog::OnChainsEndEdit(wxListEvent &event)
|
|||
PopulateChains();
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
void EditChainsDialog::OnAdd(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
while (true) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*******************************************************************//**
|
||||
|
||||
\class BenchmarkDialog
|
||||
\brief BenchmarkDialog is used for measuring performance and accuracy
|
||||
\brief BenchmarkDialog is used for measuring performance and accuracy
|
||||
of the BlockFile system.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
@ -46,9 +46,9 @@ class BenchmarkDialog: public wxDialog
|
|||
public:
|
||||
// constructors and destructors
|
||||
BenchmarkDialog( wxWindow *parent );
|
||||
|
||||
|
||||
void MakeBenchmarkDialog();
|
||||
|
||||
|
||||
private:
|
||||
// WDR: handler declarations
|
||||
void OnRun( wxCommandEvent &event );
|
||||
|
@ -72,7 +72,7 @@ private:
|
|||
bool mEditDetail;
|
||||
|
||||
wxTextCtrl *mText;
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@ -153,7 +153,7 @@ void BenchmarkDialog::MakeBenchmarkDialog()
|
|||
{
|
||||
ShuttleGui S(this, eIsCreating);
|
||||
wxControl *item;
|
||||
|
||||
|
||||
// Strings don't need to be translated because this class doesn't
|
||||
// ever get used in a stable release.
|
||||
|
||||
|
@ -293,7 +293,7 @@ void BenchmarkDialog::FlushPrint()
|
|||
void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
TransferDataFromWindow();
|
||||
|
||||
|
||||
if (!Validate())
|
||||
return;
|
||||
|
||||
|
@ -353,7 +353,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
|
|||
}
|
||||
|
||||
// The chunks are the pieces we move around in the test.
|
||||
// They are (and are supposed to be) a different size to
|
||||
// They are (and are supposed to be) a different size to
|
||||
// the blocks that make the blockfiles. That way we get to
|
||||
// do some testing of when edit chunks cross blockfile boundaries.
|
||||
Printf(wxT("Using %d chunks of %d samples each, for a total of ")
|
||||
|
@ -511,7 +511,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
|
|||
elapsed = timer.Time();
|
||||
|
||||
Printf(wxT("Time to check all data (2): %ld ms\n"), elapsed);
|
||||
|
||||
|
||||
Printf(wxT("At 44100 Hz, 16-bits per sample, the estimated number of\n")
|
||||
wxT("simultaneous tracks that could be played at once: %.1f\n"),
|
||||
(nChunks*chunkSize/44100.0)/(elapsed/1000.0));
|
||||
|
|
|
@ -36,8 +36,8 @@ counts.
|
|||
*//****************************************************************//**
|
||||
|
||||
\class SummaryInfo
|
||||
\brief Works with BlockFile to hold info about max and min and RMS
|
||||
over multiple samples, which in turn allows rapid drawing when zoomed
|
||||
\brief Works with BlockFile to hold info about max and min and RMS
|
||||
over multiple samples, which in turn allows rapid drawing when zoomed
|
||||
out.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
@ -367,7 +367,7 @@ void BlockFile::FixSummary(void *data)
|
|||
|
||||
for(i=0; i<len; i++)
|
||||
buffer[i] = wxUINT32_SWAP_ALWAYS(buffer[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Retrieves the minimum, maximum, and maximum RMS of the
|
||||
|
@ -486,7 +486,7 @@ bool BlockFile::Read64K(float *buffer,
|
|||
if (start+len > mSummaryInfo.frames64K)
|
||||
len = mSummaryInfo.frames64K - start;
|
||||
|
||||
CopySamples(summary + mSummaryInfo.offset64K +
|
||||
CopySamples(summary + mSummaryInfo.offset64K +
|
||||
(start * mSummaryInfo.bytesPerFrame),
|
||||
mSummaryInfo.format,
|
||||
(samplePtr)buffer, floatSample, len*mSummaryInfo.fields);
|
||||
|
@ -538,9 +538,9 @@ AliasBlockFile::AliasBlockFile(wxFileName baseFileName,
|
|||
}
|
||||
|
||||
AliasBlockFile::AliasBlockFile(wxFileName existingSummaryFileName,
|
||||
wxFileName aliasedFileName,
|
||||
wxFileName aliasedFileName,
|
||||
sampleCount aliasStart,
|
||||
sampleCount aliasLen,
|
||||
sampleCount aliasLen,
|
||||
int aliasChannel,
|
||||
float min, float max, float rms):
|
||||
BlockFile(existingSummaryFileName, aliasLen),
|
||||
|
@ -616,7 +616,7 @@ bool AliasBlockFile::ReadSummary(void *data)
|
|||
mSilentLog=TRUE;
|
||||
return true;
|
||||
|
||||
}else mSilentLog=FALSE; // worked properly, any future error is new
|
||||
}else mSilentLog=FALSE; // worked properly, any future error is new
|
||||
|
||||
if(silence) delete silence;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class BlockFile {
|
|||
sampleCount start, sampleCount len) = 0;
|
||||
|
||||
// Other Properties
|
||||
|
||||
|
||||
// Write cache to disk, if it has any
|
||||
virtual bool GetNeedWriteCacheToDisk() { return false; }
|
||||
virtual void WriteCacheToDisk() { /* no cache by default */ }
|
||||
|
@ -96,16 +96,16 @@ class BlockFile {
|
|||
|
||||
/// Returns TRUE if this block references another disk file
|
||||
virtual bool IsAlias() { return false; }
|
||||
|
||||
|
||||
/// Returns TRUE if this block's complete summary has been computed and is ready (for OD)
|
||||
virtual bool IsSummaryAvailable(){return true;}
|
||||
|
||||
/// Returns TRUE if this block's complete data is ready to be accessed by Read()
|
||||
virtual bool IsDataAvailable(){return true;}
|
||||
|
||||
/// Returns TRUE if the summary has not yet been written, but is actively being computed and written to disk
|
||||
|
||||
/// Returns TRUE if the summary has not yet been written, but is actively being computed and written to disk
|
||||
virtual bool IsSummaryBeingComputed(){return false;}
|
||||
|
||||
|
||||
/// Create a new BlockFile identical to this, using the given filename
|
||||
virtual BlockFile *Copy(wxFileName newFileName) = 0;
|
||||
|
||||
|
@ -125,7 +125,7 @@ class BlockFile {
|
|||
///when the project closes, it locks the blockfiles.
|
||||
///Override this in case it needs special treatment
|
||||
virtual void CloseLock(){Lock();}
|
||||
|
||||
|
||||
/// Prevents a read on other threads. The basic blockfile runs on only one thread, so does nothing.
|
||||
virtual void LockRead(){}
|
||||
/// Allows reading on other threads.
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
CrossFade.h
|
||||
|
||||
(c) 2005 The Audacity Team
|
||||
Licensed under the GPL version 2.0
|
||||
Licensed under the GPL version 2.0
|
||||
|
||||
**********************************************************************/
|
||||
#ifndef __AUDACITY_CROSSFADE__
|
||||
#define __AUDACITY_CROSSFADE__
|
||||
|
||||
/// This defines a crossfader class that
|
||||
/// This defines a crossfader class that
|
||||
/// accepts a list of WaveClips and can do a mini-mixing
|
||||
/// to produce the desired crossfading
|
||||
/// to produce the desired crossfading
|
||||
|
||||
#include "SampleFormat.h"
|
||||
#include "Resample.h"
|
||||
|
@ -39,18 +39,18 @@ class CrossFader
|
|||
void SetMixCrossFade(){mType = FT_MIX;};
|
||||
void SetTriangularCrossFade(){mType = FT_TRIANGULAR;};
|
||||
void SetExponentialCrossFade(){mType = FT_EXPONENTIAL;};
|
||||
|
||||
|
||||
void AddClip( WaveClip * clip);
|
||||
void ClearClips();
|
||||
//Produces samples according to crossfading rules.
|
||||
bool GetSamples(samplePtr buffer, sampleFormat format,
|
||||
bool GetSamples(samplePtr buffer, sampleFormat format,
|
||||
sampleCount start, sampleCount len);
|
||||
|
||||
|
||||
protected:
|
||||
WaveClipList mClips;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
bool CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len);
|
||||
|
||||
FadeType mType;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Audacity: A Digital Audio Editor
|
||||
Audacity(R) is copyright (c) 1999-2008 Audacity Team.
|
||||
License: GPL v2. See License.txt.
|
||||
|
||||
|
||||
Dependencies.cpp
|
||||
|
||||
Dominic Mazzoni
|
||||
|
@ -12,7 +12,7 @@
|
|||
LRN
|
||||
Michael Chinen
|
||||
Vaughan Johnson
|
||||
|
||||
|
||||
The primary function provided in this source file is
|
||||
ShowDependencyDialogIfNeeded. It checks a project to see if
|
||||
any of its WaveTracks contain AliasBlockFiles; if so it
|
||||
|
@ -39,8 +39,8 @@
|
|||
#include "Track.h"
|
||||
|
||||
// Note, this #include must occur here, not up with the others!
|
||||
// It must be between the WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY.
|
||||
#include <wx/arrimpl.cpp>
|
||||
// It must be between the WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY.
|
||||
#include <wx/arrimpl.cpp>
|
||||
|
||||
WX_DEFINE_OBJARRAY( AliasedFileArray );
|
||||
|
||||
|
@ -120,38 +120,38 @@ void FindDependencies(AudacityProject *project,
|
|||
int i;
|
||||
for (i = 0; i < (int)blocks.GetCount(); i++) {
|
||||
BlockFile *f = blocks[i]->f;
|
||||
if (f->IsAlias() && (blockFileHash.count(f) == 0))
|
||||
if (f->IsAlias() && (blockFileHash.count(f) == 0))
|
||||
{
|
||||
// f is an alias block we have not yet counted.
|
||||
blockFileHash[f] = true; // Don't count the same blockfile twice.
|
||||
AliasBlockFile *aliasBlockFile = (AliasBlockFile *)f;
|
||||
wxFileName fileName = aliasBlockFile->GetAliasedFileName();
|
||||
|
||||
// In DirManager::ProjectFSCK(), if the user has chosen to
|
||||
// "Replace missing audio with silence", the code there puts in an empty wxFileName.
|
||||
// In DirManager::ProjectFSCK(), if the user has chosen to
|
||||
// "Replace missing audio with silence", the code there puts in an empty wxFileName.
|
||||
// Don't count those in dependencies.
|
||||
if (!fileName.IsOk())
|
||||
continue;
|
||||
|
||||
|
||||
wxString fileNameStr = fileName.GetFullPath();
|
||||
int blockBytes = (SAMPLE_SIZE(format) *
|
||||
aliasBlockFile->GetLength());
|
||||
if (aliasedFileHash.count(fileNameStr) > 0)
|
||||
// Already put this AliasBlockFile in aliasedFileHash.
|
||||
// Already put this AliasBlockFile in aliasedFileHash.
|
||||
// Update block count.
|
||||
aliasedFileHash[fileNameStr]->mByteCount += blockBytes;
|
||||
else
|
||||
else
|
||||
{
|
||||
// Haven't counted this AliasBlockFile yet.
|
||||
// Haven't counted this AliasBlockFile yet.
|
||||
// Add to return array and internal hash.
|
||||
outAliasedFiles->Add(AliasedFile(fileName,
|
||||
blockBytes,
|
||||
outAliasedFiles->Add(AliasedFile(fileName,
|
||||
blockBytes,
|
||||
fileName.FileExists()));
|
||||
aliasedFileHash[fileNameStr] =
|
||||
&((*outAliasedFiles)[outAliasedFiles->GetCount()-1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Given a project and a list of aliased files that should no
|
||||
|
@ -162,12 +162,12 @@ static void RemoveDependencies(AudacityProject *project,
|
|||
{
|
||||
DirManager *dirManager = project->GetDirManager();
|
||||
|
||||
ProgressDialog *progress =
|
||||
ProgressDialog *progress =
|
||||
new ProgressDialog(_("Removing Dependencies"),
|
||||
_("Copying audio data into project..."));
|
||||
int updateResult = eProgressSuccess;
|
||||
|
||||
// Hash aliasedFiles based on their full paths and
|
||||
// Hash aliasedFiles based on their full paths and
|
||||
// count total number of bytes to process.
|
||||
AliasedFileHash aliasedFileHash;
|
||||
wxLongLong totalBytesToProcess = 0;
|
||||
|
@ -177,16 +177,16 @@ static void RemoveDependencies(AudacityProject *project,
|
|||
wxString fileNameStr = aliasedFiles->Item(i).mFileName.GetFullPath();
|
||||
aliasedFileHash[fileNameStr] = &aliasedFiles->Item(i);
|
||||
}
|
||||
|
||||
|
||||
BlockArray blocks;
|
||||
GetAllSeqBlocks(project, &blocks);
|
||||
|
||||
const sampleFormat format = project->GetDefaultFormat();
|
||||
ReplacedBlockFileHash blockFileHash;
|
||||
ReplacedBlockFileHash blockFileHash;
|
||||
wxLongLong completedBytes = 0;
|
||||
for (i = 0; i < blocks.GetCount(); i++) {
|
||||
BlockFile *f = blocks[i]->f;
|
||||
if (f->IsAlias() && (blockFileHash.count(f) == 0))
|
||||
if (f->IsAlias() && (blockFileHash.count(f) == 0))
|
||||
{
|
||||
// f is an alias block we have not yet processed.
|
||||
AliasBlockFile *aliasBlockFile = (AliasBlockFile *)f;
|
||||
|
@ -260,8 +260,8 @@ private:
|
|||
void OnYes(wxCommandEvent &evt);
|
||||
|
||||
void SaveFutureActionChoice();
|
||||
|
||||
|
||||
|
||||
|
||||
AudacityProject *mProject;
|
||||
AliasedFileArray *mAliasedFiles;
|
||||
bool mIsSaving;
|
||||
|
@ -273,7 +273,7 @@ private:
|
|||
wxButton *mCopySelectedFilesButton;
|
||||
wxButton *mCopyAllFilesButton;
|
||||
wxChoice *mFutureActionChoice;
|
||||
|
||||
|
||||
public:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@ -301,19 +301,19 @@ DependencyDialog::DependencyDialog(wxWindow *parent,
|
|||
bool isSaving)
|
||||
: wxDialog(parent, id, _("Project Depends on Other Audio Files"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
(isSaving ?
|
||||
(isSaving ?
|
||||
(wxDEFAULT_DIALOG_STYLE & ~wxCLOSE_BOX) : // no close box when saving
|
||||
wxDEFAULT_DIALOG_STYLE) |
|
||||
wxRESIZE_BORDER),
|
||||
wxDEFAULT_DIALOG_STYLE) |
|
||||
wxRESIZE_BORDER),
|
||||
mProject(project),
|
||||
mAliasedFiles(aliasedFiles),
|
||||
mIsSaving(isSaving),
|
||||
mHasMissingFiles(false),
|
||||
mHasNonMissingFiles(false),
|
||||
mHasMissingFiles(false),
|
||||
mHasNonMissingFiles(false),
|
||||
mMessageStaticText(NULL),
|
||||
mFileListCtrl(NULL),
|
||||
mCopySelectedFilesButton(NULL),
|
||||
mCopyAllFilesButton(NULL),
|
||||
mCopyAllFilesButton(NULL),
|
||||
mFutureActionChoice(NULL)
|
||||
{
|
||||
ShuttleGui S(this, eIsCreating);
|
||||
|
@ -322,11 +322,11 @@ DependencyDialog::DependencyDialog(wxWindow *parent,
|
|||
|
||||
const wxString kStdMsg =
|
||||
_("Copying these files into your project will remove this dependency.\
|
||||
\nThis is safer, but needs more disk space.");
|
||||
\nThis is safer, but needs more disk space.");
|
||||
|
||||
const wxString kExtraMsgForMissingFiles =
|
||||
_("\n\nFiles shown as MISSING have been moved or deleted and cannot be copied.\
|
||||
\nRestore them to their original location to be able to copy into project.");
|
||||
\nRestore them to their original location to be able to copy into project.");
|
||||
|
||||
void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
|
|||
mMessageStaticText = S.AddVariableText(kStdMsg, false);
|
||||
|
||||
S.StartStatic(_("Project Dependencies"));
|
||||
{
|
||||
{
|
||||
mFileListCtrl = S.Id(FileListID).AddListControlReportMode();
|
||||
mFileListCtrl->InsertColumn(0, _("Audio File"));
|
||||
mFileListCtrl->SetColumnWidth(0, 220);
|
||||
|
@ -344,13 +344,13 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
|
|||
mFileListCtrl->SetColumnWidth(1, 120);
|
||||
PopulateList();
|
||||
|
||||
mCopySelectedFilesButton =
|
||||
mCopySelectedFilesButton =
|
||||
S.Id(CopySelectedFilesButtonID).AddButton(
|
||||
_("Copy Selected Files"),
|
||||
_("Copy Selected Files"),
|
||||
wxALIGN_LEFT);
|
||||
mCopySelectedFilesButton->Enable(
|
||||
mFileListCtrl->GetSelectedItemCount() > 0);
|
||||
mCopySelectedFilesButton->SetDefault();
|
||||
mCopySelectedFilesButton->SetDefault();
|
||||
mCopySelectedFilesButton->SetFocus();
|
||||
}
|
||||
S.EndStatic();
|
||||
|
@ -364,26 +364,26 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
|
|||
else
|
||||
S.Id(wxID_NO).AddButton(_("Do Not Copy"));
|
||||
|
||||
mCopyAllFilesButton =
|
||||
mCopyAllFilesButton =
|
||||
S.Id(wxID_YES).AddButton(_("Copy All Files (Safer)"));
|
||||
|
||||
// Enabling mCopyAllFilesButton is also done in PopulateList,
|
||||
// Enabling mCopyAllFilesButton is also done in PopulateList,
|
||||
// but at its call above, mCopyAllFilesButton does not yet exist.
|
||||
mCopyAllFilesButton->Enable(!mHasMissingFiles);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
|
||||
|
||||
if (mIsSaving)
|
||||
{
|
||||
S.StartHorizontalLay(wxALIGN_LEFT);
|
||||
{
|
||||
wxArrayString choices;
|
||||
/*i18n-hint: One of the choices of what you want Audacity to do when
|
||||
/*i18n-hint: One of the choices of what you want Audacity to do when
|
||||
* Audacity finds a project depends on another file.*/
|
||||
choices.Add(_("Ask me"));
|
||||
choices.Add(_("Always copy all files (safest)"));
|
||||
choices.Add(_("Never copy any files"));
|
||||
mFutureActionChoice =
|
||||
mFutureActionChoice =
|
||||
S.Id(FutureActionChoiceID).AddChoice(
|
||||
_("Whenever a project depends on other files:"),
|
||||
_("Ask me"), &choices);
|
||||
|
@ -419,7 +419,7 @@ void DependencyDialog::PopulateList()
|
|||
mHasNonMissingFiles = true;
|
||||
mFileListCtrl->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
mFileListCtrl->InsertItem(i, _("MISSING ") + fileName.GetFullPath());
|
||||
mHasMissingFiles = true;
|
||||
|
@ -429,7 +429,7 @@ void DependencyDialog::PopulateList()
|
|||
mFileListCtrl->SetItem(i, 1, Internat::FormatSize(byteCount));
|
||||
mFileListCtrl->SetItemData(i, long(bOriginalExists));
|
||||
}
|
||||
|
||||
|
||||
wxString msg = kStdMsg;
|
||||
if (mHasMissingFiles)
|
||||
msg += kExtraMsgForMissingFiles;
|
||||
|
@ -446,10 +446,10 @@ void DependencyDialog::OnList(wxListEvent &evt)
|
|||
|
||||
wxString itemStr = evt.GetText();
|
||||
if (evt.GetData() == 0)
|
||||
// This list item is one of mAliasedFiles for which
|
||||
// This list item is one of mAliasedFiles for which
|
||||
// the original is missing, i.e., moved or deleted.
|
||||
// wxListCtrl does not provide for items that are not
|
||||
// allowed to be selected, so always deselect these items.
|
||||
// wxListCtrl does not provide for items that are not
|
||||
// allowed to be selected, so always deselect these items.
|
||||
mFileListCtrl->SetItemState(evt.GetIndex(), 0, wxLIST_STATE_SELECTED); // Deselect.
|
||||
|
||||
mCopySelectedFilesButton->Enable(
|
||||
|
@ -461,10 +461,10 @@ void DependencyDialog::OnSize(wxSizeEvent &evt)
|
|||
int fileListCtrlWidth, fileListCtrlHeight;
|
||||
mFileListCtrl->GetSize(&fileListCtrlWidth, &fileListCtrlHeight);
|
||||
|
||||
// File path is column 0. File size is column 1.
|
||||
// File size column is always 120 px wide.
|
||||
// File path is column 0. File size is column 1.
|
||||
// File size column is always 120 px wide.
|
||||
// Also subtract 8 from file path column width for borders.
|
||||
mFileListCtrl->SetColumnWidth(0, fileListCtrlWidth - 120 - 8);
|
||||
mFileListCtrl->SetColumnWidth(0, fileListCtrlWidth - 120 - 8);
|
||||
mFileListCtrl->SetColumnWidth(1, 120);
|
||||
wxDialog::OnSize(evt);
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ void DependencyDialog::OnCopySelectedFiles(wxCommandEvent & WXUNUSED(event))
|
|||
aliasedFilesToDelete.Add(mAliasedFiles->Item(i));
|
||||
mAliasedFiles->RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RemoveDependencies(mProject, &aliasedFilesToDelete);
|
||||
PopulateList();
|
||||
|
@ -514,7 +514,7 @@ void DependencyDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
|||
if (ret != wxYES)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
EndModal(wxID_CANCEL);
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ void DependencyDialog::SaveFutureActionChoice()
|
|||
{
|
||||
if (mFutureActionChoice)
|
||||
{
|
||||
wxString savePref;
|
||||
wxString savePref;
|
||||
int sel = mFutureActionChoice->GetSelection();
|
||||
switch (sel)
|
||||
{
|
||||
|
@ -546,26 +546,26 @@ bool ShowDependencyDialogIfNeeded(AudacityProject *project,
|
|||
FindDependencies(project, &aliasedFiles);
|
||||
|
||||
if (aliasedFiles.GetCount() == 0) {
|
||||
if (!isSaving)
|
||||
if (!isSaving)
|
||||
{
|
||||
wxString msg =
|
||||
wxString msg =
|
||||
_("Your project is currently self-contained; it does not depend on any external audio files. \
|
||||
\n\nIf you change the project to a state that has external dependencies on imported \
|
||||
files, it will no longer be self-contained. If you then Save without copying those files in, \
|
||||
you may lose data.");
|
||||
wxMessageBox(msg,
|
||||
wxMessageBox(msg,
|
||||
_("Dependency Check"),
|
||||
wxOK | wxICON_INFORMATION,
|
||||
project);
|
||||
}
|
||||
return true; // Nothing to do.
|
||||
}
|
||||
|
||||
|
||||
if (isSaving)
|
||||
{
|
||||
wxString action =
|
||||
wxString action =
|
||||
gPrefs->Read(
|
||||
wxT("/FileFormats/SaveProjectWithDependencies"),
|
||||
wxT("/FileFormats/SaveProjectWithDependencies"),
|
||||
wxT("ask"));
|
||||
if (action == wxT("copy"))
|
||||
{
|
||||
|
@ -582,7 +582,7 @@ you may lose data.");
|
|||
int returnCode = dlog.ShowModal();
|
||||
if (returnCode == wxID_CANCEL)
|
||||
return false;
|
||||
else if (returnCode == wxID_YES)
|
||||
else if (returnCode == wxID_YES)
|
||||
RemoveDependencies(project, &aliasedFiles);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Audacity: A Digital Audio Editor
|
||||
Audacity(R) is copyright (c) 1999-2008 Audacity Team.
|
||||
License: GPL v2. See License.txt.
|
||||
|
||||
|
||||
Dependencies.h
|
||||
|
||||
Dominic Mazzoni
|
||||
|
@ -18,10 +18,10 @@
|
|||
|
||||
class AudacityProject;
|
||||
|
||||
class AliasedFile
|
||||
class AliasedFile
|
||||
{
|
||||
public:
|
||||
AliasedFile(wxFileName fileName, wxLongLong byteCount, bool bOriginalExists)
|
||||
AliasedFile(wxFileName fileName, wxLongLong byteCount, bool bOriginalExists)
|
||||
{
|
||||
mFileName = fileName;
|
||||
mByteCount = byteCount;
|
||||
|
|
|
@ -38,12 +38,12 @@
|
|||
|
||||
DeviceManager DeviceManager::dm;
|
||||
|
||||
/// Gets the singleton instance
|
||||
/// Gets the singleton instance
|
||||
DeviceManager* DeviceManager::Instance()
|
||||
{
|
||||
return &dm;
|
||||
}
|
||||
|
||||
|
||||
/// Releases memory assosiated with the singleton
|
||||
void DeviceManager::Destroy()
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ DeviceSourceMap* DeviceManager::GetDefaultDevice(int hostIndex, int isInput)
|
|||
if (maps[i].deviceIndex == targetDevice)
|
||||
return &maps[i];
|
||||
}
|
||||
|
||||
|
||||
wxLogDebug(wxT("GetDefaultDevice() no default device"));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -149,17 +149,17 @@ static void AddSourcesFromStream(int deviceIndex, const PaDeviceInfo *info, std:
|
|||
}
|
||||
|
||||
//if there is only one source, we don't need to concatenate the source
|
||||
//or enumerate, because it is something meaningless like 'master'
|
||||
//or enumerate, because it is something meaningless like 'master'
|
||||
//(as opposed to 'mic in' or 'line in'), and the user doesn't have any choice.
|
||||
//note that some devices have no input sources at all but are still valid.
|
||||
//the behavior we do is the same for 0 and 1 source cases.
|
||||
map.totalSources = Px_GetNumInputSources(portMixer);
|
||||
#endif
|
||||
|
||||
|
||||
if (map.totalSources <= 1) {
|
||||
map.sourceIndex = 0;
|
||||
maps->push_back(map);
|
||||
}
|
||||
}
|
||||
#ifdef USE_PORTMIXER
|
||||
else {
|
||||
//open up a stream with the device so portmixer can get the info out of it.
|
||||
|
@ -262,14 +262,14 @@ void DeviceManager::Rescan()
|
|||
// check to see if there is a stream open - can happen if monitoring,
|
||||
// but otherwise Rescan() should not be available to the user.
|
||||
if (gAudioIO) {
|
||||
if (gAudioIO->IsMonitoring())
|
||||
if (gAudioIO->IsMonitoring())
|
||||
{
|
||||
gAudioIO->StopStream();
|
||||
while (gAudioIO->IsBusy())
|
||||
wxMilliSleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// restart portaudio - this updates the device list
|
||||
Pa_Terminate();
|
||||
Pa_Initialize();
|
||||
|
|
|
@ -37,9 +37,9 @@ wxString MakeDeviceSourceString(const DeviceSourceMap *map);
|
|||
class DeviceManager
|
||||
{
|
||||
public:
|
||||
/// Gets the singleton instance
|
||||
/// Gets the singleton instance
|
||||
static DeviceManager* Instance();
|
||||
|
||||
|
||||
/// Releases memory assosiated with the singleton
|
||||
static void Destroy();
|
||||
|
||||
|
@ -64,7 +64,7 @@ class DeviceManager
|
|||
DeviceSourceMap* GetDefaultDevice(int hostIndex, int isInput);
|
||||
|
||||
bool m_inited;
|
||||
|
||||
|
||||
std::vector<DeviceSourceMap> mInputDeviceSourceMaps;
|
||||
std::vector<DeviceSourceMap> mOutputDeviceSourceMaps;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -60,13 +60,13 @@ class DirManager: public XMLTagHandler {
|
|||
sampleCount sampleLen,
|
||||
sampleFormat format,
|
||||
bool allowDeferredWrite = false);
|
||||
|
||||
|
||||
BlockFile *NewAliasBlockFile( wxString aliasedFile, sampleCount aliasStart,
|
||||
sampleCount aliasLen, int aliasChannel);
|
||||
|
||||
|
||||
BlockFile *NewODAliasBlockFile( wxString aliasedFile, sampleCount aliasStart,
|
||||
sampleCount aliasLen, int aliasChannel);
|
||||
|
||||
|
||||
BlockFile *NewODDecodeBlockFile( wxString aliasedFile, sampleCount aliasStart,
|
||||
sampleCount aliasLen, int aliasChannel, int decodeType);
|
||||
|
||||
|
@ -114,21 +114,21 @@ class DirManager: public XMLTagHandler {
|
|||
static void CleanTempDir();
|
||||
|
||||
// Check the project for errors and possibly prompt user
|
||||
// bForceError: Always show log error alert even if no errors are found here.
|
||||
// bForceError: Always show log error alert even if no errors are found here.
|
||||
// Important when you know that there are already errors in the log.
|
||||
// bAutoRecoverMode: Do not show any option dialogs for how to deal with errors found here.
|
||||
// bAutoRecoverMode: Do not show any option dialogs for how to deal with errors found here.
|
||||
// Too complicated during auto-recover. Just correct problems the "safest" way.
|
||||
int ProjectFSCK(const bool bForceError, const bool bAutoRecoverMode);
|
||||
|
||||
|
||||
void FindMissingAliasedFiles(
|
||||
BlockHash& missingAliasedFileAUFHash, // output: (.auf) AliasBlockFiles whose aliased files are missing
|
||||
BlockHash& missingAliasedFilePathHash); // output: full paths of missing aliased files
|
||||
void FindMissingAUFs(
|
||||
BlockHash& missingAUFHash); // output: missing (.auf) AliasBlockFiles
|
||||
BlockHash& missingAUFHash); // output: missing (.auf) AliasBlockFiles
|
||||
void FindMissingAUs(
|
||||
BlockHash& missingAUHash); // missing data (.au) blockfiles
|
||||
// Find .au and .auf files that are not in the project.
|
||||
void FindOrphanBlockFiles(
|
||||
void FindOrphanBlockFiles(
|
||||
const wxArrayString& filePathArray, // input: all files in project directory
|
||||
wxArrayString& orphanFilePathArray); // output: orphan files
|
||||
|
||||
|
@ -142,14 +142,14 @@ class DirManager: public XMLTagHandler {
|
|||
// not interested in this information, but it is important for the
|
||||
// auto-save functionality
|
||||
wxString GetDataFilesDir() const;
|
||||
|
||||
|
||||
// This should only be used by the auto save functionality
|
||||
void SetLocalTempDir(wxString path);
|
||||
|
||||
|
||||
// Do not delete any temporary files on exit. This is only called if
|
||||
// auto recovery is cancelled and should be retried later
|
||||
static void SetDontDeleteTempFiles() { dontDeleteTempFiles = true; }
|
||||
|
||||
|
||||
// Write all write-cached block files to disc, if any
|
||||
void WriteCacheToDisk();
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ const float Dither::SHAPED_BS[] = { 2.033f, -2.165f, 1.959f, -1.590f, 0.6149f };
|
|||
// be quite fast.
|
||||
|
||||
#if 0
|
||||
// To assist in understanding what the macros are doing, here's an example of what
|
||||
// To assist in understanding what the macros are doing, here's an example of what
|
||||
// the result would be for Shaped dither:
|
||||
//
|
||||
// DITHER(ShapedDither, dest, destFormat, destStride, source, sourceFormat, sourceStride, len);
|
||||
|
|
|
@ -18,7 +18,7 @@ class Dither
|
|||
public:
|
||||
/// Default constructor
|
||||
Dither();
|
||||
|
||||
|
||||
/// These ditherers are currently available:
|
||||
enum DitherType { none = 0, rectangle = 1, triangle = 2, shaped = 3};
|
||||
|
||||
|
@ -47,7 +47,7 @@ private:
|
|||
static const int BUF_SIZE; /* = 8 */
|
||||
static const int BUF_MASK; /* = 7 */
|
||||
static const float SHAPED_BS[];
|
||||
|
||||
|
||||
// Dither state
|
||||
int mPhase;
|
||||
float mTriangleState;
|
||||
|
|
102
src/Envelope.cpp
102
src/Envelope.cpp
|
@ -21,7 +21,7 @@
|
|||
*//****************************************************************//**
|
||||
|
||||
\class EnvPoint
|
||||
\brief EnvPoint, derived from XMLTagHandler, provides Envelope with
|
||||
\brief EnvPoint, derived from XMLTagHandler, provides Envelope with
|
||||
a draggable point type.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
@ -60,7 +60,7 @@ Envelope::Envelope()
|
|||
mDirty = false;
|
||||
mIsDeleting = false;
|
||||
mMirror = true;
|
||||
|
||||
|
||||
mMinValue = 1.0e-7;
|
||||
mMaxValue = 2.0;
|
||||
|
||||
|
@ -103,7 +103,7 @@ void Envelope::Rescale(double minValue, double maxValue)
|
|||
|
||||
}
|
||||
|
||||
/// Flatten removes all points from the envelope to
|
||||
/// Flatten removes all points from the envelope to
|
||||
/// make it horizontal at a chosen y-value.
|
||||
/// @value - the y-value for the flat envelope.
|
||||
void Envelope::Flatten(double value)
|
||||
|
@ -147,7 +147,7 @@ void Envelope::CopyFrom(const Envelope *e, double t0, double t1)
|
|||
i++;
|
||||
|
||||
// Create the point at 0 if it needs interpolated representation
|
||||
if (i>0)
|
||||
if (i>0)
|
||||
AddPointAtEnd( 0, e->GetValue(mOffset) );
|
||||
|
||||
// Copy points from inside the copied region
|
||||
|
@ -291,8 +291,8 @@ bool Envelope::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
if (!value)
|
||||
break;
|
||||
const wxString strValue = value;
|
||||
if( !wxStrcmp(attr, wxT("numpoints")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
if( !wxStrcmp(attr, wxT("numpoints")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
numPoints = nValue;
|
||||
}
|
||||
if (numPoints < 0)
|
||||
|
@ -305,7 +305,7 @@ bool Envelope::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
|
||||
XMLTagHandler *Envelope::HandleXMLChild(const wxChar *tag)
|
||||
{
|
||||
if (wxStrcmp(tag, wxT("controlpoint")))
|
||||
if (wxStrcmp(tag, wxT("controlpoint")))
|
||||
return NULL;
|
||||
|
||||
return AddPointAtEnd(0,0);
|
||||
|
@ -366,7 +366,7 @@ float Envelope::ValueOfPixel( int y, int height, bool upper, bool dB,
|
|||
|
||||
/// HandleMouseButtonDown either finds an existing control point or adds a new one
|
||||
/// which is then recorded as the point to drag.
|
||||
/// This is slightly complicated by there possibly being four control points for
|
||||
/// This is slightly complicated by there possibly being four control points for
|
||||
/// a given time value:
|
||||
/// We have an upper and lower envelope line.
|
||||
/// Also we may be showing an inner envelope (at 0.5 the range).
|
||||
|
@ -401,7 +401,7 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
|
|||
// TODO: also fix it so that we can drag the last point on an envelope.
|
||||
for (int i = 0; i < len; i++) { //search for control point nearest click
|
||||
if (mEnv[i]->GetT() >= tleft && mEnv[i]->GetT() <= tright) {
|
||||
|
||||
|
||||
int x = int ((mEnv[i]->GetT() + mOffset - h) * pps) + r.x;
|
||||
int y[4];
|
||||
int numControlPoints;
|
||||
|
@ -415,7 +415,7 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
|
|||
// Inner control points(contour)
|
||||
y[2] = GetWaveYPos( mEnv[i]->GetVal(), zoomMin, zoomMax, r.height,
|
||||
dB, false, dBr, false);
|
||||
y[3] = GetWaveYPos( -mEnv[i]->GetVal()-.00000001, zoomMin, zoomMax,
|
||||
y[3] = GetWaveYPos( -mEnv[i]->GetVal()-.00000001, zoomMin, zoomMax,
|
||||
r.height, dB, false, dBr, false);
|
||||
|
||||
numControlPoints = 4;
|
||||
|
@ -425,9 +425,9 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
|
|||
|
||||
if (!mMirror)
|
||||
numControlPoints = 1;
|
||||
|
||||
|
||||
for(int j=0; j<numControlPoints; j++){
|
||||
|
||||
|
||||
int d = (int)(sqrt((double)(SQR(x-event.m_x) + SQR(y[j]-(event.m_y-r.y)))) + 0.5);
|
||||
if (d < bestDist) {
|
||||
bestNum = i;
|
||||
|
@ -444,20 +444,20 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
|
|||
else {
|
||||
// TODO: Extract this into a function CreateNewPoint
|
||||
double when = h + (event.m_x - r.x) / pps - mOffset;
|
||||
|
||||
|
||||
// if (when <= 0 || when >= mTrackLen)
|
||||
// return false;
|
||||
|
||||
|
||||
double v = GetValueAtX( event.m_x, r, h, pps );
|
||||
|
||||
int ct = GetWaveYPos( v, zoomMin, zoomMax, r.height, dB,
|
||||
|
||||
int ct = GetWaveYPos( v, zoomMin, zoomMax, r.height, dB,
|
||||
false, dBr, false) ;
|
||||
int cb = GetWaveYPos( -v-.000000001, zoomMin, zoomMax, r.height, dB,
|
||||
int cb = GetWaveYPos( -v-.000000001, zoomMin, zoomMax, r.height, dB,
|
||||
false, dBr, false) ;
|
||||
if( ct <= cb || !mMirror ){
|
||||
int t = GetWaveYPos( v, zoomMin, zoomMax, r.height, dB,
|
||||
int t = GetWaveYPos( v, zoomMin, zoomMax, r.height, dB,
|
||||
true, dBr, false) ;
|
||||
int b = GetWaveYPos( -v, zoomMin, zoomMax, r.height, dB,
|
||||
int b = GetWaveYPos( -v, zoomMin, zoomMax, r.height, dB,
|
||||
true, dBr, false) ;
|
||||
|
||||
ct = (t + ct) / 2;
|
||||
|
@ -498,14 +498,14 @@ void Envelope::MarkDragPointForDeletion()
|
|||
// We're going to be deleting the point; On
|
||||
// screen we show this by having the envelope move to
|
||||
// the position it will have after deletion of the point.
|
||||
// Without delting the point we move it left or right
|
||||
// Without delting the point we move it left or right
|
||||
// to the same position as the previous or next point.
|
||||
|
||||
if( mEnv.Count()<=1)
|
||||
if( mEnv.Count()<=1)
|
||||
{
|
||||
// There is only one point - just move it
|
||||
// off screen and at default height.
|
||||
// temporary state when dragging only!
|
||||
// temporary state when dragging only!
|
||||
mEnv[mDragPoint]->SetT(-1000000.0);
|
||||
mEnv[mDragPoint]->SetVal(mDefaultValue);
|
||||
return;
|
||||
|
@ -525,13 +525,13 @@ void Envelope::MoveDraggedPoint( wxMouseEvent & event, wxRect & r,
|
|||
if(clip_y < 0) clip_y = 0;
|
||||
if(clip_y > r.height) clip_y = r.height;
|
||||
double newVal = ValueOfPixel(clip_y, r.height, mUpper, dB,
|
||||
zoomMin, zoomMax);
|
||||
zoomMin, zoomMax);
|
||||
|
||||
wxASSERT( pps > 0 );
|
||||
// We no longer tolerate multiple envelope points at the same t.
|
||||
// epsilon is less than the time offset of a single sample
|
||||
// TODO: However because mTrackEpsilon assumes 200KHz this use
|
||||
// of epsilon is a tad bogus. What we need to do instead is delete
|
||||
// of epsilon is a tad bogus. What we need to do instead is delete
|
||||
// a duplicated point on a mouse up.
|
||||
double newWhen = mInitialWhen + (event.m_x - mInitialX) / pps;
|
||||
|
||||
|
@ -555,7 +555,7 @@ void Envelope::MoveDraggedPoint( wxMouseEvent & event, wxRect & r,
|
|||
|
||||
bool Envelope::HandleDragging( wxMouseEvent & event, wxRect & r,
|
||||
double h, double pps, bool dB,
|
||||
float zoomMin, float zoomMax,
|
||||
float zoomMin, float zoomMax,
|
||||
float WXUNUSED(eMin), float WXUNUSED(eMax))
|
||||
{
|
||||
mDirty = true;
|
||||
|
@ -571,7 +571,7 @@ bool Envelope::HandleDragging( wxMouseEvent & event, wxRect & r,
|
|||
MoveDraggedPoint( event, r,h,pps,dB, zoomMin, zoomMax);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if(mIsDeleting )
|
||||
// IF we already know we're deleting THEN no envelope point to update.
|
||||
return false;
|
||||
|
@ -582,9 +582,9 @@ bool Envelope::HandleDragging( wxMouseEvent & event, wxRect & r,
|
|||
|
||||
// Exit dragging mode and deletes dragged point if neccessary.
|
||||
bool Envelope::HandleMouseButtonUp( wxMouseEvent & WXUNUSED(event), wxRect & WXUNUSED(r),
|
||||
double WXUNUSED(h),
|
||||
double WXUNUSED(h),
|
||||
double WXUNUSED(pps), bool WXUNUSED(dB),
|
||||
float WXUNUSED(zoomMin),
|
||||
float WXUNUSED(zoomMin),
|
||||
float WXUNUSED(zoomMax) )
|
||||
{
|
||||
if (mIsDeleting) {
|
||||
|
@ -610,7 +610,7 @@ bool Envelope::MouseEvent(wxMouseEvent & event, wxRect & r,
|
|||
if (event.ButtonDown() && mButton == wxMOUSE_BTN_NONE)
|
||||
return HandleMouseButtonDown( event, r, h, pps,dB,
|
||||
zoomMin, zoomMax);
|
||||
if (event.Dragging() && mDragPoint >= 0)
|
||||
if (event.Dragging() && mDragPoint >= 0)
|
||||
return HandleDragging( event, r, h, pps,dB,
|
||||
zoomMin, zoomMax);
|
||||
if (event.ButtonUp() && event.GetButton() == mButton)
|
||||
|
@ -647,7 +647,7 @@ void Envelope::CollapseRegion(double t0, double t1)
|
|||
for (i = 0; i < len; i++)
|
||||
if (mEnv[i]->GetT() >= t1)
|
||||
mEnv[i]->SetT(mEnv[i]->GetT() - (t1 - t0));
|
||||
|
||||
|
||||
mTrackLen -= (t1-t0);
|
||||
}
|
||||
|
||||
|
@ -682,7 +682,7 @@ void Envelope::Paste(double t0, Envelope *e)
|
|||
e->Insert(e->mTrackLen, rightval);
|
||||
pointsAdded = true; // we need to delete them later so's not to corrupt 'e' for later use
|
||||
}
|
||||
|
||||
|
||||
t0 = wxMin(t0 - mOffset, mTrackLen); // t0 now has origin of zero
|
||||
double deltat = e->mTrackLen;
|
||||
|
||||
|
@ -696,7 +696,7 @@ void Envelope::Paste(double t0, Envelope *e)
|
|||
bool onPoint = false;
|
||||
unsigned int len = mEnv.Count();
|
||||
|
||||
// get values to perform framing of the insertion
|
||||
// get values to perform framing of the insertion
|
||||
double splitval = GetValue(t0 + mOffset);
|
||||
|
||||
if(len != 0) { // Not case 10: there are point/s in the envelope
|
||||
|
@ -727,8 +727,8 @@ Old analysis of cases:
|
|||
// In pasting in a clip we choose to preserve the envelope so that the loudness of the
|
||||
// parts is unchanged.
|
||||
//
|
||||
// 1) This may introduce a discontnuity in the envelope at a boundary between the
|
||||
// old and new clips. In that case we must ensure there are envelope points
|
||||
// 1) This may introduce a discontnuity in the envelope at a boundary between the
|
||||
// old and new clips. In that case we must ensure there are envelope points
|
||||
// at sample positions immediately before and immediately after the boundary.
|
||||
// 2) If the points have the same value we only need one of them.
|
||||
// 3) If the points have the same value AND it is the same as the value interpolated
|
||||
|
@ -736,8 +736,8 @@ Old analysis of cases:
|
|||
//
|
||||
// We do the same for the left and right edge of the new clip.
|
||||
//
|
||||
// Even simpler: we could always add two points at a boundary and then call
|
||||
// RemoveUnneededPoints() (provided that function behaves correctly).
|
||||
// Even simpler: we could always add two points at a boundary and then call
|
||||
// RemoveUnneededPoints() (provided that function behaves correctly).
|
||||
|
||||
// See if existing points need shifting to the right, and what Case we are in
|
||||
for (i = 0; i < len; i++) {
|
||||
|
@ -775,7 +775,7 @@ Old analysis of cases:
|
|||
}
|
||||
else {
|
||||
if(atEnd) { // insertion at the end
|
||||
if(onPoint) { // last env point is at RH end, Case 2:
|
||||
if(onPoint) { // last env point is at RH end, Case 2:
|
||||
mEnv[0]->SetT(mEnv[0]->GetT() - mTrackEpsilon); // move it L slightly to avoid duplicate point
|
||||
//wxLogDebug(wxT("Case 2"));
|
||||
}
|
||||
|
@ -875,7 +875,7 @@ void Envelope::RemoveUnneededPoints(double time, double tolerence)
|
|||
if( fabs(val -val1) > tolerence )
|
||||
{
|
||||
Insert(when,val); // put it back, we needed it
|
||||
|
||||
|
||||
//Insert may have modified instead of inserting, if two points were at the same time.
|
||||
// in which case len needs to shrink i and len, because the array size decreased.
|
||||
bExcludePoint = (mEnv.Count() < len);
|
||||
|
@ -960,7 +960,7 @@ void Envelope::GetPoints(double *bufferWhen,
|
|||
* If you call Envelope::Insert() from WaveClip, or anywhere else outside the
|
||||
* Envelope class that is using project timing, subtract the envelope's mOffset
|
||||
* from the time.
|
||||
* If you call Envelope::Insert() from within Envelope, don't subtract mOffset
|
||||
* If you call Envelope::Insert() from within Envelope, don't subtract mOffset
|
||||
* because you are working in relative time inside the envelope
|
||||
* @param when the time in seconds when the envelope point should be created.
|
||||
* @param value the envelope value to use at the given point.
|
||||
|
@ -997,7 +997,7 @@ int Envelope::Insert(double when, double value)
|
|||
when = mTrackLen;
|
||||
|
||||
int i = 0;
|
||||
|
||||
|
||||
while (i < len && when > mEnv[i]->GetT())
|
||||
i++;
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ void Envelope::BinarySearchForTime( int &Lo, int &Hi, double t ) const
|
|||
|
||||
/// GetInterpolationStartValueAtPoint() is used to select either the
|
||||
/// envelope value or its log depending on whether we are doing linear
|
||||
/// or log interpolation.
|
||||
/// or log interpolation.
|
||||
/// @param iPoint index in env array to look at.
|
||||
/// @return value there, or its (safe) log10.
|
||||
double Envelope::GetInterpolationStartValueAtPoint( int iPoint ) const
|
||||
|
@ -1139,7 +1139,7 @@ void Envelope::GetValues(double *buffer, int bufferLen,
|
|||
|
||||
vprev = GetInterpolationStartValueAtPoint( lo );
|
||||
vnext = GetInterpolationStartValueAtPoint( hi );
|
||||
|
||||
|
||||
// Interpolate, either linear or log depending on mDB.
|
||||
double dt = (tnext - tprev);
|
||||
double to = t - tprev;
|
||||
|
@ -1317,11 +1317,11 @@ double Envelope::Integral( double t0, double t1 )
|
|||
{
|
||||
return -Integral(t1, t0); // this makes more sense than returning the default value
|
||||
}
|
||||
|
||||
|
||||
unsigned int count = mEnv.Count();
|
||||
if(count == 0) // 'empty' envelope
|
||||
return (t1 - t0) * mDefaultValue;
|
||||
|
||||
|
||||
double total = 0.0, lastT, lastVal;
|
||||
unsigned int i; // this is the next point to check
|
||||
if(t0 < mEnv[0]->GetT()) // t0 preceding the first point
|
||||
|
@ -1346,7 +1346,7 @@ double Envelope::Integral( double t0, double t1 )
|
|||
lastT = t0;
|
||||
i = hi; // the point immediately after t0.
|
||||
}
|
||||
|
||||
|
||||
// loop through the rest of the envelope points until we get to t1
|
||||
while (1)
|
||||
{
|
||||
|
@ -1377,11 +1377,11 @@ double Envelope::IntegralOfInverse( double t0, double t1 )
|
|||
{
|
||||
return -IntegralOfInverse(t1, t0); // this makes more sense than returning the default value
|
||||
}
|
||||
|
||||
|
||||
unsigned int count = mEnv.Count();
|
||||
if(count == 0) // 'empty' envelope
|
||||
return (t1 - t0) / mDefaultValue;
|
||||
|
||||
|
||||
double total = 0.0, lastT, lastVal;
|
||||
unsigned int i; // this is the next point to check
|
||||
if(t0 < mEnv[0]->GetT()) // t0 preceding the first point
|
||||
|
@ -1406,7 +1406,7 @@ double Envelope::IntegralOfInverse( double t0, double t1 )
|
|||
lastT = t0;
|
||||
i = hi; // the point immediately after t0.
|
||||
}
|
||||
|
||||
|
||||
// loop through the rest of the envelope points until we get to t1
|
||||
while (1)
|
||||
{
|
||||
|
@ -1438,11 +1438,11 @@ double Envelope::SolveIntegralOfInverse( double t0, double area )
|
|||
fprintf( stderr, "SolveIntegralOfInverse called with negative area, this is not supported!\n" );
|
||||
return t0;
|
||||
}
|
||||
|
||||
|
||||
unsigned int count = mEnv.Count();
|
||||
if(count == 0) // 'empty' envelope
|
||||
return t0 + area * mDefaultValue;
|
||||
|
||||
|
||||
double lastT, lastVal;
|
||||
unsigned int i; // this is the next point to check
|
||||
if(t0 < mEnv[0]->GetT()) // t0 preceding the first point
|
||||
|
@ -1468,7 +1468,7 @@ double Envelope::SolveIntegralOfInverse( double t0, double area )
|
|||
lastT = t0;
|
||||
i = hi; // the point immediately after t0.
|
||||
}
|
||||
|
||||
|
||||
// loop through the rest of the envelope points until we get to t1
|
||||
while (1)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
mT = t;
|
||||
mVal = ClampValue(val);
|
||||
}
|
||||
|
||||
|
||||
double ClampValue(double val); // this calls mEnvelope->ClampValue(), implementation is below the Envelope class
|
||||
|
||||
double GetT() { return mT; }
|
||||
|
@ -74,12 +74,12 @@ private:
|
|||
Envelope *mEnvelope;
|
||||
double mT;
|
||||
double mVal;
|
||||
|
||||
|
||||
};
|
||||
|
||||
// TODO: Become an array of EnvPoint rather than of pointers to.
|
||||
// Really? wxWidgets help says:
|
||||
// "wxArray is suitable for storing integer types and pointers which it does not
|
||||
// Really? wxWidgets help says:
|
||||
// "wxArray is suitable for storing integer types and pointers which it does not
|
||||
// treat as objects in any way..."
|
||||
// And why is this a TODO in any case, if it works correctly?
|
||||
WX_DEFINE_ARRAY(EnvPoint *, EnvArray);
|
||||
|
@ -98,11 +98,11 @@ class Envelope : public XMLTagHandler {
|
|||
|
||||
void Flatten(double value);
|
||||
int GetDragPoint(void) {return mDragPoint;}
|
||||
|
||||
|
||||
double GetMinValue() { return mMinValue; }
|
||||
double GetMaxValue() { return mMaxValue; }
|
||||
void SetRange(double minValue, double maxValue);
|
||||
|
||||
|
||||
double ClampValue(double value) { return std::max(mMinValue, std::min(mMaxValue, value)); }
|
||||
|
||||
#if LEGACY_PROJECT_FILE_SUPPORT
|
||||
|
@ -147,7 +147,7 @@ class Envelope : public XMLTagHandler {
|
|||
// Control
|
||||
void SetOffset(double newOffset);
|
||||
void SetTrackLen(double trackLen);
|
||||
|
||||
|
||||
// Accessors
|
||||
/** \brief Get envelope value at time t */
|
||||
double GetValue(double t) const;
|
||||
|
@ -241,7 +241,7 @@ private:
|
|||
int mButton;
|
||||
bool mDB;
|
||||
bool mDirty;
|
||||
|
||||
|
||||
double mMinValue, mMaxValue;
|
||||
|
||||
// These are memoizing variables for Integral()
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
Used for #includes and #defines for experimental features.
|
||||
|
||||
When the features become mainstream the #include files will
|
||||
When the features become mainstream the #include files will
|
||||
move out of here and into the files which need them. The
|
||||
#defines will then be retired.
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
|||
- Modular architecture.
|
||||
Add #defines in here for the new features, and make your code
|
||||
conditional on those #defines.
|
||||
|
||||
All the #defines are positive, i.e., when defined,
|
||||
|
||||
All the #defines are positive, i.e., when defined,
|
||||
they enable the feature.
|
||||
|
||||
**********************************************************************/
|
||||
|
@ -50,7 +50,7 @@
|
|||
|
||||
// experimental theming
|
||||
// Work in progress, June-2008.
|
||||
// This mostly sets up a weird color scheme currently.
|
||||
// This mostly sets up a weird color scheme currently.
|
||||
//#define EXPERIMENTAL_THEMING
|
||||
|
||||
//August 2009 - Theming not locked down enough for a stable release.
|
||||
|
@ -58,7 +58,7 @@
|
|||
//#define EXPERIMENTAL_THEME_PREFS
|
||||
|
||||
//Next line enables Mic monitoring at times when it was previously off.
|
||||
//More work is needed as after recording or playing it results in an
|
||||
//More work is needed as after recording or playing it results in an
|
||||
//unwanted record-cursor on the wave track.
|
||||
//#define EXPERIMENTAL_EXTRA_MONITORING
|
||||
|
||||
|
@ -75,9 +75,9 @@
|
|||
// preferrably disabled until other work is done. Martyn 22/12/2008.
|
||||
//#define EFFECT_CATEGORIES
|
||||
|
||||
// Andreas Micheler, 20.Nov 2007:
|
||||
// Andreas Micheler, 20.Nov 2007:
|
||||
// A spectrumLogF-like view mode with notes quantization.
|
||||
// Just select the "Find Notes" checkbox in the spectrum prefs
|
||||
// Just select the "Find Notes" checkbox in the spectrum prefs
|
||||
// to activate it instead of the Spectrum log(f) mode.
|
||||
//#define EXPERIMENTAL_FIND_NOTES
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
// Skip Points support in the spectrum view mode.
|
||||
//#define EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
// AM, 22.Nov 2007:
|
||||
// AM, 22.Nov 2007:
|
||||
// A Frequency Grid for the Spectrum Log(f) & Find Notes modes
|
||||
//#define EXPERIMENTAL_FFT_Y_GRID
|
||||
|
||||
|
@ -125,7 +125,7 @@
|
|||
// a tabbed divider to the project.
|
||||
//#define EXPERIMENTAL_NOTEBOOK
|
||||
// The notebook in turn can contain:
|
||||
// 1. The Nyquist Inspector, which is a browser for the objects in
|
||||
// 1. The Nyquist Inspector, which is a browser for the objects in
|
||||
// Audacity.
|
||||
//#define EXPERIMENTAL_NYQUIST_INSPECTOR
|
||||
// 2. The Vocal Studio, a screen for working with vocal sounds
|
||||
|
@ -133,7 +133,7 @@
|
|||
//#define EXPERIMENTAL_VOCAL_STUDIO
|
||||
// 3. The Audacity Tester is an extended version of the benchmarks
|
||||
// display. The crucial idea is to be able to compare waveforms
|
||||
// where effects have been applied by audacity but using different
|
||||
// where effects have been applied by audacity but using different
|
||||
// block-sizes. This should give high confidence that we don't
|
||||
// suffer from end-effects on buffers, e.g. losing one sample on
|
||||
// each buffer.
|
||||
|
|
12
src/FFmpeg.h
12
src/FFmpeg.h
|
@ -35,7 +35,7 @@ Describes shared object that is used to access FFmpeg libraries.
|
|||
|
||||
#if defined(USE_FFMPEG)
|
||||
extern "C" {
|
||||
// Include errno.h before the ffmpeg includes since they depend on
|
||||
// Include errno.h before the ffmpeg includes since they depend on
|
||||
// knowing the value of EINVAL...see bottom of avcodec.h. Not doing
|
||||
// so will produce positive error returns when they should be < 0.
|
||||
#include <errno.h>
|
||||
|
@ -369,7 +369,7 @@ private:
|
|||
wxString mAVCodecVersion;
|
||||
wxString mAVFormatVersion;
|
||||
wxString mAVUtilVersion;
|
||||
|
||||
|
||||
///! wx interfaces for dynamic libraries
|
||||
wxDynamicLibrary *avformat;
|
||||
wxDynamicLibrary *avcodec;
|
||||
|
@ -401,7 +401,7 @@ typedef struct _streamContext
|
|||
AVPacket m_pkt; // the last AVPacket we read for this stream
|
||||
int m_pktValid; // is m_pkt valid?
|
||||
uint8_t *m_pktDataPtr; // pointer into m_pkt.data
|
||||
int m_pktRemainingSiz;
|
||||
int m_pktRemainingSiz;
|
||||
|
||||
int64_t m_pts; // the current presentation time of the input stream
|
||||
int64_t m_ptsOffset; // packets associated with stream are relative to this
|
||||
|
@ -450,7 +450,7 @@ extern "C" {
|
|||
// make sure that the definitions are the same. If not, it will complain. For this to occur,
|
||||
// the functions MUST be defined in an extern "C" block otherwise the compiler just thinks the
|
||||
// functions are being overloaded.
|
||||
//
|
||||
//
|
||||
// The compiler should optimize away the inline function since it just passes control to the real
|
||||
// function and we should wind up with about the same function call we had before, only now it is
|
||||
// safer due to the validation.
|
||||
|
@ -525,7 +525,7 @@ extern "C" {
|
|||
} \
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// libavutil
|
||||
//
|
||||
FFMPEG_FUNCTION_WITH_RETURN(
|
||||
|
@ -535,7 +535,7 @@ extern "C" {
|
|||
()
|
||||
);
|
||||
FFMPEG_FUNCTION_NO_RETURN(
|
||||
av_log_set_callback,
|
||||
av_log_set_callback,
|
||||
(void (*cb)(void*, int, const char*, va_list)),
|
||||
(cb)
|
||||
);
|
||||
|
|
|
@ -72,7 +72,7 @@ unsigned int sf_header_index_to_type(int i)
|
|||
int sf_num_encodings()
|
||||
{
|
||||
int count ;
|
||||
|
||||
|
||||
sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int)) ;
|
||||
|
||||
return count;
|
||||
|
@ -108,7 +108,7 @@ unsigned int sf_encoding_index_to_subtype(int i)
|
|||
wxString sf_header_name(int format)
|
||||
{
|
||||
SF_FORMAT_INFO format_info;
|
||||
|
||||
|
||||
memset(&format_info, 0, sizeof(format_info));
|
||||
format_info.format = (format & SF_FORMAT_TYPEMASK);
|
||||
sf_command(NULL, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info));
|
||||
|
@ -122,7 +122,7 @@ wxString sf_header_shortname(int format)
|
|||
char *tmp;
|
||||
int i;
|
||||
wxString s;
|
||||
|
||||
|
||||
memset(&format_info, 0, sizeof(format_info));
|
||||
format_info.format = (format & SF_FORMAT_TYPEMASK);
|
||||
sf_command(NULL, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info));
|
||||
|
@ -147,7 +147,7 @@ wxString sf_header_shortname(int format)
|
|||
wxString sf_header_extension(int format)
|
||||
{
|
||||
SF_FORMAT_INFO format_info;
|
||||
|
||||
|
||||
memset(&format_info, 0, sizeof(format_info));
|
||||
format_info.format = (format & SF_FORMAT_TYPEMASK);
|
||||
sf_command(NULL, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info));
|
||||
|
@ -158,7 +158,7 @@ wxString sf_header_extension(int format)
|
|||
wxString sf_encoding_name(int encoding)
|
||||
{
|
||||
SF_FORMAT_INFO format_info;
|
||||
|
||||
|
||||
memset(&format_info, 0, sizeof(format_info));
|
||||
format_info.format = (encoding & SF_FORMAT_SUBMASK);
|
||||
sf_command(NULL, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info));
|
||||
|
@ -169,7 +169,7 @@ wxString sf_encoding_name(int encoding)
|
|||
int sf_num_simple_formats()
|
||||
{
|
||||
int count ;
|
||||
|
||||
|
||||
sf_command (NULL, SFC_GET_SIMPLE_FORMAT_COUNT, &count, sizeof (int)) ;
|
||||
|
||||
return count;
|
||||
|
@ -204,7 +204,7 @@ bool sf_subtype_is_integer(unsigned int format)
|
|||
subtype == SF_FORMAT_PCM_24 ||
|
||||
subtype == SF_FORMAT_PCM_32);
|
||||
}
|
||||
|
||||
|
||||
wxArrayString sf_get_all_extensions()
|
||||
{
|
||||
wxArrayString exts;
|
||||
|
@ -212,7 +212,7 @@ wxArrayString sf_get_all_extensions()
|
|||
int count, k;
|
||||
|
||||
memset(&format_info, 0, sizeof(format_info));
|
||||
|
||||
|
||||
sf_command(NULL, SFC_GET_FORMAT_MAJOR_COUNT,
|
||||
&count, sizeof(count));
|
||||
|
||||
|
@ -220,7 +220,7 @@ wxArrayString sf_get_all_extensions()
|
|||
format_info.format = k;
|
||||
sf_command(NULL, SFC_GET_FORMAT_MAJOR,
|
||||
&format_info, sizeof (format_info)) ;
|
||||
|
||||
|
||||
exts.Add(LAT1CTOWX(format_info.extension));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
// enumerating headers
|
||||
//
|
||||
|
||||
/** @brief Get the number of container formats supported by libsndfile
|
||||
/** @brief Get the number of container formats supported by libsndfile
|
||||
*
|
||||
* Uses SFC_GET_FORMAT_MAJOR_COUNT in sf_command interface */
|
||||
int sf_num_headers();
|
||||
|
||||
/** @brief Get the name of a container format from libsndfile
|
||||
/** @brief Get the name of a container format from libsndfile
|
||||
*
|
||||
* Uses SFC_GET_FORMAT_MAJOR in the sf_command() interface. Resulting C string
|
||||
* from libsndfile is converted to a wxString
|
||||
* from libsndfile is converted to a wxString
|
||||
* @param format_num The libsndfile format number for the container format
|
||||
* required
|
||||
*/
|
||||
|
@ -54,7 +54,7 @@ unsigned int sf_encoding_index_to_subtype(int encoding_num);
|
|||
/** @brief Get the string name of the specified container format
|
||||
*
|
||||
* AND format with SF_FORMAT_TYPEMASK to get only the container format and
|
||||
* then use SFC_GET_FORMAT_INFO to get the description
|
||||
* then use SFC_GET_FORMAT_INFO to get the description
|
||||
* @param format the libsndfile format to get the name for (only the container
|
||||
* part is used) */
|
||||
wxString sf_header_name(int format);
|
||||
|
@ -75,7 +75,7 @@ wxString sf_header_extension(int format);
|
|||
/** @brief Get the string name of the specified data encoding
|
||||
*
|
||||
* AND encoding_num with SF_FORMAT_SUBMASK to get only the data encoding and
|
||||
* then use SFC_GET_FORMAT_INFO to get the description
|
||||
* then use SFC_GET_FORMAT_INFO to get the description
|
||||
* @param encoding_num the libsndfile encoding to get the name for (only the
|
||||
* data encoding is used) */
|
||||
wxString sf_encoding_name(int encoding_num);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
|
||||
FileIO.cpp
|
||||
|
||||
|
||||
Leland Lucius
|
||||
|
||||
**********************************************************************/
|
||||
|
@ -72,7 +72,7 @@ void FileIO::Close()
|
|||
|
||||
// MacOS: set the file type/creator so that the OS knows it's an MP3
|
||||
// file which was created by Audacity
|
||||
|
||||
|
||||
void FileIO::SetCatalogInfo()
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
|
@ -124,6 +124,6 @@ wxOutputStream & FileIO::Write(const void *buf, size_t size)
|
|||
if (mOutputStream == NULL) {
|
||||
return *mOutputStream;
|
||||
}
|
||||
|
||||
|
||||
return mOutputStream->Write(buf, size);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
|
||||
FileIO.h
|
||||
|
||||
|
||||
Leland Lucius
|
||||
|
||||
**********************************************************************/
|
||||
|
@ -28,7 +28,7 @@ class FileIO
|
|||
~FileIO();
|
||||
|
||||
bool IsOpened();
|
||||
|
||||
|
||||
void Close();
|
||||
|
||||
wxInputStream & Read(void *buffer, size_t size);
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
\class FileNames
|
||||
\brief Provides Static functions to yield filenames.
|
||||
|
||||
This class helps us with setting a base path, and makes it easier
|
||||
for us to keep track of the different kinds of files we read and write
|
||||
This class helps us with setting a base path, and makes it easier
|
||||
for us to keep track of the different kinds of files we read and write
|
||||
from.
|
||||
|
||||
JKC: In time I plan to add all file names and file extensions
|
||||
|
@ -53,7 +53,7 @@ wxString FileNames::MkDir(const wxString &Str)
|
|||
|
||||
/// Returns the directory used for temp files.
|
||||
/// \todo put a counter in here to see if it gets used a lot.
|
||||
/// if it does, then maybe we should cache the path name
|
||||
/// if it does, then maybe we should cache the path name
|
||||
/// each time.
|
||||
wxString FileNames::TempDir()
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ wxString FileNames::DataDir()
|
|||
exePath.RemoveLastDir();
|
||||
#endif
|
||||
wxFileName portablePrefsPath(exePath.GetPath(), wxT("Portable Settings"));
|
||||
|
||||
|
||||
if (::wxDirExists(portablePrefsPath.GetFullPath()))
|
||||
{
|
||||
// Use "Portable Settings" folder
|
||||
|
@ -121,7 +121,7 @@ wxString FileNames::DataDir()
|
|||
gDataDir = FileNames::MkDir(dataDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return gDataDir;
|
||||
}
|
||||
|
||||
|
@ -133,16 +133,16 @@ wxString FileNames::HtmlHelpDir()
|
|||
exePath.RemoveLastDir();
|
||||
exePath.RemoveLastDir();
|
||||
exePath.RemoveLastDir();
|
||||
|
||||
|
||||
return wxFileName( exePath.GetPath()+wxT("/help/manual"), wxEmptyString ).GetFullPath();
|
||||
#else
|
||||
//linux goes into /*prefix*/share/audacity/
|
||||
//windows goes into the dir containing the .exe
|
||||
wxString exeDir = wxStandardPaths::Get().GetDataDir();
|
||||
|
||||
|
||||
//for mac this puts us within the .app: Audacity.app/Contents/SharedSupport/
|
||||
return wxFileName( exeDir+wxT("/help/manual"), wxEmptyString ).GetFullPath();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
wxString FileNames::HtmlHelpIndexFile(bool quick)
|
||||
|
@ -236,7 +236,7 @@ wxString FileNames::PathFromAddr(void *addr)
|
|||
}
|
||||
#elif defined(__WXMSW__) && defined(_UNICODE)
|
||||
// The GetModuleHandlEx() function did not appear until Windows XP and
|
||||
// GetModuleFileName() did appear until Windows 2000, so we have to
|
||||
// GetModuleFileName() did appear until Windows 2000, so we have to
|
||||
// check for them at runtime.
|
||||
typedef BOOL (WINAPI *getmodulehandleex)(DWORD dwFlags, LPCWSTR lpModuleName, HMODULE* phModule);
|
||||
typedef DWORD (WINAPI *getmodulefilename)(HMODULE hModule, LPWCH lpFilename, DWORD nSize);
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
private:
|
||||
// Private constructors: No one is ever going to instantiate it.
|
||||
//
|
||||
//
|
||||
FileNames(){;};
|
||||
~FileNames(){;};
|
||||
};
|
||||
|
|
|
@ -432,7 +432,7 @@ void FreqWindow::GetAudio()
|
|||
}
|
||||
t = iter.Next();
|
||||
}
|
||||
|
||||
|
||||
if (selcount == 0)
|
||||
return;
|
||||
|
||||
|
@ -477,7 +477,7 @@ void FreqWindow::DrawPlot()
|
|||
}
|
||||
|
||||
mBitmap = new wxBitmap(mUpdateRect.width, mUpdateRect.height);
|
||||
|
||||
|
||||
wxMemoryDC memDC;
|
||||
memDC.SelectObject(*mBitmap);
|
||||
|
||||
|
|
|
@ -186,12 +186,12 @@ static wxString HelpTextBuiltIn( const wxString & Key )
|
|||
wxString(wxT("")) +
|
||||
_("<center><h3>How to Get Help</h3></center>") +
|
||||
_("Welcome to Audacity ") + AUDACITY_VERSION_STRING + wxT("!<p>") +
|
||||
_("These are our support methods:") + wxT("</p>") + wxT("<ul><li>") +
|
||||
_("These are our support methods:") + wxT("</p>") + wxT("<ul><li>") +
|
||||
_(" [[file:quick_help.html|Quick Help]] (should be installed locally, <a href=\"http://manual.audacityteam.org/o/quick_help.html\">Internet version if it isn't</a>)") + wxT("</li><li>") +
|
||||
_(" [[file:index.html|Manual]] (should be installed locally, <a href=\"http://manual.audacityteam.org/o/\">Internet version if it isn't</a>)") + wxT("</li><li>") +
|
||||
_(" [[http://wiki.audacityteam.org/index.php|Wiki]] (the latest tips, tricks and tutorials, on the Internet)") + wxT("</li><li>") +
|
||||
_(" <a href=\"http://forum.audacityteam.org/\">Forum</a> (ask your question directly, on the Internet)") + wxT("</li></ul></p><p>") +
|
||||
_(" For even quicker answers, all the online resources above are <b>searchable</b>.") + wxT("</p>")
|
||||
_(" For even quicker answers, all the online resources above are <b>searchable</b>.") + wxT("</p>")
|
||||
);
|
||||
}
|
||||
if(Key==wxT("wma-proprietary"))
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
*******************************************************************//*!
|
||||
|
||||
\class HistoryWindow
|
||||
\brief Works with UndoManager to allow user to see descriptions of
|
||||
and undo previous commands. Also allows you to selectively clear the
|
||||
\brief Works with UndoManager to allow user to see descriptions of
|
||||
and undo previous commands. Also allows you to selectively clear the
|
||||
undo memory so as to free up space.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
@ -116,10 +116,10 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
|
|||
S.EndVerticalLay();
|
||||
// ----------------------- End of main section --------------
|
||||
|
||||
// Vaughan, 2010-07-30: AudacityProject::OnHistory always calls Show()
|
||||
// Vaughan, 2010-07-30: AudacityProject::OnHistory always calls Show()
|
||||
// then HistoryWindow::UpdateDisplay, so no need to do it here.
|
||||
// Vaughan, 2010-10-16: Not on Windows, anyway.
|
||||
// But Steve reported that on Ubuntu, View > History now crashes,
|
||||
// Vaughan, 2010-10-16: Not on Windows, anyway.
|
||||
// But Steve reported that on Ubuntu, View > History now crashes,
|
||||
// so restore it for non-Windows.
|
||||
#ifdef __WXGTK__
|
||||
DoUpdate();
|
||||
|
@ -151,7 +151,7 @@ void HistoryWindow::DoUpdate()
|
|||
mSelected = mManager->GetCurrentState() - 1;
|
||||
for (i = 0; i < (int)mManager->GetNumStates(); i++) {
|
||||
wxString desc, size;
|
||||
|
||||
|
||||
mManager->GetLongDescription(i + 1, &desc, &size);
|
||||
mList->InsertItem(i, desc, i == mSelected ? 1 : 0);
|
||||
mList->SetItem(i, 1, size);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Audacity: A Digital Audio Editor
|
||||
|
||||
ImageManipulation.cpp
|
||||
|
||||
|
||||
Dominic Mazzoni
|
||||
James Crook
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
|||
Provides Image Manipulation functions.
|
||||
|
||||
wxWidgets misses some important functions involving cutting and
|
||||
pasting bitmaps, and (in version 2.6.1) is patchy in support of alpha
|
||||
pasting bitmaps, and (in version 2.6.1) is patchy in support of alpha
|
||||
channel. This collection of functions fills that gap.
|
||||
|
||||
*//*********************************************************************/
|
||||
|
@ -27,10 +27,10 @@ channel. This collection of functions fills that gap.
|
|||
#include "ImageManipulation.h"
|
||||
|
||||
/// This looks at the first pixel in the image, and shifts
|
||||
/// the entire image by the vector difference between that
|
||||
/// the entire image by the vector difference between that
|
||||
/// pixel and the dstColour. For better control, use
|
||||
/// ChangeImageColour(wxImage, wxColour*, wxColour*) below
|
||||
wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour)
|
||||
wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour)
|
||||
{
|
||||
unsigned char *src = srcImage->GetData();
|
||||
wxColour c;
|
||||
|
@ -39,10 +39,10 @@ wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour)
|
|||
}
|
||||
|
||||
///This will explicitly shift the image color from
|
||||
///srcColour to dstColour.
|
||||
///srcColour to dstColour.
|
||||
wxImage *ChangeImageColour(wxImage * srcImage,
|
||||
wxColour & srcColour,
|
||||
wxColour & dstColour)
|
||||
wxColour & dstColour)
|
||||
{
|
||||
// This function takes a source image, which it assumes to
|
||||
// be grayscale, and smoothly changes the overall color
|
||||
|
@ -99,7 +99,7 @@ wxImage *ChangeImageColour(wxImage * srcImage,
|
|||
/// overlaid onto the background using alpha-blending,
|
||||
/// at location (xoff, yoff).
|
||||
wxImage *OverlayImage(wxImage * background, wxImage * foreground,
|
||||
wxImage * mask, int xoff, int yoff)
|
||||
wxImage * mask, int xoff, int yoff)
|
||||
{
|
||||
unsigned char *bg = background->GetData();
|
||||
unsigned char *fg = foreground->GetData();
|
||||
|
@ -115,7 +115,7 @@ wxImage *OverlayImage(wxImage * background, wxImage * foreground,
|
|||
|
||||
//Now, determine the dimensions of the images to be masked together
|
||||
//on top of the background. This should be equal to the area of the
|
||||
//smaller of the foreground and the mask, as long as it is
|
||||
//smaller of the foreground and the mask, as long as it is
|
||||
//within the area of the background, given the offset.
|
||||
|
||||
//Make sure the foreground size is no bigger than the mask
|
||||
|
@ -138,7 +138,7 @@ wxImage *OverlayImage(wxImage * background, wxImage * foreground,
|
|||
// Go through the foreground image bit by bit and mask it on to the
|
||||
// background, at an offset of xoff,yoff.
|
||||
// BUT...Don't go beyond the size of the background image,
|
||||
// the foreground image, or the mask
|
||||
// the foreground image, or the mask
|
||||
int x, y;
|
||||
for (y = 0; y < hCutoff; y++) {
|
||||
|
||||
|
@ -151,11 +151,11 @@ wxImage *OverlayImage(wxImage * background, wxImage * foreground,
|
|||
int opp = 255 - value;
|
||||
|
||||
for (int c = 0; c < 3; c++)
|
||||
dstp[x * 3 + c] =
|
||||
((bkp[x * 3 + c] * opp) +
|
||||
dstp[x * 3 + c] =
|
||||
((bkp[x * 3 + c] * opp) +
|
||||
(fg[3 * (y * fgWidth + x) + c] * value)) / 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dstImage;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ wxImage *OverlayImage(teBmps eBack, teBmps eForeground,
|
|||
|
||||
//Now, determine the dimensions of the images to be masked together
|
||||
//on top of the background. This should be equal to the area of the
|
||||
//smaller of the foreground and the mask, as long as it is
|
||||
//smaller of the foreground and the mask, as long as it is
|
||||
//within the area of the background, given the offset.
|
||||
|
||||
//Make sure the foreground size is no bigger than the mask
|
||||
|
@ -212,7 +212,7 @@ wxImage *OverlayImage(teBmps eBack, teBmps eForeground,
|
|||
// Go through the foreground image bit by bit and mask it on to the
|
||||
// background, at an offset of xoff,yoff.
|
||||
// BUT...Don't go beyond the size of the background image,
|
||||
// the foreground image, or the mask
|
||||
// the foreground image, or the mask
|
||||
int x, y;
|
||||
for (y = 0; y < hCutoff; y++) {
|
||||
|
||||
|
@ -225,11 +225,11 @@ wxImage *OverlayImage(teBmps eBack, teBmps eForeground,
|
|||
int opp = 255 - value;
|
||||
|
||||
for (int c = 0; c < 3; c++)
|
||||
dstp[x * 3 + c] =
|
||||
((bkp[x * 3 + c] * opp) +
|
||||
dstp[x * 3 + c] =
|
||||
((bkp[x * 3 + c] * opp) +
|
||||
(fg[3 * (y * fgWidth + x) + c] * value)) / 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dstImage;
|
||||
}
|
||||
|
||||
|
@ -293,8 +293,8 @@ void PasteSubImage( wxImage * background, wxImage * foreground, int xoff, int yo
|
|||
|
||||
unsigned char *bg = background->GetData();
|
||||
unsigned char *fg = foreground->GetData();
|
||||
unsigned char *bgAlpha = background->HasAlpha() ? background->GetAlpha() : NULL;
|
||||
unsigned char *fgAlpha = foreground->HasAlpha() ? foreground->GetAlpha() : NULL;
|
||||
unsigned char *bgAlpha = background->HasAlpha() ? background->GetAlpha() : NULL;
|
||||
unsigned char *fgAlpha = foreground->HasAlpha() ? foreground->GetAlpha() : NULL;
|
||||
// For testing... Set as if no alpha in foreground....
|
||||
// fgAlpha = NULL;
|
||||
|
||||
|
@ -340,7 +340,7 @@ void PasteSubImage( wxImage * background, wxImage * foreground, int xoff, int yo
|
|||
memset( bgAlphap, 255, wCutoff );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets a rectangle from within another image, INCLUDING the alpha channel
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
Audacity: A Digital Audio Editor
|
||||
|
||||
ImageManipulation.h
|
||||
|
||||
|
||||
Dominic Mazzoni
|
||||
|
||||
**********************************************************************/
|
||||
**********************************************************************/
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/colour.h>
|
||||
|
@ -15,10 +15,10 @@
|
|||
class wxImage;
|
||||
|
||||
// This looks at the first pixel in the image, and shifts
|
||||
// the entire image by the vector difference between that
|
||||
// the entire image by the vector difference between that
|
||||
// pixel and the dstColour. For better control, use
|
||||
// ChangeImageColour(wxImage, wxColour*, wxColour*) below
|
||||
wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour);
|
||||
wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour);
|
||||
|
||||
// This function takes a source image, which it assumes to
|
||||
// be grayscale, and smoothly changes the overall color
|
||||
|
@ -30,7 +30,7 @@ wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour);
|
|||
wxImage *ChangeImageColour(wxImage * srcImage,
|
||||
wxColour & srcColour,
|
||||
wxColour & dstColour);
|
||||
|
||||
|
||||
// Takes a background image, foreground image, and mask
|
||||
// (i.e. the alpha channel for the foreground), and
|
||||
// returns an new image where the foreground has been
|
||||
|
|
|
@ -20,7 +20,7 @@ and on Mac OS X for the filesystem.
|
|||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/filename.h>
|
||||
|
@ -97,17 +97,17 @@ wxString Internat::ToDisplayString(double numberToConvert,
|
|||
if (digitsAfterDecimalPoint == -1)
|
||||
{
|
||||
result.Printf(wxT("%f"), numberToConvert);
|
||||
|
||||
|
||||
// Not all libcs respect the decimal separator, so always convert
|
||||
// any dots found to the decimal separator.
|
||||
result.Replace(wxT("."), decSep);
|
||||
|
||||
|
||||
if (result.Find(decSep) != -1)
|
||||
{
|
||||
// Strip trailing zeros, but leave one, and decimal separator.
|
||||
// Strip trailing zeros, but leave one, and decimal separator.
|
||||
int pos = result.Length() - 1;
|
||||
while ((pos > 1) &&
|
||||
(result.GetChar(pos) == wxT('0')) &&
|
||||
while ((pos > 1) &&
|
||||
(result.GetChar(pos) == wxT('0')) &&
|
||||
(result.GetChar(pos - 1) != decSep))
|
||||
pos--;
|
||||
// (Previous code removed all of them and decimal separator.)
|
||||
|
@ -115,13 +115,13 @@ wxString Internat::ToDisplayString(double numberToConvert,
|
|||
// pos--; // strip point before empty fractional part
|
||||
result = result.Left(pos+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString format;
|
||||
format.Printf(wxT("%%.%if"), digitsAfterDecimalPoint);
|
||||
result.Printf(format, numberToConvert);
|
||||
|
||||
|
||||
// Not all libcs respect the decimal separator, so always convert
|
||||
// any dots found to the decimal separator
|
||||
result.Replace(wxT("."), decSep);
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
* remove them */
|
||||
static wxString SanitiseFilename(const wxString &name, const wxString &sub);
|
||||
|
||||
/** \brief Remove accelerator charactors from strings
|
||||
/** \brief Remove accelerator charactors from strings
|
||||
*
|
||||
* Utility function - takes a translatable string to be used as a menu item,
|
||||
* for example _("&Splash...\tAlt+S"), and strips all of the menu
|
||||
|
|
|
@ -106,7 +106,7 @@ LabelDialog::LabelDialog(wxWindow *parent,
|
|||
wxBoxSizer *vs = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
// A little instruction
|
||||
wxStaticText *instruct =
|
||||
wxStaticText *instruct =
|
||||
new wxStaticText(this,
|
||||
wxID_ANY,
|
||||
_("Press F2 or double click to edit cell contents."));
|
||||
|
@ -538,7 +538,7 @@ void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event))
|
|||
// into it
|
||||
LabelTrack *lt = new LabelTrack(mDirManager);
|
||||
lt->Import(f);
|
||||
|
||||
|
||||
// Add the labesls to our collection
|
||||
AddLabels(lt);
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class LabelDialog:public wxDialog
|
|||
TimeEditor *mTimeEditor;
|
||||
|
||||
RowDataArray mData;
|
||||
|
||||
|
||||
DirManager *mDirManager;
|
||||
TrackList *mTracks;
|
||||
ViewInfo *mViewInfo;
|
||||
|
|
|
@ -68,7 +68,7 @@ bool LabelTrack::mbGlyphsReady=false;
|
|||
|
||||
/// We have several variants of the icons (highlighting).
|
||||
/// The icons are draggable, and you can drag one boundary
|
||||
/// or all boundaries at the same timecode depending on whether you
|
||||
/// or all boundaries at the same timecode depending on whether you
|
||||
/// click the centre (for all) or the arrow part (for one).
|
||||
/// Currently we have twelve variants but we're only using six.
|
||||
wxBitmap LabelTrack::mBoundaryGlyphs[ NUM_GLYPH_CONFIGS * NUM_GLYPH_HIGHLIGHTS ];
|
||||
|
@ -128,7 +128,7 @@ LabelTrack::LabelTrack(const LabelTrack &orig) :
|
|||
mLabels.Add(l);
|
||||
}
|
||||
mSelIndex = orig.mSelIndex;
|
||||
|
||||
|
||||
// reset flags
|
||||
ResetFlags();
|
||||
}
|
||||
|
@ -237,11 +237,11 @@ double LabelTrack::AdjustTimeStampOnScale(double t, double b, double e, double c
|
|||
{
|
||||
//t is the time stamp we'll be changing
|
||||
//b and e are the selection start and end
|
||||
|
||||
|
||||
if (t < b){
|
||||
return t;
|
||||
}else if (t > e){
|
||||
double shift = (e-b)*change - (e-b);
|
||||
double shift = (e-b)*change - (e-b);
|
||||
return t + shift;
|
||||
}else{
|
||||
double shift = (t-b)*change - (t-b);
|
||||
|
@ -288,7 +288,7 @@ void LabelTrack::ResetFont()
|
|||
}
|
||||
}
|
||||
|
||||
/// ComputeTextPosition is 'smart' about where to display
|
||||
/// ComputeTextPosition is 'smart' about where to display
|
||||
/// the label text.
|
||||
///
|
||||
/// The text must be displayed between its endpoints x and x1
|
||||
|
@ -298,12 +298,12 @@ void LabelTrack::ResetFont()
|
|||
///
|
||||
/// This function has a number of tests and adjustments to the
|
||||
/// text start position. The tests later in the function will
|
||||
/// take priority over the ones earlier, so because centering
|
||||
/// is the first thing we do, it's the first thing we lose if
|
||||
/// take priority over the ones earlier, so because centering
|
||||
/// is the first thing we do, it's the first thing we lose if
|
||||
/// we can't do everything we want to.
|
||||
void LabelTrack::ComputeTextPosition(const wxRect & r, int index)
|
||||
{
|
||||
// xExtra is extra space
|
||||
// xExtra is extra space
|
||||
// between the text and the endpoints.
|
||||
const int xExtra=mIconWidth;
|
||||
int x = mLabels[index]->x; // left endpoint
|
||||
|
@ -318,10 +318,10 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index)
|
|||
bool bSimpleCentering = false;
|
||||
|
||||
//TODO (possibly):
|
||||
// Add configurable options as to when to use simple
|
||||
// Add configurable options as to when to use simple
|
||||
// and when complex centering.
|
||||
//
|
||||
// Simple centering does its best to keep the text
|
||||
// Simple centering does its best to keep the text
|
||||
// centered between the label limits.
|
||||
//
|
||||
// Complex centering positions the text proportionally
|
||||
|
@ -348,7 +348,7 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index)
|
|||
int rx0,rx1,xText0,xText1;
|
||||
|
||||
// Since we will be using a linear function,
|
||||
// we should blend smoothly between left and right
|
||||
// we should blend smoothly between left and right
|
||||
// aligned text as r, the 'viewport' moves.
|
||||
if( bTooWideForScreen )
|
||||
{
|
||||
|
@ -360,9 +360,9 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index)
|
|||
else
|
||||
{
|
||||
// when label start + width + extra spacing at viewport end..
|
||||
rx0=x-r.width+width+2*xExtra;
|
||||
rx0=x-r.width+width+2*xExtra;
|
||||
// ..text aligned left.
|
||||
xText0=x+xExtra;
|
||||
xText0=x+xExtra;
|
||||
// when viewport start + width + extra spacing at label end..
|
||||
rx1=x1-(width+2*xExtra);
|
||||
// ..text aligned right.
|
||||
|
@ -377,7 +377,7 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index)
|
|||
//
|
||||
// xText = xText0 + ((xText1-xText0)*(r.x-rx0))/(rx1-rx0);
|
||||
//
|
||||
// The problem with the above is that it integer-oveflows at
|
||||
// The problem with the above is that it integer-oveflows at
|
||||
// high zoom.
|
||||
|
||||
// Instead use:
|
||||
|
@ -396,7 +396,7 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index)
|
|||
}
|
||||
}
|
||||
|
||||
// Is the text now appearing partly outside r?
|
||||
// Is the text now appearing partly outside r?
|
||||
bool bOffLeft = xText < r.x+xExtra;
|
||||
bool bOffRight = xText > r.x+r.width-width-xExtra;
|
||||
|
||||
|
@ -405,7 +405,7 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index)
|
|||
if( bOffLeft == bOffRight )
|
||||
{
|
||||
//IF both sides on screen, THEN nothing to do.
|
||||
//IF both sides off screen THEN don't do
|
||||
//IF both sides off screen THEN don't do
|
||||
//anything about it.
|
||||
//(because if we did, you'd never get to read
|
||||
//all the text by scrolling).
|
||||
|
@ -427,10 +427,10 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index)
|
|||
|
||||
// But if we've taken the text out from its endpoints
|
||||
// we must move it back so that it's between the endpoints.
|
||||
|
||||
|
||||
// We test the left end point last because the
|
||||
// text might not even fit between the endpoints (at this
|
||||
// zoom factor), and in that case we'd like to position
|
||||
// zoom factor), and in that case we'd like to position
|
||||
// the text at the left end point.
|
||||
if( xText > (x1-width-xExtra))
|
||||
xText=(x1-width-xExtra);
|
||||
|
@ -465,7 +465,7 @@ void LabelTrack::ComputeLayout(const wxRect & r, double h, double pps)
|
|||
xUsed[i]=xStart;
|
||||
int nRowsUsed=0;
|
||||
|
||||
for (i = 0; i < (int)mLabels.Count(); i++)
|
||||
for (i = 0; i < (int)mLabels.Count(); i++)
|
||||
{
|
||||
int x = r.x + (int) ((mLabels[i]->t - h) * pps);
|
||||
int x1 = r.x + (int) ((mLabels[i]->t1 - h) * pps);
|
||||
|
@ -479,7 +479,7 @@ void LabelTrack::ComputeLayout(const wxRect & r, double h, double pps)
|
|||
// (This is to encourage merging of adjacent label boundaries).
|
||||
while( (iRow<nRowsUsed) && (xUsed[iRow] != x ))
|
||||
iRow++;
|
||||
// IF we didn't find one THEN
|
||||
// IF we didn't find one THEN
|
||||
// find any row that can take a span starting at x.
|
||||
if( iRow >= nRowsUsed )
|
||||
{
|
||||
|
@ -533,7 +533,7 @@ void LabelStruct::DrawLines(wxDC & dc, const wxRect & r)
|
|||
const int yIconStart = y - (LabelTrack::mIconHeight /2)+1+(LabelTrack::mTextHeight+3)/2;
|
||||
const int yIconEnd = yIconStart + LabelTrack::mIconHeight-2;
|
||||
|
||||
// If y is positive then it is the center line for the
|
||||
// If y is positive then it is the center line for the
|
||||
// Label.
|
||||
if( y >= 0 )
|
||||
{
|
||||
|
@ -572,21 +572,21 @@ void LabelStruct::DrawGlyphs(wxDC & dc, const wxRect & r, int GlyphLeft, int Gly
|
|||
|
||||
if((x >= r.x) && (x <= (r.x+r.width)))
|
||||
dc.DrawBitmap(LabelTrack::GetGlyph(GlyphLeft), x-xHalfWidth,yStart, true);
|
||||
// The extra test commented out here would suppress right hand markers
|
||||
// The extra test commented out here would suppress right hand markers
|
||||
// when they overlap the left hand marker (e.g. zoomed out) or to the left.
|
||||
if((x1 >= r.x) && (x1 <= (r.x+r.width)) /*&& (x1>x+LabelTrack::mIconWidth)*/)
|
||||
dc.DrawBitmap(LabelTrack::GetGlyph(GlyphRight), x1-xHalfWidth,yStart, true);
|
||||
}
|
||||
|
||||
/// Draw the text of the label and also draw
|
||||
/// a long thin rectangle for its full extent
|
||||
/// from x to x1 and a rectangular frame
|
||||
/// a long thin rectangle for its full extent
|
||||
/// from x to x1 and a rectangular frame
|
||||
/// behind the text itself.
|
||||
/// @param dc the device context
|
||||
/// @param r the LabelTrack rectangle.
|
||||
void LabelStruct::DrawText(wxDC & dc, const wxRect & r)
|
||||
{
|
||||
//If y is positive then it is the center line for the
|
||||
//If y is positive then it is the center line for the
|
||||
//text we are about to draw.
|
||||
//if it isn't, nothing to draw.
|
||||
|
||||
|
@ -609,9 +609,9 @@ void LabelStruct::DrawText(wxDC & dc, const wxRect & r)
|
|||
|
||||
}
|
||||
|
||||
void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r)
|
||||
void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r)
|
||||
{
|
||||
//If y is positive then it is the center line for the
|
||||
//If y is positive then it is the center line for the
|
||||
//text we are about to draw.
|
||||
const int yBarHeight=3;
|
||||
const int yFrameHeight = LabelTrack::mTextHeight+3;
|
||||
|
@ -626,8 +626,8 @@ void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r)
|
|||
|
||||
if( (xStart < (r.x+r.width)) && (xEnd > r.x) && (xWidth>0))
|
||||
{
|
||||
|
||||
wxRect bar( xStart,y-yBarHeight/2+yFrameHeight/2,
|
||||
|
||||
wxRect bar( xStart,y-yBarHeight/2+yFrameHeight/2,
|
||||
xWidth,yBarHeight);
|
||||
if( x1 > x+xBarShorten )
|
||||
dc.DrawRectangle(bar);
|
||||
|
@ -635,13 +635,13 @@ void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r)
|
|||
}
|
||||
|
||||
// In drawing the bar and the frame, we compute the clipping
|
||||
// to the viewport ourselves. Under Win98 the GDI does its
|
||||
// calculations in 16 bit arithmetic, and so gets it completely
|
||||
// wrong at higher zooms where the bar can easily be
|
||||
// to the viewport ourselves. Under Win98 the GDI does its
|
||||
// calculations in 16 bit arithmetic, and so gets it completely
|
||||
// wrong at higher zooms where the bar can easily be
|
||||
// more than 65536 pixels wide.
|
||||
|
||||
// Draw bar for label extent...
|
||||
// We don't quite draw from x to x1 because we allow
|
||||
// We don't quite draw from x to x1 because we allow
|
||||
// half an icon width at each end.
|
||||
{
|
||||
const int xStart=wxMax(r.x,xText-LabelTrack::mIconWidth/2);
|
||||
|
@ -660,10 +660,10 @@ void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r)
|
|||
|
||||
/// Draws text-selected region within the label
|
||||
void LabelStruct::DrawHighlight( wxDC & dc, int xPos1, int xPos2, int charHeight)
|
||||
{
|
||||
{
|
||||
highlighted = true;
|
||||
changeInitialMouseXPos = false;
|
||||
|
||||
|
||||
wxPen curPen = dc.GetPen();
|
||||
curPen.SetColour(wxString(wxT("BLUE")));
|
||||
wxBrush curBrush = dc.GetBrush();
|
||||
|
@ -674,7 +674,7 @@ void LabelStruct::DrawHighlight( wxDC & dc, int xPos1, int xPos2, int charHeight
|
|||
dc.DrawRectangle(xPos2-1, y-charHeight/2, xPos1-xPos2+1, charHeight);
|
||||
}
|
||||
|
||||
void LabelStruct::getXPos( wxDC & dc, int * xPos1, int cursorPos)
|
||||
void LabelStruct::getXPos( wxDC & dc, int * xPos1, int cursorPos)
|
||||
{
|
||||
*xPos1 = xText;
|
||||
if( cursorPos > 0)
|
||||
|
@ -730,7 +730,7 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
|
|||
// Get the text widths.
|
||||
// TODO: Make more efficient by only re-computing when a
|
||||
// text label title changes.
|
||||
for (i = 0; i < (int)mLabels.Count(); i++)
|
||||
for (i = 0; i < (int)mLabels.Count(); i++)
|
||||
{
|
||||
dc.GetTextExtent(mLabels[i]->title, &textWidth, &textHeight);
|
||||
mLabels[i]->width = textWidth;
|
||||
|
@ -738,12 +738,12 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
|
|||
|
||||
// TODO: And this only needs to be done once, but we
|
||||
// do need the dc to do it.
|
||||
// We need to set mTextHeight to something sensible,
|
||||
// We need to set mTextHeight to something sensible,
|
||||
// guarding against the case where there are no
|
||||
// labels or all are empty strings, which for example
|
||||
// happens with a new label track.
|
||||
dc.GetTextExtent(wxT("Demo Text x^y"), &textWidth, &textHeight);
|
||||
mTextHeight = (int)textHeight;
|
||||
mTextHeight = (int)textHeight;
|
||||
ComputeLayout( r, h , pps );
|
||||
dc.SetTextForeground(theTheme.Colour( clrLabelTrackText));
|
||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||
|
@ -756,13 +756,13 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
|
|||
// so that the correct things overpaint each other.
|
||||
|
||||
// Draw vertical lines that show where the end positions are.
|
||||
for (i = 0; i < nLabels; i++)
|
||||
for (i = 0; i < nLabels; i++)
|
||||
{
|
||||
mLabels[i]->DrawLines( dc, r );
|
||||
}
|
||||
|
||||
// Draw the end glyphs.
|
||||
for (i = 0; i < nLabels; i++)
|
||||
for (i = 0; i < nLabels; i++)
|
||||
{
|
||||
GlyphLeft=0;
|
||||
GlyphRight=1;
|
||||
|
@ -810,9 +810,9 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
|
|||
{
|
||||
i = mSelIndex;
|
||||
int xPos = mLabels[i]->xText;
|
||||
|
||||
|
||||
// if mouse is clicked in text box
|
||||
if (mMouseXPos != -1)
|
||||
if (mMouseXPos != -1)
|
||||
{
|
||||
// set current cursor position
|
||||
SetCurrentCursorPosition(dc, (int) mMouseXPos);
|
||||
|
@ -831,7 +831,7 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
|
|||
dc.GetTextExtent((mLabels[i]->title).Left(mCurrentCursorPos), &partWidth, NULL);
|
||||
xPos += partWidth;
|
||||
}
|
||||
|
||||
|
||||
// Draw the cursor
|
||||
wxPen currentPen = dc.GetPen();
|
||||
const int CursorWidth=2;
|
||||
|
@ -846,9 +846,9 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
|
|||
}
|
||||
|
||||
/// Set the cursor position according to x position of mouse
|
||||
/// uses GetTextExtent to find the character position
|
||||
/// uses GetTextExtent to find the character position
|
||||
/// corresponding to the x pixel position.
|
||||
void LabelTrack::SetCurrentCursorPosition(wxDC & dc, int xPos)
|
||||
void LabelTrack::SetCurrentCursorPosition(wxDC & dc, int xPos)
|
||||
{
|
||||
// A bool indicator to see if set the cursor position or not
|
||||
bool finished = false;
|
||||
|
@ -857,42 +857,42 @@ void LabelTrack::SetCurrentCursorPosition(wxDC & dc, int xPos)
|
|||
int oneWidth;
|
||||
double bound;
|
||||
wxString subString;
|
||||
while (!finished && (charIndex < (int)mLabels[mSelIndex]->title.length() + 1))
|
||||
while (!finished && (charIndex < (int)mLabels[mSelIndex]->title.length() + 1))
|
||||
{
|
||||
subString = (mLabels[mSelIndex]->title).Left(charIndex);
|
||||
// Get the width of substring
|
||||
dc.GetTextExtent(subString, &partWidth, NULL);
|
||||
if (charIndex > 1)
|
||||
if (charIndex > 1)
|
||||
{
|
||||
// Get the width of the last character
|
||||
dc.GetTextExtent(subString.Right(1), &oneWidth, NULL);
|
||||
bound = mLabels[mSelIndex]->xText + partWidth - oneWidth * 0.5;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
bound = mLabels[mSelIndex]->xText + partWidth * 0.5;
|
||||
}
|
||||
|
||||
if (xPos <= bound)
|
||||
if (xPos <= bound)
|
||||
{
|
||||
// Found
|
||||
mCurrentCursorPos = charIndex - 1;
|
||||
finished = true;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
// Advance
|
||||
charIndex++;
|
||||
}
|
||||
}
|
||||
if (!finished)
|
||||
if (!finished)
|
||||
{
|
||||
// Cursor should be in the last position
|
||||
mCurrentCursorPos = mLabels[mSelIndex]->title.length();
|
||||
}
|
||||
}
|
||||
|
||||
void LabelTrack::calculateFontHeight(wxDC & dc)
|
||||
void LabelTrack::calculateFontHeight(wxDC & dc)
|
||||
{
|
||||
int charDescent;
|
||||
int charLeading;
|
||||
|
@ -900,7 +900,7 @@ void LabelTrack::calculateFontHeight(wxDC & dc)
|
|||
// Calculate the width of the substring and add it to Xpos
|
||||
dc.GetTextExtent(wxT("(Test String)|[yp]"), NULL, &mFontHeight, &charDescent, &charLeading);
|
||||
|
||||
// The cursor will have height charHeight. We don't include the descender as
|
||||
// The cursor will have height charHeight. We don't include the descender as
|
||||
// part of the height because for phonetic fonts this leads to cursors which are
|
||||
// too tall. We don't include leading either - it is usually 0.
|
||||
// To make up for ignoring the descender height, we add one pixel above and below
|
||||
|
@ -923,7 +923,7 @@ bool LabelTrack::IsTextSelected()
|
|||
|
||||
/// Cut the selected text in the text box
|
||||
/// @return true if text is selected in text box, false otherwise
|
||||
bool LabelTrack::CutSelectedText()
|
||||
bool LabelTrack::CutSelectedText()
|
||||
{
|
||||
if (!IsTextSelected())
|
||||
return false;
|
||||
|
@ -954,7 +954,7 @@ bool LabelTrack::CutSelectedText()
|
|||
|
||||
// set title to the combination of the two remainders
|
||||
mLabels[mSelIndex]->title = left + right;
|
||||
|
||||
|
||||
// copy data onto clipboard
|
||||
if (wxTheClipboard->Open()) {
|
||||
#if defined(__WXGTK__) && defined(HAVE_GTK)
|
||||
|
@ -963,7 +963,7 @@ bool LabelTrack::CutSelectedText()
|
|||
wxTheClipboard->SetData(new wxTextDataObject(data));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
|
||||
|
||||
// set cursor positions
|
||||
mCurrentCursorPos = left.Length();
|
||||
mInitialCursorPos = mCurrentCursorPos;
|
||||
|
@ -972,7 +972,7 @@ bool LabelTrack::CutSelectedText()
|
|||
|
||||
/// Copy the selected text in the text box
|
||||
/// @return true if text is selected in text box, false otherwise
|
||||
bool LabelTrack::CopySelectedText()
|
||||
bool LabelTrack::CopySelectedText()
|
||||
{
|
||||
if (mSelIndex == -1)
|
||||
return false;
|
||||
|
@ -986,7 +986,7 @@ bool LabelTrack::CopySelectedText()
|
|||
cur = mInitialCursorPos;
|
||||
init = mCurrentCursorPos;
|
||||
}
|
||||
|
||||
|
||||
// data for copying
|
||||
wxString data = mLabels[mSelIndex]->title.Mid(init, cur-init);
|
||||
|
||||
|
@ -1013,7 +1013,7 @@ bool LabelTrack::PasteSelectedText(double sel0, double sel1)
|
|||
wxString text;
|
||||
wxString left=wxT("");
|
||||
wxString right=wxT("");
|
||||
|
||||
|
||||
// if text data is available
|
||||
if (IsTextClipSupported()) {
|
||||
if (wxTheClipboard->Open()) {
|
||||
|
@ -1051,9 +1051,9 @@ bool LabelTrack::PasteSelectedText(double sel0, double sel1)
|
|||
if (mCurrentCursorPos < (int)(mLabels[mSelIndex]->title).Length()) {
|
||||
right = (mLabels[mSelIndex]->title).Mid(mCurrentCursorPos, (mLabels[mSelIndex]->title).Length()-mCurrentCursorPos);
|
||||
}
|
||||
mLabels[mSelIndex]->title = left + text + right;
|
||||
mLabels[mSelIndex]->title = left + text + right;
|
||||
mCurrentCursorPos = left.Length() + text.Length();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// insert the data on the clipboard from the cursor position
|
||||
|
@ -1098,7 +1098,7 @@ bool LabelTrack::IsTextClipSupported()
|
|||
double LabelTrack::GetStartTime()
|
||||
{
|
||||
int len = mLabels.Count();
|
||||
|
||||
|
||||
if (len == 0)
|
||||
return 0.0;
|
||||
else
|
||||
|
@ -1112,7 +1112,7 @@ double LabelTrack::GetEndTime()
|
|||
int len = mLabels.Count();
|
||||
if (len == 0)
|
||||
return 0.0;
|
||||
|
||||
|
||||
double end = 0.0;
|
||||
for(int i = 0; i < len; i++)
|
||||
{
|
||||
|
@ -1121,10 +1121,10 @@ double LabelTrack::GetEndTime()
|
|||
}
|
||||
return end;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// OverGlyph returns 0 if not over a glyph,
|
||||
/// 1 if over the left-hand glyph, and
|
||||
/// 1 if over the left-hand glyph, and
|
||||
/// 2 if over the right-hand glyph on a label.
|
||||
/// 3 if over both right and left.
|
||||
///
|
||||
|
@ -1143,15 +1143,15 @@ int LabelTrack::OverGlyph(int x, int y)
|
|||
int result=0;
|
||||
const int d1=10; //distance in pixels, used for have we hit drag handle.
|
||||
const int d2=5; //distance in pixels, used for have we hit drag handle center.
|
||||
|
||||
|
||||
//If not over a label, reset it
|
||||
mMouseOverLabelLeft = -1;
|
||||
mMouseOverLabelRight = -1;
|
||||
mbHitCenter = false;
|
||||
for (int i = 0; i < (int)mLabels.Count(); i++)
|
||||
for (int i = 0; i < (int)mLabels.Count(); i++)
|
||||
{
|
||||
pLabel = mLabels[i];
|
||||
|
||||
|
||||
//over left or right selection bound
|
||||
//Check right bound first, since it is drawn after left bound,
|
||||
//so give it precedence for matching/highlighting.
|
||||
|
@ -1173,7 +1173,7 @@ int LabelTrack::OverGlyph(int x, int y)
|
|||
result |= 2;
|
||||
mInBox = false; // to disable the dragging for selecting the text in text box
|
||||
}
|
||||
// Use else-if here rather than else to avoid detecting left and right
|
||||
// Use else-if here rather than else to avoid detecting left and right
|
||||
// of the same label.
|
||||
else if( abs(pLabel->y - (y - (LabelTrack::mTextHeight+3)/2)) < d1 &&
|
||||
abs(pLabel->x + d2 - x) < d1 )
|
||||
|
@ -1196,9 +1196,9 @@ int LabelTrack::OverGlyph(int x, int y)
|
|||
}
|
||||
|
||||
// return true if the mouse is over text box, false otherwise
|
||||
bool LabelTrack::OverTextBox(const LabelStruct *pLabel, int x, int y)
|
||||
bool LabelTrack::OverTextBox(const LabelStruct *pLabel, int x, int y)
|
||||
{
|
||||
if( (pLabel->xText-(mIconWidth/2) < x) &&
|
||||
if( (pLabel->xText-(mIconWidth/2) < x) &&
|
||||
(x<pLabel->xText+pLabel->width+(mIconWidth/2)) &&
|
||||
(abs(pLabel->y-y)<mIconHeight/2))
|
||||
{
|
||||
|
@ -1357,7 +1357,7 @@ static int Constrain( int value, int min, int max )
|
|||
}
|
||||
|
||||
/// HandleMouse gets called with every mouse move or click.
|
||||
///
|
||||
///
|
||||
bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
||||
wxRect & r, double h, double pps,
|
||||
double *newSel0, double *newSel1)
|
||||
|
@ -1400,14 +1400,14 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
|||
}
|
||||
|
||||
if(evt.Dragging())
|
||||
{
|
||||
{
|
||||
// if dragging happens in text box
|
||||
if (mInBox) {
|
||||
// end dragging x position in pixels
|
||||
// set flag to update current cursor position
|
||||
mDragXPos = evt.m_x;
|
||||
mResetCursorPos = true;
|
||||
|
||||
|
||||
// if it's an invalid dragging, disable displaying
|
||||
if (mRightDragging) {
|
||||
mDragXPos = -1;
|
||||
|
@ -1415,7 +1415,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
|||
}
|
||||
}
|
||||
|
||||
//If we are currently adjusting a label,
|
||||
//If we are currently adjusting a label,
|
||||
//just reset its value and redraw.
|
||||
if(mIsAdjustingLabel ) // This guard is necessary but hides another bug. && mSelIndex != -1)
|
||||
{
|
||||
|
@ -1458,10 +1458,10 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
|||
|
||||
if( evt.ButtonDown())
|
||||
{
|
||||
//OverGlyph sets mMouseOverLabel to be the chosen label.
|
||||
//OverGlyph sets mMouseOverLabel to be the chosen label.
|
||||
int iGlyph = OverGlyph(evt.m_x, evt.m_y);
|
||||
mIsAdjustingLabel = iGlyph != 0;
|
||||
|
||||
|
||||
// reset mouseXPos if the mouse is pressed in the text box
|
||||
mMouseXPos = -1;
|
||||
mInBox = false;
|
||||
|
@ -1477,7 +1477,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
|||
highlightedRect = wxRect(mXPos2, mLabels[mSelIndex]->y - mFontHeight/2, (int) (mXPos1-mXPos2+0.5), mFontHeight);
|
||||
|
||||
// reset when left button is down
|
||||
if (evt.LeftDown())
|
||||
if (evt.LeftDown())
|
||||
mLabels[mSelIndex]->highlighted = false;
|
||||
// reset when right button is down outside text box
|
||||
if (evt.RightDown())
|
||||
|
@ -1501,22 +1501,22 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
|||
mbIsMoving = mbHitCenter;
|
||||
// When we start dragging the label(s) we don't want them to jump.
|
||||
// so we calculate the displacement of the mouse from the drag center
|
||||
// and use that in subsequent dragging calculations. The mouse stays
|
||||
// and use that in subsequent dragging calculations. The mouse stays
|
||||
// at the same relative displacement throughout dragging.
|
||||
|
||||
// However, if two label's edges are being dragged
|
||||
// then the displacement is relative to the initial average
|
||||
// position of them, and in that case there can be a jump of at most
|
||||
// a few pixels to bring the two label boundaries to exactly the same
|
||||
// then the displacement is relative to the initial average
|
||||
// position of them, and in that case there can be a jump of at most
|
||||
// a few pixels to bring the two label boundaries to exactly the same
|
||||
// position when we start dragging.
|
||||
|
||||
// Dragging of three label edges at the same time is not supported (yet).
|
||||
if( (mMouseOverLabelRight >=0) &&
|
||||
(mMouseOverLabelLeft >=0)
|
||||
if( (mMouseOverLabelRight >=0) &&
|
||||
(mMouseOverLabelLeft >=0)
|
||||
)
|
||||
{
|
||||
t = (mLabels[mMouseOverLabelRight]->t1+mLabels[mMouseOverLabelLeft]->t)/2.0f;
|
||||
// If we're moving two edges, then it's a move (label size preserved)
|
||||
// If we're moving two edges, then it's a move (label size preserved)
|
||||
// if both edges are the same label, and it's an adjust (label sizes change)
|
||||
// if we're on a boundary between two different labels.
|
||||
mbIsMoving = (mMouseOverLabelLeft == mMouseOverLabelRight);
|
||||
|
@ -1531,7 +1531,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
|||
}
|
||||
mxMouseDisplacement = (int)((((t-h) * pps) + r.x )-evt.m_x);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// disable displaying if left button is down
|
||||
if (evt.LeftDown())
|
||||
|
@ -1656,7 +1656,7 @@ bool LabelTrack::OnKeyDown(double & newSel0, double & newSel1, wxKeyEvent & even
|
|||
case WXK_BACK:
|
||||
{
|
||||
int len = mLabels[mSelIndex]->title.Length();
|
||||
|
||||
|
||||
//IF the label is not blank THEN get rid of a letter or letters according to cursor position
|
||||
if (len > 0)
|
||||
{
|
||||
|
@ -1687,7 +1687,7 @@ bool LabelTrack::OnKeyDown(double & newSel0, double & newSel1, wxKeyEvent & even
|
|||
case WXK_NUMPAD_DELETE:
|
||||
{
|
||||
int len = mLabels[mSelIndex]->title.Length();
|
||||
|
||||
|
||||
//If the label is not blank get rid of a letter according to cursor position
|
||||
if (len > 0)
|
||||
{
|
||||
|
@ -1796,13 +1796,13 @@ bool LabelTrack::OnKeyDown(double & newSel0, double & newSel1, wxKeyEvent & even
|
|||
}
|
||||
break;
|
||||
|
||||
case WXK_RETURN:
|
||||
case WXK_RETURN:
|
||||
case WXK_NUMPAD_ENTER:
|
||||
|
||||
case WXK_ESCAPE:
|
||||
case WXK_ESCAPE:
|
||||
mSelIndex = -1;
|
||||
break;
|
||||
|
||||
|
||||
case WXK_TAB:
|
||||
case WXK_NUMPAD_TAB:
|
||||
if (event.ShiftDown()) {
|
||||
|
@ -1810,7 +1810,7 @@ bool LabelTrack::OnKeyDown(double & newSel0, double & newSel1, wxKeyEvent & even
|
|||
} else {
|
||||
mSelIndex++;
|
||||
}
|
||||
|
||||
|
||||
if (mSelIndex >= 0 && mSelIndex < (int)mLabels.Count()) {
|
||||
mCurrentCursorPos = mLabels[mSelIndex]->title.Length();
|
||||
//Set the selection region to be equal to the selection bounds of the tabbed-to label.
|
||||
|
@ -1972,11 +1972,11 @@ bool LabelTrack::OnChar(double & WXUNUSED(newSel0), double & WXUNUSED(newSel1),
|
|||
return updated;
|
||||
}
|
||||
|
||||
void LabelTrack::RemoveSelectedText()
|
||||
void LabelTrack::RemoveSelectedText()
|
||||
{
|
||||
wxString left = wxT("");
|
||||
wxString right = wxT("");
|
||||
|
||||
|
||||
if (mInitialCursorPos > mCurrentCursorPos) {
|
||||
int temp = mCurrentCursorPos;
|
||||
mCurrentCursorPos = mInitialCursorPos;
|
||||
|
@ -2026,22 +2026,22 @@ void LabelTrack::Import(wxTextFile & in)
|
|||
wxString s,s1;
|
||||
wxString title;
|
||||
double t,t1;
|
||||
|
||||
|
||||
lines = in.GetLineCount();
|
||||
|
||||
|
||||
mLabels.Clear();
|
||||
mLabels.Alloc(lines);
|
||||
|
||||
|
||||
//Currently, we expect a tag file to have two values and a label
|
||||
//on each line. If the second token is not a number, we treat
|
||||
//it as a single-value label.
|
||||
for (index = 0; index < lines; index++) {
|
||||
currentLine = in.GetLine(index);
|
||||
|
||||
|
||||
len = currentLine.Length();
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
|
||||
//get the timepoint of the left edge of the label.
|
||||
i = 0;
|
||||
while (i < len && currentLine.GetChar(i) != wxT(' ')
|
||||
|
@ -2050,13 +2050,13 @@ void LabelTrack::Import(wxTextFile & in)
|
|||
i++;
|
||||
}
|
||||
s = currentLine.Left(i);
|
||||
|
||||
|
||||
if (!Internat::CompatibleToDouble(s, &t))
|
||||
return;
|
||||
|
||||
|
||||
//Increment one letter.
|
||||
i++;
|
||||
|
||||
|
||||
//Now, go until we find the start of the get the next token
|
||||
while (i < len
|
||||
&& (currentLine.GetChar(i) == wxT(' ')
|
||||
|
@ -2066,21 +2066,21 @@ void LabelTrack::Import(wxTextFile & in)
|
|||
}
|
||||
//Keep track of the start of the second token
|
||||
i2=i;
|
||||
|
||||
|
||||
//Now, go to the end of the second token.
|
||||
while (i < len && currentLine.GetChar(i) != wxT(' ')
|
||||
&& currentLine.GetChar(i) != wxT('\t'))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
//We are at the end of the second token.
|
||||
|
||||
//We are at the end of the second token.
|
||||
s1 = currentLine.Mid(i2,i-i2+1).Strip(wxString::stripType(0x3));
|
||||
if (!Internat::CompatibleToDouble(s1, &t1))
|
||||
{
|
||||
//s1 is not a number.
|
||||
t1 = t; //This is a one-sided label; t1 == t.
|
||||
|
||||
|
||||
//Because s1 is not a number, the label should be
|
||||
//The rest of the line, starting at i2;
|
||||
title = currentLine.Right(len - i2).Strip(wxString::stripType(0x3)); //0x3 indicates both
|
||||
|
@ -2088,12 +2088,12 @@ void LabelTrack::Import(wxTextFile & in)
|
|||
else
|
||||
{
|
||||
//s1 is a number, and it is stored correctly in t1.
|
||||
//The title should be the remainder of the line,
|
||||
//After we eat
|
||||
|
||||
//Get rid of spaces at either end
|
||||
//The title should be the remainder of the line,
|
||||
//After we eat
|
||||
|
||||
//Get rid of spaces at either end
|
||||
title = currentLine.Right(len - i).Strip(wxString::stripType(0x3)); //0x3 indicates both.
|
||||
|
||||
|
||||
}
|
||||
LabelStruct *l = new LabelStruct();
|
||||
l->t = t;
|
||||
|
@ -2117,17 +2117,17 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
while(*attrs) {
|
||||
const wxChar *attr = *attrs++;
|
||||
const wxChar *value = *attrs++;
|
||||
|
||||
|
||||
if (!value)
|
||||
break;
|
||||
|
||||
|
||||
const wxString strValue = value;
|
||||
if (!XMLValueChecker::IsGoodString(strValue))
|
||||
{
|
||||
delete l;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!wxStrcmp(attr, wxT("t")) && Internat::CompatibleToDouble(strValue, &dblValue))
|
||||
l->t = dblValue;
|
||||
else if (!wxStrcmp(attr, wxT("t1")) && Internat::CompatibleToDouble(strValue, &dblValue))
|
||||
|
@ -2154,15 +2154,15 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
while (*attrs) {
|
||||
const wxChar *attr = *attrs++;
|
||||
const wxChar *value = *attrs++;
|
||||
|
||||
|
||||
if (!value)
|
||||
return true;
|
||||
|
||||
const wxString strValue = value;
|
||||
if (!wxStrcmp(attr, wxT("name")) && XMLValueChecker::IsGoodString(strValue))
|
||||
mName = strValue;
|
||||
else if (!wxStrcmp(attr, wxT("numlabels")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
else if (!wxStrcmp(attr, wxT("numlabels")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
{
|
||||
if (nValue < 0)
|
||||
{
|
||||
|
@ -2172,13 +2172,13 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
mLabels.Clear();
|
||||
mLabels.Alloc(nValue);
|
||||
}
|
||||
else if (!wxStrcmp(attr, wxT("height")) &&
|
||||
else if (!wxStrcmp(attr, wxT("height")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
SetHeight(nValue);
|
||||
else if (!wxStrcmp(attr, wxT("minimized")) &&
|
||||
else if (!wxStrcmp(attr, wxT("minimized")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
SetMinimized(nValue != 0);
|
||||
else if (!wxStrcmp(attr, wxT("isSelected")) &&
|
||||
else if (!wxStrcmp(attr, wxT("isSelected")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
this->SetSelected(nValue != 0);
|
||||
}
|
||||
|
@ -2281,7 +2281,7 @@ bool LabelTrack::Cut(double t0, double t1, Track **dest)
|
|||
bool LabelTrack::SplitCut(double t0, double t1, Track ** dest)
|
||||
{
|
||||
// SplitCut() == Copy() + SplitDelete()
|
||||
|
||||
|
||||
if (!Copy(t0, t1, dest))
|
||||
return false;
|
||||
if (!SplitDelete(t0, t1))
|
||||
|
@ -2410,7 +2410,7 @@ bool LabelTrack::Repeat(double t0, double t1, int n)
|
|||
// it, and we need to extend it through to the last repeat interval
|
||||
mLabels[i]->t1 += n * tLen;
|
||||
}
|
||||
|
||||
|
||||
// Other cases have already been handled by ShiftLabelsOnInsert()
|
||||
}
|
||||
|
||||
|
@ -2492,12 +2492,12 @@ int LabelTrack::GetLabelIndex(double t, double t1)
|
|||
|
||||
int len = mLabels.Count();
|
||||
int i;
|
||||
//We'd have liked to have times in terms of samples,
|
||||
//We'd have liked to have times in terms of samples,
|
||||
//because then we're doing an intrger comparison.
|
||||
//Never mind. Instead we look for near enough.
|
||||
//This level of (in)accuracy is only a problem if we
|
||||
//This level of (in)accuracy is only a problem if we
|
||||
//deal with sounds in the MHz range.
|
||||
const double delta = 1.0e-7;
|
||||
const double delta = 1.0e-7;
|
||||
for( i=0;i<len;i++)
|
||||
{
|
||||
l = mLabels[i];
|
||||
|
@ -2611,7 +2611,7 @@ static const char *const GlyphXpmRegionSpec[] = {
|
|||
|
||||
/// CreateCustomGlyphs() creates the mBoundaryGlyph array.
|
||||
/// It's a bit like painting by numbers!
|
||||
///
|
||||
///
|
||||
/// Schematically the glyphs we want will 'look like':
|
||||
/// <O, O> and <O>
|
||||
/// for a left boundary to a label, a right boundary and both.
|
||||
|
@ -2622,14 +2622,14 @@ static const char *const GlyphXpmRegionSpec[] = {
|
|||
/// giving 3 x 4 = 12 combinations.
|
||||
///
|
||||
/// Two of those combinations aren't used, but
|
||||
/// treating them specially would make other code more
|
||||
/// treating them specially would make other code more
|
||||
/// complicated.
|
||||
void LabelTrack::CreateCustomGlyphs()
|
||||
{
|
||||
int iConfig;
|
||||
int iHighlight;
|
||||
int index;
|
||||
const int nSpecRows =
|
||||
const int nSpecRows =
|
||||
sizeof( GlyphXpmRegionSpec )/sizeof( GlyphXpmRegionSpec[0]);
|
||||
const char *XmpBmp[nSpecRows];
|
||||
|
||||
|
@ -2701,17 +2701,17 @@ bool LabelTrack::IsGoodLabelEditKey(int keyCode)
|
|||
|
||||
/// Sorts the labels in order of their starting times.
|
||||
/// This function is called often (whilst dragging a label)
|
||||
/// We expect them to be very nearly in order, so insertion
|
||||
/// sort (with a linear search) is a reasonable choice.
|
||||
/// We expect them to be very nearly in order, so insertion
|
||||
/// sort (with a linear search) is a reasonable choice.
|
||||
void LabelTrack::SortLabels()
|
||||
{
|
||||
int i,j;
|
||||
LabelStruct * pTemp;
|
||||
for (i = 1; i < (int)mLabels.Count(); i++)
|
||||
for (i = 1; i < (int)mLabels.Count(); i++)
|
||||
{
|
||||
j=i-1;
|
||||
while( (j>=0) && (mLabels[j]->t > mLabels[i]->t) )
|
||||
{
|
||||
{
|
||||
j--;
|
||||
}
|
||||
j++;
|
||||
|
|
|
@ -37,7 +37,7 @@ class DirManager;
|
|||
class TimeWarper;
|
||||
|
||||
|
||||
class LabelStruct
|
||||
class LabelStruct
|
||||
{
|
||||
public:
|
||||
LabelStruct();
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
double getDuration(){return t1-t;};
|
||||
void AdjustEdge( int iEdge, double fNewTime);
|
||||
void MoveLabel( int iEdge, double fNewTime);
|
||||
|
||||
|
||||
/// Relationships between selection region and labels
|
||||
enum TimeRelations
|
||||
{
|
||||
|
@ -68,13 +68,13 @@ public:
|
|||
/// it possible to delete capture all labels with a Select All).
|
||||
TimeRelations RegionRelation(double reg_t0, double reg_t1,
|
||||
LabelTrack *parent = NULL);
|
||||
|
||||
|
||||
public:
|
||||
double t; /// Time for left hand of label.
|
||||
double t1; /// Time for right hand of label.
|
||||
wxString title; /// Text of the label.
|
||||
int width; /// width of the text in pixels.
|
||||
|
||||
|
||||
// Working storage for on-screen layout.
|
||||
int x; /// Pixel position of left hand glyph
|
||||
int x1; /// Pixel position of right hand glyph
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
int y; /// Pixel position of label.
|
||||
|
||||
bool highlighted; /// if the text is highlighted
|
||||
bool changeInitialMouseXPos; /// flag to change initial mouse X pos
|
||||
bool changeInitialMouseXPos; /// flag to change initial mouse X pos
|
||||
bool updated; /// flag to tell if the label times were updated
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,7 @@ const int NUM_GLYPH_HIGHLIGHTS = 4;
|
|||
const int MAX_NUM_ROWS =80;
|
||||
|
||||
|
||||
class AUDACITY_DLL_API LabelTrack : public Track
|
||||
class AUDACITY_DLL_API LabelTrack : public Track
|
||||
{
|
||||
friend class LabelStruct;
|
||||
|
||||
|
@ -118,7 +118,7 @@ class AUDACITY_DLL_API LabelTrack : public Track
|
|||
|
||||
int getSelectedIndex() const { return mSelIndex; }
|
||||
|
||||
virtual int GetKind() const { return Label; }
|
||||
virtual int GetKind() const { return Label; }
|
||||
|
||||
virtual double GetStartTime();
|
||||
virtual double GetEndTime();
|
||||
|
@ -136,8 +136,8 @@ class AUDACITY_DLL_API LabelTrack : public Track
|
|||
|
||||
virtual bool Cut (double t0, double t1, Track ** dest);
|
||||
// JKC Do not add the const modifier to Copy(), Clear()
|
||||
// or Paste() because then it
|
||||
// is no longer recognised as a virtual function matching the
|
||||
// or Paste() because then it
|
||||
// is no longer recognised as a virtual function matching the
|
||||
// one in Track.
|
||||
virtual bool Copy (double t0, double t1, Track ** dest);// const;
|
||||
virtual bool Clear(double t0, double t1);
|
||||
|
@ -156,14 +156,14 @@ class AUDACITY_DLL_API LabelTrack : public Track
|
|||
bool CopySelectedText();
|
||||
bool PasteSelectedText(double sel0, double sel1);
|
||||
static bool IsTextClipSupported();
|
||||
|
||||
|
||||
// methods to set flags
|
||||
void SetDragXPos(const int d) { mDragXPos = d; };
|
||||
void SetInBox(bool inTextBox) { mInBox = inTextBox; };
|
||||
void SetResetCursorPos(bool resetFlag) { mResetCursorPos = resetFlag; };
|
||||
void SetWrongDragging(bool rightFlag) { mRightDragging = rightFlag; };
|
||||
void SetDrawCursor(bool drawCursorFlag) { mDrawCursor = drawCursorFlag; };
|
||||
|
||||
|
||||
bool HandleMouse(const wxMouseEvent & evt, wxRect & r, double h, double pps,
|
||||
double *newSel0, double *newSel1);
|
||||
|
||||
|
@ -192,7 +192,7 @@ class AUDACITY_DLL_API LabelTrack : public Track
|
|||
//get current cursor position
|
||||
bool CalcCursorX(wxWindow * parent, int * x);
|
||||
int getCurrentCursorPosition() const { return mCurrentCursorPos; };
|
||||
|
||||
|
||||
void MayAdjustLabel( int iLabel, int iEdge, bool bAllowSwapping, double fNewTime);
|
||||
void MayMoveLabel( int iLabel, int iEdge, double fNewTime);
|
||||
|
||||
|
@ -205,7 +205,7 @@ class AUDACITY_DLL_API LabelTrack : public Track
|
|||
void ScaleLabels(double b, double e, double change);
|
||||
double AdjustTimeStampOnScale(double t, double b, double e, double change);
|
||||
void WarpLabels(const TimeWarper &warper);
|
||||
|
||||
|
||||
// Returns tab-separated text of all labels completely within given region
|
||||
wxString GetTextOfLabels(double t0, double t1);
|
||||
|
||||
|
@ -215,7 +215,7 @@ class AUDACITY_DLL_API LabelTrack : public Track
|
|||
bool mbHitCenter;
|
||||
//The edge variable tells us what state the icon is in.
|
||||
//mOldEdge is useful for telling us when there has been a state change.
|
||||
int mOldEdge;
|
||||
int mOldEdge;
|
||||
private:
|
||||
|
||||
int mSelIndex; /// Keeps track of the currently selected label
|
||||
|
@ -234,16 +234,16 @@ class AUDACITY_DLL_API LabelTrack : public Track
|
|||
|
||||
static int mFontHeight;
|
||||
int mXPos1; /// left X pos of highlighted area
|
||||
int mXPos2; /// right X pos of highlighted area
|
||||
int mXPos2; /// right X pos of highlighted area
|
||||
int mCurrentCursorPos; /// current cursor position
|
||||
int mInitialCursorPos; /// initial cursor position
|
||||
double mMouseXPos; /// mouse X pos
|
||||
int mDragXPos; /// end X pos of dragging
|
||||
bool mInBox; /// flag to tell if the mouse is in text box
|
||||
bool mResetCursorPos; /// flag to reset cursor position(used in the dragging the glygh)
|
||||
bool mResetCursorPos; /// flag to reset cursor position(used in the dragging the glygh)
|
||||
bool mRightDragging; /// flag to tell if it's a valid dragging
|
||||
bool mDrawCursor; /// flag to tell if drawing the cursor or not
|
||||
|
||||
|
||||
// Set in copied label tracks
|
||||
double mClipLen;
|
||||
|
||||
|
|
|
@ -35,19 +35,19 @@ public:
|
|||
LangChoiceDialog(wxWindow * parent,
|
||||
wxWindowID id,
|
||||
const wxString & title);
|
||||
|
||||
|
||||
wxString GetLang() { return mLang; }
|
||||
|
||||
private:
|
||||
void OnOk(wxCommandEvent & event);
|
||||
|
||||
|
||||
wxChoice *mChoice;
|
||||
wxString mLang;
|
||||
|
||||
int mNumLangs;
|
||||
wxArrayString mLangCodes;
|
||||
wxArrayString mLangNames;
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@ -55,7 +55,7 @@ wxString ChooseLanguage(wxWindow *parent)
|
|||
{
|
||||
wxString returnVal;
|
||||
|
||||
/* i18n-hint: Title on a dialog indicating that this is the first
|
||||
/* i18n-hint: Title on a dialog indicating that this is the first
|
||||
* time Audacity has been run. */
|
||||
LangChoiceDialog dlog(parent, -1, _("Audacity First Run"));
|
||||
dlog.CentreOnParent();
|
||||
|
@ -121,10 +121,10 @@ void LangChoiceDialog::OnOk(wxCommandEvent & WXUNUSED(event))
|
|||
else {
|
||||
sname = mLangNames[sndx];
|
||||
}
|
||||
|
||||
|
||||
if (mLang.Left(2) != slang.Left(2)) {
|
||||
wxString msg;
|
||||
/* i18n-hint: The %s's are replaced by translated and untranslated
|
||||
/* i18n-hint: The %s's are replaced by translated and untranslated
|
||||
* versions of language names. */
|
||||
msg.Printf(_("The language you have chosen, %s (%s), is not the same as the system language, %s (%s)."),
|
||||
mLangNames[ndx].c_str(),
|
||||
|
|
|
@ -44,7 +44,7 @@ WX_DECLARE_STRING_HASH_MAP(wxString, LangHash);
|
|||
|
||||
static bool TranslationExists(wxArrayString &audacityPathList, wxString code)
|
||||
{
|
||||
wxArrayString results;
|
||||
wxArrayString results;
|
||||
wxGetApp().FindFilesInPathList(wxString::Format(wxT("%s/audacity.mo"),
|
||||
code.c_str()),
|
||||
audacityPathList,
|
||||
|
@ -60,7 +60,7 @@ static bool TranslationExists(wxArrayString &audacityPathList, wxString code)
|
|||
code.c_str()),
|
||||
audacityPathList,
|
||||
results);
|
||||
|
||||
|
||||
return (results.GetCount() > 0);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ wxString GetSystemLanguageCode()
|
|||
GetLanguages(langCodes, langNames);
|
||||
int sysLang = wxLocale::GetSystemLanguage();
|
||||
const wxLanguageInfo *info = wxLocale::GetLanguageInfo(sysLang);
|
||||
|
||||
|
||||
if (info) {
|
||||
wxString fullCode = info->CanonicalName;
|
||||
if (fullCode.Length() < 2)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*******************************************************************//*!
|
||||
|
||||
\file Legacy.cpp
|
||||
\brief Converts old Audacity file types. Implements
|
||||
\brief Converts old Audacity file types. Implements
|
||||
AutoRollbackRenamer.
|
||||
|
||||
These routines convert Audacity project files from the
|
||||
|
@ -186,7 +186,7 @@ static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile)
|
|||
start = f->GetNextLine();
|
||||
if (f->GetNextLine() != wxT("Block len"))
|
||||
return false;
|
||||
len = f->GetNextLine();
|
||||
len = f->GetNextLine();
|
||||
if (f->GetNextLine() != wxT("Block info"))
|
||||
return false;
|
||||
name = f->GetNextLine();
|
||||
|
@ -225,7 +225,7 @@ static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile)
|
|||
|
||||
xmlFile.EndTag(wxT("sequence"));
|
||||
xmlFile.EndTag(wxT("wavetrack"));
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (kind == wxT("LabelTrack")) {
|
||||
|
@ -298,7 +298,7 @@ bool ConvertLegacyProjectFile(wxFileName filename)
|
|||
wxT("_bak") + wxString::Format(wxT("%d"), index) + wxT(".") + filename.GetExt();
|
||||
} while(::wxFileExists(backupName));
|
||||
|
||||
// This will move the original file out of the way, but
|
||||
// This will move the original file out of the way, but
|
||||
// move it back if we exit from this function early.
|
||||
AutoRollbackRenamer renamer(filename.GetFullPath(), backupName);
|
||||
if (!renamer.RenameSucceeded())
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*******************************************************************//*!
|
||||
|
||||
\file LoadModules.cpp
|
||||
\brief Based on LoadLadspa, this code loads pluggable Audacity
|
||||
\brief Based on LoadLadspa, this code loads pluggable Audacity
|
||||
extension modules. It also has the code to (a) invoke a script
|
||||
server and (b) invoke a function returning a replacement window,
|
||||
i.e. an alternative to the usual interface, for Audacity.
|
||||
|
@ -49,7 +49,7 @@ typedef int (*tModuleInit)(int);
|
|||
typedef wxChar * (*tVersionFn)();
|
||||
typedef pwxWindow (*tPanelFn)(int);
|
||||
|
||||
// This variable will hold the address of a subroutine in
|
||||
// This variable will hold the address of a subroutine in
|
||||
// a DLL that can hijack the normal panel.
|
||||
static tPanelFn pPanelHijack=NULL;
|
||||
|
||||
|
@ -57,7 +57,7 @@ static tPanelFn pPanelHijack=NULL;
|
|||
// strange DLL behaviour. Instead of dynamic linking,
|
||||
// link the library which has the replacement panel statically.
|
||||
// Give the address of the routine here.
|
||||
// This is a great help in identifying missing
|
||||
// This is a great help in identifying missing
|
||||
// symbols which otherwise cause a dll to unload after loading
|
||||
// without an explanation as to why!
|
||||
//extern wxWindow * MainPanelFunc( int i );
|
||||
|
@ -222,7 +222,7 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
|||
}
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
wxGetApp().FindFilesInPathList(wxT("*.dll"), pathList, files);
|
||||
wxGetApp().FindFilesInPathList(wxT("*.dll"), pathList, files);
|
||||
#else
|
||||
wxGetApp().FindFilesInPathList(wxT("*.so"), pathList, files);
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
Dominic Mazzoni
|
||||
Vaughan Johnson
|
||||
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
|
@ -23,19 +23,19 @@
|
|||
WX_DEFINE_OBJARRAY(SyllableArray);
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(HighlightTextCtrl, wxTextCtrl)
|
||||
BEGIN_EVENT_TABLE(HighlightTextCtrl, wxTextCtrl)
|
||||
EVT_MOUSE_EVENTS(HighlightTextCtrl::OnMouseEvent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
HighlightTextCtrl::HighlightTextCtrl(Lyrics* parent,
|
||||
wxWindowID id,
|
||||
const wxString& value /*= ""*/,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
HighlightTextCtrl::HighlightTextCtrl(Lyrics* parent,
|
||||
wxWindowID id,
|
||||
const wxString& value /*= ""*/,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
const wxSize& size /*= wxDefaultSize*/)
|
||||
: wxTextCtrl(parent, id, // wxWindow* parent, wxWindowID id,
|
||||
value, // const wxString& value = "",
|
||||
pos, // const wxPoint& pos = wxDefaultPosition,
|
||||
size, // const wxSize& size = wxDefaultSize,
|
||||
: wxTextCtrl(parent, id, // wxWindow* parent, wxWindowID id,
|
||||
value, // const wxString& value = "",
|
||||
pos, // const wxPoint& pos = wxDefaultPosition,
|
||||
size, // const wxSize& size = wxDefaultSize,
|
||||
wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 | wxTE_AUTO_URL | wxTE_NOHIDESEL), //v | wxHSCROLL)
|
||||
mLyrics(parent)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ HighlightTextCtrl::HighlightTextCtrl(Lyrics* parent,
|
|||
|
||||
void HighlightTextCtrl::OnMouseEvent(wxMouseEvent& event)
|
||||
{
|
||||
if (event.ButtonUp())
|
||||
if (event.ButtonUp())
|
||||
{
|
||||
long from, to;
|
||||
this->GetSelection(&from, &to);
|
||||
|
@ -56,8 +56,8 @@ void HighlightTextCtrl::OnMouseEvent(wxMouseEvent& event)
|
|||
AudacityProject* pProj = GetActiveProject();
|
||||
pProj->SetSel0(pCurSyl->t);
|
||||
|
||||
//v Should probably select to end as in AudacityProject::OnSelectCursorEnd,
|
||||
// but better to generalize that in AudacityProject methods.
|
||||
//v Should probably select to end as in AudacityProject::OnSelectCursorEnd,
|
||||
// but better to generalize that in AudacityProject methods.
|
||||
pProj->mViewInfo.sel1 = pCurSyl->t;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ void HighlightTextCtrl::OnMouseEvent(wxMouseEvent& event)
|
|||
|
||||
//v static const kHighlightTextCtrlID = 7654;
|
||||
|
||||
BEGIN_EVENT_TABLE(Lyrics, wxPanel)
|
||||
BEGIN_EVENT_TABLE(Lyrics, wxPanel)
|
||||
EVT_CHAR(Lyrics::OnKeyEvent)
|
||||
EVT_PAINT(Lyrics::OnPaint)
|
||||
EVT_SIZE(Lyrics::OnSize)
|
||||
|
@ -77,12 +77,12 @@ BEGIN_EVENT_TABLE(Lyrics, wxPanel)
|
|||
// EVT_COMMAND_LEFT_CLICK(kHighlightTextCtrlID, Lyrics::OnHighlightTextCtrl)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_CLASS(Lyrics, wxPanel)
|
||||
IMPLEMENT_CLASS(Lyrics, wxPanel)
|
||||
|
||||
Lyrics::Lyrics(wxWindow* parent, wxWindowID id,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
const wxSize& size /*= wxDefaultSize*/):
|
||||
wxPanel(parent, id, pos, size),
|
||||
wxPanel(parent, id, pos, size),
|
||||
mWidth(size.x), mHeight(size.y)
|
||||
{
|
||||
mKaraokeHeight = mHeight;
|
||||
|
@ -91,10 +91,10 @@ Lyrics::Lyrics(wxWindow* parent, wxWindowID id,
|
|||
|
||||
this->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
mHighlightTextCtrl =
|
||||
new HighlightTextCtrl(this, -1, // wxWindow* parent, wxWindowID id,
|
||||
wxT(""), // const wxString& value = wxT(""),
|
||||
wxPoint(0, 0), // const wxPoint& pos = wxDefaultPosition,
|
||||
mHighlightTextCtrl =
|
||||
new HighlightTextCtrl(this, -1, // wxWindow* parent, wxWindowID id,
|
||||
wxT(""), // const wxString& value = wxT(""),
|
||||
wxPoint(0, 0), // const wxPoint& pos = wxDefaultPosition,
|
||||
size); // const wxSize& size = wxDefaultSize
|
||||
this->SetHighlightFont();
|
||||
mHighlightTextCtrl->Show(mLyricsStyle == kHighlightLyrics); // test, in case we conditionalize the default, above
|
||||
|
@ -153,11 +153,11 @@ void Lyrics::Add(double t, wxString syllable)
|
|||
|
||||
// Put a space between syllables unless the previous one
|
||||
// ended in a hyphen
|
||||
if (i > 0 &&
|
||||
if (i > 0 &&
|
||||
// mSyllables[i-1].text.Length() > 0 &&
|
||||
mSyllables[i-1].text.Right(1) != wxT("-"))
|
||||
mSyllables[i-1].text.Right(1) != wxT("-"))
|
||||
mSyllables[i].textWithSpace = wxT(" ") + syllable;
|
||||
else
|
||||
else
|
||||
mSyllables[i].textWithSpace = syllable;
|
||||
|
||||
mText += mSyllables[i].textWithSpace;
|
||||
|
@ -166,7 +166,7 @@ void Lyrics::Add(double t, wxString syllable)
|
|||
int nTextLen = mSyllables[i].textWithSpace.Length();
|
||||
if ((nTextLen > 0) && (mSyllables[i].textWithSpace.Right(1) == wxT("_")))
|
||||
mHighlightTextCtrl->AppendText(mSyllables[i].textWithSpace.Left(nTextLen - 1) + wxT("\n"));
|
||||
else
|
||||
else
|
||||
mHighlightTextCtrl->AppendText(mSyllables[i].textWithSpace);
|
||||
}
|
||||
|
||||
|
@ -236,8 +236,8 @@ void Lyrics::SetDrawnFont(wxDC *dc)
|
|||
void Lyrics::SetHighlightFont() // for kHighlightLyrics
|
||||
{
|
||||
wxFont newFont(mKaraokeFontSize, wxSWISS, wxNORMAL, wxNORMAL);
|
||||
mHighlightTextCtrl->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, newFont));
|
||||
mHighlightTextCtrl->SetStyle(0, mHighlightTextCtrl->GetLastPosition(),
|
||||
mHighlightTextCtrl->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, newFont));
|
||||
mHighlightTextCtrl->SetStyle(0, mHighlightTextCtrl->GetLastPosition(),
|
||||
wxTextAttr(wxNullColour, wxNullColour, newFont));
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ void Lyrics::Measure(wxDC *dc) // only for drawn text
|
|||
int width = 0, height = 0;
|
||||
|
||||
const int kIndent = 4;
|
||||
int x = 2*kIndent;
|
||||
int x = 2*kIndent;
|
||||
|
||||
unsigned int i;
|
||||
for(i=0; i<mSyllables.GetCount(); i++) {
|
||||
|
@ -283,13 +283,13 @@ void Lyrics::Measure(wxDC *dc) // only for drawn text
|
|||
}
|
||||
else
|
||||
extraWidth = 20;
|
||||
|
||||
|
||||
mSyllables[i].width = width + extraWidth;
|
||||
mSyllables[i].leftX = x;
|
||||
mSyllables[i].x = x + width/2;
|
||||
x += mSyllables[i].width;
|
||||
}
|
||||
|
||||
|
||||
mTextHeight = height;
|
||||
|
||||
mMeasurementsDone = true;
|
||||
|
@ -402,10 +402,10 @@ void Lyrics::GetKaraokePosition(double t,
|
|||
|
||||
void Lyrics::Update(double t)
|
||||
{
|
||||
if (t < 0.0)
|
||||
if (t < 0.0)
|
||||
{
|
||||
// TrackPanel::OnTimer passes gAudioIO->GetStreamTime(), which is -1000000000 if !IsStreamActive().
|
||||
// In that case, use the selection start time.
|
||||
// In that case, use the selection start time.
|
||||
AudacityProject* pProj = GetActiveProject();
|
||||
mT = pProj->GetSel0();
|
||||
}
|
||||
|
@ -422,16 +422,16 @@ void Lyrics::Update(double t)
|
|||
if (i == mCurrentSyllable)
|
||||
return;
|
||||
|
||||
mCurrentSyllable = i;
|
||||
mCurrentSyllable = i;
|
||||
|
||||
if (mLyricsStyle == kHighlightLyrics)
|
||||
{
|
||||
mHighlightTextCtrl->SetSelection(mSyllables[i].char0, mSyllables[i].char1);
|
||||
|
||||
|
||||
//v No trail for now.
|
||||
//// Leave a trail behind the selection, by highlighting.
|
||||
//if (i == I_FIRST_REAL_SYLLABLE)
|
||||
// // Reset the trail to zero.
|
||||
//if (i == I_FIRST_REAL_SYLLABLE)
|
||||
// // Reset the trail to zero.
|
||||
// mHighlightTextCtrl->SetStyle(0, mHighlightTextCtrl->GetLastPosition(), wxTextAttr(wxNullColour, *wxWHITE));
|
||||
//// Mark the trail for mSyllables[i].
|
||||
//mHighlightTextCtrl->SetStyle(mSyllables[i].char0, mSyllables[i].char1, wxTextAttr(wxNullColour, *wxLIGHT_GREY));
|
||||
|
@ -450,7 +450,7 @@ void Lyrics::OnPaint(wxPaintEvent & WXUNUSED(event))
|
|||
if (!this->GetParent()->IsShown())
|
||||
return;
|
||||
|
||||
if (mLyricsStyle == kBouncingBallLyrics)
|
||||
if (mLyricsStyle == kBouncingBallLyrics)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
|
||||
|
@ -482,9 +482,9 @@ void Lyrics::OnSize(wxSizeEvent & WXUNUSED(event))
|
|||
|
||||
mKaraokeHeight = mHeight;
|
||||
|
||||
mKaraokeFontSize =
|
||||
mKaraokeFontSize =
|
||||
(int)((float)(this->GetDefaultFontSize() * mHeight) / (float)LYRICS_DEFAULT_HEIGHT);
|
||||
// Usually don't get the size window we want, usually less than
|
||||
// Usually don't get the size window we want, usually less than
|
||||
// LYRICS_DEFAULT_HEIGHT, so bump it a little.
|
||||
mKaraokeFontSize += 2;
|
||||
|
||||
|
@ -518,7 +518,7 @@ void Lyrics::HandlePaint(wxDC &dc)
|
|||
dc.SetBrush(*wxWHITE_BRUSH);
|
||||
dc.DrawRectangle(0, 0, mWidth, mKaraokeHeight);
|
||||
|
||||
this->HandlePaint_BouncingBall(dc);
|
||||
this->HandlePaint_BouncingBall(dc);
|
||||
}
|
||||
|
||||
void Lyrics::HandlePaint_BouncingBall(wxDC &dc)
|
||||
|
@ -527,7 +527,7 @@ void Lyrics::HandlePaint_BouncingBall(wxDC &dc)
|
|||
int x;
|
||||
double y;
|
||||
GetKaraokePosition(mT, &x, &y);
|
||||
|
||||
|
||||
dc.SetTextForeground(wxColour(238, 0, 102));
|
||||
bool changedColor = false;
|
||||
|
||||
|
|
20
src/Lyrics.h
20
src/Lyrics.h
|
@ -6,7 +6,7 @@
|
|||
|
||||
Dominic Mazzoni
|
||||
Vaughan Johnson
|
||||
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_LYRICS__
|
||||
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include <wx/dynarray.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/textctrl.h>
|
||||
|
||||
|
||||
#define LYRICS_DEFAULT_WIDTH 608
|
||||
|
@ -41,10 +41,10 @@ class Lyrics;
|
|||
class HighlightTextCtrl : public wxTextCtrl
|
||||
{
|
||||
public:
|
||||
HighlightTextCtrl(Lyrics* parent,
|
||||
wxWindowID id,
|
||||
const wxString& value = wxT(""),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
HighlightTextCtrl(Lyrics* parent,
|
||||
wxWindowID id,
|
||||
const wxString& value = wxT(""),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize);
|
||||
virtual ~HighlightTextCtrl() {};
|
||||
|
||||
|
@ -56,7 +56,7 @@ private:
|
|||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class Lyrics : public wxPanel
|
||||
class Lyrics : public wxPanel
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(Lyrics)
|
||||
|
||||
|
@ -95,7 +95,7 @@ class Lyrics : public wxPanel
|
|||
|
||||
// Doesn't seem to be a way to capture a selection event in a read-only wxTextCtrl.
|
||||
// Thus the HighlightTextCtrl class.
|
||||
// void OnHighlightTextCtrl(wxCommandEvent & event);
|
||||
// void OnHighlightTextCtrl(wxCommandEvent & event);
|
||||
|
||||
void HandlePaint(wxDC &dc);
|
||||
void HandlePaint_BouncingBall(wxDC &dc);
|
||||
|
@ -104,7 +104,7 @@ class Lyrics : public wxPanel
|
|||
|
||||
private:
|
||||
unsigned int GetDefaultFontSize() const; // Depends on mLyricsStyle. Call only after mLyricsStyle is set.
|
||||
|
||||
|
||||
void SetDrawnFont(wxDC *dc); // for kBouncingBallLyrics
|
||||
void SetHighlightFont(); // for kHighlightLyrics
|
||||
|
||||
|
@ -126,7 +126,7 @@ private:
|
|||
|
||||
int mCurrentSyllable;
|
||||
SyllableArray mSyllables;
|
||||
wxString mText;
|
||||
wxString mText;
|
||||
|
||||
int mTextHeight; // only for drawn text
|
||||
bool mMeasurementsDone; // only for drawn text
|
||||
|
|
|
@ -43,24 +43,24 @@ END_EVENT_TABLE()
|
|||
const wxSize gSize = wxSize(LYRICS_DEFAULT_WIDTH, LYRICS_DEFAULT_HEIGHT);
|
||||
|
||||
LyricsWindow::LyricsWindow(AudacityProject *parent):
|
||||
wxFrame(parent, -1,
|
||||
wxString::Format(_("Audacity Karaoke%s"),
|
||||
((parent->GetName() == wxEmptyString) ?
|
||||
wxFrame(parent, -1,
|
||||
wxString::Format(_("Audacity Karaoke%s"),
|
||||
((parent->GetName() == wxEmptyString) ?
|
||||
wxT("") :
|
||||
wxString::Format(
|
||||
wxT(" - %s"),
|
||||
parent->GetName().c_str()).c_str())),
|
||||
wxPoint(100, 300), gSize,
|
||||
wxPoint(100, 300), gSize,
|
||||
//v Bug in wxFRAME_FLOAT_ON_PARENT:
|
||||
// If both the project frame and LyricsWindow are minimized and you restore LyricsWindow,
|
||||
// you can't restore project frame until you close LyricsWindow, but then project frame and
|
||||
// If both the project frame and LyricsWindow are minimized and you restore LyricsWindow,
|
||||
// you can't restore project frame until you close LyricsWindow, but then project frame and
|
||||
// LyricsWindow are restored but LyricsWindow is unresponsive because it thinks it's not shown.
|
||||
// wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT)
|
||||
wxDEFAULT_FRAME_STYLE)
|
||||
{
|
||||
//vvv Still necessary? It's commented out in ToolManager and Meter, so I did so here.
|
||||
// #ifdef __WXMAC__
|
||||
// // WXMAC doesn't support wxFRAME_FLOAT_ON_PARENT, so we do
|
||||
// // WXMAC doesn't support wxFRAME_FLOAT_ON_PARENT, so we do
|
||||
// SetWindowClass((WindowRef) MacGetWindowRef(), kFloatingWindowClass);
|
||||
// #endif
|
||||
mProject = parent;
|
||||
|
@ -79,15 +79,15 @@ LyricsWindow::LyricsWindow(AudacityProject *parent):
|
|||
wxSize panelSize = gSize;
|
||||
|
||||
//vvv not yet working right in ported version, so choice is disabled.
|
||||
// It seems when you select highlight style, the TrackPanel timer stops working, but
|
||||
// It seems when you select highlight style, the TrackPanel timer stops working, but
|
||||
// going back to bouncing ball style starts it up again (!!!), per breakpoints in TrackPanel::OnTimer().
|
||||
//
|
||||
//wxToolBar* pToolBar = this->CreateToolBar();
|
||||
//const int kHorizMargin = 8;
|
||||
//wxRadioButton* pRadioButton_BouncingBall =
|
||||
//wxRadioButton* pRadioButton_BouncingBall =
|
||||
// new wxRadioButton(pToolBar, kID_RadioButton_BouncingBall, _("Bouncing Ball"), wxPoint(kHorizMargin, 4),
|
||||
// wxDefaultSize, wxRB_GROUP);
|
||||
//// Reposition to center vertically.
|
||||
//// Reposition to center vertically.
|
||||
//wxSize tbSize = pToolBar->GetSize();
|
||||
//wxSize btnSize = pRadioButton_BouncingBall->GetSize();
|
||||
//int top = (tbSize.GetHeight() - btnSize.GetHeight()) / 2;
|
||||
|
@ -95,7 +95,7 @@ LyricsWindow::LyricsWindow(AudacityProject *parent):
|
|||
//pToolBar->AddControl(pRadioButton_BouncingBall);
|
||||
//
|
||||
//int left = kHorizMargin + btnSize.GetWidth() + kHorizMargin; //vvv Doesn't actually work. Probably need sizers.
|
||||
//wxRadioButton* pRadioButton_Highlight =
|
||||
//wxRadioButton* pRadioButton_Highlight =
|
||||
// new wxRadioButton(pToolBar, kID_RadioButton_Highlight, _("Highlight"), wxPoint(left, top));
|
||||
//pToolBar->AddControl(pRadioButton_Highlight);
|
||||
//
|
||||
|
@ -113,7 +113,7 @@ LyricsWindow::LyricsWindow(AudacityProject *parent):
|
|||
mLyricsPanel = new Lyrics(this, -1, panelPos, panelSize);
|
||||
|
||||
//vvv Highlight style is broken in ported version.
|
||||
//switch (mLyricsPanel->GetLyricsStyle())
|
||||
//switch (mLyricsPanel->GetLyricsStyle())
|
||||
//{
|
||||
// case Lyrics::kBouncingBallLyrics:
|
||||
// pRadioButton_BouncingBall->SetValue(true); break;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
\file MacroMagic.h
|
||||
|
||||
This file allows the same macros to do multiple duty by undefining
|
||||
This file allows the same macros to do multiple duty by undefining
|
||||
and redefining the macros.
|
||||
|
||||
For example DEFINE_IMAGE will generate:
|
||||
|
|
|
@ -266,7 +266,7 @@ libaudacity_la_OBJECTS = $(am_libaudacity_la_OBJECTS)
|
|||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
am__v_lt_1 =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(desktopdir)" \
|
||||
"$(DESTDIR)$(mimedir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
@ -746,11 +746,11 @@ am__v_P_1 = :
|
|||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp = $(SHELL) $(top_srcdir)/autotools/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
|
@ -764,7 +764,7 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
|||
AM_V_CXX = $(am__v_CXX_@AM_V@)
|
||||
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
|
||||
am__v_CXX_0 = @echo " CXX " $@;
|
||||
am__v_CXX_1 =
|
||||
am__v_CXX_1 =
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
|
@ -772,7 +772,7 @@ CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
|||
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
|
||||
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
|
||||
am__v_CXXLD_0 = @echo " CXXLD " $@;
|
||||
am__v_CXXLD_1 =
|
||||
am__v_CXXLD_1 =
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
|
@ -782,7 +782,7 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
|||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
|
@ -790,7 +790,7 @@ LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
|||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libaudacity_la_SOURCES) $(audacity_SOURCES)
|
||||
DIST_SOURCES = $(libaudacity_la_SOURCES) $(am__audacity_SOURCES_DIST)
|
||||
am__can_run_installinfo = \
|
||||
|
@ -1365,7 +1365,7 @@ configwin.h: stamp-h1
|
|||
stamp-h1: $(srcdir)/configtemplate.h $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status src/configwin.h
|
||||
$(srcdir)/configtemplate.h: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(srcdir)/configtemplate.h: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
@ -1422,7 +1422,7 @@ xml/$(DEPDIR)/$(am__dirstamp):
|
|||
xml/libaudacity_la-XMLTagHandler.lo: xml/$(am__dirstamp) \
|
||||
xml/$(DEPDIR)/$(am__dirstamp)
|
||||
|
||||
libaudacity.la: $(libaudacity_la_OBJECTS) $(libaudacity_la_DEPENDENCIES) $(EXTRA_libaudacity_la_DEPENDENCIES)
|
||||
libaudacity.la: $(libaudacity_la_OBJECTS) $(libaudacity_la_DEPENDENCIES) $(EXTRA_libaudacity_la_DEPENDENCIES)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(libaudacity_la_OBJECTS) $(libaudacity_la_LIBADD) $(LIBS)
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
|
@ -1915,7 +1915,7 @@ effects/VST/$(DEPDIR)/$(am__dirstamp):
|
|||
effects/VST/audacity-VSTEffect.$(OBJEXT): effects/VST/$(am__dirstamp) \
|
||||
effects/VST/$(DEPDIR)/$(am__dirstamp)
|
||||
|
||||
audacity$(EXEEXT): $(audacity_OBJECTS) $(audacity_DEPENDENCIES) $(EXTRA_audacity_DEPENDENCIES)
|
||||
audacity$(EXEEXT): $(audacity_OBJECTS) $(audacity_DEPENDENCIES) $(EXTRA_audacity_DEPENDENCIES)
|
||||
@rm -f audacity$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(audacity_LINK) $(audacity_OBJECTS) $(audacity_LDADD) $(LIBS)
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ Vector VectorConcatenate(const Vector& left, const Vector& right)
|
|||
Vector v(left.Len() + right.Len());
|
||||
int i;
|
||||
for(i=0; i<left.Len(); i++)
|
||||
v[i] = left[i];
|
||||
v[i] = left[i];
|
||||
for(i=0; i<right.Len(); i++)
|
||||
v[i + left.Len()] = right[i];
|
||||
return v;
|
||||
|
|
|
@ -65,14 +65,14 @@ class Matrix
|
|||
inline Vector& operator[](int i) const { return *mRowVec[i]; }
|
||||
inline int Rows() const { return mRows; }
|
||||
inline int Cols() const { return mCols; }
|
||||
|
||||
|
||||
void SwapRows(int i, int j);
|
||||
|
||||
double Sum() const;
|
||||
|
||||
private:
|
||||
void CopyFrom(const Matrix& other);
|
||||
|
||||
|
||||
int mRows;
|
||||
int mCols;
|
||||
Vector **mRowVec;
|
||||
|
|
482
src/Menus.cpp
482
src/Menus.cpp
File diff suppressed because it is too large
Load Diff
|
@ -14,11 +14,11 @@
|
|||
|
||||
|
||||
// These are all member functions of class AudacityProject.
|
||||
// Vaughan, 2010-08-05:
|
||||
// Vaughan, 2010-08-05:
|
||||
// Note that this file is included in a "public" section of Project.h.
|
||||
// Most of these methods do not need to be public, and because
|
||||
// Most of these methods do not need to be public, and because
|
||||
// we do not subclass AudacityProject, they should be "private."
|
||||
// Because the ones that need to be public are intermixed,
|
||||
// Because the ones that need to be public are intermixed,
|
||||
// I've added "private" in just a few cases.
|
||||
|
||||
private:
|
||||
|
@ -29,7 +29,7 @@ void CreateMenusAndCommands();
|
|||
/** Generate submenus for the categories that contain more than one effect
|
||||
and return the effects from the categories that do not contain more than
|
||||
submenuThreshold effects so the caller can add them to the current menu. */
|
||||
EffectSet CreateEffectSubmenus(CommandManager* c,
|
||||
EffectSet CreateEffectSubmenus(CommandManager* c,
|
||||
const CategorySet& categories, int flags,
|
||||
unsigned submenuThreshold = 1);
|
||||
|
||||
|
|
38
src/Mix.cpp
38
src/Mix.cpp
|
@ -61,7 +61,7 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
|
|||
TrackListIterator iter(tracks);
|
||||
SelectedTrackListOfKindIterator usefulIter(Track::Wave, tracks);
|
||||
// this only iterates tracks which are relevant to this function, i.e.
|
||||
// selected WaveTracks. The tracklist is (confusingly) the list of all
|
||||
// selected WaveTracks. The tracklist is (confusingly) the list of all
|
||||
// tracks in the project
|
||||
|
||||
t = iter.First();
|
||||
|
@ -168,7 +168,7 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
|
|||
::wxSafeYield();
|
||||
ProgressDialog *progress = new ProgressDialog(_("Mix and Render"),
|
||||
_("Mixing and rendering tracks"));
|
||||
|
||||
|
||||
int updateResult = eProgressSuccess;
|
||||
while(updateResult == eProgressSuccess) {
|
||||
sampleCount blockLen = mixer->Process(maxBlockLen);
|
||||
|
@ -194,16 +194,16 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
|
|||
delete progress;
|
||||
|
||||
mixLeft->Flush();
|
||||
if (!mono)
|
||||
if (!mono)
|
||||
mixRight->Flush();
|
||||
if (updateResult == eProgressCancelled || updateResult == eProgressFailed)
|
||||
{
|
||||
delete mixLeft;
|
||||
if (!mono)
|
||||
if (!mono)
|
||||
delete mixRight;
|
||||
} else {
|
||||
*newLeft = mixLeft;
|
||||
if (!mono)
|
||||
if (!mono)
|
||||
*newRight = mixRight;
|
||||
|
||||
#if 0
|
||||
|
@ -268,7 +268,7 @@ Mixer::Mixer(int numInputTracks, WaveTrack **inputTracks,
|
|||
mNumBuffers = mNumChannels;
|
||||
mInterleavedBufferSize = mBufferSize;
|
||||
}
|
||||
|
||||
|
||||
mBuffer = new samplePtr[mNumBuffers];
|
||||
mTemp = new samplePtr[mNumBuffers];
|
||||
for (int c = 0; c < mNumBuffers; c++) {
|
||||
|
@ -350,10 +350,10 @@ void MixBuffers(int numChannels, int *channelFlags, float *gains,
|
|||
for (int c = 0; c < numChannels; c++) {
|
||||
if (!channelFlags[c])
|
||||
continue;
|
||||
|
||||
|
||||
samplePtr destPtr;
|
||||
int skip;
|
||||
|
||||
|
||||
if (interleaved) {
|
||||
destPtr = dests[0] + c*SAMPLE_SIZE(floatSample);
|
||||
skip = numChannels;
|
||||
|
@ -371,7 +371,7 @@ void MixBuffers(int numChannels, int *channelFlags, float *gains,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrack *track,
|
||||
sampleCount *pos, float *queue,
|
||||
int *queueStart, int *queueLen,
|
||||
|
@ -446,7 +446,7 @@ sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrack *track,
|
|||
}
|
||||
|
||||
double factor = initialWarp;
|
||||
if (mTimeTrack)
|
||||
if (mTimeTrack)
|
||||
{
|
||||
//TODO-MB: The end time is wrong when the resampler doesn't use all input samples,
|
||||
// as a result of this the warp factor may be slightly wrong, so AudioIO will stop too soon
|
||||
|
@ -511,7 +511,7 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrack *track,
|
|||
//don't process if we're at the end of the selection or track.
|
||||
if (t>=tEnd)
|
||||
return 0;
|
||||
//if we're about to approach the end of the track or selection, figure out how much we need to grab
|
||||
//if we're about to approach the end of the track or selection, figure out how much we need to grab
|
||||
if (t + slen/track->GetRate() > tEnd)
|
||||
slen = (int)((tEnd - t) * track->GetRate() + 0.5);
|
||||
|
||||
|
@ -522,7 +522,7 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrack *track,
|
|||
track->GetEnvelopeValues(mEnvValues, slen, t, 1.0 / mRate);
|
||||
for(int i=0; i<slen; i++)
|
||||
mFloatBuffer[i] *= mEnvValues[i]; // Track gain control will go here?
|
||||
|
||||
|
||||
for(c=0; c<mNumChannels; c++)
|
||||
if (mApplyTrackGains)
|
||||
mGains[c] = track->GetChannelGain(c);
|
||||
|
@ -590,11 +590,11 @@ sampleCount Mixer::Process(sampleCount maxToProcess)
|
|||
|
||||
if (out > maxOut)
|
||||
maxOut = out;
|
||||
|
||||
|
||||
double t = (double)mSamplePos[i] / (double)track->GetRate();
|
||||
if(t > mTime)
|
||||
mTime = std::min(t, mT1);
|
||||
|
||||
|
||||
}
|
||||
if(mInterleaved) {
|
||||
for(int c=0; c<mNumChannels; c++) {
|
||||
|
@ -621,7 +621,7 @@ sampleCount Mixer::Process(sampleCount maxToProcess)
|
|||
// MB: this doesn't take warping into account, replaced with code based on mSamplePos
|
||||
//mT += (maxOut / mRate);
|
||||
|
||||
delete [] channelFlags;
|
||||
delete [] channelFlags;
|
||||
|
||||
return maxOut;
|
||||
}
|
||||
|
@ -677,10 +677,10 @@ MixerSpec::MixerSpec( int numTracks, int maxNumChannels )
|
|||
{
|
||||
mNumTracks = mNumChannels = numTracks;
|
||||
mMaxNumChannels = maxNumChannels;
|
||||
|
||||
|
||||
if( mNumChannels > mMaxNumChannels )
|
||||
mNumChannels = mMaxNumChannels;
|
||||
|
||||
|
||||
Alloc();
|
||||
|
||||
for( int i = 0; i < mNumTracks; i++ )
|
||||
|
@ -728,7 +728,7 @@ bool MixerSpec::SetNumChannels( int newNumChannels )
|
|||
|
||||
if( newNumChannels > mMaxNumChannels )
|
||||
return false;
|
||||
|
||||
|
||||
for( int i = 0; i < mNumTracks; i++ )
|
||||
{
|
||||
for( int j = newNumChannels; j < mNumChannels; j++ )
|
||||
|
@ -745,7 +745,7 @@ bool MixerSpec::SetNumChannels( int newNumChannels )
|
|||
MixerSpec& MixerSpec::operator=( const MixerSpec &mixerSpec )
|
||||
{
|
||||
Free();
|
||||
|
||||
|
||||
mNumTracks = mixerSpec.mNumTracks;
|
||||
mNumChannels = mixerSpec.mNumChannels;
|
||||
mMaxNumChannels = mixerSpec.mMaxNumChannels;
|
||||
|
|
12
src/Mix.h
12
src/Mix.h
|
@ -27,9 +27,9 @@ class DirManager;
|
|||
* Takes one or more tracks as input; of all the WaveTrack s that are selected,
|
||||
* it mixes them together, applying any envelopes, amplitude gain, panning, and
|
||||
* real-time effects in the process. The resulting pair of tracks (stereo) are
|
||||
* "rendered" and have no effects, gain, panning, or envelopes. Other sorts of
|
||||
* "rendered" and have no effects, gain, panning, or envelopes. Other sorts of
|
||||
* tracks are ignored.
|
||||
* If the start and end times passed are the same this is taken as meaning
|
||||
* If the start and end times passed are the same this is taken as meaning
|
||||
* no explicit time range to process, and the whole occupied length of the
|
||||
* input tracks is processed.
|
||||
*/
|
||||
|
@ -45,13 +45,13 @@ void MixBuffers(int numChannels, int *channelFlags, float *gains,
|
|||
class AUDACITY_DLL_API MixerSpec
|
||||
{
|
||||
int mNumTracks, mNumChannels, mMaxNumChannels;
|
||||
|
||||
|
||||
void Alloc();
|
||||
void Free();
|
||||
|
||||
public:
|
||||
bool **mMap;
|
||||
|
||||
|
||||
MixerSpec( int numTracks, int maxNumChannels );
|
||||
MixerSpec( const MixerSpec &mixerSpec );
|
||||
virtual ~MixerSpec();
|
||||
|
@ -67,7 +67,7 @@ class AUDACITY_DLL_API MixerSpec
|
|||
|
||||
class AUDACITY_DLL_API Mixer {
|
||||
public:
|
||||
//
|
||||
//
|
||||
// Constructor / Destructor
|
||||
//
|
||||
|
||||
|
@ -135,7 +135,7 @@ class AUDACITY_DLL_API Mixer {
|
|||
float *mGains;
|
||||
double *mEnvValues;
|
||||
double mT0; // Start time
|
||||
double mT1; // Stop time (none if mT0==mT1)
|
||||
double mT1; // Stop time (none if mT0==mT1)
|
||||
double mTime; // Current time (renamed from mT to mTime for consistency with AudioIO - mT represented warped time there)
|
||||
Resample **mResample;
|
||||
float **mSampleQueue;
|
||||
|
|
|
@ -50,12 +50,12 @@ END_EVENT_TABLE()
|
|||
MixerTrackSlider::MixerTrackSlider(wxWindow * parent,
|
||||
wxWindowID id,
|
||||
wxString name,
|
||||
const wxPoint & pos,
|
||||
const wxPoint & pos,
|
||||
const wxSize & size,
|
||||
int style /*= FRAC_SLIDER*/,
|
||||
bool popup /*= true*/,
|
||||
bool canUseShift /*= true*/,
|
||||
float stepValue /*= STEP_CONTINUOUS*/,
|
||||
float stepValue /*= STEP_CONTINUOUS*/,
|
||||
int orientation /*= wxHORIZONTAL*/)
|
||||
: ASlider(parent, id, name, pos, size,
|
||||
style, popup, canUseShift, stepValue, orientation)
|
||||
|
@ -129,10 +129,10 @@ void MixerTrackSlider::OnCaptureKey(wxCommandEvent &event)
|
|||
#define kMixerTrackClusterWidth kLeftSideStackWidth + kRightSideStackWidth + kQuadrupleInset // kDoubleInset margin on both sides
|
||||
|
||||
enum {
|
||||
ID_BITMAPBUTTON_MUSICAL_INSTRUMENT = 13000,
|
||||
ID_BITMAPBUTTON_MUSICAL_INSTRUMENT = 13000,
|
||||
ID_SLIDER_PAN,
|
||||
ID_SLIDER_GAIN,
|
||||
ID_TOGGLEBUTTON_MUTE,
|
||||
ID_TOGGLEBUTTON_MUTE,
|
||||
ID_TOGGLEBUTTON_SOLO,
|
||||
};
|
||||
|
||||
|
@ -141,7 +141,7 @@ BEGIN_EVENT_TABLE(MixerTrackCluster, wxPanel)
|
|||
EVT_MOUSE_EVENTS(MixerTrackCluster::OnMouseEvent)
|
||||
EVT_PAINT(MixerTrackCluster::OnPaint)
|
||||
|
||||
EVT_BUTTON(ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, MixerTrackCluster::OnButton_MusicalInstrument)
|
||||
EVT_BUTTON(ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, MixerTrackCluster::OnButton_MusicalInstrument)
|
||||
EVT_SLIDER(ID_SLIDER_PAN, MixerTrackCluster::OnSlider_Pan)
|
||||
EVT_SLIDER(ID_SLIDER_GAIN, MixerTrackCluster::OnSlider_Gain)
|
||||
//v EVT_COMMAND_SCROLL(ID_SLIDER_GAIN, MixerTrackCluster::OnSliderScroll_Gain)
|
||||
|
@ -149,11 +149,11 @@ BEGIN_EVENT_TABLE(MixerTrackCluster, wxPanel)
|
|||
EVT_COMMAND(ID_TOGGLEBUTTON_SOLO, wxEVT_COMMAND_BUTTON_CLICKED, MixerTrackCluster::OnButton_Solo)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
|
||||
MixerBoard* grandParent, AudacityProject* project,
|
||||
WaveTrack* pLeftTrack, WaveTrack* pRightTrack /*= NULL*/,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
const wxSize& size /*= wxDefaultSize*/)
|
||||
MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
|
||||
MixerBoard* grandParent, AudacityProject* project,
|
||||
WaveTrack* pLeftTrack, WaveTrack* pRightTrack /*= NULL*/,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
const wxSize& size /*= wxDefaultSize*/)
|
||||
: wxPanel(parent, -1, pos, size)
|
||||
{
|
||||
mMixerBoard = grandParent;
|
||||
|
@ -176,51 +176,51 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
|
|||
|
||||
SetName(mLeftTrack->GetName());
|
||||
|
||||
this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||
this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||
|
||||
// Not sure why, but sizers weren't getting offset vertically,
|
||||
// probably because not using wxDefaultPosition,
|
||||
// Not sure why, but sizers weren't getting offset vertically,
|
||||
// probably because not using wxDefaultPosition,
|
||||
// so positions are calculated explicitly below, and sizers code was removed.
|
||||
// (Still available in Audacity_UmixIt branch off 1.2.6.)
|
||||
|
||||
// track name
|
||||
wxPoint ctrlPos(kDoubleInset, kDoubleInset);
|
||||
wxSize ctrlSize(size.GetWidth() - kQuadrupleInset, TRACK_NAME_HEIGHT);
|
||||
mStaticText_TrackName =
|
||||
mStaticText_TrackName =
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
new wxStaticText(this, -1, mTrack->GetName(), ctrlPos, ctrlSize,
|
||||
new wxStaticText(this, -1, mTrack->GetName(), ctrlPos, ctrlSize,
|
||||
wxALIGN_CENTRE | wxST_NO_AUTORESIZE | wxSUNKEN_BORDER);
|
||||
#else
|
||||
new wxStaticText(this, -1, mLeftTrack->GetName(), ctrlPos, ctrlSize,
|
||||
wxALIGN_CENTRE | 0x0001 | wxBORDER_SUNKEN);
|
||||
#endif
|
||||
//v Useful when different tracks are different colors, but not now.
|
||||
//v Useful when different tracks are different colors, but not now.
|
||||
// mStaticText_TrackName->SetBackgroundColour(this->GetTrackColor());
|
||||
|
||||
|
||||
|
||||
// gain slider at left
|
||||
ctrlPos.x = kDoubleInset;
|
||||
ctrlPos.y += TRACK_NAME_HEIGHT + kDoubleInset;
|
||||
const int nGainSliderHeight =
|
||||
const int nGainSliderHeight =
|
||||
size.GetHeight() - ctrlPos.y - kQuadrupleInset;
|
||||
ctrlSize.Set(kLeftSideStackWidth - kQuadrupleInset, nGainSliderHeight);
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
if (mNoteTrack) {
|
||||
mSlider_Gain =
|
||||
mSlider_Gain =
|
||||
new MixerTrackSlider(
|
||||
this, ID_SLIDER_GAIN,
|
||||
/* i18n-hint: title of the MIDI Velocity slider */
|
||||
_("Velocity"),
|
||||
ctrlPos, ctrlSize, VEL_SLIDER, true,
|
||||
_("Velocity"),
|
||||
ctrlPos, ctrlSize, VEL_SLIDER, true,
|
||||
true, 0.0, wxVERTICAL);
|
||||
} else
|
||||
#endif
|
||||
mSlider_Gain =
|
||||
mSlider_Gain =
|
||||
new MixerTrackSlider(
|
||||
this, ID_SLIDER_GAIN,
|
||||
this, ID_SLIDER_GAIN,
|
||||
/* i18n-hint: title of the Gain slider, used to adjust the volume */
|
||||
_("Gain"),
|
||||
ctrlPos, ctrlSize, DB_SLIDER, true,
|
||||
_("Gain"),
|
||||
ctrlPos, ctrlSize, DB_SLIDER, true,
|
||||
true, 0.0, wxVERTICAL);
|
||||
mSlider_Gain->SetName(_("Gain"));
|
||||
|
||||
|
@ -238,10 +238,10 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
|
|||
wxBitmap* bitmap = mMixerBoard->GetMusicalInstrumentBitmap(mLeftTrack);
|
||||
#endif
|
||||
wxASSERT(bitmap);
|
||||
mBitmapButton_MusicalInstrument =
|
||||
new wxBitmapButton(this, ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, *bitmap,
|
||||
ctrlPos, ctrlSize,
|
||||
wxBU_AUTODRAW, wxDefaultValidator,
|
||||
mBitmapButton_MusicalInstrument =
|
||||
new wxBitmapButton(this, ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, *bitmap,
|
||||
ctrlPos, ctrlSize,
|
||||
wxBU_AUTODRAW, wxDefaultValidator,
|
||||
_("Musical Instrument"));
|
||||
mBitmapButton_MusicalInstrument->SetName(_("Musical Instrument"));
|
||||
|
||||
|
@ -255,12 +255,12 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
|
|||
if (!(ctrlSize.x & 1))
|
||||
ctrlSize.x--;
|
||||
|
||||
mSlider_Pan =
|
||||
mSlider_Pan =
|
||||
new MixerTrackSlider(
|
||||
this, ID_SLIDER_PAN,
|
||||
this, ID_SLIDER_PAN,
|
||||
/* i18n-hint: Title of the Pan slider, used to move the sound left or right */
|
||||
_("Pan"),
|
||||
ctrlPos, ctrlSize, PAN_SLIDER, true);
|
||||
_("Pan"),
|
||||
ctrlPos, ctrlSize, PAN_SLIDER, true);
|
||||
mSlider_Pan->SetName(_("Pan"));
|
||||
|
||||
this->UpdatePan();
|
||||
|
@ -268,47 +268,47 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
|
|||
// mute/solo buttons stacked below Pan slider
|
||||
ctrlPos.y += PAN_HEIGHT + kDoubleInset;
|
||||
ctrlSize.Set(mMixerBoard->mMuteSoloWidth, MUTE_SOLO_HEIGHT);
|
||||
mToggleButton_Mute =
|
||||
new AButton(this, ID_TOGGLEBUTTON_MUTE,
|
||||
ctrlPos, ctrlSize,
|
||||
*(mMixerBoard->mImageMuteUp), *(mMixerBoard->mImageMuteOver),
|
||||
*(mMixerBoard->mImageMuteDown), *(mMixerBoard->mImageMuteDisabled),
|
||||
mToggleButton_Mute =
|
||||
new AButton(this, ID_TOGGLEBUTTON_MUTE,
|
||||
ctrlPos, ctrlSize,
|
||||
*(mMixerBoard->mImageMuteUp), *(mMixerBoard->mImageMuteOver),
|
||||
*(mMixerBoard->mImageMuteDown), *(mMixerBoard->mImageMuteDisabled),
|
||||
true); // toggle button
|
||||
mToggleButton_Mute->SetName(_("Mute"));
|
||||
mToggleButton_Mute->SetAlternateImages(
|
||||
*(mMixerBoard->mImageMuteUp), *(mMixerBoard->mImageMuteOver),
|
||||
*(mMixerBoard->mImageMuteUp), *(mMixerBoard->mImageMuteOver),
|
||||
*(mMixerBoard->mImageMuteDown), *(mMixerBoard->mImageMuteDisabled));
|
||||
this->UpdateMute();
|
||||
|
||||
ctrlPos.y += MUTE_SOLO_HEIGHT;
|
||||
mToggleButton_Solo =
|
||||
new AButton(this, ID_TOGGLEBUTTON_SOLO,
|
||||
ctrlPos, ctrlSize,
|
||||
*(mMixerBoard->mImageSoloUp), *(mMixerBoard->mImageSoloOver),
|
||||
*(mMixerBoard->mImageSoloDown), *(mMixerBoard->mImageSoloDisabled),
|
||||
mToggleButton_Solo =
|
||||
new AButton(this, ID_TOGGLEBUTTON_SOLO,
|
||||
ctrlPos, ctrlSize,
|
||||
*(mMixerBoard->mImageSoloUp), *(mMixerBoard->mImageSoloOver),
|
||||
*(mMixerBoard->mImageSoloDown), *(mMixerBoard->mImageSoloDisabled),
|
||||
true); // toggle button
|
||||
mToggleButton_Solo->SetName(_("Solo"));
|
||||
this->UpdateSolo();
|
||||
bool bSoloNone = mProject->IsSoloNone();
|
||||
mToggleButton_Solo->Show(!bSoloNone);
|
||||
|
||||
|
||||
|
||||
// meter
|
||||
ctrlPos.y += (bSoloNone ? 0 : MUTE_SOLO_HEIGHT) + kDoubleInset;
|
||||
const int nMeterHeight =
|
||||
nGainSliderHeight -
|
||||
const int nMeterHeight =
|
||||
nGainSliderHeight -
|
||||
(MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH + kDoubleInset) -
|
||||
(PAN_HEIGHT + kDoubleInset) -
|
||||
(PAN_HEIGHT + kDoubleInset) -
|
||||
(MUTE_SOLO_HEIGHT + (bSoloNone ? 0 : MUTE_SOLO_HEIGHT) + kDoubleInset);
|
||||
ctrlSize.Set(kRightSideStackWidth, nMeterHeight);
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
if (mLeftTrack) {
|
||||
#endif
|
||||
mMeter =
|
||||
new Meter(this, -1, // wxWindow* parent, wxWindowID id,
|
||||
mMeter =
|
||||
new Meter(this, -1, // wxWindow* parent, wxWindowID id,
|
||||
false, // bool isInput
|
||||
ctrlPos, ctrlSize, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
Meter::MixerTrackCluster); // Style style = HorizontalStereo,
|
||||
Meter::MixerTrackCluster); // Style style = HorizontalStereo,
|
||||
mMeter->SetName(_("Signal Level Meter"));
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
} else {
|
||||
|
@ -339,34 +339,34 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
|
|||
|
||||
void MixerTrackCluster::HandleResize() // For wxSizeEvents, update gain slider and meter.
|
||||
{
|
||||
wxSize scrolledWindowClientSize = this->GetParent()->GetClientSize();
|
||||
const int newClusterHeight =
|
||||
wxSize scrolledWindowClientSize = this->GetParent()->GetClientSize();
|
||||
const int newClusterHeight =
|
||||
scrolledWindowClientSize.GetHeight() - kDoubleInset - // nClusterHeight from MixerBoard::UpdateTrackClusters
|
||||
wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y) + // wxScrolledWindow::GetClientSize doesn't account for its scrollbar size.
|
||||
kDoubleInset;
|
||||
|
||||
this->SetSize(-1, newClusterHeight);
|
||||
|
||||
// Change only the heights of mSlider_Gain and mMeter.
|
||||
this->SetSize(-1, newClusterHeight);
|
||||
|
||||
// Change only the heights of mSlider_Gain and mMeter.
|
||||
// But update shown status of mToggleButton_Solo, which affects top of mMeter.
|
||||
const int nGainSliderHeight =
|
||||
newClusterHeight -
|
||||
const int nGainSliderHeight =
|
||||
newClusterHeight -
|
||||
(kInset + // margin above mStaticText_TrackName
|
||||
TRACK_NAME_HEIGHT + kDoubleInset) - // mStaticText_TrackName + margin
|
||||
kQuadrupleInset; // margin below gain slider
|
||||
mSlider_Gain->SetSize(-1, nGainSliderHeight);
|
||||
mSlider_Gain->SetSize(-1, nGainSliderHeight);
|
||||
|
||||
bool bSoloNone = mProject->IsSoloNone();
|
||||
|
||||
mToggleButton_Solo->Show(!bSoloNone);
|
||||
|
||||
const int nRequiredHeightAboveMeter =
|
||||
MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH + kDoubleInset +
|
||||
PAN_HEIGHT + kDoubleInset +
|
||||
const int nRequiredHeightAboveMeter =
|
||||
MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH + kDoubleInset +
|
||||
PAN_HEIGHT + kDoubleInset +
|
||||
MUTE_SOLO_HEIGHT + (bSoloNone ? 0 : MUTE_SOLO_HEIGHT) + kDoubleInset;
|
||||
const int nMeterY =
|
||||
const int nMeterY =
|
||||
kDoubleInset + // margin at top
|
||||
TRACK_NAME_HEIGHT + kDoubleInset +
|
||||
TRACK_NAME_HEIGHT + kDoubleInset +
|
||||
nRequiredHeightAboveMeter;
|
||||
const int nMeterHeight = nGainSliderHeight - nRequiredHeightAboveMeter;
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
|
@ -387,7 +387,7 @@ void MixerTrackCluster::HandleSliderGain(const bool bWantPushState /*= false*/)
|
|||
if (mRightTrack)
|
||||
mRightTrack->SetGain(fValue);
|
||||
|
||||
// Update the TrackPanel correspondingly.
|
||||
// Update the TrackPanel correspondingly.
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
mProject->RefreshTPTrack(mTrack);
|
||||
#else
|
||||
|
@ -405,7 +405,7 @@ void MixerTrackCluster::HandleSliderPan(const bool bWantPushState /*= false*/)
|
|||
if (mRightTrack)
|
||||
mRightTrack->SetPan(fValue);
|
||||
|
||||
// Update the TrackPanel correspondingly.
|
||||
// Update the TrackPanel correspondingly.
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
mProject->RefreshTPTrack(mTrack);
|
||||
#else
|
||||
|
@ -419,7 +419,7 @@ void MixerTrackCluster::HandleSliderPan(const bool bWantPushState /*= false*/)
|
|||
void MixerTrackCluster::ResetMeter(const bool bResetClipping)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
if (mMeter)
|
||||
if (mMeter)
|
||||
#endif
|
||||
mMeter->Reset(mLeftTrack->GetRate(), bResetClipping);
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ void MixerTrackCluster::ResetMeter(const bool bResetClipping)
|
|||
// These are used by TrackPanel for synchronizing control states, etc.
|
||||
|
||||
// Update the controls that can be affected by state change.
|
||||
void MixerTrackCluster::UpdateForStateChange()
|
||||
void MixerTrackCluster::UpdateForStateChange()
|
||||
{
|
||||
this->UpdateName();
|
||||
this->UpdatePan();
|
||||
|
@ -443,7 +443,7 @@ void MixerTrackCluster::UpdateName()
|
|||
const wxString newName = mLeftTrack->GetName();
|
||||
#endif
|
||||
SetName(newName);
|
||||
mStaticText_TrackName->SetLabel(newName);
|
||||
mStaticText_TrackName->SetLabel(newName);
|
||||
#if wxUSE_TOOLTIPS
|
||||
mStaticText_TrackName->SetToolTip(newName);
|
||||
#endif
|
||||
|
@ -464,9 +464,9 @@ void MixerTrackCluster::UpdateMute()
|
|||
mToggleButton_Mute->SetAlternate(mLeftTrack->GetSolo());
|
||||
if (mLeftTrack->GetMute())
|
||||
#endif
|
||||
mToggleButton_Mute->PushDown();
|
||||
else
|
||||
mToggleButton_Mute->PopUp();
|
||||
mToggleButton_Mute->PushDown();
|
||||
else
|
||||
mToggleButton_Mute->PopUp();
|
||||
}
|
||||
|
||||
void MixerTrackCluster::UpdateSolo()
|
||||
|
@ -477,9 +477,9 @@ void MixerTrackCluster::UpdateSolo()
|
|||
bool bIsSolo = mLeftTrack->GetSolo();
|
||||
#endif
|
||||
if (bIsSolo)
|
||||
mToggleButton_Solo->PushDown();
|
||||
else
|
||||
mToggleButton_Solo->PopUp();
|
||||
mToggleButton_Solo->PushDown();
|
||||
else
|
||||
mToggleButton_Solo->PopUp();
|
||||
mToggleButton_Mute->SetAlternate(bIsSolo);
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ void MixerTrackCluster::UpdateGain()
|
|||
}
|
||||
mSlider_Gain->SetStyle(DB_SLIDER);
|
||||
#endif
|
||||
mSlider_Gain->Set(mLeftTrack->GetGain());
|
||||
mSlider_Gain->Set(mLeftTrack->GetGain());
|
||||
}
|
||||
|
||||
void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
||||
|
@ -512,22 +512,22 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
|||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
// NoteTracks do not (currently) register on meters. It would probably be
|
||||
// a good idea to display 16 channel "active" lights rather than a meter
|
||||
if (!mLeftTrack)
|
||||
if (!mLeftTrack)
|
||||
return;
|
||||
#else
|
||||
wxASSERT(mLeftTrack && (mLeftTrack->GetKind() == Track::Wave));
|
||||
#endif
|
||||
|
||||
//vvv Vaughan, 2010-11-27:
|
||||
// NOTE TO ROGER DANNENBERG:
|
||||
//vvv Vaughan, 2010-11-27:
|
||||
// NOTE TO ROGER DANNENBERG:
|
||||
// I undid the mTrack hack in this conditional, as the rest of the method still assumed it's a wavetrack
|
||||
// so dereferencing mLeftTrack would have gotten a NULL pointer fault.
|
||||
// so dereferencing mLeftTrack would have gotten a NULL pointer fault.
|
||||
// I really think MixerTrackCluster should be factored for NoteTracks.
|
||||
// REPLY: I think bSuccess prevents dereferencing mLeftTrack, but I will
|
||||
// check. We should talk about whether it's better to factor
|
||||
// MixerTrackCluster or more fully hide track types from MixerTrackCluster.
|
||||
// For now, out change plan produced the following:
|
||||
// Vaughan, 2011=10-15: There's no bSuccess here, so I don't know what you mean.
|
||||
// Vaughan, 2011=10-15: There's no bSuccess here, so I don't know what you mean.
|
||||
// But this change is consistent with the others for EXPERIMENTAL_MIDI_OUT, so I accept it.
|
||||
if ((t0 < 0.0) || (t1 < 0.0) || (t0 >= t1) || // bad time value or nothing to show
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
|
@ -536,26 +536,26 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
|||
((mMixerBoard->HasSolo() || mLeftTrack->GetMute()) && !mLeftTrack->GetSolo()))
|
||||
#endif
|
||||
{
|
||||
//v Vaughan, 2011-02-25: Moved the update back to TrackPanel::OnTimer() as it helps with
|
||||
//v Vaughan, 2011-02-25: Moved the update back to TrackPanel::OnTimer() as it helps with
|
||||
// playback issues reported by Bill and noted on Bug 258, so no assert.
|
||||
// Vaughan, 2011-02-04: Now that we're updating all meters from audacityAudioCallback,
|
||||
// this causes an assert if you click Mute while playing, because ResetMeter() resets
|
||||
// the timer, and wxTimerbase says that can only be done from main thread --
|
||||
// Vaughan, 2011-02-04: Now that we're updating all meters from audacityAudioCallback,
|
||||
// this causes an assert if you click Mute while playing, because ResetMeter() resets
|
||||
// the timer, and wxTimerbase says that can only be done from main thread --
|
||||
// but it seems to work fine.
|
||||
this->ResetMeter(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Vaughan, 2010-11-27:
|
||||
// Vaughan, 2010-11-27:
|
||||
// This commented out code is flawed. Mistaken understanding of "frame" vs "window".
|
||||
// Caused me to override Meter::UpdateDisplay().
|
||||
// But I think it's got a good idea, of calling WaveTracks' GetMinMax and GetRMS
|
||||
// But I think it's got a good idea, of calling WaveTracks' GetMinMax and GetRMS
|
||||
// instead of passing in all the data and asking the meter to derive peak and rms.
|
||||
// May be worth revisiting as I think it should perform better, because it uses the min/max/rms
|
||||
// stored in blockfiles, rather than calculating them, but for now, changing it to use the
|
||||
// May be worth revisiting as I think it should perform better, because it uses the min/max/rms
|
||||
// stored in blockfiles, rather than calculating them, but for now, changing it to use the
|
||||
// original Meter::UpdateDisplay(). New code is below the previous (now commented out).
|
||||
//
|
||||
//const int kFramesPerBuffer = 4;
|
||||
//
|
||||
//const int kFramesPerBuffer = 4;
|
||||
//float min; // dummy, since it's not shown in meters
|
||||
//float* maxLeft = new float[kFramesPerBuffer];
|
||||
//float* rmsLeft = new float[kFramesPerBuffer];
|
||||
|
@ -574,16 +574,16 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
|||
//int i = 0;
|
||||
//while (bSuccess && (i < kFramesPerBuffer))
|
||||
//{
|
||||
// bSuccess &=
|
||||
// mLeftTrack->GetMinMax(&min, &(maxLeft[i]), dFrameT0, dFrameT1) &&
|
||||
// bSuccess &=
|
||||
// mLeftTrack->GetMinMax(&min, &(maxLeft[i]), dFrameT0, dFrameT1) &&
|
||||
// mLeftTrack->GetRMS(&(rmsLeft[i]), dFrameT0, dFrameT1);
|
||||
// if (bSuccess && mRightTrack)
|
||||
// bSuccess &=
|
||||
// mRightTrack->GetMinMax(&min, &(maxRight[i]), dFrameT0, dFrameT1) &&
|
||||
// mRightTrack->GetMinMax(&min, &(maxRight[i]), dFrameT0, dFrameT1) &&
|
||||
// mRightTrack->GetRMS(&(rmsRight[i]), dFrameT0, dFrameT1);
|
||||
// else
|
||||
// {
|
||||
// // Mono: Start with raw values same as left.
|
||||
// // Mono: Start with raw values same as left.
|
||||
// // To be modified by bWantPostFadeValues and channel pan/gain.
|
||||
// maxRight[i] = maxLeft[i];
|
||||
// rmsRight[i] = rmsLeft[i];
|
||||
|
@ -609,9 +609,9 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
|||
// }
|
||||
// mMeter->UpdateDisplay(
|
||||
// 2, // If mono, show left track values in both meters, as in MeterToolBar, rather than kNumChannels.
|
||||
// kFramesPerBuffer,
|
||||
// maxLeft, rmsLeft,
|
||||
// maxRight, rmsRight,
|
||||
// kFramesPerBuffer,
|
||||
// maxLeft, rmsLeft,
|
||||
// maxRight, rmsRight,
|
||||
// mLeftTrack->TimeToLongSamples(t1 - t0));
|
||||
//}
|
||||
//
|
||||
|
@ -627,7 +627,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
|||
bool bSuccess = mLeftTrack->Get((samplePtr)tempFloatsArray, floatSample, startSample, nFrames);
|
||||
if (bSuccess)
|
||||
{
|
||||
// We always pass a stereo sample array to the meter, as it shows 2 channels.
|
||||
// We always pass a stereo sample array to the meter, as it shows 2 channels.
|
||||
// Mono shows same in both meters.
|
||||
// Since we're not mixing, need to duplicate same signal for "right" channel in mono case.
|
||||
meterFloatsArray = new float[2 * nFrames];
|
||||
|
@ -636,7 +636,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
|||
for (int index = 0; index < nFrames; index++)
|
||||
meterFloatsArray[2 * index] = tempFloatsArray[index];
|
||||
|
||||
if (mRightTrack)
|
||||
if (mRightTrack)
|
||||
bSuccess = mRightTrack->Get((samplePtr)tempFloatsArray, floatSample, startSample, nFrames);
|
||||
|
||||
if (bSuccess)
|
||||
|
@ -648,7 +648,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
|||
//const bool bWantPostFadeValues = true; //v Turn this into a checkbox on MixerBoard? For now, always true.
|
||||
//if (bSuccess && bWantPostFadeValues)
|
||||
if (bSuccess)
|
||||
{
|
||||
{
|
||||
//vvv Need to apply envelope, too? See Mixer::MixSameRate.
|
||||
float gain = mLeftTrack->GetChannelGain(0);
|
||||
if (gain < 1.0)
|
||||
|
@ -693,7 +693,7 @@ wxColour MixerTrackCluster::GetTrackColor()
|
|||
|
||||
void MixerTrackCluster::HandleSelect(const bool bShiftDown)
|
||||
{
|
||||
if (bShiftDown)
|
||||
if (bShiftDown)
|
||||
{
|
||||
// ShiftDown => Just toggle selection on this track.
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
|
@ -707,7 +707,7 @@ void MixerTrackCluster::HandleSelect(const bool bShiftDown)
|
|||
mRightTrack->SetSelected(bSelect);
|
||||
|
||||
// Refresh only this MixerTrackCluster and WaveTrack in TrackPanel.
|
||||
this->Refresh(true);
|
||||
this->Refresh(true);
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
mProject->RefreshTPTrack(mTrack);
|
||||
#else
|
||||
|
@ -728,7 +728,7 @@ void MixerTrackCluster::HandleSelect(const bool bShiftDown)
|
|||
|
||||
if (mProject->GetSel0() >= mProject->GetSel1())
|
||||
{
|
||||
// No range previously selected, so use the range of this track.
|
||||
// No range previously selected, so use the range of this track.
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
mProject->mViewInfo.sel0 = mTrack->GetOffset();
|
||||
mProject->mViewInfo.sel1 = mTrack->GetEndTime();
|
||||
|
@ -739,8 +739,8 @@ void MixerTrackCluster::HandleSelect(const bool bShiftDown)
|
|||
}
|
||||
|
||||
// Exclusive select, so refresh all MixerTrackClusters.
|
||||
// This could just be a call to wxWindow::Refresh, but this is
|
||||
// more efficient and when ProjectLogo is shown as background,
|
||||
// This could just be a call to wxWindow::Refresh, but this is
|
||||
// more efficient and when ProjectLogo is shown as background,
|
||||
// it's necessary to prevent blinking.
|
||||
mMixerBoard->RefreshTrackClusters(false);
|
||||
}
|
||||
|
@ -753,7 +753,7 @@ void MixerTrackCluster::OnKeyEvent(wxKeyEvent & event)
|
|||
|
||||
void MixerTrackCluster::OnMouseEvent(wxMouseEvent& event)
|
||||
{
|
||||
if (event.ButtonUp())
|
||||
if (event.ButtonUp())
|
||||
this->HandleSelect(event.ShiftDown());
|
||||
else
|
||||
event.Skip();
|
||||
|
@ -804,12 +804,12 @@ void MixerTrackCluster::OnSlider_Gain(wxCommandEvent& WXUNUSED(event))
|
|||
//{
|
||||
//int sliderValue = (int)(mSlider_Gain->Get()); //v mSlider_Gain->GetValue();
|
||||
//#ifdef __WXMSW__
|
||||
// // Negate because wxSlider on Windows has min at top, max at bottom.
|
||||
// // mSlider_Gain->GetValue() is in [-6,36]. wxSlider has min at top, so this is [-36dB,6dB].
|
||||
// // Negate because wxSlider on Windows has min at top, max at bottom.
|
||||
// // mSlider_Gain->GetValue() is in [-6,36]. wxSlider has min at top, so this is [-36dB,6dB].
|
||||
// sliderValue = -sliderValue;
|
||||
//#endif
|
||||
//wxString str = _("Gain: ");
|
||||
//if (sliderValue > 0)
|
||||
//if (sliderValue > 0)
|
||||
// str += "+";
|
||||
//str += wxString::Format("%d dB", sliderValue);
|
||||
//mSlider_Gain->SetToolTip(str);
|
||||
|
@ -830,7 +830,7 @@ void MixerTrackCluster::OnButton_Mute(wxCommandEvent& WXUNUSED(event))
|
|||
mToggleButton_Mute->SetAlternate(mLeftTrack->GetSolo());
|
||||
#endif
|
||||
|
||||
// Update the TrackPanel correspondingly.
|
||||
// Update the TrackPanel correspondingly.
|
||||
if (mProject->IsSoloSimple())
|
||||
{
|
||||
// Have to refresh all tracks.
|
||||
|
@ -838,7 +838,7 @@ void MixerTrackCluster::OnButton_Mute(wxCommandEvent& WXUNUSED(event))
|
|||
mProject->RedrawProject();
|
||||
}
|
||||
else
|
||||
// Update only the changed track.
|
||||
// Update only the changed track.
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
mProject->RefreshTPTrack(mTrack);
|
||||
#else
|
||||
|
@ -857,7 +857,7 @@ void MixerTrackCluster::OnButton_Solo(wxCommandEvent& WXUNUSED(event))
|
|||
#endif
|
||||
mToggleButton_Mute->SetAlternate(bIsSolo);
|
||||
|
||||
// Update the TrackPanel correspondingly.
|
||||
// Update the TrackPanel correspondingly.
|
||||
if (mProject->IsSoloSimple())
|
||||
{
|
||||
// Have to refresh all tracks.
|
||||
|
@ -866,7 +866,7 @@ void MixerTrackCluster::OnButton_Solo(wxCommandEvent& WXUNUSED(event))
|
|||
mProject->RedrawProject();
|
||||
}
|
||||
else
|
||||
// Update only the changed track.
|
||||
// Update only the changed track.
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
mProject->RefreshTPTrack(mTrack);
|
||||
#else
|
||||
|
@ -885,14 +885,14 @@ MusicalInstrument::MusicalInstrument(wxBitmap* pBitmap, const wxString strXPMfil
|
|||
wxString strFilename = strXPMfilename;
|
||||
strFilename.MakeLower(); // Make sure, so we don't have to do case insensitive comparison.
|
||||
wxString strKeyword;
|
||||
while ((nUnderscoreIndex = strFilename.Find(wxT('_'))) != -1)
|
||||
while ((nUnderscoreIndex = strFilename.Find(wxT('_'))) != -1)
|
||||
{
|
||||
strKeyword = strFilename.Left(nUnderscoreIndex);
|
||||
mKeywords.Add(strKeyword);
|
||||
strFilename = strFilename.Mid(nUnderscoreIndex + 1);
|
||||
}
|
||||
if (!strFilename.IsEmpty()) // Skip trailing underscores.
|
||||
mKeywords.Add(strFilename); // Add the last one.
|
||||
mKeywords.Add(strFilename); // Add the last one.
|
||||
}
|
||||
|
||||
MusicalInstrument::~MusicalInstrument()
|
||||
|
@ -904,9 +904,9 @@ MusicalInstrument::~MusicalInstrument()
|
|||
WX_DEFINE_OBJARRAY(MusicalInstrumentArray);
|
||||
|
||||
|
||||
// class MixerBoardScrolledWindow
|
||||
// class MixerBoardScrolledWindow
|
||||
|
||||
// wxScrolledWindow ignores mouse clicks in client area,
|
||||
// wxScrolledWindow ignores mouse clicks in client area,
|
||||
// but they don't get passed to Mixerboard.
|
||||
// We need to catch them to deselect all track clusters.
|
||||
|
||||
|
@ -914,10 +914,10 @@ BEGIN_EVENT_TABLE(MixerBoardScrolledWindow, wxScrolledWindow)
|
|||
EVT_MOUSE_EVENTS(MixerBoardScrolledWindow::OnMouseEvent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MixerBoardScrolledWindow::MixerBoardScrolledWindow(AudacityProject* project,
|
||||
MixerBoard* parent, wxWindowID id /*= -1*/,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
const wxSize& size /*= wxDefaultSize*/,
|
||||
MixerBoardScrolledWindow::MixerBoardScrolledWindow(AudacityProject* project,
|
||||
MixerBoard* parent, wxWindowID id /*= -1*/,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
const wxSize& size /*= wxDefaultSize*/,
|
||||
long style /*= wxHSCROLL | wxVSCROLL*/)
|
||||
: wxScrolledWindow(parent, id, pos, size, style)
|
||||
{
|
||||
|
@ -931,9 +931,9 @@ MixerBoardScrolledWindow::~MixerBoardScrolledWindow()
|
|||
|
||||
void MixerBoardScrolledWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
{
|
||||
if (event.ButtonUp())
|
||||
if (event.ButtonUp())
|
||||
{
|
||||
//v Even when I implement MixerBoard::OnMouseEvent and call event.Skip()
|
||||
//v Even when I implement MixerBoard::OnMouseEvent and call event.Skip()
|
||||
// here, MixerBoard::OnMouseEvent never gets called.
|
||||
// So, added mProject to MixerBoardScrolledWindow and just directly do what's needed here.
|
||||
mProject->SelectNone();
|
||||
|
@ -948,16 +948,16 @@ void MixerBoardScrolledWindow::OnMouseEvent(wxMouseEvent& event)
|
|||
#define MIXER_BOARD_MIN_HEIGHT 460
|
||||
|
||||
// Min width is one cluster wide, plus margins.
|
||||
#define MIXER_BOARD_MIN_WIDTH kTripleInset + kMixerTrackClusterWidth + kTripleInset
|
||||
#define MIXER_BOARD_MIN_WIDTH kTripleInset + kMixerTrackClusterWidth + kTripleInset
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(MixerBoard, wxWindow)
|
||||
EVT_SIZE(MixerBoard::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MixerBoard::MixerBoard(AudacityProject* pProject,
|
||||
wxFrame* parent,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
MixerBoard::MixerBoard(AudacityProject* pProject,
|
||||
wxFrame* parent,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
const wxSize& size /*= wxDefaultSize*/)
|
||||
: wxWindow(parent, -1, pos, size)
|
||||
{
|
||||
|
@ -980,22 +980,22 @@ MixerBoard::MixerBoard(AudacityProject* pProject,
|
|||
// private data members
|
||||
this->LoadMusicalInstruments(); // Set up mMusicalInstruments.
|
||||
mProject = pProject;
|
||||
|
||||
mScrolledWindow =
|
||||
|
||||
mScrolledWindow =
|
||||
new MixerBoardScrolledWindow(
|
||||
pProject, // AudacityProject* project,
|
||||
this, -1, // wxWindow* parent, wxWindowID id = -1,
|
||||
this->GetClientAreaOrigin(), // const wxPoint& pos = wxDefaultPosition,
|
||||
size, // const wxSize& size = wxDefaultSize,
|
||||
this, -1, // wxWindow* parent, wxWindowID id = -1,
|
||||
this->GetClientAreaOrigin(), // const wxPoint& pos = wxDefaultPosition,
|
||||
size, // const wxSize& size = wxDefaultSize,
|
||||
wxHSCROLL); // long style = wxHSCROLL | wxVSCROLL, const wxString& name = "scrolledWindow")
|
||||
|
||||
// Set background color to same as TrackPanel background.
|
||||
#ifdef EXPERIMENTAL_THEMING
|
||||
mScrolledWindow->SetBackgroundColour(this->GetParent()->GetBackgroundColour());
|
||||
#else
|
||||
mScrolledWindow->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));
|
||||
mScrolledWindow->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));
|
||||
#endif
|
||||
|
||||
|
||||
mScrolledWindow->SetScrollRate(10, 0); // no vertical scroll
|
||||
mScrolledWindow->SetVirtualSize(size);
|
||||
|
||||
|
@ -1030,15 +1030,15 @@ MixerBoard::~MixerBoard()
|
|||
}
|
||||
|
||||
// Reassign mixer input strips (MixerTrackClusters) to Track Clusters
|
||||
// both have the same order.
|
||||
// both have the same order.
|
||||
// If EXPERIMENTAL_MIDI_OUT, then Note Tracks appear in the
|
||||
// mixer, and we must be able to convert and reuse a MixerTrackCluster
|
||||
// mixer, and we must be able to convert and reuse a MixerTrackCluster
|
||||
// from audio to midi or midi to audio. This task is handled by
|
||||
// UpdateForStateChange().
|
||||
//
|
||||
void MixerBoard::UpdateTrackClusters()
|
||||
void MixerBoard::UpdateTrackClusters()
|
||||
{
|
||||
if (!mImageMuteUp)
|
||||
if (!mImageMuteUp)
|
||||
this->CreateMuteSoloImages();
|
||||
|
||||
const int nClusterHeight = mScrolledWindow->GetClientSize().GetHeight() - kDoubleInset;
|
||||
|
@ -1053,17 +1053,17 @@ void MixerBoard::UpdateTrackClusters()
|
|||
while (pLeftTrack) {
|
||||
pRightTrack = pLeftTrack->GetLinked() ? iterTracks.Next() : NULL;
|
||||
|
||||
if (pLeftTrack->GetKind() == Track::Wave
|
||||
if (pLeftTrack->GetKind() == Track::Wave
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
|| pLeftTrack->GetKind() == Track::Note
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
if (nClusterIndex < nClusterCount)
|
||||
{
|
||||
// Already showing it.
|
||||
// Already showing it.
|
||||
// Track clusters are maintained in the same order as the WaveTracks.
|
||||
// Track pointers can change for the "same" track for different states
|
||||
// Track pointers can change for the "same" track for different states
|
||||
// on the undo stack, so update the pointers and display name.
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
if (pLeftTrack->GetKind() == Track::Note) {
|
||||
|
@ -1084,14 +1084,14 @@ void MixerBoard::UpdateTrackClusters()
|
|||
// Not already showing it. Add a new MixerTrackCluster.
|
||||
wxPoint clusterPos(
|
||||
(kInset + // extra inset to left for first one, so it's double
|
||||
(nClusterIndex *
|
||||
(nClusterIndex *
|
||||
(kInset + kMixerTrackClusterWidth)) + // left margin and width for each to its left
|
||||
kInset), // plus left margin for new cluster
|
||||
kInset);
|
||||
kInset);
|
||||
wxSize clusterSize(kMixerTrackClusterWidth, nClusterHeight);
|
||||
pMixerTrackCluster =
|
||||
new MixerTrackCluster(mScrolledWindow, this, mProject,
|
||||
(WaveTrack*)pLeftTrack, (WaveTrack*)pRightTrack,
|
||||
pMixerTrackCluster =
|
||||
new MixerTrackCluster(mScrolledWindow, this, mProject,
|
||||
(WaveTrack*)pLeftTrack, (WaveTrack*)pRightTrack,
|
||||
clusterPos, clusterSize);
|
||||
if (pMixerTrackCluster)
|
||||
mMixerTrackClusters.Add(pMixerTrackCluster);
|
||||
|
@ -1109,9 +1109,9 @@ void MixerBoard::UpdateTrackClusters()
|
|||
}
|
||||
else if (nClusterIndex < nClusterCount)
|
||||
{
|
||||
// We've got too many clusters.
|
||||
// We've got too many clusters.
|
||||
// This can happen only on things like Undo New Audio Track or Undo Import
|
||||
// that don't call RemoveTrackCluster explicitly.
|
||||
// that don't call RemoveTrackCluster explicitly.
|
||||
// We've already updated the track pointers for the clusters to the left, so just remove all the rest.
|
||||
// Keep nClusterIndex constant and successively delete from left to right.
|
||||
for (unsigned int nCounter = nClusterIndex; nCounter < nClusterCount; nCounter++)
|
||||
|
@ -1125,7 +1125,7 @@ void MixerBoard::UpdateTrackClusters()
|
|||
|
||||
int MixerBoard::GetTrackClustersWidth()
|
||||
{
|
||||
return
|
||||
return
|
||||
kInset + // extra margin at left for first one
|
||||
(mMixerTrackClusters.GetCount() * // number of tracks times
|
||||
(kInset + kMixerTrackClusterWidth)) + // left margin and width for each
|
||||
|
@ -1133,16 +1133,16 @@ int MixerBoard::GetTrackClustersWidth()
|
|||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
void MixerBoard::MoveTrackCluster(const Track* pTrack,
|
||||
void MixerBoard::MoveTrackCluster(const Track* pTrack,
|
||||
bool bUp) // Up in TrackPanel is left in MixerBoard.
|
||||
#else
|
||||
void MixerBoard::MoveTrackCluster(const WaveTrack* pTrack,
|
||||
void MixerBoard::MoveTrackCluster(const WaveTrack* pTrack,
|
||||
bool bUp) // Up in TrackPanel is left in MixerBoard.
|
||||
#endif
|
||||
{
|
||||
MixerTrackCluster* pMixerTrackCluster;
|
||||
int nIndex = FindMixerTrackCluster(pTrack, &pMixerTrackCluster);
|
||||
if (pMixerTrackCluster == NULL)
|
||||
if (pMixerTrackCluster == NULL)
|
||||
return; // Couldn't find it.
|
||||
|
||||
wxPoint pos;
|
||||
|
@ -1160,7 +1160,7 @@ void MixerBoard::MoveTrackCluster(const WaveTrack* pTrack,
|
|||
}
|
||||
else
|
||||
{ // Move it down (right).
|
||||
if (((unsigned int)nIndex + 1) >= mMixerTrackClusters.GetCount())
|
||||
if (((unsigned int)nIndex + 1) >= mMixerTrackClusters.GetCount())
|
||||
return; // It's already last.
|
||||
|
||||
pos = pMixerTrackCluster->GetPosition();
|
||||
|
@ -1181,7 +1181,7 @@ void MixerBoard::RemoveTrackCluster(const WaveTrack* pTrack)
|
|||
// Find and destroy.
|
||||
MixerTrackCluster* pMixerTrackCluster;
|
||||
int nIndex = this->FindMixerTrackCluster(pTrack, &pMixerTrackCluster);
|
||||
if (pMixerTrackCluster == NULL)
|
||||
if (pMixerTrackCluster == NULL)
|
||||
return; // Couldn't find it.
|
||||
|
||||
mMixerTrackClusters.RemoveAt(nIndex);
|
||||
|
@ -1193,7 +1193,7 @@ void MixerBoard::RemoveTrackCluster(const WaveTrack* pTrack)
|
|||
for (unsigned int i = nIndex; i < mMixerTrackClusters.GetCount(); i++)
|
||||
{
|
||||
pos = mMixerTrackClusters[i]->GetPosition();
|
||||
targetX =
|
||||
targetX =
|
||||
kInset + // extra inset to left for first one, so it's double
|
||||
(i * (kInset + kMixerTrackClusterWidth)) + // left margin and width for each
|
||||
kInset; // plus left margin for this cluster
|
||||
|
@ -1221,8 +1221,8 @@ wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(const WaveTrack* pLeftTrack)
|
|||
if (mMusicalInstruments.IsEmpty())
|
||||
return NULL;
|
||||
|
||||
// random choice: return mMusicalInstruments[(int)pLeftTrack % mMusicalInstruments.GetCount()].mBitmap;
|
||||
|
||||
// random choice: return mMusicalInstruments[(int)pLeftTrack % mMusicalInstruments.GetCount()].mBitmap;
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
const wxString strTrackName(name.MakeLower());
|
||||
#else
|
||||
|
@ -1246,16 +1246,16 @@ wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(const WaveTrack* pLeftTrack)
|
|||
for (nKeywordIndex = 0; nKeywordIndex < nNumKeywords; nKeywordIndex++)
|
||||
if (strTrackName.Contains(mMusicalInstruments[nInstrIndex].mKeywords[nKeywordIndex]))
|
||||
{
|
||||
nScore +=
|
||||
nPointsPerMatch +
|
||||
nScore +=
|
||||
nPointsPerMatch +
|
||||
// Longer keywords get more points.
|
||||
(2 * mMusicalInstruments[nInstrIndex].mKeywords[nKeywordIndex].Length());
|
||||
}
|
||||
}
|
||||
|
||||
// Choose later one if just matching nBestScore, for better variety,
|
||||
// Choose later one if just matching nBestScore, for better variety,
|
||||
// and so default works as last element.
|
||||
if (nScore >= nBestScore)
|
||||
if (nScore >= nBestScore)
|
||||
{
|
||||
nBestScore = nScore;
|
||||
nBestItemIndex = nInstrIndex;
|
||||
|
@ -1264,12 +1264,12 @@ wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(const WaveTrack* pLeftTrack)
|
|||
return mMusicalInstruments[nBestItemIndex].mBitmap;
|
||||
}
|
||||
|
||||
bool MixerBoard::HasSolo()
|
||||
{
|
||||
bool MixerBoard::HasSolo()
|
||||
{
|
||||
TrackListIterator iterTracks(mTracks);
|
||||
Track* pTrack;
|
||||
for (pTrack = iterTracks.First(); pTrack; pTrack = iterTracks.Next())
|
||||
if (pTrack->GetSolo())
|
||||
for (pTrack = iterTracks.First(); pTrack; pTrack = iterTracks.Next())
|
||||
if (pTrack->GetSolo())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -1282,7 +1282,7 @@ void MixerBoard::RefreshTrackCluster(const WaveTrack* pTrack, bool bEraseBackgro
|
|||
{
|
||||
MixerTrackCluster* pMixerTrackCluster;
|
||||
this->FindMixerTrackCluster(pTrack, &pMixerTrackCluster);
|
||||
if (pMixerTrackCluster)
|
||||
if (pMixerTrackCluster)
|
||||
pMixerTrackCluster->Refresh(bEraseBackground);
|
||||
}
|
||||
|
||||
|
@ -1317,7 +1317,7 @@ void MixerBoard::UpdateName(const WaveTrack* pTrack)
|
|||
{
|
||||
MixerTrackCluster* pMixerTrackCluster;
|
||||
this->FindMixerTrackCluster(pTrack, &pMixerTrackCluster);
|
||||
if (pMixerTrackCluster)
|
||||
if (pMixerTrackCluster)
|
||||
pMixerTrackCluster->UpdateName();
|
||||
}
|
||||
|
||||
|
@ -1327,16 +1327,16 @@ void MixerBoard::UpdateMute(const Track* pTrack /*= NULL*/) // NULL means update
|
|||
void MixerBoard::UpdateMute(const WaveTrack* pTrack /*= NULL*/) // NULL means update for all tracks.
|
||||
#endif
|
||||
{
|
||||
if (pTrack == NULL)
|
||||
if (pTrack == NULL)
|
||||
{
|
||||
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
|
||||
mMixerTrackClusters[i]->UpdateMute();
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
MixerTrackCluster* pMixerTrackCluster;
|
||||
FindMixerTrackCluster(pTrack, &pMixerTrackCluster);
|
||||
if (pMixerTrackCluster)
|
||||
if (pMixerTrackCluster)
|
||||
pMixerTrackCluster->UpdateMute();
|
||||
}
|
||||
}
|
||||
|
@ -1347,16 +1347,16 @@ void MixerBoard::UpdateSolo(const Track* pTrack /*= NULL*/) // NULL means update
|
|||
void MixerBoard::UpdateSolo(const WaveTrack* pTrack /*= NULL*/) // NULL means update for all tracks.
|
||||
#endif
|
||||
{
|
||||
if (pTrack == NULL)
|
||||
if (pTrack == NULL)
|
||||
{
|
||||
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
|
||||
mMixerTrackClusters[i]->UpdateSolo();
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
MixerTrackCluster* pMixerTrackCluster;
|
||||
FindMixerTrackCluster(pTrack, &pMixerTrackCluster);
|
||||
if (pMixerTrackCluster)
|
||||
if (pMixerTrackCluster)
|
||||
pMixerTrackCluster->UpdateSolo();
|
||||
}
|
||||
}
|
||||
|
@ -1369,7 +1369,7 @@ void MixerBoard::UpdatePan(const WaveTrack* pTrack)
|
|||
{
|
||||
MixerTrackCluster* pMixerTrackCluster;
|
||||
FindMixerTrackCluster(pTrack, &pMixerTrackCluster);
|
||||
if (pMixerTrackCluster)
|
||||
if (pMixerTrackCluster)
|
||||
pMixerTrackCluster->UpdatePan();
|
||||
}
|
||||
|
||||
|
@ -1381,7 +1381,7 @@ void MixerBoard::UpdateGain(const WaveTrack* pTrack)
|
|||
{
|
||||
MixerTrackCluster* pMixerTrackCluster;
|
||||
FindMixerTrackCluster(pTrack, &pMixerTrackCluster);
|
||||
if (pMixerTrackCluster)
|
||||
if (pMixerTrackCluster)
|
||||
pMixerTrackCluster->UpdateGain();
|
||||
}
|
||||
|
||||
|
@ -1396,8 +1396,8 @@ void MixerBoard::UpdateMeters(const double t1, const bool bLoopedPlay)
|
|||
return;
|
||||
}
|
||||
|
||||
// In loopedPlay mode, at the end of the loop, mPrevT1 is set to
|
||||
// selection end, so the next t1 will be less, but we do want to
|
||||
// In loopedPlay mode, at the end of the loop, mPrevT1 is set to
|
||||
// selection end, so the next t1 will be less, but we do want to
|
||||
// keep updating the meters.
|
||||
if (t1 <= mPrevT1)
|
||||
{
|
||||
|
@ -1415,7 +1415,7 @@ void MixerBoard::UpdateMeters(const double t1, const bool bLoopedPlay)
|
|||
|
||||
void MixerBoard::UpdateWidth()
|
||||
{
|
||||
int newWidth = this->GetTrackClustersWidth();
|
||||
int newWidth = this->GetTrackClustersWidth();
|
||||
|
||||
// Min width is one cluster wide, plus margins.
|
||||
if (newWidth < MIXER_BOARD_MIN_WIDTH)
|
||||
|
@ -1433,7 +1433,7 @@ void MixerBoard::CreateMuteSoloImages()
|
|||
{
|
||||
// Much of this is taken from TrackLabel::DrawMuteSolo.
|
||||
wxMemoryDC dc;
|
||||
wxString str = _("Mute");
|
||||
wxString str = _("Mute");
|
||||
int textWidth, textHeight;
|
||||
|
||||
int fontSize = 10;
|
||||
|
@ -1504,7 +1504,7 @@ void MixerBoard::CreateMuteSoloImages()
|
|||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
int MixerBoard::FindMixerTrackCluster(const Track* pTrack,
|
||||
int MixerBoard::FindMixerTrackCluster(const Track* pTrack,
|
||||
MixerTrackCluster** hMixerTrackCluster) const
|
||||
#else
|
||||
int MixerBoard::FindMixerTrackCluster(const WaveTrack* pLeftTrack,
|
||||
|
@ -1540,7 +1540,7 @@ void MixerBoard::LoadMusicalInstruments()
|
|||
AColor::Bevel(dc, false, bev);
|
||||
pMusicalInstrument = new MusicalInstrument(bitmap, wxT("acoustic_guitar_gtr"));
|
||||
mMusicalInstruments.Add(pMusicalInstrument);
|
||||
|
||||
|
||||
bitmap = new wxBitmap((const char**)acoustic_piano_pno_xpm);
|
||||
dc.SelectObject(*bitmap);
|
||||
AColor::Bevel(dc, false, bev);
|
||||
|
@ -1565,7 +1565,7 @@ void MixerBoard::LoadMusicalInstruments()
|
|||
AColor::Bevel(dc, false, bev);
|
||||
pMusicalInstrument = new MusicalInstrument(bitmap, wxT("drums_dr"));
|
||||
mMusicalInstruments.Add(pMusicalInstrument);
|
||||
|
||||
|
||||
bitmap = new wxBitmap((const char**)electric_bass_guitar_bs_gtr_xpm);
|
||||
dc.SelectObject(*bitmap);
|
||||
AColor::Bevel(dc, false, bev);
|
||||
|
@ -1668,7 +1668,7 @@ void MixerBoard::LoadMusicalInstruments()
|
|||
|
||||
|
||||
// This one must be last, so it wins when best score is 0.
|
||||
bitmap = new wxBitmap((const char**)_default_instrument_xpm);
|
||||
bitmap = new wxBitmap((const char**)_default_instrument_xpm);
|
||||
dc.SelectObject(*bitmap);
|
||||
AColor::Bevel(dc, false, bev);
|
||||
pMusicalInstrument = new MusicalInstrument(bitmap, wxEmptyString);
|
||||
|
@ -1681,7 +1681,7 @@ void MixerBoard::OnSize(wxSizeEvent &evt)
|
|||
{
|
||||
// this->FitInside() doesn't work, and it doesn't happen automatically. Is wxScrolledWindow wrong?
|
||||
mScrolledWindow->SetSize(evt.GetSize());
|
||||
|
||||
|
||||
this->ResizeTrackClusters();
|
||||
this->RefreshTrackClusters(true);
|
||||
}
|
||||
|
@ -1696,27 +1696,27 @@ BEGIN_EVENT_TABLE(MixerBoardFrame, wxFrame)
|
|||
END_EVENT_TABLE()
|
||||
|
||||
// Default to fitting one track.
|
||||
const wxSize kDefaultSize =
|
||||
wxSize(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT);
|
||||
const wxSize kDefaultSize =
|
||||
wxSize(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT);
|
||||
|
||||
MixerBoardFrame::MixerBoardFrame(AudacityProject* parent)
|
||||
: wxFrame(parent, -1,
|
||||
wxString::Format(_("Audacity Mixer Board%s"),
|
||||
((parent->GetName() == wxEmptyString) ?
|
||||
wxT("") :
|
||||
wxString::Format(_("Audacity Mixer Board%s"),
|
||||
((parent->GetName() == wxEmptyString) ?
|
||||
wxT("") :
|
||||
wxString::Format(wxT(" - %s"),
|
||||
parent->GetName().c_str()).c_str())),
|
||||
wxDefaultPosition, kDefaultSize,
|
||||
parent->GetName().c_str()).c_str())),
|
||||
wxDefaultPosition, kDefaultSize,
|
||||
//vvv Bug in wxFRAME_FLOAT_ON_PARENT:
|
||||
// If both the project frame and MixerBoardFrame are minimized and you restore MixerBoardFrame,
|
||||
// you can't restore project frame until you close MixerBoardFrame, but then project frame and
|
||||
// If both the project frame and MixerBoardFrame are minimized and you restore MixerBoardFrame,
|
||||
// you can't restore project frame until you close MixerBoardFrame, but then project frame and
|
||||
// MixerBoardFrame are restored but MixerBoardFrame is unresponsive because it thinks it's not shown.
|
||||
// wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT)
|
||||
wxDEFAULT_FRAME_STYLE)
|
||||
{
|
||||
mMixerBoard = new MixerBoard(parent, this, wxDefaultPosition, kDefaultSize);
|
||||
|
||||
this->SetSizeHints(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT);
|
||||
|
||||
this->SetSizeHints(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT);
|
||||
|
||||
mMixerBoard->UpdateTrackClusters();
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
#include "widgets/ASlider.h"
|
||||
#include "widgets/Meter.h"
|
||||
|
||||
// containment hierarchy:
|
||||
// containment hierarchy:
|
||||
// MixerBoardFrame -> MixerBoard -> MixerBoardScrolledWindow -> MixerTrackCluster(s)
|
||||
|
||||
|
||||
// MixerTrackSlider is a subclass just to override OnMouseEvent,
|
||||
// MixerTrackSlider is a subclass just to override OnMouseEvent,
|
||||
// so we can know when adjustment ends, so we can PushState only then.
|
||||
class MixerTrackSlider : public ASlider
|
||||
{
|
||||
|
@ -38,12 +38,12 @@ public:
|
|||
MixerTrackSlider(wxWindow * parent,
|
||||
wxWindowID id,
|
||||
wxString name,
|
||||
const wxPoint & pos,
|
||||
const wxPoint & pos,
|
||||
const wxSize & size,
|
||||
int style = FRAC_SLIDER,
|
||||
bool popup = true,
|
||||
bool canUseShift = true,
|
||||
float stepValue = STEP_CONTINUOUS,
|
||||
float stepValue = STEP_CONTINUOUS,
|
||||
int orientation = wxHORIZONTAL);
|
||||
virtual ~MixerTrackSlider() {};
|
||||
|
||||
|
@ -68,13 +68,13 @@ class NoteTrack;
|
|||
#endif
|
||||
class WaveTrack;
|
||||
|
||||
class MixerTrackCluster : public wxPanel
|
||||
{
|
||||
class MixerTrackCluster : public wxPanel
|
||||
{
|
||||
public:
|
||||
MixerTrackCluster(wxWindow* parent,
|
||||
MixerBoard* grandParent, AudacityProject* project,
|
||||
WaveTrack* pLeftTrack, WaveTrack* pRightTrack = NULL,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
MixerTrackCluster(wxWindow* parent,
|
||||
MixerBoard* grandParent, AudacityProject* project,
|
||||
WaveTrack* pLeftTrack, WaveTrack* pRightTrack = NULL,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize);
|
||||
virtual ~MixerTrackCluster() {};
|
||||
|
||||
|
@ -114,18 +114,18 @@ private:
|
|||
|
||||
public:
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
// mTrack is redundant, but simplifies code that operates on either
|
||||
// mTrack is redundant, but simplifies code that operates on either
|
||||
// mLeftTrack or mNoteTrack.
|
||||
Track* mTrack; // either mLeftTrack or mNoteTrack, whichever is not NULL
|
||||
#endif
|
||||
WaveTrack* mLeftTrack; // NULL if Note Track
|
||||
WaveTrack* mRightTrack; // NULL if mono
|
||||
|
||||
//vvv Vaughan, 2010-11-05:
|
||||
// I suggest that when this is no longer experimental, rather than all these #ifdef's,
|
||||
// this be done by factoring, i.e., add two subclasses to MixerTrackCluster,
|
||||
// MixerNoteTrackCluster and MixerWaveTrackCluster, such that all the common
|
||||
// code is in the parent, and these #ifdef's are only around
|
||||
//vvv Vaughan, 2010-11-05:
|
||||
// I suggest that when this is no longer experimental, rather than all these #ifdef's,
|
||||
// this be done by factoring, i.e., add two subclasses to MixerTrackCluster,
|
||||
// MixerNoteTrackCluster and MixerWaveTrackCluster, such that all the common
|
||||
// code is in the parent, and these #ifdef's are only around
|
||||
// MixerNoteTrackCluster rather than sprinkled throughout MixerTrackCluster.
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
NoteTrack* mNoteTrack; // NULL if Wave Track
|
||||
|
@ -151,7 +151,7 @@ public:
|
|||
WX_DEFINE_ARRAY(MixerTrackCluster*, MixerTrackClusterArray);
|
||||
|
||||
|
||||
class MusicalInstrument
|
||||
class MusicalInstrument
|
||||
{
|
||||
public:
|
||||
MusicalInstrument(wxBitmap* pBitmap, const wxString strXPMfilename);
|
||||
|
@ -164,23 +164,23 @@ WX_DECLARE_OBJARRAY(MusicalInstrument, MusicalInstrumentArray);
|
|||
|
||||
|
||||
|
||||
// wxScrolledWindow ignores mouse clicks in client area,
|
||||
// wxScrolledWindow ignores mouse clicks in client area,
|
||||
// but they don't get passed to Mixerboard.
|
||||
// We need to catch them to deselect all track clusters.
|
||||
class MixerBoardScrolledWindow : public wxScrolledWindow
|
||||
class MixerBoardScrolledWindow : public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
MixerBoardScrolledWindow(AudacityProject* project,
|
||||
MixerBoard* parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
public:
|
||||
MixerBoardScrolledWindow(AudacityProject* project,
|
||||
MixerBoard* parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxHSCROLL | wxVSCROLL);
|
||||
virtual ~MixerBoardScrolledWindow();
|
||||
|
||||
private:
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
|
||||
private:
|
||||
private:
|
||||
MixerBoard* mMixerBoard;
|
||||
AudacityProject* mProject;
|
||||
|
||||
|
@ -192,20 +192,20 @@ public:
|
|||
class MixerBoardFrame;
|
||||
class TrackList;
|
||||
|
||||
class MixerBoard : public wxWindow
|
||||
{
|
||||
class MixerBoard : public wxWindow
|
||||
{
|
||||
friend class MixerBoardFrame;
|
||||
|
||||
public:
|
||||
MixerBoard(AudacityProject* pProject,
|
||||
wxFrame* parent,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
MixerBoard(AudacityProject* pProject,
|
||||
wxFrame* parent,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize);
|
||||
virtual ~MixerBoard();
|
||||
|
||||
// Add clusters for any tracks we're not yet showing.
|
||||
// Update pointers for tracks we're aleady showing.
|
||||
void UpdateTrackClusters();
|
||||
// Update pointers for tracks we're aleady showing.
|
||||
void UpdateTrackClusters();
|
||||
|
||||
int GetTrackClustersWidth();
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
void UpdatePan(const WaveTrack* pTrack);
|
||||
void UpdateGain(const WaveTrack* pTrack);
|
||||
#endif
|
||||
|
||||
|
||||
void UpdateMeters(const double t1, const bool bLoopedPlay);
|
||||
|
||||
void UpdateWidth();
|
||||
|
@ -255,10 +255,10 @@ public:
|
|||
private:
|
||||
void CreateMuteSoloImages();
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
int FindMixerTrackCluster(const Track* pTrack,
|
||||
int FindMixerTrackCluster(const Track* pTrack,
|
||||
MixerTrackCluster** hMixerTrackCluster) const;
|
||||
#else
|
||||
int FindMixerTrackCluster(const WaveTrack* pLeftTrack,
|
||||
int FindMixerTrackCluster(const WaveTrack* pLeftTrack,
|
||||
MixerTrackCluster** hMixerTrackCluster) const;
|
||||
#endif
|
||||
void LoadMusicalInstruments();
|
||||
|
@ -283,9 +283,9 @@ public:
|
|||
|
||||
private:
|
||||
// Track clusters are maintained in the same order as the WaveTracks.
|
||||
MixerTrackClusterArray mMixerTrackClusters;
|
||||
MixerTrackClusterArray mMixerTrackClusters;
|
||||
|
||||
MusicalInstrumentArray mMusicalInstruments;
|
||||
MusicalInstrumentArray mMusicalInstruments;
|
||||
AudacityProject* mProject;
|
||||
MixerBoardScrolledWindow* mScrolledWindow; // Holds the MixerTrackClusters and handles scrolling.
|
||||
double mPrevT1;
|
||||
|
@ -296,8 +296,8 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class MixerBoardFrame : public wxFrame
|
||||
{
|
||||
class MixerBoardFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
MixerBoardFrame(AudacityProject* parent);
|
||||
virtual ~MixerBoardFrame();
|
||||
|
|
|
@ -52,7 +52,7 @@ bool sonificationStarted = false;
|
|||
|
||||
void SonifyBeginSonification()
|
||||
{
|
||||
PmError err = Pm_OpenOutput(&sonMidiStream, Pm_GetDefaultOutputDeviceID(),
|
||||
PmError err = Pm_OpenOutput(&sonMidiStream, Pm_GetDefaultOutputDeviceID(),
|
||||
NULL, 0, NULL, NULL, 0);
|
||||
if (err) sonMidiStream = NULL;
|
||||
if (sonMidiStream)
|
||||
|
@ -76,7 +76,7 @@ void SonifyNoteOnOff(int p, int v)
|
|||
SonifyBeginSonification();
|
||||
if (sonMidiStream)
|
||||
Pm_WriteShort(sonMidiStream, 0, Pm_Message(0x90, p, v));
|
||||
}
|
||||
}
|
||||
|
||||
#define SONFNS(name) \
|
||||
void SonifyBegin ## name() { SonifyNoteOnOff(SON_ ## name, SON_VEL); } \
|
||||
|
@ -146,7 +146,7 @@ Track *NoteTrack::Duplicate()
|
|||
SonifyBeginSerialize();
|
||||
assert(!mSerializationBuffer);
|
||||
// serialize from this to duplicate's mSerializationBuffer
|
||||
mSeq->serialize((void**)&duplicate->mSerializationBuffer,
|
||||
mSeq->serialize((void**)&duplicate->mSerializationBuffer,
|
||||
&duplicate->mSerializationLength);
|
||||
SonifyEndSerialize();
|
||||
} else if (mSerializationBuffer) {
|
||||
|
@ -183,8 +183,8 @@ double NoteTrack::GetEndTime()
|
|||
}
|
||||
|
||||
|
||||
void NoteTrack::WarpAndTransposeNotes(double t0, double t1,
|
||||
const TimeWarper &warper,
|
||||
void NoteTrack::WarpAndTransposeNotes(double t0, double t1,
|
||||
const TimeWarper &warper,
|
||||
double semitones)
|
||||
{
|
||||
// Since this is a duplicate and duplicates convert mSeq to
|
||||
|
@ -215,7 +215,7 @@ void NoteTrack::WarpAndTransposeNotes(double t0, double t1,
|
|||
iter.begin();
|
||||
Alg_event_ptr event;
|
||||
while ((event = iter.next()) && event->time < t1) {
|
||||
if (event->is_note() && event->time >= t0 &&
|
||||
if (event->is_note() && event->time >= t0 &&
|
||||
// Allegro data structure does not restrict channels to 16.
|
||||
// Since there is not way to select more than 16 channels,
|
||||
// map all channel numbers mod 16. This will have no effect
|
||||
|
@ -271,7 +271,7 @@ int NoteTrack::DrawLabelControls(wxDC & dc, wxRect & r)
|
|||
dc.DrawRectangle(box);
|
||||
// two choices: channel is enabled (to see and play) when button is in
|
||||
// "up" position (original Audacity style) or in "down" position
|
||||
//
|
||||
//
|
||||
#define CHANNEL_ON_IS_DOWN 1
|
||||
#if CHANNEL_ON_IS_DOWN
|
||||
AColor::DarkMIDIChannel(&dc, chanName);
|
||||
|
@ -323,7 +323,7 @@ int NoteTrack::DrawLabelControls(wxDC & dc, wxRect & r)
|
|||
|
||||
t.Printf(wxT("%d"), chanName);
|
||||
dc.GetTextExtent(t, &w, &h);
|
||||
|
||||
|
||||
dc.DrawText(t, box.x + (box.width - w) / 2, box.y + (box.height - h) / 2);
|
||||
}
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ void NoteTrack::SetSequence(Alg_seq_ptr seq)
|
|||
mSeq = seq;
|
||||
}
|
||||
|
||||
Alg_seq* NoteTrack::GetSequence()
|
||||
Alg_seq* NoteTrack::GetSequence()
|
||||
{
|
||||
return mSeq;
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ void NoteTrack::PrintSequence()
|
|||
}
|
||||
else {}
|
||||
}
|
||||
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ bool NoteTrack::Paste(double t, Track *src)
|
|||
//Check that src is a non-NULL NoteTrack
|
||||
if (src == NULL || src->GetKind() != Track::Note)
|
||||
return false;
|
||||
|
||||
|
||||
NoteTrack* other = (NoteTrack*)src;
|
||||
if (other->mSeq == NULL)
|
||||
return false;
|
||||
|
@ -555,7 +555,7 @@ bool NoteTrack::Shift(double t) // t is always seconds
|
|||
// get initial tempo
|
||||
double tempo = mSeq->get_tempo(0.0);
|
||||
double beats_per_measure = mSeq->get_bar_len(0.0);
|
||||
int m = ROUND(t * tempo / beats_per_measure);
|
||||
int m = ROUND(t * tempo / beats_per_measure);
|
||||
// need at least 1 measure, so if we rounded down to zero, fix it
|
||||
if (m == 0) m = 1;
|
||||
// compute new tempo so that m measures at new tempo take t seconds
|
||||
|
@ -633,7 +633,7 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq()
|
|||
Alg_beat_ptr bp = &(map->beats[0]);
|
||||
if (bp->time < ALG_EPS) { // tempo change at time 0
|
||||
if (map->beats.len > 1) { // compute slope to get tempo
|
||||
bps = (map->beats[1].beat - map->beats[0].beat) /
|
||||
bps = (map->beats[1].beat - map->beats[0].beat) /
|
||||
(map->beats[1].time - map->beats[0].time);
|
||||
} else if (seq->get_time_map()->last_tempo_flag) {
|
||||
bps = seq->get_time_map()->last_tempo;
|
||||
|
@ -648,7 +648,7 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq()
|
|||
measure_time = offset / n;
|
||||
bps = beats_per_measure / measure_time;
|
||||
// insert integer multiple of measures at beginning
|
||||
seq->convert_to_beats();
|
||||
seq->convert_to_beats();
|
||||
seq->insert_silence(0, beats_per_measure * n);
|
||||
// make sure time signature at 0 is correct
|
||||
if (tsp) {
|
||||
|
@ -667,7 +667,7 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq()
|
|||
double beat = mSeq->get_time_map()->time_to_beat(start);
|
||||
// Find the time signature in mSeq in effect at start (beat):
|
||||
int i = mSeq->time_sig.find_beat(beat);
|
||||
// i is where you would insert a new time sig at beat,
|
||||
// i is where you would insert a new time sig at beat,
|
||||
// Case 1: beat coincides with a time sig at i. Time signature
|
||||
// at beat means that there is a barline at beat, so when beat
|
||||
// is shifted to 0, the relative barline positions are preserved
|
||||
|
@ -676,10 +676,10 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq()
|
|||
// beat coincides with time signature change, so offset must
|
||||
// be a multiple of beats
|
||||
/* do nothing */ ;
|
||||
// Case 2: there is no time signature before beat.
|
||||
// Case 2: there is no time signature before beat.
|
||||
} else if (i == 0 && (mSeq->time_sig.length() == 0 ||
|
||||
mSeq->time_sig[i].beat > beat)) {
|
||||
// If beat does not fall on an implied barline, we need to
|
||||
// If beat does not fall on an implied barline, we need to
|
||||
// insert a time signature.
|
||||
double measures = beat / 4.0;
|
||||
double imeasures = ROUND(measures);
|
||||
|
@ -688,12 +688,12 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq()
|
|||
seq->set_time_sig(bar_offset, 4, 4);
|
||||
}
|
||||
// This case should never be true because if i == 0, either there
|
||||
// are no time signatures before beat (Case 2),
|
||||
// are no time signatures before beat (Case 2),
|
||||
// or there is one time signature at beat (Case 1)
|
||||
} else if (i == 0) {
|
||||
/* do nothing (might be good to assert(false)) */ ;
|
||||
// Case 3: i-1 must be the effective time sig position
|
||||
} else {
|
||||
} else {
|
||||
i -= 1; // index the time signature in effect at beat
|
||||
Alg_time_sig_ptr tsp = &(mSeq->time_sig[i]);
|
||||
double beats_per_measure = (tsp->num * 4) / tsp->den;
|
||||
|
@ -709,14 +709,14 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq()
|
|||
// It will have the same time signature, but the position will
|
||||
// force a barline to match the barlines in mSeq
|
||||
seq->set_time_sig(bar_offset, tsp->num, tsp->den);
|
||||
}
|
||||
}
|
||||
// else beat coincides with a barline, so no need for an extra
|
||||
// time signature to force barline alignment
|
||||
}
|
||||
}
|
||||
return seq;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool NoteTrack::ExportMIDI(wxString f)
|
||||
{
|
||||
|
@ -753,29 +753,29 @@ bool NoteTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
double dblValue;
|
||||
if (!wxStrcmp(attr, wxT("name")) && XMLValueChecker::IsGoodString(strValue))
|
||||
mName = strValue;
|
||||
else if (!wxStrcmp(attr, wxT("offset")) &&
|
||||
XMLValueChecker::IsGoodString(strValue) &&
|
||||
else if (!wxStrcmp(attr, wxT("offset")) &&
|
||||
XMLValueChecker::IsGoodString(strValue) &&
|
||||
Internat::CompatibleToDouble(strValue, &dblValue))
|
||||
SetOffset(dblValue);
|
||||
else if (!wxStrcmp(attr, wxT("visiblechannels"))) {
|
||||
if (!XMLValueChecker::IsGoodInt(strValue) ||
|
||||
if (!XMLValueChecker::IsGoodInt(strValue) ||
|
||||
!strValue.ToLong(&nValue) ||
|
||||
!XMLValueChecker::IsValidVisibleChannels(nValue))
|
||||
return false;
|
||||
mVisibleChannels = nValue;
|
||||
}
|
||||
else if (!wxStrcmp(attr, wxT("height")) &&
|
||||
else if (!wxStrcmp(attr, wxT("height")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
mHeight = nValue;
|
||||
else if (!wxStrcmp(attr, wxT("minimized")) &&
|
||||
else if (!wxStrcmp(attr, wxT("minimized")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
mMinimized = (nValue != 0);
|
||||
else if (!wxStrcmp(attr, wxT("isSelected")) &&
|
||||
else if (!wxStrcmp(attr, wxT("isSelected")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
this->SetSelected(nValue != 0);
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
else if (!wxStrcmp(attr, wxT("velocity")) &&
|
||||
XMLValueChecker::IsGoodString(strValue) &&
|
||||
else if (!wxStrcmp(attr, wxT("velocity")) &&
|
||||
XMLValueChecker::IsGoodString(strValue) &&
|
||||
Internat::CompatibleToDouble(strValue, &dblValue))
|
||||
mGain = (float) dblValue;
|
||||
#endif
|
||||
|
@ -808,10 +808,10 @@ void NoteTrack::WriteXML(XMLWriter &xmlFile)
|
|||
// we combine the Duplicate with serialization or unserialization.
|
||||
// Serialization and Unserialization happen on alternate calls to
|
||||
// Duplicate and (usually) produce the right results at the right
|
||||
// time.
|
||||
// It turns out that this optimized Duplicate is a little too
|
||||
// time.
|
||||
// It turns out that this optimized Duplicate is a little too
|
||||
// clever. There is at least one case where a track can be duplicated
|
||||
// and then AutoSave'd. (E.g. do an "Insert Silence" effect on a
|
||||
// and then AutoSave'd. (E.g. do an "Insert Silence" effect on a
|
||||
// NoteTrack.) In this case, mSeq will be NULL. To avoid a crash
|
||||
// and perform WriteXML, we may need to restore NoteTracks from binary
|
||||
// blobs to regular data structures (with an Alg_seq member).
|
||||
|
@ -852,7 +852,7 @@ void NoteTrack::VScroll(int start, int end)
|
|||
SetBottomNote(mStartBottomNote + delta);
|
||||
}
|
||||
|
||||
// Zoom the note track, centering the pitch at centerY,
|
||||
// Zoom the note track, centering the pitch at centerY,
|
||||
// amount is 1 for zoom in, and -1 for zoom out
|
||||
void NoteTrack::Zoom(int centerY, int amount)
|
||||
{
|
||||
|
|
|
@ -58,8 +58,8 @@ class AUDACITY_DLL_API NoteTrack:public Track {
|
|||
virtual ~NoteTrack();
|
||||
|
||||
virtual Track *Duplicate();
|
||||
|
||||
virtual int GetKind() const { return Note; }
|
||||
|
||||
virtual int GetKind() const { return Note; }
|
||||
|
||||
virtual double GetStartTime();
|
||||
virtual double GetEndTime();
|
||||
|
@ -117,7 +117,7 @@ class AUDACITY_DLL_API NoteTrack:public Track {
|
|||
// is located at r.y + r.height - (GetNoteMargin() + 1 + mPitchHeight)
|
||||
void PrepareIPitchToY(const wxRect &r) {
|
||||
mBottom = r.y + r.height - GetNoteMargin() - 1 - mPitchHeight +
|
||||
(mBottomNote / 12) * GetOctaveHeight() +
|
||||
(mBottomNote / 12) * GetOctaveHeight() +
|
||||
GetNotePos(mBottomNote % 12);
|
||||
}
|
||||
// IPitchToY returns Y coordinate of top of pitch p
|
||||
|
@ -137,7 +137,7 @@ class AUDACITY_DLL_API NoteTrack:public Track {
|
|||
int YToIPitch(int y);
|
||||
// map pitch class number (0-11) to pixel offset from bottom of octave
|
||||
// (the bottom of the black line between B and C) to the top of the
|
||||
// note. Note extra pixel separates B(11)/C(0) and E(4)/F(5).
|
||||
// note. Note extra pixel separates B(11)/C(0) and E(4)/F(5).
|
||||
int GetNotePos(int p) const { return 1 + mPitchHeight * (p + 1) + (p > 4); }
|
||||
// get pixel offset to top of ith black key note
|
||||
int GetBlackPos(int i) const { return GetNotePos(i * 2 + 1 + (i > 1)); }
|
||||
|
@ -145,16 +145,16 @@ class AUDACITY_DLL_API NoteTrack:public Track {
|
|||
// GetOctaveBottom. GetWhitePos(0) returns 1, which matches the location
|
||||
// of the line separating B and C
|
||||
int GetWhitePos(int i) const { return 1 + (i * GetOctaveHeight()) / 7; }
|
||||
void SetBottomNote(int note)
|
||||
{
|
||||
void SetBottomNote(int note)
|
||||
{
|
||||
if (note < 0)
|
||||
note = 0;
|
||||
else if (note > 96)
|
||||
note = 96;
|
||||
|
||||
mBottomNote = note;
|
||||
mBottomNote = note;
|
||||
}
|
||||
// Vertical scrolling is performed by dragging the keyboard at
|
||||
// Vertical scrolling is performed by dragging the keyboard at
|
||||
// left of track. Protocol is call StartVScroll, then update by
|
||||
// calling VScroll with original and final mouse position.
|
||||
// These functions are not used -- instead, zooming/dragging works like
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
License: GPL v2. See License.txt.
|
||||
|
||||
PitchName.cpp
|
||||
Vaughan Johnson and Dominic Mazzoni.
|
||||
Vaughan Johnson and Dominic Mazzoni.
|
||||
|
||||
******************************************************************//**
|
||||
|
||||
\file PitchName.cpp
|
||||
\brief Utilities for converting from frequency to pitch
|
||||
and from pitch to absolute (e.g., C4 for middle C)
|
||||
\brief Utilities for converting from frequency to pitch
|
||||
and from pitch to absolute (e.g., C4 for middle C)
|
||||
or nominal (A through G#) pitch name.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
@ -25,7 +25,7 @@
|
|||
|
||||
double FreqToMIDInote(const double freq)
|
||||
{
|
||||
// Make the calculation relative to A440 (A4), note number 69.
|
||||
// Make the calculation relative to A440 (A4), note number 69.
|
||||
return (69.0 + (12.0 * (log(freq / 440.0) / log(2.0))));
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ unsigned int PitchIndex(const double dMIDInote)
|
|||
double dRound = (dMIDInote < 0.0) ? -0.5 : 0.5;
|
||||
int nPitchIndex = ((int)(dMIDInote + dRound) % 12);
|
||||
|
||||
// Because of the modulo, we know we're within 12 of positive, if dMIDInote is negative.
|
||||
// Because of the modulo, we know we're within 12 of positive, if dMIDInote is negative.
|
||||
if (nPitchIndex < 0)
|
||||
nPitchIndex += 12;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
******************************************************************//**
|
||||
|
||||
utilities for converting among frequency, MIDI note number,
|
||||
utilities for converting among frequency, MIDI note number,
|
||||
pitch index, pitch name
|
||||
|
||||
*//*******************************************************************/
|
||||
|
@ -20,34 +20,34 @@
|
|||
|
||||
#include <wx/defs.h>
|
||||
|
||||
// FreqToMIDInote takes a frequency in Hz (exponential scale relative to
|
||||
// alphabetic pitch names) and returns a pitch ID number (linear
|
||||
// FreqToMIDInote takes a frequency in Hz (exponential scale relative to
|
||||
// alphabetic pitch names) and returns a pitch ID number (linear
|
||||
// scale), such that A440 (A4) is 69, middle C (C4) is 60, etc.
|
||||
// Each register starts with C (e.g., for middle C and A440,
|
||||
// Each register starts with C (e.g., for middle C and A440,
|
||||
// it's register 4).
|
||||
// MIDI note number 0 is C-1 in Scientific pitch notation.
|
||||
double FreqToMIDInote(const double freq);
|
||||
|
||||
double MIDInoteToFreq(const double dMIDInote);
|
||||
|
||||
// PitchIndex returns the [0,11] index for a double MIDI note number,
|
||||
// per result from FreqToMIDInote, corresponding to modulo 12
|
||||
// PitchIndex returns the [0,11] index for a double MIDI note number,
|
||||
// per result from FreqToMIDInote, corresponding to modulo 12
|
||||
// of the integer part of (dMIDInote + 0.5), so 0=C, 1=C#, etc.
|
||||
unsigned int PitchIndex(const double dMIDInote);
|
||||
|
||||
// PitchOctave returns the octave index for a double dMIDInote note number,
|
||||
// PitchOctave returns the octave index for a double dMIDInote note number,
|
||||
// per result from FreqToMIDInote.
|
||||
// MIDI note number 0 is C-1 in Scientific pitch notation.
|
||||
int PitchOctave(const double dMIDInote);
|
||||
|
||||
// PitchName takes dMIDInote (per result from
|
||||
// FreqToMIDInote) and returns a standard pitch/note name [C, C#, etc.).
|
||||
// PitchName takes dMIDInote (per result from
|
||||
// FreqToMIDInote) and returns a standard pitch/note name [C, C#, etc.).
|
||||
// Sharps are the default, unless, bWantFlats is true.
|
||||
wxChar * PitchName(const double dMIDInote, const bool bWantFlats = false);
|
||||
|
||||
// PitchName_Absolute does the same thing as PitchName, but appends
|
||||
// the octave number, e.g., instead of "C" it will return "C4"
|
||||
// if the dMIDInote corresonds to middle C, i.e., is 60.
|
||||
// PitchName_Absolute does the same thing as PitchName, but appends
|
||||
// the octave number, e.g., instead of "C" it will return "C4"
|
||||
// if the dMIDInote corresonds to middle C, i.e., is 60.
|
||||
wxChar * PitchName_Absolute(const double dMIDInote, const bool bWantFlats = false);
|
||||
|
||||
double PitchToMIDInote(const unsigned int nPitchIndex, const int nPitchOctave);
|
||||
|
|
|
@ -32,22 +32,22 @@ public:
|
|||
// just returns the exact string it is given.
|
||||
//
|
||||
static wxString GetLongFileName(const wxString& shortFileName);
|
||||
|
||||
|
||||
//
|
||||
// Get filename and path of executable (e.g. "/usr/bin/audacity" on
|
||||
// Linux or "C:\Program Files\Audacity\Audacity.exe" on Windows)
|
||||
//
|
||||
static wxString GetExecutablePath();
|
||||
|
||||
|
||||
//
|
||||
// Audacity treats the / as a file seperator always for Mac OS,
|
||||
// however /'s are allowed in the filename. In order for /'s to
|
||||
// work they muse be treated as :'s. To facilitate this, this
|
||||
// function should be called when opening or saving a file on
|
||||
// function should be called when opening or saving a file on
|
||||
// the Mac. It's important to note that if a / is used in a filename
|
||||
// and folder exists in the same folder with the same name as the part
|
||||
// of the file (before the first /) then the file will be saved inside
|
||||
// of that directory. This function also exists in the FileDialogPrivate
|
||||
// of that directory. This function also exists in the FileDialogPrivate
|
||||
// object
|
||||
//
|
||||
static wxString ConvertSlashInFileName(const wxString& filePath);
|
||||
|
|
|
@ -90,15 +90,15 @@ void PluginManager::Close()
|
|||
// I guess we can live with that for now.
|
||||
// This function will still close the config and
|
||||
// delete it, without updating the file.
|
||||
if( IsDirty())
|
||||
if( IsDirty())
|
||||
{
|
||||
wxFile file(FileNames::PluginsCache(), wxFile::write);
|
||||
if (!file.IsOpened())
|
||||
if (!file.IsOpened())
|
||||
{
|
||||
// Might fail to open...
|
||||
wxLogDebug(wxT("Couldn't open plugins cache for write"));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
wxFileOutputStream stream(file);
|
||||
// Save() might return false.
|
||||
|
@ -127,7 +127,7 @@ wxString PluginManager::Read(const wxString & key, const wxString & def)
|
|||
if (mConfig) {
|
||||
return mConfig->Read(key, def);
|
||||
}
|
||||
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ long PluginManager::Read(const wxString & key, long def)
|
|||
if (mConfig) {
|
||||
return mConfig->Read(key, def);
|
||||
}
|
||||
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ void PluginManager::Write(const wxString & key, long val)
|
|||
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
SpectrumHighColor - much easier to parse.
|
||||
/Locale
|
||||
Language - two-letter language code for translations
|
||||
|
||||
|
||||
(*): wxGTK
|
||||
(+): wxWin
|
||||
($): wxMac
|
||||
|
@ -115,7 +115,7 @@ static void CopyEntriesRecursive(wxString path, wxConfigBase *src, wxConfigBase
|
|||
wxString entryName;
|
||||
long entryIndex;
|
||||
bool entryKeepGoing;
|
||||
|
||||
|
||||
entryKeepGoing = src->GetFirstEntry(entryName, entryIndex);
|
||||
while (entryKeepGoing) {
|
||||
CopyEntry(path, src, dst, entryName);
|
||||
|
@ -125,7 +125,7 @@ static void CopyEntriesRecursive(wxString path, wxConfigBase *src, wxConfigBase
|
|||
wxString groupName;
|
||||
long groupIndex;
|
||||
bool groupKeepGoing;
|
||||
|
||||
|
||||
groupKeepGoing = src->GetFirstGroup(groupName, groupIndex);
|
||||
while (groupKeepGoing) {
|
||||
wxString subPath = path+groupName+wxT("/");
|
||||
|
@ -145,7 +145,7 @@ void InitPreferences()
|
|||
gPrefs = new wxFileConfig(appName, wxEmptyString,
|
||||
configFileName.GetFullPath(),
|
||||
wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
|
||||
|
||||
|
||||
wxConfigBase::Set(gPrefs);
|
||||
|
||||
static wxString resourcesDir;
|
||||
|
@ -182,7 +182,7 @@ void InitPreferences()
|
|||
delete legacyConfig;
|
||||
gPrefs->Write(wxT("/NewPrefsInitialized"), true);
|
||||
}
|
||||
|
||||
|
||||
gPrefs->Write(wxT("/Version"), wxString(AUDACITY_VERSION_STRING));
|
||||
|
||||
// BG: Make sure the users prefs are up to date
|
||||
|
@ -199,7 +199,7 @@ void InitPreferences()
|
|||
gPrefs->DeleteGroup(wxT("/Locale"));
|
||||
gPrefs->Write(wxT("/PrefsVersion"), wxString(wxT(AUDACITY_PREFS_VERSION_STRING)));
|
||||
}
|
||||
|
||||
|
||||
// Check if some prefs updates need to happen based on audacity version.
|
||||
// Unfortunately we can't use the PrefsVersion prefs key because that resets things.
|
||||
// In the future we may want to integrate that better.
|
||||
|
@ -208,19 +208,19 @@ void InitPreferences()
|
|||
int vMajor = gPrefs->Read(wxT("/Version/Major"), (long) 0);
|
||||
int vMinor = gPrefs->Read(wxT("/Version/Minor"), (long) 0);
|
||||
int vMicro = gPrefs->Read(wxT("/Version/Micro"), (long) 0);
|
||||
|
||||
|
||||
// These integer version keys were introduced april 4 2011 for 1.3.13
|
||||
// The device toolbar needs to be enabled due to removal of source selection features in
|
||||
// the mixer toolbar.
|
||||
if ((vMajor < 1) ||
|
||||
if ((vMajor < 1) ||
|
||||
(vMajor == 1 && vMinor < 3) ||
|
||||
(vMajor == 1 && vMinor == 3 && vMicro < 13)) {
|
||||
|
||||
|
||||
|
||||
|
||||
// Do a full reset of the Device Toolbar to get it on the screen.
|
||||
if (gPrefs->Exists(wxT("/GUI/ToolBars/Device")))
|
||||
gPrefs->DeleteGroup(wxT("/GUI/ToolBars/Device"));
|
||||
|
||||
|
||||
// We keep the mixer toolbar prefs (shown/not shown)
|
||||
// the width of the mixer toolbar may have shrunk, the prefs will keep the larger value
|
||||
// if the user had a device that had more than one source.
|
||||
|
@ -229,11 +229,11 @@ void InitPreferences()
|
|||
gPrefs->Write(wxT("/GUI/ToolBars/Mixer/W"), -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gPrefs->Write(wxT("/Version/Major"), AUDACITY_VERSION);
|
||||
gPrefs->Write(wxT("/Version/Minor"), AUDACITY_RELEASE);
|
||||
gPrefs->Write(wxT("/Version/Minor"), AUDACITY_RELEASE);
|
||||
gPrefs->Write(wxT("/Version/Micro"), AUDACITY_REVISION);
|
||||
|
||||
|
||||
gPrefs->Flush();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Audacity: A Digital Audio Editor
|
||||
|
||||
Profiler.cpp
|
||||
|
||||
|
||||
Created by Michael Chinen (mchinen) on 8/12/08
|
||||
Audacity(R) is copyright (c) 1999-2008 Audacity Team.
|
||||
License: GPL v2. See License.txt.
|
||||
|
@ -11,7 +11,7 @@
|
|||
******************************************************************//**
|
||||
|
||||
\class Profiler
|
||||
\brief A simple profiler to measure the average time lengths that a
|
||||
\brief A simple profiler to measure the average time lengths that a
|
||||
particular task/function takes. Currently not thread-safe and not thread-smart,
|
||||
but it will probably work fine if you use it on a high level.
|
||||
|
||||
|
@ -30,7 +30,7 @@ Profiler::~Profiler()
|
|||
//print everything out. append to a log.
|
||||
FILE* log = fopen("AudacityProfilerLog.txt", "a");
|
||||
time_t now;
|
||||
|
||||
|
||||
time(&now);
|
||||
fprintf(log,"Audacity Profiler Run, Ended at ");
|
||||
fprintf(log,"%s",ctime(&now));
|
||||
|
@ -44,15 +44,15 @@ Profiler::~Profiler()
|
|||
fprintf(log,"Number of times run: %d\n",mTasks[i]->mNumHits);
|
||||
fprintf(log,"Total run time (seconds): %f\n", (double)mTasks[i]->mCumTime/CLOCKS_PER_SEC);
|
||||
fprintf(log,"Average run time (seconds): %f\n",mTasks[i]->ComputeAverageRunTime());
|
||||
|
||||
|
||||
if(i < ((int)mTasks.size()) -1)
|
||||
fprintf(log,"----------------------------\n");
|
||||
}
|
||||
}
|
||||
fprintf(log,"\n****************************************\n\n\n");
|
||||
|
||||
|
||||
fclose(log);
|
||||
|
||||
|
||||
//delete everything.
|
||||
for(int i=0;i<(int)mTasks.size();i++)
|
||||
delete mTasks[i];
|
||||
|
@ -66,7 +66,7 @@ void Profiler::Begin(char* fileName, int lineNum, char* taskDescription)
|
|||
GetOrCreateTaskProfile(fileName,lineNum)->Begin(fileName,lineNum,taskDescription);
|
||||
mTasksMutex.Unlock();
|
||||
}
|
||||
|
||||
|
||||
///end the task timer.
|
||||
void Profiler::End(char* fileName, int lineNum, char* taskDescription)
|
||||
{
|
||||
|
@ -77,16 +77,16 @@ void Profiler::End(char* fileName, int lineNum, char* taskDescription)
|
|||
tp->End(fileName,lineNum,taskDescription);
|
||||
mTasksMutex.Unlock();
|
||||
}
|
||||
|
||||
|
||||
///Gets the singleton instance
|
||||
Profiler* Profiler::Instance()
|
||||
{
|
||||
static Profiler* pro=NULL;
|
||||
//this isn't 100% threadsafe but I think Okay for this purpose.
|
||||
|
||||
|
||||
if(!pro)
|
||||
pro = new Profiler();
|
||||
|
||||
|
||||
return pro;
|
||||
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ TaskProfile* Profiler::GetOrCreateTaskProfile(char* fileName, int lineNum)
|
|||
if(strcmp(fileName,mTasks[i]->mFileName)==0 && lineNum == mTasks[i]->mLine)
|
||||
return mTasks[i];
|
||||
}
|
||||
|
||||
|
||||
TaskProfile* tp = new TaskProfile();
|
||||
mTasks.push_back(tp);
|
||||
return tp;
|
||||
|
@ -112,7 +112,7 @@ TaskProfile* Profiler::GetTaskProfileByDescription(char* description)
|
|||
if(strcmp(description,mTasks[i]->mDescription)==0)
|
||||
return mTasks[i];
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ void TaskProfile::Begin(char* fileName, int lineNum, char* taskDescription)
|
|||
}
|
||||
|
||||
mLastTime = clock();
|
||||
|
||||
|
||||
}
|
||||
|
||||
///end the task timer.
|
||||
|
@ -157,7 +157,7 @@ void TaskProfile::End(char* WXUNUSED(fileName), int WXUNUSED(lineNum), char* WXU
|
|||
mCumTime += clock() - mLastTime;
|
||||
mNumHits++;
|
||||
}
|
||||
|
||||
|
||||
double TaskProfile::ComputeAverageRunTime()
|
||||
{
|
||||
if(mNumHits)
|
||||
|
@ -165,4 +165,3 @@ double TaskProfile::ComputeAverageRunTime()
|
|||
else
|
||||
return 0.0;
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
Audacity: A Digital Audio Editor
|
||||
|
||||
Profiler.h
|
||||
|
||||
|
||||
Created by Michael Chinen (mchinen) on 8/12/08
|
||||
Audacity(R) is copyright (c) 1999-2008 Audacity Team.
|
||||
License: GPL v2. See License.txt.
|
||||
|
@ -11,7 +11,7 @@
|
|||
******************************************************************//**
|
||||
|
||||
\class Profiler
|
||||
\brief A simple profiler to measure the average time lengths that a
|
||||
\brief A simple profiler to measure the average time lengths that a
|
||||
particular task/function takes. Currently not thread-safe and not thread-smart,
|
||||
but it will probably work fine if you use it on a high level.
|
||||
|
||||
|
@ -46,16 +46,16 @@ class Profiler
|
|||
void Begin(char* fileName, int lineNum, char* taskDescription);
|
||||
///end the task timer.
|
||||
void End(char* fileName, int lineNum, char* taskDescription);
|
||||
|
||||
|
||||
///Gets the singleton instance
|
||||
static Profiler* Instance();
|
||||
|
||||
|
||||
protected:
|
||||
///private constructor - Singleton.
|
||||
Profiler(){};
|
||||
|
||||
|
||||
///find a taskProfile for the given task, otherwise create
|
||||
TaskProfile* GetOrCreateTaskProfile(char* fileName, int lineNum);
|
||||
TaskProfile* GetOrCreateTaskProfile(char* fileName, int lineNum);
|
||||
TaskProfile* GetTaskProfileByDescription(char* description);
|
||||
|
||||
//List of current Task to do.
|
||||
|
@ -75,9 +75,9 @@ class Profiler
|
|||
void Begin(char* fileName, int lineNum, char* taskDescription);
|
||||
///end the task timer.
|
||||
void End(char* fileName, int lineNum, char* taskDescription);
|
||||
|
||||
|
||||
double ComputeAverageRunTime();
|
||||
|
||||
|
||||
char* mFileName;
|
||||
int mLine;
|
||||
char* mDescription;
|
||||
|
|
532
src/Project.cpp
532
src/Project.cpp
File diff suppressed because it is too large
Load Diff
|
@ -100,19 +100,19 @@ enum PlayMode {
|
|||
};
|
||||
|
||||
// XML handler for <import> tag
|
||||
class ImportXMLTagHandler : public XMLTagHandler
|
||||
class ImportXMLTagHandler : public XMLTagHandler
|
||||
{
|
||||
public:
|
||||
ImportXMLTagHandler(AudacityProject* pProject) { mProject = pProject; };
|
||||
|
||||
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs);
|
||||
virtual XMLTagHandler *HandleXMLChild(const wxChar * WXUNUSED(tag)) { return NULL; };
|
||||
|
||||
// Don't want a WriteXML method because ImportXMLTagHandler is not a WaveTrack.
|
||||
// <import> tags are instead written by AudacityProject::WriteXML.
|
||||
// virtual void WriteXML(XMLWriter &xmlFile) { wxASSERT(false); }
|
||||
|
||||
private:
|
||||
// Don't want a WriteXML method because ImportXMLTagHandler is not a WaveTrack.
|
||||
// <import> tags are instead written by AudacityProject::WriteXML.
|
||||
// virtual void WriteXML(XMLWriter &xmlFile) { wxASSERT(false); }
|
||||
|
||||
private:
|
||||
AudacityProject* mProject;
|
||||
};
|
||||
|
||||
|
@ -142,9 +142,9 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
|
||||
void GetPlayRegion(double* playRegionStart, double *playRegionEnd);
|
||||
bool IsPlayRegionLocked() { return mLockPlayRegion; }
|
||||
|
||||
void SetSel0(double); //Added by STM
|
||||
void SetSel1(double); //Added by STM
|
||||
|
||||
void SetSel0(double); //Added by STM
|
||||
void SetSel1(double); //Added by STM
|
||||
|
||||
bool Clipboard() { return (msClipT1 - msClipT0) > 0.0; }
|
||||
|
||||
|
@ -180,7 +180,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
* enough to fit in the file dialogue filter drop-down. It should be
|
||||
* translated.
|
||||
* @param extrafilter Specify the file extension(s) for the additional format
|
||||
* specified by extraformat. The patterns must include the wildcard (e.g.
|
||||
* specified by extraformat. The patterns must include the wildcard (e.g.
|
||||
* "*.aup" not "aup" or ".aup"), separate multiple patters with a semicolon,
|
||||
* e.g. "*.aup;*.AUP" because patterns are case-sensitive. Do not add a
|
||||
* trailing semicolon to the string. This string should not be translated
|
||||
|
@ -195,7 +195,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
bool WarnOfLegacyFile( );
|
||||
|
||||
// If pNewTrackList is passed in non-NULL, it gets filled with the pointers to new tracks.
|
||||
bool Import(wxString fileName, WaveTrackArray *pTrackArray = NULL);
|
||||
bool Import(wxString fileName, WaveTrackArray *pTrackArray = NULL);
|
||||
|
||||
void AddImportedTracks(wxString fileName,
|
||||
Track **newTracks, int numTracks);
|
||||
|
@ -226,11 +226,11 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
bool GetNormalizeOnLoad() { return mNormalizeOnLoad; } //lda
|
||||
void SetNormalizeOnLoad(bool flag) { mNormalizeOnLoad = flag; } //lda
|
||||
|
||||
/** \brief Sets the wxDialog that is being displayed
|
||||
/** \brief Sets the wxDialog that is being displayed
|
||||
* Used by the custom dialog warning constructor and destructor
|
||||
*/
|
||||
void SetMissingAliasFileDialog(wxDialog *dialog);
|
||||
|
||||
|
||||
/** \brief returns a pointer to the wxDialog if it is displayed, NULL otherwise.
|
||||
*/
|
||||
wxDialog *GetMissingAliasFileDialog();
|
||||
|
@ -290,13 +290,13 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
void Rewind(bool shift);
|
||||
void SkipEnd(bool shift);
|
||||
void SetStop(bool bStopped);
|
||||
void EditByLabel( WaveTrack::EditFunction action, bool bSyncLockedTracks );
|
||||
void EditByLabel( WaveTrack::EditFunction action, bool bSyncLockedTracks );
|
||||
void EditClipboardByLabel( WaveTrack::EditDestFunction action );
|
||||
bool IsSyncLocked();
|
||||
void SetSyncLock(bool flag);
|
||||
|
||||
// "exclusive" mute means mute the chosen track and unmute all others.
|
||||
void HandleTrackMute(Track *t, const bool exclusive);
|
||||
void HandleTrackMute(Track *t, const bool exclusive);
|
||||
|
||||
// Type of solo (standard or simple) follows the set preference, unless
|
||||
// alternate == true, which causes the opposite behavior.
|
||||
|
@ -328,7 +328,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
// TrackPanel access
|
||||
virtual wxSize GetTPTracksUsableArea();
|
||||
virtual void RefreshTPTrack(Track* pTrk, bool refreshbacking = true);
|
||||
|
||||
|
||||
// TrackPanel callback methods, overrides of TrackPanelListener
|
||||
virtual void TP_DisplaySelection();
|
||||
virtual void TP_DisplayStatusMessage(wxString msg);
|
||||
|
@ -352,7 +352,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
// ToolBar
|
||||
|
||||
// In the GUI, ControlToolBar appears as the "Transport Toolbar". "Control Toolbar" is historic.
|
||||
ControlToolBar *GetControlToolBar();
|
||||
ControlToolBar *GetControlToolBar();
|
||||
|
||||
DeviceToolBar *GetDeviceToolBar();
|
||||
EditToolBar *GetEditToolBar();
|
||||
|
@ -391,7 +391,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
wxWindow *HasKeyboardCapture();
|
||||
void CaptureKeyboard(wxWindow *h);
|
||||
void ReleaseKeyboard(wxWindow *h);
|
||||
|
||||
|
||||
// Audio IO callback methods
|
||||
virtual void OnAudioIORate(int rate);
|
||||
virtual void OnAudioIOStartRecording();
|
||||
|
@ -401,10 +401,10 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
// Command Handling
|
||||
bool TryToMakeActionAllowed( wxUint32 & flags, wxUint32 flagsRqd, wxUint32 mask );
|
||||
|
||||
///Prevents delete from external thread - for e.g. use of GetActiveProject
|
||||
///Prevents delete from external thread - for e.g. use of GetActiveProject
|
||||
static void AllProjectsDeleteLock();
|
||||
static void AllProjectsDeleteUnlock();
|
||||
|
||||
|
||||
void PushState(wxString desc, wxString shortDesc,
|
||||
int flags = PUSH_AUTOSAVE | PUSH_CALC_SPACE);
|
||||
|
||||
|
@ -415,15 +415,15 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
void ModifyState(bool bWantsAutoSave); // if true, writes auto-save file. Should set only if you really want the state change restored after
|
||||
// a crash, as it can take many seconds for large (eg. 10 track-hours) projects
|
||||
void PopState(TrackList * l);
|
||||
|
||||
|
||||
void UpdateLyrics();
|
||||
void UpdateMixerBoard();
|
||||
|
||||
|
||||
void GetRegionsByLabel( Regions ®ions );
|
||||
|
||||
|
||||
void AutoSave();
|
||||
void DeleteCurrentAutoSaveFile();
|
||||
|
||||
|
||||
static bool GetCacheBlockFiles();
|
||||
|
||||
public:
|
||||
|
@ -527,7 +527,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
bool mShowId3Dialog; //lda
|
||||
bool mEmptyCanBeDirty;
|
||||
bool mSelectAllOnNone;
|
||||
|
||||
|
||||
bool mIsSyncLocked;
|
||||
|
||||
bool mLockPlayRegion;
|
||||
|
@ -541,16 +541,16 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
|
||||
// Last auto-save file name and path (empty if none)
|
||||
wxString mAutoSaveFileName;
|
||||
|
||||
|
||||
// Are we currently auto-saving or not?
|
||||
bool mAutoSaving;
|
||||
|
||||
// Has this project been recovered from an auto-saved version
|
||||
bool mIsRecovered;
|
||||
|
||||
|
||||
// The auto-save data dir the project has been recovered from
|
||||
wxString mRecoveryAutoSaveDataDir;
|
||||
|
||||
|
||||
// The handler that handles recovery of <recordingrecovery> tags
|
||||
RecordingRecoveryHandler* mRecordingRecoveryHandler;
|
||||
|
||||
|
@ -559,7 +559,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
|
||||
bool mWantSaveCompressed;
|
||||
wxArrayString mStrOtherNamesArray; // used to make sure compressed file names are unique
|
||||
|
||||
|
||||
// Last effect applied to this project
|
||||
Effect *mLastEffect;
|
||||
int mLastEffectType;
|
||||
|
@ -568,7 +568,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||
friend class ScreenshotCommand;
|
||||
|
||||
wxRect mNormalizedWindowState;
|
||||
|
||||
|
||||
//flag for cancellation of timer record.
|
||||
bool mTimerRecordCanceled;
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ HFFT InitializeFFT(int fftlen)
|
|||
temp=(temp >> 1) + (i&mask ? h->Points : 0);
|
||||
|
||||
h->BitReversed[i]=temp;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<h->Points;i++)
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#pragma warning(disable:4305)
|
||||
#else
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#include "SseMathFuncs.h"
|
||||
#include <xmmintrin.h>
|
||||
|
||||
|
@ -89,7 +89,7 @@ void TableUsage(int iMask)
|
|||
useSinCosTable=((iMask&2)!=0);
|
||||
}
|
||||
|
||||
// note !!! number of bits must be between 9-16
|
||||
// note !!! number of bits must be between 9-16
|
||||
int SmallReverseBits(int bits, int numberBits)
|
||||
{
|
||||
return (smallReverseBitsTable[*((unsigned char *)&bits)]<<(numberBits-8))+(smallReverseBitsTable[*(((unsigned char *)&bits)+1)]>>(16-numberBits));
|
||||
|
@ -111,7 +111,7 @@ HFFT InitializeFFT1x(int WXUNUSED( fftlen ) )
|
|||
// this needs to move out but ehh... Andrew Hallendorff
|
||||
for(i=0;i<256;i++) {
|
||||
smallReverseBitsTable[i]=0;
|
||||
for(int maskLow=1, maskHigh=128;maskLow<256;maskLow<<=1,maskHigh>>=1)
|
||||
for(int maskLow=1, maskHigh=128;maskLow<256;maskLow<<=1,maskHigh>>=1)
|
||||
if(i&maskLow)
|
||||
smallReverseBitsTable[i]|=maskHigh;
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ void RealFFTf4x(fft_type *buffer,HFFT h)
|
|||
int br1Value, br2Value;
|
||||
__m128 HRplus,HRminus,HIplus,HIminus;
|
||||
__m128 v1,v2,sin,cos;
|
||||
fft_type iToRad=2*M_PI/(2*h->Points);
|
||||
fft_type iToRad=2*M_PI/(2*h->Points);
|
||||
|
||||
int ButterfliesPerGroup=h->Points/2;
|
||||
|
||||
|
@ -472,7 +472,7 @@ void RealFFTf4x(fft_type *buffer,HFFT h)
|
|||
v1 = _mm_add_ps( _mm_mul_ps(*B, cos), _mm_mul_ps(*(B+1), sin));
|
||||
v2 = _mm_sub_ps( _mm_mul_ps(*B, sin), _mm_mul_ps(*(B+1), cos));
|
||||
*B=_mm_add_ps( *A, v1);
|
||||
__m128 temp128 = _mm_set1_ps( 2.0);
|
||||
__m128 temp128 = _mm_set1_ps( 2.0);
|
||||
*(A++)=_mm_sub_ps(*(B++), _mm_mul_ps(temp128, v1));
|
||||
*B=_mm_sub_ps(*A,v2);
|
||||
*(A++)=_mm_add_ps(*(B++), _mm_mul_ps(temp128, v2));
|
||||
|
@ -538,7 +538,7 @@ void RealFFTf4x(fft_type *buffer,HFFT h)
|
|||
br2Index--;
|
||||
}
|
||||
/* Handle the center bin (just need a conjugate) */
|
||||
if(useBitReverseTable)
|
||||
if(useBitReverseTable)
|
||||
A=&localBuffer[h->BitReversed[br1Index]+1];
|
||||
else
|
||||
A=&localBuffer[SmallReverseBits(br1Index,h->pow2Bits)+1];
|
||||
|
@ -722,7 +722,7 @@ void ReorderToFreq4x(HFFT hFFT, fft_type *buffer, fft_type *RealOut, fft_type *I
|
|||
// Copy the data into the real and imaginary outputs
|
||||
for(int i=1;i<hFFT->Points;i++) {
|
||||
int brValue;
|
||||
if(useBitReverseTable)
|
||||
if(useBitReverseTable)
|
||||
brValue=hFFT->BitReversed[i];
|
||||
else
|
||||
brValue=SmallReverseBits(i,hFFT->pow2Bits);
|
||||
|
@ -742,7 +742,7 @@ void ReorderToTime4x(HFFT hFFT, fft_type *buffer, fft_type *TimeOut)
|
|||
// Copy the data into the real outputs
|
||||
for(int i=0;i<hFFT->Points;i++) {
|
||||
int brValue;
|
||||
if(useBitReverseTable)
|
||||
if(useBitReverseTable)
|
||||
brValue=hFFT->BitReversed[i];
|
||||
else
|
||||
brValue=SmallReverseBits(i,hFFT->pow2Bits);
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
(int)lastFlag, inBufferUsed, outBuffer, outBufferLen);
|
||||
}
|
||||
|
||||
#elif USE_LIBSAMPLERATE
|
||||
#elif USE_LIBSAMPLERATE
|
||||
|
||||
#include <samplerate.h>
|
||||
|
||||
|
@ -184,7 +184,7 @@
|
|||
wxFprintf(stderr, _("Libsamplerate error: %d\n"), err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(lastFlag) {
|
||||
mShouldReset = true;
|
||||
mSamplesLeft = inBufferLen - (int)data.input_frames_used;
|
||||
|
@ -202,12 +202,12 @@
|
|||
{
|
||||
this->SetMethod(useBestMethod);
|
||||
soxr_quality_spec_t q_spec;
|
||||
if (dMinFactor == dMaxFactor)
|
||||
if (dMinFactor == dMaxFactor)
|
||||
{
|
||||
mbWantConstRateResampling = true; // constant rate resampling
|
||||
q_spec = soxr_quality_spec("\0\1\4\6"[mMethod], 0);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
mbWantConstRateResampling = false; // variable rate resampling
|
||||
q_spec = soxr_quality_spec(SOXR_HQ, SOXR_VR);
|
||||
|
|
|
@ -24,14 +24,14 @@ class Resample
|
|||
{
|
||||
public:
|
||||
/// Resamplers may have more than one method, offering a
|
||||
/// tradeoff between speed and quality.
|
||||
/// tradeoff between speed and quality.
|
||||
/// Audacity identifies two methods out of all of the choices:
|
||||
/// a Fast method intended for real-time audio I/O, and a Best
|
||||
/// method intended for mixing and exporting.
|
||||
/// method intended for mixing and exporting.
|
||||
//
|
||||
/// The first parameter lets you select either the best method or
|
||||
/// the fast method.
|
||||
// dMinFactor and dMaxFactor specify the range of factors for variable-rate resampling.
|
||||
/// the fast method.
|
||||
// dMinFactor and dMaxFactor specify the range of factors for variable-rate resampling.
|
||||
// For constant-rate, pass the same value for both.
|
||||
Resample(const bool useBestMethod, const double dMinFactor, const double dMaxFactor);
|
||||
virtual ~Resample();
|
||||
|
@ -44,14 +44,14 @@ class Resample
|
|||
static int GetFastMethodDefault();
|
||||
static int GetBestMethodDefault();
|
||||
|
||||
/** @brief Main processing function. Resamples from the input buffer to the
|
||||
/** @brief Main processing function. Resamples from the input buffer to the
|
||||
* output buffer.
|
||||
*
|
||||
* Reads samples from the input buffer, and writes samples to the output
|
||||
* buffer. Stops when either is exhaughsted, or we reach a convenient block
|
||||
* end, unless lastFlag is set to force emptying the input buffer.
|
||||
* The number of input samples used is returned in inBufferUsed, and the
|
||||
* number of output samples generated is the return value of the function.
|
||||
* number of output samples generated is the return value of the function.
|
||||
* This function may do nothing if you don't pass a large enough output
|
||||
* buffer (i.e. there is no where to put a full block of output data)
|
||||
@param factor The scaling factor to resample by.
|
||||
|
@ -59,7 +59,7 @@ class Resample
|
|||
@param inBufferLen Length of the input buffer, in samples.
|
||||
@param lastFlag Flag to indicate this is the last lot of input samples and
|
||||
the buffer needs to be emptied out into the rate converter.
|
||||
@param inBufferUsed Number of samples from inBuffer that have been used
|
||||
@param inBufferUsed Number of samples from inBuffer that have been used
|
||||
(unless lastFlag is true, we don't garuntee to process all the samples in
|
||||
the input this time, we may leave some for next time)
|
||||
@param outBuffer Buffer to write output (converted) samples to.
|
||||
|
@ -86,11 +86,11 @@ class Resample
|
|||
protected:
|
||||
int mMethod; // resampler-specific enum for resampling method
|
||||
void* mHandle; // constant-rate or variable-rate resampler (XOR per instance)
|
||||
#if USE_LIBSAMPLERATE
|
||||
#if USE_LIBSAMPLERATE
|
||||
bool mShouldReset; // whether the resampler should be reset because lastFlag has been set previously
|
||||
int mSamplesLeft; // number of samples left before a reset is needed
|
||||
#elif USE_LIBSOXR
|
||||
bool mbWantConstRateResampling;
|
||||
bool mbWantConstRateResampling;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ int RingBuffer::Put(samplePtr buffer, sampleFormat format,
|
|||
block = samplesToCopy;
|
||||
if (block > mBufferSize - pos)
|
||||
block = mBufferSize - pos;
|
||||
|
||||
|
||||
CopySamples(src, format,
|
||||
mBuffer + pos * SAMPLE_SIZE(mFormat), mFormat,
|
||||
block);
|
||||
|
|
|
@ -35,7 +35,7 @@ class RingBuffer {
|
|||
|
||||
private:
|
||||
int Len();
|
||||
|
||||
|
||||
sampleFormat mFormat;
|
||||
int mStart;
|
||||
int mEnd;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
Integer formats use the full signed range of their data type,
|
||||
for example 16-bit samples use the range -32768...32767.
|
||||
This means that reading in a wav file and writing it out again
|
||||
('round tripping'), via floats, is lossless; -32768 equates to -1.0f
|
||||
('round tripping'), via floats, is lossless; -32768 equates to -1.0f
|
||||
and 32767 equates to +1.0f - (a little bit).
|
||||
It also means (unfortunatly) that writing out +1.0f leads to
|
||||
clipping by 1 LSB. This creates some distortion, but I (MJS) have
|
||||
|
|
|
@ -62,7 +62,7 @@ void CopySamplesNoDither(samplePtr src, sampleFormat srcFormat,
|
|||
unsigned int len,
|
||||
unsigned int srcStride=1,
|
||||
unsigned int dstStride=1);
|
||||
|
||||
|
||||
void ClearSamples(samplePtr buffer, sampleFormat format,
|
||||
int start, int len);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Audacity: A Digital Audio Editor
|
||||
|
||||
Screenshot.cpp
|
||||
|
||||
|
||||
Dominic Mazzoni
|
||||
|
||||
*******************************************************************/
|
||||
|
@ -444,7 +444,7 @@ void ScreenFrame::PopulateOrExchange(ShuttleGui & S)
|
|||
Move(displayWidth - width - 16, top + 16);
|
||||
}
|
||||
else {
|
||||
CentreOnParent();
|
||||
CentreOnParent();
|
||||
}
|
||||
|
||||
SetIcon(mContext.proj->GetIcon());
|
||||
|
@ -508,7 +508,7 @@ void ScreenFrame::OnDirChoose(wxCommandEvent & WXUNUSED(event))
|
|||
{
|
||||
wxString current = mDirectoryTextBox->GetValue();
|
||||
|
||||
wxDirDialog dlog(this,
|
||||
wxDirDialog dlog(this,
|
||||
_("Choose a location to save screenshot images"),
|
||||
current);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Audacity: A Digital Audio Editor
|
||||
|
||||
Screenshot.h
|
||||
|
||||
|
||||
Dominic Mazzoni
|
||||
|
||||
*******************************************************************//**
|
||||
|
|
176
src/Sequence.cpp
176
src/Sequence.cpp
|
@ -13,17 +13,17 @@
|
|||
*//****************************************************************//**
|
||||
|
||||
\class Sequence
|
||||
\brief A WaveTrack contains WaveClip(s).
|
||||
A WaveClip contains a Sequence. A Sequence is primarily an
|
||||
interface to an array of SeqBlock instances, corresponding to
|
||||
\brief A WaveTrack contains WaveClip(s).
|
||||
A WaveClip contains a Sequence. A Sequence is primarily an
|
||||
interface to an array of SeqBlock instances, corresponding to
|
||||
the audio BlockFiles on disk.
|
||||
Contrast with RingBuffer.
|
||||
|
||||
*//****************************************************************//**
|
||||
|
||||
\class SeqBlock
|
||||
\brief Data structure containing pointer to a BlockFile and
|
||||
a start time. Element of a BlockArray.
|
||||
\brief Data structure containing pointer to a BlockFile and
|
||||
a start time. Element of a BlockArray.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
|
@ -154,7 +154,7 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
|
|||
if (format == mSampleFormat)
|
||||
return true;
|
||||
|
||||
if (mBlock->GetCount() == 0)
|
||||
if (mBlock->GetCount() == 0)
|
||||
{
|
||||
mSampleFormat = format;
|
||||
*pbChanged = true;
|
||||
|
@ -174,15 +174,15 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
|
|||
pNewBlockArray->Alloc(mBlock->GetCount() * ((float)oldMaxSamples / (float)mMaxSamples));
|
||||
|
||||
bool bSuccess = true;
|
||||
for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++)
|
||||
for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++)
|
||||
{
|
||||
SeqBlock* pOldSeqBlock = mBlock->Item(i);
|
||||
BlockFile* pOldBlockFile = pOldSeqBlock->f;
|
||||
|
||||
|
||||
sampleCount len = pOldSeqBlock->f->GetLength();
|
||||
samplePtr bufferOld = NewSamples(len, oldFormat);
|
||||
samplePtr bufferNew = NewSamples(len, mSampleFormat);
|
||||
|
||||
|
||||
bSuccess = (pOldBlockFile->ReadData(bufferOld, oldFormat, 0, len) > 0);
|
||||
if (!bSuccess)
|
||||
{
|
||||
|
@ -190,18 +190,18 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
|
|||
DeleteSamples(bufferOld);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
CopySamples(bufferOld, oldFormat, bufferNew, mSampleFormat, len);
|
||||
|
||||
// Note this fix for http://bugzilla.audacityteam.org/show_bug.cgi?id=451,
|
||||
|
||||
// Note this fix for http://bugzilla.audacityteam.org/show_bug.cgi?id=451,
|
||||
// using Blockify, allows (len < mMinSamples).
|
||||
// This will happen consistently when going from more bytes per sample to fewer...
|
||||
// This will create a block that's smaller than mMinSamples, which
|
||||
// This will create a block that's smaller than mMinSamples, which
|
||||
// shouldn't be allowed, but we agreed it's okay for now.
|
||||
//vvv ANSWER-ME: Does this cause any bugs, or failures on write, elsewhere?
|
||||
// If so, need to special-case (len < mMinSamples) and start combining data
|
||||
// If so, need to special-case (len < mMinSamples) and start combining data
|
||||
// from the old blocks... Oh no!
|
||||
|
||||
|
||||
// Using Blockify will handle the cases where len > the new mMaxSamples. Previous code did not.
|
||||
BlockArray* pSplitBlockArray = Blockify(bufferNew, len);
|
||||
bSuccess = (pSplitBlockArray->GetCount() > 0);
|
||||
|
@ -215,7 +215,7 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
|
|||
*pbChanged = true;
|
||||
}
|
||||
delete pSplitBlockArray;
|
||||
|
||||
|
||||
DeleteSamples(bufferNew);
|
||||
DeleteSamples(bufferOld);
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
|
|||
{
|
||||
// Invalidate all the old, non-aliased block files.
|
||||
// Aliased files will be converted at save, per comment above.
|
||||
for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++)
|
||||
for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++)
|
||||
{
|
||||
SeqBlock* pOldSeqBlock = mBlock->Item(i);
|
||||
mDirManager->Deref(pOldSeqBlock->f);
|
||||
|
@ -237,8 +237,8 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* vvvvv We *should do the following, but TrackPanel::OnFormatChange() doesn't actually check the conversion results,
|
||||
it just assumes the conversion was successful.
|
||||
/* vvvvv We *should do the following, but TrackPanel::OnFormatChange() doesn't actually check the conversion results,
|
||||
it just assumes the conversion was successful.
|
||||
TODO: Uncomment this section when TrackPanel::OnFormatChange() is upgraded to check the results.
|
||||
|
||||
// Conversion failed. Revert these member vars.
|
||||
|
@ -246,12 +246,12 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
|
|||
mMaxSamples = oldMaxSamples;
|
||||
*/
|
||||
|
||||
delete pNewBlockArray; // Failed. Throw out the scratch array.
|
||||
delete pNewBlockArray; // Failed. Throw out the scratch array.
|
||||
*pbChanged = false; // Revert overall change flag, in case we had some partial success in the loop.
|
||||
}
|
||||
|
||||
bSuccess &= ConsistencyCheck(wxT("Sequence::ConvertToSampleFormat()"));
|
||||
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
|
@ -445,9 +445,9 @@ bool Sequence::Copy(sampleCount s0, sampleCount s1, Sequence **dest)
|
|||
Get(buffer, mSampleFormat, mBlock->Item(b1)->start, blocklen);
|
||||
(*dest)->Append(buffer, mSampleFormat, blocklen);
|
||||
}
|
||||
|
||||
|
||||
DeleteSamples(buffer);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -456,8 +456,8 @@ bool Sequence::Paste(sampleCount s, const Sequence *src)
|
|||
if ((s < 0) || (s > mNumSamples))
|
||||
{
|
||||
wxLogError(
|
||||
wxT("Sequence::Paste: sampleCount s %s is < 0 or > mNumSamples %s)."),
|
||||
Internat::ToString(((wxLongLong)s).ToDouble(), 0).c_str(),
|
||||
wxT("Sequence::Paste: sampleCount s %s is < 0 or > mNumSamples %s)."),
|
||||
Internat::ToString(((wxLongLong)s).ToDouble(), 0).c_str(),
|
||||
Internat::ToString(((wxLongLong)mNumSamples).ToDouble(), 0).c_str());
|
||||
wxASSERT(false);
|
||||
return false;
|
||||
|
@ -467,8 +467,8 @@ bool Sequence::Paste(sampleCount s, const Sequence *src)
|
|||
if (((double)mNumSamples) + ((double)src->mNumSamples) > wxLL(9223372036854775807))
|
||||
{
|
||||
wxLogError(
|
||||
wxT("Sequence::Paste: mNumSamples %s + src->mNumSamples %s would overflow."),
|
||||
Internat::ToString(((wxLongLong)mNumSamples).ToDouble(), 0).c_str(),
|
||||
wxT("Sequence::Paste: mNumSamples %s + src->mNumSamples %s would overflow."),
|
||||
Internat::ToString(((wxLongLong)mNumSamples).ToDouble(), 0).c_str(),
|
||||
Internat::ToString(((wxLongLong)src->mNumSamples).ToDouble(), 0).c_str());
|
||||
wxASSERT(false);
|
||||
return false;
|
||||
|
@ -477,7 +477,7 @@ bool Sequence::Paste(sampleCount s, const Sequence *src)
|
|||
if (src->mSampleFormat != mSampleFormat)
|
||||
{
|
||||
wxLogError(
|
||||
wxT("Sequence::Paste: Sample format to be pasted, %s, does not match destination format, %s."),
|
||||
wxT("Sequence::Paste: Sample format to be pasted, %s, does not match destination format, %s."),
|
||||
GetSampleFormatStr(src->mSampleFormat), GetSampleFormatStr(src->mSampleFormat));
|
||||
wxASSERT(false);
|
||||
return false;
|
||||
|
@ -524,11 +524,11 @@ bool Sequence::Paste(sampleCount s, const Sequence *src)
|
|||
SeqBlock *largerBlock = new SeqBlock();
|
||||
largerBlock->start = mBlock->Item(b)->start;
|
||||
sampleCount largerBlockLen = mBlock->Item(b)->f->GetLength() + addedLen;
|
||||
if (largerBlockLen > mMaxSamples)
|
||||
if (largerBlockLen > mMaxSamples)
|
||||
{
|
||||
wxLogError(
|
||||
wxT("Sequence::Paste: (largerBlockLen %s > mMaxSamples %s). largerBlockLen truncated to mMaxSamples."),
|
||||
Internat::ToString(((wxLongLong)largerBlockLen).ToDouble(), 0).c_str(),
|
||||
wxT("Sequence::Paste: (largerBlockLen %s > mMaxSamples %s). largerBlockLen truncated to mMaxSamples."),
|
||||
Internat::ToString(((wxLongLong)largerBlockLen).ToDouble(), 0).c_str(),
|
||||
Internat::ToString(((wxLongLong)mMaxSamples).ToDouble(), 0).c_str());
|
||||
largerBlockLen = mMaxSamples; // Prevent overruns, per NGS report for UmixIt.
|
||||
}
|
||||
|
@ -806,17 +806,17 @@ sampleCount Sequence::GetBestBlockSize(sampleCount start) const
|
|||
// than the value of GetMaxBlockSize();
|
||||
int b = FindBlock(start);
|
||||
int numBlocks = mBlock->GetCount();
|
||||
|
||||
|
||||
sampleCount result = (mBlock->Item(b)->start + mBlock->Item(b)->f->GetLength() - start);
|
||||
|
||||
|
||||
while(result < mMinSamples && b+1<numBlocks &&
|
||||
(mBlock->Item(b+1)->f->GetLength()+result) <= mMaxSamples) {
|
||||
b++;
|
||||
result += mBlock->Item(b)->f->GetLength();
|
||||
}
|
||||
|
||||
|
||||
wxASSERT(result > 0 && result <= mMaxSamples);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -835,10 +835,10 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
while(*attrs) {
|
||||
const wxChar *attr = *attrs++;
|
||||
const wxChar *value = *attrs++;
|
||||
|
||||
|
||||
if (!value)
|
||||
break;
|
||||
|
||||
|
||||
// Both these attributes have non-negative integer counts of samples, so
|
||||
// we can test & convert here, making sure that values > 2^31 are OK
|
||||
// because long clips will need them.
|
||||
|
@ -848,25 +848,25 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
delete (wb);
|
||||
mErrorOpening = true;
|
||||
wxLogWarning(
|
||||
wxT(" Sequence has bad %s attribute value, %s, that should be a positive integer."),
|
||||
wxT(" Sequence has bad %s attribute value, %s, that should be a positive integer."),
|
||||
attr, strValue.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!wxStrcmp(attr, wxT("start")))
|
||||
wb->start = nValue;
|
||||
|
||||
// Vaughan, 2011-10-10: I don't think we ever write a "len" attribute for "waveblock" tag,
|
||||
// so I think this is actually legacy code, or something intended, but not completed.
|
||||
// Anyway, might as well leave this code in, especially now that it has the check
|
||||
// Vaughan, 2011-10-10: I don't think we ever write a "len" attribute for "waveblock" tag,
|
||||
// so I think this is actually legacy code, or something intended, but not completed.
|
||||
// Anyway, might as well leave this code in, especially now that it has the check
|
||||
// against mMaxSamples.
|
||||
if (!wxStrcmp(attr, wxT("len")))
|
||||
{
|
||||
// mMaxSamples should already have been set by calls to the "sequence" clause below.
|
||||
// The check intended here was already done in DirManager::HandleXMLTag(), where
|
||||
// it let the block be built, then checked against mMaxSamples, and deleted the block
|
||||
// mMaxSamples should already have been set by calls to the "sequence" clause below.
|
||||
// The check intended here was already done in DirManager::HandleXMLTag(), where
|
||||
// it let the block be built, then checked against mMaxSamples, and deleted the block
|
||||
// if the size of the block is bigger than mMaxSamples.
|
||||
if (nValue > mMaxSamples)
|
||||
if (nValue > mMaxSamples)
|
||||
{
|
||||
delete (wb);
|
||||
mErrorOpening = true;
|
||||
|
@ -881,16 +881,16 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* handle sequence tag and it's attributes */
|
||||
if (!wxStrcmp(tag, wxT("sequence"))) {
|
||||
while(*attrs) {
|
||||
const wxChar *attr = *attrs++;
|
||||
const wxChar *value = *attrs++;
|
||||
|
||||
|
||||
if (!value)
|
||||
break;
|
||||
|
||||
|
||||
const wxString strValue = value; // promote string, we need this for all
|
||||
|
||||
if (!wxStrcmp(attr, wxT("maxsamples")))
|
||||
|
@ -935,9 +935,9 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
}
|
||||
} // while
|
||||
|
||||
//// Both mMaxSamples and mSampleFormat should have been set.
|
||||
//// Both mMaxSamples and mSampleFormat should have been set.
|
||||
//// Check that mMaxSamples is right for mSampleFormat, using the calculations from the constructor.
|
||||
//if ((mMinSamples != sMaxDiskBlockSize / SAMPLE_SIZE(mSampleFormat) / 2) ||
|
||||
//if ((mMinSamples != sMaxDiskBlockSize / SAMPLE_SIZE(mSampleFormat) / 2) ||
|
||||
// (mMaxSamples != mMinSamples * 2))
|
||||
//{
|
||||
// mErrorOpening = true;
|
||||
|
@ -946,7 +946,7 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -967,13 +967,13 @@ void Sequence::HandleXMLEndTag(const wxChar *tag)
|
|||
else
|
||||
len = mNumSamples - mBlock->Item(b)->start;
|
||||
|
||||
if (len > mMaxSamples)
|
||||
if (len > mMaxSamples)
|
||||
{
|
||||
// This could be why the blockfile failed, so limit
|
||||
// the silent replacement to mMaxSamples.
|
||||
wxLogWarning(
|
||||
wxT(" Sequence has missing block file with length %s > mMaxSamples %s.\n Setting length to mMaxSamples. This will likely cause some block files to be considered orphans."),
|
||||
Internat::ToString(((wxLongLong)len).ToDouble(), 0).c_str(),
|
||||
wxT(" Sequence has missing block file with length %s > mMaxSamples %s.\n Setting length to mMaxSamples. This will likely cause some block files to be considered orphans."),
|
||||
Internat::ToString(((wxLongLong)len).ToDouble(), 0).c_str(),
|
||||
Internat::ToString(((wxLongLong)mMaxSamples).ToDouble(), 0).c_str());
|
||||
len = mMaxSamples;
|
||||
}
|
||||
|
@ -991,22 +991,22 @@ void Sequence::HandleXMLEndTag(const wxChar *tag)
|
|||
wxString sFileAndExtension = mBlock->Item(b)->f->GetFileName().GetFullName();
|
||||
if (sFileAndExtension.IsEmpty())
|
||||
sFileAndExtension = wxT("(replaced with silence)");
|
||||
else
|
||||
else
|
||||
sFileAndExtension = wxT("\"") + sFileAndExtension + wxT("\"");
|
||||
wxLogWarning(
|
||||
wxT("Gap detected in project file.\n Start (%s) for block file %s is more than one sample past end of previous block (%s).\n Moving start back so blocks are contiguous."),
|
||||
Internat::ToString(((wxLongLong)(mBlock->Item(b)->start)).ToDouble(), 0).c_str(),
|
||||
sFileAndExtension.c_str(),
|
||||
wxT("Gap detected in project file.\n Start (%s) for block file %s is more than one sample past end of previous block (%s).\n Moving start back so blocks are contiguous."),
|
||||
Internat::ToString(((wxLongLong)(mBlock->Item(b)->start)).ToDouble(), 0).c_str(),
|
||||
sFileAndExtension.c_str(),
|
||||
Internat::ToString(((wxLongLong)(numSamples)).ToDouble(), 0).c_str());
|
||||
mBlock->Item(b)->start = numSamples;
|
||||
mErrorOpening = true;
|
||||
mErrorOpening = true;
|
||||
}
|
||||
numSamples += mBlock->Item(b)->f->GetLength();
|
||||
}
|
||||
if (mNumSamples != numSamples) {
|
||||
wxLogWarning(
|
||||
wxT("Gap detected in project file. Correcting sequence sample count from %s to %s."),
|
||||
Internat::ToString(((wxLongLong)mNumSamples).ToDouble(), 0).c_str(),
|
||||
wxT("Gap detected in project file. Correcting sequence sample count from %s to %s."),
|
||||
Internat::ToString(((wxLongLong)mNumSamples).ToDouble(), 0).c_str(),
|
||||
Internat::ToString(((wxLongLong)numSamples).ToDouble(), 0).c_str());
|
||||
mNumSamples = numSamples;
|
||||
mErrorOpening = true;
|
||||
|
@ -1026,7 +1026,7 @@ XMLTagHandler *Sequence::HandleXMLChild(const wxChar *tag)
|
|||
void Sequence::WriteXML(XMLWriter &xmlFile)
|
||||
{
|
||||
unsigned int b;
|
||||
|
||||
|
||||
xmlFile.StartTag(wxT("sequence"));
|
||||
|
||||
xmlFile.WriteAttr(wxT("maxsamples"), mMaxSamples);
|
||||
|
@ -1037,15 +1037,15 @@ void Sequence::WriteXML(XMLWriter &xmlFile)
|
|||
SeqBlock *bb = mBlock->Item(b);
|
||||
|
||||
// See http://bugzilla.audacityteam.org/show_bug.cgi?id=451.
|
||||
// Also, don't check against mMaxSamples for AliasBlockFiles, because if you convert sample format,
|
||||
// mMaxSample gets changed to match the format, but the number of samples in the aliased file
|
||||
// Also, don't check against mMaxSamples for AliasBlockFiles, because if you convert sample format,
|
||||
// mMaxSample gets changed to match the format, but the number of samples in the aliased file
|
||||
// has not changed (because sample format conversion was not actually done in the aliased file.
|
||||
if (!bb->f->IsAlias() && (bb->f->GetLength() > mMaxSamples))
|
||||
{
|
||||
wxString sMsg =
|
||||
wxString sMsg =
|
||||
wxString::Format(
|
||||
_("Sequence has block file with length %s > mMaxSamples %s.\nTruncating to mMaxSamples."),
|
||||
Internat::ToString(((wxLongLong)(bb->f->GetLength())).ToDouble(), 0).c_str(),
|
||||
_("Sequence has block file with length %s > mMaxSamples %s.\nTruncating to mMaxSamples."),
|
||||
Internat::ToString(((wxLongLong)(bb->f->GetLength())).ToDouble(), 0).c_str(),
|
||||
Internat::ToString(((wxLongLong)mMaxSamples).ToDouble(), 0).c_str());
|
||||
::wxMessageBox(sMsg, _("Warning - Length in Writing Sequence"), wxICON_EXCLAMATION | wxOK);
|
||||
::wxLogWarning(sMsg);
|
||||
|
@ -1114,7 +1114,7 @@ bool Sequence::Read(samplePtr buffer, sampleFormat format,
|
|||
|
||||
int result = f->ReadData(buffer, format, start, len);
|
||||
|
||||
if (result != len)
|
||||
if (result != len)
|
||||
{
|
||||
wxLogWarning(wxT("Expected to read %d samples, got %d samples."), len, result);
|
||||
if (result < 0)
|
||||
|
@ -1270,7 +1270,7 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
|
|||
s1 = mNumSamples;
|
||||
|
||||
sampleCount srcX = s0;
|
||||
|
||||
|
||||
unsigned int block0 = FindBlock(s0);
|
||||
|
||||
float *temp = new float[mMaxSamples];
|
||||
|
@ -1293,13 +1293,13 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
|
|||
|
||||
if (num > (s1 - srcX + divisor - 1) / divisor)
|
||||
num = (s1 - srcX + divisor - 1) / divisor;
|
||||
|
||||
|
||||
switch (divisor) {
|
||||
default:
|
||||
case 1:
|
||||
Read((samplePtr)temp, floatSample, mBlock->Item(b),
|
||||
srcX - mBlock->Item(b)->start, num);
|
||||
|
||||
|
||||
blockStatus=b;
|
||||
break;
|
||||
case 256:
|
||||
|
@ -1330,7 +1330,7 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Get min/max/rms of samples for each pixel we can
|
||||
int x = 0;
|
||||
|
||||
|
@ -1346,9 +1346,9 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
|
|||
sumsq = float(0.0);
|
||||
jcount = 0;
|
||||
}
|
||||
|
||||
|
||||
while (x < num) {
|
||||
|
||||
|
||||
while (pixel < len &&
|
||||
where[pixel] / divisor == srcX / divisor + x) {
|
||||
if (pixel > 0) {
|
||||
|
@ -1368,13 +1368,13 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
|
|||
jcount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sampleCount stop = (where[pixel] - srcX) / divisor;
|
||||
if (stop == x)
|
||||
stop++;
|
||||
if (stop > num)
|
||||
stop = num;
|
||||
|
||||
|
||||
switch (divisor) {
|
||||
default:
|
||||
case 1:
|
||||
|
@ -1399,7 +1399,7 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
|
|||
x++;
|
||||
jcount++;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1414,7 +1414,7 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl,
|
|||
srcX = mBlock->Item(b)->start;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Make sure that min[pixel - 1] doesn't segfault
|
||||
if (pixel <= 0)
|
||||
pixel = 1;
|
||||
|
@ -1493,7 +1493,7 @@ bool Sequence::Append(samplePtr buffer, sampleFormat format,
|
|||
blockFileLog != NULL);
|
||||
if (blockFileLog)
|
||||
((SimpleBlockFile*)newLastBlock->f)->SaveXML(*blockFileLog);
|
||||
|
||||
|
||||
DeleteSamples(buffer2);
|
||||
|
||||
mDirManager->Deref(lastBlock->f);
|
||||
|
@ -1513,7 +1513,7 @@ bool Sequence::Append(samplePtr buffer, sampleFormat format,
|
|||
/* i18n-hint: Error message shown when Audacity was trying to allocate
|
||||
memory to hold audio, and didn't have enough. 'New Samples' is
|
||||
the name of the C++ function that failed, for use by a developer,
|
||||
and should not be translated - though you could say
|
||||
and should not be translated - though you could say
|
||||
'in function "NewSamples()"' to be clearer.*/
|
||||
if (!temp) {
|
||||
wxMessageBox(_("Memory allocation failed -- NewSamples"));
|
||||
|
@ -1549,7 +1549,7 @@ bool Sequence::Append(samplePtr buffer, sampleFormat format,
|
|||
DeleteSamples(temp);
|
||||
|
||||
// JKC: During generate we use Append again and again.
|
||||
// If generating a long sequence this test would give O(n^2)
|
||||
// If generating a long sequence this test would give O(n^2)
|
||||
// performance - not good!
|
||||
#ifdef VERY_SLOW_CHECKING
|
||||
ConsistencyCheck(wxT("Append"));
|
||||
|
@ -1591,9 +1591,9 @@ bool Sequence::Delete(sampleCount start, sampleCount len)
|
|||
return true;
|
||||
if (len < 0 || start < 0 || start >= mNumSamples)
|
||||
return false;
|
||||
|
||||
|
||||
//TODO: add a ref-deref mechanism to SeqBlock/BlockArray so we don't have to make this a critical section.
|
||||
//On-demand threads iterate over the mBlocks and the GUI thread deletes them, so for now put a mutex here over
|
||||
//On-demand threads iterate over the mBlocks and the GUI thread deletes them, so for now put a mutex here over
|
||||
//both functions,
|
||||
LockDeleteUpdateMutex();
|
||||
|
||||
|
@ -1636,7 +1636,7 @@ bool Sequence::Delete(sampleCount start, sampleCount len)
|
|||
|
||||
mNumSamples -= len;
|
||||
UnlockDeleteUpdateMutex();
|
||||
|
||||
|
||||
return ConsistencyCheck(wxT("Delete - branch one"));
|
||||
}
|
||||
|
||||
|
@ -1798,7 +1798,7 @@ bool Sequence::Delete(sampleCount start, sampleCount len)
|
|||
|
||||
// Update total number of samples and do a consistency check.
|
||||
mNumSamples -= len;
|
||||
|
||||
|
||||
UnlockDeleteUpdateMutex();
|
||||
return ConsistencyCheck(wxT("Delete - branch two"));
|
||||
}
|
||||
|
@ -1823,13 +1823,13 @@ bool Sequence::ConsistencyCheck(const wxChar *whereStr)
|
|||
if (pos != mNumSamples)
|
||||
bError = true;
|
||||
|
||||
if (bError)
|
||||
if (bError)
|
||||
{
|
||||
wxLogError(wxT("*** Consistency check failed after %s. ***"), whereStr);
|
||||
wxString str;
|
||||
DebugPrintf(&str);
|
||||
wxLogError(wxT("%s"), str.c_str());
|
||||
wxLogError(wxT("*** Please report this error to feedback@audacityteam.org. ***\n\nRecommended course of action:\nUndo the failed operation(s), then export or save your work and quit."));
|
||||
wxLogError(wxT("*** Please report this error to feedback@audacityteam.org. ***\n\nRecommended course of action:\nUndo the failed operation(s), then export or save your work and quit."));
|
||||
}
|
||||
|
||||
return !bError;
|
||||
|
|
|
@ -91,10 +91,10 @@ class Sequence: public XMLTagHandler {
|
|||
|
||||
bool AppendCoded(wxString fName, sampleCount start,
|
||||
sampleCount len, int channel, int decodeType);
|
||||
|
||||
|
||||
///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc.
|
||||
unsigned int GetODFlags();
|
||||
|
||||
unsigned int GetODFlags();
|
||||
|
||||
// Append a blockfile. The blockfile pointer is then "owned" by the
|
||||
// sequence. This function is used by the recording log crash recovery
|
||||
// code, but may be useful for other purposes. The blockfile must already
|
||||
|
@ -124,7 +124,7 @@ class Sequence: public XMLTagHandler {
|
|||
// from being moved. Call this if you want to copy a
|
||||
// track to a different DirManager. See BlockFile.h
|
||||
// for details.
|
||||
//
|
||||
//
|
||||
|
||||
bool Lock();
|
||||
bool CloseLock();//similar to Lock but should be called upon project close.
|
||||
|
@ -161,7 +161,7 @@ class Sequence: public XMLTagHandler {
|
|||
//
|
||||
|
||||
BlockArray *GetBlockArray() {return mBlock;}
|
||||
|
||||
|
||||
///
|
||||
void LockDeleteUpdateMutex(){mDeleteUpdateMutex.Lock();}
|
||||
void UnlockDeleteUpdateMutex(){mDeleteUpdateMutex.Unlock();}
|
||||
|
@ -170,7 +170,7 @@ class Sequence: public XMLTagHandler {
|
|||
|
||||
//
|
||||
// Private static variables
|
||||
//
|
||||
//
|
||||
|
||||
static int sMaxDiskBlockSize;
|
||||
|
||||
|
@ -188,7 +188,7 @@ class Sequence: public XMLTagHandler {
|
|||
sampleCount mMaxSamples; // max samples per block
|
||||
|
||||
bool mErrorOpening;
|
||||
|
||||
|
||||
///To block the Delete() method against the ODCalcSummaryTask::Update() method
|
||||
ODLock mDeleteUpdateMutex;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
\brief Moves data from one place to another, converting it as required.
|
||||
|
||||
Shuttle provides a base class for transfering parameter data into and
|
||||
out of clasess into some other structure. This is a common
|
||||
out of clasess into some other structure. This is a common
|
||||
requirement and is needed for:
|
||||
- Prefs data
|
||||
- Command line parameter data
|
||||
|
@ -42,8 +42,8 @@ with a binary representation.
|
|||
*//****************************************************************//**
|
||||
|
||||
\class Enums
|
||||
\brief Enums is a helper class for Shuttle. It defines enumerations
|
||||
which are used in effects dialogs, in the effects themselves and in
|
||||
\brief Enums is a helper class for Shuttle. It defines enumerations
|
||||
which are used in effects dialogs, in the effects themselves and in
|
||||
preferences.
|
||||
|
||||
(If it grows big, we will move it out of shuttle.h).
|
||||
|
@ -72,14 +72,14 @@ preferences.
|
|||
|
||||
const int Enums::NumDbChoices = 13;
|
||||
|
||||
const wxString Enums::DbChoices[] =
|
||||
{wxT("-20 dB"), wxT("-25 dB"), wxT("-30 dB"),
|
||||
wxT("-35 dB"), wxT("-40 dB"), wxT("-45 dB"),
|
||||
const wxString Enums::DbChoices[] =
|
||||
{wxT("-20 dB"), wxT("-25 dB"), wxT("-30 dB"),
|
||||
wxT("-35 dB"), wxT("-40 dB"), wxT("-45 dB"),
|
||||
wxT("-50 dB"), wxT("-55 dB"), wxT("-60 dB"),
|
||||
wxT("-65 dB"), wxT("-70 dB"), wxT("-75 dB"),
|
||||
wxT("-65 dB"), wxT("-70 dB"), wxT("-75 dB"),
|
||||
wxT("-80 dB")};
|
||||
|
||||
const double Enums::Db2Signal[] =
|
||||
const double Enums::Db2Signal[] =
|
||||
// -20dB -25dB -30dB -35dB -40dB -45dB -50dB -55dB -60dB -65dB -70dB -75dB -80dB Off
|
||||
{ 0.10000, 0.05620, 0.03160, 0.01780, 0.01000, 0.00562, 0.00316, 0.00178, 0.00100, 0.000562, 0.000316, 0.000178, 0.0001000, 0.0 };
|
||||
|
||||
|
@ -104,7 +104,7 @@ bool Shuttle::TransferBool( const wxString & Name, bool & bValue, const bool & b
|
|||
if( !mValueString.IsEmpty() )
|
||||
bValue = mValueString.GetChar(0) == wxT('y');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mValueString = (bValue==0) ? wxT("no"):wxT("yes");
|
||||
|
@ -123,7 +123,7 @@ bool Shuttle::TransferFloat( const wxString & Name, float & fValue, const float
|
|||
if( !mValueString.IsEmpty() )
|
||||
fValue = wxAtof( mValueString );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mValueString = wxString::Format(wxT("%f"),fValue);
|
||||
|
@ -142,10 +142,10 @@ bool Shuttle::TransferDouble( const wxString & Name, double & dValue, const doub
|
|||
if( !mValueString.IsEmpty() )
|
||||
dValue = wxAtof( mValueString );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//%f is format string for double
|
||||
//%f is format string for double
|
||||
mValueString = wxString::Format(wxT("%f"),dValue);
|
||||
return ExchangeWithMaster( Name );
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ bool Shuttle::TransferInt( const wxString & Name, int & iValue, const int & iDef
|
|||
{
|
||||
iValue = wxAtoi( mValueString );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mValueString = wxString::Format(wxT("%i"),iValue);
|
||||
|
@ -185,7 +185,7 @@ bool Shuttle::TransferLongLong( const wxString & Name, wxLongLong_t & iValue, co
|
|||
{
|
||||
iValue = wxAtoi( mValueString );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// \todo Fix for long long values.
|
||||
|
@ -196,7 +196,7 @@ bool Shuttle::TransferLongLong( const wxString & Name, wxLongLong_t & iValue, co
|
|||
}
|
||||
|
||||
|
||||
bool Shuttle::TransferEnum( const wxString & Name, int & iValue,
|
||||
bool Shuttle::TransferEnum( const wxString & Name, int & iValue,
|
||||
const int nChoices, const wxString * pFirstStr)
|
||||
{
|
||||
if( mbStoreInClient )
|
||||
|
@ -219,7 +219,7 @@ bool Shuttle::TransferEnum( const wxString & Name, int & iValue,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//TIDY-ME: Out of range configuration values are silently discarded...
|
||||
|
@ -282,7 +282,7 @@ bool Shuttle::ExchangeWithMaster(const wxString & WXUNUSED(Name))
|
|||
}
|
||||
|
||||
// This variant uses values of the form
|
||||
// param1=value1 param2=value2
|
||||
// param1=value1 param2=value2
|
||||
bool ShuttleCli::ExchangeWithMaster(const wxString & Name)
|
||||
{
|
||||
if( !mbStoreInClient )
|
||||
|
|
|
@ -29,7 +29,7 @@ class Shuttle {
|
|||
// constructors and destructors
|
||||
Shuttle();
|
||||
virtual ~Shuttle() {}
|
||||
|
||||
|
||||
public:
|
||||
bool mbStoreInClient;
|
||||
wxString mValueString;
|
||||
|
@ -42,7 +42,7 @@ class Shuttle {
|
|||
virtual bool TransferInt( const wxString & Name, wxLongLong_t & iValue, const wxLongLong_t &iDefault );
|
||||
virtual bool TransferLongLong( const wxString & Name, wxLongLong_t & iValue, const wxLongLong_t &iDefault );
|
||||
virtual bool TransferString( const wxString & Name, wxString & strValue, const wxString &strDefault );
|
||||
virtual bool TransferEnum( const wxString & Name, int & iValue,
|
||||
virtual bool TransferEnum( const wxString & Name, int & iValue,
|
||||
const int nChoices, const wxString * pFirstStr);
|
||||
virtual bool TransferWrappedType( const wxString & Name, WrappedType & W );
|
||||
// We expect the ExchangeWithMaster function to change from one type of
|
||||
|
|
|
@ -18,17 +18,17 @@
|
|||
|
||||
\class ShuttleGui
|
||||
\brief
|
||||
Derived from ShuttleGuiBase, an Audacity specific class for shuttling
|
||||
Derived from ShuttleGuiBase, an Audacity specific class for shuttling
|
||||
data to and from GUI.
|
||||
|
||||
ShuttleGui extends the idea of the data Shuttle class to include creation
|
||||
of dialog controls. As part of this it provides an interface to sizers
|
||||
that leads to shorter more readable code.
|
||||
|
||||
ShuttleGui extends the idea of the data Shuttle class to include creation
|
||||
of dialog controls. As part of this it provides an interface to sizers
|
||||
that leads to shorter more readable code.
|
||||
|
||||
It also allows the code that is used to create dialogs to be reused
|
||||
to shuttle information in and out.
|
||||
to shuttle information in and out.
|
||||
|
||||
Most of the ShuttleGui functions are actually defined in
|
||||
Most of the ShuttleGui functions are actually defined in
|
||||
ShuttleGuiBase.
|
||||
- wxWidgets widgets are dealt with by ShuttleGuiBase.
|
||||
- Audacity specific widgets are dealt with by ShuttleGui
|
||||
|
@ -52,37 +52,37 @@ The code in this file is fairly repetitive. We are dealing with
|
|||
- Creation / Reading / Writing / Exporting / Importing
|
||||
- int, float, string variants (for example of TextCtrl contents).
|
||||
|
||||
A technique used to reduce the size of the \p Tie functions is to
|
||||
A technique used to reduce the size of the \p Tie functions is to
|
||||
have one generic \p Tie function that uses WrappedType for its
|
||||
data type. Type specific \p Tie functions themselves call the generic
|
||||
variant.
|
||||
|
||||
A second technique used to reduce the size of \p Tie functions
|
||||
A second technique used to reduce the size of \p Tie functions
|
||||
only comes into play for two-step \p Tie functions. (A two step
|
||||
\p Tie function is one that transfers data between the registry
|
||||
and the GUI via an intermediate temporary variable). In the two
|
||||
step style, a function ShuttleGuiBase::DoStep() determines which
|
||||
transfers in the function are to be done, reducing repetitive
|
||||
\p Tie function is one that transfers data between the registry
|
||||
and the GUI via an intermediate temporary variable). In the two
|
||||
step style, a function ShuttleGuiBase::DoStep() determines which
|
||||
transfers in the function are to be done, reducing repetitive
|
||||
if-then-else's.
|
||||
|
||||
Although unusual, these two techniques make the code easier to
|
||||
add to and much easier to check for correctness. The alternative
|
||||
'more obvious' code that just repeats code as needed is
|
||||
add to and much easier to check for correctness. The alternative
|
||||
'more obvious' code that just repeats code as needed is
|
||||
considerably longer.
|
||||
|
||||
You would rarely use ShuttleGuiBase directly, instead you'd use
|
||||
ShuttleGui.
|
||||
You would rarely use ShuttleGuiBase directly, instead you'd use
|
||||
ShuttleGui.
|
||||
|
||||
There is DOxygen documentation on how to use the ShuttleGui
|
||||
class in \ref ShuttleSystem .
|
||||
There is DOxygen documentation on how to use the ShuttleGui
|
||||
class in \ref ShuttleSystem .
|
||||
|
||||
*//***************************************************************//**
|
||||
|
||||
\class InvisiblePanel
|
||||
\brief An InvisiblePanel is a panel which does not repaint its
|
||||
\brief An InvisiblePanel is a panel which does not repaint its
|
||||
own background.
|
||||
|
||||
It is used (a) To group together widgets which need to be refreshed
|
||||
It is used (a) To group together widgets which need to be refreshed
|
||||
together. A single refresh of the panel causes all the subwindows to
|
||||
refresh. (b) as a base class for some flicker-free classes for which
|
||||
the backgorund is never repainted.
|
||||
|
@ -216,7 +216,7 @@ void ShuttleGuiBase::AddPrompt(const wxString &Prompt)
|
|||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
miProp=1;
|
||||
mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize,
|
||||
mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize,
|
||||
Style( wxALIGN_RIGHT ));
|
||||
mpWind->SetName(wxStripMenuCodes(Prompt)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
|
||||
UpdateSizersCore( false, wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL );
|
||||
|
@ -230,7 +230,7 @@ void ShuttleGuiBase::AddUnits(const wxString &Prompt)
|
|||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
miProp=1;
|
||||
mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize,
|
||||
mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize,
|
||||
Style( wxALIGN_LEFT ));
|
||||
mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
|
||||
UpdateSizersCore( false, wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL );
|
||||
|
@ -243,7 +243,7 @@ void ShuttleGuiBase::AddTitle(const wxString &Prompt)
|
|||
return;
|
||||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize,
|
||||
mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize,
|
||||
Style( wxALIGN_CENTRE ));
|
||||
mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
|
||||
UpdateSizers();
|
||||
|
@ -315,9 +315,9 @@ wxBitmapButton * ShuttleGuiBase::AddBitmapButton(const wxBitmap &Bitmap, int Pos
|
|||
if( mShuttleMode != eIsCreating )
|
||||
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxBitmapButton);
|
||||
wxBitmapButton * pBtn;
|
||||
mpWind = pBtn = new wxBitmapButton( mpParent, miId, Bitmap,
|
||||
mpWind = pBtn = new wxBitmapButton( mpParent, miId, Bitmap,
|
||||
wxDefaultPosition, wxDefaultSize, Style( wxNO_BORDER ) );
|
||||
pBtn->SetBackgroundColour(
|
||||
pBtn->SetBackgroundColour(
|
||||
wxColour( 246,246,243));
|
||||
// wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
miProp=0;
|
||||
|
@ -337,7 +337,7 @@ wxChoice * ShuttleGuiBase::AddChoice( const wxString &Prompt, const wxString &Se
|
|||
mpWind = pChoice = new wxChoice(
|
||||
mpParent,
|
||||
miId,
|
||||
wxDefaultPosition,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
*pChoices,
|
||||
Style( 0 ) );
|
||||
|
@ -355,7 +355,7 @@ void ShuttleGuiBase::AddFixedText(const wxString &Str, bool bCenter)
|
|||
UseUpId();
|
||||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
mpWind = new wxStaticText(mpParent, miId, Str, wxDefaultPosition, wxDefaultSize,
|
||||
mpWind = new wxStaticText(mpParent, miId, Str, wxDefaultPosition, wxDefaultSize,
|
||||
Style( wxALIGN_LEFT ));
|
||||
mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
|
||||
if( bCenter )
|
||||
|
@ -374,7 +374,7 @@ wxStaticText * ShuttleGuiBase::AddVariableText(const wxString &Str, bool bCenter
|
|||
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxStaticText);
|
||||
|
||||
wxStaticText *pStatic;
|
||||
mpWind = pStatic = new wxStaticText(mpParent, miId, Str, wxDefaultPosition, wxDefaultSize,
|
||||
mpWind = pStatic = new wxStaticText(mpParent, miId, Str, wxDefaultPosition, wxDefaultSize,
|
||||
Style( wxALIGN_LEFT ));
|
||||
mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
|
||||
if( bCenter )
|
||||
|
@ -412,7 +412,7 @@ wxComboBox * ShuttleGuiBase::AddCombo( const wxString &Prompt, const wxString &S
|
|||
|
||||
AddPrompt( Prompt );
|
||||
|
||||
mpWind = pCombo = new wxComboBox(mpParent, miId, Selected, wxDefaultPosition, wxDefaultSize,
|
||||
mpWind = pCombo = new wxComboBox(mpParent, miId, Selected, wxDefaultPosition, wxDefaultSize,
|
||||
n, Choices, Style( style ));
|
||||
mpWind->SetName(wxStripMenuCodes(Prompt));
|
||||
|
||||
|
@ -423,7 +423,7 @@ wxComboBox * ShuttleGuiBase::AddCombo( const wxString &Prompt, const wxString &S
|
|||
|
||||
wxRadioButton * ShuttleGuiBase::AddRadioButton(const wxString &Prompt)
|
||||
{
|
||||
/// \todo This function and the next one, suitably adapted, could be
|
||||
/// \todo This function and the next one, suitably adapted, could be
|
||||
/// used by TieRadioButton.
|
||||
UseUpId();
|
||||
if( mShuttleMode != eIsCreating )
|
||||
|
@ -457,8 +457,8 @@ wxSlider * ShuttleGuiBase::AddSlider(const wxString &Prompt, int pos, int Max, i
|
|||
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSlider);
|
||||
AddPrompt( Prompt );
|
||||
wxSlider * pSlider;
|
||||
mpWind = pSlider = new wxSlider( mpParent, miId,
|
||||
pos, Min, Max,
|
||||
mpWind = pSlider = new wxSlider( mpParent, miId,
|
||||
pos, Min, Max,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
Style( wxSL_HORIZONTAL | wxSL_LABELS | wxSL_AUTOTICKS )
|
||||
);
|
||||
|
@ -475,8 +475,8 @@ wxSpinCtrl * ShuttleGuiBase::AddSpinCtrl(const wxString &Prompt, int Value, int
|
|||
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSpinCtrl);
|
||||
AddPrompt( Prompt );
|
||||
wxSpinCtrl * pSpinCtrl;
|
||||
mpWind = pSpinCtrl = new wxSpinCtrl( mpParent, miId,
|
||||
wxEmptyString,
|
||||
mpWind = pSpinCtrl = new wxSpinCtrl( mpParent, miId,
|
||||
wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
Style( wxSP_VERTICAL | wxSP_ARROW_KEYS ),
|
||||
Min, Max, Value
|
||||
|
@ -615,7 +615,7 @@ wxGrid * ShuttleGuiBase::AddGrid()
|
|||
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxGrid);
|
||||
wxGrid * pGrid;
|
||||
SetProportions( 1 );
|
||||
mpWind = pGrid = new wxGrid(mpParent, miId, wxDefaultPosition,
|
||||
mpWind = pGrid = new wxGrid(mpParent, miId, wxDefaultPosition,
|
||||
wxDefaultSize, Style( wxWANTS_CHARS ));
|
||||
pGrid->SetMinSize( wxSize( 120, 150 ));
|
||||
UpdateSizers();
|
||||
|
@ -679,11 +679,11 @@ wxMenuBar * ShuttleGuiBase::AddMenuBar( )
|
|||
mpMenuBar->SetThemeEnabled( true );
|
||||
pFrame->SetMenuBar(mpMenuBar);
|
||||
|
||||
return mpMenuBar;
|
||||
return mpMenuBar;
|
||||
}
|
||||
|
||||
wxMenu * ShuttleGuiBase::AddMenu( const wxString & Title )
|
||||
{
|
||||
{
|
||||
mpMenu = new wxMenu;
|
||||
mpMenuBar->Append( mpMenu, Title );
|
||||
return mpMenu;
|
||||
|
@ -693,7 +693,7 @@ wxMenu * ShuttleGuiBase::AddMenu( const wxString & Title )
|
|||
|
||||
/// Starts a static box around a number of controls.
|
||||
/// @param Str The text of the title for the box.
|
||||
/// @param iProp The resizing proportion value.
|
||||
/// @param iProp The resizing proportion value.
|
||||
/// Use iProp == 0 for a minimum sized static box.
|
||||
/// Use iProp == 1 for a box that grows if there is space to spare.
|
||||
wxStaticBox * ShuttleGuiBase::StartStatic(const wxString &Str, int iProp)
|
||||
|
@ -702,11 +702,11 @@ wxStaticBox * ShuttleGuiBase::StartStatic(const wxString &Str, int iProp)
|
|||
mBoxName = Str;
|
||||
if( mShuttleMode != eIsCreating )
|
||||
return NULL;
|
||||
wxStaticBox * pBox = new wxStaticBox(mpParent, miId,
|
||||
wxStaticBox * pBox = new wxStaticBox(mpParent, miId,
|
||||
Str );
|
||||
pBox->SetLabel( Str );
|
||||
pBox->SetName(wxStripMenuCodes(Str));
|
||||
mpSubSizer = new wxStaticBoxSizer(
|
||||
mpSubSizer = new wxStaticBoxSizer(
|
||||
pBox,
|
||||
wxVERTICAL );
|
||||
miSizerProp = iProp;
|
||||
|
@ -721,29 +721,29 @@ void ShuttleGuiBase::EndStatic()
|
|||
PopSizer();
|
||||
}
|
||||
|
||||
/// This allows subsequent controls and static boxes to be in
|
||||
/// This allows subsequent controls and static boxes to be in
|
||||
/// a scrolled panel. Very handy if you are running out of space
|
||||
/// on a dialog.
|
||||
///
|
||||
/// The iStyle parameter is used in some very hacky code that
|
||||
/// dynamically repopulates a dialog. It also controls the
|
||||
/// dynamically repopulates a dialog. It also controls the
|
||||
/// background colour. Look at the code for details.
|
||||
/// @param istyle deprecated parameter, but has been used for hacking.
|
||||
/// @param istyle deprecated parameter, but has been used for hacking.
|
||||
wxScrolledWindow * ShuttleGuiBase::StartScroller(int iStyle)
|
||||
{
|
||||
UseUpId();
|
||||
if( mShuttleMode != eIsCreating )
|
||||
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxScrolledWindow);
|
||||
|
||||
|
||||
wxScrolledWindow * pScroller;
|
||||
mpWind = pScroller = new wxScrolledWindow( mpParent, miId, wxDefaultPosition, wxDefaultSize,
|
||||
Style( wxSUNKEN_BORDER ) );
|
||||
pScroller->SetScrollRate( 20,20 );
|
||||
|
||||
mpWind->SetBackgroundColour(
|
||||
iStyle==0
|
||||
mpWind->SetBackgroundColour(
|
||||
iStyle==0
|
||||
? wxColour( 245,244,240) :
|
||||
wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)
|
||||
wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)
|
||||
);
|
||||
SetProportions( 1 );
|
||||
if( iStyle==2 )
|
||||
|
@ -779,7 +779,7 @@ void ShuttleGuiBase::EndScroller()
|
|||
mpParent->SetMinSize( wxSize(xMin, yMin) );
|
||||
|
||||
PopSizer();
|
||||
mpParent = mpParent->GetParent();
|
||||
mpParent = mpParent->GetParent();
|
||||
}
|
||||
|
||||
wxPanel * ShuttleGuiBase::StartPanel(int iStyle)
|
||||
|
@ -793,10 +793,10 @@ wxPanel * ShuttleGuiBase::StartPanel(int iStyle)
|
|||
|
||||
if( iStyle != 0 )
|
||||
{
|
||||
mpWind->SetBackgroundColour(
|
||||
iStyle==1
|
||||
mpWind->SetBackgroundColour(
|
||||
iStyle==1
|
||||
? wxColour( 190,200,230) :
|
||||
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)
|
||||
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)
|
||||
);
|
||||
}
|
||||
SetProportions(0);
|
||||
|
@ -816,7 +816,7 @@ void ShuttleGuiBase::EndPanel()
|
|||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
PopSizer();
|
||||
mpParent = mpParent->GetParent();
|
||||
mpParent = mpParent->GetParent();
|
||||
}
|
||||
|
||||
wxNotebook * ShuttleGuiBase::StartNotebook()
|
||||
|
@ -825,7 +825,7 @@ wxNotebook * ShuttleGuiBase::StartNotebook()
|
|||
if( mShuttleMode != eIsCreating )
|
||||
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxNotebook);
|
||||
wxNotebook * pNotebook;
|
||||
mpWind = pNotebook = new wxNotebook(mpParent,
|
||||
mpWind = pNotebook = new wxNotebook(mpParent,
|
||||
miId, wxDefaultPosition, wxDefaultSize, Style( 0 ));
|
||||
SetProportions( 1 );
|
||||
UpdateSizers();
|
||||
|
@ -836,7 +836,7 @@ wxNotebook * ShuttleGuiBase::StartNotebook()
|
|||
void ShuttleGuiBase::EndNotebook()
|
||||
{
|
||||
//PopSizer();
|
||||
mpParent = mpParent->GetParent();
|
||||
mpParent = mpParent->GetParent();
|
||||
}
|
||||
|
||||
|
||||
|
@ -849,8 +849,8 @@ wxNotebookPage * ShuttleGuiBase::StartNotebookPage( const wxString Name )
|
|||
wxNotebookPage * pPage = new wxPanel(mpParent );
|
||||
pPage->SetName(Name);
|
||||
|
||||
pNotebook->AddPage(
|
||||
pPage,
|
||||
pNotebook->AddPage(
|
||||
pPage,
|
||||
Name);
|
||||
PushSizer();
|
||||
|
||||
|
@ -869,12 +869,12 @@ void ShuttleGuiBase::StartNotebookPage( const wxString Name, wxNotebookPage * pP
|
|||
return;
|
||||
// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
|
||||
wxNotebook * pNotebook = (wxNotebook*)mpParent;
|
||||
// wxNotebookPage * pPage = new wxPanel(mpParent );
|
||||
// wxNotebookPage * pPage = new wxPanel(mpParent );
|
||||
pPage->Create( mpParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, wxT("panel"));
|
||||
pPage->SetName(Name);
|
||||
|
||||
pNotebook->AddPage(
|
||||
pPage,
|
||||
pNotebook->AddPage(
|
||||
pPage,
|
||||
Name);
|
||||
PushSizer();
|
||||
|
||||
|
@ -891,19 +891,19 @@ void ShuttleGuiBase::EndNotebookPage()
|
|||
if( mShuttleMode != eIsCreating )
|
||||
return;
|
||||
PopSizer();
|
||||
mpParent = mpParent->GetParent();
|
||||
mpParent = mpParent->GetParent();
|
||||
}
|
||||
|
||||
// Doxygen description is at the start of the file
|
||||
// Doxygen description is at the start of the file
|
||||
// this is a wxPanel with erase background disabled.
|
||||
class InvisiblePanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
InvisiblePanel(
|
||||
wxWindow* parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
InvisiblePanel(
|
||||
wxWindow* parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL ) :
|
||||
wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
|
@ -911,7 +911,7 @@ public:
|
|||
~InvisiblePanel(){;};
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
void OnErase(wxEraseEvent &/*evt*/){;};
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
|
@ -936,8 +936,8 @@ wxPanel * ShuttleGuiBase::StartInvisiblePanel()
|
|||
mpWind = pPanel = new wxPanel( mpParent, miId, wxDefaultPosition, wxDefaultSize,
|
||||
wxNO_BORDER);
|
||||
|
||||
mpWind->SetBackgroundColour(
|
||||
wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)
|
||||
mpWind->SetBackgroundColour(
|
||||
wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)
|
||||
);
|
||||
SetProportions( 1 );
|
||||
miBorder=0;
|
||||
|
@ -962,7 +962,7 @@ void ShuttleGuiBase::EndInvisiblePanel()
|
|||
/// - Use wxEXPAND and 1 to expand horizontally and vertically.
|
||||
/// - Use wxCENTRE and 1 for no expansion.
|
||||
/// @param PositionFlag Typically wxEXPAND or wxALIGN_CENTER.
|
||||
/// @param iProp Proportionality for resizing.
|
||||
/// @param iProp Proportionality for resizing.
|
||||
void ShuttleGuiBase::StartHorizontalLay( int PositionFlags, int iProp)
|
||||
{
|
||||
if( mShuttleMode != eIsCreating )
|
||||
|
@ -1021,7 +1021,7 @@ void ShuttleGuiBase::DoDataShuttle( const wxString &Name, WrappedType & WrappedR
|
|||
//-----------------------------------------------------------------------//
|
||||
|
||||
// We now have a group of tie functions which are generic in the type
|
||||
// they bind to (i.e. WrappedType).
|
||||
// they bind to (i.e. WrappedType).
|
||||
// The type specific versions are much shorter and are later
|
||||
// in this file.
|
||||
wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, WrappedType & WrappedRef)
|
||||
|
@ -1266,8 +1266,8 @@ wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, WrappedType & Wrap
|
|||
}
|
||||
|
||||
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const wxString &Prompt,
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const wxString &Prompt,
|
||||
WrappedType &WrappedRef,
|
||||
const wxArrayString * pChoices )
|
||||
{
|
||||
|
@ -1340,7 +1340,7 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(const wxString &Prompt, WrappedTy
|
|||
case eIsCreating:
|
||||
{
|
||||
mpWind = pRadioButton = new wxRadioButton( mpParent, miId, Prompt,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
(mRadioCount==1)?wxRB_GROUP:0);
|
||||
pRadioButton->SetValue(WrappedRef.ValuesMatch( mRadioValue ));
|
||||
pRadioButton->SetName(wxStripMenuCodes(Prompt));
|
||||
|
@ -1365,7 +1365,7 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(const wxString &Prompt, WrappedTy
|
|||
return pRadioButton;
|
||||
}
|
||||
|
||||
/// Call this before any TieRadioButton calls.
|
||||
/// Call this before any TieRadioButton calls.
|
||||
/// This is the generic version and requires mRadioValue already initialised.
|
||||
/// Versions for specific types must do that initialisation.
|
||||
void ShuttleGuiBase::StartRadioButtonGroup( const wxString & SettingName )
|
||||
|
@ -1400,7 +1400,7 @@ wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, bool &Var)
|
|||
|
||||
// See comment in AddCheckBoxOnRight() for why we have this variant.
|
||||
wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(const wxString &Prompt, bool &Var)
|
||||
{
|
||||
{
|
||||
// Only odes anything different if it's creating.
|
||||
WrappedType WrappedRef( Var );
|
||||
if( mShuttleMode == eIsCreating )
|
||||
|
@ -1415,7 +1415,7 @@ wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl( const wxString &Prompt, int &Value, co
|
|||
}
|
||||
|
||||
wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, wxString &Selected, const int nChars)
|
||||
{
|
||||
{
|
||||
WrappedType WrappedRef(Selected);
|
||||
return TieTextBox( Prompt, WrappedRef, nChars );
|
||||
}
|
||||
|
@ -1433,7 +1433,7 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, double &Value,
|
|||
}
|
||||
|
||||
wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, wxString &Selected, const int nChars)
|
||||
{
|
||||
{
|
||||
WrappedType WrappedRef(Selected);
|
||||
return TieNumericTextBox( Prompt, WrappedRef, nChars );
|
||||
}
|
||||
|
@ -1461,7 +1461,7 @@ wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, float &pos, const
|
|||
const float RoundFix=0.0000001f;
|
||||
int iVal=(pos-fMin+RoundFix)*100.0/(fMax-fMin);
|
||||
wxSlider * pWnd = TieSlider( Prompt, iVal, 100 );
|
||||
pos = iVal*(fMax-fMin)*0.01+fMin;
|
||||
pos = iVal*(fMax-fMin)*0.01+fMin;
|
||||
return pWnd;
|
||||
}
|
||||
|
||||
|
@ -1473,22 +1473,22 @@ wxSlider * ShuttleGuiBase::TieVSlider( const wxString &Prompt, float &pos, const
|
|||
// return AddVSlider( Prompt, iVal, 100 );
|
||||
// }
|
||||
wxSlider * pWnd = TieSlider( Prompt, iVal, 100 );
|
||||
pos = iVal*(fMax-fMin)*0.01+fMin;
|
||||
pos = iVal*(fMax-fMin)*0.01+fMin;
|
||||
return pWnd;
|
||||
}
|
||||
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const wxString &Prompt,
|
||||
wxString &Selected,
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const wxString &Prompt,
|
||||
wxString &Selected,
|
||||
const wxArrayString * pChoices )
|
||||
{
|
||||
WrappedType WrappedRef( Selected );
|
||||
return TieChoice( Prompt, WrappedRef, pChoices );
|
||||
}
|
||||
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const wxString &Prompt,
|
||||
int &Selected,
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const wxString &Prompt,
|
||||
int &Selected,
|
||||
const wxArrayString * pChoices )
|
||||
{
|
||||
WrappedType WrappedRef( Selected );
|
||||
|
@ -1528,7 +1528,7 @@ wxString ShuttleGuiBase::TranslateFromIndex( const int nIn, const wxArrayString
|
|||
|
||||
/// Int-to-Index (choices can be items like e.g 0x400120 )
|
||||
int ShuttleGuiBase::TranslateToIndex( const int Value, const wxArrayInt &Choices )
|
||||
{
|
||||
{
|
||||
int n = Choices.Index( Value );
|
||||
if( n== wxNOT_FOUND )
|
||||
n=miNoMatchSelector;
|
||||
|
@ -1563,7 +1563,7 @@ int ShuttleGuiBase::TranslateFromIndex( const int nIn, const wxArrayInt &Choices
|
|||
//----------------------------------------------------------------------//
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Code-Condenser function.
|
||||
|
||||
We have functions which need to do:
|
||||
|
@ -1588,7 +1588,7 @@ like this:
|
|||
if( DoStep(3) ) DoThirdThing();
|
||||
\endcode
|
||||
|
||||
The repeated choice logic can then be taken out of those
|
||||
The repeated choice logic can then be taken out of those
|
||||
functions.
|
||||
|
||||
JKC: This paves the way for doing data validation too,
|
||||
|
@ -1616,11 +1616,11 @@ bool ShuttleGuiBase::DoStep( int iStep )
|
|||
}
|
||||
|
||||
|
||||
/// Variant of the standard TieCheckBox which does the two step exchange
|
||||
/// Variant of the standard TieCheckBox which does the two step exchange
|
||||
/// between gui and stack variable and stack variable and shuttle.
|
||||
wxCheckBox * ShuttleGuiBase::TieCheckBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault)
|
||||
{
|
||||
wxCheckBox * pCheck=NULL;
|
||||
|
@ -1634,11 +1634,11 @@ wxCheckBox * ShuttleGuiBase::TieCheckBox(
|
|||
return pCheck;
|
||||
}
|
||||
|
||||
/// Variant of the standard TieCheckBox which does the two step exchange
|
||||
/// Variant of the standard TieCheckBox which does the two step exchange
|
||||
/// between gui and stack variable and stack variable and shuttle.
|
||||
wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault)
|
||||
{
|
||||
wxCheckBox * pCheck=NULL;
|
||||
|
@ -1652,11 +1652,11 @@ wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(
|
|||
return pCheck;
|
||||
}
|
||||
|
||||
/// Variant of the standard TieSlider which does the two step exchange
|
||||
/// Variant of the standard TieSlider which does the two step exchange
|
||||
/// between gui and stack variable and stack variable and shuttle.
|
||||
wxSlider * ShuttleGuiBase::TieSlider(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int iDefault,
|
||||
const int max,
|
||||
const int min)
|
||||
|
@ -1672,11 +1672,11 @@ wxSlider * ShuttleGuiBase::TieSlider(
|
|||
return pSlider;
|
||||
}
|
||||
|
||||
/// Variant of the standard TieSpinCtrl which does the two step exchange
|
||||
/// Variant of the standard TieSpinCtrl which does the two step exchange
|
||||
/// between gui and stack variable and stack variable and shuttle.
|
||||
wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Value,
|
||||
const int max,
|
||||
const int min)
|
||||
|
@ -1692,11 +1692,11 @@ wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl(
|
|||
return pSpinCtrl;
|
||||
}
|
||||
|
||||
/// Variant of the standard TieTextBox which does the two step exchange
|
||||
/// Variant of the standard TieTextBox which does the two step exchange
|
||||
/// between gui and stack variable and stack variable and shuttle.
|
||||
wxTextCtrl * ShuttleGuiBase::TieTextBox(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const wxString & Default,
|
||||
const int nChars)
|
||||
{
|
||||
|
@ -1710,11 +1710,11 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox(
|
|||
return pText;
|
||||
}
|
||||
|
||||
/// Variant of the standard TieTextBox which does the two step exchange
|
||||
/// Variant of the standard TieTextBox which does the two step exchange
|
||||
/// between gui and stack variable and stack variable and shuttle.
|
||||
wxTextCtrl * ShuttleGuiBase::TieNumericTextBox(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const wxString & Default,
|
||||
const int nChars)
|
||||
{
|
||||
|
@ -1727,12 +1727,12 @@ wxTextCtrl * ShuttleGuiBase::TieNumericTextBox(
|
|||
if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
|
||||
return pText;
|
||||
}
|
||||
/// Variant of the standard TieTextBox which does the two step exchange
|
||||
/// Variant of the standard TieTextBox which does the two step exchange
|
||||
/// between gui and stack variable and stack variable and shuttle.
|
||||
/// This one does it for double values...
|
||||
wxTextCtrl * ShuttleGuiBase::TieTextBox(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const double & Default,
|
||||
const int nChars)
|
||||
{
|
||||
|
@ -1746,12 +1746,12 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox(
|
|||
return pText;
|
||||
}
|
||||
|
||||
/// Variant of the standard TieTextBox which does the two step exchange
|
||||
/// Variant of the standard TieTextBox which does the two step exchange
|
||||
/// between gui and stack variable and stack variable and shuttle.
|
||||
/// This one does it for double values...
|
||||
wxTextCtrl * ShuttleGuiBase::TieNumericTextBox(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const double & Default,
|
||||
const int nChars)
|
||||
{
|
||||
|
@ -1765,22 +1765,22 @@ wxTextCtrl * ShuttleGuiBase::TieNumericTextBox(
|
|||
return pText;
|
||||
}
|
||||
|
||||
/// Variant of the standard TieChoice which does the two step exchange
|
||||
/// Variant of the standard TieChoice which does the two step exchange
|
||||
/// between gui and stack variable and stack variable and shuttle.
|
||||
/// @param Prompt The prompt shown beside the control.
|
||||
/// @param SettingName The setting name as stored in gPrefs
|
||||
/// @param Default The default value for this control (translated)
|
||||
/// @param Choices An array of choices that appear on screen.
|
||||
/// @param TranslatedChoices The corresponding values (as a string array)
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const wxArrayString & Choices,
|
||||
const wxArrayString & TranslatedChoices)
|
||||
{
|
||||
wxChoice * pChoice=(wxChoice*)NULL;
|
||||
|
||||
|
||||
int TempIndex=0;
|
||||
// int TempIndex = TranslateToIndex( Default, TranslatedChoices );
|
||||
wxString TempStr = Default;
|
||||
|
@ -1795,7 +1795,7 @@ wxChoice * ShuttleGuiBase::TieChoice(
|
|||
return pChoice;
|
||||
}
|
||||
|
||||
/// Variant of the standard TieChoice which does the two step exchange
|
||||
/// Variant of the standard TieChoice which does the two step exchange
|
||||
/// between gui and stack variable and stack variable and shuttle.
|
||||
/// Difference to previous one is that the Translated choices and default
|
||||
/// are integers, not Strings.
|
||||
|
@ -1804,15 +1804,15 @@ wxChoice * ShuttleGuiBase::TieChoice(
|
|||
/// @param Default The default value for this control (translated)
|
||||
/// @param Choices An array of choices that appear on screen.
|
||||
/// @param TranslatedChoices The correcponding values (as an integer array)
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
wxChoice * ShuttleGuiBase::TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
const wxArrayString & Choices,
|
||||
const wxArrayInt & TranslatedChoices)
|
||||
{
|
||||
wxChoice * pChoice=(wxChoice*)NULL;
|
||||
|
||||
|
||||
int TempIndex=0;
|
||||
int TranslatedInt = Default;
|
||||
WrappedType WrappedRef( TranslatedInt );
|
||||
|
@ -1850,8 +1850,8 @@ void ShuttleGuiBase::StartRadioButtonGroup( const wxString & SettingName, const
|
|||
|
||||
|
||||
/// This function must be within a StartRadioButtonGroup - EndRadioButtonGroup pair.
|
||||
wxRadioButton * ShuttleGuiBase::TieRadioButton(
|
||||
const wxString &Prompt,
|
||||
wxRadioButton * ShuttleGuiBase::TieRadioButton(
|
||||
const wxString &Prompt,
|
||||
const int iValue)
|
||||
{
|
||||
int iTemp = iValue;
|
||||
|
@ -1860,14 +1860,14 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(
|
|||
}
|
||||
|
||||
/// This function must be within a StartRadioButtonGroup - EndRadioButtonGroup pair.
|
||||
wxRadioButton * ShuttleGuiBase::TieRadioButton(
|
||||
const wxString &Prompt,
|
||||
wxRadioButton * ShuttleGuiBase::TieRadioButton(
|
||||
const wxString &Prompt,
|
||||
const wxString &Value)
|
||||
{
|
||||
// In what follows, WrappedRef is used in read only mode, but we
|
||||
// don't have a 'read-only' version, so we copy to deal with the constness.
|
||||
wxString Temp = Value;
|
||||
WrappedType WrappedRef( Temp );
|
||||
WrappedType WrappedRef( Temp );
|
||||
return TieRadioButton( Prompt, WrappedRef );
|
||||
}
|
||||
|
||||
|
@ -1879,7 +1879,7 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(
|
|||
/// However, the user can force the id manually, for example
|
||||
/// if they need a specific Id for a button, and then let it
|
||||
/// resume normal numbering later.
|
||||
/// UseUpId() sets miId to the next Id, either using the
|
||||
/// UseUpId() sets miId to the next Id, either using the
|
||||
/// user specicfied one, or resuming the sequence.
|
||||
void ShuttleGuiBase::UseUpId()
|
||||
{
|
||||
|
@ -2067,8 +2067,8 @@ AdornedRulerPanel * ShuttleGui::AddAdornedRuler( ViewInfo *pViewInfo )
|
|||
AdornedRulerPanel * pAdornedRuler;
|
||||
miProp=0;
|
||||
mpWind = pAdornedRuler = new AdornedRulerPanel(
|
||||
mpParent,
|
||||
miId,
|
||||
mpParent,
|
||||
miId,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
pViewInfo
|
||||
|
@ -2089,7 +2089,7 @@ RulerPanel * ShuttleGui::AddRulerVertical(float low, float hi, const wxString &
|
|||
RulerPanel * pRulerPanel;
|
||||
miProp=0;
|
||||
mpWind = pRulerPanel = new RulerPanel(
|
||||
mpParent,
|
||||
mpParent,
|
||||
miId,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize
|
||||
|
@ -2101,7 +2101,7 @@ RulerPanel * ShuttleGui::AddRulerVertical(float low, float hi, const wxString &
|
|||
Ruler.SetFormat(Ruler::RealFormat);
|
||||
Ruler.SetUnits(Units);
|
||||
Ruler.SetLabelEdges(true);
|
||||
|
||||
|
||||
mpWind->SetMinSize(wxSize(38,50));
|
||||
UpdateSizers();
|
||||
return pRulerPanel;
|
||||
|
@ -2220,7 +2220,7 @@ void ShuttleGui::AddStandardButtons(long buttons, wxButton *extra)
|
|||
return;
|
||||
|
||||
StartVerticalLay( false );
|
||||
|
||||
|
||||
miSizerProp = false;
|
||||
mpSubSizer = CreateStdButtonSizer( mpParent, buttons, extra );
|
||||
UpdateSizers();
|
||||
|
@ -2245,7 +2245,7 @@ void ShuttleGui::SetSizeHints( wxWindow *window, const wxArrayString & items )
|
|||
{
|
||||
int x;
|
||||
int y;
|
||||
|
||||
|
||||
window->GetTextExtent(items[i], &x, &y );
|
||||
if( x > maxw )
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <wx/grid.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
#include "WrappedType.h"
|
||||
#include "WrappedType.h"
|
||||
|
||||
const int nMaxNestedSizers = 20;
|
||||
|
||||
|
@ -173,7 +173,7 @@ public:
|
|||
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, int &Selected, const wxArrayString * pChoices );
|
||||
|
||||
|
||||
wxSlider * TieSlider( const wxString &Prompt, WrappedType & WrappedRef, const int max, const int min = 0 );
|
||||
wxSlider * TieSlider( const wxString &Prompt, int &pos, const int max, const int min = 0);
|
||||
wxSlider * TieSlider( const wxString &Prompt, float &pos, const float fMin, const float fMax);
|
||||
|
@ -191,55 +191,55 @@ public:
|
|||
// Note that unlike the other Tie functions, ALL the arguments are const.
|
||||
// That's because the data is being exchanged between the dialog and mpShuttle
|
||||
// so it doesn't need an argument that is writeable.
|
||||
wxCheckBox * TieCheckBox(
|
||||
wxCheckBox * TieCheckBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault);
|
||||
wxCheckBox * TieCheckBoxOnRight(
|
||||
wxCheckBox * TieCheckBoxOnRight(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault);
|
||||
wxChoice * TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
wxChoice * TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const wxArrayString &Choices,
|
||||
const wxArrayString & TranslatedChoices );
|
||||
wxChoice * TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
wxChoice * TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
const wxArrayString & Choices,
|
||||
const wxArrayInt & TranslatedChoices);
|
||||
wxTextCtrl * TieTextBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const int nChars);
|
||||
wxTextCtrl * TieTextBox(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const double & Default,
|
||||
const int nChars);
|
||||
wxTextCtrl * TieNumericTextBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const int nChars);
|
||||
wxTextCtrl * TieNumericTextBox(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const double & Default,
|
||||
const int nChars);
|
||||
wxSlider * TieSlider(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const int iDefault,
|
||||
const int max,
|
||||
const int min = 0);
|
||||
wxSpinCtrl * TieSpinCtrl(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Value,
|
||||
const int max,
|
||||
const int min);
|
||||
|
@ -276,7 +276,7 @@ protected:
|
|||
wxSizer * pSizerStack[ nMaxNestedSizers ];
|
||||
wxString mBoxName;
|
||||
|
||||
Shuttle * mpShuttle; /*! Controls source/destination of shuttled data. You can
|
||||
Shuttle * mpShuttle; /*! Controls source/destination of shuttled data. You can
|
||||
leave this NULL if you are shuttling to variables */
|
||||
int miNoMatchSelector; //! Used in choices to determine which item to use on no match.
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
\verbatim
|
||||
Gui -- Data -- Prefs
|
||||
\endverbatim
|
||||
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "Audacity.h"
|
||||
|
@ -40,7 +40,7 @@ bool ShuttlePrefs::TransferBool( const wxString & Name, bool & bValue, const boo
|
|||
{
|
||||
bValue = bDefault;
|
||||
gPrefs->Read( Name, &bValue );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (gPrefs->Write( Name, bValue ) && gPrefs->Flush());
|
||||
|
@ -54,7 +54,7 @@ bool ShuttlePrefs::TransferDouble( const wxString & Name, double & dValue, const
|
|||
{
|
||||
dValue = dDefault;
|
||||
gPrefs->Read( Name, &dValue );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (gPrefs->Write( Name, dValue ) && gPrefs->Flush());
|
||||
|
@ -68,7 +68,7 @@ bool ShuttlePrefs::TransferInt( const wxString & Name, int & iValue, const int &
|
|||
{
|
||||
iValue = iDefault;
|
||||
gPrefs->Read( Name, &iValue );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (gPrefs->Write( Name, iValue ) && gPrefs->Flush());
|
||||
|
@ -82,7 +82,7 @@ bool ShuttlePrefs::TransferString( const wxString & Name, wxString & strValue, c
|
|||
{
|
||||
strValue = strDefault;
|
||||
gPrefs->Read( Name, &strValue );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (gPrefs->Write( Name, strValue ) && gPrefs->Flush());
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
// constructors and destructors
|
||||
ShuttlePrefs(){;};
|
||||
virtual ~ShuttlePrefs() {;};
|
||||
|
||||
|
||||
public:
|
||||
virtual bool TransferBool( const wxString & Name, bool & bValue, const bool & bDefault );
|
||||
// virtual bool TransferFloat( const wxString & Name, float & fValue, const float &fDefault );
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
|
||||
Snap.cpp
|
||||
|
||||
|
||||
Dominic Mazzoni
|
||||
|
||||
**********************************************************************/
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
|
||||
Snap.h
|
||||
|
||||
|
||||
Dominic Mazzoni
|
||||
|
||||
Create one of these objects at the beginning of a click/drag.
|
||||
|
|
|
@ -33,7 +33,7 @@ BEGIN_EVENT_TABLE(SoundActivatedRecord, wxDialog)
|
|||
END_EVENT_TABLE()
|
||||
|
||||
SoundActivatedRecord::SoundActivatedRecord(wxWindow* parent)
|
||||
: wxDialog(parent, -1, _("Sound Activated Record"), wxDefaultPosition,
|
||||
: wxDialog(parent, -1, _("Sound Activated Record"), wxDefaultPosition,
|
||||
wxDefaultSize, wxCAPTION )
|
||||
// wxDefaultSize, wxCAPTION | wxTHICK_FRAME)
|
||||
{
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
********************************************************************//**
|
||||
|
||||
\class SplashDialog
|
||||
\brief The SplashDialog shows help information for Audacity when
|
||||
\brief The SplashDialog shows help information for Audacity when
|
||||
Audacity starts up.
|
||||
|
||||
It was written for the benefit of new users who do not want to
|
||||
It was written for the benefit of new users who do not want to
|
||||
read the manual. The text of the dialog is kept short to increase the
|
||||
chance of it being read. The content is designed to reduce the
|
||||
chance of it being read. The content is designed to reduce the
|
||||
most commonly asked questions about Audacity.
|
||||
|
||||
*//********************************************************************/
|
||||
|
@ -46,7 +46,7 @@ most commonly asked questions about Audacity.
|
|||
|
||||
SplashDialog * SplashDialog::pSelf=NULL;
|
||||
|
||||
enum
|
||||
enum
|
||||
{
|
||||
DontShowID=1000,
|
||||
};
|
||||
|
@ -94,10 +94,10 @@ void SplashDialog::Populate( ShuttleGui & S )
|
|||
RescaledImage.Rescale( int(LOGOWITHNAME_WIDTH * fScale), int(LOGOWITHNAME_HEIGHT *fScale) );
|
||||
wxBitmap RescaledBitmap( RescaledImage );
|
||||
m_pIcon =
|
||||
new wxStaticBitmap(S.GetParent(), -1,
|
||||
//*m_pLogo, //v theTheme.Bitmap(bmpAudacityLogoWithName),
|
||||
new wxStaticBitmap(S.GetParent(), -1,
|
||||
//*m_pLogo, //v theTheme.Bitmap(bmpAudacityLogoWithName),
|
||||
RescaledBitmap,
|
||||
wxDefaultPosition,
|
||||
wxDefaultPosition,
|
||||
wxSize(int(LOGOWITHNAME_WIDTH*fScale), int(LOGOWITHNAME_HEIGHT*fScale)));
|
||||
|
||||
S.Prop(0).AddWindow( m_pIcon );
|
||||
|
@ -129,7 +129,7 @@ SplashDialog::~SplashDialog()
|
|||
|
||||
void SplashDialog::OnDontShow( wxCommandEvent & Evt )
|
||||
{
|
||||
bool bShow = !Evt.IsChecked();
|
||||
bool bShow = !Evt.IsChecked();
|
||||
gPrefs->Write(wxT("/GUI/ShowSplashScreen"), bShow );
|
||||
gPrefs->Flush();
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue