On Feb 5, 1:17 pm, "Jason Burgon" <jayn...@[EMAIL PROTECTED]
> wrote:
> Now you have to decide what the interface ("contract") between the TSong
and
> the TPlayer is going to be. Ideally, only one of them at most should
"know"
> about the other. It might be better for both to be ignorant of each
other,
> and use a third object to trans****t the data from the TSong to the
TPlayer.
I've made some progress, but my current hurdle is how to interface
everything together. Essentially, I have one TPlayer object that,
after processing song data, needs to set channels/instrumnets/etc. but
this is different for each card. I have a TOutputDevice abstract
object that will be used to create several descendants (MIDI, Adlib,
etc.) to do the actual hardware manipulation.
But my question is: How can I initialize my TPlayer object to call
the right output device object? Is the proper way to pass the pointer
to the output device object to TPlayer during TPlayer's
initialization? If so, what would the pointer type be? Would it be
the TOutputDevice abstract/ancestor's type, or the descendant's type?
> > a player object that inherits the song object and contains only
> > generic VIRTUAL playback methods;
>
> I wouldn't. Use a different object for the player.
I agree with you, but see above; I'm having trouble figuring out what
to pass the TPlayer object
> You could also use a procedural "data-getter" method of TSong that
retrieves
> data from the Song and stores it in a buffer of the TPlayer. The TSong
(or a
> 3rd party) would pass the function to the TPlayer, which would then call
it
> whenever it needs "feeding".
Not a bad idea at all; it would certainly cut down on calling a
bazillion methods just to get one timer tick's worth of note data.
If my target platform were something other than an 8088, I would
virtualize everything to within an inch of its life :-) but instead I
have to balance form with function.


|