Graphics and Sound Programming Techniques For The Mac 1995
From the originals
13 scansMachine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.
These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.
Image 1
Graphics and Sound Programming Techniques FOR THE MAC
New Technology Building Blocks Graphics and Sound Programming Techniques FOR THE MAC CD-ROM INCLUDED The essential guide to programming sound and graphics for the Mac Covers QuickDraw GX and QuickTime Includes complete coverage of speech on the Mac Dan Parks Sydow M&T BOOKS
A book cover with a bold yellow and black title over a red band, a blue lower panel with bulleted feature text, and a collage image of a CD, a treble clef, film strip, and floating photo fragments on the right, with an orange gradient strip on the left edge and a CD-ROM Included badge.
Reading notes: The top-right tagline 'New Technology Building Blocks' is small italic text and was read as shown. The M&T Books logo text is small and was read as 'M&T BOOKS'.
- Printed product names
- Mac · QuickDraw GX · QuickTime
- Languages
- English
PDF page 1
New Technology Building Blocks Graphics and Sound Programming Techniques FOR THE MAC CD-ROM INCLUDED The essential guide to programming sound and graphics for the Mac Covers QuickDraw GX and QuickTime Includes complete coverage of speech on the Mac Dan Parks Sydow M&T BOOKS
A book cover with a black and red title band over a blue panel, a treble clef and a CD-ROM disc over colorful collage images on the right, and an orange gradient strip on the left with a circular CD-ROM included badge.
Reading notes: The word 'Sydow' is set in the same line as 'Dan Parks' and may be read as a single author line; the author name appears as 'Dan Parks Sydow' in the image. Reading order of the top small tagline and the bulleted features is inferred from layout.
- Printed product names
- Mac · QuickDraw GX · QuickTime
- Languages
- English
PDF page 2
GRAPHICS AND SOUND PROGRAMMING TECHNIQUES FOR THE MAC Dan Parks Sydow M&T BOOKS
A book title page with a framed abstract graphic of geometric shapes and musical notes at top, a bold stylized title in the center, the author's name in italic beneath a dotted rule, and the M&T Books logo at the bottom, with faint fine print on the page background.
Reading notes: Faint copyright and publisher fine print in the upper-right margin and lower portion of the page is too light to read reliably and was omitted. Background text behind the title block is blurred and not transcribed.
- Languages
- English
PDF page 3
M&T Books A Division of MIS:Press, Inc. A Subsidiary of Henry Holt and Company, Inc. 115West18th Street New York, New York 10011 Copyright© 1995, by Dan Parks Sydow. Printed in the United States of America All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without prior written permission from the Publisher. Contact the Publisher for information on foreign rights. Limits of Liability and Disclaimer of Warranty The Author and Publisher of this book have used their best efforts in preparing the book and the programs contained in it. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The Author and Publisher make no warranty of any kind, expressed or implied, with regard to these programs or the documentation contained in this book. The Author and Publisher shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, the furnishing, performance, or use of these programs. All products, names and services are trademarks or registered trademarks of their respective companies. Wayzata sound files and QuickTime movie distributed with permission of Wayzata Technology. Screen snapshots of the Robot movie used with permission of Wayzata Technology. Library of Congress Cataloging-in-Publication Data Graphics and sound programming for the Mac I by Dan Parks Sydow. p. cm. Indudes index. ISBN 1-55851-442-2 1. Macintosh (Computer)-Programming. 2. Computer graphics. 3. Computer sound processing. I. Title. IN PROCESS 006.6'765-dc20 95-40387 CIP 10987654321 Associate Publisher: Paul Farrell Managing Editor: Cary Sullivan Development Editor: Michael Sprague Copy Edit Manager: Shari Chappell Production Editor: Anne Incao Technical Editor: Pete Ferrante Copy Editor: Winifred Davis
Reading notes: Scanned text contains spacing artifacts such as 'Indudes' (likely 'Includes') and split words, which may reflect OCR errors. Printed date '95-40387' appears to be a Library of Congress control number rather than a publication date; confirm classification.
- Printed product names
- Macintosh · QuickTime · Robot
- Printed dates
- 1995 · 95-40387
- Languages
- English
PDF page 4
The image is a plain, entirely blank white portrait-oriented page with no visible artwork, layout, or markings.
Reading notes: No visible text found in the image; the page appears blank.
PDF page 5
Acknowledgments Michael Sprague, Development Editor, M&T Books, for keeping things rolling and on schedule. Anne Incao, Senior Production Editor, M&T Books, for another fine page layout effort. Winifred Davis, Copy Editor, for making it appear that I really do know how to write! Peter Ferrante, Apple Computer, for another helpful technical review. Carole McClendon, Waterside Productions, for making this book happen. Jeffery Garland, M.D., St. Joseph's Hospital, Milwaukee, Wisconsin, for choosing medicine as your profession, and for bypassing convention! Karen Heine, RN, St. Joseph's Hospital, Milwaukee, Wisconsin, for providing help as both a professional and a person-Taylor's parents will always remember you!
Reading notes: Source text contains irregular spacing and a hyphenated line break in the final acknowledgment, which may affect reading order.
- Languages
- English
PDF page 6
WttY Ttt1s BooK Is fOR Yoo ............................................................... 0 CHflPTEit 1 • lnmooua1on TO MAClnTOSH GitflPHICS Ano Souno .............1 Graphics, Sound, and This Book ....................................................................... 1 Sound Playing .................................................................................................. 2 Sound Recording ............................................................................................. 2 Speech ............................................................................................................... 3 Animation ....................................................................................................... .4 QuickDraw GX ............................................................................................... .5 QuickTime Movies ......................................................................................... .5 QuickTime Musical Instruments .................................................................. 7 A Complete Example Program .....................................................................8 Now ...................................................................................................................... 9 CHAPl'ER Z • Soono PLAY1nG ......•.•••.•.•.•.••...........•.•••.•..•.•.•.•.•...•..•..•.•.. 11 The Sound Manager .......................................................................................... 12 The Sound Manager Version 3.0 ................................................................. 12 Synchronous and Asynchronous Sound Play .......................................... 13 Sound Resources ................................................................................................ 13 About Sound Resources ............................................................................... 13 Playing a Sound Resource ........................................................................... 15 Now, Really Playing a Sound Resource .................................................... 16 Chapter Example: SoundResource ............................................................. 19 Sound Channels ................................................................................................. 22 Allocating and Disposing of a Sound Channel ........................................ 22 Using a Sound Channel. ............................................................................... 26 Chapter Example: SoundChannellntro ...................................................... 27 Sound Commands .............................................................................................29 About Sound Commands ............................................................................ 30 Chapter Example: SoundCommands ......................................................... 34 Asynchronous Sound Play ............................................................................... 36 An Approach to Playing a Sound Asynchronously ................................. 36 The Callback Command and Callback Routine ....................................... 38 Installing the Callback Command in the Command Queue ................ .43 The Sound Callback Routine .......................................................................46 Starting the Sound and Animation ............................................................ .52 vii
Reading notes: Source text is a table of contents with OCR spacing and character errors (e.g., 'WttY Ttt1s BooK Is fOR Yoo', 'lnmooua1on', 'Ano') Heading reading order and chapter headings are partly garbled in the extraction
- Printed product names
- QuickDraw GX · QuickTime Movies · QuickTime Musical Instruments
- Languages
- English
PDF page 7
viii Graphics and Sound Programming Techniques for the Mac Performing Animation While a Sound Plays ............................................ 56 Chapter Example: AsynchSndPlay ............................................................ 60 More Asynchronous Sound .............................................................................. 70 Allowing User Input While a Sound Plays ............................................... 70 Chapter Example: AsynchSndEvt .............................................................. 72 Sound Commands and Asynchronous Sound Play ................................. 76 SndDolmmediate() and Sound Volume .................................................... 77 SndDolmmediate() and Sound Pitch ......................................................... 80 Chapter Example: MoreSndCommands .................................................... 82 Summary ............................................................................................................. 86 CHAPTER J • SooHD REco~o1na ..........................................................87 Sound Input Devices .........................................................................................87 Recording a Sound to Memory ........................................................................ 90 Sound Data and Memory ............................................................................. 90 Allocating a Memory Block for Sound Data ............................................. 93 Recording the Sound Data to Memory ...................................................... % Chapter Example: SoundRecord ................................................................. 98 Playing Back a Recorded Sound .................................................................... 102 Using the Handle to the Recorded Sound ............................................... 102 Chapter Example: SoundHandle .............................................................. 104 Saving a Recorded Sound to a snd Resource ............................................. 107 The Format of Sound Data in Memory .................................................... 107 Saving Sound Data to a snd Resource .................................................... 108 Chapter Example: SaveSound ................................................................... 111 Sound Quality and Disk Storage Space ................................................... 116 Summary ........................................................................................................... 119 CHAPTEft, 4 • SPEECH •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• 121 The Speech Manager ....................................................................................... 122 The Speech Manager and Speech Synthesizers ...................................... 122 Voices and Speech Synthesizers ............................................................... 124 Checking for the Availability of the Speech Manager ........................... 125 Speaking a String ............................................................................................. 126 The SpeakString() Toolbox Function ........................................................ 126 Chapter Example: QuickSpeech ............................................................... 127 Speaking More Than One String .............................................................. 129 Chapter Example: WaitSpeech .................................................................. 131 User Input and Speech ............................................................................... 131 Chapter Example: InputSpeech ................................................................ 132 Resource Strings and Speech ..................................................................... 135
Reading notes: Source is a table of contents with OCR damage (e.g., 'SooHD REco~o1na', 'J', 'CHAPTEft, 4'). No primary headline is printed in the supplied copy.
- Languages
- English
PDF page 8
Contents ix Chapter Example: ResourceSpeech .......................................................... 137 Speech Channels .............................................................................................. 140 Allocating and Disposing of a Speech Channel.. .................................... 141 Using a Speech Channel. ............................................................................ 143 Chapter Example: SpeechChannellntro ................................................... 144 Voices ................................................................................................................. 146 Specifying a Voice ....................................................................................... 146 Obtaining a Voice Description for a Voice .............................................. 148 Chapter Example: Change Voice ............................................................... 152 Summary ........................................................................................................... 159 CHAPTER 5 • f1"111AT1on ••••••••••.••••••••••••••••••••••••••••••••••.••••••••••••••.••••••• 161 Monochrome Animation and CopyBits() ..................................................... 162 Bit Images and BitMaps ............................................................................. 162 BitMaps, Graphics Ports, and Windows .................................................. 166 BitMaps and Graphics Ports Without Windows .................................... 168 Creating a New BitMap ............................................................................. 176 Copying a BitMap ....................................................................................... 180 Chapter Example: CopyBitsB&W ............................................................. 185 Color Animation and GWorlds ..................................................................... 192 Color Images and PixMaps ........................................................................ 192 Pixel Maps, Color Graphics Ports, and the GWorld .............................. 193 Checking for the Availability of GWorlds ............................................... 194 Creating a GWorld and its PixMap .......................................................... 195 Using GWorlds for Animation .................................................................. 198 CopyBits() and Color Animation .............................................................. 199 Chapter Example: GWorlds ....................................................................... 216 Summary ........................................................................................................... 225 CttflPTEtt 6 • Qu1cKDRAW CiX ........................................................... 227 About QuickDraw GX ..................................................................................... 228 Object and Shapes ....................................................................................... 228 QuickDraw vs. QuickDraw GX ................................................................ 229 Chapter Example: PoorMansQDGX ........................................................ 230 Readying a Program for QuickDraw GX .....................................................235 Checking for QuickDraw GX .................................................................... 235 Initializing QuickDraw GX ........................................................................ 238 Terminating a QuickDraw GX Application ............................................ 243 Chapter Example: QDGXIntro .................................................................. 244 Windows and QuickDraw GX .................................................................. 250 Chapter Example: QDGXWindow ...........................................................252
Reading notes: Some OCR-style spacing and character errors appear in the table of contents (e.g., 'f1"111AT1on', 'CttflPTEtt', 'QuickDRAW CiX').
- Languages
- English
PDF page 9
x Graphics and Sound Programming Techniques for the Mac Graphic Shape Objects .................................................................................... 254 Creating and Drawing a Shape Object... .................................................. 255 Chapter Example: QDGXShape ................................................................ 259 Shape Object Properties ............................................................................. 260 Shape Object Style Properties .................................................................... 262 Shape Object Ink Properties ...................................................................... 262 Chapter Example: QDGXProperties ......................................................... 266 Shape Object Transform Properties .......................................................... 267 Chapter Example: QDGXMapping ..........................................................267 Summary ........................................................................................................... 271 CHAPTER 7 • Qu1cKT1ME MOVIES ........................................................273 The Movie Toolbox .......................................................................................... 274 Checking for QuickTime ............................................................................ 276 Initializing the Movie Toolbox .................................................................. 277 Loading a Movie ..............................................................................................278 Opening a Movie File ................................................................................. 279 Loading a Movie from a File ..................................................................... 281 Closing a Movie File ...................................................................................285 Displaying a Movie .......................................................................................... 285 Setting the Movie Graphics World-SetMovieGWorld() ....................286 Resizing the Display Window ...................................................................286 Playing a QuickTime Movie ........................................................................... 289 Preparing a Movie for Playing .................................................................. 289 Playing a Movie ........................................................................................... 290 Cleaning Up .................................................................................................291 Chapter Example: QuickPlay .................................................................... 291 Chapter Example: MovieDialog .................................................................... 294 The Movie Dialog Program ........................................................................ 294 The MovieDialog Resources ...................................................................... 296 The Movie Dialog Source Code Listing .................................................... 300 Improving the MovieDialog Program ..................................................... 306 Chapter Example: SelectMovie ...................................................................... 307 Movie Controllers ............................................................................................ 310 About Movie Controllers ........................................................................... 310 Attaching a Movie Controller to a Movie ................................................ 311 Movie Controllers and the Event Loop ................................................... 314 Chapter Example: QuickController .......................................................... 317 Movie Controllers and Movie Looping ................................................... 321 Chapter Example: MovieLooping ............................................................ 322 Chapter Summary ............................................................................................ 323
Reading notes: Table of contents text; the primary heading is not present in the supplied copy.
- Printed product names
- QuickTime · QDGXShape · QDGXProperties · QDGXMapping · QuickPlay · MovieDialog · SelectMovie · QuickController · MovieLooping
- Languages
- English
PDF page 10
Contents xi CHAPTER 8 • OulCl<'flME MUSICAL lrtSTRUMEtm .................................. 325 About QuickTime Music ............................................................................... .326 The Note Allocator ..........................................................................................326 Opening a Note Allocator Component .................................................... 327 ToneDescription: Describing an Instrurnent ...........................................327 Describing a Note Channel ........................................................................329 Opening a Note Channel ........................................................................... 330 Playing a Note ............................................................................................. 331 Chapter Example: PlayNote ...................................................................... 334 Chapter Example: PlayScale ......................................................................336 Selecting an Instrument .................................................................................. 337 Adding the Instrument Picker Dialog Box to a Program ..................... 339 Chapter Example: Picklnstrurnent ...........................................................340 Chapter Example: PickAndPlay ............................................................... 344 Summary ........................................................................................................... 347 CHAPTER 9 • flPPLICflTIOl'I: Qu1cl<'flME MOVIE EDITOR ......................... 349 Movie Editing ................................................................................................... 350 Movie Editing and the Movie Controller ................................................ 350 Movie Toolbox Movie Editing Routines ..................................................351 Saving an Edited Movie ..................................................................................357 Saving a Movie with a "Save" Menu Item .............................................. 357 Saving a Movie with a "Save As" Menu Item ........................................358 Working with Multiple Movies ..................................................................... 362 Window Records and Extra Window Data .............................................362 Accessing the Application-Defined Window Structure ........................366 Example Program: FilmEdit ........................................................................... 371 The FilmEdit Resources ..............................................................................372 Program Initialization ................................................................................373 The Main Event Loop and Menus ............................................................ 376 The Main Event Loop and Movie Controllers ........................................380 The Main Event Loop and Event Handling ............................................381 The Application-Defined Window Structure ..........................................390 Updating Multiple Movies ........................................................................395 The Movie Controller Action Filter Function .........................................397 Handling Apple Menu Item Selections ................................................. ..401 Handling the File Menu Open Item .........................................................401 Handling the File Menu Close Item ......................................................... 403 Handling the File Menu Save Item .......................................................... .404 Handling the File Menu Save As Item .................................................... .405 Handling the File Menu Quit Item ........................................................... 406
Reading notes: Chapter heading OulCl<'flME spelling and running heads (e.g., 'flPPLICflTIOl'I' and 'Qu1cl<'flME') appear OCR-damaged; read as Quicktime Music Instrument and Application: QuickTime Movie Editor.
- Printed product names
- QuickTime · QuickTime Music · FilmEdit
- Languages
- English
PDF page 11
xii Graphics and Sound Programming Tczchniquczs for thcz Mac Handling Edit Menu Item Selections ...................................................... .407 The FilmEdit Project File Organization .................................................. .409 Summary ........................................................................................................... 414 flPPEl'IDIX fl • CiEHE~flL MIDI IHSTRUMEtlT tlUMBE~S .......................... 417 flPPEnDIX B • THE AS WoRLD.......................................................... 425 Switching the Contents of AS ........................................................................ .42S Macintosh Memory, the AS World, and the AS Register ..................... .426 Keeping Track of the Value in an Application's AS Register ...............428 Callback Routines and the AS Register ................................................... .430 The AsynchSndPlay Example Program .................................................. .433 lnDEX •.........................................................•...••.............................. 439
Reading notes: OCR spacing and character damage in table-of-contents text (e.g., 'Tczchniquczs', 'fl PPEl'IDIX') Appendix and page-number entries are partly garbled, affecting reading order
- Languages
- English