[Clam-devel] AudioFile refactor progress

David García Garzón dgarcia at iua.upf.edu
Sun Apr 15 06:43:55 PDT 2007


AudioFile refactoring finnished (still several long term pending tasks).

Audio writers' usage code simplification is deeper than readers'. Before the 
refactor you had to create not just an AudioFile object but also a Header 
object. Now you just set the header parameters as configuration parameters. 
Moreover i just kept SampleRate and NChannels (on multichannel) and they 
default to the most used values (44100 and 2).

What happened with the other parameters? Length and NSamples have no sense on 
writting. Format (ogg, mp3, aiff, wav...) is deduced from the filename 
extension. We could add such a field but I think that the management of that 
default behavior could become complex and it is not worth. Some fields i 
think that may be added in the future are Encoding (8bits, 16bigs, ulaw...) 
and Endianess but nobody used that, just on the tests to translate the 
parameters from input to output. Another missing feature now is to write ID3 
with the TextDescriptors. Also nobody used that but it maybe a wished 
feature. Let's add them on demand.

AudioFile has become mostly a inner implementation detail for processing 
classes. I kept an accessor to the inner AudioFile on readers so you could 
access to the readed Header and TextDescriptors, but it could be refactored 
as a direct access to such fields.

TODO's Summary.
* Add Encoding and Endianess fields to writer's configs
* Add TextDescriptors to writer's configs
* Abstract accessors to reader's Header (or to its fields) and to 
TextDescriptors and remove AudioFile accessor
* Simplify AudioFile hierarchy 
* Simplify writer and reader Processings inner code



On Dissabte 14 Abril 2007, Pau Arumi wrote:
> En/na David García Garzón ha escrit:
> > Status: I just ported MonoAudioFileReader to see what happened and the
> > migration is not as hard as i thought. Moreover, both the code and the
> > XML get simpler. For example, former configuration code for a
> > MonoAudioFileReader was:
> >
> > AudioFile file;
> > file.OpenExisting("lala.wav");
> > MonoAudioFileReaderConfig config;
> > config.SetSourceFile(file);
> > MonoAudioFileReader reader(config);
> >
> > Current one:
> >
> > MonoAudioFileReaderConfig config;
> > config.SetSourceFile("lala.wav");
> > MonoAudioFileReader reader(config);
> >
> > And the XML now is:
>  > ...
>
> that's great news! the kick-out-audiofile-from-config-refactoring paid
> off
>
>
>
> _______________________________________________
> Clam-devel mailing list
> Clam-devel at llistes.projectes.lafarga.org
> https://llistes.projectes.lafarga.org/cgi-bin/mailman/listinfo/clam-devel



-- 
David García Garzón
(Work) dgarcia at iua dot upf anotherdot es
(Home) vokimon at telefonica adot net
http://www.iua.upf.edu/~dgarcia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20070415/00cd0bc7/attachment-0001.sig>


More information about the clam-devel mailing list