Loading...
Searching...
No Matches
Media::AudioTrimmer Class Referencefinal

Writes the used part of an audio file into a new WAV. More...

Inheritance diagram for Media::AudioTrimmer:
Process::MediaTrimmer score::InterfaceBase

Detailed Description

Writes the used part of an audio file into a new WAV.

Decodes at the source's own rate – resampling here would change the audio, and trimming must not – then writes 32-bit float, which is what score decodes to. That can make a compressed source grow, which is exactly why the caller keeps the result only when it is actually smaller.

Public Member Functions

bool supports (const QString &absolutePath) const noexcept override
 Can this trimmer read that file?
 
QString outputExtension () const noexcept override
 The extension the trimmed file must take, without the dot.
 
double duration (const QString &absolutePath) const override
 Duration of the file in seconds, or 0 if it cannot be read.
 
qint64 estimatedSize (const QString &absolutePath, Process::MediaRange kept) const override
 
QString trim (const QString &source, const QString &destination, Process::MediaRange range) const override
 
- Public Member Functions inherited from score::InterfaceBase
virtual InterfaceKey interfaceKey () const noexcept=0
 Identifies an interface uniquely.
 

Member Function Documentation

◆ duration()

double Media::AudioTrimmer::duration ( const QString &  absolutePath) const
overridevirtual

Duration of the file in seconds, or 0 if it cannot be read.

Implements Process::MediaTrimmer.

◆ estimatedSize()

qint64 Media::AudioTrimmer::estimatedSize ( const QString &  absolutePath,
Process::MediaRange  kept 
) const
overridevirtual

Size the trimmed file would take, so the plan shown to the user is the one that happens.

Scaling the source's size by the kept fraction is not good enough: a trimmer that re-encodes – and the audio one writes 32-bit float – can hand back a bigger file from a smaller region, and a plan promising space that never appears is exactly the complaint other implementations get.

Implements Process::MediaTrimmer.

◆ outputExtension()

QString Media::AudioTrimmer::outputExtension ( ) const
overridevirtualnoexcept

The extension the trimmed file must take, without the dot.

Implements Process::MediaTrimmer.

◆ supports()

bool Media::AudioTrimmer::supports ( const QString &  absolutePath) const
overridevirtualnoexcept

Can this trimmer read that file?

Implements Process::MediaTrimmer.

◆ trim()

QString Media::AudioTrimmer::trim ( const QString &  source,
const QString &  destination,
Process::MediaRange  range 
) const
overridevirtual

Write range of source into destination.

range is in seconds of the source's own timeline and has already been clamped to it. Returns an empty string on success, the reason otherwise.

Implements Process::MediaTrimmer.


The documentation for this class was generated from the following files: