Audacity  2.2.0
LOFImportFileHandle Class Referencefinal

An ImportFileHandle for LOF data. More...

Inheritance diagram for LOFImportFileHandle:
ImportFileHandle

Public Member Functions

 LOFImportFileHandle (const wxString &name, std::unique_ptr< wxTextFile > &&file)
 
 ~LOFImportFileHandle ()
 
wxString GetFileDescription () override
 
ByteCount GetFileUncompressedBytes () override
 
ProgressResult Import (TrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags) override
 
wxInt32 GetStreamCount () override
 
const wxArrayString & GetStreamInfo () override
 
void SetStreamUsage (wxInt32 WXUNUSED(StreamID), bool WXUNUSED(Use)) override
 
- Public Member Functions inherited from ImportFileHandle
 ImportFileHandle (const wxString &filename)
 
virtual ~ImportFileHandle ()
 
void CreateProgress ()
 
virtual void SetStreamUsage (wxInt32 StreamID, bool Use)=0
 

Private Member Functions

void lofOpenFiles (wxString *ln)
 Processes a single line from a LOF text file, doing whatever is indicated on the line. More...
 
void doDurationAndScrollOffset ()
 

Private Attributes

std::unique_ptr< wxTextFile > mTextFile
 
wxFileName mLOFFileName
 
AudacityProjectmProject { GetActiveProject() }
 
bool windowCalledOnce { false }
 
bool callDurationFactor { false }
 
double durationFactor { 1 }
 
bool callScrollOffset { false }
 
double scrollOffset { 0 }
 

Additional Inherited Members

- Public Types inherited from ImportFileHandle
using ByteCount = unsigned long long
 
- Protected Attributes inherited from ImportFileHandle
wxString mFilename
 
Maybe< ProgressDialogmProgress
 

Detailed Description

An ImportFileHandle for LOF data.

Supports the opening of ".lof" files which are text files that contain a list of individual files to open in audacity in specific formats. Files may be file names (in the same directory as the LOF file), absolute paths or relative paths relative to the directory of the LOF file.

(In BNF) The syntax for an LOF file, denoted by <lof>:

  <lof> ::= [<window> | <file> | <#>]*
  <window> ::= window [<window-parameter>]* <newline>
  <window-parameter> ::= offset <time> | duration <time>
  <time> ::= [<digit>]+ [ . [<digit>]* ]
  <file> ::= file [<file-parameter>]* <newline>
  <file-parameter> ::= offset <time>
  <#> ::= <comment> <newline>

EXAMPLE LOF file:

  # everything following the hash character is ignored
  window # an initial window command is implicit and optional
  file "C:\folder1\sample1.wav"    # sample1.wav is displayed
  file "C:\sample2.wav" offset 5   # sample2 is displayed with a 5s offset
  File "C:\sample3.wav"            # sample3 is displayed with no offset
  File "foo.aiff" # foo is loaded from the same directory as the LOF file
  window offset 5 duration 10      # open a NEW window, zoom to display
  # 10 seconds total starting at 5 (ending at 15) seconds
  file "C:\sample3.wav" offset 2.5

SEMANTICS:

There are two commands: "window" creates a NEW window, and "file" appends a track to the current window and displays the file there. The first file is always placed in a NEW window, whether or not an initial "window" command is given.

Commands have optional keyword parameters that may be listed in any order. A parameter should only occur once per command. The "offset" parameter specifies a time offset. For windows, this is the leftmost time displayed in the window. For files, the offset is an amount by which the file is shifted in time before display (only enabled for audio; not midi). The offset is specified as an integer or decimal number of seconds, and the default value is zero.

Windows may also have a "duration" parameter, which specifies how much time should be displayed in the window. The default duration is equal to the duration of the longest track currently displayed.

Constructor & Destructor Documentation

LOFImportFileHandle::LOFImportFileHandle ( const wxString &  name,
std::unique_ptr< wxTextFile > &&  file 
)
LOFImportFileHandle::~LOFImportFileHandle ( )

Member Function Documentation

wxString LOFImportFileHandle::GetFileDescription ( )
overridevirtual

Implements ImportFileHandle.

References DESC.

auto LOFImportFileHandle::GetFileUncompressedBytes ( )
overridevirtual

Implements ImportFileHandle.

wxInt32 LOFImportFileHandle::GetStreamCount ( )
inlineoverridevirtual

Implements ImportFileHandle.

const wxArrayString& LOFImportFileHandle::GetStreamInfo ( )
inlineoverridevirtual

Implements ImportFileHandle.

ProgressResult LOFImportFileHandle::Import ( TrackFactory trackFactory,
TrackHolders outTracks,
Tags tags 
)
overridevirtual
void LOFImportFileHandle::lofOpenFiles ( wxString *  ln)
private

Processes a single line from a LOF text file, doing whatever is indicated on the line.

This function should just return for lines it cannot deal with, and the caller will continue to the next line of the input file

References _(), callDurationFactor, callScrollOffset, Internat::CompatibleToDouble(), CountNumTracks(), doDurationAndScrollOffset(), AudacityProject::DoImportMIDI(), durationFactor, AudacityProject::GetTracks(), Importer::IsMidi(), mLOFFileName, mProject, AudacityProject::OpenProject(), scrollOffset, AudacityProject::TP_ModifyState(), and windowCalledOnce.

Referenced by Import().

void LOFImportFileHandle::SetStreamUsage ( wxInt32   WXUNUSEDStreamID,
bool   WXUNUSEDUse 
)
inlineoverride

Member Data Documentation

bool LOFImportFileHandle::callDurationFactor { false }
private
bool LOFImportFileHandle::callScrollOffset { false }
private
double LOFImportFileHandle::durationFactor { 1 }
private
wxFileName LOFImportFileHandle::mLOFFileName
private

The name of the LOF file, which is used to interpret relative paths in it

Referenced by lofOpenFiles().

AudacityProject* LOFImportFileHandle::mProject { GetActiveProject() }
private
std::unique_ptr<wxTextFile> LOFImportFileHandle::mTextFile
private

Referenced by Import().

double LOFImportFileHandle::scrollOffset { 0 }
private
bool LOFImportFileHandle::windowCalledOnce { false }
private

Referenced by lofOpenFiles().


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