[Clam-devel] AudioFile refactor progress

David García Garzón dgarcia at iua.upf.edu
Sat Apr 14 07:22:22 PDT 2007


Going ahead with Zach patch on AudioFile, Pau and me did some refactorings on 
Friday. Not finished yet. The idea is having Filename objects which are as 
lightweight as the former CLAM::Filename (they can be used just like strings) 
but having the filters configurability that Zach added to ConfigurableFile.

Pau wrote an example on how to add and use new filename types at 
NetworkEditor/src/processing/FilenameUsageExample.hxx

By having this lightweight object on the configuration, we can hide AudioFile 
management as implementaiton detail of the audio file related Processings. If 
you still need it, there is a GetAudioFile() method on the processings.

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:

<processing id="MonoAudioFileReader_0" type="MonoAudioFileReader">
<SourceFile>example-data/jaume-voice.mp3</SourceFile>
<SelectedChannel>0</SelectedChannel>
<Loop>0</Loop>
</processing>

Instead of:

<processing id="MonoAudioFileReader_0" type="MonoAudioFileReader">
<SourceFile>
<URI>example-data/Guillamino_CitiusAltiusFortius.mp3</URI>
<Header>
<SampleRate>44100</SampleRate>
<Samples>1443393</Samples>
<Channels>1</Channels>
<Length>32730</Length>
<Format>Mpeg Audio Layer 3</Format>
<Encoding>Format Default</Encoding>
<Endianess>Format Default</Endianess>
</Header>
<TextualDescriptors/>
</SourceFile>
<SelectedChannel>0</SelectedChannel>
<Loop>0</Loop>
</processing>

They seem pretty independent so I'll commit MonoAudioFileReader changes and 
proceed with the next one.

-- 
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/20070414/e55df7f2/attachment-0003.pgp>


More information about the clam-devel mailing list