24#include "../../../ui/BrushHandle.h"
30#include "../../../../TrackArt.h"
31#include "../../../../TrackArtist.h"
32#include "../../../../TrackPanelDrawingContext.h"
38#include "../../../../prefs/SpectrogramSettings.h"
40#include <wx/dcmemory.h>
41#include <wx/graphics.h>
50 {
wxT(
"Spectrogram"),
XXO(
"&Spectrogram") }
83 std::make_shared<SpectralData>(pOldData->GetSR());
84 pNewData->CopyFrom(*pOldData);
85 pOldData->clearAllData();
89 if (&
mView == &view) {
91 std::make_shared<SpectralData>(pOldData->GetSR());
92 pNewData->CopyFrom( *pOldData );
111 view.mpSpectralData->CopyFrom(*pBackupData);
126 std::weak_ptr<BrushHandle> &holder,
128 const std::shared_ptr<SpectrumView> &pChannelView,
129 const std::shared_ptr<SpectralData> &mpData)
133 auto result = std::make_shared<BrushHandle>(
134 std::make_shared<SpectrumView::SpectralDataSaver>(*pChannelView),
136 st, viewInfo, mpData, projectSettings);
141 const auto pChannel = pChannelView->FindWaveChannel();
143 !pChannel->GetTrack().GetSelected())
157 for (
auto pChannel : wt->Channels()) {
158 if (
auto pWaveChannelView =
160 for (
const auto &pSubView : pWaveChannelView->GetAllSubViews()) {
161 if (
const auto sView =
dynamic_cast<SpectrumView*
>(pSubView.get()))
174 std::vector<UIHandlePtr> results;
176#ifdef EXPERIMENTAL_BRUSH_TOOL
181 pProject, std::static_pointer_cast<SpectrumView>(shared_from_this()),
183 results.push_back(result);
189 state, pProject, currentTool, bMultiTool, wt
200 gPrefs->
Read(
wxT(
"/GUI/CollapseToHalfWave"), &bHalfWave,
false);
201 if( bHalfWave && minimized)
207 constexpr auto max = std::numeric_limits<float>::max();
208 const bool spectrumLinear =
213 .
SetBounds( spectrumLinear ? 0.0f : 1.0f, max );
226 return std::make_shared<SpectrumVRulerControls>(shared_from_this());
235 if (
const auto pDest =
dynamic_cast< SpectrumView*
>(destSubView)) {
236 pDest->mpSpectralData =
246(
const float *spectrum,
float bin0,
float bin1,
unsigned nBins,
247 bool autocorrelation,
int gain,
int range)
254 if ((
int)(bin1) == (
int)(bin0)) {
255 value = spectrum[(int)(bin0)];
257 float binwidth= bin1 - bin0;
258 value = spectrum[(int)(bin0)] * (1.f - bin0 + (int)bin0);
260 bin0 = 1 + (int)(bin0);
261 while (bin0 < (
int)(bin1)) {
262 value += spectrum[(int)(bin0)];
266 if ((
int)(bin1) >= (
int)nBins) {
270 value += spectrum[(int)(bin1)] * (bin1 - (int)(bin1));
276 int index, limitIndex;
277 if (autocorrelation) {
280 index = std::max(0.0f,
std::min(
float(nBins - 1),
281 (nBins - 1) - (2 * nBins) / (std::max(1.0f, bin0))
283 limitIndex = std::max(0.0f,
std::min(
float(nBins - 1),
284 (nBins - 1) - (2 * nBins) / (std::max(1.0f, bin1))
288 index = std::min<int>(nBins - 1, (
int)(floor(0.5 + bin0)));
289 limitIndex = std::min<int>(nBins, (
int)(floor(0.5 + bin1)));
291 value = spectrum[index];
292 while (++index < limitIndex)
293 value = std::max(value, spectrum[index]);
295 if (!autocorrelation) {
297 value = (value + range + gain) / (
double)range;
299 value =
std::min(1.0f, std::max(0.0f, value));
306 float selBinCenter,
float selBinHi,
int dashCount,
bool isSpectral )
310 if ((selBinCenter >= 0) && (bin0 <= selBinCenter) &&
311 (selBinCenter < bin1))
313 if ((0 == dashCount % 2) &&
314 (((selBinLo >= 0) && (bin0 <= selBinLo) && ( selBinLo < bin1)) ||
315 ((selBinHi >= 0) && (bin0 <= selBinHi) && ( selBinHi < bin1))))
317 if ((selBinLo < 0 || selBinLo < bin1) && (selBinHi < 0 || selBinHi > bin0))
325 bool trackIsSelected)
327 if (!trackIsSelected)
329 const double t0 = selectedRegion.
t0();
330 const double t1 = selectedRegion.
t1();
333 auto s1 = std::clamp(
342 const std::shared_ptr<SpectralData> &mpSpectralData,
345 auto &dc = context.
dc;
347 bool onBrushTool = artist->onBrushTool;
348 const auto &selectedRegion = *artist->pSelectedRegion;
349 const auto &zoomInfo = *artist->pZoomInfo;
351#ifdef PROFILE_WAVEFORM
367 enum { DASH_LENGTH = 10 };
370 const wxRect &hiddenMid =
params.hiddenMid;
373 if (hiddenMid.width <= 0) {
377 const double &t0 =
params.t0;
382 const double &averagePixelsPerSecond =
params.averagePixelsPerSecond;
385 const double &hiddenLeftOffset =
params.hiddenLeftOffset;
386 const double &leftOffset =
params.leftOffset;
387 const wxRect &mid =
params.mid;
391 freqLo = selectedRegion.f0();
392 freqHi = selectedRegion.f1();
394 const int &colorScheme =
settings.colorScheme;
398#ifdef EXPERIMENTAL_FIND_NOTES
399 const bool &fftFindNotes =
settings.fftFindNotes;
400 const double &findNotesMinA =
settings.findNotesMinA;
401 const int &numberOfMaxima =
settings.numberOfMaxima;
402 const bool &findNotesQuantize =
settings.findNotesQuantize;
404#ifdef EXPERIMENTAL_FFT_Y_GRID
405 const bool &fftYGrid =
settings.fftYGrid;
408 dc.SetPen(*wxTRANSPARENT_PEN);
414 wxImage image((
int)mid.width, (
int)mid.height);
417#ifdef EXPERIMENTAL_SPECTROGRAM_OVERLAY
419 unsigned char *alpha = image.GetAlpha();
421 unsigned char *data = image.GetData();
423 const auto half =
settings.GetFFTLength() / 2;
424 const double binUnit =
sampleRate / (2 * half);
425 const float *freq = 0;
428 clip, freq,
settings, where, (
size_t)hiddenMid.width, t0,
429 averagePixelsPerSecond);
432 float minFreq, maxFreq;
439 float *bins = (
float*)alloca(
sizeof(*bins)*(hiddenMid.height + 1));
444 float nextBin = std::max( 0.0f,
std::min(
float(nBins - 1),
445 settings.findBin( *it, binUnit ) ) );
448 for (yy = 0; yy < hiddenMid.height; ++yy) {
450 nextBin = std::max( 0.0f,
std::min(
float(nBins - 1),
451 settings.findBin( *++it, binUnit ) ) );
456#ifdef EXPERIMENTAL_FFT_Y_GRID
459 scale2 = (lmax - lmin) / log2,
463 for (
int yy = 0; yy < mid.height; ++yy) {
464 float n = (float(yy) / mid.height*scale2 - lmin2) * 12;
465 float n2 = (float(yy + 1) / mid.height*scale2 - lmin2) * 12;
466 float f = float(minFreq) / (fftSkipPoints + 1)*powf(2.0f, n / 12.0f + lmin2);
467 float f2 = float(minFreq) / (fftSkipPoints + 1)*powf(2.0f, n2 / 12.0f + lmin2);
468 n = logf(f / 440) / log2 * 12;
469 n2 = logf(f2 / 440) / log2 * 12;
470 if (floor(n) < floor(n2))
479 if (!updated && specPxCache &&
480 ((
int)specPxCache->len == hiddenMid.height * hiddenMid.width)
481 && scaleType == specPxCache->scaleType
482 && gain == specPxCache->gain
483 && range == specPxCache->range
484 && minFreq == specPxCache->minFreq
485 && maxFreq == specPxCache->maxFreq
486#ifdef EXPERIMENTAL_FFT_Y_GRID
487 && fftYGrid==fftYGridOld
489#ifdef EXPERIMENTAL_FIND_NOTES
490 && fftFindNotes == artist->fftFindNotesOld
491 && findNotesMinA == artist->findNotesMinAOld
492 && numberOfMaxima == artist->findNotesNOld
493 && findNotesQuantize == artist->findNotesQuantizeOld
501 specPxCache = std::make_unique<SpecPxCache>(hiddenMid.width * hiddenMid.height);
502 specPxCache->scaleType = scaleType;
503 specPxCache->gain = gain;
504 specPxCache->range = range;
505 specPxCache->minFreq = minFreq;
506 specPxCache->maxFreq = maxFreq;
507#ifdef EXPERIMENTAL_FIND_NOTES
508 artist->fftFindNotesOld = fftFindNotes;
509 artist->findNotesMinAOld = findNotesMinA;
510 artist->findNotesNOld = numberOfMaxima;
511 artist->findNotesQuantizeOld = findNotesQuantize;
514#ifdef EXPERIMENTAL_FIND_NOTES
515 float log2 = logf( 2.0f ),
516 lmin = logf( minFreq ), lmax = logf( maxFreq ), scale = lmax - lmin,
522#ifdef EXPERIMENTAL_FIND_NOTES
524 float maxima0[128], maxima1[128];
527 bin2f = 1.0f / f2bin,
528 minDistance = powf(2.0f, 2.0f / 12.0f),
529 i0 = expf(lmin) / binUnit,
530 i1 = expf(scale + lmin) / binUnit,
532 const size_t maxTableSize = 1024;
537#pragma omp parallel for
539 for (
int xx = 0; xx < hiddenMid.width; ++xx) {
540#ifdef EXPERIMENTAL_FIND_NOTES
542 const int x0 = nBins * xx;
544 for (
int i = maxTableSize - 1; i >= 0; i--)
548 for (
int i = (
int)(i0); i < (int)(i1); i++) {
549 float freqi = freq[x0 + (int)(i)];
550 int value = (int)((freqi + gain + range) / range*(maxTableSize - 1));
553 if (value >= maxTableSize)
554 value = maxTableSize - 1;
558 for (
int i = maxTableSize - 1; i >= 0; i--) {
559 int index = indexes[i];
561 float freqi = freq[x0 + index];
562 if (freqi < findNotesMinA)
566 for (
int m = 0; m < maximas; m++) {
568 float maxm = maxima[m];
569 if (maxm / index < minDistance && index / maxm < minDistance) {
575 maxima[maximas++] = index;
576 if (maximas >= numberOfMaxima)
583#define f2pix(f) (logf(f)-lmins)/(lmaxs-lmins)*hiddenMid.height
586 for (
int i = 0; i < maximas; i++) {
587 int index = maxima[i];
588 float f = float(index)*bin2f;
589 if (findNotesQuantize)
591 f = expf((
int)(log(f / 440) / log2 * 12 - 0.5) / 12.0f*log2) * 440;
594 float f0 = expf((log(f / 440) / log2 * 24 - 1) / 24.0f*log2) * 440;
595 maxima0[i] = f2pix(f0);
596 float f1 = expf((log(f / 440) / log2 * 24 + 1) / 24.0f*log2) * 440;
597 maxima1[i] = f2pix(f1);
602 bool inMaximum =
false;
605 for (
int yy = 0; yy < hiddenMid.height; ++yy) {
606 const float bin = bins[yy];
607 const float nextBin = bins[yy+1];
611 (freq + nBins * xx, bin, nextBin, nBins, autocorrelation, gain, range);
612 specPxCache->values[xx * hiddenMid.height + yy] = value;
617#ifdef EXPERIMENTAL_FIND_NOTES
620 float i0 = maxima0[it];
625 float i1 = maxima1[it];
627 value =
findValue(freq + x0, bin, nextBin, nBins, autocorrelation, gain, range);
628 if (value < findNotesMinA)
648 (freq + nBins * xx, bin, nextBin, nBins, autocorrelation, gain, range);
650 specPxCache->values[xx * hiddenMid.height + yy] = value;
656 float selBinLo =
settings.findBin( freqLo, binUnit);
657 float selBinHi =
settings.findBin( freqHi, binUnit);
658 float selBinCenter = (freqLo < 0 || freqHi < 0)
662 const bool isSpectral =
settings.SpectralSelectionEnabled();
664 const int begin = hidden
666 : std::max(0, (
int)(zoomInfo.GetFisheyeLeftBoundary(-leftOffset)));
667 const int end = hidden
669 :
std::min(mid.width, (
int)(zoomInfo.GetFisheyeRightBoundary(-leftOffset)));
670 const size_t numPixels = std::max(0,
end -
begin);
678 for (
int ii =
begin; ii <
end; ++ii) {
679 const double time = zoomInfo.PositionToTime(ii, -leftOffset) - playStartTime;
694 int fisheyeLeft = zoomInfo.GetFisheyeLeftBoundary(-leftOffset);
697 int selectedX = zoomInfo.TimeToPosition(selectedRegion.t0(), -leftOffset);
700#pragma omp parallel for
704 int windowSize = mpSpectralData->GetWindowSize();
705 int hopSize = mpSpectralData->GetHopSize();
706 double sr = mpSpectralData->GetSR();
707 auto &dataHistory = mpSpectralData->dataHistory;
710 dataHistory.push_back(mpSpectralData->dataBuffer);
713 std::map<long long, std::set<int>> hopBinMap;
714 for(
auto vecIter = dataHistory.begin(); vecIter != dataHistory.end(); ++vecIter){
715 for(
const auto &hopMap: *vecIter){
716 for(
const auto &binNum: hopMap.second)
717 hopBinMap[hopMap.first].insert(binNum);
722 auto yyToFreqBin = [&](
int yy){
723 const double p = double(yy) / hiddenMid.height;
725 float convertedFreqBinNum = convertedFreq / (sr / windowSize);
731 return static_cast<int>(
lrintf(convertedFreqBinNum));
734 for (
int xx = 0; xx < mid.width; ++xx) {
735 int correctedX = xx + leftOffset - hiddenLeftOffset;
740 if (!zoomInfo.InFisheye(xx, -leftOffset)) {
744 int specIndex = (xx - fisheyeLeft) * nBins;
745 wxASSERT(specIndex >= 0 && specIndex < (
int)specCache.
freq.size());
746 uncached = &specCache.
freq[specIndex];
753 (zoomInfo.PositionToTime(xx, -leftOffset) - playStartTime));
757 (zoomInfo.PositionToTime(xx + 1, -leftOffset) - playStartTime));
759 bool maybeSelected = ssel0 <= w0 && w1 < ssel1;
760 maybeSelected = maybeSelected || (xx == selectedX);
763 std::set<int> *pSelectedBins =
nullptr;
764 std::set<int>::iterator freqBinIter;
765 auto advanceFreqBinIter = [&](
int nextBinRounded){
766 while (freqBinIter != pSelectedBins->end() &&
767 *freqBinIter < nextBinRounded)
771 bool hitHopNum =
false;
773 int convertedHopNum = (w0.as_long_long() + hopSize / 2) / hopSize;
774 hitHopNum = (hopBinMap.find(convertedHopNum) != hopBinMap.end());
776 pSelectedBins = &hopBinMap[convertedHopNum];
777 freqBinIter = pSelectedBins->begin();
778 advanceFreqBinIter(yyToFreqBin(0));
782 for (
int yy = 0; yy < hiddenMid.height; ++yy) {
784 maybeSelected =
false;
785 const float bin = bins[yy];
786 const float nextBin = bins[yy+1];
787 auto binRounded = yyToFreqBin(yy);
788 auto nextBinRounded = yyToFreqBin(yy + 1);
791 && freqBinIter != pSelectedBins->end()
792 && binRounded == *freqBinIter)
793 maybeSelected =
true;
796 advanceFreqBinIter(nextBinRounded);
808 (xx + leftOffset - hiddenLeftOffset) / DASH_LENGTH, isSpectral);
814 const float value = uncached
815 ?
findValue(uncached, bin, nextBin, nBins, autocorrelation, gain, range)
816 : specPxCache->values[correctedX * hiddenMid.height + yy];
818 unsigned char rv, gv, bv;
821#ifdef EXPERIMENTAL_FFT_Y_GRID
822 if (fftYGrid && yGrid[yy]) {
828 int px = ((mid.height - 1 - yy) * mid.width + xx);
829#ifdef EXPERIMENTAL_SPECTROGRAM_OVERLAY
831 alpha[px]= wxMin( 200, (value+0.3) * 500) ;
840 dataHistory.pop_back();
841 wxBitmap converted = wxBitmap(image);
845 memDC.SelectObject(converted);
847 dc.Blit(mid.x, mid.y, mid.width, mid.height, &memDC, 0, 0, wxCOPY, FALSE);
863 const auto &blankSelectedBrush = artist->blankSelectedBrush;
864 const auto &blankBrush = artist->blankBrush;
866 context, rect, channel, blankSelectedBrush, blankBrush );
868 for (
const auto &pInterval : channel.
Intervals()) {
869 bool selected = selectedClip &&
870 selectedClip == &pInterval->GetClip();
883 const auto &pendingTracks = *artist->pPendingTracks;
885 auto &dc = context.
dc;
891 pendingTracks.SubstitutePendingChangedChannel(*pChannel));
893#if defined(__WXMAC__)
894 wxAntialiasMode aamode = dc.GetGraphicsContext()->GetAntialiasMode();
895 dc.GetGraphicsContext()->SetAntialiasMode(wxANTIALIAS_NONE);
899 wxASSERT(waveChannelView.use_count());
901 auto selectedClip = waveChannelView->GetSelectedClip();
902 DoDraw(context, wt, selectedClip.get(), rect);
904#if defined(__WXMAC__)
905 dc.GetGraphicsContext()->SetAntialiasMode(aamode);
913 return std::make_shared<SpectrumView>(view);
922#include "../../../../MenuCreator.h"
924#include "../../../../RefreshCode.h"
925#include "../../../../prefs/PrefsDialog.h"
926#include "../../../../prefs/SpectrumPrefs.h"
928#include "../../../../widgets/PopupMenuTable.h"
940 void OnSpectrogramSettings(wxCommandEvent &);
948void SpectrogramSettingsHandler::OnSpectrogramSettings(wxCommandEvent &)
950 class ViewSettingsDialog final :
public PrefsDialog
975 if (gAudioIO->IsBusy()){
978"To change Spectrogram Settings, stop any\n playing or recording first."),
979 XO(
"Stop the Audio First"),
980 wxOK | wxICON_EXCLAMATION | wxCENTRE);
984 auto &wc = **
static_cast<WaveTrack&
>(mpData->track).Channels().begin();
993 auto title =
XO(
"%s:").Format(wc.GetTrack().GetName());
994 ViewSettingsDialog dialog(
995 mpData->pParent, mpData->project,
title, factories, page);
997 if (0 != dialog.ShowModal()) {
1011 {
"SubViews/Extra" },
1012 std::make_unique<PopupMenuSection>(
"SpectrogramSettings",
1014 PopupMenuTable::Adapt< WaveTrackPopupMenuTable >(
1018 static const int OnSpectrogramSettingsID =
1023 const auto displays = view.GetDisplays();
1024 bool hasSpectrum = (displays.end() != std::find(
1025 displays.begin(), displays.end(),
1027 WaveChannelViewConstants::Spectrum, {} }
1035 ? std::make_unique<Entry>(
"SpectrogramSettings",
1037 OnSpectrogramSettingsID,
1038 XXO(
"S&pectrogram Settings..."),
1039 (wxCommandEventFunction)
1040 (&SpectrogramSettingsHandler::OnSpectrogramSettings),
1041 SpectrogramSettingsHandler::Instance(),
1046 menu.Enable(
id, !gAudioIO->IsBusy());
1055 const auto keyCode =
event.GetKeyCode();
1057 (keyCode == WXK_BACK || keyCode == WXK_DELETE ||
1058 keyCode == WXK_NUMPAD_DELETE)
1066 event.Skip(!capture);
1073 event.Skip(!capture);
1084 event.Skip(!capture);
1089#include "../../../ui/SelectHandle.h"
1090#include "../../../../CommonCommandFlags.h"
1092#include "../../../../SpectrumAnalyst.h"
1106 const auto hasSpectrum = [](
const WaveTrack *wt){
1108 return displays.end() != std::find(
1109 displays.begin(), displays.end(),
1113 const auto iter = find_if(
begin(range),
end(range), hasSpectrum);
1114 if (iter !=
end(range)) {
1118 viewInfo, **wt.Channels().first, up);
1134 const double f0 = selectedRegion.
f0();
1135 const double f1 = selectedRegion.f1();
1136 const bool haveSpectralSelection =
1139 if (haveSpectralSelection)
1143 selectedRegion.setFrequencies
1147 selectedRegion.setFrequencies(mLastF0, mLastF1);
1169 return std::make_unique< Handler >(); } };
1176#define FN(X) (& Handler :: X)
1180 static auto menu = std::shared_ptr{
1184 XXO(
"To&ggle Spectral Selection"),
FN(OnToggleSpectralSelection),
1187 XXO(
"Next &Higher Peak Frequency"),
FN(OnNextHigherPeakFrequency),
1190 XXO(
"Next &Lower Peak Frequency"),
FN(OnNextLowerPeakFrequency),
1199 Placement{
wxT(
"Select/Basic"), { OrderingHint::After,
wxT(
"Region") } }
void GetColorGradient(float value, AColor::ColorGradientChoice selected, int colorScheme, unsigned char *__restrict red, unsigned char *__restrict green, unsigned char *__restrict blue)
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
AttachedItem sAttachment2
std::shared_ptr< UIHandle > UIHandlePtr
wxEvtHandler CommandHandlerObject
const ReservedCommandFlag & TracksExistFlag()
EffectDistortionSettings params
XXO("&Cut/Copy/Paste Toolbar")
audacity::BasicSettings * gPrefs
PrefsPanel::Factory SpectrumPrefsFactory(WaveChannel *wc)
static WaveChannelSubViewType::RegisteredType reg
static const WaveChannelSubViews::RegisteredFactory key
static WaveChannelSubView::Type sType
static bool ShouldCaptureEvent(wxKeyEvent &event, SpectralData *pData)
static UIHandlePtr BrushHandleHitTest(std::weak_ptr< BrushHandle > &holder, const TrackPanelMouseState &st, const AudacityProject *pProject, const std::shared_ptr< SpectrumView > &pChannelView, const std::shared_ptr< SpectralData > &mpData)
static Settings & settings()
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
WaveTrackPopupMenuTable & GetWaveTrackMenuTable()
@ ColorGradientUnselected
@ ColorGradientTimeAndFrequencySelected
@ ColorGradientTimeSelected
static void PreComputeGradient()
static bool gradient_inited
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
static AudioIOBase * Get()
static ChannelView & Get(Channel &channel)
virtual void DoSetMinimized(bool isMinimized)
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
AudacityProject & project
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.
float PositionToValue(float pp) const
Iterator begin(float nPositions) const
Dialog that shows the current PrefsPanel in a tabbed divider.
virtual void SavePreferredPage()=0
PrefsDialog(wxWindow *parent, AudacityProject *pProject, const TranslatableString &titlePrefix=XO("Preferences:"), PrefsPanel::Factories &factories=PrefsPanel::DefaultFactories())
virtual long GetPreferredPage()=0
std::vector< PrefsPanel::PrefsNode > Factories
A simple profiler to measure the average time lengths that a particular task/function takes....
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
static ProjectSettings & Get(AudacityProject &project)
Generates classes whose instances register items at construction.
static void SnapCenterOnce(SpectrumAnalyst &analyst, ViewInfo &viewInfo, const WaveChannel &wc, bool up)
Defines a selected portion of a project.
static const int UndefinedFrequency
void Grow(size_t len_, SpectrogramSettings &settings, double samplesPerPixel, double start)
void Populate(const SpectrogramSettings &settings, const WaveChannelInterval &clip, int copyBegin, int copyEnd, size_t numPixels, double pixelsPerSecond)
std::vector< float > freq
std::vector< sampleCount > where
std::vector< HopsAndBinsMap > dataHistory
static bool ProcessTracks(AudacityProject &project)
void SetBounds(float min, float max)
void GetBounds(const WaveChannel &wc, float &min, float &max) const
static SpectrogramBounds & Get(WaveTrack &track)
Get either the global default settings, or the track's own if previously created.
static SpectrogramSettings & Get(const WaveTrack &track)
Used for finding the peaks, for snapping to peaks.
AudacityProject * mpProject
SpectralDataSaver(SpectrumView &view)
~SpectralDataSaver() override
void Init(AudacityProject &project, bool clearAll) override
static void ForAll(AudacityProject &project, std::function< void(SpectrumView &view)> fn)
void DoSetMinimized(bool minimized) override
unsigned CaptureKey(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
bool IsSpectral() const override
void DoDraw(TrackPanelDrawingContext &context, const WaveChannel &channel, const WaveTrack::Interval *selectedClip, const wxRect &rect)
std::shared_ptr< SpectralData > mpSpectralData
std::weak_ptr< BrushHandle > mBrushHandle
unsigned KeyDown(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
std::shared_ptr< SpectralData > mpBackupSpectralData
const Type & SubViewType() const override
unsigned Char(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
std::shared_ptr< SpectralData > GetSpectralData()
SpectrumView(WaveChannelView &waveChannelView, const SpectrumView &src)=delete
std::shared_ptr< ChannelVRulerControls > DoGetVRulerControls() override
std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool) override
void CopyToSubView(WaveChannelSubView *destSubView) const override
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
static TrackArtist * Get(TrackPanelDrawingContext &)
bool GetSelected() const
Selectedness is always the same for all channels of a group.
static TrackList & Get(AudacityProject &project)
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
Holds a msgid for the translation catalog; may also bind format arguments.
NotifyingSelectedRegion selectedRegion
static ViewInfo & Get(AudacityProject &project)
IteratorRange< IntervalIterator< WaveClipChannel > > Intervals()
std::shared_ptr< WaveChannel > FindWaveChannel()
static void DrawBoldBoundaries(TrackPanelDrawingContext &context, const WaveChannel &channel, const wxRect &rect)
std::pair< bool, std::vector< UIHandlePtr > > DoDetailedHitTest(const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool, const std::shared_ptr< WaveChannel > &wt)
std::weak_ptr< WaveChannelView > GetWaveChannelView() const
static bool ClipDetailsVisible(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
static WaveChannelView & GetFirst(WaveTrack &wt)
Get the view of the first channel.
std::vector< WaveChannelSubView::Type > GetDisplays() const
sampleCount GetVisibleSampleCount() const override
size_t GetChannelIndex() const
int GetRate() const override
double GetPlayStartTime() const override
double GetStretchRatio() const override
sampleCount TimeToSamples(double time) const override
This allows multiple clips to be a part of one WaveTrack.
A Track that contains audio waveform data.
virtual bool Read(const wxString &key, bool *value) const =0
Positions or offsets within audio files need a wide type.
std::unique_ptr< detail::IndirectItem< Item > > Indirect(const std::shared_ptr< Item > &ptr)
A convenience function.
AUDACITY_DLL_API void DrawClipFolded(wxDC &dc, const wxRect &rect)
AUDACITY_DLL_API void DrawClipEdges(wxDC &dc, const wxRect &clipRect, bool selected=false)
AUDACITY_DLL_API void DrawBackgroundWithSelection(TrackPanelDrawingContext &context, const wxRect &rect, const Channel &channel, const wxBrush &selBrush, const wxBrush &unselBrush, bool useSelection=true)
constexpr auto sampleRate
void DoNextPeakFrequency(AudacityProject &project, bool up)
static CommandHandlerObject & findCommandHandler(AudacityProject &project)
auto SpectralSelectionMenu()
PopupMenuTable::AttachedItem sAttachment
AColor::ColorGradientChoice ChooseColorSet(float bin0, float bin1, float selBinLo, float selBinCenter, float selBinHi, int dashCount, bool isSpectral)
static float findValue(const float *spectrum, float bin0, float bin1, unsigned nBins, bool autocorrelation, int gain, int range)
std::pair< sampleCount, sampleCount > GetSelectedSampleIndices(const SelectedRegion &selectedRegion, const WaveChannelInterval &clip, bool trackIsSelected)
void DrawClipSpectrum(TrackPanelDrawingContext &context, const WaveChannel &channel, const WaveChannelInterval &clip, const wxRect &rect, const std::shared_ptr< SpectralData > &mpSpectralData, bool selected)
AuthorizationHandler handler
const char * end(const char *str) noexcept
const char * begin(const char *str) noexcept
__finl float_x4 __vecc sqrt(const float_x4 &a)
A convenient default parameter for class template Site.
static wxRect GetClipRect(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect, bool *outShowSamples=nullptr)
bool GetSpectrogram(const WaveChannelInterval &clip, const float *&spectrogram, SpectrogramSettings &spectrogramSettings, const sampleCount *&where, size_t numPixels, double t0, double pixelsPerSecond)
static WaveClipSpectrumCache & Get(const WaveChannelInterval &clip)
void OnNextLowerPeakFrequency(const CommandContext &context)
void OnToggleSpectralSelection(const CommandContext &context)
void OnNextHigherPeakFrequency(const CommandContext &context)
static SpectrogramSettingsHandler & Instance()
void InitUserData(void *pUserData) override
Called before the menu items are appended.