MCPcopy Create free account
hub / github.com/audacity/audacity / FrequencyToPosition

Function FrequencyToPosition

src/tracks/ui/BrushHandle.cpp:65–76  ·  view source on GitHub ↗

Converts a frequency to screen y position.

Source from the content-addressed store, hash-verified

63{
64 /// Converts a frequency to screen y position.
65 wxInt64 FrequencyToPosition(const WaveChannel &wc,
66 double frequency,
67 wxInt64 trackTopEdge,
68 int trackHeight)
69 {
70 const auto &settings = SpectrogramSettings::Get(wc);
71 float minFreq, maxFreq;
72 SpectrogramBounds::Get(wc).GetBounds(wc, minFreq, maxFreq);
73 const NumberScale numberScale(settings.GetScale(minFreq, maxFreq));
74 const float p = numberScale.ValueToPosition(frequency);
75 return trackTopEdge + wxInt64((1.0 - p) * trackHeight);
76 }
77
78 /// Converts a position (mouse Y coordinate) to
79 /// frequency, in Hz.

Callers

nothing calls this directly

Calls 4

GetFunction · 0.85
GetScaleMethod · 0.80
GetBoundsMethod · 0.45
ValueToPositionMethod · 0.45

Tested by

no test coverage detected