Login  •  Register


The time is now: Thu Oct 17, 2019 9:11 pm

Emaculation wiki  •  Delete all board cookies



Post new topic  Reply to topic Page 1 of 1 [ 10 posts ]
Print view Previous topic  |  Next topic
Author Message
PostPosted: Fri Mar 28, 2014 1:22 am 
Offline
Tinkerer

Joined: Wed Mar 31, 2010 11:55 pm
Posts: 64
Location: Maine, U.S.
Sorry that I didn't know of anywhere more appropriate to post this.

But I finally did it. It's still a work in progress, but I got some major QuickDraw-like routines working (along with translucency, not covered by Executor), and a virtual Sound Manager operating on Windows 32/64 bit.  Most of it is portable, light-weight, and none of it requires SDL, or any other third party library, and it's all free (GPL License).

The name of the package was dubbed ‘utility.’  (It could have a better name.)  Among the projects coming together:

snddec can not only play back AIFF-C files and sounds in ROMs, but also SoundList resources, which means multiple sounds in one, wait periods, channel init flags/interpolation, L/R volume/mute, full pointer param2, a host of codecs including CD/XA (not covered by the actual SM), MACE… and some assembly optimizations.  (Note that this, for now, excludes Carbon-deprecated commands, such as amp, square waves.) No longer will you ever need a Mac emulator to hear sounds in a Mac resource file.  rSoundSample playback (included) would also mean neither needing an Apple IIgs emulator.

ResEx can be used to get full rsrc listings, of Mac OS and Apple IIgs forks, with type descriptions. The offset/length for a sound would be passed to the snddec command line.  Missing/truncated trailers in Mac rsrc forks with can be rebuilt with a '????' type - something ResEdit doesn't do.

mgraf goes a step beyond QD by taking fixed-point coordinates, not just in the rendering of round rectangles but in regions of unlimited size. The scanline rendering method can be used with custom routines… can you say 3D mapping with region bounds?  It’s possible here.

I still have to cover image transfer with dithering, and text.  And then all of this will be used for a Windows port of my Marathon 2/Infinity-based project, which is already capable of running on any old Mac with enough RAM.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sat Mar 29, 2014 3:30 am 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2699
Location: Emaculation.com
Wow! Great job!

One question: would it be possible to hook the APIs you've created in such a way as to have Mini vMac for example do native calls when the appropriate QD and SM hooks are called? This would fix a number of emulation issues and allow for tremendous performance speedups (and the emulated computer would be using the hardware clock, so goodbye stuttering SM!) It may also mean that games requiring ATi graphics cards etc. could actually work under SheepShaver....


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Tue Apr 01, 2014 9:23 pm 
Offline
Tinkerer

Joined: Wed Mar 31, 2010 11:55 pm
Posts: 64
Location: Maine, U.S.
Mini vMac is meant for, and performs mostly low-level emulation, and these APIs are of the high-level sort, using similar methods, yet they don't match the actual QD/SM.  Even Basilisk II goes down to the level of samples (e.g., sound component stream buffering, to which the stream in the Windows port efficiently calls waveOut itself).

It is however, possible to work snddec’s SM into Executor, given how close it is to the real thing.  (It would still take some effort to actually work like the real thing, given the emulator side of things: memory, 68K code, firstMod storage instead of sndChannel fmt/cnv storage, etc.)

The most useful thing by far is instead how the code can be used to make it easier to port Classic Mac OS software into modern software.  For sound, the Sound Manager calls are so close, very few modifications are necessary — mostly macros to change names, parameters.

Update: mgraf now has limited support for text drawing/measurement, 4bpp and up.

Quote:
…This would fix a number of emulation issues and allow for tremendous performance speedups (and the emulated computer would be using the hardware clock, so goodbye stuttering SM!)…


Mini vMac does not emulate the Sound Manager itself, and the clock — mostly separate from SM — tends to be more accurate than B2’s.  (That’s if you don’t switch out of MvM.)

The stuttering sound in Mini vMac is due to bugs in the Apple Sound Chip code, expecting the same buffering scheme as the Mac Plus, at the same rate (ASC’s default is 22257 Hz, not 22254.5).  I’ve attempted to get sound in Mini vMac working, but it still doesn’t work right.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Apr 02, 2014 12:16 am 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2699
Location: Emaculation.com
Oh well. Thanks for the clarification Adam :)

Actually, as you said, this points to something else this can be used for: porting older software that requires QD and SM... a re-implementation of the carbon stack would be nice too (could possibly be used in lieu of all the work you had to do for the Mini vMac migration).


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Apr 04, 2014 9:11 pm 
Offline
Tinkerer

