Thursday, September 20. 2007Mixer API DesignTrackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
typical use for an EnumControl would be a QComboBox so I modeled their API as counterparts to QSlider/QComboBox This has a couple benefits: 1. Nodes don't have to know their parent 2. Nodes can have multiple parents. Might there be a usecase for sharing a control between multiple elements? (An alternative solution to this would be to connect the signals and slots of related controls) In other words, this allows the mixer chain to be a DAG, not just a tree. Allowing a DAG now seems more flexible to me. regarding (1.): that's an implementation detail IMO but I'm considering instead of control.remove(); doelement.remove(control); and instead of element.remove(); domixer.remove(element); Otherwise it's too much like "delete this" - which is not wrong, just awkward. Yes #1 is an implementation detail, but the original proposed API forces that detail (without jumping through some crazy hoops). In my experience it's worth thinking about the implementation, just not letting the initial implementation bind your hands. I also suggested creating an id to avoid the question of value type vs comparing pointers. Again, I feel it's a more flexible solution. QList<Mixer> allMixers = MixerList::availableMixers(); Mixer specificMixer("hw:0"); foreach(const Mixer &m, allMixers) { if (specificMixer == m) { // success } } The same holds for Element and Control objects, though I think there it's more obvious that the objects are equal since those classes don't have their own ctors. Do you agree that the object is the id? Regarding #1 again: can you come up with a use case/code example where it would be a problem/hindrance to have a parent relationship? Because I currently can't see how decoupling would help, instead I think that (coming from the physical picture again) a control/element cannot exist without a mixer. a. Allocate on the heap and use pointer equality or b. Make the objects all value classes, so you can put them in containers, compare them, etc. Granted option b. makes it obvious how you're supposed to compare two objects and find the equivalent one to remove from the list, I just feel that adding an identifier makes it that much more obvious when two objects are equivalent. Perhaps that's exposing an implementation detail (I agree with you in this case). I wouldn't make the id just an integer. I'd probably define a type that wraps an integer, but won't implicitly convert. This prevents mixing up id types. And, no, I can't come up with a use case where it's problem/hindrance to force a parent/child relationship. But why force it, when you can leave either option open with a small API change? I don't want to try to predict how this API will be used five years from now. BTW, I haven't mentioned this previously, but nice work! I'm mostly nitpicking. Can you give an example how the API would look like, because I still don't really see what you mean. I.e. how can you have a Control object without an explicit Element parent which has an explicit Mixer parent? What caused this change in the plan? isChecked, setChecked signal:toggled(bool) suggestions for Element: - MixerElement - Track - MixerTrack - Channel - MixerChannel Element is very generic, Channel also has a meaning like left/right channel, Track makes me think of a specific thing: gain, EQ, Aux, mute, volume slider, routing which this is not about. - Master (Volume slider, Panorama, mute button) - PCM (Volume slider, Panorama, mute button) - Capture (Volume slider, Panorama, capture source enum) - External Amplifier (toggle button) Probably also Device - Item - MixerItem - Element - MixerElement - Channel - MixerChannel - Device - MixerDevice - Track - MixerTrack I also always get this wrong and trigger a nice reminder by the compiler This app would need a mixer for handling the microphone input and a mixer for handling the speaker output. Is the phonon api capable of handling such a combination? Everything seems poised towards playback for now... Mixer in the context you're using it is ambiguous. Do you mean mixing two audio streams into one, or do you mean the volume/mute controls? The latter does not <b>have</b> to be handled by the application IMHO, but it would be nice if it could. And with the work I'm currently doing this will be possible. In the beginning I thought that KMixer would attach to an object representing a full duplex audio device (i.e. a typical soundcard with sound input and output). If that were the case, it would have to provide a way for the calling programs to know whether an element (volume control) is for recording or for playback (so that a logical separation can be achieved like in kmixer) But it seems to me like a KMixer is an object you attach in a pipeline between the AudioOutput object and the MediaObject that needs to be played back. Since there is no corresponding Audio_Input_ object, my comment is out of scope, maybe something like this would be an interesting addition... an a one-stop recording solution for kde programs... |
Calendar
QuicksearchCategoriesBlog Administration |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||