MCPcopy Create free account
hub / github.com/bbc/audiowaveform / createScaleFactor

Function createScaleFactor

src/OptionHandler.cpp:89–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87//------------------------------------------------------------------------------
88
89static std::unique_ptr<ScaleFactor> createScaleFactor(const Options& options)
90{
91 std::unique_ptr<ScaleFactor> scale_factor;
92
93 if (options.hasSamplesPerPixel() && options.hasEndTime()) {
94 throwError("Specify either --end or --zoom but not both");
95 }
96 else if (options.hasPixelsPerSecond() && options.hasEndTime()) {
97 throwError("Specify either --end or --pixels-per-second but not both");
98 }
99 else if (options.hasSamplesPerPixel() && options.hasPixelsPerSecond()) {
100 throwError("Specify either --zoom or --pixels-per-second but not both");
101 }
102 else if (options.hasEndTime()) {
103 scale_factor.reset(new DurationScaleFactor(
104 options.getStartTime(),
105 options.getEndTime(),
106 options.getImageWidth()
107 ));
108 }
109 else if (options.hasPixelsPerSecond()) {
110 scale_factor.reset(
111 new PixelsPerSecondScaleFactor(options.getPixelsPerSecond())
112 );
113 }
114 else {
115 scale_factor.reset(
116 new SamplesPerPixelScaleFactor(options.getSamplesPerPixel())
117 );
118 }
119
120 return scale_factor;
121}
122
123//------------------------------------------------------------------------------
124

Callers 3

generateWaveformDataMethod · 0.85
renderWaveformImageMethod · 0.85
resampleWaveformDataMethod · 0.85

Calls 10

hasSamplesPerPixelMethod · 0.80
hasEndTimeMethod · 0.80
hasPixelsPerSecondMethod · 0.80
resetMethod · 0.80
getStartTimeMethod · 0.80
getEndTimeMethod · 0.80
getImageWidthMethod · 0.80
getPixelsPerSecondMethod · 0.80
throwErrorFunction · 0.70
getSamplesPerPixelMethod · 0.45

Tested by

no test coverage detected