1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 07:39:42 +02:00

Merge remote-tracking branch 'upstream/master' into wx3

This commit is contained in:
Leland Lucius 2015-07-19 18:00:02 -05:00
commit 3fe146f306
127 changed files with 2284 additions and 1702 deletions

View File

@ -31,7 +31,7 @@ PROJECT_NAME = Audacity
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 2.1.1
PROJECT_NUMBER = 2.1.2
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

View File

@ -16,7 +16,7 @@
#include <wx/statbmp.h>
#include <wx/bitmap.h>
#include "ShuttleGui.h"
class ShuttleGui;
struct AboutDialogCreditItem {
wxString description;

View File

@ -27,12 +27,12 @@
// 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 0
#define IS_ALPHA 1
// Increment as appropriate every time we release a new version.
#define AUDACITY_VERSION 2
#define AUDACITY_RELEASE 1
#define AUDACITY_REVISION 1
#define AUDACITY_REVISION 2
#define AUDACITY_MODLEVEL 0
#if IS_ALPHA

View File

@ -19,6 +19,7 @@ recover previous Audacity projects that were closed incorrectly.
#include "AudacityApp.h"
#include "FileNames.h"
#include "blockfile/SimpleBlockFile.h"
#include "ShuttleGui.h"
#include <wx/wxprec.h>
#include <wx/filefn.h>

View File

@ -15,6 +15,7 @@
*//*******************************************************************/
#include "Audacity.h"
#include "BatchProcessDialog.h"
#include <wx/defs.h>
#include <wx/checkbox.h>
@ -32,9 +33,9 @@
#include <wx/msgdlg.h>
#include <wx/settings.h>
#include "ShuttleGui.h"
#include "Prefs.h"
#include "Project.h"
#include "BatchProcessDialog.h"
#include "Internat.h"
#include "commands/CommandManager.h"
#include "effects/Effect.h"

View File

@ -25,7 +25,6 @@
#include <wx/menuitem.h>
#include <wx/checklst.h>
#include "ShuttleGui.h"
#include "BatchCommands.h"
class wxWindow;
@ -37,6 +36,7 @@ class wxRadioButton;
class wxListCtrl;
class wxListEvent;
class wxButton;
class ShuttleGui;
class BatchProcessDialog:public wxDialog {
public:

View File

@ -16,6 +16,7 @@ of the BlockFile system.
#include "Audacity.h"
#include "Benchmark.h"
#include <wx/log.h>
#include <wx/textctrl.h>
@ -33,7 +34,7 @@ of the BlockFile system.
#include <wx/valtext.h>
#include <wx/intl.h>
#include "Benchmark.h"
#include "ShuttleGui.h"
#include "Project.h"
#include "WaveTrack.h"
#include "Sequence.h"

View File

@ -27,6 +27,7 @@ a draggable point type.
*//*******************************************************************/
#include "Envelope.h"
#include "ViewInfo.h"
#include <math.h>
@ -65,6 +66,8 @@ Envelope::Envelope()
mMaxValue = 2.0;
mButton = wxMOUSE_BTN_NONE;
mSearchGuess = -1;
}
Envelope::~Envelope()
@ -199,13 +202,9 @@ static void DrawPoint(wxDC & dc, const wxRect & r, int x, int y, bool top)
}
/// TODO: This should probably move to track artist.
void Envelope::DrawPoints(wxDC & dc, const wxRect & r, double h, double pps, bool dB,
void Envelope::DrawPoints(wxDC & dc, const wxRect & r, const ZoomInfo &zoomInfo, bool dB,
float zoomMin, float zoomMax)
{
h -= mOffset;
wxASSERT( pps > 0 );
double tright = h + (r.width / pps);
// TODO: Cache the gPrefs value. Reading it every time is inefficient.
double dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
@ -213,7 +212,9 @@ void Envelope::DrawPoints(wxDC & dc, const wxRect & r, double h, double pps, boo
dc.SetBrush(*wxWHITE_BRUSH);
for (int i = 0; i < (int)mEnv.Count(); i++) {
if (mEnv[i]->GetT() >= h && mEnv[i]->GetT() <= tright) {
const double time = mEnv[i]->GetT() + mOffset;
const wxInt64 position = zoomInfo.TimeToPosition(time);
if (position >= 0 && position < r.width) {
// Change colour if this is the draggable point...
if (i == mDragPoint) {
dc.SetPen(AColor::envelopePen);
@ -221,7 +222,7 @@ void Envelope::DrawPoints(wxDC & dc, const wxRect & r, double h, double pps, boo
}
double v = mEnv[i]->GetVal();
int x = int ((mEnv[i]->GetT() - h) * pps);
int x = int(position);
int y, y2;
y = GetWaveYPos(v, zoomMin, zoomMax, r.height, dB,
@ -317,9 +318,10 @@ void Envelope::WriteXML(XMLWriter &xmlFile)
xmlFile.EndTag(wxT("envelope"));
}
#ifndef SQR
#define SQR(X) ((X)*(X))
#endif
namespace
{
inline int SQR(int x) { return x * x; }
}
/// ValueOfPixel() converts a y position on screen to an envelope value.
/// @param y - y position, usually of the mouse.relative to the clip.
@ -353,7 +355,7 @@ float Envelope::ValueOfPixel( int y, int height, bool upper, bool dB,
/// We have an upper and lower envelope line.
/// Also we may be showing an inner envelope (at 0.5 the range).
bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
double h, double pps, bool dB,
const ZoomInfo &zoomInfo, bool dB,
float zoomMin, float zoomMax)
{
int ctr = (int)(r.height * zoomMax / (zoomMax - zoomMin));
@ -363,10 +365,8 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
if(clip_y < 0) clip_y = 0; //keeps point in rect r, even if mouse isn't
if(clip_y > r.GetBottom()) clip_y = r.GetBottom();
double tleft = h - mOffset;
double tright = tleft + (r.width / pps);
int bestNum = -1;
int bestDist = 10; // Must be within 10 pixel radius.
int bestDistSqr = 100; // Must be within 10 pixel radius.
// TODO: Cache the gPrefs value. Reading it every time is inefficient.
double dBr = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
@ -382,22 +382,25 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
// TODO: extract this into a function FindNearestControlPoint()
// 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) {
const double time = mEnv[i]->GetT() + mOffset;
const wxInt64 position = zoomInfo.TimeToPosition(time);
if (position >= 0 && position < r.width) {
int x = int ((mEnv[i]->GetT() + mOffset - h) * pps) + r.x;
int x = int (position);
int y[4];
int numControlPoints;
// Outer control points
y[0] = GetWaveYPos( mEnv[i]->GetVal(), zoomMin, zoomMax, r.height,
double value = mEnv[i]->GetVal();
y[0] = GetWaveYPos(value, zoomMin, zoomMax, r.height,
dB, true, dBr, false);
y[1] = GetWaveYPos( -mEnv[i]->GetVal(), zoomMin, zoomMax, r.height,
y[1] = GetWaveYPos(-value, zoomMin, zoomMax, r.height,
dB, true, dBr, false);
// Inner control points(contour)
y[2] = GetWaveYPos( mEnv[i]->GetVal(), zoomMin, zoomMax, r.height,
y[2] = GetWaveYPos(value, zoomMin, zoomMax, r.height,
dB, false, dBr, false);
y[3] = GetWaveYPos( -mEnv[i]->GetVal()-.00000001, zoomMin, zoomMax,
y[3] = GetWaveYPos(-value -.00000001, zoomMin, zoomMax,
r.height, dB, false, dBr, false);
numControlPoints = 4;
@ -408,12 +411,13 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
if (!mMirror)
numControlPoints = 1;
const int deltaXSquared = SQR(x - (event.m_x - r.x));
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) {
const int dSqr = deltaXSquared + SQR(y[j] - (event.m_y - r.y));
if (dSqr < bestDistSqr) {
bestNum = i;
bestDist = d;
bestDistSqr = dSqr;
mContourOffset = (bool)(j > 1);
}
}
@ -425,12 +429,12 @@ 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;
const double when = zoomInfo.PositionToTime(event.m_x, r.x);
// if (when <= 0 || when >= mTrackLen)
// return false;
double v = GetValueAtX( event.m_x, r, h, pps );
const double v = GetValue( when );
int ct = GetWaveYPos( v, zoomMin, zoomMax, r.height, dB,
false, dBr, false) ;
@ -456,16 +460,14 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r,
double newVal = ValueOfPixel(clip_y, r.height, upper, dB,
zoomMin, zoomMax);
mDragPoint = Insert(when, newVal);
mDragPoint = Insert(when - mOffset, newVal);
mDirty = true;
}
mUpper = upper;
mInitialWhen = mEnv[mDragPoint]->GetT();
mInitialVal = mEnv[mDragPoint]->GetVal();
mInitialX = event.m_x;
mInitialY = event.m_y+mContourOffset;
return true;
@ -500,8 +502,8 @@ void Envelope::MarkDragPointForDeletion()
}
void Envelope::MoveDraggedPoint( wxMouseEvent & event, wxRect & r,
double WXUNUSED(h), double pps, bool dB,
float zoomMin, float zoomMax)
const ZoomInfo &zoomInfo, bool dB,
float zoomMin, float zoomMax)
{
int clip_y = event.m_y - r.y;
if(clip_y < 0) clip_y = 0;
@ -509,13 +511,12 @@ void Envelope::MoveDraggedPoint( wxMouseEvent & event, wxRect & r,
double newVal = ValueOfPixel(clip_y, r.height, mUpper, dB,
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
// a duplicated point on a mouse up.
double newWhen = mInitialWhen + (event.m_x - mInitialX) / pps;
double newWhen = zoomInfo.PositionToTime(event.m_x, r.x) - mOffset;
// We'll limit the drag point time to be between those of the preceding
// and next envelope point.
@ -536,7 +537,7 @@ void Envelope::MoveDraggedPoint( wxMouseEvent & event, wxRect & r,
}
bool Envelope::HandleDragging( wxMouseEvent & event, wxRect & r,
double h, double pps, bool dB,
const ZoomInfo &zoomInfo, bool dB,
float zoomMin, float zoomMax,
float WXUNUSED(eMin), float WXUNUSED(eMax))
{
@ -550,7 +551,7 @@ bool Envelope::HandleDragging( wxMouseEvent & event, wxRect & r,
// IF we're in the rect THEN we're not deleting this point (anymore).
mIsDeleting = false;
// ...we're dragging it.
MoveDraggedPoint( event, r,h,pps,dB, zoomMin, zoomMax);
MoveDraggedPoint( event, r, zoomInfo, dB, zoomMin, zoomMax);
return true;
}
@ -563,11 +564,7 @@ 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(pps), bool WXUNUSED(dB),
float WXUNUSED(zoomMin),
float WXUNUSED(zoomMax) )
bool Envelope::HandleMouseButtonUp()
{
if (mIsDeleting) {
delete mEnv[mDragPoint];
@ -586,18 +583,17 @@ void Envelope::Delete( int point )
// Returns true if parent needs to be redrawn
bool Envelope::MouseEvent(wxMouseEvent & event, wxRect & r,
double h, double pps, bool dB,
const ZoomInfo &zoomInfo, bool dB,
float zoomMin, float zoomMax)
{
if (event.ButtonDown() && mButton == wxMOUSE_BTN_NONE)
return HandleMouseButtonDown( event, r, h, pps,dB,
return HandleMouseButtonDown( event, r, zoomInfo,dB,
zoomMin, zoomMax);
if (event.Dragging() && mDragPoint >= 0)
return HandleDragging( event, r, h, pps,dB,
return HandleDragging( event, r, zoomInfo,dB,
zoomMin, zoomMax);
if (event.ButtonUp() && event.GetButton() == mButton)
return HandleMouseButtonUp( event, r, h, pps, dB,
zoomMin, zoomMax);
return HandleMouseButtonUp();
return false;
}
@ -1023,28 +1019,45 @@ void Envelope::SetTrackLen(double trackLen)
// Accessors
double Envelope::GetValue(double t) const
{
// t is absolute time
double temp;
GetValues(&temp, 1, t, 1.0);
return temp;
}
// 'X' is in pixels and relative to track.
double Envelope::GetValueAtX(int x, const wxRect & r, double h, double pps)
{
// Convert x to time.
double t = (x - r.x) / pps + h ;//-mOffset;
return GetValue(t);
}
/// @param Lo returns index before this time.
/// @param Hi returns index after this time.
/// @param Lo returns last index at or before this time.
/// @param Hi returns first index after this time.
void Envelope::BinarySearchForTime( int &Lo, int &Hi, double t ) const
{
Lo = 0;
Hi = mEnv.Count() - 1;
// JC: Do we have a problem if the envelope only has one point??
wxASSERT( Hi > Lo );
wxASSERT(Hi > Lo);
// Optimizations for the usual pattern of repeated calls with
// small increases of t.
{
if (mSearchGuess >= 0 && mSearchGuess < int(mEnv.Count()) - 1) {
if (t >= mEnv[mSearchGuess]->GetT() &&
t < mEnv[1 + mSearchGuess]->GetT()) {
Lo = mSearchGuess;
Hi = 1 + mSearchGuess;
return;
}
}
++mSearchGuess;
if (mSearchGuess >= 0 && mSearchGuess < int(mEnv.Count()) - 1) {
if (t >= mEnv[mSearchGuess]->GetT() &&
t < mEnv[1 + mSearchGuess]->GetT()) {
Lo = mSearchGuess;
Hi = 1 + mSearchGuess;
return;
}
}
}
while (Hi > (Lo + 1)) {
int mid = (Lo + Hi) / 2;
if (t < mEnv[mid]->GetT())
@ -1053,6 +1066,8 @@ void Envelope::BinarySearchForTime( int &Lo, int &Hi, double t ) const
Lo = mid;
}
wxASSERT( Hi == ( Lo+1 ));
mSearchGuess = Lo;
}
/// GetInterpolationStartValueAtPoint() is used to select either the
@ -1072,6 +1087,7 @@ double Envelope::GetInterpolationStartValueAtPoint( int iPoint ) const
void Envelope::GetValues(double *buffer, int bufferLen,
double t0, double tstep) const
{
// Convert t0 from absolute to clip-relative time
t0 -= mOffset;
// JC: If bufferLen ==0 we have probably just allocated a zero sized buffer.
@ -1154,6 +1170,13 @@ void Envelope::GetValues(double *buffer, int bufferLen,
}
}
void Envelope::GetValues
(double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo) const
{
for (int xx = 0; xx < bufferLen; ++xx)
buffer[xx] = GetValue(zoomInfo.PositionToTime(xx, -leftOffset));
}
int Envelope::NumberOfPointsAfter(double t)
{
if( t >= mEnv[mEnv.Count()-1]->GetT() )

View File

@ -29,6 +29,8 @@ class wxTextFile;
class DirManager;
class Envelope;
class ZoomInfo;
#define ENV_DB_RANGE 60
class EnvPoint : public XMLTagHandler {
@ -116,23 +118,21 @@ class Envelope : public XMLTagHandler {
virtual XMLTagHandler *HandleXMLChild(const wxChar *tag);
virtual void WriteXML(XMLWriter &xmlFile);
void DrawPoints(wxDC & dc, const wxRect & r, double h, double pps, bool dB,
void DrawPoints(wxDC & dc, const wxRect & r, const ZoomInfo &zoomInfo, bool dB,
float zoomMin=-1.0, float zoomMax=1.0);
// Event Handlers
// Each ofthese returns true if parents needs to be redrawn
bool MouseEvent(wxMouseEvent & event, wxRect & r,
double h, double pps, bool dB,
const ZoomInfo &zoomInfo, bool dB,
float zoomMin=-1.0, float zoomMax=1.0);
bool HandleMouseButtonDown( wxMouseEvent & event, wxRect & r,
double h, double pps, bool dB,
const ZoomInfo &zoomInfo, bool dB,
float zoomMin=-1.0, float zoomMax=1.0);
bool HandleDragging( wxMouseEvent & event, wxRect & r,
double h, double pps, bool dB,
const ZoomInfo &zoomInfo, bool dB,
float zoomMin=-1.0, float zoomMax=1.0, float eMin=0., float eMax=2.);
bool HandleMouseButtonUp( wxMouseEvent & event, wxRect & r,
double h, double pps, bool dB,
float zoomMin=-1.0, float zoomMax=1.0);
bool HandleMouseButtonUp();
void GetEventParams( int &height, bool &upper, bool dB,
wxMouseEvent & event, wxRect & r,
float &zoomMin, float &zoomMax);
@ -151,8 +151,6 @@ class Envelope : public XMLTagHandler {
// Accessors
/** \brief Get envelope value at time t */
double GetValue(double t) const;
/** \brief Get envelope value at pixel X */
double GetValueAtX(int x, const wxRect & r, double h, double pps);
/** \brief Get many envelope points at once.
*
@ -160,6 +158,11 @@ class Envelope : public XMLTagHandler {
* more than one value in a row. */
void GetValues(double *buffer, int len, double t0, double tstep) const;
/** \brief Get many envelope points at once, but don't assume uniform time step.
*/
void GetValues
(double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo) const;
int NumberOfPointsAfter(double t);
double NextPointAfter(double t);
@ -202,7 +205,7 @@ private:
void BinarySearchForTime( int &Lo, int &Hi, double t ) const;
double GetInterpolationStartValueAtPoint( int iPoint ) const;
void MoveDraggedPoint( wxMouseEvent & event, wxRect & r,
double h, double pps, bool dB,
const ZoomInfo &zoomInfo, bool dB,
float zoomMin, float zoomMax);
// Possibly inline functions:
@ -228,12 +231,10 @@ private:
/** \brief Number of pixels contour is from the true envelope. */
int mContourOffset;
double mInitialWhen;
double mInitialVal;
// These are used in dragging.
int mDragPoint;
int mInitialX;
int mInitialY;
bool mUpper;
bool mIsDeleting;
@ -248,6 +249,8 @@ private:
double lastIntegral_t1;
double lastIntegral_result;
mutable int mSearchGuess;
};
inline double EnvPoint::ClampValue(double val)

View File

@ -86,10 +86,6 @@
// to activate it instead of the Spectrum log(f) mode.
//#define EXPERIMENTAL_FIND_NOTES
// AM, 22.Nov 2007
// Skip Points support in the spectrum view mode.
//#define EXPERIMENTAL_FFT_SKIP_POINTS
// AM, 22.Nov 2007:
// A Frequency Grid for the Spectrum Log(f) & Find Notes modes
//#define EXPERIMENTAL_FFT_Y_GRID

View File

@ -41,6 +41,7 @@ and in the spectrogram spectral selection.
#include "Audacity.h"
#include "FreqWindow.h"
#include <wx/brush.h>
#include <wx/button.h>
@ -61,8 +62,7 @@ and in the spectrogram spectral selection.
#include <math.h>
#include "FreqWindow.h"
#include "ShuttleGui.h"
#include "AColor.h"
#include "FFT.h"
#include "Internat.h"

View File

@ -14,6 +14,7 @@
*//*******************************************************************/
#include "Audacity.h"
#include "LabelDialog.h"
#include <wx/button.h>
#include <wx/defs.h>
@ -29,8 +30,8 @@
#include <wx/stattext.h>
#include <wx/textdlg.h>
#include "ShuttleGui.h"
#include "Internat.h"
#include "LabelDialog.h"
#include "LabelTrack.h"
#include "Prefs.h"
#include "Project.h"

View File

@ -25,7 +25,7 @@ class TrackList;
class RowData;
class EmptyLabelRenderer;
class LabelTrack;
struct ViewInfo;
class ViewInfo;
WX_DEFINE_ARRAY(RowData *, RowDataArray);

View File

@ -443,7 +443,7 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index)
/// ComputeLayout determines which row each label
/// should be placed on, and reserves space for it.
/// Function assumes that the labels are sorted.
void LabelTrack::ComputeLayout(const wxRect & r, double h, double pps)
void LabelTrack::ComputeLayout(const wxRect & r, const ZoomInfo &zoomInfo)
{
int i;
int iRow;
@ -460,15 +460,17 @@ void LabelTrack::ComputeLayout(const wxRect & r, double h, double pps)
const int nRows = wxMin((r.height / yRowHeight) + 1, MAX_NUM_ROWS);
// Initially none of the rows have been used.
// So set a value that is less than any valid value.
const int xStart = r.x -(int)(h*pps) -100;
for(i=0;i<MAX_NUM_ROWS;i++)
xUsed[i]=xStart;
{
const int xStart = zoomInfo.TimeToPosition(0.0, r.x) - 100;
for(i=0;i<MAX_NUM_ROWS;i++)
xUsed[i]=xStart;
}
int nRowsUsed=0;
for (i = 0; i < (int)mLabels.Count(); i++)
{
int x = r.x + (int) ((mLabels[i]->getT0() - h) * pps);
int x1 = r.x + (int) ((mLabels[i]->getT1() - h) * pps);
const int x = zoomInfo.TimeToPosition(mLabels[i]->getT0(), r.x);
const int x1 = zoomInfo.TimeToPosition(mLabels[i]->getT1(), r.x);
int y = r.y;
mLabels[i]->x=x;
@ -726,8 +728,9 @@ bool LabelTrack::CalcCursorX(wxWindow * parent, int * x)
/// Draw calls other functions to draw the LabelTrack.
/// @param dc the device context
/// @param r the LabelTrack rectangle.
void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
double sel0, double sel1)
void LabelTrack::Draw(wxDC & dc, const wxRect & r,
const SelectedRegion &selectedRegion,
const ZoomInfo &zoomInfo)
{
if(msFont.Ok())
dc.SetFont(msFont);
@ -737,7 +740,7 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
TrackArtist::DrawBackgroundWithSelection(&dc, r, this,
AColor::labelSelectedBrush, AColor::labelUnselectedBrush,
sel0, sel1, h, pps);
selectedRegion, zoomInfo);
int i;
@ -760,7 +763,7 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
// happens with a new label track.
dc.GetTextExtent(wxT("Demo Text x^y"), &textWidth, &textHeight);
mTextHeight = (int)textHeight;
ComputeLayout( r, h , pps );
ComputeLayout( r, zoomInfo );
dc.SetTextForeground(theTheme.Colour( clrLabelTrackText));
dc.SetBackgroundMode(wxTRANSPARENT);
dc.SetBrush(AColor::labelTextNormalBrush);
@ -1364,7 +1367,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,
wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel)
{
if(evt.LeftUp())
@ -1436,7 +1439,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
bool bLabelMoving = mbIsMoving;
bLabelMoving ^= evt.ShiftDown();
bLabelMoving |= mMouseOverLabelLeft==mMouseOverLabelRight;
double fNewX = h + x / pps;
double fNewX = zoomInfo.PositionToTime(x, 0);
if( bLabelMoving )
{
MayMoveLabel( mMouseOverLabelLeft, -1, fNewX );
@ -1534,7 +1537,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
{
t = mLabels[mMouseOverLabelLeft]->getT0();
}
mxMouseDisplacement = (int)((((t-h) * pps) + r.x )-evt.m_x);
mxMouseDisplacement = zoomInfo.TimeToPosition(t, r.x) - evt.m_x;
return false;
}
@ -1566,7 +1569,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
if (mSelIndex != -1) {
if (!OverTextBox(mLabels[mSelIndex], evt.m_x, evt.m_y))
mSelIndex = -1;
double t = h + (evt.m_x - r.x) / pps;
double t = zoomInfo.PositionToTime(evt.m_x, r.x);
*newSel = SelectedRegion(t, t);
}

View File

@ -36,6 +36,7 @@ class TrackList;
class AudacityProject;
class DirManager;
class TimeWarper;
class ZoomInfo;
class LabelStruct
@ -125,8 +126,9 @@ class AUDACITY_DLL_API LabelTrack : public Track
static void ResetFont();
void Draw(wxDC & dc, const wxRect & r, double h, double pps,
double sel0, double sel1);
void Draw(wxDC & dc, const wxRect & r,
const SelectedRegion &selectedRegion,
const ZoomInfo &zoomInfo);
int getSelectedIndex() const { return mSelIndex; }
@ -177,7 +179,7 @@ class AUDACITY_DLL_API LabelTrack : public Track
void SetWrongDragging(bool rightFlag) { mRightDragging = rightFlag; }
void SetDrawCursor(bool drawCursorFlag) { mDrawCursor = drawCursorFlag; }
bool HandleMouse(const wxMouseEvent & evt, wxRect & r, double h, double pps,
bool HandleMouse(const wxMouseEvent & evt, wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel);
bool CaptureKey(wxKeyEvent & event);
@ -260,7 +262,7 @@ class AUDACITY_DLL_API LabelTrack : public Track
// Set in copied label tracks
double mClipLen;
void ComputeLayout(const wxRect & r, double h, double pps);
void ComputeLayout(const wxRect & r, const ZoomInfo &zoomInfo);
void ComputeTextPosition(const wxRect & r, int index);
void SetCurrentCursorPosition(wxDC & dc, int xPos);

View File

@ -1125,6 +1125,9 @@ void AudacityProject::CreateMenusAndCommands()
c->AddCommand(wxT("Stop"), _("Stop"), FN(OnStop),
AudioIOBusyFlag,
AudioIOBusyFlag);
c->SetDefaultFlags(CaptureNotBusyFlag, CaptureNotBusyFlag);
c->AddCommand(wxT("PlayOneSec"), _("Play One Second"), FN(OnPlayOneSecond), wxT("1"),
CaptureNotBusyFlag,
CaptureNotBusyFlag);
@ -1141,6 +1144,9 @@ void AudacityProject::CreateMenusAndCommands()
CaptureNotBusyFlag,
CaptureNotBusyFlag);
c->SetDefaultFlags(AlwaysEnabledFlag, AlwaysEnabledFlag);
c->AddCommand(wxT("SelStart"), _("Selection to Start"), FN(OnSelToStart), wxT("Shift+Home"));
c->AddCommand(wxT("SelEnd"), _("Selection to End"), FN(OnSelToEnd), wxT("Shift+End"));
@ -1769,10 +1775,10 @@ wxUint32 AudacityProject::GetUpdateFlags()
if (mUndoManager.RedoAvailable())
flags |= RedoAvailableFlag;
if (GetZoom() < gMaxZoom && (flags & TracksExistFlag))
if (ZoomInAvailable() && (flags & TracksExistFlag))
flags |= ZoomInAvailableFlag;
if (GetZoom() > gMinZoom && (flags & TracksExistFlag))
if (ZoomOutAvailable() && (flags & TracksExistFlag))
flags |= ZoomOutAvailableFlag;
if ((flags & LabelTracksExistFlag) && LabelTrack::IsTextClipSupported())
@ -4881,7 +4887,7 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
{
// LLL: Handling positioning differently when audio is active
if (gAudioIO->IsStreamActive(GetAudioIOToken()) != 0) {
Zoom(mViewInfo.zoom * ZoomFactor);
ZoomBy(ZoomFactor);
mTrackPanel->ScrollIntoView(gAudioIO->GetStreamTime());
mTrackPanel->Refresh(false);
return;
@ -4914,7 +4920,7 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
(mViewInfo.h + mViewInfo.screen - mViewInfo.selectedRegion.t0()) / 2;
// Zoom in
Zoom(mViewInfo.zoom *= ZoomFactor);
ZoomBy(ZoomFactor);
// Recenter on selCenter
TP_ScrollWindow(selCenter - mViewInfo.screen / 2);
@ -4924,7 +4930,7 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
double origLeft = mViewInfo.h;
double origWidth = mViewInfo.screen;
Zoom(mViewInfo.zoom *= ZoomFactor);
ZoomBy(ZoomFactor);
double newh = origLeft + (origWidth - mViewInfo.screen) / 2;
@ -4956,7 +4962,7 @@ void AudacityProject::ZoomOutByFactor( double ZoomFactor )
double origLeft = mViewInfo.h;
double origWidth = mViewInfo.screen;
Zoom(mViewInfo.zoom *=ZoomFactor);
ZoomBy(ZoomFactor);
double newh = origLeft + (origWidth - mViewInfo.screen) / 2;
// newh = (newh > 0) ? newh : 0;
@ -4964,6 +4970,8 @@ void AudacityProject::ZoomOutByFactor( double ZoomFactor )
}
// this is unused:
#if 0
static double OldZooms[2]={ 44100.0/512.0, 4410.0/512.0 };
void AudacityProject::OnZoomToggle()
{
@ -4983,11 +4991,12 @@ void AudacityProject::OnZoomToggle()
double newh = origLeft + (origWidth - mViewInfo.screen) / 2;
TP_ScrollWindow(newh);
}
#endif
void AudacityProject::OnZoomNormal()
{
Zoom(44100.0 / 512.0);
Zoom(ZoomInfo::GetDefaultZoom());
mTrackPanel->Refresh(false);
}
@ -5073,7 +5082,7 @@ void AudacityProject::OnZoomSel()
// where the selected region may be scrolled off the left of the screen.
// I know this isn't right, but until the real rounding or 1-off issue is
// found, this will have to work.
Zoom(((mViewInfo.zoom * mViewInfo.screen) - 1) / denom);
Zoom((mViewInfo.GetScreenWidth() - 1) / denom);
TP_ScrollWindow(mViewInfo.selectedRegion.t0());
}

View File

@ -259,7 +259,7 @@ void OnSelectAllTracks();
void OnZoomIn();
void OnZoomOut();
void OnZoomToggle();
// void OnZoomToggle();
void OnZoomNormal();
void OnZoomFit();
void OnZoomFitV();

View File

@ -15,6 +15,7 @@
#include "Audacity.h"
#include "Printing.h"
#include <wx/defs.h>
#include <wx/dc.h>
@ -29,7 +30,6 @@
#include "ViewInfo.h"
#include "WaveTrack.h"
#include "widgets/Ruler.h"
#include "Printing.h"
// Globals, so that we remember settings from session to session
static wxPrintData *gPrintData = NULL;
@ -80,13 +80,8 @@ bool AudacityPrintout::OnPrintPage(int WXUNUSED(page))
TrackArtist artist;
artist.SetBackgroundBrushes(*wxWHITE_BRUSH, *wxWHITE_BRUSH,
*wxWHITE_PEN, *wxWHITE_PEN);
ViewInfo viewInfo;
viewInfo.selectedRegion = SelectedRegion();
viewInfo.vpos = 0;
viewInfo.h = 0.0;
viewInfo.screen = mTracks->GetEndTime() - viewInfo.h;
viewInfo.total = viewInfo.screen;
viewInfo.zoom = width / viewInfo.screen;
const double screenDuration = mTracks->GetEndTime();
ZoomInfo zoomInfo(0.0, screenDuration, width / screenDuration);
int y = rulerPageHeight;
TrackListIterator iter(mTracks);
@ -98,7 +93,7 @@ bool AudacityPrintout::OnPrintPage(int WXUNUSED(page))
r.width = width;
r.height = (int)(n->GetHeight() * scale);
artist.DrawTrack(n, *dc, r, &viewInfo, false, false, false, false);
artist.DrawTrack(n, *dc, r, SelectedRegion(), zoomInfo, false, false, false, false);
dc->SetPen(*wxBLACK_PEN);
AColor::Line(*dc, 0, r.y, width, r.y);

View File

@ -772,6 +772,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mImportXMLTagHandler(NULL),
mAutoSaving(false),
mIsRecovered(false),
mIsCapturing(false),
mRecordingRecoveryHandler(NULL),
mImportedDependencies(false),
mWantSaveCompressed(false),
@ -779,6 +780,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mTimerRecordCanceled(false),
mMenuClose(false)
, mbInitializingScrollbar(false)
, mViewInfo(0.0, 1.0, ZoomInfo::GetDefaultZoom())
{
// Note that the first field of the status bar is a dummy, and it's width is set
// to zero latter in the code. This field is needed for wxWidgets 2.8.12 because
@ -809,26 +811,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
// Initialize view info (shared with TrackPanel)
//
// Selection
mViewInfo.selectedRegion = SelectedRegion();
// Horizontal scrollbar
mViewInfo.total = 1.0;
mViewInfo.screen = 1.0;
mViewInfo.h = 0.0;
mViewInfo.zoom = 44100.0 / 512.0;
// Vertical scrollbar
mViewInfo.track = NULL;
mViewInfo.vpos = 0;
mViewInfo.scrollStep = 16;
mViewInfo.sbarH = 0;
mViewInfo.sbarScreen = 1;
mViewInfo.sbarTotal = 1;
mViewInfo.sbarScale = 1.0;
UpdatePrefs();
mLockPlayRegion = false;
@ -1469,19 +1451,22 @@ double AudacityProject::ScrollingLowerBoundTime() const
: 0;
}
wxInt64 AudacityProject::PixelWidthBeforeTime(double scrollto) const
{
const double lowerBound = ScrollingLowerBoundTime();
return
mViewInfo.TimeToPosition(scrollto, 0
, true
) -
mViewInfo.TimeToPosition(lowerBound, 0
, true
);
}
void AudacityProject::SetHorizontalThumb(double scrollto)
{
const double timeOffset = -ScrollingLowerBoundTime();
int pos = (int) (
(scrollto + timeOffset) * mViewInfo.zoom * mViewInfo.sbarScale
);
int max = mHsbar->GetRange() - mHsbar->GetThumbSize();
if (pos > max)
pos = max;
else if (pos < 0)
pos = 0;
wxInt64 max = mHsbar->GetRange() - mHsbar->GetThumbSize();
int pos = std::min(max, std::max(wxInt64(0), PixelWidthBeforeTime(scrollto)));
mHsbar->SetThumbPosition(pos);
}
@ -1545,7 +1530,7 @@ void AudacityProject::FixScrollbars()
double LastTime =
std::max(mTracks->GetEndTime(), mViewInfo.selectedRegion.t1());
mViewInfo.screen = ((double) panelWidth) / mViewInfo.zoom;
mViewInfo.SetScreenWidth(panelWidth);
const double halfScreen = mViewInfo.screen / 2.0;
// If we can scroll beyond zero,
@ -1569,9 +1554,9 @@ void AudacityProject::FixScrollbars()
rescroll = true;
}
mViewInfo.sbarTotal = (wxInt64) (mViewInfo.total * mViewInfo.zoom);
mViewInfo.sbarScreen = (wxInt64) (mViewInfo.screen * mViewInfo.zoom);
mViewInfo.sbarH = (wxInt64) (mViewInfo.h * mViewInfo.zoom);
mViewInfo.sbarTotal = (wxInt64) (mViewInfo.GetTotalWidth());
mViewInfo.sbarScreen = (wxInt64) (mViewInfo.GetScreenWidth());
mViewInfo.sbarH = (wxInt64) (mViewInfo.GetBeforeScreenWidth());
int lastv = mViewInfo.vpos;
// PRL: Can someone else find a more elegant solution to bug 812, than
@ -1592,7 +1577,7 @@ void AudacityProject::FixScrollbars()
bool oldhstate;
bool oldvstate;
bool newhstate = mViewInfo.screen < mViewInfo.total;
bool newhstate = !mViewInfo.ZoomedAll();
bool newvstate = panelHeight < totalHeight;
#ifdef __WXGTK__
@ -1603,7 +1588,7 @@ void AudacityProject::FixScrollbars()
#else
oldhstate = mHsbar->IsEnabled();
oldvstate = mVsbar->IsEnabled();
mHsbar->Enable(mViewInfo.screen < mViewInfo.total);
mHsbar->Enable(!mViewInfo.ZoomedAll());
mVsbar->Enable(panelHeight < totalHeight);
#endif
@ -1613,7 +1598,7 @@ void AudacityProject::FixScrollbars()
refresh = true;
rescroll = false;
}
if (mViewInfo.screen >= mViewInfo.total && mViewInfo.sbarH != 0) {
if (mViewInfo.ZoomedAll() && mViewInfo.sbarH != 0) {
mViewInfo.sbarH = 0;
refresh = true;
@ -1641,8 +1626,7 @@ void AudacityProject::FixScrollbars()
int scaledSbarH = (int)(mViewInfo.sbarH * mViewInfo.sbarScale);
int scaledSbarScreen = (int)(mViewInfo.sbarScreen * mViewInfo.sbarScale);
int scaledSbarTotal = (int)(mViewInfo.sbarTotal * mViewInfo.sbarScale);
int offset;
offset = -lowerBound * mViewInfo.zoom * mViewInfo.sbarScale;
const int offset = mViewInfo.sbarScale * PixelWidthBeforeTime(0.0);
mHsbar->SetScrollbar(scaledSbarH + offset, scaledSbarScreen, scaledSbarTotal,
scaledSbarScreen, TRUE);
@ -1656,7 +1640,7 @@ void AudacityProject::FixScrollbars()
panelHeight / mViewInfo.scrollStep, TRUE);
mVsbar->Refresh();
if (refresh || (rescroll && mViewInfo.screen < mViewInfo.total)) {
if (refresh || (rescroll && !mViewInfo.ZoomedAll())) {
mTrackPanel->Refresh(false);
}
@ -1834,25 +1818,18 @@ void AudacityProject::OnScroll(wxScrollEvent & WXUNUSED(event))
const wxInt64 hlast = mViewInfo.sbarH;
const double lowerBound = ScrollingLowerBoundTime();
const wxInt64 offset = 0.5 + -lowerBound * mViewInfo.zoom;
const wxInt64 offset = PixelWidthBeforeTime(0.0);
mViewInfo.sbarH =
(wxInt64)(mHsbar->GetThumbPosition() / mViewInfo.sbarScale) - offset;
if (mViewInfo.sbarH != hlast) {
mViewInfo.h = mViewInfo.sbarH / mViewInfo.zoom;
if (mViewInfo.h > mViewInfo.total - mViewInfo.screen)
mViewInfo.h = mViewInfo.total - mViewInfo.screen;
if (mViewInfo.h < lowerBound)
mViewInfo.h = lowerBound;
}
if (mViewInfo.sbarH != hlast)
mViewInfo.SetBeforeScreenWidth(mViewInfo.sbarH, lowerBound);
if (mScrollBeyondZero) {
enum { SCROLL_PIXEL_TOLERANCE = 10 };
if (fabs(mViewInfo.h * mViewInfo.zoom) < SCROLL_PIXEL_TOLERANCE) {
if (abs(mViewInfo.TimeToPosition(0.0, 0
)) < SCROLL_PIXEL_TOLERANCE) {
// Snap the scrollbar to 0
mViewInfo.h = 0;
SetHorizontalThumb(0.0);
@ -2896,6 +2873,12 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
if (!value || !XMLValueChecker::IsGoodString(value))
break;
if (mViewInfo.ReadXMLAttribute(attr, value)) {
// We need to save vpos now and restore it below
longVpos = std::max(longVpos, long(mViewInfo.vpos));
continue;
}
if (!wxStrcmp(attr, wxT("datadir")))
{
//
@ -2989,20 +2972,6 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
requiredTags++;
}
else if (mViewInfo.selectedRegion
.HandleXMLAttribute(attr, value, wxT("sel0"), wxT("sel1"))) {
}
else if (!wxStrcmp(attr, wxT("vpos")))
// Just assign a variable, put the value in its place later
wxString(value).ToLong(&longVpos);
else if (!wxStrcmp(attr, wxT("h")))
Internat::CompatibleToDouble(value, &mViewInfo.h);
else if (!wxStrcmp(attr, wxT("zoom")))
Internat::CompatibleToDouble(value, &mViewInfo.zoom);
else if (!wxStrcmp(attr, wxT("rate"))) {
Internat::CompatibleToDouble(value, &mRate);
GetSelectionBar()->SetRate(mRate);
@ -3196,12 +3165,8 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile)
xmlFile.WriteAttr(wxT("projname"), projName);
xmlFile.WriteAttr(wxT("version"), wxT(AUDACITY_FILE_FORMAT_VERSION));
xmlFile.WriteAttr(wxT("audacityversion"), AUDACITY_VERSION_STRING);
mViewInfo.selectedRegion
.WriteXMLAttributes(xmlFile, wxT("sel0"), wxT("sel1"));
// PRL: to do: persistence of other fields of the selection
xmlFile.WriteAttr(wxT("vpos"), mViewInfo.vpos);
xmlFile.WriteAttr(wxT("h"), mViewInfo.h, 10);
xmlFile.WriteAttr(wxT("zoom"), mViewInfo.zoom, 10);
mViewInfo.WriteXMLAttributes(xmlFile);
xmlFile.WriteAttr(wxT("rate"), mRate);
xmlFile.WriteAttr(wxT("snapto"), GetSnapTo() ? wxT("on") : wxT("off"));
xmlFile.WriteAttr(wxT("selectionformat"), GetSelectionFormat());
@ -4132,12 +4097,14 @@ void AudacityProject::SelectNone()
// Utility function called by other zoom methods
void AudacityProject::Zoom(double level)
{
if (level > gMaxZoom)
level = gMaxZoom;
if (level <= gMinZoom)
level = gMinZoom;
mViewInfo.SetZoom(level);
FixScrollbars();
}
mViewInfo.zoom = level;
// Utility function called by other zoom methods
void AudacityProject::ZoomBy(double multiplier)
{
mViewInfo.ZoomBy(multiplier);
FixScrollbars();
}

View File

@ -152,9 +152,11 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
sampleFormat GetDefaultFormat() { return mDefaultFormat; }
double GetRate() { return mRate; }
double GetZoom() { return mViewInfo.zoom; }
bool ZoomInAvailable() const { return mViewInfo.ZoomInAvailable(); }
bool ZoomOutAvailable() const { return mViewInfo.ZoomOutAvailable(); }
double GetSel0() { return mViewInfo.selectedRegion.t0(); }
double GetSel1() { return mViewInfo.selectedRegion.t1(); }
const ZoomInfo &GetZoomInfo() const { return mViewInfo; }
Track *GetFirstVisible();
void UpdateFirstVisible();
@ -308,6 +310,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
void SelectNone();
void SelectAllIfNone();
void Zoom(double level);
void ZoomBy(double multiplier);
void Rewind(bool shift);
void SkipEnd(bool shift);
void EditByLabel( WaveTrack::EditFunction action, bool bSyncLockedTracks );
@ -354,6 +357,8 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
void SafeDisplayStatusMessage(const wxChar *msg);
double ScrollingLowerBoundTime() const;
// How many pixels are covered by the period from lowermost scrollable time, to the given time:
wxInt64 PixelWidthBeforeTime(double scrollto) const;
void SetHorizontalThumb(double scrollto);
// TrackPanel access

View File

@ -661,7 +661,7 @@ void ScreenFrame::TimeZoom(double seconds)
{
int width, height;
mContext.GetProject()->GetClientSize(&width, &height);
mContext.GetProject()->mViewInfo.zoom = (0.75 * width) / seconds;
mContext.GetProject()->mViewInfo.SetZoom((0.75 * width) / seconds);
mContext.GetProject()->RedrawProject();
}

View File

@ -325,7 +325,7 @@ class GuiWaveTrack;
class AdornedRulerPanel;
class RulerPanel;
class AttachableScrollBar;
struct ViewInfo;
class ViewInfo;
#include <wx/scrolbar.h> // to get wxSB_HORIZONTAL
// CreateStdButtonSizer defs...should probably move to widgets subdir

View File

@ -8,14 +8,14 @@
**********************************************************************/
#include "Snap.h"
#include <algorithm>
#include <math.h>
#include "LabelTrack.h"
#include "Prefs.h"
#include "Project.h"
#include "Snap.h"
#include "TrackPanel.h"
#include "WaveTrack.h"
#include "widgets/NumericTextCtrl.h"
// Change this to "true" to snap to nearest and "false" to snap to previous
@ -29,8 +29,10 @@ static int CompareSnapPoints(SnapPoint *s1, SnapPoint *s2)
}
SnapManager::SnapManager(TrackList *tracks, TrackClipArray *exclusions,
double zoom, int pixelTolerance, bool noTimeSnap)
const ZoomInfo &zoomInfo, int pixelTolerance, bool noTimeSnap)
: mConverter(NumericConverter::TIME)
, mPixelTolerance(std::max(0, pixelTolerance))
, mZoomInfo(zoomInfo)
{
int i;
@ -50,13 +52,7 @@ SnapManager::SnapManager(TrackList *tracks, TrackClipArray *exclusions,
}
mSnapPoints = new SnapPointArray(CompareSnapPoints);
if (zoom > 0 && pixelTolerance > 0)
mTolerance = pixelTolerance / zoom;
else {
// This shouldn't happen, but we don't want to crash if we get
// illegal values. The net effect of this is to never snap.
mTolerance = 0.0;
}
// Two time points closer than this are considered the same
mEpsilon = 1 / 44100.0;
@ -135,9 +131,12 @@ double SnapManager::Get(int index)
}
// Returns the difference in time between t and the point at a given index
double SnapManager::Diff(double t, int index)
wxInt64 SnapManager::PixelDiff(double t, int index)
{
return fabs(t - Get(index));
return abs(
mZoomInfo.TimeToPosition(t, 0) -
mZoomInfo.TimeToPosition(Get(index), 0)
);
}
// Find the index where this SnapPoint should go in
@ -168,7 +167,7 @@ int SnapManager::Find(double t)
next++;
// Now return whichever one is closer to time t
if (next < len && Diff(t, next) < Diff(t, index))
if (next < len && PixelDiff(t, next) < PixelDiff(t, index))
return next;
else
return index;
@ -189,7 +188,7 @@ bool SnapManager::SnapToPoints(Track *currentTrack,
int index = Find(t);
// If it's too far away, just give up now
if (Diff(t, index) >= mTolerance)
if (PixelDiff(t, index) >= mPixelTolerance)
return false;
// Otherwise, search left and right for all of the points
@ -198,10 +197,10 @@ bool SnapManager::SnapToPoints(Track *currentTrack,
int right = index;
int i;
while(left > 0 && Diff(t, left-1) < mTolerance)
while(left > 0 && PixelDiff(t, left-1) < mPixelTolerance)
left--;
while(right < len-1 && Diff(t, right+1) < mTolerance)
while(right < len-1 && PixelDiff(t, right+1) < mPixelTolerance)
right++;
if (left == index && right == index) {

View File

@ -22,6 +22,7 @@
#include "widgets/NumericTextCtrl.h"
class TrackClipArray;
class ZoomInfo;
enum
{
@ -43,9 +44,9 @@ class SnapPoint {
WX_DEFINE_SORTED_ARRAY(SnapPoint *, SnapPointArray);
class SnapManager {
public:
public:
SnapManager(TrackList *tracks, TrackClipArray *exclusions,
double zoom, int pixelTolerance, bool noTimeSnap = false);
const ZoomInfo &zoomInfo, int pixelTolerance, bool noTimeSnap = false);
~SnapManager();
@ -54,34 +55,35 @@ class SnapManager {
// Pass rightEdge=true if this is the right edge of a selection,
// and false if it's the left edge.
bool Snap(Track *currentTrack,
double t,
bool rightEdge,
double *out_t,
bool *snappedPoint,
bool *snappedTime);
double t,
bool rightEdge,
double *out_t,
bool *snappedPoint,
bool *snappedTime);
static wxArrayString GetSnapLabels();
static wxArrayString GetSnapValues();
static const wxString & GetSnapValue(int index);
static int GetSnapIndex(const wxString & value);
private:
private:
void CondListAdd(double t, Track *tr);
double Get(int index);
double Diff(double t, int index);
wxInt64 PixelDiff(double t, int index);
int Find(double t, int i0, int i1);
int Find(double t);
bool SnapToPoints(Track *currentTrack, double t, bool rightEdge,
double *out_t);
double *out_t);
double mEpsilon;
double mTolerance;
double mZoom;
SnapPointArray *mSnapPoints;
// Info for snap-to-time
NumericConverter mConverter;
bool mSnapToTime;
const wxInt64 mPixelTolerance;
const ZoomInfo &mZoomInfo;
};
#endif

View File

@ -13,15 +13,16 @@
*//*******************************************************************/
#include "Audacity.h"
#include "TimeTrack.h"
#include <wx/intl.h>
#include "Audacity.h"
#include "AColor.h"
#include "TimeTrack.h"
#include "widgets/Ruler.h"
#include "Prefs.h"
#include "Internat.h"
#include "Resample.h"
#include "ViewInfo.h"
//TODO-MB: are these sensible values?
#define TIMETRACK_MIN 0.01
@ -52,7 +53,8 @@ TimeTrack::TimeTrack(DirManager *projDirManager):
SetDefaultName(_("Time Track"));
SetName(GetDefaultName());
mRuler = new Ruler();
mRuler = new Ruler;
mRuler->SetUseZoomInfo(0);
mRuler->SetLabelEdges(false);
mRuler->SetFormat(Ruler::TimeFormat);
@ -76,7 +78,8 @@ TimeTrack::TimeTrack(TimeTrack &orig):
mEnvelope->Paste(0.0, orig.mEnvelope);
///@TODO: Give Ruler:: a copy-constructor instead of this?
mRuler = new Ruler();
mRuler = new Ruler;
mRuler->SetUseZoomInfo(0);
mRuler->SetLabelEdges(false);
mRuler->SetFormat(Ruler::TimeFormat);
@ -223,19 +226,15 @@ void TimeTrack::WriteXML(XMLWriter &xmlFile)
xmlFile.EndTag(wxT("timetrack"));
}
void TimeTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps)
void TimeTrack::Draw(wxDC & dc, const wxRect & r, const ZoomInfo &zoomInfo)
{
double tstep = 1.0 / pps; // Seconds per point
double t0 = h;
double t1 = h + (r.width * tstep);
//Make sure t1 (the right bound) is greater than 0
if (t1 < 0.0)
t1 = 0.0;
//make sure t1 is greater than t0
if (t0 > t1)
t0 = t1;
double min = zoomInfo.PositionToTime(0);
double max = zoomInfo.PositionToTime(r.width);
if (min > max)
{
wxASSERT(false);
min = max;
}
dc.SetBrush(blankBrush);
dc.SetPen(blankPen);
@ -246,8 +245,6 @@ void TimeTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps)
// Draw the Ruler
mRuler->SetBounds(r.x, r.y, r.x + r.width - 1, r.y + r.height - 1);
double min = t0;
double max = min + r.width / pps;
mRuler->SetRange(min, max);
mRuler->SetFlip(false); // If we don't do this, the Ruler doesn't redraw itself when the envelope is modified.
// I have no idea why!
@ -258,7 +255,7 @@ void TimeTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps)
mRuler->Draw(dc, this);
double *envValues = new double[mid.width];
GetEnvelope()->GetValues(envValues, mid.width, t0, tstep);
GetEnvelope()->GetValues(envValues, mid.width, 0, zoomInfo);
dc.SetPen(AColor::envelopePen);

View File

@ -21,6 +21,7 @@ class wxRect;
class wxDC;
class Envelope;
class Ruler;
class ZoomInfo;
class TimeTrack: public Track {
@ -49,7 +50,7 @@ class TimeTrack: public Track {
virtual double GetStartTime() const { return 0.0; }
virtual double GetEndTime() const { return 0.0; }
void Draw(wxDC & dc, const wxRect & r, double h, double pps);
void Draw(wxDC & dc, const wxRect & r, const ZoomInfo &zoomInfo);
// XMLTagHandler callback methods for loading and saving

View File

@ -19,6 +19,7 @@
*//*******************************************************************/
#include "Audacity.h"
#include "TimerRecordDialog.h"
#include <wx/defs.h>
#include <wx/datetime.h>
@ -29,7 +30,7 @@
#include <wx/timer.h>
#include <wx/dynlib.h> //<! For windows.h
#include "TimerRecordDialog.h"
#include "ShuttleGui.h"
#include "Project.h"
#include "Internat.h"
#include "Prefs.h"

View File

@ -19,10 +19,12 @@
#include <wx/dialog.h>
#include <wx/datectrl.h>
#include <wx/calctrl.h>
#include <wx/timer.h>
#include "ShuttleGui.h"
class wxTimerEvent;
class NumericTextCtrl;
class ShuttleGui;
class TimerRecordDialog : public wxDialog
{

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
#include <wx/brush.h>
#include <wx/pen.h>
#include "Experimental.h"
#include "Sequence.h"
#include "audacity/Types.h"
class wxDC;
class wxRect;
@ -37,7 +37,8 @@ class LabelTrack;
class TimeTrack;
class TrackList;
class Ruler;
struct ViewInfo;
class SelectedRegion;
class ZoomInfo;
#ifndef uchar
typedef unsigned char uchar;
@ -52,17 +53,19 @@ class AUDACITY_DLL_API TrackArtist {
void SetColours();
void DrawTracks(TrackList *tracks, Track *start,
wxDC & dc, wxRegion & reg,
wxRect & r, wxRect & clip, ViewInfo *viewInfo,
bool drawEnvelope, bool drawSamples, bool drawSliders);
wxRect & rect, wxRect & clip,
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
bool drawEnvelope, bool bigPoints, bool drawSliders);
void DrawTrack(const Track *t,
wxDC & dc, const wxRect & r, const ViewInfo *viewInfo,
bool drawEnvelope, bool drawSamples, bool drawSliders,
wxDC & dc, const wxRect & rect,
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
bool drawEnvelope, bool bigPoints, bool drawSliders,
bool hasSolo);
void DrawVRuler(Track *t, wxDC *dc, wxRect & r);
void DrawVRuler(Track *t, wxDC *dc, wxRect & rect);
void UpdateVRuler(Track *t, wxRect & r);
void UpdateVRuler(Track *t, wxRect & rect);
void SetInset(int left, int top, int right, int bottom);
@ -76,10 +79,6 @@ class AUDACITY_DLL_API TrackArtist {
int GetSpectrumLogMaxFreq(int deffreq);
int GetSpectrumWindowSize(bool includeZeroPadding);
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
int GetSpectrumFftSkipPoints();
#endif
void SetSpectrumMinFreq(int freq);
void SetSpectrumMaxFreq(int freq);
void SetSpectrumLogMinFreq(int freq);
@ -94,12 +93,12 @@ class AUDACITY_DLL_API TrackArtist {
}
// Helper: draws the "sync-locked" watermark tiled to a rectangle
static void DrawSyncLockTiles(wxDC *dc, wxRect r);
static void DrawSyncLockTiles(wxDC *dc, wxRect rect);
// Helper: draws background with selection rect
static void DrawBackgroundWithSelection(wxDC *dc, const wxRect &r,
static void DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
Track *track, wxBrush &selBrush, wxBrush &unselBrush,
double sel0, double sel1, double h, double pps);
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo);
private:
@ -108,67 +107,74 @@ class AUDACITY_DLL_API TrackArtist {
//
void DrawWaveform(WaveTrack *track,
wxDC & dc, const wxRect & r, const ViewInfo *viewInfo,
bool drawEnvelope, bool drawSamples, bool drawSliders,
wxDC & dc, const wxRect & rect,
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
bool drawEnvelope, bool bigPoints, bool drawSliders,
bool dB, bool muted);
void DrawSpectrum(WaveTrack *track,
wxDC & dc, const wxRect & r, const ViewInfo *viewInfo);
wxDC & dc, const wxRect & rect,
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo);
#ifdef USE_MIDI
int GetBottom(NoteTrack *t, const wxRect &r);
int GetBottom(NoteTrack *t, const wxRect &rect);
void DrawNoteBackground(NoteTrack *track, wxDC &dc,
const wxRect &r, const wxRect &sel,
const ViewInfo *viewInfo,
const wxRect &rect, const wxRect &sel,
const ZoomInfo &zoomInfo,
const wxBrush &wb, const wxPen &wp,
const wxBrush &bb, const wxPen &bp,
const wxPen &mp);
void DrawNoteTrack(NoteTrack *track,
wxDC & dc, const wxRect & r, const ViewInfo *viewInfo,
wxDC & dc, const wxRect & rect,
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
bool muted);
#endif // USE_MIDI
void DrawLabelTrack(LabelTrack *track,
wxDC & dc, const wxRect & r, const ViewInfo *viewInfo);
wxDC & dc, const wxRect & rect,
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo);
void DrawTimeTrack(TimeTrack *track,
wxDC & dc, const wxRect & r, const ViewInfo *viewInfo);
wxDC & dc, const wxRect & rect, const ZoomInfo &zoomInfo);
void DrawTimeSlider(wxDC & dc, const wxRect & r,
void DrawTimeSlider(wxDC & dc, const wxRect & rect,
bool rightwards);
void DrawClipWaveform(WaveTrack *track, WaveClip *clip,
wxDC & dc, const wxRect & r, const ViewInfo *viewInfo,
bool drawEnvelope, bool drawSamples,
wxDC & dc, const wxRect & rect,
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
bool drawEnvelope, bool bigPoints,
bool dB, bool muted);
void DrawClipSpectrum(WaveTrackCache &cache, WaveClip *clip,
wxDC & dc, const wxRect & r, const ViewInfo *viewInfo);
wxDC & dc, const wxRect & rect,
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo);
// Waveform utility functions
void DrawWaveformBackground(wxDC & dc, const wxRect &r, const double env[],
void DrawWaveformBackground(wxDC & dc, int leftOffset, const wxRect &rect,
const double env[],
float zoomMin, float zoomMax, bool dB,
const sampleCount where[],
sampleCount ssel0, sampleCount ssel1,
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
bool drawEnvelope, bool bIsSyncLockSelected);
void DrawMinMaxRMS(wxDC &dc, const wxRect &r, const double env[],
void DrawMinMaxRMS(wxDC &dc, const wxRect & rect, const double env[],
float zoomMin, float zoomMax, bool dB,
const WaveDisplay &display, bool /* showProgress */, bool muted
const float *min, const float *max, const float *rms, const int *bl,
bool /* showProgress */, bool muted
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
, const float gain
#endif
);
void DrawIndividualSamples(wxDC & dc, const wxRect & r,
void DrawIndividualSamples(wxDC & dc, int leftOffset, const wxRect & rect,
float zoomMin, float zoomMax, bool dB,
WaveClip *clip,
double t0, double pps, double h,
bool drawSamples, bool showPoints, bool muted);
const ZoomInfo &zoomInfo,
bool bigPoints, bool showPoints, bool muted);
void DrawNegativeOffsetTrackArrows(wxDC & dc, const wxRect & r);
void DrawNegativeOffsetTrackArrows(wxDC & dc, const wxRect & rect);
void DrawEnvelope(wxDC & dc, const wxRect & r, const double env[],
void DrawEnvelope(wxDC & dc, const wxRect & rect, const double env[],
float zoomMin, float zoomMax, bool dB);
void DrawEnvLine(wxDC & dc, const wxRect & r, int x, int y, int cy, bool top);
void DrawEnvLine(wxDC & dc, const wxRect & rect, int x0, int y0, int cy, bool top);
// Preference values
float mdBrange; // "/GUI/EnvdBRange"
@ -221,7 +227,7 @@ extern int GetWaveYPos(float value, float min, float max,
int height, bool dB, bool outer, float dBr,
bool clip);
extern float FromDB(float value, double dBRange);
extern float ValueOfPixel(int y, int height, bool offset,
extern float ValueOfPixel(int yy, int height, bool offset,
bool dB, double dBRange, float zoomMin, float zoomMax);
#endif // define __AUDACITY_TRACKARTIST__

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@ class AudacityProject;
class TrackPanelAx;
struct ViewInfo;
class ViewInfo;
WX_DEFINE_ARRAY(LWSlider *, LWSliderArray);
@ -331,8 +331,9 @@ protected:
// Handle small cursor and play head movements
void SeekLeftOrRight
(bool left, bool shift, bool ctrl, bool keyup,
int snapToTime, bool mayAccelerateQuiet, bool mayAccelerateAudio,
double quietSeekStepPositive, double audioSeekStepPositive);
int snapToTime, bool mayAccelerateQuiet, bool mayAccelerateAudio,
double quietSeekStepPositive, bool quietStepIsPixels,
double audioSeekStepPositive, bool audioStepIsPixels);
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
public:
@ -500,10 +501,10 @@ protected:
// JKC Nov-2011: These four functions only used from within a dll such as mod-track-panel
// They work around some messy problems with constructors.
public:
TrackList * GetTracks(){ return mTracks;};
ViewInfo * GetViewInfo(){ return mViewInfo;};
TrackPanelListener * GetListener(){ return mListener;};
AdornedRulerPanel * GetRuler(){ return mRuler;};
TrackList * GetTracks(){ return mTracks;}
ViewInfo * GetViewInfo(){ return mViewInfo;}
TrackPanelListener * GetListener(){ return mListener;}
AdornedRulerPanel * GetRuler(){ return mRuler;}
// JKC and here is a factory function which just does 'new' in standard Audacity.
static TrackPanel *(*FactoryFunction)(wxWindow * parent,
wxWindowID id,
@ -538,7 +539,7 @@ protected:
void UpdateVirtualStereoOrder();
#endif
// Accessors...
virtual bool HasSoloButton(){ return mSoloPref!=wxT("None");};
virtual bool HasSoloButton(){ return mSoloPref!=wxT("None");}
//JKC: These two belong in the label track.
int mLabelTrackStartXPos;
@ -691,14 +692,7 @@ protected:
void HandleCenterFrequencyClick
(bool shiftDown, Track *pTrack, double value);
#endif
double PositionToTime(wxInt64 mouseXCoordinate,
wxInt64 trackLeftEdge) const;
wxInt64 TimeToPosition(double time,
wxInt64 trackLeftEdge) const;
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
double PositionToFrequency(bool maySnap,
wxInt64 mouseYCoordinate,
wxInt64 trackTopEdge,

View File

@ -0,0 +1,148 @@
/**********************************************************************
Audacity: A Digital Audio Editor
ViewInfo.cpp
Paul Licameli
**********************************************************************/
#include "ViewInfo.h"
#include <algorithm>
#include "Internat.h"
#include "xml/XMLWriter.h"
namespace {
static const double gMaxZoom = 6000000;
static const double gMinZoom = 0.001;
}
ZoomInfo::ZoomInfo(double start, double screenDuration, double pixelsPerSecond)
: vpos(0)
, h(start)
, screen(screenDuration)
, zoom(pixelsPerSecond)
{
}
ZoomInfo::~ZoomInfo()
{
}
/// Converts a position (mouse X coordinate) to
/// project time, in seconds. Needs the left edge of
/// the track as an additional parameter.
double ZoomInfo::PositionToTime(wxInt64 position,
wxInt64 origin
, bool // ignoreFisheye
) const
{
return h + (position - origin) / zoom;
}
/// STM: Converts a project time to screen x position.
wxInt64 ZoomInfo::TimeToPosition(double projectTime,
wxInt64 origin
, bool // ignoreFisheye
) const
{
return floor(0.5 +
zoom * (projectTime - h) + origin
);
}
bool ZoomInfo::ZoomInAvailable() const
{
return zoom < gMaxZoom;
}
bool ZoomInfo::ZoomOutAvailable() const
{
return zoom > gMinZoom;
}
void ZoomInfo::SetZoom(double pixelsPerSecond)
{
zoom = std::max(gMinZoom, std::min(gMaxZoom, pixelsPerSecond));
}
void ZoomInfo::ZoomBy(double multiplier)
{
SetZoom(zoom * multiplier);
}
void ZoomInfo::FindIntervals
(double /*rate*/, Intervals &results, wxInt64 origin) const
{
results.clear();
results.reserve(2);
const wxInt64 rightmost(origin + (0.5 + screen * zoom));
wxASSERT(origin <= rightmost);
{
results.push_back(Interval(origin, zoom, false));
}
if (origin < rightmost)
results.push_back(Interval(rightmost, 0, false));
wxASSERT(!results.empty() && results[0].position == origin);
}
ViewInfo::ViewInfo(double start, double screenDuration, double pixelsPerSecond)
: ZoomInfo(start, screenDuration, pixelsPerSecond)
, selectedRegion()
, track(NULL)
, total(screen)
, sbarH(0)
, sbarScreen(1)
, sbarTotal(1)
, sbarScale(1.0)
, scrollStep(16)
, bUpdateTrackIndicator(true)
{
}
void ViewInfo::SetBeforeScreenWidth(wxInt64 width, double lowerBoundTime)
{
h =
std::max(lowerBoundTime,
std::min(total - screen,
width / zoom));
}
void ViewInfo::WriteXMLAttributes(XMLWriter &xmlFile)
{
selectedRegion.WriteXMLAttributes(xmlFile, wxT("sel0"), wxT("sel1"));
xmlFile.WriteAttr(wxT("vpos"), vpos);
xmlFile.WriteAttr(wxT("h"), h, 10);
xmlFile.WriteAttr(wxT("zoom"), zoom, 10);
}
bool ViewInfo::ReadXMLAttribute(const wxChar *attr, const wxChar *value)
{
if (selectedRegion.HandleXMLAttribute(attr, value, wxT("sel0"), wxT("sel1")))
return true;
if (!wxStrcmp(attr, wxT("vpos"))) {
long longVpos;
wxString(value).ToLong(&longVpos);
vpos = int(longVpos);
return true;
}
if (!wxStrcmp(attr, wxT("h"))) {
Internat::CompatibleToDouble(value, &h);
return true;
}
if (!wxStrcmp(attr, wxT("zoom"))) {
Internat::CompatibleToDouble(value, &zoom);
return true;
}
return false;
}

View File

@ -11,14 +11,137 @@
#ifndef __AUDACITY_VIEWINFO__
#define __AUDACITY_VIEWINFO__
#include <vector>
#include "SelectedRegion.h"
const double gMaxZoom = 6000000,
gMinZoom = 0.001;
class Track;
struct ViewInfo {
// The subset of ViewInfo information (other than selection)
// that is sufficient for purposes of TrackArtist,
// and for computing conversions between track times and pixel positions.
class AUDACITY_DLL_API ZoomInfo
{
public:
ZoomInfo(double start, double duration, double pixelsPerSecond);
~ZoomInfo();
int vpos; // vertical scroll pos
double h; // h pos in secs
double screen; // screen width in secs
protected:
double zoom; // pixels per second
public:
// do NOT use this once to convert a pixel width to a duration!
// Instead, call twice to convert start and end times,
// and take the difference.
// origin specifies the pixel corresponding to time h
double PositionToTime(wxInt64 position,
wxInt64 origin = 0
, bool ignoreFisheye = false
) const;
// do NOT use this once to convert a duration to a pixel width!
// Instead, call twice to convert start and end positions,
// and take the difference.
// origin specifies the pixel corresponding to time h
wxInt64 TimeToPosition(double time,
wxInt64 origin = 0
, bool ignoreFisheye = false
) const;
double OffsetTimeByPixels(double time, wxInt64 offset) const
{
return PositionToTime(offset + TimeToPosition(time));
}
bool ZoomInAvailable() const;
bool ZoomOutAvailable() const;
// Return pixels, but maybe not a whole number
double GetScreenWidth() const
{ return screen * zoom; }
void SetScreenWidth(wxInt64 width)
{ screen = width / zoom; }
static double GetDefaultZoom()
{ return 44100.0 / 512.0; }
// There is NO GetZoom()!
// Use TimeToPosition and PositionToTime and OffsetTimeByPixels!
// Limits zoom to certain bounds
void SetZoom(double pixelsPerSecond);
// Limits zoom to certain bounds
// multipliers above 1.0 zoom in, below out
void ZoomBy(double multiplier);
struct Interval {
/* const */ wxInt64 position; /* const */ double averageZoom; /* const */ bool inFisheye;
Interval(wxInt64 p, double z, bool i)
: position(p), averageZoom(z), inFisheye(i) {}
};
typedef std::vector<Interval> Intervals;
// Find an increasing sequence of pixel positions. Each is the start
// of an interval, or is the end position.
// Each of the disjoint intervals should be drawn
// separately.
// It is guaranteed that there is at least one entry and the position of the
// first entry equals origin.
// @param origin specifies the pixel position corresponding to time ViewInfo::h.
void FindIntervals
(double rate, Intervals &results, wxInt64 origin = 0) const;
enum FisheyeState {
HIDDEN,
PINNED,
NUM_STATES,
};
FisheyeState GetFisheyeState() const
{ return HIDDEN; } // stub
// Return true if the mouse position is anywhere in the fisheye
// origin specifies the pixel corresponding to time h
bool InFisheye(wxInt64 position, wxInt64 origin = 0) const
{origin; return false;} // stub
// These accessors ignore the fisheye hiding state.
// Inclusive:
wxInt64 GetFisheyeLeftBoundary(wxInt64 origin = 0) const
{origin; return 0;} // stub
// Exclusive:
wxInt64 GetFisheyeRightBoundary(wxInt64 origin = 0) const
{origin; return 0;} // stub
};
class AUDACITY_DLL_API ViewInfo
: public ZoomInfo
{
public:
ViewInfo(double start, double screenDuration, double pixelsPerSecond);
double GetBeforeScreenWidth() const
{
return h * zoom;
}
void SetBeforeScreenWidth(wxInt64 width, double lowerBoundTime = 0.0);
double GetTotalWidth() const
{ return total * zoom; }
bool ZoomedAll() const
{ return screen >= total; }
// Current selection
@ -27,13 +150,8 @@ struct ViewInfo {
// Scroll info
Track *track; // first visible track
int vpos; // vertical scroll pos
double h; // h pos in secs
double screen; // screen width in secs
double total; // total width in secs
double zoom; // pixels per second
// Current horizontal scroll bar positions, in pixels
wxInt64 sbarH;
wxInt64 sbarScreen;
@ -52,6 +170,9 @@ struct ViewInfo {
// drawing the waveform. Maybe this should be put somewhere else?
bool bUpdateTrackIndicator;
void WriteXMLAttributes(XMLWriter &xmlFile);
bool ReadXMLAttribute(const wxChar *attr, const wxChar *value);
};
#endif

View File

@ -17,12 +17,6 @@
\class WaveCache
\brief Cache used with WaveClip to cache wave information (for drawing).
*//****************************************************************//**
\class SpecCache
\brief Cache used with WaveClip to cache spectrum information (for
drawing). Cache's the Spectrogram frequency samples.
*//*******************************************************************/
#include "WaveClip.h"
@ -61,8 +55,8 @@ public:
{
}
WaveCache(int len_, double pixelsPerSecond, double rate_, double t0)
: dirty(-1)
WaveCache(int len_, double pixelsPerSecond, double rate_, double t0, int dirty_)
: dirty(dirty_)
, len(len_)
, start(t0)
, pps(pixelsPerSecond)
@ -263,105 +257,10 @@ protected:
};
class SpecCache {
public:
// Make invalid cache
SpecCache()
: len(-1)
, ac(false)
, pps(-1.0)
, start(-1.0)
, windowType(-1)
, windowSize(-1)
, zeroPaddingFactor(-1)
, frequencyGain(-1)
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
, fftSkipPoints(-1)
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
, freq(NULL)
, where(NULL)
, dirty(-1)
{
}
// Make valid cache, to be filled in
SpecCache(int cacheLen, bool autocorrelation,
double pps_, double start_, int windowType_, int windowSize_,
int zeroPaddingFactor_, int frequencyGain_
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
, int fftSkipPoints_
#endif
)
: len(cacheLen)
, ac(autocorrelation)
, pps(pps_)
, start(start_)
, windowType(windowType_)
, windowSize(windowSize_)
, zeroPaddingFactor(zeroPaddingFactor_)
, frequencyGain(frequencyGain_)
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
, fftSkipPoints(fftSkipPoints_)
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
// len columns, and so many rows, column-major.
// Don't take column literally -- this isn't pixel data yet, it's the
// raw data to be mapped onto the display.
, freq(len * ((windowSize * zeroPaddingFactor) / 2))
// Sample counts corresponding to the columns, and to one past the end.
, where(len + 1)
, dirty(-1)
{
where[0] = 0;
}
~SpecCache()
{
}
bool Matches(int dirty_, bool autocorrelation, double pixelsPerSecond,
const SpectrogramSettings &settings, double rate) const;
void CalculateOneSpectrum
(const SpectrogramSettings &settings,
WaveTrackCache &waveTrackCache,
int xx, sampleCount numSamples,
double offset, double rate,
bool autocorrelation, const std::vector<float> &gainFactors,
float *scratch);
void Populate
(const SpectrogramSettings &settings, WaveTrackCache &waveTrackCache,
int copyBegin, int copyEnd, int numPixels,
sampleCount numSamples,
double offset, double rate,
bool autocorrelation);
const int len; // counts pixels, not samples
const bool ac;
const double pps;
const double start;
const int windowType;
const int windowSize;
const int zeroPaddingFactor;
const int frequencyGain;
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
const int fftSkipPoints;
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
std::vector<float> freq;
std::vector<sampleCount> where;
int dirty;
};
#ifdef EXPERIMENTAL_USE_REALFFTF
#include "FFT.h"
static void ComputeSpectrumUsingRealFFTf(float *buffer, HFFT hFFT, const float *window, int len, float *out)
static void ComputeSpectrumUsingRealFFTf
(float *buffer, HFFT hFFT, const float *window, int len, float *out)
{
int i;
if(len > hFFT->Points*2)
@ -580,11 +479,11 @@ fillWhere(std::vector<sampleCount> &where, int len, double bias, double correcti
double t0, double rate, double samplesPerPixel)
{
// Be careful to make the first value non-negative
correction += 0.5 + bias;
where[0] = sampleCount(std::max(0.0, floor(correction + t0 * rate)));
const double w0 = 0.5 + correction + bias + t0 * rate;
where[0] = sampleCount(std::max(0.0, floor(w0)));
for (sampleCount x = 1; x < len + 1; x++)
where[x] = sampleCount(
floor(correction + t0 * rate + double(x) * samplesPerPixel)
floor(w0 + double(x) * samplesPerPixel)
);
}
@ -598,110 +497,137 @@ fillWhere(std::vector<sampleCount> &where, int len, double bias, double correcti
bool WaveClip::GetWaveDisplay(WaveDisplay &display, double t0,
double pixelsPerSecond, bool &isLoadingOD)
{
int numPixels = display.width;
const bool allocated = (display.where != 0);
ODLocker locker(mWaveCacheMutex);
const int numPixels = display.width;
const double tstep = 1.0 / pixelsPerSecond;
const double samplesPerPixel = mRate * tstep;
int p0 = 0; // least column requiring computation
int p1 = numPixels; // greatest column requiring computation, plus one
// Make a tolerant comparison of the pps values in this wise:
// accumulated difference of times over the number of pixels is less than
// a sample period.
const bool ppsMatch = mWaveCache &&
(fabs(tstep - 1.0 / mWaveCache->pps) * numPixels < (1.0 / mRate));
float *min;
float *max;
float *rms;
int *bl;
std::vector<sampleCount> *pWhere;
const bool match =
mWaveCache &&
ppsMatch &&
mWaveCache->len > 0 &&
mWaveCache->dirty == mDirty;
if (match &&
mWaveCache->start == t0 &&
mWaveCache->len >= numPixels) {
mWaveCache->LoadInvalidRegions(mSequence, true);
mWaveCache->ClearInvalidRegions();
// Satisfy the request completely from the cache
display.min = &mWaveCache->min[0];
display.max = &mWaveCache->max[0];
display.rms = &mWaveCache->rms[0];
display.bl = &mWaveCache->bl[0];
display.where = &mWaveCache->where[0];
isLoadingOD = mWaveCache->numODPixels > 0;
return true;
if (allocated) {
// assume ownWhere is filled.
min = &display.min[0];
max = &display.max[0];
rms = &display.rms[0];
bl = &display.bl[0];
pWhere = &display.ownWhere;
}
else {
// Lock the list of invalid regions
ODLocker locker(mWaveCacheMutex);
std::auto_ptr<WaveCache> oldCache(mWaveCache);
mWaveCache = 0;
const double tstep = 1.0 / pixelsPerSecond;
const double samplesPerPixel = mRate * tstep;
int oldX0 = 0;
double correction = 0.0;
// Make a tolerant comparison of the pps values in this wise:
// accumulated difference of times over the number of pixels is less than
// a sample period.
const bool ppsMatch = mWaveCache &&
(fabs(tstep - 1.0 / mWaveCache->pps) * numPixels < (1.0 / mRate));
int copyBegin = 0, copyEnd = 0;
if (match) {
findCorrection(oldCache->where, oldCache->len, numPixels,
t0, mRate, samplesPerPixel,
oldX0, correction);
// Remember our first pixel maps to oldX0 in the old cache,
// possibly out of bounds.
// For what range of pixels can data be copied?
copyBegin = std::min(numPixels, std::max(0, -oldX0));
copyEnd = std::min(numPixels,
copyBegin + oldCache->len - std::max(0, oldX0)
);
}
const bool match =
mWaveCache &&
ppsMatch &&
mWaveCache->len > 0 &&
mWaveCache->dirty == mDirty;
if (!(copyEnd > copyBegin))
oldCache.reset(0);
if (match &&
mWaveCache->start == t0 &&
mWaveCache->len >= numPixels) {
mWaveCache->LoadInvalidRegions(mSequence, true);
mWaveCache->ClearInvalidRegions();
mWaveCache = new WaveCache(numPixels, pixelsPerSecond, mRate, t0);
float *const min = &mWaveCache->min[0];
float *const max = &mWaveCache->max[0];
float *const rms = &mWaveCache->rms[0];
int *const bl = &mWaveCache->bl[0];
std::vector<sampleCount> &where = mWaveCache->where;
// Satisfy the request completely from the cache
display.min = &mWaveCache->min[0];
display.max = &mWaveCache->max[0];
display.rms = &mWaveCache->rms[0];
display.bl = &mWaveCache->bl[0];
display.where = &mWaveCache->where[0];
isLoadingOD = mWaveCache->numODPixels > 0;
return true;
}
fillWhere(where, numPixels, 0.0, correction,
t0, mRate, samplesPerPixel);
std::auto_ptr<WaveCache> oldCache(mWaveCache);
mWaveCache = 0;
// The range of pixels we must fetch from the Sequence:
const int p0 = (copyBegin > 0) ? 0 : copyEnd;
int p1 = (copyEnd >= numPixels) ? copyBegin : numPixels;
int oldX0 = 0;
double correction = 0.0;
int copyBegin = 0, copyEnd = 0;
if (match) {
findCorrection(oldCache->where, oldCache->len, numPixels,
t0, mRate, samplesPerPixel,
oldX0, correction);
// Remember our first pixel maps to oldX0 in the old cache,
// possibly out of bounds.
// For what range of pixels can data be copied?
copyBegin = std::min(numPixels, std::max(0, -oldX0));
copyEnd = std::min(numPixels,
copyBegin + oldCache->len - std::max(0, oldX0)
);
}
if (!(copyEnd > copyBegin))
oldCache.reset(0);
// Optimization: if the old cache is good and overlaps
// with the current one, re-use as much of the cache as
// possible
mWaveCache = new WaveCache(numPixels, pixelsPerSecond, mRate, t0, mDirty);
min = &mWaveCache->min[0];
max = &mWaveCache->max[0];
rms = &mWaveCache->rms[0];
bl = &mWaveCache->bl[0];
pWhere = &mWaveCache->where;
if (oldCache.get()) {
fillWhere(*pWhere, numPixels, 0.0, correction,
t0, mRate, samplesPerPixel);
//TODO: only load inval regions if
//necessary. (usually is the case, so no rush.)
//also, we should be updating the NEW cache, but here we are patching the old one up.
oldCache->LoadInvalidRegions(mSequence, false);
oldCache->ClearInvalidRegions();
// The range of pixels we must fetch from the Sequence:
p0 = (copyBegin > 0) ? 0 : copyEnd;
p1 = (copyEnd >= numPixels) ? copyBegin : numPixels;
// Copy what we can from the old cache.
const int length = copyEnd - copyBegin;
const size_t sizeFloats = length * sizeof(float);
const int srcIdx = copyBegin + oldX0;
memcpy(&min[copyBegin], &oldCache->min[srcIdx], sizeFloats);
memcpy(&max[copyBegin], &oldCache->max[srcIdx], sizeFloats);
memcpy(&rms[copyBegin], &oldCache->rms[srcIdx], sizeFloats);
memcpy(&bl[copyBegin], &oldCache->bl[srcIdx], length * sizeof(int));
// Optimization: if the old cache is good and overlaps
// with the current one, re-use as much of the cache as
// possible
if (oldCache.get()) {
//TODO: only load inval regions if
//necessary. (usually is the case, so no rush.)
//also, we should be updating the NEW cache, but here we are patching the old one up.
oldCache->LoadInvalidRegions(mSequence, false);
oldCache->ClearInvalidRegions();
// Copy what we can from the old cache.
const int length = copyEnd - copyBegin;
const size_t sizeFloats = length * sizeof(float);
const int srcIdx = copyBegin + oldX0;
memcpy(&min[copyBegin], &oldCache->min[srcIdx], sizeFloats);
memcpy(&max[copyBegin], &oldCache->max[srcIdx], sizeFloats);
memcpy(&rms[copyBegin], &oldCache->rms[srcIdx], sizeFloats);
memcpy(&bl[copyBegin], &oldCache->bl[srcIdx], length * sizeof(int));
}
}
if (p1 > p0) {
// Cache was not used or did not satisfy the whole request
std::vector<sampleCount> &where = *pWhere;
/* handle values in the append buffer */
int numSamples = mSequence->GetNumSamples();
int a;
for(a = p0; a < p1; ++a)
if (where[a+1] > numSamples)
break;
// Not all of the required columns might be in the sequence.
// Some might be in the append buffer.
for (a = p0; a < p1; ++a) {
if (where[a + 1] > numSamples)
break;
}
// Handle the columns that land in the append buffer.
//compute the values that are outside the overlap from scratch.
if (a < p1) {
int i;
@ -712,7 +638,7 @@ bool WaveClip::GetWaveDisplay(WaveDisplay &display, double t0,
sampleCount left;
left = where[i] - numSamples;
sampleCount right;
right = where[i+1] - numSamples;
right = where[i + 1] - numSamples;
//wxCriticalSectionLocker locker(mAppendCriticalSection);
@ -765,6 +691,8 @@ bool WaveClip::GetWaveDisplay(WaveDisplay &display, double t0,
p1 = a;
}
// Done with append buffer, now fetch the rest of the cache miss
// from the sequence
if (p1 > p0) {
if (!mSequence->GetWaveDisplay(&min[p0],
&max[p0],
@ -779,15 +707,23 @@ bool WaveClip::GetWaveDisplay(WaveDisplay &display, double t0,
}
}
mWaveCache->dirty = mDirty;
//find the number of OD pixels - the only way to do this is by recounting
if (!allocated) {
// Now report the results
display.min = min;
display.max = max;
display.rms = rms;
display.bl = bl;
display.where = &(*pWhere)[0];
isLoadingOD = mWaveCache->numODPixels > 0;
}
else {
using namespace std;
isLoadingOD =
count_if(display.ownBl.begin(), display.ownBl.end(),
bind2nd(less<int>(), 0)) > 0;
}
// Now report the results
display.min = min;
display.max = max;
display.rms = rms;
display.bl = bl;
display.where = &where[0];
isLoadingOD = mWaveCache->numODPixels > 0;
return true;
}
@ -833,9 +769,6 @@ bool SpecCache::Matches
windowSize == settings.windowSize &&
zeroPaddingFactor == settings.zeroPaddingFactor &&
frequencyGain == settings.frequencyGain &&
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
fftSkipPoints == settings.fftSkipPoints &&
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
ac == autocorrelation;
}
@ -847,11 +780,6 @@ void SpecCache::CalculateOneSpectrum
bool autocorrelation, const std::vector<float> &gainFactors,
float *scratch)
{
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
int fftSkipPoints = settings.fftSkipPoints;
int fftSkipPoints1 = fftSkipPoints + 1;
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
const int windowSize = settings.windowSize;
sampleCount start = where[xx];
const int zeroPaddingFactor = (autocorrelation ? 1 : settings.zeroPaddingFactor);
@ -881,15 +809,6 @@ void SpecCache::CalculateOneSpectrum
start = 0;
copy = true;
}
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
copy = true;
if (start + len*fftSkipPoints1 > numSamples) {
int newlen = (numSamples - start) / fftSkipPoints1;
for (int i = newlen*fftSkipPoints1; i < (sampleCount)len*fftSkipPoints1; i++)
adj[i] = 0;
len = newlen;
}
#else //!EXPERIMENTAL_FFT_SKIP_POINTS
if (start + len > numSamples) {
// Near the end of the clip, pad right with zeroes as needed.
int newlen = numSamples - start;
@ -898,28 +817,13 @@ void SpecCache::CalculateOneSpectrum
len = newlen;
copy = true;
}
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
if (len > 0) {
// Copy samples out of the track.
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
useBuffer = (float*)(waveTrackCache.Get(floatSample,
floor(0.5 + start + offset * rate), len*fftSkipPoints1));
memcpy(adj, useBuffer, len * fftSkipPoints1 * sizeof(float));
if (fftSkipPoints) {
// TODO: (maybe) alternatively change Get to include skipping of points
int j = 0;
for (int i = 0; i < len; i++) {
adj[i] = adj[j];
j += fftSkipPoints1;
}
}
#else //!EXPERIMENTAL_FFT_SKIP_POINTS
useBuffer = (float*)(waveTrackCache.Get(floatSample,
floor(0.5 + start + offset * rate), len));
if (copy)
memcpy(adj, useBuffer, len * sizeof(float));
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
}
if (copy)
@ -961,11 +865,6 @@ void SpecCache::Populate
settings.CacheWindows();
#endif
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
int fftSkipPoints = settings.fftSkipPoints;
int fftSkipPoints1 = fftSkipPoints + 1;
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
const int &frequencyGain = settings.frequencyGain;
const int &windowSize = settings.windowSize;
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
@ -979,11 +878,7 @@ void SpecCache::Populate
const int fftLen = windowSize * zeroPaddingFactor;
std::vector<float> buffer(
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
fftLen*fftSkipPoints1
#else //!EXPERIMENTAL_FFT_SKIP_POINTS
fftLen
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
);
std::vector<float> gainFactors;
@ -1009,10 +904,6 @@ bool WaveClip::GetSpectrogram(WaveTrackCache &waveTrackCache,
{
const SpectrogramSettings &settings = SpectrogramSettings::defaults();
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
int fftSkipPoints = settings.fftSkipPoints;
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
const int &frequencyGain = settings.frequencyGain;
const int &windowSize = settings.windowSize;
const int &windowType = settings.windowType;
@ -1070,9 +961,6 @@ bool WaveClip::GetSpectrogram(WaveTrackCache &waveTrackCache,
mSpecCache = new SpecCache(
numPixels, autocorrelation, pixelsPerSecond, t0,
windowType, windowSize, zeroPaddingFactor, frequencyGain
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
, fftSkipPoints
#endif
);
fillWhere(mSpecCache->where, numPixels, 0.5, correction,

View File

@ -32,9 +32,93 @@
#include <vector>
class Envelope;
class SpectrogramSettings;
class WaveCache;
class WaveTrackCache;
class SpecCache;
class SpecCache {
public:
// Make invalid cache
SpecCache()
: len(-1)
, ac(false)
, pps(-1.0)
, start(-1.0)
, windowType(-1)
, windowSize(-1)
, zeroPaddingFactor(-1)
, frequencyGain(-1)
, freq(NULL)
, where(NULL)
, dirty(-1)
{
}
// Make valid cache, to be filled in
SpecCache(int cacheLen, bool autocorrelation,
double pps_, double start_, int windowType_, int windowSize_,
int zeroPaddingFactor_, int frequencyGain_
)
: len(cacheLen)
, ac(autocorrelation)
, pps(pps_)
, start(start_)
, windowType(windowType_)
, windowSize(windowSize_)
, zeroPaddingFactor(zeroPaddingFactor_)
, frequencyGain(frequencyGain_)
// len columns, and so many rows, column-major.
// Don't take column literally -- this isn't pixel data yet, it's the
// raw data to be mapped onto the display.
, freq(len * ((windowSize * zeroPaddingFactor) / 2))
// Sample counts corresponding to the columns, and to one past the end.
, where(len + 1)
, dirty(-1)
{
where[0] = 0;
}
~SpecCache()
{
}
bool Matches(int dirty_, bool autocorrelation, double pixelsPerSecond,
const SpectrogramSettings &settings, double rate) const;
void CalculateOneSpectrum
(const SpectrogramSettings &settings,
WaveTrackCache &waveTrackCache,
int xx, sampleCount numSamples,
double offset, double rate,
bool autocorrelation, const std::vector<float> &gainFactors,
float *scratch);
void Populate
(const SpectrogramSettings &settings, WaveTrackCache &waveTrackCache,
int copyBegin, int copyEnd, int numPixels,
sampleCount numSamples,
double offset, double rate,
bool autocorrelation);
const int len; // counts pixels, not samples
const bool ac;
const double pps;
const double start;
const int windowType;
const int windowSize;
const int zeroPaddingFactor;
const int frequencyGain;
std::vector<float> freq;
std::vector<sampleCount> where;
int dirty;
};
class SpecPxCache {
public:
@ -67,6 +151,8 @@ class WaveClip;
WX_DECLARE_USER_EXPORTED_LIST(WaveClip, WaveClipList, AUDACITY_DLL_API);
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(WaveClip*, WaveClipArray, class AUDACITY_DLL_API);
// A bundle of arrays needed for drawing waveforms. The object may or may not
// own the storage for those arrays. If it does, it destroys them.
class WaveDisplay
{
public:
@ -75,11 +161,38 @@ public:
float *min, *max, *rms;
int* bl;
std::vector<sampleCount> ownWhere;
std::vector<float> ownMin, ownMax, ownRms;
std::vector<int> ownBl;
public:
WaveDisplay(int w)
: width(w), where(0), min(0), max(0), rms(0), bl(0)
{
}
// Create "own" arrays.
void Allocate()
{
ownWhere.resize(width + 1);
ownMin.resize(width);
ownMax.resize(width);
ownRms.resize(width);
ownBl.resize(width);
where = &ownWhere[0];
if (width > 0) {
min = &ownMin[0];
max = &ownMax[0];
rms = &ownRms[0];
bl = &ownBl[0];
}
else {
min = max = rms = 0;
bl = 0;
}
}
~WaveDisplay()
{
}

View File

@ -444,7 +444,7 @@ class AUDACITY_DLL_API WaveTrack: public Track {
if( mDisplay == SpectralSelectionLogDisplay ){
}
}
int GetDisplay() const {return mDisplay;}
WaveTrackDisplay GetDisplay() const { return mDisplay; }
int GetLastDisplay() {return mLastDisplay;}
void GetDisplayBounds(float *min, float *max);

View File

@ -19,6 +19,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "Amplify.h"
#include <math.h>
#include <float.h>
@ -32,11 +33,10 @@
#include <wx/valtext.h>
#include <wx/log.h>
#include "../ShuttleGui.h"
#include "../WaveTrack.h"
#include "../widgets/valnum.h"
#include "Amplify.h"
enum
{

View File

@ -21,12 +21,12 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "Effect.h"
#define AMPLIFY_PLUGIN_SYMBOL XO("Amplify")
class ShuttleGui;
class EffectAmplify : public Effect
{
public:

View File

@ -14,6 +14,7 @@
*******************************************************************/
#include "../Audacity.h"
#include "AutoDuck.h"
#include <math.h>
#include <float.h>
@ -28,11 +29,10 @@
#include "../AllThemeResources.h"
#include "../Internat.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../Theme.h"
#include "../widgets/valnum.h"
#include "AutoDuck.h"
// Define keys, defaults, minimums, and maximums for the effect parameters
//
// Name Type Key Def Min Max Scale

View File

@ -19,12 +19,12 @@
#include <wx/textctrl.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "../WaveTrack.h"
#include "Effect.h"
class EffectAutoDuckPanel;
class ShuttleGui;
#define AUTO_DUCK_PANEL_NUM_CONTROL_POINTS 5

View File

@ -19,6 +19,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "BassTreble.h"
#include <math.h>
@ -28,11 +29,10 @@
#include <wx/sizer.h>
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../WaveTrack.h"
#include "../widgets/valnum.h"
#include "BassTreble.h"
enum
{
ID_Bass = 10000,

View File

@ -19,10 +19,10 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "Effect.h"
class ShuttleGui;
#define BASSTREBLE_PLUGIN_SYMBOL XO("Bass and Treble")
class EffectBassTreble : public Effect

View File

@ -19,6 +19,8 @@ the pitch without changing the tempo.
#if USE_SOUNDTOUCH
#include "ChangePitch.h"
#include <float.h>
#include <math.h>
@ -26,13 +28,12 @@ the pitch without changing the tempo.
#include <wx/valtext.h>
#include "../PitchName.h"
#include "../ShuttleGui.h"
#include "../Spectrum.h"
#include "../WaveTrack.h"
#include "../widgets/valnum.h"
#include "TimeWarper.h"
#include "ChangePitch.h"
enum {
ID_PercentChange = 10000,
ID_FromPitch,

View File

@ -27,10 +27,10 @@ the pitch without changing the tempo.
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "SoundTouchEffect.h"
class ShuttleGui;
#define CHANGEPITCH_PLUGIN_SYMBOL XO("Change Pitch")
class EffectChangePitch : public EffectSoundTouch

View File

@ -19,13 +19,14 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "../Track.h"
#include "../WaveTrack.h"
#include "../widgets/NumericTextCtrl.h"
#include "Effect.h"
class ShuttleGui;
#define CHANGESPEED_PLUGIN_SYMBOL XO("Change Speed")
class EffectChangeSpeed : public Effect

View File

@ -21,10 +21,10 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "SoundTouchEffect.h"
class ShuttleGui;
#define CHANGETEMPO_PLUGIN_SYMBOL XO("Change Tempo")
class EffectChangeTempo : public EffectSoundTouch

View File

@ -25,6 +25,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "ClickRemoval.h"
#include <math.h>
@ -33,10 +34,9 @@
#include <wx/valgen.h>
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
#include "ClickRemoval.h"
enum
{
ID_Thresh = 10000,

View File

@ -22,11 +22,12 @@
#include <wx/textctrl.h>
#include "../Envelope.h"
#include "../ShuttleGui.h"
#include "../WaveTrack.h"
#include "Effect.h"
class ShuttleGui;
#define CLICKREMOVAL_PLUGIN_SYMBOL XO("Click Removal")
class EffectClickRemoval : public Effect

View File

@ -25,6 +25,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "Compressor.h"
#include <math.h>
@ -36,11 +37,10 @@
#include "../AColor.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../float_cast.h"
#include "../widgets/Ruler.h"
#include "Compressor.h"
enum
{
ID_Threshold = 10000,

View File

@ -21,11 +21,10 @@
#include <wx/stattext.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "TwoPassSimpleMono.h"
class EffectCompressorPanel;
class ShuttleGui;
#define COMPRESSOR_PLUGIN_SYMBOL XO("Compressor")

View File

@ -10,15 +10,16 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "../AudacityApp.h"
#include "Contrast.h"
#include "../AudacityApp.h"
#include "../Envelope.h"
#include "../FFT.h"
#include "../WaveTrack.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../FileNames.h"
#include "../widgets/LinkingHtmlWindow.h"
#include "../widgets/HelpSystem.h"

View File

@ -15,6 +15,7 @@
class wxButton;
class wxSizer;
class wxString;
class wxTextCtrl;
class Envelope;
class NumericTextCtrl;

View File

@ -14,15 +14,16 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "DtmfGen.h"
#include <wx/intl.h>
#include <wx/valgen.h>
#include <wx/valtext.h>
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
#include "DtmfGen.h"
enum
{

View File

@ -19,11 +19,12 @@
#include <wx/stattext.h>
#include <wx/string.h>
#include "../ShuttleGui.h"
#include "../widgets/NumericTextCtrl.h"
#include "Effect.h"
class ShuttleGui;
#define DTMFTONES_PLUGIN_SYMBOL XO("DTMF Tones")
class EffectDtmf : public Effect

View File

@ -20,15 +20,15 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "Echo.h"
#include <float.h>
#include <wx/intl.h>
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
#include "Echo.h"
// Define keys, defaults, minimums, and maximums for the effect parameters
//
// Name Type Key Def Min Max Scale

View File

@ -16,10 +16,10 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "Effect.h"
class ShuttleGui;
#define ECHO_PLUGIN_SYMBOL XO("Echo")
class EffectEcho : public Effect

View File

@ -22,6 +22,7 @@ greater use in future.
*//*******************************************************************/
#include "../Audacity.h"
#include "Effect.h"
#include <wx/defs.h>
#include <wx/hashmap.h>
@ -36,11 +37,11 @@ greater use in future.
#include "audacity/ConfigInterface.h"
#include "Effect.h"
#include "../AudioIO.h"
#include "../Mix.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../WaveTrack.h"
#include "../toolbars/ControlToolBar.h"
#include "../widgets/AButton.h"
@ -724,6 +725,11 @@ wxString Effect::GetDurationFormat()
return mDurationFormat;
}
wxString Effect::GetSelectionFormat()
{
return GetActiveProject()->GetSelectionFormat();
}
void Effect::SetDuration(double seconds)
{
if (seconds < 0.0)

View File

@ -20,7 +20,10 @@
#include <wx/string.h>
#include <wx/tglbtn.h>
class wxCheckBox;
class wxChoice;
class wxDialog;
class wxListBox;
class wxWindow;
#include "audacity/ConfigInterface.h"
@ -30,10 +33,11 @@ class wxWindow;
#include "../WaveTrack.h"
#include "../SelectedRegion.h"
#include "../Shuttle.h"
#include "../ShuttleGui.h"
#include "../Internat.h"
#include "../widgets/ProgressDialog.h"
class ShuttleGui;
#define BUILTIN_EFFECT_PREFIX wxT("Built-in Effect: ")
class SelectedRegion;
@ -146,6 +150,7 @@ class AUDACITY_DLL_API Effect : public wxEvtHandler,
virtual double GetDefaultDuration();
virtual double GetDuration();
virtual wxString GetDurationFormat();
virtual wxString GetSelectionFormat(); // time format in Selection toolbar
virtual void SetDuration(double duration);
virtual bool Apply();

View File

@ -2804,7 +2804,8 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
memDC.SetPen(*wxBLACK_PEN);
if( mEffect->mDraw->GetValue() )
mEffect->mEnvelope->DrawPoints(memDC, mEnvRect, 0.0, mEnvRect.width-1, false, mEffect->mdBMin, mEffect->mdBMax);
mEffect->mEnvelope->DrawPoints(memDC, mEnvRect, ZoomInfo(0.0, 1.0, mEnvRect.width-1), false,
mEffect->mdBMin, mEffect->mdBMax);
dc.Blit(0, 0, mWidth, mHeight,
&memDC, 0, 0, wxCOPY, FALSE);
@ -2822,7 +2823,7 @@ void EqualizationPanel::OnMouseEvent(wxMouseEvent & event)
CaptureMouse();
}
if (mEffect->mEnvelope->MouseEvent(event, mEnvRect, 0.0, mEnvRect.width, false,
if (mEffect->mEnvelope->MouseEvent(event, mEnvRect, ZoomInfo(0.0, 1.0, mEnvRect.width), false,
mEffect->mdBMin, mEffect->mdBMax))
{
mEffect->EnvelopeUpdated();

View File

@ -20,16 +20,16 @@
#include "../Audacity.h"
#include "FindClipping.h"
#include <math.h>
#include <wx/intl.h>
#include "../AudacityApp.h"
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
#include "FindClipping.h"
// Define keys, defaults, minimums, and maximums for the effect parameters
//
// Name Type Key Def Min Max Scale

View File

@ -14,6 +14,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "Leveller.h"
#include <math.h>
@ -22,8 +23,7 @@
#include <wx/valgen.h>
#include "../Prefs.h"
#include "Leveller.h"
#include "../ShuttleGui.h"
enum kPasses
{

View File

@ -14,10 +14,10 @@
#include <wx/arrstr.h>
#include <wx/string.h>
#include "../ShuttleGui.h"
#include "Effect.h"
class ShuttleGui;
#define LEVELLER_PLUGIN_SYMBOL XO("Leveller")
class EffectLeveller : public Effect

View File

@ -14,6 +14,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "Noise.h"
#include <math.h>
@ -23,10 +24,9 @@
#include <wx/valgen.h>
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
#include "Noise.h"
enum kTypes
{
kWhite,

View File

@ -15,11 +15,12 @@
#include <wx/string.h>
#include "../ShuttleGui.h"
#include "../widgets/NumericTextCtrl.h"
#include "Effect.h"
class ShuttleGui;
#define NOISE_PLUGIN_SYMBOL XO("Noise")
class EffectNoise : public Effect

View File

@ -40,6 +40,7 @@
#include "../Experimental.h"
#include "NoiseReduction.h"
#include "../ShuttleGui.h"
#include "../Prefs.h"
#include <algorithm>

View File

@ -18,11 +18,12 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "../WaveTrack.h"
#include "Effect.h"
class ShuttleGui;
#define NORMALIZE_PLUGIN_SYMBOL XO("Normalize")
class EffectNormalize : public Effect

View File

@ -15,6 +15,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "Paulstretch.h"
#include <math.h>
#include <float.h>
@ -22,11 +23,10 @@
#include <wx/intl.h>
#include <wx/valgen.h>
#include "../ShuttleGui.h"
#include "../FFT.h"
#include "../widgets/valnum.h"
#include "Paulstretch.h"
// Define keys, defaults, minimums, and maximums for the effect parameters
//
// Name Type Key Def Min Max Scale

View File

@ -12,11 +12,12 @@
#include <wx/string.h>
#include "../ShuttleGui.h"
#include "../WaveTrack.h"
#include "Effect.h"
class ShuttleGui;
#define PAULSTRETCH_PLUGIN_SYMBOL XO("Paulstretch")
class EffectPaulstretch : public Effect

View File

@ -20,14 +20,15 @@
#include "../Audacity.h"
#include "Phaser.h"
#include <math.h>
#include <wx/intl.h>
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
#include "Phaser.h"
enum
{

View File

@ -21,10 +21,10 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "Effect.h"
class ShuttleGui;
#define NUM_STAGES 24
#define PHASER_PLUGIN_SYMBOL XO("Phaser")

View File

@ -38,7 +38,7 @@
// Define keys, defaults, minimums, and maximums for the effect parameters
//
// Name Type Key Def Min Max Scale
Param( Count, int, XO("Count"), 10, 1, INT_MAX, 1 );
Param( Count, int, XO("Count"), 1, 1, INT_MAX, 1 );
BEGIN_EVENT_TABLE(EffectRepeat, wxEvtHandler)
EVT_TEXT(wxID_ANY, EffectRepeat::OnRepeatTextChange)
@ -46,7 +46,7 @@ END_EVENT_TABLE()
EffectRepeat::EffectRepeat()
{
repeatCount = 10;
repeatCount = DEF_Count;
SetLinearEffectFlag(true);
}
@ -175,16 +175,17 @@ void EffectRepeat::PopulateOrExchange(ShuttleGui & S)
{
IntegerValidator<int> vldRepeatCount(&repeatCount);
vldRepeatCount.SetRange(MIN_Count, 2147483647 / mProjectRate);
mRepeatCount = S.AddTextBox(_("Number of times to repeat:"), wxT(""), 12);
mRepeatCount = S.AddTextBox(_("Number of repeats to add:"), wxT(""), 12);
mRepeatCount->SetValidator(vldRepeatCount);
}
S.EndHorizontalLay();
S.StartHorizontalLay(wxCENTER, true);
S.StartMultiColumn(1, wxCENTER);
{
mCurrentTime = S.AddVariableText(_("Current selection length: dd:hh:mm:ss"));
mTotalTime = S.AddVariableText(_("New selection length: dd:hh:mm:ss"));
}
S.EndHorizontalLay();
S.EndMultiColumn();
}
bool EffectRepeat::TransferDataToWindow()
@ -215,22 +216,32 @@ bool EffectRepeat::TransferDataFromWindow()
void EffectRepeat::DisplayNewTime()
{
long l;
wxString str;
mRepeatCount->GetValue().ToLong(&l);
if (l > 0)
{
NumericConverter nc(NumericConverter::TIME,
GetSelectionFormat(),
mT1 - mT0,
mProjectRate);
str = _("Current selection length: ") + nc.GetString();
mCurrentTime->SetLabel(str);
mCurrentTime->SetName(str); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
if (l > 0) {
EnableApply(true);
repeatCount = l;
NumericConverter nc(NumericConverter::TIME,
_("hh:mm:ss"),
(mT1 - mT0) * (repeatCount + 1),
mProjectRate);
wxString str = _("New selection length: ") + nc.GetString();
mTotalTime->SetLabel(str);
mTotalTime->SetName(str); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
nc.SetValue((mT1 - mT0) * (repeatCount + 1));
str = _("New selection length: ") + nc.GetString();
}
else {
str = _("Warning: No repeats.");
EnableApply(false);
}
mTotalTime->SetLabel(str);
mTotalTime->SetName(str); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
}
void EffectRepeat::OnRepeatTextChange(wxCommandEvent & WXUNUSED(evt))

View File

@ -16,10 +16,10 @@
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "Effect.h"
class ShuttleGui;
#define REPEAT_PLUGIN_SYMBOL XO("Repeat")
class EffectRepeat : public Effect
@ -59,6 +59,7 @@ private:
int repeatCount;
wxTextCtrl *mRepeatCount;
wxStaticText *mCurrentTime;
wxStaticText *mTotalTime;
DECLARE_EVENT_TABLE();

View File

@ -15,16 +15,17 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "Reverb.h"
#include <wx/arrstr.h>
#include <wx/intl.h>
#include "../Audacity.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
#include "Reverb_libSoX.h"
#include "Reverb.h"
enum
{

View File

@ -18,10 +18,10 @@
#include <wx/spinctrl.h>
#include <wx/string.h>
#include "../ShuttleGui.h"
#include "Effect.h"
class ShuttleGui;
#define REVERB_PLUGIN_SYMBOL XO("Reverb")
struct Reverb_priv_t;

View File

@ -33,6 +33,7 @@ a graph for EffectScienFilter.
*//*******************************************************************/
#include "../Audacity.h"
#include "ScienFilter.h"
#include <math.h>
#include <float.h>
@ -50,12 +51,12 @@ a graph for EffectScienFilter.
#include "../PlatformCompatibility.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../Theme.h"
#include "../WaveTrack.h"
#include "../widgets/valnum.h"
#include "Equalization.h" // For SliderAx
#include "ScienFilter.h"
#if !defined(M_PI)
#define PI = 3.1415926535897932384626433832795

View File

@ -23,12 +23,14 @@ Vaughan Johnson (Preview)
#include <wx/string.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "../widgets/Ruler.h"
#include "Biquad.h"
#include "Effect.h"
class wxTextCtrl;
class ShuttleGui;
#define CLASSICFILTERS_PLUGIN_SYMBOL XO("Classic Filters")
class EffectScienFilterPanel;

View File

@ -14,10 +14,11 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "Silence.h"
#include <wx/intl.h>
#include "Silence.h"
#include "../ShuttleGui.h"
EffectSilence::EffectSilence()
{

View File

@ -17,13 +17,15 @@
#if USE_SBSMS
#include "TimeScale.h"
#include <math.h>
#include <wx/intl.h>
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
#include "TimeScale.h"
#include "sbsms.h"
enum

View File

@ -20,10 +20,10 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "SBSMSEffect.h"
class ShuttleGui;
#define TIMESCALE_PLUGIN_SYMBOL XO("Time Scale")
class EffectTimeScale : public EffectSBSMS

View File

@ -19,6 +19,7 @@ frequency changes smoothly during the tone.
*//*******************************************************************/
#include "../Audacity.h"
#include "ToneGen.h"
#include <math.h>
#include <float.h>
@ -27,11 +28,10 @@ frequency changes smoothly during the tone.
#include <wx/valgen.h>
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../widgets/NumericTextCtrl.h"
#include "../widgets/valnum.h"
#include "ToneGen.h"
enum kInterpolations
{
kLinear,

View File

@ -16,11 +16,12 @@
#include <wx/arrstr.h>
#include <wx/string.h>
#include "../ShuttleGui.h"
#include "../widgets/NumericTextCtrl.h"
#include "Effect.h"
class ShuttleGui;
#define CHIRP_PLUGIN_SYMBOL XO("Chirp")
#define TONE_PLUGIN_SYMBOL XO("Tone")

View File

@ -16,6 +16,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "TruncSilence.h"
#include <limits>
#include <math.h>
@ -23,11 +24,10 @@
#include <wx/valgen.h>
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../WaveTrack.h"
#include "../widgets/valnum.h"
#include "TruncSilence.h"
enum kActions
{
kTruncate,

View File

@ -24,10 +24,10 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "Effect.h"
class ShuttleGui;
#define TRUNCATESILENCE_PLUGIN_SYMBOL XO("Truncate Silence")
// Declaration of RegionList

View File

@ -19,15 +19,15 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "Wahwah.h"
#include <math.h>
#include <wx/intl.h>
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
#include "Wahwah.h"
enum
{
ID_Freq = 10000,

View File

@ -21,10 +21,10 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "Effect.h"
class ShuttleGui;
#define WAHWAH_PLUGIN_SYMBOL XO("Wahwah")
class EffectWahwah : public Effect

View File

@ -37,6 +37,7 @@
#include <wx/version.h>
#include "../../ShuttleGui.h"
#include "../../widgets/valnum.h"
enum

View File

@ -28,6 +28,9 @@
*//********************************************************************/
#include "../Audacity.h"
#include "Export.h"
#include <wx/dynarray.h>
#include <wx/file.h>
#include <wx/filename.h>
@ -43,7 +46,6 @@
#include <wx/dcmemory.h>
#include <wx/window.h>
#include "Export.h"
#include "ExportPCM.h"
#include "ExportMP3.h"
#include "ExportOGG.h"
@ -56,7 +58,6 @@
#include "FileDialog.h"
#include "../Audacity.h"
#include "../DirManager.h"
#include "../FileFormats.h"
#include "../Internat.h"
@ -64,6 +65,7 @@
#include "../Mix.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../Track.h"
#include "../WaveTrack.h"
#include "../widgets/Warning.h"

View File

@ -12,6 +12,7 @@
**********************************************************************/
#include "../Audacity.h"
#include "ExportCL.h"
#include "../Project.h"
#include <wx/button.h>
@ -23,10 +24,10 @@
#include <wx/textctrl.h>
#include <FileDialog.h>
#include "Export.h"
#include "ExportCL.h"
#include "../Mix.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../Internat.h"
#include "../float_cast.h"
#include "../widgets/FileHistory.h"

View File

@ -22,8 +22,8 @@ and libvorbis examples, Monty <monty@xiph.org>
#ifdef USE_LIBFLAC
#include "Export.h"
#include "ExportFLAC.h"
#include "Export.h"
#include <wx/progdlg.h>
#include <wx/ffile.h>
@ -36,6 +36,7 @@ and libvorbis examples, Monty <monty@xiph.org>
#include "../Project.h"
#include "../Mix.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../Internat.h"
#include "../Tags.h"

View File

@ -33,6 +33,7 @@
*/
#include "../Audacity.h"
#include "ExportMP2.h"
#ifdef USE_LIBTWOLAME
@ -47,12 +48,12 @@
#include <wx/intl.h>
#include "Export.h"
#include "ExportMP2.h"
#include "../FileIO.h"
#include "../Internat.h"
#include "../Mix.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../Tags.h"
#include "../WaveTrack.h"

View File

@ -59,6 +59,9 @@
*//********************************************************************/
#include "../Audacity.h"
#include "ExportMP3.h"
#include <wx/defs.h>
#include <wx/choice.h>
@ -75,13 +78,13 @@
#include <wx/utils.h>
#include <wx/window.h>
#include "../Audacity.h"
#include "../FileNames.h"
#include "../float_cast.h"
#include "../Internat.h"
#include "../Mix.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../Tags.h"
#include "../WaveTrack.h"
#include "../widgets/LinkingHtmlWindow.h"
@ -89,7 +92,6 @@
#include "FileDialog.h"
#include "Export.h"
#include "ExportMP3.h"
#include <lame/lame.h>

View File

@ -16,6 +16,7 @@
*//********************************************************************/
#include "../Audacity.h"
#include "ExportMultiple.h"
#include <wx/defs.h>
#include <wx/button.h>
@ -38,7 +39,6 @@
#include <wx/textdlg.h>
#include "Export.h"
#include "ExportMultiple.h"
#include "../Internat.h"
#include "../FileFormats.h"
@ -46,6 +46,7 @@
#include "../LabelTrack.h"
#include "../Project.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../Tags.h"
#include "../widgets/HelpSystem.h"

View File

@ -19,8 +19,8 @@
#ifdef USE_LIBVORBIS
#include "Export.h"
#include "ExportOGG.h"
#include "Export.h"
#include <wx/log.h>
#include <wx/msgdlg.h>
@ -32,6 +32,7 @@
#include "../Project.h"
#include "../Mix.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../Internat.h"
#include "../Tags.h"

View File

@ -8,6 +8,9 @@
**********************************************************************/
#include "../Audacity.h"
#include "ExportPCM.h"
#include <wx/defs.h>
#include <wx/choice.h>
@ -23,20 +26,19 @@
#include "sndfile.h"
#include "../Audacity.h"
#include "../FileFormats.h"
#include "../Internat.h"
#include "../LabelTrack.h"
#include "../Mix.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../Tags.h"
#include "../Track.h"
#include "../WaveTrack.h"
#include "../ondemand/ODManager.h"
#include "Export.h"
#include "ExportPCM.h"
#ifdef USE_LIBID3TAG
#include <id3tag.h>

View File

@ -70,6 +70,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "ImportLOF.h"
#include <wx/string.h>
#include <wx/utils.h>
@ -78,7 +79,6 @@
#include <wx/msgdlg.h>
#include <wx/tokenzr.h>
#include "ImportLOF.h"
#ifdef USE_MIDI
#include "ImportMIDI.h"
#endif // USE_MIDI
@ -485,8 +485,7 @@ void LOFImportFileHandle::doDuration()
if (callDurationFactor)
{
double longestDuration = mProject->GetTracks()->GetEndTime();
double realZoomValue = ((longestDuration/durationFactor)*(mProject->GetZoom()));
mProject->Zoom(realZoomValue);
mProject->ZoomBy(longestDuration / durationFactor);
callDurationFactor = false;
}
}

View File

@ -16,10 +16,10 @@
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class ShuttleGui;
class BatchPrefs : public PrefsPanel
{
public:

View File

@ -19,11 +19,11 @@
#include <wx/window.h>
#include <wx/dynarray.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class DevicePrefs:public PrefsPanel
class ShuttleGui;
class DevicePrefs :public PrefsPanel
{
public:
DevicePrefs(wxWindow * parent);

View File

@ -14,11 +14,11 @@
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class DirectoriesPrefs:public PrefsPanel
class ShuttleGui;
class DirectoriesPrefs :public PrefsPanel
{
public:
DirectoriesPrefs(wxWindow * parent);

View File

@ -18,11 +18,11 @@
#include <wx/arrstr.h>
#include <wx/window.h>
#include "../ShuttleGui.h"
#include "PrefsPanel.h"
class EffectsPrefs:public PrefsPanel
class ShuttleGui;
class EffectsPrefs :public PrefsPanel
{
public:
EffectsPrefs(wxWindow * parent);

Some files were not shown because too many files have changed in this diff Show More