Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Borland > Re: How to hand...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 21 Topic 1085 of 1118
Post > Topic >>

Re: How to handle this OOP/inheritance problem?

by Jim Leonard <MobyGamer@[EMAIL PROTECTED] > Feb 6, 2008 at 09:50 AM

On Feb 5, 1:17 pm, "Jason Burgon" <jayn...@[EMAIL PROTECTED]
> wrote:
> You should definately have different objects for the player and the song
> because:
>
> (1) The song object encapsulates a data element -TSong.
> (2) The Playback object represents [an interface to] a device driver -
> TPlayer.

Actually, there are basic song handling routines that are common to
playing *any* song, such as "slide this note upward each tick for a
****tamento", etc.  The device-specific routines would come later, so
that's why I was leaning toward something like:

song = object
player = object(song)
playSpk = object(player)
playAdlib = object(player)
playGMIDI = object(player)

That sort of thing.  If you're familiar with PC MOD players/trackers,
that's the same idea; there are song maintenance operations to be done
on every interrupt tick, but those operations are independent of the
actual output device used.

> TSong might also want to be an abstract type
> as well, so that different song types can be played by the same player
type.

While that's a good design decision, it is quite out of scope for this
project :)  The goal was to create an editor/player for very low-
resource machines, so the song data format is actually a big part of
the design -- I'll explain later in this post.

> 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.
> Some sort of stream object comes mind for this role.

If I didn't care about performance, I would agree this is the most
proper way to do it.  However, the target platform for this project is
-- don't get mad -- an original IBM PC, which is a 4.77MHz 8088.
(Most people hit *DELETE* after reading that, but I like challenges in
my hobby...) Not only that, but the music must play at the same time
many other things are going on, so player performance is extremely
im****tant.  It's im****tant enough that I started this project with the
song data format, because I wanted to be able to retrieve a note in a
single data access (if you're curious, each note+effects is only 2
bytes, which I plan to fetch with LODSW and then do all processing in
registers).

This is why I was trying to figure out the most efficient way to pass
data between objects -- ideally, there would be no passing at all (ie.
the generic player object would be able to read the song data
directory without passing it on the stack or through a stream).  So,
with this in mind, do you think my idea (see above) is the best
compromise?
 




 21 Posts in Topic:
How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-04 17:18:17 
Re: How to handle this OOP/inheritance problem?
"Jason Burgon"   2008-02-05 19:17:21 
Re: How to handle this OOP/inheritance problem?
Femme Verbeek <fv2006@  2008-02-05 22:01:32 
Re: How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-06 09:50:02 
Re: How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-06 12:07:29 
Re: How to handle this OOP/inheritance problem?
Femme Verbeek <fv2006@  2008-02-07 02:02:07 
Re: How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-06 21:04:50 
Re: How to handle this OOP/inheritance problem?
dik <quagga5@[EMAIL PR  2008-02-07 05:10:52 
Re: How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-07 07:39:09 
Re: How to handle this OOP/inheritance problem?
dik <quagga5@[EMAIL PR  2008-02-07 11:01:54 
Re: How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-08 08:49:39 
Re: How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-09 19:45:14 
Re: How to handle this OOP/inheritance problem?
Marco van de Voort <ma  2008-02-10 11:31:10 
Re: How to handle this OOP/inheritance problem?
"Jason Burgon"   2008-02-10 11:56:57 
Re: How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-10 10:42:20 
Re: How to handle this OOP/inheritance problem?
"Jason Burgon"   2008-02-11 01:54:58 
Re: How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-10 21:31:25 
Re: How to handle this OOP/inheritance problem?
"Jason Burgon"   2008-02-11 12:04:54 
Re: How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-11 09:06:30 
Re: How to handle this OOP/inheritance problem?
"Jason Burgon"   2008-02-11 20:37:17 
Re: How to handle this OOP/inheritance problem?
Jim Leonard <MobyGamer  2008-02-11 13:41:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 23 15:59:20 CDT 2008.