Audacity 3.2.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ImportFileHandle Class Referenceabstract

An ImportFileHandle for data. More...

#include <ImportPlugin.h>

Inheritance diagram for ImportFileHandle:
[legend]
Collaboration diagram for ImportFileHandle:
[legend]

Public Types

using ProgressResult = BasicUI::ProgressResult
 
using ByteCount = unsigned long long
 

Public Member Functions

 ImportFileHandle (const FilePath &filename)
 
virtual ~ImportFileHandle ()
 
void CreateProgress ()
 
virtual TranslatableString GetFileDescription ()=0
 
virtual ByteCount GetFileUncompressedBytes ()=0
 
virtual wxInt32 GetStreamCount ()=0
 
virtual const TranslatableStringsGetStreamInfo ()=0
 
virtual void SetStreamUsage (wxInt32 StreamID, bool Use)=0
 
virtual ProgressResult Import (WaveTrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags)=0
 

Static Public Member Functions

static sampleFormat ChooseFormat (sampleFormat effectiveFormat)
 Choose appropriate format, which will not be narrower than the specified one. More...
 

Protected Member Functions

std::shared_ptr< WaveTrackNewWaveTrack (WaveTrackFactory &trackFactory, sampleFormat effectiveFormat, double rate)
 Build a wave track with appropriate format, which will not be narrower than the specified one. More...
 

Protected Attributes

FilePath mFilename
 
std::unique_ptr< ProgressDialogmProgress
 

Detailed Description

An ImportFileHandle for data.

Base class for FlacImportFileHandle, LOFImportFileHandle, MP3ImportFileHandle, OggImportFileHandle and PCMImportFileHandle. Gives API for sound file import.

The Ogg format supports multiple logical bitstreams that can be chained within the physical bitstream. The sampling rate and number of channels can vary between these logical bitstreams. For the moment, we'll ignore all but the first logical bitstream.

Ogg also allows for an arbitrary number of channels. Luckily, so does Audacity. We'll call the first channel LeftChannel, the second RightChannel, and all others after it MonoChannel.

Definition at line 111 of file ImportPlugin.h.

Member Typedef Documentation

◆ ByteCount

using ImportFileHandle::ByteCount = unsigned long long

Definition at line 132 of file ImportPlugin.h.

◆ ProgressResult

Definition at line 114 of file ImportPlugin.h.

Constructor & Destructor Documentation

◆ ImportFileHandle()

ImportFileHandle::ImportFileHandle ( const FilePath filename)

Definition at line 41 of file ImportPlugin.cpp.

42: mFilename(filename)
43{
44}
FilePath mFilename
Definition: ImportPlugin.h:163

◆ ~ImportFileHandle()

ImportFileHandle::~ImportFileHandle ( )
virtual

Definition at line 46 of file ImportPlugin.cpp.

47{
48}

Member Function Documentation

◆ ChooseFormat()

sampleFormat ImportFileHandle::ChooseFormat ( sampleFormat  effectiveFormat)
static

Choose appropriate format, which will not be narrower than the specified one.

Definition at line 59 of file ImportPlugin.cpp.

60{
61 // Consult user preference
62 auto defaultFormat = QualitySettings::SampleFormatChoice();
63
64 // Don't choose format narrower than effective or default
65 auto format = std::max(effectiveFormat, defaultFormat);
66
67 // But also always promote 24 bits to float
68 if (format > int16Sample)
70
71 return format;
72}
int format
Definition: ExportPCM.cpp:53
PROJECT_RATE_API sampleFormat SampleFormatChoice()

References floatSample, format, int16Sample, and QualitySettings::SampleFormatChoice().

Referenced by ImportRaw(), NewWaveTrack(), and PCMImportFileHandle::PCMImportFileHandle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateProgress()

void ImportFileHandle::CreateProgress ( )

Definition at line 50 of file ImportPlugin.cpp.

51{
52 wxFileName ff( mFilename );
53
54 auto title = XO("Importing %s").Format( GetFileDescription() );
55 mProgress = std::make_unique< ProgressDialog >(
56 title, Verbatim( ff.GetFullName() ) );
57}
XO("Cut/Copy/Paste")
static const auto title
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
virtual TranslatableString GetFileDescription()=0
std::unique_ptr< ProgressDialog > mProgress
Definition: ImportPlugin.h:164

References GetFileDescription(), mFilename, mProgress, title, Verbatim(), and XO().

Referenced by GStreamerImportFileHandle::Import(), AUPImportFileHandle::Import(), FFmpegImportFileHandle::Import(), FLACImportFileHandle::Import(), MP3ImportFileHandle::Import(), anonymous_namespace{ImportMP3_MPG123.cpp}::MP3ImportFileHandle::Import(), OggImportFileHandle::Import(), PCMImportFileHandle::Import(), and WavPackImportFileHandle::Import().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetFileDescription()

virtual TranslatableString ImportFileHandle::GetFileDescription ( )
pure virtual

Implemented in AUPImportFileHandle, FFmpegImportFileHandle, FLACImportFileHandle, GStreamerImportFileHandle, LOFImportFileHandle, MP3ImportFileHandle, anonymous_namespace{ImportMP3_MPG123.cpp}::MP3ImportFileHandle, OggImportFileHandle, PCMImportFileHandle, and WavPackImportFileHandle.

Referenced by CreateProgress().

Here is the caller graph for this function:

◆ GetFileUncompressedBytes()

virtual ByteCount ImportFileHandle::GetFileUncompressedBytes ( )
pure virtual

◆ GetStreamCount()

virtual wxInt32 ImportFileHandle::GetStreamCount ( )
pure virtual

◆ GetStreamInfo()

virtual const TranslatableStrings & ImportFileHandle::GetStreamInfo ( )
pure virtual

◆ Import()

virtual ProgressResult ImportFileHandle::Import ( WaveTrackFactory trackFactory,
TrackHolders outTracks,
Tags tags 
)
pure virtual

◆ NewWaveTrack()

std::shared_ptr< WaveTrack > ImportFileHandle::NewWaveTrack ( WaveTrackFactory trackFactory,
sampleFormat  effectiveFormat,
double  rate 
)
protected

Build a wave track with appropriate format, which will not be narrower than the specified one.

Definition at line 74 of file ImportPlugin.cpp.

76{
77 return trackFactory.Create(ChooseFormat(effectiveFormat), rate);
78}
static sampleFormat ChooseFormat(sampleFormat effectiveFormat)
Choose appropriate format, which will not be narrower than the specified one.
std::shared_ptr< WaveTrack > Create()
Creates an unnamed empty WaveTrack with default sample format and default rate.
Definition: WaveTrack.cpp:182

References ChooseFormat(), and WaveTrackFactory::Create().

Referenced by FFmpegImportFileHandle::Import(), FLACImportFileHandle::Import(), OggImportFileHandle::Import(), PCMImportFileHandle::Import(), WavPackImportFileHandle::Import(), MP3ImportFileHandle::OutputCB(), and anonymous_namespace{ImportMP3_MPG123.cpp}::MP3ImportFileHandle::SetupOutputFormat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetStreamUsage()

virtual void ImportFileHandle::SetStreamUsage ( wxInt32  StreamID,
bool  Use 
)
pure virtual

Member Data Documentation

◆ mFilename

FilePath ImportFileHandle::mFilename
protected

◆ mProgress

std::unique_ptr<ProgressDialog> ImportFileHandle::mProgress
protected

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