Audacity 3.2.0
|
An ImportFileHandle for LOF data. More...
Public Member Functions | |
LOFImportFileHandle (AudacityProject *pProject, const FilePath &name, std::unique_ptr< wxTextFile > &&file) | |
~LOFImportFileHandle () | |
TranslatableString | GetFileDescription () override |
ByteCount | GetFileUncompressedBytes () override |
void | Import (ImportProgressListener &progressListener, WaveTrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags, std::optional< LibFileFormats::AcidizerTags > &outAcidTags) override |
FilePath | GetFilename () const override |
void | Cancel () override |
void | Stop () override |
wxInt32 | GetStreamCount () override |
const TranslatableStrings & | GetStreamInfo () override |
void | SetStreamUsage (wxInt32 WXUNUSED(StreamID), bool WXUNUSED(Use)) override |
Public Member Functions inherited from ImportFileHandle | |
virtual | ~ImportFileHandle () |
virtual FilePath | GetFilename () const =0 |
virtual TranslatableString | GetErrorMessage () const |
virtual TranslatableString | GetFileDescription ()=0 |
virtual ByteCount | GetFileUncompressedBytes ()=0 |
virtual wxInt32 | GetStreamCount ()=0 |
virtual const TranslatableStrings & | GetStreamInfo ()=0 |
virtual void | SetStreamUsage (wxInt32 StreamID, bool Use)=0 |
virtual void | Import (ImportProgressListener &progressListener, WaveTrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags, std::optional< LibFileFormats::AcidizerTags > &acidTags)=0 |
virtual void | Cancel ()=0 |
virtual void | Stop ()=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 |
const wxFileName | mLOFFileName |
AudacityProject * | mProject {} |
int | nFilesInGroup { 0 } |
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 |
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.
Definition at line 113 of file ImportLOF.cpp.
LOFImportFileHandle::LOFImportFileHandle | ( | AudacityProject * | pProject, |
const FilePath & | name, | ||
std::unique_ptr< wxTextFile > && | file | ||
) |
Definition at line 166 of file ImportLOF.cpp.
LOFImportFileHandle::~LOFImportFileHandle | ( | ) |
Definition at line 534 of file ImportLOF.cpp.
|
overridevirtual |
Implements ImportFileHandle.
Definition at line 324 of file ImportLOF.cpp.
|
private |
Definition at line 508 of file ImportLOF.cpp.
References callDurationFactor, callScrollOffset, durationFactor, ProjectHistory::Get(), TrackList::Get(), Viewport::Get(), TrackList::GetEndTime(), ProjectHistory::ModifyState(), mProject, scrollOffset, Viewport::SetHorizontalThumb(), and Viewport::ZoomBy().
Referenced by Import(), and lofOpenFiles().
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Implements ImportFileHandle.
Definition at line 135 of file ImportLOF.cpp.
|
overridevirtual |
Implements ImportFileHandle.
Definition at line 271 of file ImportLOF.cpp.
References doDurationAndScrollOffset(), ImportProgressListener::Error, lofOpenFiles(), mTextFile, ImportProgressListener::OnImportResult(), and ImportProgressListener::Success.
|
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
Definition at line 344 of file ImportLOF.cpp.
References callDurationFactor, callScrollOffset, Internat::CompatibleToDouble(), doDurationAndScrollOffset(), durationFactor, ProjectHistory::Get(), TrackList::Get(), mLOFFileName, ProjectHistory::ModifyState(), mProject, nFilesInGroup, ProjectManager::OpenProject(), scrollOffset, ImportUtils::ShowMessageBox(), tracks, wxT(), and XO().
Referenced by Import().
|
inlineoverride |
Definition at line 141 of file ImportLOF.cpp.
|
overridevirtual |
Implements ImportFileHandle.
Definition at line 329 of file ImportLOF.cpp.
|
private |
Definition at line 158 of file ImportLOF.cpp.
Referenced by doDurationAndScrollOffset(), and lofOpenFiles().
|
private |
Definition at line 162 of file ImportLOF.cpp.
Referenced by doDurationAndScrollOffset(), and lofOpenFiles().
|
private |
Definition at line 159 of file ImportLOF.cpp.
Referenced by doDurationAndScrollOffset(), and lofOpenFiles().
|
private |
The name of the LOF file, which is used to interpret relative paths in it
Definition at line 150 of file ImportLOF.cpp.
Referenced by GetFilename(), and lofOpenFiles().
|
private |
Definition at line 152 of file ImportLOF.cpp.
Referenced by doDurationAndScrollOffset(), and lofOpenFiles().
|
private |
Definition at line 149 of file ImportLOF.cpp.
Referenced by Import().
|
private |
Definition at line 155 of file ImportLOF.cpp.
Referenced by lofOpenFiles().
|
private |
Definition at line 163 of file ImportLOF.cpp.
Referenced by doDurationAndScrollOffset(), and lofOpenFiles().