MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / DisplayWaveform

Method DisplayWaveform

src/Frame.cpp:268–298  ·  view source on GitHub ↗

Display the wave form

Source from the content-addressed store, hash-verified

266
267// Display the wave form
268void Frame::DisplayWaveform()
269{
270 // Get audio wave form image
271 GetWaveform(720, 480, 0, 123, 255, 255);
272
273 if (!QApplication::instance()) {
274 // Only create the QApplication once
275 static int argc = 1;
276 static char* argv[1] = {NULL};
277 previewApp = std::make_shared<QApplication>(argc, argv);
278 }
279
280 // Create window
281 QWidget previewWindow;
282 previewWindow.setStyleSheet("background-color: #000000;");
283 QHBoxLayout layout;
284
285 // Create label with current frame's waveform image
286 QLabel previewLabel;
287 previewLabel.setPixmap(QPixmap::fromImage(*wave_image));
288 previewLabel.setMask(QPixmap::fromImage(*wave_image).mask());
289 layout.addWidget(&previewLabel);
290
291 // Show the window
292 previewWindow.setLayout(&layout);
293 previewWindow.show();
294 previewApp->exec();
295
296 // Deallocate waveform image
297 ClearWaveform();
298}
299
300// Get magnitude of range of samples (if channel is -1, return average of all channels for that sample)
301float Frame::GetAudioSample(int channel, int sample, int magnitude_range)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected