Questions about arts (mostly to be used in docs)

Stefan Westerfeld stefan at space.twc.de
Mon Feb 24 14:48:15 GMT 2003


   Hi!

On Sat, Feb 22, 2003 at 11:45:42PM -0700, tech at bishop.dhs.org wrote:
> You said to ask questions, so I'm taking you at your word :-) However,
> I'm cc:ing kde-multimedia in case someone else knows, so as to make your
> job easier...  
> 
> 1)  I have the skeleton of a new PlayObject written, and I want to try
> it out.  However, artsd keeps complaining about unknown file format when
> I use artsplay on one of my test files.  I've compared my .mcopclass
> file against various other ones, and I believe I have the format
> correct.  Where should I be looking to debug this?  All applicable files
> available upon request. I have both run kbuildsycoca by hand and logged
> out/in.

artsplay is the wrong thing to try out PlayObjects. It is hardcoded to use
Arts::Synth_PLAY_WAV, since these files are cacheable (PlayObjects are not).
Use kaboodle.

> 2a)  Arts::Refiller has a method read that takes a pointer to an unsigned
> char buffer.  I presume that you are meant to fill that with data from
> your decoder?  If so, what format is it supposed to be in? I.e., 16-bit,
> 44Khz stereo little-endian?  How do you do stereo with one buffer?  I've
> tried to figure this out by reading other PlayObject's code, but it
> always seems to require either in-depth knowledge of (yet another) third 
> party library (itc, for example), or the code is just unreadable.

Arts::Refiller has methods to configure the format. I added documentation to
resample.h in the CVS now, please ask me if that documentation is not good
enough ;).

> 2b)  The same method takes an argument of type 'unsigned long' (len).
> What does that represent? The length of time/bytes/blocks/frames that
> you should read into 2a's buffer? Something else entirely?  If it is a
> length, how do you know what unit it is in?

Bytes. See newly added documentation.

> 3)  (probably should precede 2?) What is the bare minimum needed to
> implement an Arts::PlayObject?  Should I be aggregating with ::Refiller,
> something else, just plain PlayObject, ???  Am I correct in assuming
> that a "Refiller" is "where the action is" (i.e., where you would
> presumably instantiate a decoder object of your library, and do the
> actual work)?  If not, what is the norm?

 * make an IDL file, and define a new interface (i.e. FlacPlayObject)
 * derive from the sekeleton in your implementation
 * to make it easier, consider deriving from Arts::StdSynthModule
 * implmenent all virtual methods that the compiler tells you to reimplement

You need to implement calculateBlock, basically. But since most decoders
provide data as 16bit integer in some fixed sampling rate, PlayObjects usually
need to use some form of conversion. There are two commonly used:

1. resample.h: Arts::Resampler, Arts::Refiller
2. convert.h: uni_convert_stereo_2float

The first is easier to use. Somewhen one will need to write somewhat more
perfect resampling code, that supplies the features of both (for instance,
convert.h can also resample _to_ 16bit data, not only _from_). However for
now, choose what is more convenient for you, or implement your own resampling.

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan at space.twc.de (PGP!), Hamburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-         



More information about the kde-multimedia mailing list