![]() |
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 |
ProgressResult | Import (WaveTrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags) override |
wxInt32 | GetStreamCount () override |
const TranslatableStrings & | GetStreamInfo () override |
void | SetStreamUsage (wxInt32 WXUNUSED(StreamID), bool WXUNUSED(Use)) override |
![]() | |
ImportFileHandle (const FilePath &filename) | |
virtual | ~ImportFileHandle () |
void | CreateProgress () |
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 ProgressResult | Import (WaveTrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags)=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 |
AudacityProject * | mProject {} |
int | nFilesInGroup { 0 } |
bool | callDurationFactor { false } |
double | durationFactor { 1 } |
bool | callScrollOffset { false } |
double | scrollOffset { 0 } |
Additional Inherited Members | |
![]() | |
using | ProgressResult = BasicUI::ProgressResult |
using | ByteCount = unsigned long long |
![]() | |
static sampleFormat | ChooseFormat (sampleFormat effectiveFormat) |
Choose appropriate format, which will not be narrower than the specified one. More... | |
![]() | |
std::shared_ptr< WaveTrack > | NewWaveTrack (WaveTrackFactory &trackFactory, sampleFormat effectiveFormat, double rate) |
Build a wave track with appropriate format, which will not be narrower than the specified one. More... | |
![]() | |
FilePath | mFilename |
std::unique_ptr< ProgressDialog > | mProgress |
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 118 of file ImportLOF.cpp.
LOFImportFileHandle::LOFImportFileHandle | ( | AudacityProject * | pProject, |
const FilePath & | name, | ||
std::unique_ptr< wxTextFile > && | file | ||
) |
Definition at line 163 of file ImportLOF.cpp.
LOFImportFileHandle::~LOFImportFileHandle | ( | ) |
Definition at line 567 of file ImportLOF.cpp.
|
private |
Definition at line 541 of file ImportLOF.cpp.
References callDurationFactor, callScrollOffset, durationFactor, ProjectHistory::Get(), TrackList::Get(), ProjectWindow::Get(), TrackList::GetEndTime(), ProjectHistory::ModifyState(), mProject, scrollOffset, ProjectWindow::TP_ScrollWindow(), and ProjectWindow::ZoomBy().
Referenced by Import(), and lofOpenFiles().
|
overridevirtual |
|
overridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Implements ImportFileHandle.
Definition at line 132 of file ImportLOF.cpp.
|
overridevirtual |
Implements ImportFileHandle.
Definition at line 269 of file ImportLOF.cpp.
References doDurationAndScrollOffset(), lofOpenFiles(), mTextFile, and BasicUI::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 346 of file ImportLOF.cpp.
References AudacityMessageBox(), callDurationFactor, callScrollOffset, TrackList::Channels(), Internat::CompatibleToDouble(), doDurationAndScrollOffset(), DoImportMIDIProject(), durationFactor, ProjectHistory::Get(), TrackList::Get(), FileNames::IsMidi(), mLOFFileName, ProjectHistory::ModifyState(), mProject, nFilesInGroup, ProjectManager::OpenProject(), scrollOffset, wxT(), and XO().
Referenced by Import().
|
inlineoverride |
Definition at line 138 of file ImportLOF.cpp.
|
private |
Definition at line 155 of file ImportLOF.cpp.
Referenced by doDurationAndScrollOffset(), and lofOpenFiles().
|
private |
Definition at line 159 of file ImportLOF.cpp.
Referenced by doDurationAndScrollOffset(), and lofOpenFiles().
|
private |
Definition at line 156 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 147 of file ImportLOF.cpp.
Referenced by lofOpenFiles().
|
private |
Definition at line 149 of file ImportLOF.cpp.
Referenced by doDurationAndScrollOffset(), and lofOpenFiles().
|
private |
Definition at line 146 of file ImportLOF.cpp.
Referenced by Import().
|
private |
Definition at line 152 of file ImportLOF.cpp.
Referenced by lofOpenFiles().
|
private |
Definition at line 160 of file ImportLOF.cpp.
Referenced by doDurationAndScrollOffset(), and lofOpenFiles().