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