Re: [Linux-wildo-devel] Some talk about the sound API
Status: Pre-Alpha
Brought to you by:
darkschneider2
|
From: Benjamin P. <ben...@ar...> - 2007-07-04 08:24:27
|
Hi, Gabriele Dini Ciacci wrote: > This is a copy from IRC about gros idea on how the new API shoudl look > like: To make it clear, you mean an API that coveres codecs, filters and output, = right? [Client]-> NEW API >-[Filters/Codec/Output]+ And about the multiplexing for the case of multiple speakers, this would be= outside of the new API I suppose. > > The API for the sound part shouldn't be hard to define. Basically, > you need open(), close(), get/setParameters(), encode() and decode(). > > open() and close() would take no parameters. Parameters would be > twofold: implementation-specific ones (for example, the device name for > OSS, or the port to use for a Jack-based one) and LW-specific ones > (quality). So the parameters can be changed during usage? Well since this is codec/out= put specific I guess it depends and every API module should decide for itself and document it. What kind of parameter do you want to use, something like setParamater(string type, string value) to be generic? > encode and decode would take/return a sized buffer chunk of data. > both encode and decode should take the amount of desired bytes to > read/write as a parameter. Maybe a struct (class?) with two fields, size and buffer pointer would be n= ice? I think those values should stay together, maybe event to provide additional information about the buffer in the future. A filter might need information about the sample lenght (not by some static define) = and if the buffer was already encoded ... so there might even be some kind of communication possible between the API modules. (Could be MAXBUFF and be reused, struct holds the real and current size with a third field) > > open, close, encode and decode would all throw an IOException when > something goes wrong, to manage error cases. > > the LW client would probably pass the initialization parameters to the > sound class constructor (which would then have a "contructor(string > params)" prototype. How is this different to the setParameters(), they are dynamic the init params are static? > > Ideally, you'd want to wrap sound classes management into a factory > class, so to "hide" the implementation details from the rest of the LW > code, which would only give an init string to the factory, and get a > generic "LW_Sound" class in return. This is the way to do it. Sounds good, the implementation will show what is missing. :-) regards, Benjamin Peter aka dedeibel Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: g=FCnsti= g und schnell mit DSL - das All-Inclusive-Paket f=FCr clevere Doppel-Sparer, nur 39,85 =80 inkl. DSL- und ISDN-Grundgeb=FChr! http://www.arcor.de/rd/emf-dsl-2 |