home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1999-01-30 | 10.8 KB | [ TEXT/CWIE]
open in: MacOS 8.1
extracted
|
Win98
extracted
|
DOS
extracted
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary ).
You can browse this item here: main.c
Confidence Program Detection Match Type Support
66%
dexvert
Compact Compressed (Unix) (archive/compact)
ext
Supported
10%
dexvert
MacBinary (archive/macBinary)
fallback
Supported
10%
dexvert
Jesper Olsen Module (music/jesperOlsen)
magic
Supported
1%
dexvert
Text File (text/txt)
fallback
Supported
100%
file
MacBinary II, inited, Sat Jan 30 07:45:11 1999, modified Sat Jan 30 07:45:11 1999, creator 'CWIE', type ASCII, 10355 bytes "main.c" , at 0x28f3 410 bytes resource
default (weak)
99%
file
data
default
49%
TrID
Macintosh plain text (MacBinary)
default
33%
TrID
TTComp archive compressed (bin-4K)
default (weak)
16%
TrID
MacBinary 2
default (weak)
100%
siegfried
fmt/1762 MacBinary (II)
default
100%
lsar
MacBinary
default
id metadata key value macFileType [ TEXT] macFileCreator [ CWIE]
hex view +--------+-------------------------+-------------------------+--------+--------+ |00000000| 00 06 6d 61 69 6e 2e 63 | 00 00 00 00 00 00 00 00 |..main.c|........| |00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......| |00000050| 00 00 00 00 00 28 73 00 | 00 01 9a b2 d8 af 57 b2 |.....(s.|......W.| |00000060| d8 af 57 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..W.....|........| |00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 39 6a 00 00 |........|....9j..| |00000080| 2f 2a 0d 09 4c 65 76 65 | 6c 4d 65 74 65 72 20 56 |/*..Leve|lMeter V| |00000090| 69 73 75 61 6c 20 50 6c | 75 67 69 6e 20 45 78 61 |isual Pl|ugin Exa| |000000a0| 6d 70 6c 65 0d 09 0d 09 | 09 09 53 61 6d 70 6c 65 |mple....|..Sample| |000000b0| 20 76 69 73 75 61 6c 20 | 70 6c 75 67 69 6e 20 74 | visual |plugin t| |000000c0| 6f 20 64 65 6d 6f 6e 73 | 74 72 61 74 65 20 4d 61 |o demons|trate Ma| |000000d0| 63 41 6d 70 20 76 69 73 | 75 61 6c 20 70 6c 75 67 |cAmp vis|ual plug| |000000e0| 69 6e 20 41 50 49 20 61 | 6e 64 20 61 64 64 69 74 |in API a|nd addit| |000000f0| 69 6f 6e 61 6c 20 74 72 | 69 63 6b 73 2c 0d 09 09 |ional tr|icks,...| |00000100| 09 69 6e 63 6c 75 64 69 | 6e 67 20 61 63 63 65 73 |.includi|ng acces| |00000110| 73 20 6f 66 20 74 68 65 | 20 70 6c 75 67 69 6e 20 |s of the| plugin | |00000120| 72 65 73 6f 75 72 63 65 | 20 66 6f 72 6b 2c 20 69 |resource| fork, i| |00000130| 6e 69 74 69 61 6c 69 7a | 69 6e 67 20 74 68 65 20 |nitializ|ing the | |00000140| 70 6c 75 67 69 6e 20 69 | 6e 66 6f 20 73 74 72 75 |plugin i|nfo stru| |00000150| 63 74 75 72 65 20 6f 6e | 0d 09 09 09 73 74 61 72 |cture on|....star| |00000160| 74 75 70 20 61 6e 64 20 | 6d 6f 72 65 2e 0d 09 09 |tup and |more....| |00000170| 09 0d 09 09 09 59 6f 75 | 20 63 61 6e 20 75 73 65 |.....You| can use| |00000180| 20 61 6e 79 20 70 6f 72 | 74 69 6f 6e 73 20 6f 66 | any por|tions of| |00000190| 20 74 68 69 73 20 63 6f | 64 65 20 66 72 65 65 6c | this co|de freel| |000001a0| 79 20 69 6e 20 79 6f 75 | 72 20 70 6c 75 67 69 6e |y in you|r plugin| |000001b0| 73 20 77 69 74 68 6f 75 | 74 20 61 6e 79 20 72 65 |s withou|t any re| |000001c0| 73 74 72 69 63 74 69 6f | 6e 73 2e 0d 0d 09 42 79 |strictio|ns....By| |000001d0| 3a 20 53 6c 61 76 61 20 | 4b 61 72 70 65 6e 6b 6f |: Slava |Karpenko| |000001e0| 20 28 73 6c 61 76 61 40 | 6d 61 63 61 6d 70 2e 63 | (slava@|macamp.c| |000001f0| 6f 6d 29 09 39 2f 32 2f | 39 38 0d 09 09 40 73 6f |om).9/2/|98...@so| |00000200| 66 74 0d 09 09 0d 2a 2f | 0d 0d 23 69 6e 63 6c 75 |ft....*/|..#inclu| |00000210| 64 65 20 22 76 69 73 75 | 61 6c 2e 68 22 0d 0d 2f |de "visu|al.h"../| |00000220| 2f 20 53 6f 6d 65 20 75 | 73 65 66 75 6c 20 64 65 |/ Some u|seful de| |00000230| 66 69 6e 65 73 2e 0d 23 | 64 65 66 69 6e 65 20 4d |fines..#|define M| |00000240| 49 4e 28 61 2c 62 29 09 | 28 28 28 61 29 3c 28 62 |IN(a,b).|(((a)<(b| |00000250| 29 29 3f 28 61 29 3a 28 | 62 29 29 0d 23 64 65 66 |))?(a):(|b)).#def| |00000260| 69 6e 65 20 4d 41 58 28 | 61 2c 62 29 09 28 28 28 |ine MAX(|a,b).(((| |00000270| 61 29 3e 28 62 29 29 3f | 28 61 29 3a 28 62 29 29 |a)>(b))?|(a):(b))| |00000280| 0d 23 64 65 66 69 6e 65 | 20 41 42 53 28 61 29 09 |.#define| ABS(a).| |00000290| 09 28 28 61 29 3c 30 3f | 2d 28 61 29 3a 28 61 29 |.((a)<0?|-(a):(a)| |000002a0| 29 0d 0d 2f 2f 20 54 68 | 69 73 20 69 73 20 74 68 |)..// Th|is is th| |000002b0| 65 20 67 50 6c 75 67 49 | 6e 66 6f 20 62 6c 6f 63 |e gPlugI|nfo bloc| |000002c0| 6b 20 2d 20 61 20 70 6c | 61 63 65 20 77 68 65 72 |k - a pl|ace wher| |000002d0| 65 20 4d 61 63 41 6d 70 | 20 67 65 74 73 20 69 6e |e MacAmp| gets in| |000002e0| 69 74 69 61 6c 20 69 6e | 66 6f 72 6d 61 74 69 6f |itial in|formatio| |000002f0| 6e 20 61 62 6f 75 74 20 | 79 6f 75 72 20 70 6c 75 |n about |your plu| |00000300| 67 69 6e 2e 0d 2f 2f 20 | 4d 61 6b 65 20 73 75 72 |gin..// |Make sur| |00000310| 65 20 74 6f 20 73 65 74 | 20 74 68 65 20 66 72 61 |e to set| the fra| |00000320| 67 6d 65 6e 74 27 73 20 | 65 6e 74 72 79 20 70 6f |gment's |entry po| |00000330| 69 6e 74 20 74 6f 20 67 | 50 6c 75 67 49 6e 66 6f |int to g|PlugInfo| |00000340| 20 74 6f 20 6d 61 6b 65 | 20 69 74 20 61 63 63 65 | to make| it acce| |00000350| 73 73 69 62 6c 65 20 66 | 6f 72 20 74 68 65 20 4d |ssible f|or the M| |00000360| 61 63 41 6d 70 20 72 6f | 75 74 69 6e 65 73 2e 0d |acAmp ro|utines..| |00000370| 0d 56 50 49 6e 66 6f 42 | 6c 6f 63 6b 20 67 50 6c |.VPInfoB|lock gPl| |00000380| 75 67 49 6e 66 6f 20 3d | 0d 7b 0d 09 56 50 5f 45 |ugInfo =|.{..VP_E| |00000390| 58 54 5f 41 50 49 5f 56 | 45 52 53 49 4f 4e 2c 09 |XT_API_V|ERSION,.| |000003a0| 09 09 2f 2f 20 53 65 74 | 20 74 6f 20 56 50 5f 45 |..// Set| to VP_E| |000003b0| 58 54 5f 41 50 49 5f 56 | 45 52 53 49 4f 4e 0d 09 |XT_API_V|ERSION..| |000003c0| 70 6c 75 67 56 69 73 75 | 61 6c 2c 09 09 09 09 09 |plugVisu|al,.....| |000003d0| 2f 2f 20 53 68 6f 75 6c | 64 20 62 65 20 61 6c 77 |// Shoul|d be alw| |000003e0| 61 79 73 20 70 6c 75 67 | 56 69 73 75 61 6c 20 28 |ays plug|Visual (| |000003f0| 6f 74 68 65 72 77 69 73 | 65 20 77 68 61 74 20 61 |otherwis|e what a| |00000400| 72 65 20 77 65 20 64 6f | 69 6e 67 20 68 65 72 65 |re we do|ing here| |00000410| 3f 20 3d 29 0d 09 0d 09 | 6e 69 6c 2c 09 09 09 09 |? =)....|nil,....| |00000420| 09 09 2f 2f 20 57 65 20 | 68 61 76 65 20 6e 6f 20 |..// We |have no | |00000430| 66 6c 61 67 73 0d 09 6e | 69 6c 2c 09 09 09 09 09 |flags..n|il,.....| |00000440| 09 2f 2f 20 57 65 20 68 | 61 76 65 20 6e 6f 20 67 |.// We h|ave no g| |00000450| 6c 6f 62 61 6c 20 72 65 | 66 63 6f 6e 2e 0d 09 22 |lobal re|fcon..."| |00000460| 5c 70 4c 65 76 65 6c 4d | 65 74 65 72 2b 2b 22 2c |\pLevelM|eter++",| |00000470| 09 09 09 2f 2f 20 57 68 | 61 74 27 73 20 6f 75 72 |...// Wh|at's our| |00000480| 20 6e 61 6d 65 20 74 6f | 20 64 69 73 70 6c 61 79 | name to| display| |00000490| 20 69 6e 20 74 68 65 20 | 50 6c 75 67 69 6e 73 20 | in the |Plugins | |000004a0| 6d 65 6e 75 3f 0d 09 0d | 09 09 09 09 09 09 09 09 |menu?...|........| |000004b0| 2f 2f 20 46 75 6e 63 74 | 69 6f 6e 20 70 6f 69 6e |// Funct|ion poin| |000004c0| 74 65 72 73 2e 20 55 73 | 65 20 6e 69 6c 20 69 66 |ters. Us|e nil if| |000004d0| 20 79 6f 75 20 64 6f 6e | 27 74 20 75 73 65 20 73 | you don|'t use s| |000004e0| 6f 6d 65 74 68 69 6e 67 | 2e 0d 09 50 6c 75 67 49 |omething|...PlugI| |000004f0| 6e 69 74 69 61 6c 69 7a | 65 2c 0d 09 50 6c 75 67 |nitializ|e,..Plug| |00000500| 54 65 72 6d 69 6e 61 74 | 65 2c 0d 09 50 6c 75 67 |Terminat|e,..Plug| |00000510| 50 72 6f 63 65 73 73 2c | 0d 09 50 6c 75 67 4d 61 |Process,|..PlugMa| |00000520| 63 45 76 65 6e 74 2c 0d | 09 50 6c 75 67 4b 65 79 |cEvent,.|.PlugKey| |00000530| 44 6f 77 6e 2c 09 09 2f | 2f 20 28 75 6e 75 73 65 |Down,../|/ (unuse| |00000540| 64 20 69 6e 20 74 68 69 | 73 20 65 78 61 6d 70 6c |d in thi|s exampl| |00000550| 65 29 0d 09 50 6c 75 67 | 49 64 6c 65 2c 09 09 09 |e)..Plug|Idle,...| |00000560| 2f 2f 20 28 75 6e 75 73 | 65 64 20 69 6e 20 74 68 |// (unus|ed in th| |00000570| 69 73 20 65 78 61 6d 70 | 6c 65 29 0d 09 50 6c 75 |is examp|le)..Plu| |00000580| 67 53 65 74 74 69 6e 67 | 73 2c 09 09 2f 2f 20 28 |gSetting|s,..// (| |00000590| 75 6e 75 73 65 64 20 69 | 6e 20 74 68 69 73 20 65 |unused i|n this e| |000005a0| 78 61 6d 70 6c 65 29 0d | 09 50 6c 75 67 41 62 6f |xample).|.PlugAbo| |000005b0| 75 74 2c 0d 09 0d 09 2f | 2f 20 a5 ca 4e 45 57 20 |ut,..../|/ ..NEW | |000005c0| 46 4f 52 20 31 2e 32 20 | a5 0d 09 50 6c 75 67 53 |FOR 1.2 |...PlugS| |000005d0| 6f 6e 67 53 74 61 72 74 | 2c 0d 09 50 6c 75 67 53 |ongStart|,..PlugS| |000005e0| 6f 6e 67 45 6e 64 2c 0d | 09 0d 09 6e 69 6c 09 09 |ongEnd,.|...nil..| |000005f0| 09 09 09 2f 2f 20 4d 61 | 63 41 4d 50 20 77 69 6c |...// Ma|cAMP wil| |00000600| 6c 20 66 69 6c 6c 20 6f | 75 74 20 74 68 69 73 20 |l fill o|ut this | |00000610| 76 61 6c 75 65 20 66 6f | 72 20 75 73 2e 0d 7d 3b |value fo|r us..};| |00000620| 0d 0d 2f 2f 20 54 68 65 | 73 65 20 61 72 65 20 67 |..// The|se are g| |00000630| 6c 6f 62 61 6c 73 2e 0d | 73 74 61 74 69 63 20 6c |lobals..|static l| |00000640| 6f 6e 67 20 74 69 63 6b | 73 3b 09 09 2f 2f 20 74 |ong tick|s;..// t| |00000650| 69 63 6b 20 63 6f 75 6e | 74 20 76 61 72 69 61 62 |ick coun|t variab| |00000660| 6c 65 20 74 6f 20 6b 65 | 65 70 20 73 6f 6d 65 20 |le to ke|ep some | |00000670| 73 6f 72 74 20 6f 66 20 | 73 79 6e 63 68 2e 0d 73 |sort of |synch..s| |00000680| 74 61 74 69 63 20 73 68 | 6f 72 74 20 6c 65 66 74 |tatic sh|ort left| |00000690| 3b 09 09 2f 2f 20 6c 65 | 66 74 20 61 6e 64 20 72 |;..// le|ft and r| |000006a0| 69 67 68 74 20 63 68 61 | 6e 6e 65 6c 20 76 61 6c |ight cha|nnel val| |000006b0| 75 65 73 20 28 30 3c 3d | 78 3c 3d 32 30 29 0d 73 |ues (0<=|x<=20).s| |000006c0| 74 61 74 69 63 20 73 68 | 6f 72 74 20 72 69 67 68 |tatic sh|ort righ| |000006d0| 74 3b 0d 73 74 61 74 69 | 63 20 73 68 6f 72 74 20 |t;.stati|c short | |000006e0| 72 65 66 6e 75 6d 3b 09 | 2f 2f 20 70 6c 75 67 69 |refnum;.|// plugi| |000006f0| 6e 20 72 65 73 6f 75 72 | 63 65 20 66 6f 72 6b 20 |n resour|ce fork | |00000700| 72 65 66 6e 75 6d 0d 0d | 2f 2f 20 64 69 72 74 79 |refnum..|// dirty| |00000710| 20 68 61 63 6b 2e 0d 51 | 44 47 6c 6f 62 61 6c 73 | hack..Q|DGlobals| |00000720| 50 74 72 09 71 64 50 74 | 72 20 3d 20 6e 69 6c 3b |Ptr.qdPt|r = nil;| |00000730| 0d 0d 0d 2f 2f 20 4f 74 | 68 65 72 20 66 75 6e 63 |...// Ot|her func| |00000740| 74 69 6f 6e 20 70 72 6f | 74 6f 74 79 70 65 73 0d |tion pro|totypes.| |00000750| 76 6f 69 64 20 50 72 6f | 63 65 73 73 4d 50 33 28 |void Pro|cessMP3(| |00000760| 73 68 6f 72 74 20 63 68 | 61 6e 2c 20 63 6f 6e 73 |short ch|an, cons| |00000770| 74 20 64 6f 75 62 6c 65 | 2a 20 73 74 72 65 61 6d |t double|* stream| |00000780| 29 3b 0d 76 6f 69 64 20 | 50 72 6f 63 65 73 73 4d |);.void |ProcessM| |00000790| 50 32 28 73 68 6f 72 74 | 20 63 68 61 6e 2c 20 63 |P2(short| chan, c| |000007a0| 6f 6e 73 74 20 64 6f 75 | 62 6c 65 2a 20 73 74 72 |onst dou|ble* str| |000007b0| 65 61 6d 29 3b 0d 76 6f | 69 64 20 44 72 61 77 4d |eam);.vo|id DrawM| |000007c0| 65 74 65 72 73 28 57 69 | 6e 64 6f 77 50 74 72 20 |eters(Wi|ndowPtr | |000007d0| 77 69 6e 64 29 3b 0d 4f | 53 45 72 72 20 50 6c 75 |wind);.O|SErr Plu| |000007e0| 67 4c 6f 61 64 4d 79 73 | 65 6c 66 28 76 6f 69 64 |gLoadMys|elf(void| |000007f0| 29 3b 0d 76 6f 69 64 20 | 50 6c 75 67 55 6e 6c 6f |);.void |PlugUnlo| |00000800| 61 64 4d 79 73 65 6c 66 | 28 76 6f 69 64 29 3b 0d |adMyself|(void);.| |00000810| 0d 2f 2a 20 0d 09 50 6c | 75 67 4c 6f 61 64 4d 79 |./* ..Pl|ugLoadMy| |00000820| 73 65 6c 66 0d 0d 09 43 | 61 6c 6c 65 64 20 77 68 |self...C|alled wh| |00000830| 65 6e 20 79 6f 75 72 20 | 70 6c 75 67 69 6e 20 66 |en your |plugin f| |00000840| 72 61 67 6d 65 6e 74 20 | 69 73 20 6c 6f 61 64 65 |ragment |is loade| |00000850| 64 20 69 6e 20 6d 65 6d | 6f 72 79 2e 20 59 6f 75 |d in mem|ory. You| |00000860| 20 6d 61 79 20 77 69 73 | 68 20 74 6f 20 63 68 61 | may wis|h to cha| |00000870| 6e 67 65 20 67 50 6c 75 | 67 49 6e 66 6f 20 66 69 |nge gPlu|gInfo fi| |00000880| 65 6c 64 73 20 68 65 72 | 65 2c 20 6f 72 0d 09 64 |elds her|e, or..d| |00000890| 6f 20 73 6f 6d 65 74 68 | 69 6e 67 20 65 6c 73 65 |o someth|ing else| |000008a0| 20 6c 69 6b 65 20 6f 70 | 65 6e 69 6e 67 20 79 6f | like op|ening yo| |000008b0| 75 72 20 67 6c 6f 62 61 | 6c 20 70 72 65 66 65 72 |ur globa|l prefer| |000008c0| 65 6e 63 65 73 2e 20 54 | 61 6b 65 20 61 20 6c 6f |ences. T|ake a lo| |000008d0| 6f 6b 20 61 74 20 74 68 | 65 20 50 50 43 20 4c 69 |ok at th|e PPC Li| |000008e0| 6e 6b 65 72 20 70 61 6e | 65 6c 20 69 6e 20 74 68 |nker pan|el in th| |000008f0| 65 20 74 61 72 67 65 74 | 20 73 65 74 74 69 6e 67 |e target| setting| |00000900| 73 0d 09 74 6f 20 67 65 | 74 20 61 6e 20 69 64 65 |s..to ge|t an ide| |00000910| 61 20 68 6f 77 20 69 74 | 27 73 20 64 6f 6e 65 2e |a how it|'s done.| |00000920| 0d 09 0d 2a 2f 0d 4f 53 | 45 72 72 20 50 6c 75 67 |...*/.OS|Err Plug| |00000930| 4c 6f 61 64 4d 79 73 65 | 6c 66 28 76 6f 69 64 29 |LoadMyse|lf(void)| |00000940| 0d 7b 0d 09 72 65 74 75 | 72 6e 20 6e 6f 45 72 72 |.{..retu|rn noErr| |00000950| 3b 0d 7d 0d 0d 2f 2a 20 | 0d 09 50 6c 75 67 55 6e |;.}../* |..PlugUn| |00000960| 6c 6f 61 64 4d 79 73 65 | 6c 66 0d 0d 09 43 61 6c |loadMyse|lf...Cal| |00000970| 6c 65 64 20 77 68 65 6e | 20 4d 61 63 41 6d 70 20 |led when| MacAmp | |00000980| 69 73 20 61 62 6f 75 74 | 20 74 6f 20 71 75 69 74 |is about| to quit| |00000990| 20 61 6e 64 20 64 69 73 | 70 6f 73 65 20 61 6c 6c | and dis|pose all| |000009a0| 20 70 6c 75 67 69 6e 73 | 2e 20 44 69 73 70 6f 73 | plugins|. Dispos| |000009b0| 65 20 61 6e 79 20 67 6c | 6f 62 61 6c 20 73 74 75 |e any gl|obal stu| |000009c0| 66 66 20 79 6f 75 20 61 | 6c 6c 6f 63 61 74 65 64 |ff you a|llocated| |000009d0| 20 69 6e 20 50 6c 75 67 | 4c 6f 61 64 4d 79 73 65 | in Plug|LoadMyse| |000009e0| 6c 66 0d 09 65 74 63 2e | 0d 09 0d 2a 2f 0d 76 6f |lf..etc.|...*/.vo| |000009f0| 69 64 20 50 6c 75 67 55 | 6e 6c 6f 61 64 4d 79 73 |id PlugU|nloadMys| |00000a00| 65 6c 66 28 76 6f 69 64 | 29 0d 7b 0d 09 72 65 74 |elf(void|).{..ret| |00000a10| 75 72 6e 3b 0d 7d 0d 0d | 2f 2a 20 0d 09 50 6c 75 |urn;.}..|/* ..Plu| |00000a20| 67 49 6e 69 74 69 61 6c | 69 7a 65 0d 0d 09 43 61 |gInitial|ize...Ca| |00000a30| 6c 6c 65 64 20 65 76 65 | 72 79 20 74 69 6d 65 20 |lled eve|ry time | |00000a40| 75 73 65 20 73 65 6c 65 | 63 74 73 20 79 6f 75 72 |use sele|cts your| |00000a50| 20 70 6c 75 67 69 6e 20 | 66 72 6f 6d 20 74 68 65 | plugin |from the| |00000a60| 20 50 6c 75 67 69 6e 73 | 20 6d 65 6e 75 2e 20 59 | Plugins| menu. Y| |00000a70| 6f 75 20 6e 65 65 64 20 | 74 6f 20 61 6c 6c 6f 63 |ou need |to alloc| |00000a80| 61 74 65 20 61 6e 64 20 | 64 69 73 70 6c 61 79 20 |ate and |display | |00000a90| 61 20 77 69 6e 64 6f 77 | 20 68 65 72 65 2c 0d 09 |a window| here,..| |00000aa0| 69 6e 69 74 20 79 6f 75 | 72 20 76 61 72 69 61 62 |init you|r variab| |00000ab0| 6c 65 73 2c 20 61 6e 64 | 20 64 6f 20 77 68 61 74 |les, and| do what| |00000ac0| 65 76 65 72 20 79 6f 75 | 20 77 61 6e 74 2c 20 6c |ever you| want, l| |00000ad0| 69 6b 65 20 73 65 74 20 | 74 68 65 20 72 65 66 6e |ike set |the refn| |00000ae0| 75 6d 20 69 66 20 79 6f | 75 20 6e 65 65 64 20 69 |um if yo|u need i| |00000af0| 74 2e 0d 09 0d 09 54 68 | 69 73 20 66 75 6e 63 74 |t.....Th|is funct| |00000b00| 69 6f 6e 20 75 73 65 73 | 20 46 53 53 70 65 63 20 |ion uses| FSSpec | |00000b10| 74 6f 20 69 74 73 65 6c | 66 20 74 68 61 74 20 4d |to itsel|f that M| |00000b20| 61 63 41 6d 70 20 70 72 | 6f 76 69 64 65 73 20 74 |acAmp pr|ovides t| |00000b30| 6f 20 69 74 20 74 6f 20 | 67 61 69 6e 20 61 63 63 |o it to |gain acc| |00000b40| 65 73 73 20 74 6f 20 69 | 74 73 20 72 65 73 6f 75 |ess to i|ts resou| |00000b50| 72 63 65 20 66 6f 72 6b | 2e 0d 09 0d 09 4f 74 68 |rce fork|.....Oth| |00000b60| 65 72 20 74 68 61 6e 20 | 74 68 61 74 2c 20 65 76 |er than |that, ev| |00000b70| 65 72 79 74 68 69 6e 67 | 20 69 73 20 68 61 72 64 |erything| is hard| |00000b80| 2d 63 6f 64 65 64 20 61 | 6e 64 20 69 73 20 64 65 |-coded a|nd is de| |00000b90| 66 69 6e 69 74 6c 79 20 | 6e 6f 74 20 61 6e 20 65 |finitly |not an e| |00000ba0| 78 61 6d 70 6c 65 20 6f | 66 20 67 6f 6f 64 20 70 |xample o|f good p| |00000bb0| 72 6f 67 72 61 6d 6d 69 | 6e 67 20 3d 50 0d 2a 2f |rogrammi|ng =P.*/| |00000bc0| 0d 4f 53 45 72 72 09 50 | 6c 75 67 49 6e 69 74 69 |.OSErr.P|lugIniti| |00000bd0| 61 6c 69 7a 65 28 57 69 | 6e 64 6f 77 50 74 72 2a |alize(Wi|ndowPtr*| |00000be0| 20 77 69 6e 64 6f 77 2c | 20 46 53 53 70 65 63 50 | window,| FSSpecP| |00000bf0| 74 72 20 66 69 6c 65 2c | 20 55 49 6e 74 33 32 2a |tr file,| UInt32*| |00000c00| 29 0d 7b 0d 09 52 65 63 | 74 20 62 6f 75 6e 64 73 |).{..Rec|t bounds| |00000c10| 20 3d 20 7b 20 34 30 2c | 20 31 30 2c 20 31 30 30 | = { 40,| 10, 100| |00000c20| 2c 20 31 39 20 7d 3b 09 | 2f 2f 20 67 75 65 73 73 |, 19 };.|// guess| |00000c30| 20 77 68 61 74 20 74 68 | 69 73 20 69 73 2c 20 69 | what th|is is, i| |00000c40| 74 27 73 20 77 69 6e 64 | 6f 77 20 63 6f 6f 72 64 |t's wind|ow coord| |00000c50| 69 6e 61 74 65 73 2e 20 | 59 75 63 6b 2e 20 3d 29 |inates. |Yuck. =)| |00000c60| 0d 09 47 72 61 66 50 74 | 72 09 70 6f 72 74 3b 0d |..GrafPt|r.port;.| |00000c70| 09 0d 09 47 65 74 50 6f | 72 74 28 26 70 6f 72 74 |...GetPo|rt(&port| |00000c80| 29 3b 0d 09 0d 09 2f 2f | 20 63 72 65 61 74 65 20 |);....//| create | |00000c90| 61 20 6e 65 77 20 77 69 | 6e 64 6f 77 20 77 69 74 |a new wi|ndow wit| |00000ca0| 68 20 66 6c 6f 61 74 69 | 6e 67 20 6c 6f 6f 6b 20 |h floati|ng look | |00000cb0| 61 73 20 69 6e 63 6c 75 | 64 65 64 20 69 6e 20 4d |as inclu|ded in M| |00000cc0| 61 63 4f 53 20 37 2e 36 | 2b 20 28 57 44 45 46 20 |acOS 7.6|+ (WDEF | |00000cd0| 69 64 20 31 32 34 29 0d | 09 2a 77 69 6e 64 6f 77 |id 124).|.*window| |00000ce0| 20 3d 20 4e 65 77 43 57 | 69 6e 64 6f 77 28 6e 69 | = NewCW|indow(ni| |00000cf0| 6c 2c 26 62 6f 75 6e 64 | 73 2c 22 5c 70 22 2c 74 |l,&bound|s,"\p",t| |00000d00| 72 75 65 2c 31 39 38 35 | 2c 28 57 69 6e 64 6f 77 |rue,1985|,(Window| |00000d10| 50 74 72 29 2d 31 2c 74 | 72 75 65 2c 6e 69 6c 29 |Ptr)-1,t|rue,nil)| |00000d20| 3b 0d 09 0d 09 69 66 20 | 28 21 2a 77 69 6e 64 6f |;....if |(!*windo| |00000d30| 77 29 0d 09 09 72 65 74 | 75 72 6e 20 76 69 73 4e |w)...ret|urn visN| |00000d40| 6f 4d 65 6d 6f 72 79 3b | 0d 09 0d 09 53 65 74 50 |oMemory;|....SetP| |00000d50| 6f 72 74 28 2a 77 69 6e | 64 6f 77 29 3b 0d 09 42 |ort(*win|dow);..B| |00000d60| 61 63 6b 43 6f 6c 6f 72 | 28 62 6c 61 63 6b 43 6f |ackColor|(blackCo| |00000d70| 6c 6f 72 29 3b 0d 09 50 | 65 6e 53 69 7a 65 28 34 |lor);..P|enSize(4| |00000d80| 2c 20 31 29 3b 0d 09 53 | 65 74 50 6f 72 74 28 70 |, 1);..S|etPort(p| |00000d90| 6f 72 74 29 3b 0d 0d 09 | 2f 2f 20 69 6e 69 74 20 |ort);...|// init | |00000da0| 6f 75 72 20 76 61 72 69 | 61 62 6c 65 73 2e 0d 09 |our vari|ables...| |00000db0| 6c 65 66 74 20 3d 20 72 | 69 67 68 74 20 3d 20 30 |left = r|ight = 0| |00000dc0| 3b 0d 09 74 69 63 6b 73 | 20 3d 20 54 69 63 6b 43 |;..ticks| = TickC| |00000dd0| 6f 75 6e 74 28 29 3b 0d | 0d 09 2f 2f 20 64 72 61 |ount();.|..// dra| |00000de0| 77 20 7a 65 72 6f 65 73 | 20 69 6e 69 74 69 61 6c |w zeroes| initial| |00000df0| 6c 79 0d 09 44 72 61 77 | 4d 65 74 65 72 73 28 2a |ly..Draw|Meters(*| |00000e00| 77 69 6e 64 6f 77 29 3b | 0d 0d 09 2f 2f 20 4f 70 |window);|...// Op| |00000e10| 65 6e 20 6f 75 72 20 72 | 65 73 6f 75 72 63 65 20 |en our r|esource | |00000e20| 66 6f 72 6b 20 61 6e 64 | 20 73 61 76 65 20 74 68 |fork and| save th| |00000e30| 65 20 72 65 66 6e 75 6d | 20 66 6f 72 20 63 6c 6f |e refnum| for clo| |00000e40| 73 69 6e 67 20 69 74 20 | 28 77 65 20 61 72 65 20 |sing it |(we are | |00000e50| 61 20 77 65 6c 6c 2d 62 | 65 68 61 76 65 64 20 70 |a well-b|ehaved p| |00000e60| 6c 75 67 69 6e 2c 20 72 | 69 67 68 74 3f 20 3b 29 |lugin, r|ight? ;)| |00000e70| 0d 09 72 65 66 6e 75 6d | 20 3d 20 46 53 70 4f 70 |..refnum| = FSpOp| |00000e80| 65 6e 52 65 73 46 69 6c | 65 28 66 69 6c 65 2c 20 |enResFil|e(file, | |00000e90| 66 73 52 64 50 65 72 6d | 29 3b 0d 0d 09 2f 2f 20 |fsRdPerm|);...// | |00000ea0| 47 65 74 20 71 64 20 67 | 6c 6f 62 61 6c 73 20 66 |Get qd g|lobals f| |00000eb0| 72 6f 6d 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |rom the |applicat| |00000ec0| 69 6f 6e 20 62 79 20 63 | 61 6c 6c 69 6e 67 20 74 |ion by c|alling t| |00000ed0| 68 65 20 63 61 6c 6c 62 | 61 63 6b 0d 09 69 66 20 |he callb|ack..if | |00000ee0| 28 67 50 6c 75 67 49 6e | 66 6f 2e 63 61 6c 6c 62 |(gPlugIn|fo.callb| |00000ef0| 61 63 6b 73 20 21 3d 20 | 6e 69 6c 29 0d 09 09 71 |acks != |nil)...q| |00000f00| 64 50 74 72 20 3d 20 67 | 50 6c 75 67 49 6e 66 6f |dPtr = g|PlugInfo| |00000f10| 2e 63 61 6c 6c 62 61 63 | 6b 73 2d 3e 67 65 74 51 |.callbac|ks->getQ| |00000f20| 44 50 74 72 50 72 6f 63 | 28 29 3b 0d 09 09 0d 09 |DPtrProc|();.....| |00000f30| 72 65 74 75 72 6e 20 76 | 69 73 4e 6f 45 72 72 3b |return v|isNoErr;| |00000f40| 0d 7d 0d 0d 2f 2a 20 0d | 09 50 6c 75 67 54 65 72 |.}../* .|.PlugTer| |00000f50| 6d 69 6e 61 74 65 0d 0d | 09 43 61 6c 6c 65 64 20 |minate..|.Called | |00000f60| 77 68 65 6e 20 75 73 65 | 72 20 64 65 73 65 6c 65 |when use|r desele| |00000f70| 63 74 73 20 79 6f 75 72 | 20 70 6c 75 67 69 6e 2c |cts your| plugin,| |00000f80| 20 4d 61 63 41 6d 70 20 | 71 75 69 74 73 20 6f 72 | MacAmp |quits or| |00000f90| 20 69 6e 20 74 68 65 20 | 63 61 73 65 20 69 66 20 | in the |case if | |00000fa0| 79 6f 75 20 68 61 76 65 | 20 70 61 73 73 65 64 20 |you have| passed | |00000fb0| 76 69 73 54 65 72 6d 69 | 6e 61 74 65 2f 76 69 73 |visTermi|nate/vis| |00000fc0| 4e 6f 4d 65 6d 6f 72 79 | 20 65 72 72 6f 72 2e 0d |NoMemory| error..| |00000fd0| 09 59 6f 75 20 73 68 6f | 75 6c 64 20 64 69 73 70 |.You sho|uld disp| |00000fe0| 6f 73 65 20 79 6f 75 72 | 20 77 69 6e 64 6f 77 20 |ose your| window | |00000ff0| 68 65 72 65 20 26 20 63 | 6c 65 61 6e 20 75 70 20 |here & c|lean up | |00001000| 74 68 65 20 6d 65 73 73 | 2e 0d 2a 2f 0d 4f 53 45 |the mess|..*/.OSE| |00001010| 72 72 09 50 6c 75 67 54 | 65 72 6d 69 6e 61 74 65 |rr.PlugT|erminate| |00001020| 28 57 69 6e 64 6f 77 50 | 74 72 20 77 69 6e 64 6f |(WindowP|tr windo| |00001030| 77 2c 20 55 49 6e 74 33 | 32 2a 29 0d 7b 0d 09 69 |w, UInt3|2*).{..i| |00001040| 66 20 28 77 69 6e 64 6f | 77 20 21 3d 20 6e 69 6c |f (windo|w != nil| |00001050| 29 0d 09 09 44 69 73 70 | 6f 73 65 57 69 6e 64 6f |)...Disp|oseWindo| |00001060| 77 28 77 69 6e 64 6f 77 | 29 3b 0d 09 0d 09 2f 2f |w(window|);....//| |00001070| 20 43 6c 6f 73 65 20 6f | 75 72 20 72 65 73 6f 75 | Close o|ur resou| |00001080| 72 63 65 20 66 6f 72 6b | 2e 0d 09 69 66 20 28 72 |rce fork|...if (r| |00001090| 65 66 6e 75 6d 20 21 3d | 20 2d 31 29 0d 09 09 46 |efnum !=| -1)...F| |000010a0| 53 43 6c 6f 73 65 28 72 | 65 66 6e 75 6d 29 3b 0d |SClose(r|efnum);.| |000010b0| 09 09 0d 09 72 65 74 75 | 72 6e 20 76 69 73 4e 6f |....retu|rn visNo| |000010c0| 45 72 72 3b 0d 7d 0d 0d | 2f 2a 20 0d 09 50 6c 75 |Err;.}..|/* ..Plu| |000010d0| 67 50 72 6f 63 65 73 73 | 0d 0d 09 54 68 65 20 68 |gProcess|...The h| |000010e0| 65 61 72 74 20 6f 66 20 | 74 68 65 20 76 69 73 75 |eart of |the visu| |000010f0| 61 6c 20 70 6c 75 67 69 | 6e 2e 20 49 74 20 6d 65 |al plugi|n. It me| |00001100| 61 6e 73 20 79 6f 75 72 | 20 70 6c 75 67 69 6e 20 |ans your| plugin | |00001110| 6e 65 65 64 73 20 74 6f | 20 61 6e 61 6c 79 7a 65 |needs to| analyze| |00001120| 20 74 68 65 20 73 74 72 | 65 61 6d 20 61 6e 64 20 | the str|eam and | |00001130| 64 69 73 70 6c 61 79 20 | 77 68 61 74 65 76 65 72 |display |whatever| |00001140| 20 79 6f 75 20 77 61 6e | 74 2e 0d 09 0d 09 63 68 | you wan|t.....ch| |00001150| 61 6e 20 69 73 20 74 68 | 65 20 6e 75 6d 62 65 72 |an is th|e number| |00001160| 20 6f 66 20 63 68 61 6e | 6e 65 6c 73 2e 0d 09 73 | of chan|nels...s| |00001170| 74 72 65 61 6d 20 69 73 | 20 74 68 65 20 73 6f 75 |tream is| the sou| |00001180| 6e 64 20 64 61 74 61 2c | 20 77 68 69 63 68 20 68 |nd data,| which h| |00001190| 61 73 20 74 68 65 20 73 | 69 7a 65 20 6f 66 20 5b |as the s|ize of [| |000011a0| 32 5d 5b 33 32 5d 5b 64 | 61 74 61 53 69 7a 65 5d |2][32][d|ataSize]| |000011b0| 2e 20 46 6f 72 20 6e 6f | 77 20 64 61 74 61 53 69 |. For no|w dataSi| |000011c0| 7a 65 3d 3d 31 38 20 6d | 65 61 6e 73 20 6c 61 79 |ze==18 m|eans lay| |000011d0| 65 72 20 49 49 49 20 66 | 69 6c 65 73 2c 0d 09 64 |er III f|iles,..d| |000011e0| 61 74 61 53 69 7a 65 20 | 3d 3d 20 33 36 20 6d 65 |ataSize |== 36 me| |000011f0| 61 6e 73 20 6c 61 79 65 | 72 20 49 49 20 66 69 6c |ans laye|r II fil| |00001200| 65 73 2e 20 53 6f 75 6e | 64 20 64 61 74 61 20 69 |es. Soun|d data i| |00001210| 73 20 73 65 70 61 72 61 | 74 65 64 20 62 79 20 63 |s separa|ted by c| |00001220| 68 61 6e 6e 65 6c 73 2c | 20 73 6f 20 73 74 72 65 |hannels,| so stre| |00001230| 61 6d 5b 30 5d 20 77 6f | 75 6c 64 20 62 65 20 6c |am[0] wo|uld be l| |00001240| 65 66 74 2c 20 61 6e 64 | 20 73 74 72 65 61 6d 5b |eft, and| stream[| |00001250| 31 5d 20 2d 0d 09 72 69 | 67 68 74 20 63 68 61 6e |1] -..ri|ght chan| |00001260| 6e 65 6c 2e 0d 09 0d 09 | 59 6f 75 20 73 68 6f 75 |nel.....|You shou| |00001270| 6c 64 20 6e 65 76 65 72 | 20 65 76 65 72 20 6d 6f |ld never| ever mo| |00001280| 64 69 66 79 20 74 68 65 | 20 63 6f 6e 74 65 6e 74 |dify the| content| |00001290| 73 20 6f 66 20 74 68 65 | 20 73 74 72 65 61 6d 20 |s of the| stream | |000012a0| 70 6f 69 6e 74 65 72 2e | 20 44 6f 69 6e 67 20 73 |pointer.| Doing s| |000012b0| 6f 20 77 69 6c 6c 20 61 | 66 66 65 63 74 20 74 68 |o will a|ffect th| |000012c0| 65 20 70 6c 61 79 62 61 | 63 6b 2e 0d 09 5b 4f 6e |e playba|ck...[On| |000012d0| 20 74 68 65 20 6f 74 68 | 65 72 20 68 61 6e 64 2c | the oth|er hand,| |000012e0| 20 69 66 20 79 6f 75 20 | 6b 6e 6f 77 20 77 68 61 | if you |know wha| |000012f0| 74 20 79 6f 75 27 72 65 | 20 64 6f 69 6e 67 2c 20 |t you're| doing, | |00001300| 79 6f 75 20 43 41 4e 20 | 6d 6f 64 69 66 79 20 74 |you CAN |modify t| |00001310| 68 65 20 64 61 74 61 20 | 73 74 72 65 61 6d 2e 20 |he data |stream. | |00001320| 44 6f 69 6e 67 20 73 6f | 20 77 69 6c 6c 20 63 68 |Doing so| will ch| |00001330| 61 6e 67 65 20 74 68 65 | 20 73 6f 75 6e 64 2e 0d |ange the| sound..| |00001340| 09 53 6f 20 77 69 74 68 | 20 61 20 6c 69 74 74 6c |.So with| a littl| |00001350| 65 20 6b 6e 6f 77 6c 65 | 64 67 65 20 79 6f 75 20 |e knowle|dge you | |00001360| 63 61 6e 20 74 75 72 6e | 20 61 20 76 69 73 75 61 |can turn| a visua| |00001370| 6c 20 70 6c 75 67 69 6e | 20 69 6e 74 6f 20 61 20 |l plugin| into a | |00001380| 73 6f 75 6e 64 20 70 6c | 75 67 69 6e 20 28 6d 61 |sound pl|ugin (ma| |00001390| 6b 65 20 61 20 6e 65 77 | 20 65 71 75 61 6c 69 7a |ke a new| equaliz| |000013a0| 65 72 20 3b 29 5d 0d 2a | 2f 0d 4f 53 45 72 72 09 |er ;)].*|/.OSErr.| |000013b0| 50 6c 75 67 50 72 6f 63 | 65 73 73 28 57 69 6e 64 |PlugProc|ess(Wind| |000013c0| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 2c 20 73 68 |owPtr wi|ndow, sh| |000013d0| 6f 72 74 20 63 68 61 6e | 2c 20 63 6f 6e 73 74 20 |ort chan|, const | |000013e0| 64 6f 75 62 6c 65 2a 20 | 73 74 72 65 61 6d 2c 20 |double* |stream, | |000013f0| 73 68 6f 72 74 20 64 61 | 74 61 53 69 7a 65 2c 20 |short da|taSize, | |00001400| 55 49 6e 74 33 32 2a 29 | 0d 7b 0d 09 69 66 20 28 |UInt32*)|.{..if (| |00001410| 54 69 63 6b 43 6f 75 6e | 74 28 29 20 2d 20 74 69 |TickCoun|t() - ti| |00001420| 63 6b 73 20 3e 20 31 29 | 0d 09 7b 0d 09 09 69 66 |cks > 1)|..{...if| |00001430| 20 28 64 61 74 61 53 69 | 7a 65 20 3d 3d 20 31 38 | (dataSi|ze == 18| |00001440| 29 0d 09 09 09 50 72 6f | 63 65 73 73 4d 50 33 28 |)....Pro|cessMP3(| |00001450| 63 68 61 6e 2c 20 73 74 | 72 65 61 6d 29 3b 0d 09 |chan, st|ream);..| |00001460| 09 65 6c 73 65 0d 09 09 | 09 50 72 6f 63 65 73 73 |.else...|.Process| |00001470| 4d 50 32 28 63 68 61 6e | 2c 20 73 74 72 65 61 6d |MP2(chan|, stream| |00001480| 29 3b 0d 09 09 09 0d 09 | 09 44 72 61 77 4d 65 74 |);......|.DrawMet| |00001490| 65 72 73 28 77 69 6e 64 | 6f 77 29 3b 0d 09 09 0d |ers(wind|ow);....| |000014a0| 09 09 6c 65 66 74 2d 2d | 3b 0d 09 09 72 69 67 68 |..left--|;...righ| |000014b0| 74 2d 2d 3b 0d 09 09 74 | 69 63 6b 73 20 3d 20 54 |t--;...t|icks = T| |000014c0| 69 63 6b 43 6f 75 6e 74 | 28 29 3b 0d 09 7d 0d 09 |ickCount|();..}..| |000014d0| 0d 09 72 65 74 75 72 6e | 20 76 69 73 4e 6f 45 72 |..return| visNoEr| |000014e0| 72 3b 0d 7d 0d 0d 2f 2a | 20 0d 09 50 6c 75 67 4d |r;.}../*| ..PlugM| |000014f0| 61 63 45 76 65 6e 74 0d | 0d 09 50 72 6f 63 65 73 |acEvent.|..Proces| |00001500| 73 20 61 20 6d 61 63 20 | 65 76 65 6e 74 20 74 68 |s a mac |event th| |00001510| 61 74 20 69 73 20 72 65 | 6c 61 74 65 64 20 74 6f |at is re|lated to| |00001520| 20 74 68 65 20 77 69 6e | 64 6f 77 20 28 61 63 74 | the win|dow (act| |00001530| 69 76 61 74 65 2f 64 65 | 61 63 74 69 76 61 74 65 |ivate/de|activate| |00001540| 2c 20 75 70 64 61 74 65 | 2c 20 6d 6f 75 73 65 44 |, update|, mouseD| |00001550| 6f 77 6e 29 2e 0d 09 0d | 09 59 6f 75 20 63 61 6e |own)....|.You can| |00001560| 20 64 6f 20 77 68 61 74 | 65 76 65 72 20 79 6f 75 | do what|ever you| |00001570| 20 77 61 6e 74 2c 20 62 | 75 74 20 72 65 6d 65 6d | want, b|ut remem| |00001580| 62 65 72 20 74 68 61 74 | 20 69 66 20 79 6f 75 20 |ber that| if you | |00001590| 64 6f 6e 27 74 20 68 61 | 6e 64 6c 65 20 75 70 64 |don't ha|ndle upd| |000015a0| 61 74 65 20 65 76 65 6e | 74 73 2c 20 74 68 61 74 |ate even|ts, that| |000015b0| 20 77 69 6c 6c 20 73 63 | 72 65 77 20 75 70 20 74 | will sc|rew up t| |000015c0| 68 65 20 77 68 6f 6c 65 | 0d 09 4d 61 63 41 6d 70 |he whole|..MacAmp| |000015d0| 20 77 69 6e 64 6f 77 20 | 75 70 64 61 74 65 20 70 | window |update p| |000015e0| 72 6f 63 65 73 73 2e 0d | 2a 2f 0d 4f 53 45 72 72 |rocess..|*/.OSErr| |000015f0| 09 50 6c 75 67 4d 61 63 | 45 76 65 6e 74 28 57 69 |.PlugMac|Event(Wi| |00001600| 6e 64 6f 77 50 74 72 20 | 77 69 6e 64 6f 77 2c 20 |ndowPtr |window, | |00001610| 45 76 65 6e 74 52 65 63 | 6f 72 64 2a 20 65 76 65 |EventRec|ord* eve| |00001620| 6e 74 2c 20 55 49 6e 74 | 33 32 2a 29 0d 7b 0d 09 |nt, UInt|32*).{..| |00001630| 4f 53 45 72 72 09 72 65 | 73 75 6c 74 20 3d 20 76 |OSErr.re|sult = v| |00001640| 69 73 4e 6f 45 72 72 3b | 0d 09 73 77 69 74 63 68 |isNoErr;|..switch| |00001650| 20 28 65 76 65 6e 74 2d | 3e 77 68 61 74 29 0d 09 | (event-|>what)..| |00001660| 7b 0d 09 09 63 61 73 65 | 20 75 70 64 61 74 65 45 |{...case| updateE| |00001670| 76 74 3a 0d 09 09 09 42 | 65 67 69 6e 55 70 64 61 |vt:....B|eginUpda| |00001680| 74 65 28 77 69 6e 64 6f | 77 29 3b 0d 09 09 09 44 |te(windo|w);....D| |00001690| 72 61 77 4d 65 74 65 72 | 73 28 77 69 6e 64 6f 77 |rawMeter|s(window| |000016a0| 29 3b 0d 09 09 09 45 6e | 64 55 70 64 61 74 65 28 |);....En|dUpdate(| |000016b0| 77 69 6e 64 6f 77 29 3b | 0d 09 09 09 62 72 65 61 |window);|....brea| |000016c0| 6b 3b 0d 09 09 09 0d 09 | 09 63 61 73 65 20 6d 6f |k;......|.case mo| |000016d0| 75 73 65 44 6f 77 6e 3a | 0d 09 09 09 7b 0d 09 09 |useDown:|....{...| |000016e0| 09 09 57 69 6e 64 6f 77 | 50 74 72 09 77 69 6e 64 |..Window|Ptr.wind| |000016f0| 3b 0d 09 09 09 09 73 68 | 6f 72 74 20 74 68 65 50 |;.....sh|ort theP| |00001700| 61 72 74 20 3d 20 46 69 | 6e 64 57 69 6e 64 6f 77 |art = Fi|ndWindow| |00001710| 28 65 76 65 6e 74 2d 3e | 77 68 65 72 65 2c 20 26 |(event->|where, &| |00001720| 77 69 6e 64 29 3b 0d 09 | 09 09 09 73 77 69 74 63 |wind);..|...switc| |00001730| 68 20 28 74 68 65 50 61 | 72 74 29 0d 09 09 09 09 |h (thePa|rt).....| |00001740| 7b 0d 09 09 09 09 09 63 | 61 73 65 20 69 6e 44 72 |{......c|ase inDr| |00001750| 61 67 3a 0d 09 09 09 09 | 09 09 2f 2f 20 75 67 6c |ag:.....|..// ugl| |00001760| 79 20 68 61 63 6b 2e 20 | 69 74 20 73 68 6f 75 6c |y hack. |it shoul| |00001770| 6b 64 20 62 65 20 71 64 | 2e 73 63 72 65 65 6e 42 |kd be qd|.screenB| |00001780| 69 74 73 2e 62 6f 75 6e | 64 73 2e 0d 09 09 09 09 |its.boun|ds......| |00001790| 09 09 44 72 61 67 57 69 | 6e 64 6f 77 28 77 69 6e |..DragWi|ndow(win| |000017a0| 64 2c 20 65 76 65 6e 74 | 2d 3e 77 68 65 72 65 2c |d, event|->where,| |000017b0| 20 26 71 64 50 74 72 2d | 3e 73 63 72 65 65 6e 42 | &qdPtr-|>screenB| |000017c0| 69 74 73 2e 62 6f 75 6e | 64 73 29 3b 0d 09 09 09 |its.boun|ds);....| |000017d0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 09 0d |...break|;.......| |000017e0| 09 09 09 09 09 63 61 73 | 65 20 69 6e 47 6f 41 77 |.....cas|e inGoAw| |000017f0| 61 79 3a 0d 09 09 09 09 | 09 09 69 66 20 28 54 72 |ay:.....|..if (Tr| |00001800| 61 63 6b 47 6f 41 77 61 | 79 28 77 69 6e 64 2c 20 |ackGoAwa|y(wind, | |00001810| 65 76 65 6e 74 2d 3e 77 | 68 65 72 65 29 29 0d 09 |event->w|here))..| |00001820| 09 09 09 09 09 09 72 65 | 73 75 6c 74 20 3d 20 76 |......re|sult = v| |00001830| 69 73 54 65 72 6d 69 6e | 61 74 65 3b 09 09 09 2f |isTermin|ate;.../| |00001840| 2f 20 69 66 20 75 73 65 | 72 20 63 6c 69 63 6b 65 |/ if use|r clicke| |00001850| 64 20 74 68 65 20 63 6c | 6f 73 65 20 62 6f 78 2c |d the cl|ose box,| |00001860| 20 73 68 75 74 20 6f 75 | 72 73 65 6c 66 20 64 6f | shut ou|rself do| |00001870| 77 6e 2e 0d 09 09 09 09 | 09 09 62 72 65 61 6b 3b |wn......|..break;| |00001880| 0d 09 09 09 09 09 0d 09 | 09 09 09 09 63 61 73 65 |........|....case| |00001890| 20 69 6e 43 6f 6e 74 65 | 6e 74 3a 0d 09 09 09 09 | inConte|nt:.....| |000018a0| 09 09 2f 2f 20 68 65 68 | 65 2c 20 6d 61 78 20 6f |..// heh|e, max o| |000018b0| 75 74 20 65 76 65 72 79 | 74 68 69 6e 67 0d 09 09 |ut every|thing...| |000018c0| 09 09 09 09 6c 65 66 74 | 20 3d 20 72 69 67 68 74 |....left| = right| |000018d0| 20 3d 20 32 30 3b 0d 09 | 09 09 09 09 09 44 72 61 | = 20;..|.....Dra| |000018e0| 77 4d 65 74 65 72 73 28 | 77 69 6e 64 29 3b 0d 09 |wMeters(|wind);..| |000018f0| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |.....bre|ak;.....| |00001900| 7d 0d 09 09 09 09 0d 09 | 09 09 7d 0d 09 09 09 62 |}.......|..}....b| |00001910| 72 65 61 6b 3b 0d 09 09 | 09 0d 09 09 64 65 66 61 |reak;...|....defa| |00001920| 75 6c 74 3a 0d 09 09 09 | 62 72 65 61 6b 3b 0d 09 |ult:....|break;..| |00001930| 7d 0d 09 72 65 74 75 72 | 6e 20 72 65 73 75 6c 74 |}..retur|n result| |00001940| 3b 0d 7d 0d 0d 2f 2a 20 | 0d 09 50 6c 75 67 41 62 |;.}../* |..PlugAb| |00001950| 6f 75 74 0d 0d 09 43 61 | 6c 6c 65 64 20 77 68 65 |out...Ca|lled whe| |00001960| 6e 20 61 20 75 73 65 72 | 20 73 65 6c 65 63 74 73 |n a user| selects| |00001970| 20 22 41 62 6f 75 74 20 | 74 68 65 20 50 6c 75 67 | "About |the Plug| |00001980| 69 6e 22 20 66 72 6f 6d | 20 74 68 65 20 6d 65 6e |in" from| the men| |00001990| 75 2e 20 59 6f 75 20 73 | 68 6f 75 6c 64 20 64 69 |u. You s|hould di| |000019a0| 73 70 6c 61 79 20 73 6f | 6d 65 20 73 6f 72 74 20 |splay so|me sort | |000019b0| 6f 66 20 61 62 6f 75 74 | 20 62 6f 78 2c 20 0d 09 |of about| box, ..| |000019c0| 64 6f 20 73 6f 6d 65 20 | 73 6f 72 74 20 6f 66 20 |do some |sort of | |000019d0| 61 6e 20 65 66 66 65 63 | 74 20 6f 72 20 77 68 61 |an effec|t or wha| |000019e0| 74 65 76 65 72 20 79 6f | 75 20 66 65 65 6c 20 6c |tever yo|u feel l| |000019f0| 69 6b 65 20 69 74 2e 0d | 2a 2f 0d 4f 53 45 72 72 |ike it..|*/.OSErr| |00001a00| 09 50 6c 75 67 41 62 6f | 75 74 28 57 69 6e 64 6f |.PlugAbo|ut(Windo| |00001a10| 77 50 74 72 2c 20 55 49 | 6e 74 33 32 2a 29 0d 7b |wPtr, UI|nt32*).{| |00001a20| 0d 09 4e 6f 74 65 41 6c | 65 72 74 28 31 32 33 34 |..NoteAl|ert(1234| |00001a30| 2c 20 6e 69 6c 29 3b 0d | 09 72 65 74 75 72 6e 20 |, nil);.|.return | |00001a40| 76 69 73 4e 6f 45 72 72 | 3b 0d 7d 0d 0d 2f 2a 20 |visNoErr|;.}../* | |00001a50| 0d 09 50 6c 75 67 49 64 | 6c 65 0d 0d 09 43 61 6c |..PlugId|le...Cal| |00001a60| 6c 65 64 20 77 68 65 6e | 65 76 65 72 20 4d 61 63 |led when|ever Mac| |00001a70| 41 6d 70 20 67 65 74 73 | 20 73 6f 6d 65 20 73 70 |Amp gets| some sp| |00001a80| 61 72 65 20 74 69 6d 65 | 2e 20 49 74 27 73 20 61 |are time|. It's a| |00001a90| 20 67 6f 6f 64 20 70 6c | 61 63 65 20 74 6f 20 64 | good pl|ace to d| |00001aa0| 65 63 72 65 6d 65 6e 74 | 20 79 6f 75 72 20 76 61 |ecrement| your va| |00001ab0| 6c 75 65 73 2c 20 64 72 | 61 77 20 74 68 65 20 73 |lues, dr|aw the s| |00001ac0| 74 75 66 66 20 65 74 63 | 2e 0d 09 0d 09 43 61 6c |tuff etc|.....Cal| |00001ad0| 6c 65 64 20 6f 6e 6c 79 | 20 69 66 20 66 6c 61 67 |led only| if flag| |00001ae0| 47 65 74 49 64 6c 65 20 | 69 73 20 73 65 74 2e 0d |GetIdle |is set..| |00001af0| 2a 2f 0d 4f 53 45 72 72 | 09 50 6c 75 67 49 64 6c |*/.OSErr|.PlugIdl| |00001b00| 65 28 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |e(Window|Ptr wind| |00001b10| 6f 77 2c 20 55 49 6e 74 | 33 32 2a 20 72 65 66 63 |ow, UInt|32* refc| |00001b20| 6f 6e 29 0d 7b 0d 23 70 | 72 61 67 6d 61 20 75 6e |on).{.#p|ragma un| |00001b30| 75 73 65 64 20 28 77 69 | 6e 64 6f 77 2c 20 72 65 |used (wi|ndow, re| |00001b40| 66 63 6f 6e 29 0d 09 72 | 65 74 75 72 6e 20 76 69 |fcon)..r|eturn vi| |00001b50| 73 4e 6f 45 72 72 3b 0d | 7d 0d 0d 2f 2a 20 0d 09 |sNoErr;.|}../* ..| |00001b60| 50 6c 75 67 4b 65 79 44 | 6f 77 6e 0d 0d 09 43 61 |PlugKeyD|own...Ca| |00001b70| 6c 6c 65 64 20 77 68 65 | 6e 20 61 20 75 73 65 72 |lled whe|n a user| |00001b80| 20 70 72 65 73 73 65 73 | 20 61 20 62 75 74 74 6f | presses| a butto| |00001b90| 6e 2c 20 61 6e 64 20 61 | 66 74 65 72 20 69 74 20 |n, and a|fter it | |00001ba0| 77 61 73 20 70 72 6f 63 | 65 73 73 65 64 20 62 79 |was proc|essed by| |00001bb0| 20 4d 61 63 41 6d 70 2e | 20 4b 65 65 70 20 69 6e | MacAmp.| Keep in| |00001bc0| 20 6d 69 6e 64 20 74 68 | 61 74 20 6e 6f 20 6d 61 | mind th|at no ma| |00001bd0| 74 74 65 72 20 69 66 20 | 69 74 0d 09 77 61 73 20 |tter if |it..was | |00001be0| 70 72 6f 63 65 73 73 65 | 64 20 62 79 20 4d 61 63 |processe|d by Mac| |00001bf0| 41 6d 70 20 6f 72 20 6e | 6f 74 2c 20 79 6f 75 72 |Amp or n|ot, your| |00001c00| 20 70 6c 75 67 20 73 74 | 69 6c 6c 20 67 65 74 73 | plug st|ill gets| |00001c10| 20 69 74 2e 20 53 6f 20 | 69 66 20 79 6f 75 20 77 | it. So |if you w| |00001c20| 61 6e 74 20 74 74 6f 20 | 68 61 76 65 20 73 6f 6d |ant tto |have som| |00001c30| 65 20 6b 65 79 62 6f 61 | 72 64 20 63 6f 6e 74 72 |e keyboa|rd contr| |00001c40| 6f 6c 2c 20 74 72 79 20 | 74 6f 0d 09 75 73 65 20 |ol, try |to..use | |00001c50| 75 6e 75 73 65 64 20 6b | 65 79 73 2e 0d 09 0d 09 |unused k|eys.....| |00001c60| 43 61 6c 6c 65 64 20 6f | 6e 6c 79 20 69 66 20 66 |Called o|nly if f| |00001c70| 6c 61 67 47 65 74 4b 65 | 79 44 6f 77 6e 20 69 73 |lagGetKe|yDown is| |00001c80| 20 73 65 74 2e 0d 2a 2f | 0d 4f 53 45 72 72 09 50 | set..*/|.OSErr.P| |00001c90| 6c 75 67 4b 65 79 44 6f | 77 6e 28 57 69 6e 64 6f |lugKeyDo|wn(Windo| |00001ca0| 77 50 74 72 20 77 69 6e | 64 6f 77 2c 20 63 68 61 |wPtr win|dow, cha| |00001cb0| 72 20 6b 65 79 2c 20 73 | 68 6f 72 74 20 6d 6f 64 |r key, s|hort mod| |00001cc0| 69 66 69 65 72 73 2c 20 | 55 49 6e 74 33 32 2a 20 |ifiers, |UInt32* | |00001cd0| 72 65 66 63 6f 6e 29 0d | 7b 0d 23 70 72 61 67 6d |refcon).|{.#pragm| |00001ce0| 61 20 75 6e 75 73 65 64 | 20 28 77 69 6e 64 6f 77 |a unused| (window| |00001cf0| 2c 20 6b 65 79 2c 20 6d | 6f 64 69 66 69 65 72 73 |, key, m|odifiers| |00001d00| 2c 20 72 65 66 63 6f 6e | 29 0d 09 72 65 74 75 72 |, refcon|)..retur| |00001d10| 6e 20 76 69 73 4e 6f 45 | 72 72 3b 0d 7d 0d 0d 2f |n visNoE|rr;.}../| |00001d20| 2a 20 0d 09 50 6c 75 67 | 53 65 74 74 69 6e 67 73 |* ..Plug|Settings| |00001d30| 0d 0d 09 43 61 6c 6c 65 | 64 20 77 68 65 6e 20 75 |...Calle|d when u| |00001d40| 73 65 72 20 73 65 6c 65 | 63 74 73 20 79 6f 75 72 |ser sele|cts your| |00001d50| 20 70 6c 75 67 69 6e 20 | 66 72 6f 6d 20 74 68 65 | plugin |from the| |00001d60| 20 53 65 74 74 69 6e 67 | 73 20 73 75 62 6d 65 6e | Setting|s submen| |00001d70| 75 2e 20 4f 6e 6c 79 20 | 75 73 65 64 20 69 66 20 |u. Only |used if | |00001d80| 79 6f 75 20 68 61 76 65 | 20 64 65 63 6c 61 72 65 |you have| declare| |00001d90| 64 20 74 68 61 74 0d 09 | 79 6f 75 20 73 75 70 70 |d that..|you supp| |00001da0| 6f 72 74 20 73 65 74 74 | 69 6e 67 73 20 28 66 6c |ort sett|ings (fl| |00001db0| 61 67 48 61 73 53 65 74 | 74 69 6e 67 73 20 69 73 |agHasSet|tings is| |00001dc0| 20 73 65 74 29 2e 0d 09 | 0d 09 59 6f 75 20 73 68 | set)...|..You sh| |00001dd0| 6f 75 6c 64 20 64 69 73 | 70 6c 61 79 20 74 68 65 |ould dis|play the| |00001de0| 20 73 65 74 74 69 6e 67 | 73 20 64 69 61 6c 6f 67 | setting|s dialog| |00001df0| 20 68 65 72 65 2c 20 6f | 72 20 64 6f 20 77 68 61 | here, o|r do wha| |00001e00| 74 65 76 65 72 72 20 79 | 6f 75 20 66 65 65 6c 20 |teverr y|ou feel | |00001e10| 6c 69 6b 65 2e 20 3d 29 | 20 4a 75 73 74 20 72 65 |like. =)| Just re| |00001e20| 6d 65 6d 62 65 72 20 74 | 68 61 74 20 77 68 65 6e |member t|hat when| |00001e30| 20 75 73 65 72 0d 09 63 | 68 6f 6f 73 65 73 20 73 | user..c|hooses s| |00001e40| 65 74 74 69 6e 67 73 20 | 28 73 29 68 65 20 65 78 |ettings |(s)he ex| |00001e50| 70 65 63 74 73 20 73 6f | 6d 65 20 69 6e 74 65 72 |pects so|me inter| |00001e60| 61 63 74 69 6e 6f 20 77 | 69 74 68 20 74 68 65 20 |actino w|ith the | |00001e70| 70 6c 75 67 69 6e 2c 20 | 6c 69 6b 65 20 74 68 65 |plugin, |like the| |00001e80| 20 64 69 61 6c 6f 67 20 | 6f 72 20 6c 69 6b 65 20 | dialog |or like | |00001e90| 74 68 61 74 2e 0d 2a 2f | 0d 4f 53 45 72 72 09 50 |that..*/|.OSErr.P| |00001ea0| 6c 75 67 53 65 74 74 69 | 6e 67 73 28 57 69 6e 64 |lugSetti|ngs(Wind| |00001eb0| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 2c 20 55 49 |owPtr wi|ndow, UI| |00001ec0| 6e 74 33 32 2a 20 72 65 | 66 63 6f 6e 29 0d 7b 0d |nt32* re|fcon).{.| |00001ed0| 23 70 72 61 67 6d 61 20 | 75 6e 75 73 65 64 20 28 |#pragma |unused (| |00001ee0| 77 69 6e 64 6f 77 2c 20 | 72 65 66 63 6f 6e 29 0d |window, |refcon).| |00001ef0| 09 72 65 74 75 72 6e 20 | 76 69 73 4e 6f 45 72 72 |.return |visNoErr| |00001f00| 3b 0d 7d 0d 0d 2f 2a 20 | 0d 09 50 6c 75 67 53 6f |;.}../* |..PlugSo| |00001f10| 6e 67 53 74 61 72 74 0d | 0d 09 47 65 74 73 20 63 |ngStart.|..Gets c| |00001f20| 61 6c 6c 65 64 20 69 6d | 6d 65 64 69 61 74 65 6c |alled im|mediatel| |00001f30| 79 20 62 65 66 6f 72 65 | 20 74 68 65 20 73 6f 6e |y before| the son| |00001f40| 67 20 73 74 61 72 74 2e | 20 59 6f 75 20 63 61 6e |g start.| You can| |00001f50| 20 6f 62 74 61 69 6e 20 | 49 44 33 20 69 6e 66 6f | obtain |ID3 info| |00001f60| 72 6d 61 74 69 6f 6e 20 | 61 62 6f 75 74 20 74 68 |rmation |about th| |00001f70| 65 20 74 72 61 63 6b 20 | 68 65 72 65 20 65 74 63 |e track |here etc| |00001f80| 0d 09 69 66 20 79 6f 75 | 20 77 61 6e 74 20 2d 2d |..if you| want --| |00001f90| 20 69 74 20 77 6f 6e 27 | 74 20 62 65 20 63 68 61 | it won'|t be cha| |00001fa0| 6e 67 65 64 20 75 6e 74 | 69 6c 20 6e 65 78 74 20 |nged unt|il next | |00001fb0| 73 6f 6e 67 20 73 74 61 | 72 74 73 2e 0d 2a 2f 0d |song sta|rts..*/.| |00001fc0| 4f 53 45 72 72 09 50 6c | 75 67 53 6f 6e 67 53 74 |OSErr.Pl|ugSongSt| |00001fd0| 61 72 74 28 57 69 6e 64 | 6f 77 50 74 72 2c 20 55 |art(Wind|owPtr, U| |00001fe0| 49 6e 74 33 32 2a 29 0d | 7b 0d 09 2f 2f 20 77 65 |Int32*).|{..// we| |00001ff0| 20 64 6f 6e 27 74 20 64 | 6f 20 61 6e 79 74 68 69 | don't d|o anythi| |00002000| 6e 67 2e 09 0d 09 72 65 | 74 75 72 6e 20 76 69 73 |ng....re|turn vis| |00002010| 4e 6f 45 72 72 3b 0d 7d | 0d 0d 2f 2a 20 0d 09 50 |NoErr;.}|../* ..P| |00002020| 6c 75 67 53 6f 6e 67 45 | 6e 64 0d 0d 09 47 65 74 |lugSongE|nd...Get| |00002030| 73 20 63 61 6c 6c 65 64 | 20 69 6d 6d 65 64 69 61 |s called| immedia| |00002040| 74 65 6c 79 20 61 66 74 | 65 72 20 74 68 65 20 73 |tely aft|er the s| |00002050| 6f 6e 67 20 65 6e 64 2e | 20 49 74 20 69 73 20 61 |ong end.| It is a| |00002060| 20 67 6f 6f 64 20 69 64 | 65 61 20 74 6f 20 63 6c | good id|ea to cl| |00002070| 65 61 72 2f 73 74 6f 70 | 20 61 6e 79 20 61 6e 69 |ear/stop| any ani| |00002080| 6d 61 74 69 6f 6e 73 20 | 61 74 20 74 68 69 73 20 |mations |at this | |00002090| 70 6f 69 6e 74 0d 09 62 | 65 63 61 75 73 65 20 79 |point..b|ecause y| |000020a0| 6f 75 20 77 69 6c 6c 20 | 6e 6f 74 20 72 65 63 65 |ou will |not rece| |000020b0| 69 76 65 20 50 6c 75 67 | 50 72 6f 63 65 73 73 20 |ive Plug|Process | |000020c0| 63 61 6c 6c 73 20 75 6e | 74 69 6c 20 6e 65 78 74 |calls un|til next| |000020d0| 20 73 6f 6e 67 20 69 73 | 20 73 74 61 72 74 65 64 | song is| started| |000020e0| 20 2d 2d 20 74 68 61 74 | 20 63 61 6e 20 68 61 70 | -- that| can hap| |000020f0| 70 65 6e 20 69 6e 20 6f | 6e 65 0d 09 6d 69 6e 75 |pen in o|ne..minu| |00002100| 74 65 2f 6f 6e 65 20 73 | 65 63 6f 6e 64 20 6f 72 |te/one s|econd or| |00002110| 20 6e 65 76 65 72 2e 20 | 59 6f 75 20 6e 65 76 65 | never. |You neve| |00002120| 72 20 6b 6e 6f 77 2e 20 | 3d 29 0d 2a 2f 0d 4f 53 |r know. |=).*/.OS| |00002130| 45 72 72 09 50 6c 75 67 | 53 6f 6e 67 45 6e 64 28 |Err.Plug|SongEnd(| |00002140| 57 69 6e 64 6f 77 50 74 | 72 20 77 69 6e 64 6f 77 |WindowPt|r window| |00002150| 2c 20 55 49 6e 74 33 32 | 2a 20 72 65 66 63 6f 6e |, UInt32|* refcon| |00002160| 29 0d 7b 0d 23 70 72 61 | 67 6d 61 20 75 6e 75 73 |).{.#pra|gma unus| |00002170| 65 64 20 28 77 69 6e 64 | 6f 77 2c 20 72 65 66 63 |ed (wind|ow, refc| |00002180| 6f 6e 29 0d 0d 09 2f 2f | 20 6a 75 73 74 20 72 65 |on)...//| just re| |00002190| 73 65 74 20 74 68 65 20 | 62 61 72 73 20 61 6e 64 |set the |bars and| |000021a0| 20 64 72 61 77 20 74 68 | 65 6d 2e 0d 09 0d 09 6c | draw th|em.....l| |000021b0| 65 66 74 20 3d 20 30 3b | 0d 09 72 69 67 68 74 20 |eft = 0;|..right | |000021c0| 3d 20 30 3b 0d 09 0d 09 | 44 72 61 77 4d 65 74 65 |= 0;....|DrawMete| |000021d0| 72 73 28 77 69 6e 64 6f | 77 29 3b 0d 09 0d 09 72 |rs(windo|w);....r| |000021e0| 65 74 75 72 6e 20 76 69 | 73 4e 6f 45 72 72 3b 0d |eturn vi|sNoErr;.| |000021f0| 7d 0d 0d 23 70 72 61 67 | 6d 61 20 6d 61 72 6b 20 |}..#prag|ma mark | |00002200| 2d 0d 0d 2f 2f 20 54 68 | 65 20 66 6f 6c 6c 6f 77 |-..// Th|e follow| |00002210| 69 6e 67 20 74 77 6f 20 | 66 75 6e 63 74 69 6f 6e |ing two |function| |00002220| 73 20 61 72 65 20 65 78 | 61 6d 70 6c 65 73 20 6f |s are ex|amples o| |00002230| 66 20 61 6e 61 6c 79 7a | 69 6e 67 20 74 68 65 20 |f analyz|ing the | |00002240| 64 61 74 61 20 73 74 72 | 65 61 6d 2e 0d 76 6f 69 |data str|eam..voi| |00002250| 64 20 50 72 6f 63 65 73 | 73 4d 50 33 28 73 68 6f |d Proces|sMP3(sho| |00002260| 72 74 20 63 68 61 6e 2c | 20 63 6f 6e 73 74 20 64 |rt chan,| const d| |00002270| 6f 75 62 6c 65 2a 20 73 | 74 72 65 61 6d 29 0d 7b |ouble* s|tream).{| |00002280| 0d 09 69 6e 74 20 7a 3b | 0d 09 0d 09 64 6f 75 62 |..int z;|....doub| |00002290| 6c 65 20 73 75 6d 31 20 | 3d 20 30 2e 30 3b 0d 09 |le sum1 |= 0.0;..| |000022a0| 64 6f 75 62 6c 65 20 73 | 75 6d 32 20 3d 20 30 2e |double s|um2 = 0.| |000022b0| 30 3b 0d 09 09 0d 09 69 | 66 20 28 63 68 61 6e 20 |0;.....i|f (chan | |000022c0| 3d 3d 20 32 29 0d 09 7b | 0d 09 09 66 6f 72 20 28 |== 2)..{|...for (| |000022d0| 7a 20 3d 20 31 3b 20 7a | 20 3c 20 32 30 3b 20 7a |z = 1; z| < 20; z| |000022e0| 20 2b 2b 29 0d 09 09 20 | 20 73 75 6d 31 20 2b 3d | ++)... | sum1 +=| |000022f0| 20 73 74 72 65 61 6d 5b | 7a 5d 3b 0d 09 09 66 6f | stream[|z];...fo| |00002300| 72 20 28 7a 20 3d 20 31 | 3b 20 7a 20 3c 20 32 30 |r (z = 1|; z < 20| |00002310| 3b 20 7a 20 2b 2b 29 0d | 09 09 20 20 73 75 6d 32 |; z ++).|.. sum2| |00002320| 20 2b 3d 20 73 74 72 65 | 61 6d 5b 33 32 2a 31 38 | += stre|am[32*18| |00002330| 2b 7a 5d 3b 0d 09 7d 20 | 65 6c 73 65 20 7b 0d 09 |+z];..} |else {..| |00002340| 09 66 6f 72 20 28 7a 20 | 3d 20 31 3b 20 7a 20 3c |.for (z |= 1; z <| |00002350| 20 32 30 3b 20 7a 20 2b | 2b 29 0d 09 09 20 73 75 | 20; z +|+)... su| |00002360| 6d 31 20 2b 3d 20 73 74 | 72 65 61 6d 5b 7a 5d 3b |m1 += st|ream[z];| |00002370| 0d 09 09 73 75 6d 32 20 | 3d 20 73 75 6d 31 3b 0d |...sum2 |= sum1;.| |00002380| 09 7d 0d 09 0d 09 73 75 | 6d 31 20 3d 20 41 42 53 |.}....su|m1 = ABS| |00002390| 28 73 75 6d 31 29 20 2a | 20 32 30 2e 30 3b 0d 09 |(sum1) *| 20.0;..| |000023a0| 73 75 6d 31 20 3d 20 4d | 49 4e 28 32 30 2e 30 2c |sum1 = M|IN(20.0,| |000023b0| 20 4d 41 58 28 30 2e 30 | 2c 20 73 75 6d 31 29 29 | MAX(0.0|, sum1))| |000023c0| 3b 0d 09 6c 65 66 74 20 | 3d 20 4d 41 58 28 6c 65 |;..left |= MAX(le| |000023d0| 66 74 2c 20 73 75 6d 31 | 29 3b 0d 0d 09 73 75 6d |ft, sum1|);...sum| |000023e0| 32 20 3d 20 41 42 53 28 | 73 75 6d 32 29 20 2a 20 |2 = ABS(|sum2) * | |000023f0| 32 30 2e 30 3b 0d 09 73 | 75 6d 32 20 3d 20 4d 49 |20.0;..s|um2 = MI| |00002400| 4e 28 32 30 2e 30 2c 20 | 4d 41 58 28 30 2e 30 2c |N(20.0, |MAX(0.0,| |00002410| 20 73 75 6d 32 29 29 3b | 0d 09 72 69 67 68 74 20 | sum2));|..right | |00002420| 3d 20 4d 41 58 28 72 69 | 67 68 74 2c 20 73 75 6d |= MAX(ri|ght, sum| |00002430| 32 29 3b 0d 7d 0d 0d 76 | 6f 69 64 20 50 72 6f 63 |2);.}..v|oid Proc| |00002440| 65 73 73 4d 50 32 28 73 | 68 6f 72 74 20 63 68 61 |essMP2(s|hort cha| |00002450| 6e 2c 20 63 6f 6e 73 74 | 20 64 6f 75 62 6c 65 2a |n, const| double*| |00002460| 20 73 74 72 65 61 6d 29 | 0d 7b 0d 09 73 68 6f 72 | stream)|.{..shor| |00002470| 74 20 7a 3b 0d 09 0d 09 | 64 6f 75 62 6c 65 20 73 |t z;....|double s| |00002480| 75 6d 31 20 3d 20 30 2e | 30 3b 0d 09 64 6f 75 62 |um1 = 0.|0;..doub| |00002490| 6c 65 20 73 75 6d 32 20 | 3d 20 30 2e 30 3b 0d 09 |le sum2 |= 0.0;..| |000024a0| 09 0d 09 09 69 66 20 28 | 63 68 61 6e 20 3d 3d 20 |....if (|chan == | |000024b0| 32 29 0d 09 09 7b 0d 09 | 09 09 66 6f 72 20 28 7a |2)...{..|..for (z| |000024c0| 20 3d 20 30 3b 20 7a 20 | 3c 20 32 30 3b 20 7a 20 | = 0; z |< 20; z | |000024d0| 2b 2b 29 0d 09 09 09 20 | 20 73 75 6d 31 20 2b 3d |++).... | sum1 +=| |000024e0| 20 73 74 72 65 61 6d 5b | 7a 5d 3b 0d 09 09 09 66 | stream[|z];....f| |000024f0| 6f 72 20 28 7a 20 3d 20 | 30 3b 20 7a 20 3c 20 32 |or (z = |0; z < 2| |00002500| 30 3b 20 7a 20 2b 2b 29 | 0d 09 09 09 20 20 73 75 |0; z ++)|.... su| |00002510| 6d 32 20 2b 3d 20 73 74 | 72 65 61 6d 5b 33 32 2a |m2 += st|ream[32*| |00002520| 33 36 2b 7a 5d 3b 0d 09 | 09 7d 20 0d 09 09 65 6c |36+z];..|.} ...el| |00002530| 73 65 20 0d 09 09 7b 0d | 09 09 09 66 6f 72 20 28 |se ...{.|...for (| |00002540| 7a 20 3d 20 30 3b 20 7a | 20 3c 20 32 30 3b 20 7a |z = 0; z| < 20; z| |00002550| 20 2b 2b 29 0d 09 09 09 | 20 20 73 75 6d 31 20 2b | ++)....| sum1 +| |00002560| 3d 20 73 74 72 65 61 6d | 5b 7a 5d 3b 0d 09 09 09 |= stream|[z];....| |00002570| 73 75 6d 32 20 3d 20 73 | 75 6d 31 3b 0d 09 09 7d |sum2 = s|um1;...}| |00002580| 0d 09 09 0d 09 73 75 6d | 31 20 3d 20 41 42 53 28 |.....sum|1 = ABS(| |00002590| 73 75 6d 31 29 20 2a 20 | 31 30 3b 0d 09 73 75 6d |sum1) * |10;..sum| |000025a0| 31 20 3d 20 4d 49 4e 28 | 32 30 2e 30 2c 20 4d 41 |1 = MIN(|20.0, MA| |000025b0| 58 28 30 2e 30 2c 20 73 | 75 6d 31 29 29 3b 0d 09 |X(0.0, s|um1));..| |000025c0| 6c 65 66 74 20 3d 20 4d | 41 58 28 6c 65 66 74 2c |left = M|AX(left,| |000025d0| 20 73 75 6d 31 29 3b 0d | 0d 09 73 75 6d 32 20 3d | sum1);.|..sum2 =| |000025e0| 20 41 42 53 28 73 75 6d | 32 29 20 2a 20 31 30 3b | ABS(sum|2) * 10;| |000025f0| 0d 09 73 75 6d 32 20 3d | 20 4d 49 4e 28 32 30 2e |..sum2 =| MIN(20.| |00002600| 30 2c 20 4d 41 58 28 30 | 2e 30 2c 20 73 75 6d 32 |0, MAX(0|.0, sum2| |00002610| 29 29 3b 0d 09 72 69 67 | 68 74 20 3d 20 4d 41 58 |));..rig|ht = MAX| |00002620| 28 72 69 67 68 74 2c 20 | 73 75 6d 32 29 3b 0d 7d |(right, |sum2);.}| |00002630| 0d 0d 2f 2f 20 41 6e 64 | 20 74 68 69 73 20 69 73 |..// And| this is| |00002640| 20 61 20 72 65 61 6c 6c | 79 20 73 69 6d 70 6c 65 | a reall|y simple| |00002650| 20 66 75 6e 63 74 69 6f | 6e 20 74 68 61 74 20 64 | functio|n that d| |00002660| 72 61 77 73 20 74 68 65 | 20 6d 65 74 65 72 20 62 |raws the| meter b| |00002670| 61 72 73 2e 0d 76 6f 69 | 64 20 44 72 61 77 4d 65 |ars..voi|d DrawMe| |00002680| 74 65 72 73 28 57 69 6e | 64 6f 77 50 74 72 20 77 |ters(Win|dowPtr w| |00002690| 69 6e 64 29 0d 7b 0d 09 | 47 72 61 66 50 74 72 09 |ind).{..|GrafPtr.| |000026a0| 6f 6c 64 50 6f 72 74 3b | 0d 09 75 6e 73 69 67 6e |oldPort;|..unsign| |000026b0| 65 64 20 73 68 6f 72 74 | 20 70 6f 73 3b 0d 09 0d |ed short| pos;...| |000026c0| 09 47 65 74 50 6f 72 74 | 28 26 6f 6c 64 50 6f 72 |.GetPort|(&oldPor| |000026d0| 74 29 3b 0d 09 53 65 74 | 50 6f 72 74 28 77 69 6e |t);..Set|Port(win| |000026e0| 64 29 3b 0d 09 45 72 61 | 73 65 52 65 63 74 28 26 |d);..Era|seRect(&| |000026f0| 77 69 6e 64 2d 3e 70 6f | 72 74 52 65 63 74 29 3b |wind->po|rtRect);| |00002700| 0d 09 46 6f 72 65 43 6f | 6c 6f 72 28 67 72 65 65 |..ForeCo|lor(gree| |00002710| 6e 43 6f 6c 6f 72 29 3b | 0d 09 4d 6f 76 65 54 6f |nColor);|..MoveTo| |00002720| 28 30 2c 36 30 29 3b 0d | 09 4c 69 6e 65 28 30 2c |(0,60);.|.Line(0,| |00002730| 20 2d 28 6c 65 66 74 20 | 2a 20 33 29 29 3b 0d 09 | -(left |* 3));..| |00002740| 4d 6f 76 65 54 6f 28 35 | 2c 20 36 30 29 3b 0d 09 |MoveTo(5|, 60);..| |00002750| 4c 69 6e 65 28 30 2c 20 | 2d 28 72 69 67 68 74 20 |Line(0, |-(right | |00002760| 2a 20 33 29 29 3b 0d 09 | 46 6f 72 65 43 6f 6c 6f |* 3));..|ForeColo| |00002770| 72 28 72 65 64 43 6f 6c | 6f 72 29 3b 0d 09 09 0d |r(redCol|or);....| |00002780| 09 2f 2f 20 63 61 6c 6c | 20 74 68 65 20 63 61 6c |.// call| the cal| |00002790| 6c 62 61 63 6b 20 74 6f | 20 66 69 6e 64 20 6f 75 |lback to| find ou| |000027a0| 74 20 63 75 72 72 65 6e | 74 20 73 6f 6e 67 20 70 |t curren|t song p| |000027b0| 6f 73 69 74 69 6f 6e 2e | 20 49 66 20 69 74 20 72 |osition.| If it r| |000027c0| 65 74 75 72 6e 73 20 61 | 6e 20 65 72 72 6f 72 2c |eturns a|n error,| |000027d0| 20 77 65 20 61 72 65 20 | 70 72 6f 62 61 62 6c 79 | we are |probably| |000027e0| 20 69 73 6e 27 74 0d 09 | 2f 2f 20 70 6c 61 79 69 | isn't..|// playi| |000027f0| 6e 67 20 61 20 73 6f 6e | 67 2e 20 4a 75 73 74 20 |ng a son|g. Just | |00002800| 69 67 6e 6f 72 65 20 69 | 74 20 61 6e 64 20 73 65 |ignore i|t and se| |00002810| 74 20 74 68 65 20 70 6f | 73 69 74 69 6f 6e 20 74 |t the po|sition t| |00002820| 6f 20 30 2e 20 59 6f 75 | 20 63 61 6e 20 64 6f 20 |o 0. You| can do | |00002830| 6d 6f 72 65 20 65 78 74 | 65 6e 64 65 64 20 65 72 |more ext|ended er| |00002840| 72 6f 72 20 63 68 65 63 | 6b 69 6e 67 2c 0d 09 2f |ror chec|king,../| |00002850| 2f 20 64 65 70 65 6e 64 | 69 6e 67 20 6f 6e 20 79 |/ depend|ing on y| |00002860| 6f 75 72 20 6e 65 65 64 | 73 2e 0d 09 0d 09 69 66 |our need|s.....if| |00002870| 20 28 67 50 6c 75 67 49 | 6e 66 6f 2e 63 61 6c 6c | (gPlugI|nfo.call| |00002880| 62 61 63 6b 73 2d 3e 67 | 65 74 43 75 72 72 65 6e |backs->g|etCurren| |00002890| 74 50 6f 73 50 72 6f 63 | 28 26 70 6f 73 29 20 21 |tPosProc|(&pos) !| |000028a0| 3d 20 76 69 73 4e 6f 45 | 72 72 29 0d 09 09 70 6f |= visNoE|rr)...po| |000028b0| 73 20 3d 20 30 3b 0d 09 | 0d 09 4d 6f 76 65 54 6f |s = 0;..|..MoveTo| |000028c0| 28 32 2c 20 30 29 3b 0d | 09 4c 69 6e 65 28 30 2c |(2, 0);.|.Line(0,| |000028d0| 20 70 6f 73 20 2a 20 30 | 2e 36 29 3b 0d 0d 09 53 | pos * 0|.6);...S| |000028e0| 65 74 50 6f 72 74 28 6f | 6c 64 50 6f 72 74 29 3b |etPort(o|ldPort);| |000028f0| 0d 7d 0d 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.}......|........| |00002900| 00 00 01 00 00 00 01 54 | 00 00 00 54 00 00 00 46 |.......T|...T...F| |00002910| 20 68 61 76 65 6e 74 20 | 74 65 73 74 65 64 2e 2e | havent |tested..| |00002920| 2e 20 2a 2f 0d 09 09 09 | 74 6d 70 3d 28 4d 41 58 |. */....|tmp=(MAX| |00002930| 28 6e 6f 6e 5f 7a 65 72 | 6f 5b 30 5d 2c 6e 6f 6e |(non_zer|o[0],non| |00002940| 5f 7a 65 72 6f 5b 31 5d | 29 29 2f 33 3b 0d 09 09 |_zero[1]|))/3;...| |00002950| 09 73 66 62 3d 30 3b 20 | 77 68 69 6c 65 20 28 74 |.sfb=0; |while (t| |00002960| 5f 73 5b 73 66 62 5d 3c | 74 6d 70 20 26 26 20 73 |_s[sfb]<|tmp && s| |00002970| 66 62 3c 31 32 29 20 73 | 66 62 2b 2b 3b 0d 09 09 |fb<12) s|fb++;...| |00002980| 09 6e 6f 5f 6f 66 5f 69 | 6d 64 63 74 73 5b 30 5d |.no_of_i|mdcts[0]| |00002990| 3d 6e 6f 5f 6f 66 5f 69 | 6d 64 63 74 73 5b 31 5d |=no_of_i|mdcts[1]| |000029a0| 3d 28 74 5f 73 5b 73 66 | 62 5d 2d 31 29 2f 36 2b |=(t_s[sf|b]-1)/6+| |000029b0| 31 3b 0d 09 7d 0d 09 65 | 6c 73 65 20 6e 6f 5f 6f |1;..}..e|lse no_o| |000029c0| 66 5f 69 6d 64 63 74 73 | 5b 30 5d 3d 6e 6f 5f 6f |f_imdcts|[0]=no_o| |000029d0| 66 5f 69 6d 64 63 74 73 | 5b 31 5d 3d 28 69 73 62 |f_imdcts|[1]=(isb| |000029e0| 6f 75 6e 64 5b 30 5d 2d | 31 29 2f 31 38 2b 31 3b |ound[0]-|1)/18+1;| |000029f0| 0d 0d 20 20 20 7d 0d 0d | 20 20 20 72 65 74 75 72 |.. }..| retur| |00002a00| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....| |00002a10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002a20| 00 00 00 00 00 00 00 02 | 00 04 00 6e 00 0d 02 6e |........|...n...n| |00002a30| 03 28 00 6e 00 0d 02 6e | 03 28 b2 d8 77 17 00 00 |.(.n...n|.(..w...| |00002a40| 17 4a 00 00 17 4a 00 00 | 0a 1f 01 00 00 00 00 04 |.J...J..|........| |00002a50| 00 01 00 01 00 00 01 00 | 00 00 01 54 00 00 00 54 |........|...T...T| |00002a60| 00 00 00 46 07 3f e5 10 | 3f e6 00 00 00 1c 00 46 |...F.?..|?......F| |00002a70| 00 01 4d 50 53 52 00 00 | 00 12 4d 57 42 42 00 00 |..MPSR..|..MWBB..| |00002a80| 00 1e 03 ed ff ff 00 00 | 00 00 00 00 00 00 03 f0 |........|........| |00002a90| ff ff 00 00 00 4c 00 00 | 00 00 00 00 00 00 00 00 |.....L..|........| |00002aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| +--------+-------------------------+-------------------------+--------+--------+