mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 16:48:44 +02:00
Merge branch 'master' into temp
This commit is contained in:
commit
2e156f64d5
10
locale/da.po
10
locale/da.po
@ -9,7 +9,7 @@ msgstr ""
|
||||
"Project-Id-Version: Audacity 2.1.2\n"
|
||||
"Report-Msgid-Bugs-To: audacity-translation@lists.sourceforge.net\n"
|
||||
"POT-Creation-Date: 2015-09-07 12:40+0100\n"
|
||||
"PO-Revision-Date: 2016-04-08 00:00+0100\n"
|
||||
"PO-Revision-Date: 2016-06-15 00:00+0100\n"
|
||||
"Last-Translator: scootergrisen\n"
|
||||
"Language-Team: Danish\n"
|
||||
"Language: da\n"
|
||||
@ -9377,7 +9377,7 @@ msgstr ""
|
||||
#: src/export/ExportFFmpeg.cpp:273
|
||||
#, c-format
|
||||
msgid "FFmpeg : ERROR - Can't determine format description for file \"%s\"."
|
||||
msgstr "FFmpeg : FEJL - kan ikke aflæse formatbeskrivelse for filen \"%s\"."
|
||||
msgstr "FFmpeg : FEJL - kan ikke fastslå formatbeskrivelse for filen \"%s\"."
|
||||
|
||||
#: src/export/ExportFFmpeg.cpp:274 src/export/ExportFFmpeg.cpp:282
|
||||
#: src/export/ExportFFmpeg.cpp:294 src/export/ExportFFmpeg.cpp:306
|
||||
@ -9617,7 +9617,7 @@ msgstr "Fuld søgning"
|
||||
|
||||
#: src/export/ExportFFmpegDialogs.cpp:1295
|
||||
msgid "Log search"
|
||||
msgstr "Bevar søgning"
|
||||
msgstr "Logsøgning"
|
||||
|
||||
#: src/export/ExportFFmpegDialogs.cpp:1307
|
||||
msgid "Configure custom FFmpeg options"
|
||||
@ -9837,8 +9837,8 @@ msgid ""
|
||||
"Full search - default"
|
||||
msgstr ""
|
||||
"Metode til forudsigelse af rækkefølge\n"
|
||||
"Vurdér - hurtigst, lavest komprimering\n"
|
||||
"Søg i log - langsomst, bedst komprimering\n"
|
||||
"Anslået - hurtigst, lavere komprimering\n"
|
||||
"Logsøgning - langsomst, bedste komprimering\n"
|
||||
"Fuld søgning - standard"
|
||||
|
||||
#: src/export/ExportFFmpegDialogs.cpp:1496
|
||||
|
4374
locale/uk.po
4374
locale/uk.po
File diff suppressed because it is too large
Load Diff
@ -37,6 +37,8 @@ http://forum.audacityteam.org/viewtopic.php?p=303835#p303835 .
|
||||
cd wxWidgets-3.0.2
|
||||
patch -p0 -i <path to Audacity source>/mac/wxMac_additions/wxMac-3.0.2-fixes.patch .
|
||||
patch -p0 -i <path to Audacity source>/mac/wxMac_additions/eventloops.patch .
|
||||
patch -p0 -i <path to Audacity source>/mac/wxMac_additions/pinch-spread.patch .
|
||||
patch -p0 -i <path to Audacity source>/mac/wxMac_additions/focusrings.patch .
|
||||
|
||||
10) And finally build/install wxWidgets:
|
||||
|
||||
|
123
mac/wxMac_additions/focusrings.patch
Normal file
123
mac/wxMac_additions/focusrings.patch
Normal file
@ -0,0 +1,123 @@
|
||||
From 148b0ed936b023b9b87d7703ecb86c4279f1182a Mon Sep 17 00:00:00 2001
|
||||
From: Paul Licameli <paul.licameli@audacityteam.org>
|
||||
Date: Wed, 6 Jul 2016 14:18:17 -0400
|
||||
Subject: [PATCH 2/2] Focus rings are back for buttons, choice, listbox,
|
||||
dateTimePicker controls
|
||||
|
||||
---
|
||||
include/wx/button.h | 2 ++
|
||||
include/wx/choice.h | 2 ++
|
||||
include/wx/datetimectrl.h | 2 ++
|
||||
include/wx/listbox.h | 2 ++
|
||||
include/wx/window.h | 2 ++
|
||||
src/osx/cocoa/window.mm | 22 +++++++++++++++++++++-
|
||||
6 files changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/wx/button.h b/include/wx/button.h
|
||||
index 71dbee4..6aa75d3 100644
|
||||
--- include/wx/button.h
|
||||
+++ include/wx/button.h
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
// returns the default button size for this platform
|
||||
static wxSize GetDefaultSize();
|
||||
|
||||
+ virtual bool NeedsFocusRing() const { return true; }
|
||||
+
|
||||
protected:
|
||||
wxDECLARE_NO_COPY_CLASS(wxButtonBase);
|
||||
};
|
||||
diff --git a/include/wx/choice.h b/include/wx/choice.h
|
||||
index 3a848f9..421a9a7 100644
|
||||
--- include/wx/choice.h
|
||||
+++ include/wx/choice.h
|
||||
@@ -57,6 +57,8 @@ public:
|
||||
// override wxItemContainer::IsSorted
|
||||
virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
|
||||
|
||||
+ virtual bool NeedsFocusRing() const { return true; }
|
||||
+
|
||||
protected:
|
||||
// The generic implementation doesn't determine the height correctly and
|
||||
// doesn't account for the width of the arrow but does take into account
|
||||
diff --git a/include/wx/datetimectrl.h b/include/wx/datetimectrl.h
|
||||
index 30f23df..d51c6c1 100644
|
||||
--- include/wx/datetimectrl.h
|
||||
+++ include/wx/datetimectrl.h
|
||||
@@ -32,6 +32,8 @@ public:
|
||||
// Set/get the date or time (in the latter case, time part is ignored).
|
||||
virtual void SetValue(const wxDateTime& dt) = 0;
|
||||
virtual wxDateTime GetValue() const = 0;
|
||||
+
|
||||
+ virtual bool NeedsFocusRing() const { return true; }
|
||||
};
|
||||
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
||||
diff --git a/include/wx/listbox.h b/include/wx/listbox.h
|
||||
index afb0220..b9d47f0 100644
|
||||
--- include/wx/listbox.h
|
||||
+++ include/wx/listbox.h
|
||||
@@ -94,6 +94,8 @@ public:
|
||||
int HitTest(const wxPoint& point) const { return DoListHitTest(point); }
|
||||
int HitTest(int x, int y) const { return DoListHitTest(wxPoint(x, y)); }
|
||||
|
||||
+ virtual bool NeedsFocusRing() const { return true; }
|
||||
+
|
||||
|
||||
protected:
|
||||
virtual void DoSetFirstItem(int n) = 0;
|
||||
diff --git a/include/wx/window.h b/include/wx/window.h
|
||||
index 7dffad4..bbe727d 100644
|
||||
--- include/wx/window.h
|
||||
+++ include/wx/window.h
|
||||
@@ -260,6 +260,8 @@ public:
|
||||
// moving/resizing
|
||||
// ---------------
|
||||
|
||||
+ virtual bool NeedsFocusRing() const { return false; }
|
||||
+
|
||||
// set the window size and/or position
|
||||
void SetSize( int x, int y, int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO )
|
||||
diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm
|
||||
index d9fa4ae..881d0e9 100644
|
||||
--- src/osx/cocoa/window.mm
|
||||
+++ src/osx/cocoa/window.mm
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/radiobut.h"
|
||||
+ #include "wx/button.h"
|
||||
#endif
|
||||
|
||||
#ifdef __WXMAC__
|
||||
@@ -1660,7 +1661,26 @@ void wxWidgetCocoaImpl::drawRect(void* rect, WXWidget slf, void *WXUNUSED(_cmd))
|
||||
// call super
|
||||
SEL _cmd = @selector(drawRect:);
|
||||
wxOSX_DrawRectHandlerPtr superimpl = (wxOSX_DrawRectHandlerPtr) [[slf superclass] instanceMethodForSelector:_cmd];
|
||||
- superimpl(slf, _cmd, *(NSRect*)rect);
|
||||
+
|
||||
+ wxWindow *peer = GetWXPeer();
|
||||
+ bool hasFocus = peer->HasFocus();
|
||||
+ if (hasFocus &&
|
||||
+ peer->NeedsFocusRing()) {
|
||||
+ superimpl(slf, _cmd, *(NSRect*)rect);
|
||||
+
|
||||
+ // Paint it again, without text, causing focus halo to be
|
||||
+ // superimposed about all else
|
||||
+ HIThemeBeginFocus( context, kHIThemeFocusRingOnly, NULL );
|
||||
+ CGContextSetTextDrawingMode( context, kCGTextInvisible );
|
||||
+ superimpl(slf, _cmd, *(NSRect*)rect);
|
||||
+ HIThemeEndFocus( context );
|
||||
+
|
||||
+ CGContextRestoreGState( context );
|
||||
+ CGContextSaveGState( context );
|
||||
+ }
|
||||
+ else
|
||||
+ superimpl(slf, _cmd, *(NSRect*)rect);
|
||||
+
|
||||
CGContextRestoreGState( context );
|
||||
CGContextSaveGState( context );
|
||||
}
|
||||
--
|
||||
2.3.2 (Apple Git-55)
|
||||
|
206
mac/wxMac_additions/pinch-spread.patch
Normal file
206
mac/wxMac_additions/pinch-spread.patch
Normal file
@ -0,0 +1,206 @@
|
||||
From 74a186065ad04a1ed3d43baeccec9083910ec623 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Licameli <paul.licameli@audacityteam.org>
|
||||
Date: Sun, 3 Jul 2016 10:16:12 -0400
|
||||
Subject: [PATCH 1/2] Add wxEVT_MAGNIFY mouse event.
|
||||
|
||||
Currently this is implemented for wxOSX only.
|
||||
|
||||
Closes #14322.
|
||||
|
||||
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
|
||||
---
|
||||
docs/changes.txt | 1 +
|
||||
include/wx/event.h | 9 ++++++++-
|
||||
interface/wx/event.h | 29 +++++++++++++++++++++++++++++
|
||||
src/common/event.cpp | 4 ++++
|
||||
src/osx/cocoa/window.mm | 10 ++++++++++
|
||||
5 files changed, 52 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/docs/changes.txt b/docs/changes.txt
|
||||
index 72e7d42..6436bfb 100644
|
||||
--- docs/changes.txt
|
||||
+++ docs/changes.txt
|
||||
@@ -585,6 +585,7 @@ All:
|
||||
|
||||
All (GUI):
|
||||
|
||||
+- Add wxEVT_MAGNIFY mouse event (Joost Nieuwenhuijse).
|
||||
- Add wxGenericListCtrl::EndEditLabel() (Tim Kosse).
|
||||
- Implement bounding box computation in wxGCDC (Toni Ruža).
|
||||
- Fix saving GIF animations with 2.5s+ delays between frames (elvissteinjr).
|
||||
diff --git a/include/wx/event.h b/include/wx/event.h
|
||||
index 61ec19c..26af365 100644
|
||||
--- include/wx/event.h
|
||||
+++ include/wx/event.h
|
||||
@@ -716,6 +716,7 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DCLICK, wxMouseEvent);
|
||||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent);
|
||||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent);
|
||||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent);
|
||||
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAGNIFY, wxMouseEvent);
|
||||
|
||||
// Character input event type
|
||||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent);
|
||||
@@ -1751,6 +1752,8 @@ public:
|
||||
bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_DCLICK); }
|
||||
bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_DCLICK); }
|
||||
|
||||
+ bool Magnify() const { return (m_eventType == wxEVT_MAGNIFY); }
|
||||
+
|
||||
// True if a button is down and the mouse is moving
|
||||
bool Dragging() const
|
||||
{
|
||||
@@ -1805,6 +1808,7 @@ public:
|
||||
// Is the system set to do page scrolling?
|
||||
bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); }
|
||||
|
||||
+ float GetMagnification() const { return m_magnification; }
|
||||
virtual wxEvent *Clone() const { return new wxMouseEvent(*this); }
|
||||
virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; }
|
||||
|
||||
@@ -1823,6 +1827,7 @@ public:
|
||||
int m_wheelDelta;
|
||||
int m_linesPerAction;
|
||||
int m_columnsPerAction;
|
||||
+ float m_magnification;
|
||||
|
||||
protected:
|
||||
void Assign(const wxMouseEvent& evt);
|
||||
@@ -4218,6 +4223,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&
|
||||
#define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func))
|
||||
#define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func))
|
||||
#define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func))
|
||||
+#define EVT_MAGNIFY(func) wx__DECLARE_EVT0(wxEVT_MAGNIFY, wxMouseEventHandler(func))
|
||||
|
||||
// All mouse events
|
||||
#define EVT_MOUSE_EVENTS(func) \
|
||||
@@ -4239,7 +4245,8 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&
|
||||
EVT_MOTION(func) \
|
||||
EVT_LEAVE_WINDOW(func) \
|
||||
EVT_ENTER_WINDOW(func) \
|
||||
- EVT_MOUSEWHEEL(func)
|
||||
+ EVT_MOUSEWHEEL(func) \
|
||||
+ EVT_MAGNIFY(func)
|
||||
|
||||
// Scrolling from wxWindow (sent to wxScrolledWindow)
|
||||
#define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func))
|
||||
diff --git a/interface/wx/event.h b/interface/wx/event.h
|
||||
index 52bb609..7fe007a 100644
|
||||
--- interface/wx/event.h
|
||||
+++ interface/wx/event.h
|
||||
@@ -2626,6 +2626,8 @@ enum wxMouseWheelAxis
|
||||
Process a @c wxEVT_MOUSEWHEEL event.
|
||||
@event{EVT_MOUSE_EVENTS(func)}
|
||||
Process all mouse events.
|
||||
+ @event{EVT_MAGNIFY(func)}
|
||||
+ Process a @c wxEVT_MAGNIFY event (new since wxWidgets 3.1.0).
|
||||
@endEventTable
|
||||
|
||||
@library{wxcore}
|
||||
@@ -2659,6 +2661,7 @@ public:
|
||||
@li @c wxEVT_AUX2_DCLICK
|
||||
@li @c wxEVT_MOTION
|
||||
@li @c wxEVT_MOUSEWHEEL
|
||||
+ @li @c wxEVT_MAGNIFY
|
||||
*/
|
||||
wxMouseEvent(wxEventType mouseEventType = wxEVT_NULL);
|
||||
|
||||
@@ -2785,6 +2788,21 @@ public:
|
||||
wxPoint GetLogicalPosition(const wxDC& dc) const;
|
||||
|
||||
/**
|
||||
+ For magnify (pinch to zoom) events: returns the change in magnification.
|
||||
+
|
||||
+ A value of 0 means no change, a positive value means we should enlarge
|
||||
+ (or zoom in), a negative value means we should shrink (or zoom out).
|
||||
+
|
||||
+ This method is only valid to call for @c wxEVT_MAGNIFY events which are
|
||||
+ currently only generated under OS X.
|
||||
+
|
||||
+ @see Magnify()
|
||||
+
|
||||
+ @since 3.1.0
|
||||
+ */
|
||||
+ float GetMagnification() const;
|
||||
+
|
||||
+ /**
|
||||
Get wheel delta, normally 120.
|
||||
|
||||
This is the threshold for action to be taken, and one such action
|
||||
@@ -2851,6 +2869,17 @@ public:
|
||||
bool LeftUp() const;
|
||||
|
||||
/**
|
||||
+ Returns @true if the event is a magnify (i.e.\ pinch to zoom) event.
|
||||
+
|
||||
+ Such events are currently generated only under OS X.
|
||||
+
|
||||
+ @see GetMagnification()
|
||||
+
|
||||
+ @since 3.1.0
|
||||
+ */
|
||||
+ bool Magnify() const;
|
||||
+
|
||||
+ /**
|
||||
Returns @true if the Meta key was down at the time of the event.
|
||||
*/
|
||||
bool MetaDown() const;
|
||||
diff --git a/src/common/event.cpp b/src/common/event.cpp
|
||||
index d92a4ac..1015c84 100644
|
||||
--- src/common/event.cpp
|
||||
+++ src/common/event.cpp
|
||||
@@ -208,6 +208,7 @@ wxDEFINE_EVENT( wxEVT_AUX1_DCLICK, wxMouseEvent );
|
||||
wxDEFINE_EVENT( wxEVT_AUX2_DOWN, wxMouseEvent );
|
||||
wxDEFINE_EVENT( wxEVT_AUX2_UP, wxMouseEvent );
|
||||
wxDEFINE_EVENT( wxEVT_AUX2_DCLICK, wxMouseEvent );
|
||||
+wxDEFINE_EVENT( wxEVT_MAGNIFY, wxMouseEvent );
|
||||
|
||||
// Character input event type
|
||||
wxDEFINE_EVENT( wxEVT_CHAR, wxKeyEvent );
|
||||
@@ -576,6 +577,7 @@ wxMouseEvent::wxMouseEvent(wxEventType commandType)
|
||||
m_wheelDelta = 0;
|
||||
m_linesPerAction = 0;
|
||||
m_columnsPerAction = 0;
|
||||
+ m_magnification = 0.0f;
|
||||
}
|
||||
|
||||
void wxMouseEvent::Assign(const wxMouseEvent& event)
|
||||
@@ -600,6 +602,8 @@ void wxMouseEvent::Assign(const wxMouseEvent& event)
|
||||
m_linesPerAction = event.m_linesPerAction;
|
||||
m_columnsPerAction = event.m_columnsPerAction;
|
||||
m_wheelAxis = event.m_wheelAxis;
|
||||
+
|
||||
+ m_magnification = event.m_magnification;
|
||||
}
|
||||
|
||||
// return true if was a button dclick event
|
||||
diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm
|
||||
index ede8ebf..d9fa4ae 100644
|
||||
--- src/osx/cocoa/window.mm
|
||||
+++ src/osx/cocoa/window.mm
|
||||
@@ -741,6 +741,12 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
|
||||
case NSMouseMoved :
|
||||
wxevent.SetEventType( wxEVT_MOTION ) ;
|
||||
break;
|
||||
+
|
||||
+ case NSEventTypeMagnify:
|
||||
+ wxevent.SetEventType( wxEVT_MAGNIFY );
|
||||
+ wxevent.m_magnification = [nsEvent magnification];
|
||||
+ break;
|
||||
+
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
@@ -1772,6 +1778,10 @@ void wxOSXCocoaClassAddWXMethods(Class c)
|
||||
wxOSX_CLASS_ADD_METHOD(c, @selector(scrollWheel:), (IMP) wxOSX_mouseEvent, "v@:@" )
|
||||
wxOSX_CLASS_ADD_METHOD(c, @selector(mouseEntered:), (IMP) wxOSX_mouseEvent, "v@:@" )
|
||||
wxOSX_CLASS_ADD_METHOD(c, @selector(mouseExited:), (IMP) wxOSX_mouseEvent, "v@:@" )
|
||||
+
|
||||
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
+ wxOSX_CLASS_ADD_METHOD(c, @selector(magnifyWithEvent:), (IMP)wxOSX_mouseEvent, "v@:@")
|
||||
+#endif
|
||||
|
||||
wxOSX_CLASS_ADD_METHOD(c, @selector(cursorUpdate:), (IMP) wxOSX_cursorUpdate, "v@:@" )
|
||||
|
||||
--
|
||||
2.3.2 (Apple Git-55)
|
||||
|
@ -107,10 +107,6 @@
|
||||
// Paul Licameli (PRL) 29 Nov 2014
|
||||
// #define EXPERIMENTAL_IMPROVED_SEEKING
|
||||
|
||||
// Philip Van Baren 01 July 2009
|
||||
// Replace RealFFT() and PowerSpectrum function to use (faster) RealFFTf function
|
||||
#define EXPERIMENTAL_USE_REALFFTF
|
||||
|
||||
// RBD, 1 Sep 2008
|
||||
// Enables MIDI Output of NoteTrack (MIDI) data during playback
|
||||
// USE_MIDI must be defined in order for EXPERIMENTAL_MIDI_OUT to work
|
||||
|
164
src/FFT.cpp
164
src/FFT.cpp
@ -46,6 +46,7 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "RealFFTf.h"
|
||||
#include "Experimental.h"
|
||||
|
||||
static int **gFFTBitTable = NULL;
|
||||
@ -110,10 +111,6 @@ void InitFFT()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
#include "RealFFTf.h"
|
||||
#endif
|
||||
|
||||
void DeinitFFT()
|
||||
{
|
||||
if (gFFTBitTable) {
|
||||
@ -122,10 +119,8 @@ void DeinitFFT()
|
||||
}
|
||||
delete[] gFFTBitTable;
|
||||
}
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
// Deallocate any unused RealFFTf tables
|
||||
CleanupFFT();
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int FastReverseBits(int i, int NumBits)
|
||||
@ -142,7 +137,8 @@ inline int FastReverseBits(int i, int NumBits)
|
||||
|
||||
void FFT(int NumSamples,
|
||||
bool InverseTransform,
|
||||
float *RealIn, float *ImagIn, float *RealOut, float *ImagOut)
|
||||
const float *RealIn, const float *ImagIn,
|
||||
float *RealOut, float *ImagOut)
|
||||
{
|
||||
int NumBits; /* Number of bits needed to store indices */
|
||||
int i, j, k, n;
|
||||
@ -238,22 +234,11 @@ void FFT(int NumSamples,
|
||||
/*
|
||||
* Real Fast Fourier Transform
|
||||
*
|
||||
* This function was based on the code in Numerical Recipes in C.
|
||||
* In Num. Rec., the inner loop is based on a single 1-based array
|
||||
* of interleaved real and imaginary numbers. Because we have two
|
||||
* separate zero-based arrays, our indices are quite different.
|
||||
* Here is the correspondence between Num. Rec. indices and our indices:
|
||||
*
|
||||
* i1 <-> real[i]
|
||||
* i2 <-> imag[i]
|
||||
* i3 <-> real[n/2-i]
|
||||
* i4 <-> imag[n/2-i]
|
||||
* This is merely a wrapper of RealFFTf() from RealFFTf.h.
|
||||
*/
|
||||
|
||||
void RealFFT(int NumSamples, float *RealIn, float *RealOut, float *ImagOut)
|
||||
void RealFFT(int NumSamples, const float *RealIn, float *RealOut, float *ImagOut)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
// Remap to RealFFTf() function
|
||||
int i;
|
||||
HFFT hFFT = GetFFT(NumSamples);
|
||||
float *pFFT = new float[NumSamples];
|
||||
@ -280,62 +265,8 @@ void RealFFT(int NumSamples, float *RealIn, float *RealOut, float *ImagOut)
|
||||
}
|
||||
delete [] pFFT;
|
||||
ReleaseFFT(hFFT);
|
||||
|
||||
#else
|
||||
|
||||
int Half = NumSamples / 2;
|
||||
int i;
|
||||
|
||||
float theta = M_PI / Half;
|
||||
|
||||
float *tmpReal = new float[Half];
|
||||
float *tmpImag = new float[Half];
|
||||
|
||||
for (i = 0; i < Half; i++) {
|
||||
tmpReal[i] = RealIn[2 * i];
|
||||
tmpImag[i] = RealIn[2 * i + 1];
|
||||
}
|
||||
|
||||
FFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);
|
||||
|
||||
float wtemp = float (sin(0.5 * theta));
|
||||
|
||||
float wpr = -2.0 * wtemp * wtemp;
|
||||
float wpi = -1.0 * float (sin(theta));
|
||||
float wr = 1.0 + wpr;
|
||||
float wi = wpi;
|
||||
|
||||
int i3;
|
||||
|
||||
float h1r, h1i, h2r, h2i;
|
||||
|
||||
for (i = 1; i < Half / 2; i++) {
|
||||
|
||||
i3 = Half - i;
|
||||
|
||||
h1r = 0.5 * (RealOut[i] + RealOut[i3]);
|
||||
h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);
|
||||
h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);
|
||||
h2i = -0.5 * (RealOut[i] - RealOut[i3]);
|
||||
|
||||
RealOut[i] = h1r + wr * h2r - wi * h2i;
|
||||
ImagOut[i] = h1i + wr * h2i + wi * h2r;
|
||||
RealOut[i3] = h1r - wr * h2r + wi * h2i;
|
||||
ImagOut[i3] = -h1i + wr * h2i + wi * h2r;
|
||||
|
||||
wr = (wtemp = wr) * wpr - wi * wpi + wr;
|
||||
wi = wi * wpr + wtemp * wpi + wi;
|
||||
}
|
||||
|
||||
RealOut[0] = (h1r = RealOut[0]) + ImagOut[0];
|
||||
ImagOut[0] = h1r - ImagOut[0];
|
||||
|
||||
delete[]tmpReal;
|
||||
delete[]tmpImag;
|
||||
#endif //EXPERIMENTAL_USE_REALFFTF
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
/*
|
||||
* InverseRealFFT
|
||||
*
|
||||
@ -344,10 +275,12 @@ void RealFFT(int NumSamples, float *RealIn, float *RealOut, float *ImagOut)
|
||||
* and as a result the output is purely real.
|
||||
* Only the first half of RealIn and ImagIn are used due to this
|
||||
* symmetry assumption.
|
||||
*
|
||||
* This is merely a wrapper of InverseRealFFTf() from RealFFTf.h.
|
||||
*/
|
||||
void InverseRealFFT(int NumSamples, float *RealIn, float *ImagIn, float *RealOut)
|
||||
void InverseRealFFT(int NumSamples, const float *RealIn, const float *ImagIn,
|
||||
float *RealOut)
|
||||
{
|
||||
// Remap to RealFFTf() function
|
||||
int i;
|
||||
HFFT hFFT = GetFFT(NumSamples);
|
||||
float *pFFT = new float[NumSamples];
|
||||
@ -373,24 +306,20 @@ void InverseRealFFT(int NumSamples, float *RealIn, float *ImagIn, float *RealOut
|
||||
delete [] pFFT;
|
||||
ReleaseFFT(hFFT);
|
||||
}
|
||||
#endif // EXPERIMENTAL_USE_REALFFTF
|
||||
|
||||
/*
|
||||
* PowerSpectrum
|
||||
*
|
||||
* This function computes the same as RealFFT, above, but
|
||||
* adds the squares of the real and imaginary part of each
|
||||
* coefficient, extracting the power and throwing away the
|
||||
* phase.
|
||||
* This function uses RealFFTf() from RealFFTf.h to perform the real
|
||||
* FFT computation, and then squares the real and imaginary part of
|
||||
* each coefficient, extracting the power and throwing away the phase.
|
||||
*
|
||||
* For speed, it does not call RealFFT, but duplicates some
|
||||
* of its code.
|
||||
*/
|
||||
|
||||
void PowerSpectrum(int NumSamples, float *In, float *Out)
|
||||
void PowerSpectrum(int NumSamples, const float *In, float *Out)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
// Remap to RealFFTf() function
|
||||
int i;
|
||||
HFFT hFFT = GetFFT(NumSamples);
|
||||
float *pFFT = new float[NumSamples];
|
||||
@ -411,73 +340,6 @@ void PowerSpectrum(int NumSamples, float *In, float *Out)
|
||||
Out[i] = pFFT[1]*pFFT[1];
|
||||
delete [] pFFT;
|
||||
ReleaseFFT(hFFT);
|
||||
|
||||
#else // EXPERIMENTAL_USE_REALFFTF
|
||||
|
||||
int Half = NumSamples / 2;
|
||||
int i;
|
||||
|
||||
float theta = M_PI / Half;
|
||||
|
||||
float *tmpReal = new float[Half];
|
||||
float *tmpImag = new float[Half];
|
||||
float *RealOut = new float[Half];
|
||||
float *ImagOut = new float[Half];
|
||||
|
||||
for (i = 0; i < Half; i++) {
|
||||
tmpReal[i] = In[2 * i];
|
||||
tmpImag[i] = In[2 * i + 1];
|
||||
}
|
||||
|
||||
FFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);
|
||||
|
||||
float wtemp = float (sin(0.5 * theta));
|
||||
|
||||
float wpr = -2.0 * wtemp * wtemp;
|
||||
float wpi = -1.0 * float (sin(theta));
|
||||
float wr = 1.0 + wpr;
|
||||
float wi = wpi;
|
||||
|
||||
int i3;
|
||||
|
||||
float h1r, h1i, h2r, h2i, rt, it;
|
||||
|
||||
for (i = 1; i < Half / 2; i++) {
|
||||
|
||||
i3 = Half - i;
|
||||
|
||||
h1r = 0.5 * (RealOut[i] + RealOut[i3]);
|
||||
h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);
|
||||
h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);
|
||||
h2i = -0.5 * (RealOut[i] - RealOut[i3]);
|
||||
|
||||
rt = h1r + wr * h2r - wi * h2i;
|
||||
it = h1i + wr * h2i + wi * h2r;
|
||||
|
||||
Out[i] = rt * rt + it * it;
|
||||
|
||||
rt = h1r - wr * h2r + wi * h2i;
|
||||
it = -h1i + wr * h2i + wi * h2r;
|
||||
|
||||
Out[i3] = rt * rt + it * it;
|
||||
|
||||
wr = (wtemp = wr) * wpr - wi * wpi + wr;
|
||||
wi = wi * wpr + wtemp * wpi + wi;
|
||||
}
|
||||
|
||||
rt = (h1r = RealOut[0]) + ImagOut[0];
|
||||
it = h1r - ImagOut[0];
|
||||
Out[0] = rt * rt + it * it;
|
||||
|
||||
rt = RealOut[Half / 2];
|
||||
it = ImagOut[Half / 2];
|
||||
Out[Half / 2] = rt * rt + it * it;
|
||||
|
||||
delete[]tmpReal;
|
||||
delete[]tmpImag;
|
||||
delete[]RealOut;
|
||||
delete[]ImagOut;
|
||||
#endif // EXPERIMENTAL_USE_REALFFTF
|
||||
}
|
||||
|
||||
/*
|
||||
|
12
src/FFT.h
12
src/FFT.h
@ -61,7 +61,7 @@
|
||||
* input array, and that NumSamples must be a power of two.
|
||||
*/
|
||||
|
||||
void PowerSpectrum(int NumSamples, float *In, float *Out);
|
||||
void PowerSpectrum(int NumSamples, const float *In, float *Out);
|
||||
|
||||
/*
|
||||
* Computes an FFT when the input data is real but you still
|
||||
@ -71,19 +71,15 @@ void PowerSpectrum(int NumSamples, float *In, float *Out);
|
||||
*/
|
||||
|
||||
void RealFFT(int NumSamples,
|
||||
float *RealIn, float *RealOut, float *ImagOut);
|
||||
const float *RealIn, float *RealOut, float *ImagOut);
|
||||
|
||||
/*
|
||||
* Computes an Inverse FFT when the input data is conjugate symmetric
|
||||
* so the output is purely real. NumSamples must be a power of
|
||||
* two.
|
||||
* Requires: EXPERIMENTAL_USE_REALFFTF
|
||||
*/
|
||||
#include "Experimental.h"
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
void InverseRealFFT(int NumSamples,
|
||||
float *RealIn, float *ImagIn, float *RealOut);
|
||||
#endif
|
||||
const float *RealIn, const float *ImagIn, float *RealOut);
|
||||
|
||||
/*
|
||||
* Computes a FFT of complex input and returns complex output.
|
||||
@ -93,7 +89,7 @@ void InverseRealFFT(int NumSamples,
|
||||
|
||||
void FFT(int NumSamples,
|
||||
bool InverseTransform,
|
||||
float *RealIn, float *ImagIn, float *RealOut, float *ImagOut);
|
||||
const float *RealIn, const float *ImagIn, float *RealOut, float *ImagOut);
|
||||
|
||||
/*
|
||||
* Multiply values in data by values of the chosen function
|
||||
|
@ -1255,11 +1255,7 @@ bool SpectrumAnalyst::Calculate(Algorithm alg, int windowFunc,
|
||||
case EnhancedAutocorrelation:
|
||||
|
||||
// Take FFT
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
RealFFT(mWindowSize, in, out, out2);
|
||||
#else
|
||||
FFT(mWindowSize, false, in, NULL, out, out2);
|
||||
#endif
|
||||
// Compute power
|
||||
for (int i = 0; i < mWindowSize; i++)
|
||||
in[i] = (out[i] * out[i]) + (out2[i] * out2[i]);
|
||||
@ -1277,11 +1273,7 @@ bool SpectrumAnalyst::Calculate(Algorithm alg, int windowFunc,
|
||||
in[i] = pow(in[i], 1.0f / 3.0f);
|
||||
}
|
||||
// Take FFT
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
RealFFT(mWindowSize, in, out, out2);
|
||||
#else
|
||||
FFT(mWindowSize, false, in, NULL, out, out2);
|
||||
#endif
|
||||
|
||||
// Take real part of result
|
||||
for (int i = 0; i < half; i++)
|
||||
@ -1289,12 +1281,7 @@ bool SpectrumAnalyst::Calculate(Algorithm alg, int windowFunc,
|
||||
break;
|
||||
|
||||
case Cepstrum:
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
RealFFT(mWindowSize, in, out, out2);
|
||||
#else
|
||||
FFT(mWindowSize, false, in, NULL, out, out2);
|
||||
#endif
|
||||
|
||||
// Compute log power
|
||||
// Set a sane lower limit assuming maximum time amplitude of 1.0
|
||||
{
|
||||
@ -1309,11 +1296,7 @@ bool SpectrumAnalyst::Calculate(Algorithm alg, int windowFunc,
|
||||
in[i] = log(power);
|
||||
}
|
||||
// Take IFFT
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
InverseRealFFT(mWindowSize, in, NULL, out);
|
||||
#else
|
||||
FFT(mWindowSize, true, in, NULL, out, out2);
|
||||
#endif
|
||||
|
||||
// Take real part of result
|
||||
for (int i = 0; i < half; i++)
|
||||
|
@ -47,6 +47,7 @@ for drawing different aspects of the label and its text box.
|
||||
#include <wx/pen.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/textfile.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
#include "AudioIO.h"
|
||||
@ -268,7 +269,6 @@ void LabelTrack::WarpLabels(const TimeWarper &warper) {
|
||||
|
||||
void LabelTrack::ResetFlags()
|
||||
{
|
||||
mDragXPos = -1;
|
||||
mInitialCursorPos = 1;
|
||||
mCurrentCursorPos = 1;
|
||||
mRightDragging = false;
|
||||
@ -521,8 +521,6 @@ LabelStruct::LabelStruct(const SelectedRegion ®ion,
|
||||
: selectedRegion(region)
|
||||
, title(aTitle)
|
||||
{
|
||||
changeInitialMouseXPos = true;
|
||||
highlighted = false;
|
||||
updated = false;
|
||||
width = 0;
|
||||
x = 0;
|
||||
@ -540,8 +538,6 @@ LabelStruct::LabelStruct(const SelectedRegion ®ion,
|
||||
// Overwrite the times
|
||||
selectedRegion.setTimes(t0, t1);
|
||||
|
||||
changeInitialMouseXPos = true;
|
||||
highlighted = false;
|
||||
updated = false;
|
||||
width = 0;
|
||||
x = 0;
|
||||
@ -693,9 +689,6 @@ void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r) const
|
||||
void LabelStruct::DrawHighlight
|
||||
( wxDC & dc, int xPos1, int xPos2, int charHeight) const
|
||||
{
|
||||
highlighted = true;
|
||||
changeInitialMouseXPos = false;
|
||||
|
||||
wxPen curPen = dc.GetPen();
|
||||
curPen.SetColour(wxString(wxT("BLUE")));
|
||||
wxBrush curBrush = dc.GetBrush();
|
||||
@ -825,7 +818,7 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r,
|
||||
}}
|
||||
|
||||
// Draw highlights
|
||||
if ((mDragXPos != -1) && (mSelIndex >= 0 ))
|
||||
if ((mInitialCursorPos != mCurrentCursorPos) && (mSelIndex >= 0 ))
|
||||
{
|
||||
int xpos1, xpos2;
|
||||
CalcHighlightXs(&xpos1, &xpos2);
|
||||
@ -865,11 +858,11 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r,
|
||||
}
|
||||
}
|
||||
|
||||
/// Set the cursor position according to x position of mouse
|
||||
/// uses GetTextExtent to find the character position
|
||||
/// corresponding to the x pixel position.
|
||||
void LabelTrack::SetCurrentCursorPosition(int xPos)
|
||||
int LabelTrack::FindCurrentCursorPosition(int xPos)
|
||||
{
|
||||
int result = -1;
|
||||
wxMemoryDC dc;
|
||||
if(msFont.Ok())
|
||||
dc.SetFont(msFont);
|
||||
@ -897,7 +890,7 @@ void LabelTrack::SetCurrentCursorPosition(int xPos)
|
||||
if (xPos <= bound)
|
||||
{
|
||||
// Found
|
||||
mCurrentCursorPos = charIndex - 1;
|
||||
result = charIndex - 1;
|
||||
finished = true;
|
||||
}
|
||||
else
|
||||
@ -907,10 +900,16 @@ void LabelTrack::SetCurrentCursorPosition(int xPos)
|
||||
}
|
||||
}
|
||||
if (!finished)
|
||||
{
|
||||
// Cursor should be in the last position
|
||||
mCurrentCursorPos = length;
|
||||
}
|
||||
result = length;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Set the cursor position according to x position of mouse
|
||||
void LabelTrack::SetCurrentCursorPosition(int xPos)
|
||||
{
|
||||
mCurrentCursorPos = FindCurrentCursorPosition(xPos);
|
||||
}
|
||||
|
||||
void LabelTrack::calculateFontHeight(wxDC & dc) const
|
||||
@ -935,8 +934,6 @@ bool LabelTrack::IsTextSelected()
|
||||
{
|
||||
if (mSelIndex == -1)
|
||||
return false;
|
||||
if (!mLabels[mSelIndex].highlighted)
|
||||
return false;
|
||||
if (mCurrentCursorPos == mInitialCursorPos)
|
||||
return false;
|
||||
return true;
|
||||
@ -992,14 +989,15 @@ bool LabelTrack::CopySelectedText()
|
||||
return false;
|
||||
|
||||
const auto &labelStruct = mLabels[mSelIndex];
|
||||
if (!labelStruct.highlighted)
|
||||
return false;
|
||||
|
||||
int init = mInitialCursorPos;
|
||||
int cur = mCurrentCursorPos;
|
||||
if (init > cur)
|
||||
std::swap(init, cur);
|
||||
|
||||
if (init == cur)
|
||||
return false;
|
||||
|
||||
// data for copying
|
||||
wxString data = labelStruct.title.Mid(init, cur-init);
|
||||
|
||||
@ -1042,12 +1040,9 @@ bool LabelTrack::PasteSelectedText(double sel0, double sel1)
|
||||
|
||||
auto &labelStruct = mLabels[mSelIndex];
|
||||
auto &title = labelStruct.title;
|
||||
int cur = mCurrentCursorPos, init = cur;
|
||||
if (labelStruct.highlighted) {
|
||||
init = mInitialCursorPos;
|
||||
if (init > cur)
|
||||
std::swap(init, cur);
|
||||
}
|
||||
int cur = mCurrentCursorPos, init = mInitialCursorPos;
|
||||
if (init > cur)
|
||||
std::swap(init, cur);
|
||||
left = title.Left(init);
|
||||
if (cur < (int)title.Length())
|
||||
right = title.Mid(cur);
|
||||
@ -1222,6 +1217,103 @@ void LabelStruct::MoveLabel( int iEdge, double fNewTime)
|
||||
updated = true;
|
||||
}
|
||||
|
||||
LabelStruct LabelStruct::Import(wxTextFile &file, int &index)
|
||||
{
|
||||
SelectedRegion sr;
|
||||
wxString title;
|
||||
static const wxString continuation{ wxT("\\") };
|
||||
|
||||
wxString firstLine = file.GetLine(index++);
|
||||
|
||||
{
|
||||
// Assume tab is an impossible character within the exported text
|
||||
// of the label, so can be only a delimiter. But other white space may
|
||||
// be part of the label text.
|
||||
wxStringTokenizer toker { firstLine, wxT("\t") };
|
||||
|
||||
//get the timepoint of the left edge of the label.
|
||||
auto token = toker.GetNextToken();
|
||||
|
||||
double t0;
|
||||
if (!Internat::CompatibleToDouble(token, &t0))
|
||||
throw BadFormatException{};
|
||||
|
||||
token = toker.GetNextToken();
|
||||
|
||||
double t1;
|
||||
if (!Internat::CompatibleToDouble(token, &t1))
|
||||
//s1 is not a number.
|
||||
t1 = t0; //This is a one-sided label; t1 == t0.
|
||||
else
|
||||
token = toker.GetNextToken();
|
||||
|
||||
sr.setTimes( t0, t1 );
|
||||
|
||||
title = token;
|
||||
}
|
||||
|
||||
// Newer selection fields are written on additional lines beginning with
|
||||
// '\' which is an impossible numerical character that older versions of
|
||||
// audacity will ignore. Test for the presence of such a line and then
|
||||
// parse it if we can.
|
||||
|
||||
// There may also be additional continuation lines from future formats that
|
||||
// we ignore.
|
||||
|
||||
// Advance index over all continuation lines first, before we might throw
|
||||
// any exceptions.
|
||||
int index2 = index;
|
||||
while (index < file.GetLineCount() &&
|
||||
file.GetLine(index).StartsWith(continuation))
|
||||
++index;
|
||||
|
||||
if (index2 < index) {
|
||||
wxStringTokenizer toker { file.GetLine(index2++), wxT("\t") };
|
||||
auto token = toker.GetNextToken();
|
||||
if (token != continuation)
|
||||
throw BadFormatException{};
|
||||
|
||||
token = toker.GetNextToken();
|
||||
double f0;
|
||||
if (!Internat::CompatibleToDouble(token, &f0))
|
||||
throw BadFormatException{};
|
||||
|
||||
token = toker.GetNextToken();
|
||||
double f1;
|
||||
if (!Internat::CompatibleToDouble(token, &f1))
|
||||
throw BadFormatException{};
|
||||
|
||||
sr.setFrequencies(f0, f1);
|
||||
}
|
||||
|
||||
return LabelStruct{ sr, title };
|
||||
}
|
||||
|
||||
void LabelStruct::Export(wxTextFile &file) const
|
||||
{
|
||||
file.AddLine(wxString::Format(wxT("%f\t%f\t%s"),
|
||||
getT0(),
|
||||
getT1(),
|
||||
title.c_str()
|
||||
));
|
||||
|
||||
// Do we need more lines?
|
||||
auto f0 = selectedRegion.f0();
|
||||
auto f1 = selectedRegion.f1();
|
||||
if (f0 == SelectedRegion::UndefinedFrequency &&
|
||||
f1 == SelectedRegion::UndefinedFrequency)
|
||||
return;
|
||||
|
||||
// Write a \ character at the start of a second line,
|
||||
// so that earlier versions of Audacity ignore it.
|
||||
file.AddLine(wxString::Format(wxT("\\\t%f\t%f"),
|
||||
f0,
|
||||
f1
|
||||
));
|
||||
|
||||
// Additional lines in future formats should also start with '\'.
|
||||
}
|
||||
|
||||
auto LabelStruct::RegionRelation(
|
||||
double reg_t0, double reg_t1, const LabelTrack * WXUNUSED(parent)) const
|
||||
-> TimeRelations
|
||||
@ -1429,20 +1521,9 @@ void LabelTrack::HandleTextDragRelease(const wxMouseEvent & evt)
|
||||
|
||||
if(evt.Dragging())
|
||||
{
|
||||
// if dragging happens in text box
|
||||
// end dragging x position in pixels
|
||||
// set flag to update current cursor position
|
||||
mDragXPos = evt.m_x;
|
||||
|
||||
// for preventing dragging glygh from changing current cursor position
|
||||
// set end dragging position to current cursor position
|
||||
SetCurrentCursorPosition(mDragXPos);
|
||||
|
||||
// if it's an invalid dragging, disable displaying
|
||||
if (mRightDragging) {
|
||||
mDragXPos = -1;
|
||||
mRightDragging = false;
|
||||
}
|
||||
if (!mRightDragging)
|
||||
// Update drag end
|
||||
SetCurrentCursorPosition(evt.m_x);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1509,20 +1590,41 @@ void LabelTrack::HandleClick(const wxMouseEvent & evt,
|
||||
return;
|
||||
}
|
||||
|
||||
// disable displaying if left button is down
|
||||
if (evt.LeftDown())
|
||||
mDragXPos = -1;
|
||||
|
||||
mSelIndex = OverATextBox(evt.m_x, evt.m_y);
|
||||
if (mSelIndex != -1) {
|
||||
auto &labelStruct = mLabels[mSelIndex];
|
||||
*newSel = labelStruct.selectedRegion;
|
||||
SetCurrentCursorPosition(evt.m_x);
|
||||
|
||||
// for preventing from resetting by shift+mouse left button
|
||||
if (labelStruct.changeInitialMouseXPos)
|
||||
mInitialCursorPos = mCurrentCursorPos;
|
||||
mDrawCursor = true;
|
||||
if (evt.LeftDown()) {
|
||||
// Find the NEW drag end
|
||||
auto position = FindCurrentCursorPosition(evt.m_x);
|
||||
|
||||
// Anchor shift-drag at the farther end of the previous highlight
|
||||
// that is farther from the click, on Mac, for consistency with
|
||||
// its text editors, but on the others, re-use the previous
|
||||
// anchor.
|
||||
if (evt.ShiftDown()) {
|
||||
#ifdef __WXMAC__
|
||||
// Set the drag anchor at the end of the previous selection
|
||||
// that is farther from the NEW drag end
|
||||
if (abs(position - mCurrentCursorPos) >
|
||||
abs(position - mInitialCursorPos))
|
||||
mInitialCursorPos = mCurrentCursorPos;
|
||||
#else
|
||||
// mInitialCursorPos remains as before
|
||||
#endif
|
||||
}
|
||||
else
|
||||
mInitialCursorPos = position;
|
||||
|
||||
mCurrentCursorPos = position;
|
||||
|
||||
mDrawCursor = true;
|
||||
mRightDragging = false;
|
||||
}
|
||||
else
|
||||
// Actually this might be right or middle down
|
||||
mRightDragging = true;
|
||||
|
||||
// reset the highlight indicator
|
||||
wxRect highlightedRect;
|
||||
@ -1536,28 +1638,8 @@ void LabelTrack::HandleClick(const wxMouseEvent & evt,
|
||||
xpos1, labelStruct.y - mFontHeight / 2,
|
||||
(int)(xpos2 - xpos1 + 0.5), mFontHeight
|
||||
};
|
||||
|
||||
// reset when left button is down
|
||||
if (evt.LeftDown())
|
||||
labelStruct.highlighted = false;
|
||||
// reset when right button is down outside text box
|
||||
if (evt.RightDown())
|
||||
{
|
||||
if (!highlightedRect.Contains(evt.m_x, evt.m_y))
|
||||
{
|
||||
mCurrentCursorPos = mInitialCursorPos = 0;
|
||||
labelStruct.highlighted = false;
|
||||
}
|
||||
}
|
||||
// set changeInitialMouseXPos flag
|
||||
labelStruct.changeInitialMouseXPos = true;
|
||||
}
|
||||
|
||||
// disable displaying if right button is down outside text box
|
||||
if (evt.RightDown()
|
||||
&& !highlightedRect.Contains(evt.m_x, evt.m_y))
|
||||
mDragXPos = -1;
|
||||
|
||||
// Middle click on GTK: paste from primary selection
|
||||
#if defined(__WXGTK__) && (HAVE_GTK)
|
||||
if (evt.MiddleDown()) {
|
||||
@ -1570,16 +1652,6 @@ void LabelTrack::HandleClick(const wxMouseEvent & evt,
|
||||
*newSel = SelectedRegion(t, t);
|
||||
}
|
||||
#endif
|
||||
|
||||
// handle shift+mouse left button
|
||||
if (evt.ShiftDown()) {
|
||||
// if the mouse is clicked in text box, set flags
|
||||
mDragXPos = evt.m_x;
|
||||
|
||||
// for preventing dragging glygh from changing current cursor position
|
||||
// set end dragging position to current cursor position
|
||||
SetCurrentCursorPosition(evt.m_x);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__WXGTK__) && (HAVE_GTK)
|
||||
@ -1668,9 +1740,8 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
|
||||
if (len > 0)
|
||||
{
|
||||
// IF there are some highlighted letters, THEN DELETE them
|
||||
if (labelStruct.highlighted) {
|
||||
if (mInitialCursorPos != mCurrentCursorPos)
|
||||
RemoveSelectedText();
|
||||
}
|
||||
else
|
||||
{
|
||||
// DELETE one letter
|
||||
@ -1699,9 +1770,8 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
|
||||
if (len > 0)
|
||||
{
|
||||
// if there are some highlighted letters, DELETE them
|
||||
if (labelStruct.highlighted) {
|
||||
if (mInitialCursorPos != mCurrentCursorPos)
|
||||
RemoveSelectedText();
|
||||
}
|
||||
else
|
||||
{
|
||||
// DELETE one letter
|
||||
@ -1725,11 +1795,9 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
|
||||
// Move cursor to beginning of label
|
||||
mCurrentCursorPos = 0;
|
||||
if (mods == wxMOD_SHIFT)
|
||||
mDragXPos = 0;
|
||||
else {
|
||||
mDragXPos = -1;
|
||||
;
|
||||
else
|
||||
mInitialCursorPos = mCurrentCursorPos;
|
||||
}
|
||||
break;
|
||||
|
||||
case WXK_END:
|
||||
@ -1737,11 +1805,9 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
|
||||
// Move cursor to end of label
|
||||
mCurrentCursorPos = (int)title.length();
|
||||
if (mods == wxMOD_SHIFT)
|
||||
mDragXPos = 0;
|
||||
else {
|
||||
mDragXPos = -1;
|
||||
;
|
||||
else
|
||||
mInitialCursorPos = mCurrentCursorPos;
|
||||
}
|
||||
break;
|
||||
|
||||
case WXK_LEFT:
|
||||
@ -1750,11 +1816,10 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
|
||||
if (mCurrentCursorPos > 0) {
|
||||
mCurrentCursorPos--;
|
||||
if (mods == wxMOD_SHIFT)
|
||||
mDragXPos = 0;
|
||||
else {
|
||||
mDragXPos = -1;
|
||||
mInitialCursorPos = mCurrentCursorPos;
|
||||
}
|
||||
;
|
||||
else
|
||||
mInitialCursorPos = mCurrentCursorPos =
|
||||
std::min(mInitialCursorPos, mCurrentCursorPos);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1764,11 +1829,10 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
|
||||
if (mCurrentCursorPos < (int)title.length()) {
|
||||
mCurrentCursorPos++;
|
||||
if (mods == wxMOD_SHIFT)
|
||||
mDragXPos = 0;
|
||||
else {
|
||||
mDragXPos = -1;
|
||||
mInitialCursorPos = mCurrentCursorPos;
|
||||
}
|
||||
;
|
||||
else
|
||||
mInitialCursorPos = mCurrentCursorPos =
|
||||
std::max(mInitialCursorPos, mCurrentCursorPos);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1920,9 +1984,8 @@ bool LabelTrack::OnChar(SelectedRegion &WXUNUSED(newSel), wxKeyEvent & event)
|
||||
auto &title = labelStruct.title;
|
||||
|
||||
// Test if cursor is in the end of string or not
|
||||
if (labelStruct.highlighted) {
|
||||
if (mInitialCursorPos != mCurrentCursorPos)
|
||||
RemoveSelectedText();
|
||||
}
|
||||
|
||||
if (mCurrentCursorPos < (int)title.length()) {
|
||||
// Get substring on the righthand side of cursor
|
||||
@ -1984,9 +2047,6 @@ void LabelTrack::ShowContextMenu()
|
||||
|
||||
parent->PopupMenu(&menu, x, ls->y + (mIconHeight / 2) - 1);
|
||||
}
|
||||
|
||||
// it's an invalid dragging event
|
||||
SetWrongDragging(true);
|
||||
}
|
||||
|
||||
void LabelTrack::OnContextMenu(wxCommandEvent & evt)
|
||||
@ -2062,8 +2122,6 @@ void LabelTrack::RemoveSelectedText()
|
||||
|
||||
title = left + right;
|
||||
mInitialCursorPos = mCurrentCursorPos = left.Length();
|
||||
labelStruct.highlighted = false;
|
||||
mDragXPos = -1;
|
||||
}
|
||||
|
||||
void LabelTrack::Unselect()
|
||||
@ -2080,25 +2138,14 @@ bool LabelTrack::IsSelected() const
|
||||
void LabelTrack::Export(wxTextFile & f) const
|
||||
{
|
||||
// PRL: to do: export other selection fields
|
||||
for (auto &labelStruct: mLabels) {
|
||||
f.AddLine(wxString::Format(wxT("%f\t%f\t%s"),
|
||||
(double)labelStruct.getT0(),
|
||||
(double)labelStruct.getT1(),
|
||||
labelStruct.title.c_str()));
|
||||
}
|
||||
for (auto &labelStruct: mLabels)
|
||||
labelStruct.Export(f);
|
||||
}
|
||||
|
||||
/// Import labels, handling files with or without end-times.
|
||||
void LabelTrack::Import(wxTextFile & in)
|
||||
{
|
||||
wxString currentLine;
|
||||
int i, i2,len;
|
||||
int index, lines;
|
||||
wxString s,s1;
|
||||
wxString title;
|
||||
double t0,t1;
|
||||
|
||||
lines = in.GetLineCount();
|
||||
int lines = in.GetLineCount();
|
||||
|
||||
mLabels.clear();
|
||||
mLabels.reserve(lines);
|
||||
@ -2106,69 +2153,13 @@ void LabelTrack::Import(wxTextFile & in)
|
||||
//Currently, we expect a tag file to have two values and a label
|
||||
//on each line. If the second token is not a number, we treat
|
||||
//it as a single-value label.
|
||||
for (index = 0; index < lines; index++) {
|
||||
currentLine = in.GetLine(index);
|
||||
|
||||
len = currentLine.Length();
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
//get the timepoint of the left edge of the label.
|
||||
i = 0;
|
||||
while (i < len && currentLine.GetChar(i) != wxT(' ')
|
||||
&& currentLine.GetChar(i) != wxT('\t'))
|
||||
{
|
||||
i++;
|
||||
for (int index = 0; index < lines;) {
|
||||
try {
|
||||
// Let LabelStruct::Import advance index
|
||||
LabelStruct l { LabelStruct::Import(in, index) };
|
||||
mLabels.push_back(l);
|
||||
}
|
||||
s = currentLine.Left(i);
|
||||
|
||||
if (!Internat::CompatibleToDouble(s, &t0))
|
||||
return;
|
||||
|
||||
//Increment one letter.
|
||||
i++;
|
||||
|
||||
//Now, go until we find the start of the get the next token
|
||||
while (i < len
|
||||
&& (currentLine.GetChar(i) == wxT(' ')
|
||||
|| currentLine.GetChar(i) == wxT('\t')))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
//Keep track of the start of the second token
|
||||
i2=i;
|
||||
|
||||
//Now, go to the end of the second token.
|
||||
while (i < len && currentLine.GetChar(i) != wxT(' ')
|
||||
&& currentLine.GetChar(i) != wxT('\t'))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
//We are at the end of the second token.
|
||||
s1 = currentLine.Mid(i2,i-i2+1).Strip(wxString::stripType(0x3));
|
||||
if (!Internat::CompatibleToDouble(s1, &t1))
|
||||
{
|
||||
//s1 is not a number.
|
||||
t1 = t0; //This is a one-sided label; t1 == t0.
|
||||
|
||||
//Because s1 is not a number, the label should be
|
||||
//The rest of the line, starting at i2;
|
||||
title = currentLine.Right(len - i2).Strip(wxString::stripType(0x3)); //0x3 indicates both
|
||||
}
|
||||
else
|
||||
{
|
||||
//s1 is a number, and it is stored correctly in t1.
|
||||
//The title should be the remainder of the line,
|
||||
//After we eat
|
||||
|
||||
//Get rid of spaces at either end
|
||||
title = currentLine.Right(len - i).Strip(wxString::stripType(0x3)); //0x3 indicates both.
|
||||
|
||||
}
|
||||
// PRL: to do: import other selection fields
|
||||
LabelStruct l { SelectedRegion(t0, t1), title };
|
||||
mLabels.push_back(l);
|
||||
catch(const LabelStruct::BadFormatException&l) {}
|
||||
}
|
||||
SortLabels();
|
||||
}
|
||||
|
@ -62,6 +62,11 @@ public:
|
||||
bool AdjustEdge( int iEdge, double fNewTime);
|
||||
void MoveLabel( int iEdge, double fNewTime);
|
||||
|
||||
struct BadFormatException {};
|
||||
static LabelStruct Import(wxTextFile &file, int &index);
|
||||
|
||||
void Export(wxTextFile &file) const;
|
||||
|
||||
/// Relationships between selection region and labels
|
||||
enum TimeRelations
|
||||
{
|
||||
@ -91,8 +96,6 @@ public:
|
||||
mutable int xText; /// Pixel position of left hand side of text box
|
||||
mutable int y; /// Pixel position of label.
|
||||
|
||||
mutable bool highlighted; /// if the text is highlighted
|
||||
mutable bool changeInitialMouseXPos; /// flag to change initial mouse X pos
|
||||
bool updated; /// flag to tell if the label times were updated
|
||||
};
|
||||
|
||||
@ -175,9 +178,6 @@ class AUDACITY_DLL_API LabelTrack final : public Track
|
||||
bool PasteSelectedText(double sel0, double sel1);
|
||||
static bool IsTextClipSupported();
|
||||
|
||||
// methods to set flags
|
||||
void SetWrongDragging(bool rightFlag) { mRightDragging = rightFlag; }
|
||||
|
||||
void HandleClick(const wxMouseEvent & evt, const wxRect & r, const ZoomInfo &zoomInfo,
|
||||
SelectedRegion *newSel);
|
||||
bool HandleGlyphDragRelease(const wxMouseEvent & evt, wxRect & r, const ZoomInfo &zoomInfo,
|
||||
@ -258,8 +258,6 @@ class AUDACITY_DLL_API LabelTrack final : public Track
|
||||
static int mFontHeight;
|
||||
int mCurrentCursorPos; /// current cursor position
|
||||
int mInitialCursorPos; /// initial cursor position
|
||||
int mDragXPos; /// end X pos of dragging
|
||||
/// in text box
|
||||
|
||||
bool mRightDragging; /// flag to tell if it's a valid dragging
|
||||
bool mDrawCursor; /// flag to tell if drawing the
|
||||
@ -274,6 +272,7 @@ class AUDACITY_DLL_API LabelTrack final : public Track
|
||||
void ComputeTextPosition(const wxRect & r, int index) const;
|
||||
|
||||
public:
|
||||
int FindCurrentCursorPosition(int xPos);
|
||||
void SetCurrentCursorPosition(int xPos);
|
||||
|
||||
private:
|
||||
|
@ -325,7 +325,7 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
AudioIONotBusyFlag | UnsavedChangesFlag);
|
||||
c->AddItem(wxT("SaveAs"), _("Save Project &As..."), FN(OnSaveAs));
|
||||
#ifdef USE_LIBVORBIS
|
||||
c->AddItem(wxT("SaveCompressed"), _("Save Compressed Copy of Project..."), FN(OnSaveCompressed));
|
||||
c->AddItem(wxT("SaveCompressed"), _("Sa&ve Compressed Copy of Project..."), FN(OnSaveCompressed));
|
||||
#endif
|
||||
|
||||
c->AddItem(wxT("CheckDeps"), _("Chec&k Dependencies..."), FN(OnCheckDependencies));
|
||||
@ -371,7 +371,7 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
AudioIONotBusyFlag | WaveTracksExistFlag,
|
||||
AudioIONotBusyFlag | WaveTracksExistFlag);
|
||||
#if defined(USE_MIDI)
|
||||
c->AddItem(wxT("ExportMIDI"), _("Export MIDI..."), FN(OnExportMIDI),
|
||||
c->AddItem(wxT("ExportMIDI"), _("Export MI&DI..."), FN(OnExportMIDI),
|
||||
AudioIONotBusyFlag | NoteTracksSelectedFlag,
|
||||
AudioIONotBusyFlag | NoteTracksSelectedFlag);
|
||||
#endif
|
||||
@ -733,7 +733,7 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
c->AddSeparator();
|
||||
|
||||
/* i18n-hint: (verb)*/
|
||||
c->AddItem(wxT("ResetToolbars"), _("&Reset Toolbars"), FN(OnResetToolBars), 0, AlwaysEnabledFlag, AlwaysEnabledFlag);
|
||||
c->AddItem(wxT("ResetToolbars"), _("Reset Toolb&ars"), FN(OnResetToolBars), 0, AlwaysEnabledFlag, AlwaysEnabledFlag);
|
||||
|
||||
c->EndSubMenu();
|
||||
|
||||
@ -776,7 +776,7 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
|
||||
c->AddSeparator();
|
||||
|
||||
c->AddCheck(wxT("PinnedHead"), _("Pinned Recording/Playback Head"),
|
||||
c->AddCheck(wxT("PinnedHead"), _("Pinned Recording/Playback &Head"),
|
||||
FN(OnTogglePinnedHead), 0,
|
||||
// Switching of scrolling on and off is permitted even during transport
|
||||
AlwaysEnabledFlag, AlwaysEnabledFlag);
|
||||
|
@ -191,9 +191,9 @@ void CleanupFFT()
|
||||
void RealFFTf(fft_type *buffer,HFFT h)
|
||||
{
|
||||
fft_type *A,*B;
|
||||
fft_type *sptr;
|
||||
fft_type *endptr1,*endptr2;
|
||||
int *br1,*br2;
|
||||
const fft_type *sptr;
|
||||
const fft_type *endptr1,*endptr2;
|
||||
const int *br1,*br2;
|
||||
fft_type HRplus,HRminus,HIplus,HIminus;
|
||||
fft_type v1,v2,sin,cos;
|
||||
|
||||
@ -293,9 +293,9 @@ void RealFFTf(fft_type *buffer,HFFT h)
|
||||
void InverseRealFFTf(fft_type *buffer,HFFT h)
|
||||
{
|
||||
fft_type *A,*B;
|
||||
fft_type *sptr;
|
||||
fft_type *endptr1,*endptr2;
|
||||
int *br1;
|
||||
const fft_type *sptr;
|
||||
const fft_type *endptr1,*endptr2;
|
||||
const int *br1;
|
||||
fft_type HRplus,HRminus,HIplus,HIminus;
|
||||
fft_type v1,v2,sin,cos;
|
||||
|
||||
@ -373,7 +373,8 @@ void InverseRealFFTf(fft_type *buffer,HFFT h)
|
||||
}
|
||||
}
|
||||
|
||||
void ReorderToFreq(HFFT hFFT, fft_type *buffer, fft_type *RealOut, fft_type *ImagOut)
|
||||
void ReorderToFreq(HFFT hFFT, const fft_type *buffer,
|
||||
fft_type *RealOut, fft_type *ImagOut)
|
||||
{
|
||||
// Copy the data into the real and imaginary outputs
|
||||
for(int i=1;i<hFFT->Points;i++) {
|
||||
@ -386,7 +387,7 @@ void ReorderToFreq(HFFT hFFT, fft_type *buffer, fft_type *RealOut, fft_type *Ima
|
||||
ImagOut[hFFT->Points] = 0;
|
||||
}
|
||||
|
||||
void ReorderToTime(HFFT hFFT, fft_type *buffer, fft_type *TimeOut)
|
||||
void ReorderToTime(HFFT hFFT, const fft_type *buffer, fft_type *TimeOut)
|
||||
{
|
||||
// Copy the data into the real outputs
|
||||
for(int i=0;i<hFFT->Points;i++) {
|
||||
|
@ -21,8 +21,9 @@ void ReleaseFFT(HFFT);
|
||||
void CleanupFFT();
|
||||
void RealFFTf(fft_type *,HFFT);
|
||||
void InverseRealFFTf(fft_type *,HFFT);
|
||||
void ReorderToTime(HFFT hFFT, fft_type *buffer, fft_type *TimeOut);
|
||||
void ReorderToFreq(HFFT hFFT, fft_type *buffer, fft_type *RealOut, fft_type *ImagOut);
|
||||
void ReorderToTime(HFFT hFFT, const fft_type *buffer, fft_type *TimeOut);
|
||||
void ReorderToFreq(HFFT hFFT, const fft_type *buffer,
|
||||
fft_type *RealOut, fft_type *ImagOut);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -52,11 +52,7 @@ bool ComputeSpectrum(const float * data, int width,
|
||||
|
||||
if (autocorrelation) {
|
||||
// Take FFT
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
RealFFT(windowSize, in, out, out2);
|
||||
#else
|
||||
FFT(windowSize, false, in, NULL, out, out2);
|
||||
#endif
|
||||
// Compute power
|
||||
for (i = 0; i < windowSize; i++)
|
||||
in[i] = (out[i] * out[i]) + (out2[i] * out2[i]);
|
||||
@ -68,12 +64,7 @@ bool ComputeSpectrum(const float * data, int width,
|
||||
in[i] = powf(in[i], 1.0f / 3.0f);
|
||||
|
||||
// Take FFT
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
RealFFT(windowSize, in, out, out2);
|
||||
#else
|
||||
FFT(windowSize, false, in, NULL, out, out2);
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
PowerSpectrum(windowSize, in, out);
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "Resample.h"
|
||||
#include "Project.h"
|
||||
#include "WaveTrack.h"
|
||||
#include "FFT.h"
|
||||
|
||||
#include "prefs/SpectrogramSettings.h"
|
||||
|
||||
@ -259,8 +260,6 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
#include "FFT.h"
|
||||
static void ComputeSpectrumUsingRealFFTf
|
||||
(float *buffer, HFFT hFFT, const float *window, int len, float *out)
|
||||
{
|
||||
@ -288,7 +287,6 @@ static void ComputeSpectrumUsingRealFFTf
|
||||
out[i] = 10.0*log10f(power);
|
||||
}
|
||||
}
|
||||
#endif // EXPERIMENTAL_USE_REALFFTF
|
||||
|
||||
WaveClip::WaveClip(DirManager *projDirManager, sampleFormat format, int rate)
|
||||
{
|
||||
@ -852,7 +850,6 @@ bool SpecCache::CalculateOneSpectrum
|
||||
if (copy)
|
||||
useBuffer = scratch;
|
||||
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
if (autocorrelation) {
|
||||
float *const results = &freq[half * xx];
|
||||
// This function does not mutate useBuffer
|
||||
@ -956,12 +953,6 @@ bool SpecCache::CalculateOneSpectrum
|
||||
results[ii] += gainFactors[ii];
|
||||
}
|
||||
}
|
||||
#else // EXPERIMENTAL_USE_REALFFTF
|
||||
// This function does not mutate scratch
|
||||
ComputeSpectrum(scratch, windowSize, windowSize,
|
||||
rate, results,
|
||||
autocorrelation, settings.windowType);
|
||||
#endif // EXPERIMENTAL_USE_REALFFTF
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -972,9 +963,7 @@ void SpecCache::Populate
|
||||
sampleCount numSamples,
|
||||
double offset, double rate, double pixelsPerSecond)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
settings.CacheWindows();
|
||||
#endif
|
||||
|
||||
const int &frequencyGain = settings.frequencyGain;
|
||||
const int &windowSize = settings.windowSize;
|
||||
|
@ -20,9 +20,7 @@
|
||||
#include "xml/XMLTagHandler.h"
|
||||
|
||||
#include "Experimental.h"
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
#include "RealFFTf.h"
|
||||
#endif
|
||||
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/longlong.h>
|
||||
|
@ -138,6 +138,7 @@ bool EffectChangePitch::SetAutomationParameters(EffectAutomationParameters & par
|
||||
ReadAndVerifyDouble(Percentage);
|
||||
|
||||
m_dPercentChange = Percentage;
|
||||
Calc_SemitonesChange_fromPercentChange();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef __AUDACITY_CONTRAST_DIALOG__
|
||||
#define __AUDACITY_CONTRAST_DIALOG__
|
||||
|
||||
#include "widgets/wxPanelWrapper.h"
|
||||
#include "../widgets/wxPanelWrapper.h"
|
||||
|
||||
class wxButton;
|
||||
class wxSizer;
|
||||
|
@ -1296,11 +1296,7 @@ bool EffectEqualization::CalcFilter()
|
||||
//transfer to time domain to do the padding and windowing
|
||||
float *outr = new float[mWindowSize];
|
||||
float *outi = new float[mWindowSize];
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
InverseRealFFT(mWindowSize, mFilterFuncR, NULL, outr); // To time domain
|
||||
#else
|
||||
FFT(mWindowSize,true,mFilterFuncR,NULL,outr,outi); //To time domain
|
||||
#endif
|
||||
|
||||
for(i=0;i<=(mM-1)/2;i++)
|
||||
{ //Windowing - could give a choice, fixed for now - MJS
|
||||
@ -2944,11 +2940,7 @@ void EqualizationPanel::Recalc()
|
||||
mOuti = new float[mEffect->mWindowSize];
|
||||
|
||||
mEffect->CalcFilter(); //to calculate the actual response
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
InverseRealFFT(mEffect->mWindowSize, mEffect->mFilterFuncR, mEffect->mFilterFuncI, mOutr);
|
||||
#else
|
||||
FFT(mWindowSize,true,mFilterFuncR,mFilterFuncI,mOutr,mOuti); //work out FIR response - note mOuti will be all zeros
|
||||
#endif // EXPERIMENTAL_USE_REALFFTF
|
||||
}
|
||||
|
||||
void EqualizationPanel::OnSize(wxSizeEvent & WXUNUSED(event))
|
||||
|
@ -348,7 +348,6 @@ SpectrogramSettings::~SpectrogramSettings()
|
||||
|
||||
void SpectrogramSettings::DestroyWindows()
|
||||
{
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
if (hFFT != NULL) {
|
||||
EndFFT(hFFT);
|
||||
hFFT = NULL;
|
||||
@ -365,7 +364,6 @@ void SpectrogramSettings::DestroyWindows()
|
||||
delete[] tWindow;
|
||||
tWindow = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -428,7 +426,6 @@ namespace
|
||||
|
||||
void SpectrogramSettings::CacheWindows() const
|
||||
{
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
if (hFFT == NULL || window == NULL) {
|
||||
|
||||
double scale;
|
||||
@ -444,7 +441,6 @@ void SpectrogramSettings::CacheWindows() const
|
||||
RecreateWindow(dWindow, DWINDOW, fftLen, padding, windowType, windowSize, scale);
|
||||
}
|
||||
}
|
||||
#endif // EXPERIMENTAL_USE_REALFFTF
|
||||
}
|
||||
|
||||
void SpectrogramSettings::ConvertToEnumeratedWindowSizes()
|
||||
|
@ -137,7 +137,6 @@ public:
|
||||
|
||||
// Following fields are derived from preferences.
|
||||
|
||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||
// Variables used for computing the spectrum
|
||||
mutable FFTParam *hFFT{};
|
||||
mutable float *window{};
|
||||
@ -145,7 +144,5 @@ public:
|
||||
// Two other windows for computing reassigned spectrogram
|
||||
mutable float *tWindow{}; // Window times time parameter
|
||||
mutable float *dWindow{}; // Derivative of window
|
||||
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
@ -2782,7 +2782,7 @@ void AdornedRulerPanel::OnToggleScrubBar(/*wxCommandEvent&*/)
|
||||
wxSize size { GetSize().GetWidth(), GetRulerHeight(mShowScrubbing) };
|
||||
SetSize(size);
|
||||
SetMinSize(size);
|
||||
PostSizeEventToParent();
|
||||
GetParent()->PostSizeEventToParent();
|
||||
}
|
||||
|
||||
void AdornedRulerPanel::OnContextMenu(wxContextMenuEvent & WXUNUSED(event))
|
||||
@ -2811,8 +2811,8 @@ void AdornedRulerPanel::UpdateButtonStates()
|
||||
const auto label = state
|
||||
// Label descibes the present state, not what the click does
|
||||
// (which is, to toggle the state)
|
||||
? _("Pinned play/record Head")
|
||||
: _("Unpinned play/record Head");
|
||||
? _("Pinned Record/Play head")
|
||||
: _("Unpinned Record/Play head");
|
||||
common(*pinButton, wxT("PinnedHead"), label);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef __AUDACITY_WXPANEL_WRAPPER__
|
||||
#define __AUDACITY_WXPANEL_WRAPPER__
|
||||
|
||||
#include <MemoryX.h>
|
||||
#include "../MemoryX.h"
|
||||
#include <wx/panel.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user