|
From: Kolja K. <ko...@fr...> - 2021-08-28 16:29:16
|
> Could you please elaborate, i.e. examples of where you would see
> > issues by
> > just supplying regex patterns from the command line?
Sure!
I don't know in which order the attributes might be.
The regex you implemented uses a fixed order:
'(Name1)(Name2)(Velocity)(Note_Nr)(Note_Name)'
Take the following filename:
'Name - 64 - Bb3 - articulation.wav'
A regex-pattern could look like this:
'(.*) - (\d*) - (.*) - (.*).wav'
But how would the code know, that '64' is meant to be the velocity?
Or that 'Bb3' is a NoteName and 'articulation' is Name2?
One would also somehow have to enter the correct order, like
'(Name1)(Velocity)(Note_Name)(Name2)',
or am I missing something?
By using format specifiers, like in printf, you would simply enter:
'%n - %v - %a - %m.wav'
(where %n = Name1, %v = velocity, %a = Note_Name, %m = Name2)
I implemented some more checks today, each attribute is now checked
against a given regex-string, e.g. NoteName:
(^[c|C|d|D|e|E|f|F|g|G|a|A|b|B].*-?\\d+$)
where a pattern for the signs ('.*' in the string) will have to be
supplied if no Note_Nr is available in the filename (defaults to '#'
and 'b').
Also, it is checked that all required values for further processing are
available (for now: Name1, Velocity, Note_Nr).
It 'should' be quite robust now, I believe.
Both updated files are attached (patch created against wav2gig.cpp from
today).
Of course, all the information and examples at the beginning could go
into the manpage, but I would recommend to at least print the available
specifiers (if you want to use the filenamescanner at all...;).
> The patch also adds
> > > "
> > > } else {
> > > s->MIDIUnityNote = wav->note;
> > > "
> > > as you proposed.
> >
> > I committed that now, because no matter how the naming scheme
> > evolves, this
> > change makes sense anyway.
Cool, thanks!
Cheers,
Kolja
|