Joined: Wed Mar 31, 2010 11:55 pm
Posts: 64
Location: Maine, U.S.
It also makes streaming sound easier in general (useful for any programmer, intermediate or not).

(Better than what I heard with the AudioLab ALAudioMixerDemo, with its distorted clipping/interpolation — like Aleph One’s SM, probably not observing that the sample diff. and fraction in multiplication make 33 bits; 17+16.)

What do you mean by “reimplementing the Carbon stack,” btw?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Apr 04, 2014 9:33 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2699
Location: Emaculation.com
Adam P wrote:
What do you mean by “reimplementing the Carbon stack,” btw?


I just mean reimplementing the Managers that came through to Carbon but were deprecated by the recent SDKs -- Carbon Event Manager comes to mind as the big one since QD and SM are now done.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Apr 04, 2014 10:38 pm 
Offline
Tinkerer

Joined: Wed Mar 31, 2010 11:55 pm
Posts: 64
Location: Maine, U.S.
The QuickDraw (simulation) part still has a ways to go, but I know what you mean.  Or maybe I don’t, looking at the Carbon Event Manager pages on the Apple website, with the newer implementations (all now obsolete with OS X; what was Apple thinking).  Besides getting Carbon programs to compile, I have no experience actually being able to run, test Carbon programs.

If you mean the Classic-compatible Events (i.e., Frameworks/Events.h), the “spanner” executable already generates much of the information for an EventRecord, as well as a 160-character KeyMap, its first 128 characters intending to match the exact bits returned as if from the Mac KeyMap() routine (also available via QuickTime, however only 128 bits).  Additionally, the microsecond Time Manager simulation starts up rendering a 16625mcs TickCount (what would make the .when in an EventRecord).


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Apr 04, 2014 10:57 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2699
Location: Emaculation.com
Yeah; I was mostly thinking of a full implementation of Events.h; I figure spanner's days are numbered. the Time Manager I intentionally left out, as there are a number of ways to manage that directly in a redone events manager should it vanish (although not as elegantly).

A lot of that could be implemented via a fully compliant Quickdraw, but the problem there is that classic apps didn't usually implement this way in the first place, so there'd still need to be some significant rewriting to just use the new QD-compatible APIs. But if you've got the full events manager implemented, most of the other managers touch on it at some point, allowing a debug session to at least reveal what's not working and why.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sat May 03, 2014 12:59 am 
Offline
Tinkerer

Joined: Wed Mar 31, 2010 11:55 pm
Posts: 64
Location: Maine, U.S.
I’ve now finished the base (preliminary) implementation of mgraf.  Check it out. In in a number of areas, mgraf exceeds the capabilities of QuickDraw.

Added to the list of features: depth and endian conversion, all QuickDraw transfer modes (cpy|or|xor|bic, not; patterns; the arithmetic modes, faster than QD: blend|max|min|add/subPin|add/subOver).  And to top it off, direct filtering (so you don’t have to use gamma ramps), scaling and dithering.  The dithering isn’t so great, but it works, even with higher bit depths (yes, 24-bit dithering).  Depths up to 10:11:10 are supported; gray precision is 10 bits, versus QD’s eight.

Since the last release, even the spExtra feature was added for text, though only bitmapped rendering is currently supported.  (I downloaded freeType, and may attempt to work that in for sfnts.  Or I could just adapt fontrast to render NFNTs out of said sfnts.)

snddec was also updated to play WAVE files.

Now all I have to do for the Marathon project for its 10th anniversary Windows version is write the interface code for things like dialogs.  Help would be appreciated so I don’t have to do it all myself.  The mOS/snddec code is easy to write for.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sun Sep 11, 2016 9:29 am 
Offline
Tinkerer

Joined: Wed Mar 31, 2010 11:55 pm
Posts: 64
Location: Maine, U.S.
One final update here.

The full library has since become “adequate” in that it now handles TrueType and color fonts, GIF animations and JPEGs, and renders PICT images with support for vector graphics and text. Much of the PICT results are pixel-for-pixel identical to QuickDraw rendering with the latest fixes. Region support is limited (no complex clipping), but the QD oval region test works.

FreeType is used for TrueType support, but is not provided in the demo release; it is instead provided in the od28-6 game project release, which also includes Free Format MP3 support.

The snddec executable has been updated to handle sound resource files, in 'snd ' and Apple IIGS sound-sample forms. Assign an extension like '.sfil' for system sounds to snddec and you’ll be able to play them by merely double-clicking as you would in the Finder. (And as always, you can convert these sounds to WAV files with the -w option in a console window.)

The archive has been renamed 'mos.7z', and will remain so.


Top
 Profile  
Reply with quote Post a reply  
Display posts from previous:  Sort by  
Post new topic  Reply to topic Page 1 of 1 [ 10 posts ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
 

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group