http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sound Card Programming!



Hi Towhidun,

Okay, I didn't know you where coding for DOS. What I meanth with
"DirectHardware" is that you are accessing the hardware directly, without
the use of an abstraction layer like DirectX. 

Your argumentation for doing this the DOS way is that you like to have
control. If you look at it from a layered viewpoint, you are trying to
operate on the lowest level possible, close to or on top of the hardware.
Although this gives you absolute control, it also gives you an absolute
amount of work to do becouse every hardware manufacturer implements their
own way of doing things, and that will always require you to write many
software versions for all hardware that you want to support.

The main objection by game/demo programmers in the ancient days of win 3.1
was that windows was too cluttered with abstraction layers to be useful for
fast graphics or multimedia in general. The reason why windows is organised
in that way is that it assures a success no matter what you do, with all
possible hardware. The downside of this was that it makes your programs slow. 

Microsoft listened to the game industry's objections against windows, and
designed an architecture to bypass the thick layer of windows and access
the hardware directly (well.. almost) called DirectX. The reason I write
"almost" is that DirectX is a very thin semi-abstraction layer (i'll
explain the"semi-" part later). The idea is this: there is one layer called
DirectX that defines the hardware on a PC as objects. Those objects expose
functions that a programmer can use to access the desired effects on the
hardware.

Below the DirectX programming interface are 2 other layers, not on top of
eachother, but they exists next to eachother. The first is a layer that is
programmed by the hardware manufacturer called the "Hardware Abstraction
Layer" or HAL. this layer does the same thing as the things you are trying
to program in your DOS application. Since the manufacturer has more
knowledge of their hardware then you have, you defenetly want them to do
the lowest level stuff for you !

The other layer that co-exists next to the HAL is the "Hardware Emulation
Layer" or HEL and is written by Microsoft. The reason for this is that not
all functions may be supported on all hardware, and if it can be emulated
in software this layer will do that for you. So that's another headache
taken out of your hands.

I wrote earlyer on that DirectX is a semi-abstraction layer, becouse many
DirectX interfaces allow you to send manufacturer specific escape codes to
the hardware (for instance with keyboards). The other reason is that you
still have to query the device for support of features. This seems a bit
contradicting to what I said, but it isn't that hard to understand.

Take for instance blitting in DirectDraw. Almost all video hardware have a
hardware blitter on the card. In the event that your program happens to be
running on a PC of which the hardware doesn't have a blitter, the HEL will
do that for you becouse the latency implications of using HEL isn't that
big of a burden for your PC.


It becomes another story if you are trying to use features that would
really slow down your program if they would be done in software emulation.
No-one is going to be satisfied with a framerate of 1 frame in 3 seconds,
so no programmer would want to use those functions in the HEL for
emulation, so Microsoft didn't bother to implement them in the HEL at all.

So whenever you use a DirectX interface, you should query the interface for
the capabilities it has, and if it doesn't support them, you should degrade
the functionality as appropriate.

Okay, that was my general introduction to DirectX. Let's go on with Windows
programming. Anything that you learn seems difficult at first, but after a
while becomes your second nature. Win32 programming is no different from
that. I've put some good examples of changing from DOS to Windows:

Converting MS-DOS-based Games to Windows 95 :

http://www.perplexed.com/GPMega/directx/convertdos2win95.htm

Moving Your Game to Windows Part I,II & III

http://www.perplexed.com/GPMega/directx/dos2win.htm

http://www.perplexed.com/GPMega/directx/dos2win2.htm

http://www.perplexed.com/GPMega/directx/dos2win3.htm

If you have any further questions, feel free to ask.

Karel.

At 08:23 PM 9/5/99 +0000, you wrote:
>Hi Karel,
>
>Thank you for your reply, you know you are the only one who replied, may be 
>the text was a little too big.
>
>Sorry, you may have misunderstood my problem. It has nothing to do with 
>DirectSound or DirectHardware. I have no idea what are those. I have heard 
>of them, off course, but avoided them cautiously, because I think those are 
>for Windows, I am only trying to survive with DOS. I am planning to port in 
>Windows, but my problem is only lack the information. May be you will read 
>again the mail, specially no #10.
>
>Any info on how to use DirectSound or DirectHardware, or where to find more 
>info will be great. But right now, my main focus is how do I correct my 
>problem, like Timer, identifying Frequency from input in realtime etc. which 
>is described in previous mail. Under DOS, off course, because under DOS, I 
>have full control, and I like control.
>
>But, thank you again for your concern.
>
>regards,
>Towhidun Nabi
>naeeym@hotmail.com
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>=================================================================
>To SUBSCRIBE or UNSUBSCRIBE please visit
>http://gameprogrammer.com/mailinglist.html
> 


-------------------------====#### Class Logic ####====---------------------

                                 Software Development

                          Microsoft Certified Professional

		Karel Bagchus 
		mailto:karel@classlogic.com
		http://www.classlogic.com

		Transvaalstraat 15 / 3-hoog
		1092 HA Amsterdam
		the Netherlands

		Tel:		+31 (0)20 - 77 75 344
		Fax:	+31 (0)20 - 77 75 344
		GSM:	06 - 22 987 327


-------------------------====###################====---------------------

=================================================================
To SUBSCRIBE or UNSUBSCRIBE please visit
http://gameprogrammer.com/mailinglist.html