Mss-old.h 145 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083
  1. //############################################################################
  2. //## ##
  3. //## Miles Sound System ##
  4. //## ##
  5. //## MSS.H: Miles Sound System main header file ##
  6. //## ##
  7. //## Version 1.00 of 15-Feb-95: Initial, derived from AIL.H V3.02 ##
  8. //## 1.01 of 19-Jun-95: Added various functions for V3.03 release ##
  9. //## 1.02 of 22-Nov-95: C++ typedef problem fixed, declspecs added ##
  10. //## 1.03 of 15-Feb-96: Changes for 16 bit callbacks and multiple ##
  11. //## 16 bit DLL loads (JKR) ##
  12. //## 1.04 of 2-Nov-97: Changes made to handle DLS in future ##
  13. //## versions ##
  14. //## 1.05 of 1-Jan-98: Massive changes for version 4.0 ##
  15. //## 1.06 of 17-Sep-98: Massive changes for version 5.0 ##
  16. //## 1.07 of 2-Feb-99: Changes for new input API ##
  17. //## 1.08 of 8-Feb-99: Changes for new filter helper functions ##
  18. //## ##
  19. //## Author: John Miles ##
  20. //## ##
  21. //############################################################################
  22. //## ##
  23. //## Contact RAD Game Tools at 425-893-4300 for technical support. ##
  24. //## ##
  25. //############################################################################
  26. #ifndef MSS_VERSION
  27. #define MSS_VERSION "5.0q"
  28. #define MSS_VERSION_DATE "06-Aug-99"
  29. #define MSS_COPYRIGHT "Copyright (C) 1991-99 RAD Game Tools, Inc."
  30. #endif
  31. #ifndef MSS_H
  32. #define MSS_H
  33. // IS_DOS for DOS
  34. // IS_WINDOWS for Windows or Win32s
  35. // IS_WIN32 for Win32s
  36. // IS_WIN16 for Windows
  37. // IS_32 for 32-bit DOS or Win32s
  38. // IS_16 for 16-bit Windows
  39. #ifdef IS_DOS
  40. #undef IS_DOS
  41. #endif
  42. #ifdef IS_WINDOWS
  43. #undef IS_WINDOWS
  44. #endif
  45. #ifdef IS_WIN32
  46. #undef IS_WIN32
  47. #endif
  48. #ifdef IS_WIN16
  49. #undef IS_WIN16
  50. #endif
  51. #ifdef IS_32
  52. #undef IS_32
  53. #endif
  54. #ifdef IS_16
  55. #undef IS_16
  56. #endif
  57. #ifdef __DOS__
  58. #define IS_DOS
  59. #define IS_32
  60. #else
  61. #ifdef _WIN32
  62. #define IS_WINDOWS
  63. #define IS_WIN32
  64. #define IS_32
  65. #else
  66. #ifdef WIN32
  67. #define IS_WINDOWS
  68. #define IS_WIN32
  69. #define IS_32
  70. #else
  71. #ifdef __NT__
  72. #define IS_WINDOWS
  73. #define IS_WIN32
  74. #define IS_32
  75. #else
  76. #ifdef __WIN32__
  77. #define IS_WINDOWS
  78. #define IS_WIN32
  79. #define IS_32
  80. #else
  81. #ifdef _WINDOWS
  82. #define IS_WINDOWS
  83. #define IS_WIN16
  84. #define IS_16
  85. #else
  86. #ifdef _WINDLL
  87. #define IS_WINDOWS
  88. #define IS_WIN16
  89. #define IS_16
  90. #else
  91. #ifdef WINDOWS
  92. #define IS_WINDOWS
  93. #define IS_WIN16
  94. #define IS_16
  95. #else
  96. #ifdef __WINDOWS__
  97. #define IS_WINDOWS
  98. #define IS_WIN16
  99. #define IS_16
  100. #else
  101. #ifdef _Windows
  102. #define IS_WINDOWS
  103. #define IS_WIN16
  104. #define IS_16
  105. #endif
  106. #endif
  107. #endif
  108. #endif
  109. #endif
  110. #endif
  111. #endif
  112. #endif
  113. #endif
  114. #endif
  115. #if (!defined(IS_DOS) && !defined(IS_WINDOWS))
  116. #error MSS.H did not detect your platform. Define __DOS__, _WINDOWS, or WIN32.
  117. #endif
  118. #ifdef _PUSHPOP_SUPPORTED
  119. #pragma pack(push,1)
  120. #else
  121. #pragma pack(1)
  122. #endif
  123. #ifdef __cplusplus
  124. extern "C" {
  125. #endif
  126. #ifdef IS_DOS
  127. #define AILCALLBACK __pascal
  128. #define AILEXPORT cdecl
  129. #define DXDEC extern
  130. #define DXDEF
  131. #define AILCALL cdecl
  132. #define FAR
  133. #define HIWORD(ptr) (((U32)ptr)>>16)
  134. #define LOWORD(ptr) ((U16)((U32)ptr))
  135. #define FOURCC U32
  136. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  137. ((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \
  138. ((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 ))
  139. #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
  140. #define AILLIBCALLBACK __pascal
  141. #else
  142. #define AILLIBCALLBACK WINAPI
  143. #ifndef WIN32_LEAN_AND_MEAN
  144. #define WIN32_LEAN_AND_MEAN
  145. #endif
  146. #ifndef WIN32_EXTRA_LEAN
  147. #define WIN32_EXTRA_LEAN
  148. #endif
  149. #ifndef STRICT
  150. #define STRICT
  151. #endif
  152. #include <windows.h>
  153. #include <mmsystem.h>
  154. //
  155. // If compiling MSS DLL, use __declspec(dllexport) for both
  156. // declarations and definitions
  157. //
  158. // If compiling MSS16 library or application, use "extern" in declarations
  159. // and nothing in definitions
  160. //
  161. #ifdef IS_WIN32
  162. #define AILEXPORT WINAPI
  163. #ifdef BUILD_MSS
  164. #define DXDEC __declspec(dllexport)
  165. #define DXDEF __declspec(dllexport)
  166. #else
  167. #ifdef __BORLANDC__
  168. #define DXDEC extern
  169. #else
  170. #define DXDEC __declspec(dllimport)
  171. #endif
  172. #endif
  173. #define MSSDLLNAME "MSS32.DLL"
  174. #else
  175. #define AILEXPORT __export WINAPI
  176. #define DXDEC extern
  177. #define DXDEF
  178. #define MSSDLLNAME "MSS16.DLL"
  179. #endif
  180. #define AILCALL WINAPI
  181. #define AILCALLBACK AILEXPORT
  182. typedef LPVOID AILLPDIRECTSOUND;
  183. typedef LPVOID AILLPDIRECTSOUNDBUFFER;
  184. #endif
  185. #ifndef NULL
  186. #define NULL 0
  187. #endif
  188. //
  189. // Misc. constant definitions
  190. //
  191. #define MAX_DRVRS 16 // Max. # of simultaneous drivers
  192. #define MAX_TIMERS 16 // Max. # of simultaneous timers
  193. #define MAX_NOTES 32 // Max # of notes "on"
  194. #define FOR_NEST 4 // # of nested XMIDI FOR loops
  195. #define NUM_CHANS 16 // # of possible MIDI channels
  196. #define MAX_W_VOICES 16 // Max virtual wave synth voice cnt
  197. #define MAX_W_ENTRIES 512 // 512 wave library entries max.
  198. #define MIN_CHAN ( 1-1) // Min channel recognized (0-based)
  199. #define MAX_CHAN (16-1) // Max channel recognized
  200. #define MIN_LOCK_CHAN ( 2-1) // Min channel available for locking
  201. #define MAX_LOCK_CHAN ( 9-1) // Max channel available for locking
  202. #define PERCUSS_CHAN (10-1) // Percussion channel (no locking)
  203. #define AIL_MAX_FILE_HEADER_SIZE 4096 // AIL_set_named_sample_file() requires at least 4K
  204. // of data or the entire file image, whichever is less,
  205. // to determine sample format
  206. #define DIG_F_16BITS_MASK 1
  207. #define DIG_F_STEREO_MASK 2
  208. #define DIG_F_ADPCM_MASK 4
  209. #define DIG_F_MONO_8 0 // PCM data formats
  210. #define DIG_F_MONO_16 (DIG_F_16BITS_MASK)
  211. #define DIG_F_STEREO_8 (DIG_F_STEREO_MASK)
  212. #define DIG_F_STEREO_16 (DIG_F_STEREO_MASK|DIG_F_16BITS_MASK)
  213. #define DIG_F_ADPCM_MONO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK)
  214. #define DIG_F_ADPCM_STEREO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK)
  215. #define DIG_F_USING_ASI 16
  216. #define DIG_PCM_SIGN 0x0001 // (obsolete)
  217. #define DIG_PCM_ORDER 0x0002
  218. #define DIG_PCM_POLARITY 0x0004 // PCM flags used by driver hardware
  219. #define DIG_PCM_SPLIT 0x0008
  220. #define DIG_BUFFER_SERVICE 0x0010
  221. #define DIG_DUAL_DMA 0x0020
  222. #define DIG_RECORDING_SUPPORTED 0x8000
  223. #define WAVE_FORMAT_PCM 1
  224. #define WAVE_FORMAT_IMA_ADPCM 0x0011
  225. #ifdef IS_DOS
  226. #define AIL3DIG 0 // .DIG driver
  227. #define AIL3MDI 1 // .MDI driver
  228. #define DIG_DETECT_8_BIT_ONLY 0x0001 // Detect 8-bit DMA only
  229. #define DIG_DETECT_16_BIT_ONLY 0x0002 // Detect 16-bit DMA only
  230. #define DIG_DETECT_8_AND_16_BITS 0x0003 // Detect both 8- and 16-bit DMA
  231. #define DRV_INIT 0x300 // Functions common to .MDI and .DIG
  232. #define DRV_GET_INFO 0x301 // drivers
  233. #define DRV_SERVE 0x302
  234. #define DRV_PARSE_ENV 0x303
  235. #define DRV_VERIFY_IO 0x304
  236. #define DRV_INIT_DEV 0x305
  237. #define DRV_SHUTDOWN_DEV 0x306
  238. #define DIG_HW_VOLUME 0x400 // .DIG driver functions
  239. #define DIG_START_P_CMD 0x401
  240. #define DIG_STOP_P_REQ 0x402
  241. #define DIG_START_R_CMD 0x403
  242. #define DIG_STOP_R_REQ 0x404
  243. #define DIG_VSE 0x405
  244. #define MDI_HW_VOLUME 0x500 // .MDI driver functions
  245. #define MDI_INIT_INS_MGR 0x501
  246. #define MDI_MIDI_XMIT 0x502
  247. #define MDI_INSTALL_T_SET 0x503
  248. #define MDI_GET_T_STATUS 0x504
  249. #define MDI_PROT_UNPROT_T 0x505
  250. #define MDI_VSE 0x506
  251. #else
  252. //
  253. // Pass to AIL_midiOutOpen for NULL MIDI driver
  254. //
  255. #define MIDI_NULL_DRIVER ((U32)(S32)-2)
  256. #endif
  257. //
  258. // Non-specific XMIDI/MIDI controllers and event types
  259. //
  260. #define SYSEX_BYTE 105
  261. #define PB_RANGE 106
  262. #define CHAN_MUTE 107
  263. #define CALLBACK_PFX 108
  264. #define SEQ_BRANCH 109
  265. #define CHAN_LOCK 110
  266. #define CHAN_PROTECT 111
  267. #define VOICE_PROTECT 112
  268. #define TIMBRE_PROTECT 113
  269. #define PATCH_BANK_SEL 114
  270. #define INDIRECT_C_PFX 115
  271. #define FOR_LOOP 116
  272. #define NEXT_LOOP 117
  273. #define CLEAR_BEAT_BAR 118
  274. #define CALLBACK_TRIG 119
  275. #define SEQ_INDEX 120
  276. #define GM_BANK_MSB 0
  277. #define MODULATION 1
  278. #define DATA_MSB 6
  279. #define PART_VOLUME 7
  280. #define PANPOT 10
  281. #define EXPRESSION 11
  282. #define GM_BANK_LSB 32
  283. #define DATA_LSB 38
  284. #define SUSTAIN 64
  285. #define REVERB 91
  286. #define CHORUS 93
  287. #define RPN_LSB 100
  288. #define RPN_MSB 101
  289. #define RESET_ALL_CTRLS 121
  290. #define ALL_NOTES_OFF 123
  291. #define EV_NOTE_OFF 0x80
  292. #define EV_NOTE_ON 0x90
  293. #define EV_POLY_PRESS 0xa0
  294. #define EV_CONTROL 0xb0
  295. #define EV_PROGRAM 0xc0
  296. #define EV_CHAN_PRESS 0xd0
  297. #define EV_PITCH 0xe0
  298. #define EV_SYSEX 0xf0
  299. #define EV_ESC 0xf7
  300. #define EV_META 0xff
  301. #define META_EOT 0x2f
  302. #define META_TEMPO 0x51
  303. #define META_TIME_SIG 0x58
  304. //
  305. // SAMPLE.system_data[] usage
  306. //
  307. #define SSD_EOD_CALLBACK 0 // Application end-of-data callback if not NULL
  308. #define VOC_BLK_PTR 1 // Pointer to current block
  309. #define VOC_REP_BLK 2 // Pointer to beginning of repeat loop block
  310. #define VOC_N_REPS 3 // # of iterations left in repeat loop
  311. #define VOC_MARKER 4 // Marker to search for, or -1 if all
  312. #define VOC_MARKER_FOUND 5 // Desired marker found if 1, else 0
  313. #define SSD_RELEASE 6 // Release sample handle upon termination if >0
  314. #ifdef IS_WINDOWS
  315. #define SSD_EOD_CB_WIN32S 7 // Application end-of-data callback is in Win32s
  316. #else
  317. #define SSD_TEMP 7 // Temporary storage location for general use
  318. #endif
  319. //
  320. // Timer status values
  321. //
  322. #define AILT_FREE 0 // Timer handle is free for allocation
  323. #define AILT_STOPPED 1 // Timer is stopped
  324. #define AILT_RUNNING 2 // Timer is running
  325. //
  326. // SAMPLE.status flag values
  327. //
  328. #define SMP_FREE 0x0001 // Sample is available for allocation
  329. #define SMP_DONE 0x0002 // Sample has finished playing, or has
  330. // never been started
  331. #define SMP_PLAYING 0x0004 // Sample is playing
  332. #define SMP_STOPPED 0x0008 // Sample has been stopped
  333. #define SMP_PLAYINGBUTRELEASED 0x0010 // Sample is playing, but digital handle
  334. // has been temporarily released
  335. //
  336. // SEQUENCE.status flag values
  337. //
  338. #define SEQ_FREE 0x0001 // Sequence is available for allocation
  339. #define SEQ_DONE 0x0002 // Sequence has finished playing, or has
  340. // never been started
  341. #define SEQ_PLAYING 0x0004 // Sequence is playing
  342. #define SEQ_STOPPED 0x0008 // Sequence has been stopped
  343. #define SEQ_PLAYINGBUTRELEASED 0x0010 // Sequence is playing, but MIDI handle
  344. // has been temporarily released
  345. #ifdef IS_DOS
  346. //
  347. // MIDI driver types
  348. //
  349. #define MDIDRVRTYPE_GM 0 // General MIDI driver (Roland-compatible)
  350. #define MDIDRVRTYPE_FM_2 1 // 2-operator FM MIDI driver (OPL2)
  351. #define MDIDRVRTYPE_FM_4 2 // 4-operator FM MIDI driver (OPL3)
  352. #define MDIDRVRTYPE_SPKR 3 // Tandy or PC speaker "beep" driver
  353. //
  354. // .INI installation result codes
  355. //
  356. #define AIL_INIT_SUCCESS 0 // Driver installed successfully
  357. #define AIL_NO_INI_FILE 1 // No MDI.INI or DIG.INI file exists
  358. #define AIL_INIT_FAILURE 2 // Driver could not be initialized
  359. #ifdef __BORLANDC__
  360. #ifndef REALPTR
  361. #define REALPTR(x) ((void *) (U32) ((((U32) (x))>>16<<4) + ((x) & 0xffff) \
  362. - AIL_sel_base(_DS)))
  363. #endif
  364. #else
  365. #ifndef REALPTR
  366. #define REALPTR(x) ((void *) (U32) ((((U32) (x))>>16<<4) + ((x) & 0xffff)))
  367. #endif
  368. #endif
  369. #else
  370. //
  371. // AIL_set_direct_buffer_control() command values
  372. //
  373. #define AILDS_RELINQUISH 0 // App returns control of secondary buffer
  374. #define AILDS_SEIZE 1 // App takes control of secondary buffer
  375. #define AILDS_SEIZE_LOOP 2 // App wishes to loop the secondary buffer
  376. #endif
  377. //
  378. // General type definitions for portability
  379. //
  380. #ifndef C8
  381. #define C8 char
  382. #endif
  383. #ifndef U8
  384. #define U8 unsigned char
  385. #endif
  386. #ifndef S8
  387. #define S8 signed char
  388. #endif
  389. #ifndef U16
  390. #define U16 unsigned short
  391. #endif
  392. #ifndef S16
  393. #define S16 signed short
  394. #endif
  395. #ifndef U32
  396. #define U32 unsigned long
  397. #endif
  398. #ifndef S32
  399. #define S32 signed long
  400. #endif
  401. #ifndef F32
  402. #define F32 float
  403. #endif
  404. #ifndef F64
  405. #define F64 double
  406. #endif
  407. #ifndef REALFAR
  408. #define REALFAR unsigned long
  409. #endif
  410. #ifndef FILE_ERRS
  411. #define FILE_ERRS
  412. #define AIL_NO_ERROR 0
  413. #define AIL_IO_ERROR 1
  414. #define AIL_OUT_OF_MEMORY 2
  415. #define AIL_FILE_NOT_FOUND 3
  416. #define AIL_CANT_WRITE_FILE 4
  417. #define AIL_CANT_READ_FILE 5
  418. #define AIL_DISK_FULL 6
  419. #endif
  420. #define MIN_VAL 0
  421. #define NOM_VAL 1
  422. #define MAX_VAL 2
  423. #ifndef YES
  424. #define YES 1
  425. #endif
  426. #ifndef NO
  427. #define NO 0
  428. #endif
  429. #ifndef TRUE
  430. #define TRUE 1
  431. #endif
  432. #ifndef FALSE
  433. #define FALSE 0
  434. #endif
  435. //
  436. // Preference names and default values
  437. //
  438. #define DIG_RESAMPLING_TOLERANCE 0
  439. #define DEFAULT_DRT 655 // Resampling triggered at +/- 1%
  440. #define DIG_MIXER_CHANNELS 1
  441. #define DEFAULT_DMC 64 // 64 allocatable SAMPLE structures
  442. #define DIG_DEFAULT_VOLUME 2
  443. #define DEFAULT_DDV 127 // Default sample volume = 127 (0-127)
  444. #define MDI_SERVICE_RATE 3
  445. #define DEFAULT_MSR 120 // XMIDI sequencer timing = 120 Hz
  446. #define MDI_SEQUENCES 4
  447. #define DEFAULT_MS 8 // 8 sequence handles/driver
  448. #define MDI_DEFAULT_VOLUME 5
  449. #define DEFAULT_MDV 127 // Default sequence volume = 127 (0-127)
  450. #define MDI_QUANT_ADVANCE 6
  451. #define DEFAULT_MQA 1 // Beat/bar count +1 interval
  452. #define MDI_ALLOW_LOOP_BRANCHING 7
  453. #define DEFAULT_ALB NO // Branches cancel XMIDI FOR loops
  454. #define MDI_DEFAULT_BEND_RANGE 8
  455. #define DEFAULT_MDBR 2 // Default pitch-bend range = 2
  456. #define MDI_DOUBLE_NOTE_OFF 9
  457. #define DEFAULT_MDNO NO // For stuck notes on SB daughterboards
  458. #define DIG_ENABLE_RESAMPLE_FILTER 31 // Enable resampling filter by
  459. #define DEFAULT_DERF YES // default
  460. #define DIG_DECODE_BUFFER_SIZE 32 // 2K decode buffer size by default
  461. #define DEFAULT_DDBS 2048
  462. #ifdef IS_WINDOWS
  463. #define DIG_USE_MSS_MIXER 33
  464. #define DEFAULT_DUMM YES // Use MSS mixer with DirectSound
  465. #define DIG_DS_FRAGMENT_SIZE 34
  466. #define DEFAULT_DDFS 8 // Use 8 millisecond buffer fragments with DirectSound if MSS mixer in use
  467. #define DIG_DS_FRAGMENT_CNT 35
  468. #define DEFAULT_DDFC 96 // Use 96 buffer fragments with DirectSound if MSS mixer in use
  469. #define DIG_DS_MIX_FRAGMENT_CNT 42
  470. #define DEFAULT_DDMFC 8 // Mix ahead 8 buffer fragments
  471. #define DIG_DS_USE_PRIMARY 36
  472. #define DEFAULT_DDUP NO // Mix into secondary DirectSound buffer by default
  473. #define DIG_DS_DSBCAPS_CTRL3D 37
  474. #define DEFAULT_DDDC NO // Do not use DSBCAPS_CTRL3D by default
  475. #define DIG_DS_CREATION_HANDLER 38
  476. #define DEFAULT_DDCH NULL // Use DirectSoundCreate() by default
  477. #define MDI_SYSEX_BUFFER_SIZE 10
  478. #define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes
  479. #define DIG_OUTPUT_BUFFER_SIZE 11
  480. #define DEFAULT_DOBS 49152 // 48K output buffer size
  481. #define AIL_MM_PERIOD 12
  482. #define DEFAULT_AMP 5 // Default MM timer period = 5 msec.
  483. #define AIL_TIMERS 13
  484. #define DEFAULT_AT 16 // 16 allocatable HTIMER handles
  485. #define DIG_MIN_CHAIN_ELEMENT_SIZE 14
  486. #define DEFAULT_MCES 2048 // 2048 bytes/waveOut buffer
  487. #define DIG_USE_WAVEOUT 15
  488. #define DEFAULT_DUW NO // Use DirectSound by default
  489. #define DIG_DS_SECONDARY_SIZE 16
  490. #define DEFAULT_DDSS (32*1024L) // Must be 2^n -- use 32K by default
  491. #define DIG_DS_SAMPLE_CEILING 17
  492. #define DEFAULT_DDSC 44100 // Allow up to 44 kHz samples
  493. #define AIL_LOCK_PROTECTION 18
  494. #define DEFAULT_ALP YES // Suspend foreground thread by default
  495. #define AIL_WIN32S_CALLBACK_SIZE 19
  496. #define DEFAULT_WCS 4096 // Size of callback data in bytes
  497. #else
  498. #define DIG_SERVICE_RATE 10
  499. #define DEFAULT_DSR 200 // DMA buffer-polling rate = 200 Hz
  500. #define DIG_HARDWARE_SAMPLE_RATE 11
  501. #define DEFAULT_DHSR NOM_VAL // Use nominal sample rate by default
  502. #define DIG_DMA_RESERVE 12
  503. #define DEFAULT_DDR 32768 // Reserve 32K real-mode mem for DMA
  504. #define DIG_LATENCY 13
  505. #define DEFAULT_DL 100 // Half-buffer size in ms = 100
  506. #define DIG_USE_STEREO 14
  507. #define DEFAULT_DUS NO // Use mono output only
  508. #define DIG_USE_16_BITS 15
  509. #define DEFAULT_DU16 NO // Use 8-bit output by default
  510. #define DIG_ALLOW_16_BIT_DMA 16
  511. #define DEFAULT_DA16DMA YES // OK to use 16-bit DMA if necessary
  512. #define DIG_SS_LOCK 17
  513. #define DEFAULT_DSL NO // Don't disable IRQs while mixing
  514. #define AIL_SCAN_FOR_HARDWARE 18
  515. #define DEFAULT_ASH YES // Scan for I/O settings if necessary
  516. #define AIL_ALLOW_VDM_EXECUTION 19
  517. #define DEFAULT_AVE YES // Allow Windows "DOS box" execution
  518. #endif
  519. // ----------------------------------
  520. // DLS Preference names and default values
  521. // Unless otherwise specified, values must be established
  522. // BEFORE calling DLSMSSOpen()!
  523. // ----------------------------------
  524. #define DLS_TIMEBASE 20
  525. #define DEFAULT_DTB 120 // 120 intervals/second by default
  526. #define DLS_VOICE_LIMIT 21
  527. #define DEFAULT_DVL 24 // 24 voices supported
  528. #define DLS_BANK_SELECT_ALIAS 22
  529. #define DEFAULT_DBSA NO // Do not treat controller 114 as bank
  530. #define DLS_STREAM_BOOTSTRAP 23 // Don't submit first stream buffer
  531. #define DEFAULT_DSB YES // until at least 2 available
  532. #define DLS_VOLUME_BOOST 24
  533. #define DEFAULT_DVB 0 // Boost final volume by 0 dB
  534. #define DLS_ENABLE_FILTERING 25 // Filtering = on by default
  535. #define DEFAULT_DEF YES // (may be changed at any time)
  536. #define AIL_ENABLE_MMX_SUPPORT 27 // Enable MMX support if present
  537. #define DEFAULT_AEMS YES // (may be changed at any time)
  538. #define DLS_GM_PASSTHROUGH 28 // Pass unrecognized traffic on to
  539. #define DEFAULT_DGP YES // default GM driver layer
  540. // (may be changed at any time)
  541. #define DLS_ADPCM_TO_ASI_THRESHOLD 39 // Size in samples to switch to ASI
  542. #define DEFAULT_DATAT 32768
  543. #ifdef OLD_DLS_REVERB_PREFERENCES
  544. // these preferences are obsolete - move to the new DLS reverb function.
  545. // these defines now control nothing and will disappear completely
  546. // in MSS 6.0
  547. #define DLS_ENABLE_GLOBAL_REVERB 26 // Global reverb disabled by default
  548. #define DEFAULT_DEGR NO
  549. #define DLS_GLOBAL_REVERB_LEVEL 29 // Reverb level 0-127
  550. #define DEFAULT_GRL 20 // (may be changed at any time)
  551. #define DLS_GLOBAL_REVERB_TIME 30 // Reverb time in stream buffers
  552. #define DEFAULT_GRT 1
  553. #endif
  554. //
  555. // Add'l platform-independent prefs
  556. //
  557. #define DIG_REVERB_BUFFER_SIZE 40
  558. #define DEFAULT_DRBS 0 // No reverb support by default
  559. #define DIG_INPUT_LATENCY 41 // Use >= 250-millisecond input buffers if
  560. #define DEFAULT_DIL 250 // explicit size request cannot be satisfied
  561. #define DIG_USE_WAVEIN 43
  562. #define DEFAULT_DUWI YES // Use waveIn for input by default
  563. #define N_PREFS 44 // # of preference types
  564. typedef struct _AILSOUNDINFO {
  565. S32 format;
  566. void FAR* data_ptr;
  567. U32 data_len;
  568. U32 rate;
  569. S32 bits;
  570. S32 channels;
  571. U32 samples;
  572. U32 block_size;
  573. void FAR* initial_ptr;
  574. } AILSOUNDINFO;
  575. // for multi-processor machines
  576. #ifdef IS_WIN32
  577. #ifdef BUILD_MSS
  578. #define MSSLockedIncrement(var) _asm { lock inc [var] }
  579. #define MSSLockedDecrement(var) _asm { lock dec [var] }
  580. static void __MSSLockedIncrementAddr(void * addr)
  581. {
  582. _asm {
  583. mov eax,[addr]
  584. lock inc dword ptr [eax]
  585. }
  586. }
  587. static void __MSSLockedDecrementAddr(void * addr)
  588. {
  589. _asm {
  590. mov eax,[addr]
  591. lock dec dword ptr [eax]
  592. }
  593. }
  594. #define MSSLockedIncrementPtr(var) __MSSLockedIncrementAddr(&(var))
  595. #define MSSLockedDecrementPtr(var) __MSSLockedDecrementAddr(&(var))
  596. #else
  597. #define MSSLockedIncrement(var) (++var)
  598. #define MSSLockedDecrement(var) (--var)
  599. #define MSSLockedIncrementPtr(var) (++var)
  600. #define MSSLockedDecrementPtr(var) (--var)
  601. #endif
  602. #else
  603. #define MSSLockedIncrement(var) (++var)
  604. #define MSSLockedDecrement(var) (--var)
  605. #define MSSLockedIncrementPtr(var) (++var)
  606. #define MSSLockedDecrementPtr(var) (--var)
  607. #endif
  608. #ifndef RIB_H // RIB.H contents included if RIB.H not already included
  609. // #include "rib.h"
  610. #define RIB_H
  611. #define ARY_CNT(x) (sizeof((x)) / sizeof((x)[0]))
  612. // ----------------------------------
  613. // RIB data types
  614. // ----------------------------------
  615. typedef S32 RIBRESULT;
  616. #define RIB_NOERR 0 // Success -- no error
  617. #define RIB_NOT_ALL_AVAILABLE 1 // Some requested functions/attribs not available
  618. #define RIB_NOT_FOUND 2 // Resource not found
  619. #define RIB_OUT_OF_MEM 3 // Out of system RAM
  620. //
  621. // Handle to interface provider
  622. //
  623. typedef U32 HPROVIDER;
  624. //
  625. // Handle representing token used to obtain attribute or preference
  626. // data from RIB provider
  627. //
  628. typedef U32 HATTRIB;
  629. //
  630. // Handle representing an enumerated interface entry
  631. //
  632. // RIB_enumerate_interface() returns 1 if valid next entry found, else
  633. // 0 if end of list reached
  634. //
  635. typedef U32 HINTENUM;
  636. #define HINTENUM_FIRST 0
  637. //
  638. // Handle representing an enumerated provider entry
  639. //
  640. // RIB_enumerate_providers() returns 1 if valid next entry found, else
  641. // 0 if end of list reached
  642. //
  643. typedef U32 HPROENUM;
  644. #define HPROENUM_FIRST 0
  645. //
  646. // Data types for RIB attributes and preferences
  647. //
  648. typedef enum
  649. {
  650. RIB_NONE = 0, // No type
  651. RIB_CUSTOM, // Used for pointers to application-specific structures
  652. RIB_DEC, // Used for 32-bit integer values to be reported in decimal
  653. RIB_HEX, // Used for 32-bit integer values to be reported in hex
  654. RIB_FLOAT, // Used for 32-bit single-precision FP values
  655. RIB_PERCENT, // Used for 32-bit single-precision FP values to be reported as percentages
  656. RIB_BOOL, // Used for Boolean-constrained integer values to be reported as TRUE or FALSE
  657. RIB_STRING // Used for pointers to null-terminated ASCII strings
  658. }
  659. RIB_DATA_SUBTYPE;
  660. //
  661. // RIB_ENTRY_TYPE structure, used to register an interface or request one
  662. //
  663. typedef enum
  664. {
  665. RIB_FUNCTION = 0,
  666. RIB_ATTRIBUTE, // Attribute: read-only data type used for status/info communication
  667. RIB_PREFERENCE // Preference: read/write data type used to control behavior
  668. }
  669. RIB_ENTRY_TYPE;
  670. //
  671. // RIB_INTERFACE_ENTRY, used to represent a function or data entry in an
  672. // interface
  673. //
  674. typedef struct
  675. {
  676. RIB_ENTRY_TYPE type; // See list above
  677. C8 FAR *entry_name; // Name of desired function or attribute
  678. U32 token; // Function pointer or attribute token
  679. RIB_DATA_SUBTYPE subtype; // Data (attrib or preference) subtype
  680. }
  681. RIB_INTERFACE_ENTRY;
  682. //
  683. // Standard RAD Interface Broker provider identification attributes
  684. //
  685. #define PROVIDER_NAME (-100) // RIB_STRING name of decoder
  686. #define PROVIDER_VERSION (-101) // RIB_HEX BCD version number
  687. //
  688. // Standard function to obtain provider attributes (see PROVIDER_ defines
  689. // above)
  690. //
  691. // Each provider of a searchable interface must export this function
  692. //
  693. typedef U32 (AILCALL FAR *PROVIDER_QUERY_ATTRIBUTE) (HATTRIB index);
  694. //
  695. // Macros to simplify interface registrations/requests for functions,
  696. // attributes, and preferences
  697. //
  698. #define FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE }
  699. #define REG_FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE }
  700. #define AT(entry_name,ID) { RIB_ATTRIBUTE, (entry_name), (U32) &(ID), RIB_NONE }
  701. #define REG_AT(entry_name,ID,subtype) { RIB_ATTRIBUTE, (entry_name), (U32) (ID), subtype }
  702. #define PR(entry_name,ID) { RIB_PREFERENCE, (entry_name), (U32) &(ID), RIB_NONE }
  703. #define REG_PR(entry_name,ID,subtype) { RIB_PREFERENCE, (entry_name), (U32) (ID), subtype }
  704. #define RIB_register(x,y,z) RIB_register_interface (HPROVIDER(x), y, ARY_CNT(z), z)
  705. #define RIB_unregister(x,y,z) RIB_unregister_interface(HPROVIDER(x), y, ARY_CNT(z), z)
  706. #define RIB_unregister_all(x) RIB_unregister_interface(HPROVIDER(x), NULL, 0, NULL)
  707. #define RIB_free_libraries() RIB_free_provider_library(HPROVIDER(NULL));
  708. #define RIB_request(x,y,z) RIB_request_interface (x, y, ARY_CNT(z), z)
  709. // ----------------------------------
  710. // Standard RIB API prototypes
  711. // ----------------------------------
  712. DXDEC HPROVIDER AILCALL RIB_alloc_provider_handle (U32 module);
  713. DXDEC void AILCALL RIB_free_provider_handle (HPROVIDER provider);
  714. DXDEC HPROVIDER AILCALL RIB_load_provider_library (C8 FAR *filename);
  715. DXDEC void AILCALL RIB_free_provider_library (HPROVIDER provider);
  716. DXDEC HPROVIDER AILCALL RIB_provider_library_handle (void);
  717. DXDEC RIBRESULT AILCALL RIB_register_interface (HPROVIDER provider,
  718. C8 FAR *interface_name,
  719. S32 entry_count,
  720. const RIB_INTERFACE_ENTRY FAR *rlist);
  721. DXDEC RIBRESULT AILCALL RIB_unregister_interface (HPROVIDER provider,
  722. C8 FAR *interface_name,
  723. S32 entry_count,
  724. const RIB_INTERFACE_ENTRY FAR *rlist);
  725. DXDEC RIBRESULT AILCALL RIB_request_interface (HPROVIDER provider,
  726. C8 FAR *interface_name,
  727. S32 entry_count,
  728. RIB_INTERFACE_ENTRY FAR *rlist);
  729. DXDEC RIBRESULT AILCALL RIB_request_interface_entry (HPROVIDER provider,
  730. C8 FAR *interface_name,
  731. RIB_ENTRY_TYPE entry_type,
  732. C8 FAR *entry_name,
  733. U32 FAR *token);
  734. DXDEC S32 AILCALL RIB_enumerate_interface (HPROVIDER provider,
  735. C8 FAR *interface_name,
  736. RIB_ENTRY_TYPE type,
  737. HINTENUM FAR *next,
  738. RIB_INTERFACE_ENTRY FAR *dest);
  739. DXDEC S32 AILCALL RIB_enumerate_providers (C8 FAR *interface_name,
  740. HPROENUM FAR *next,
  741. HPROVIDER FAR *dest);
  742. DXDEC C8 FAR * AILCALL RIB_type_string (U32 data,
  743. RIB_DATA_SUBTYPE subtype);
  744. DXDEC HPROVIDER AILCALL RIB_find_file_provider (C8 FAR *interface_name,
  745. C8 FAR *attribute_name,
  746. C8 FAR *file_suffix);
  747. DXDEC HPROVIDER AILCALL RIB_find_provider (C8 FAR *interface_name,
  748. C8 FAR *attribute_name,
  749. C8 FAR *attribute_value);
  750. DXDEC S32 AILCALL RIB_load_application_providers
  751. (C8 FAR *filespec);
  752. DXDEC void AILCALL RIB_set_provider_user_data (HPROVIDER provider,
  753. U32 index,
  754. S32 value);
  755. DXDEC S32 AILCALL RIB_provider_user_data (HPROVIDER provider,
  756. U32 index);
  757. DXDEC void AILCALL RIB_set_provider_system_data
  758. (HPROVIDER provider,
  759. U32 index,
  760. S32 value);
  761. DXDEC S32 AILCALL RIB_provider_system_data (HPROVIDER provider,
  762. U32 index);
  763. DXDEC C8 FAR * AILCALL RIB_error (void);
  764. #endif
  765. #ifndef MSS_ASI_VERSION // MSSASI.H contents included if MSSASI.H not already included
  766. // #include "mssasi.h"
  767. #define AIL_ASI_VERSION 1
  768. #define AIL_ASI_REVISION 0
  769. //
  770. // Handle to stream being managed by ASI codec
  771. //
  772. typedef S32 HASISTREAM;
  773. //
  774. // ASI result codes
  775. //
  776. typedef S32 ASIRESULT;
  777. #define ASI_NOERR 0 // Success -- no error
  778. #define ASI_NOT_ENABLED 1 // ASI not enabled
  779. #define ASI_ALREADY_STARTED 2 // ASI already started
  780. #define ASI_INVALID_PARAM 3 // Invalid parameters used
  781. #define ASI_INTERNAL_ERR 4 // Internal error in ASI driver
  782. #define ASI_OUT_OF_MEM 5 // Out of system RAM
  783. #define ASI_ERR_NOT_IMPLEMENTED 6 // Feature not implemented
  784. #define ASI_NOT_FOUND 7 // ASI supported device not found
  785. #define ASI_NOT_INIT 8 // ASI not initialized
  786. #define ASI_CLOSE_ERR 9 // ASI not closed correctly
  787. // ----------------------------------
  788. // Application-provided ASI callbacks
  789. // ----------------------------------
  790. //
  791. // AILASIFETCHCB: Called by ASI to obtain data from stream source
  792. //
  793. // offset normally will be either 0 at the first call made by the codec
  794. // or -1 to specify a continuous stream, except when ASI_stream_seek()
  795. // is called to restart the stream codec at a new stream offset. In this
  796. // case, the application must execute the seek operation on the ASI codec's
  797. // behalf.
  798. //
  799. // In response to this callback, the application should read the requested
  800. // data and copy it to the specified destination buffer, returning the number
  801. // of bytes copied (which can be less than bytes_requested if the end of
  802. // the stream is reached).
  803. //
  804. typedef S32 (AILCALLBACK FAR * AILASIFETCHCB) (U32 user, // User value passed to ASI_open_stream()
  805. void FAR *dest, // Location to which stream data should be copied by app
  806. S32 bytes_requested, // # of bytes requested by ASI codec
  807. S32 offset); // If not -1, application should seek to this point in stream
  808. //############################################################################
  809. //## ##
  810. //## Interface "ASI codec" ##
  811. //## ##
  812. //############################################################################
  813. //
  814. // Initialize ASI stream codec
  815. //
  816. // No other ASI functions may be called outside an ASI_startup() /
  817. // ASI_shutdown() pair, except for the standard RIB function
  818. // PROVIDER_query_attribute(). All provider attributes must be accessible
  819. // without starting up the codec.
  820. //
  821. typedef ASIRESULT (AILCALL FAR *ASI_STARTUP)(void);
  822. //
  823. // Shut down ASI codec
  824. //
  825. typedef ASIRESULT (AILCALL FAR *ASI_SHUTDOWN)(void);
  826. //
  827. // Return codec error message, or NULL if no errors have occurred since
  828. // last call
  829. //
  830. // The ASI error text state is global to all streams
  831. //
  832. typedef C8 FAR * (AILCALL FAR *ASI_ERROR)(void);
  833. //############################################################################
  834. //## ##
  835. //## Interface "ASI stream" ##
  836. //## ##
  837. //############################################################################
  838. //
  839. // Open a stream, returning handle to stream
  840. //
  841. typedef HASISTREAM (AILCALL FAR *ASI_STREAM_OPEN) (U32 user, // User value passed to fetch callback
  842. AILASIFETCHCB fetch_CB, // Source data fetch handler
  843. U32 total_size); // Total size for %-done calculations (0=unknown)
  844. //
  845. // Translate data in stream, returning # of bytes actually decoded or encoded
  846. //
  847. // Any number of bytes may be requested. Requesting more data than is
  848. // available in the codec's internal buffer will cause the AILASIFETCHCB
  849. // handler to be called to fetch more data from the stream.
  850. //
  851. typedef S32 (AILCALL FAR *ASI_STREAM_PROCESS) (HASISTREAM stream, // Handle of stream
  852. void FAR *buffer, // Destination for processed data
  853. S32 buffer_size); // # of bytes to return in buffer
  854. //
  855. // Restart stream decoding process at new offset
  856. //
  857. // Relevant for decoders only
  858. //
  859. // Seek destination is given as offset in bytes from beginning of stream
  860. //
  861. // At next ASI_stream_process() call, decoder will seek to the closest possible
  862. // point in the stream which occurs at or after the specified position
  863. //
  864. // This function has no effect for decoders which do not support random
  865. // seeks on a given stream type
  866. //
  867. // Warning: some decoders may need to implement seeking by reparsing
  868. // the entire stream up to the specified offset, through multiple calls
  869. // to the data-fetch callback. This operation may be extremely
  870. // time-consuming on large files or slow network connections.
  871. //
  872. // A stream_offset value of -1 may be used to inform the decoder that the
  873. // application has changed the input stream offset on its own, e.g. for a
  874. // double-buffering application where the ASI decoder is not accessing the
  875. // stream directly. ASI decoders should respond to this by flushing all
  876. // internal buffers and resynchronizing themselves to the data stream.
  877. //
  878. typedef ASIRESULT (AILCALL FAR *ASI_STREAM_SEEK) (HASISTREAM stream,
  879. S32 stream_offset);
  880. //
  881. // Retrieve an ASI stream attribute or preference value by index
  882. //
  883. typedef S32 (AILCALL FAR *ASI_STREAM_ATTRIBUTE) (HASISTREAM stream,
  884. HATTRIB attrib);
  885. //
  886. // Set an ASI stream preference value by index
  887. //
  888. typedef S32 (AILCALL FAR *ASI_STREAM_SET_PREFERENCE) (HASISTREAM stream,
  889. HATTRIB preference,
  890. void FAR* value);
  891. //
  892. // Close stream, freeing handle and all internally-allocated resources
  893. //
  894. typedef ASIRESULT (AILCALL FAR *ASI_STREAM_CLOSE) (HASISTREAM stream);
  895. #endif
  896. //############################################################################
  897. //## ##
  898. //## Interface "MSS 3D audio services" ##
  899. //## ##
  900. //############################################################################
  901. //
  902. // 3D positioning services
  903. //
  904. typedef struct h3DPOBJECT
  905. {
  906. U32 junk;
  907. } h3DPOBJECT;
  908. typedef h3DPOBJECT FAR * H3DPOBJECT;
  909. typedef H3DPOBJECT H3DSAMPLE;
  910. //
  911. // M3D result codes
  912. //
  913. typedef S32 M3DRESULT;
  914. #define M3D_NOERR 0 // Success -- no error
  915. #define M3D_NOT_ENABLED 1 // M3D not enabled
  916. #define M3D_ALREADY_STARTED 2 // M3D already started
  917. #define M3D_INVALID_PARAM 3 // Invalid parameters used
  918. #define M3D_INTERNAL_ERR 4 // Internal error in M3D driver
  919. #define M3D_OUT_OF_MEM 5 // Out of system RAM
  920. #define M3D_ERR_NOT_IMPLEMENTED 6 // Feature not implemented
  921. #define M3D_NOT_FOUND 7 // M3D supported device not found
  922. #define M3D_NOT_INIT 8 // M3D not initialized
  923. #define M3D_CLOSE_ERR 9 // M3D not closed correctly
  924. typedef M3DRESULT (AILCALL FAR *M3D_STARTUP)(void);
  925. typedef M3DRESULT (AILCALL FAR *M3D_SHUTDOWN)(void);
  926. typedef C8 FAR * (AILCALL FAR *M3D_ERROR)(void);
  927. typedef S32 (AILCALL FAR *M3D_SET_PROVIDER_PREFERENCE)(HATTRIB preference,
  928. void FAR* value);
  929. typedef M3DRESULT (AILCALL FAR * M3D_ACTIVATE)(S32 enable);
  930. typedef H3DSAMPLE (AILCALL FAR * M3D_ALLOCATE_3D_SAMPLE_HANDLE)(void);
  931. typedef void (AILCALL FAR * M3D_RELEASE_3D_SAMPLE_HANDLE)(H3DSAMPLE samp);
  932. typedef void (AILCALL FAR * M3D_START_3D_SAMPLE)(H3DSAMPLE samp);
  933. typedef void (AILCALL FAR * M3D_STOP_3D_SAMPLE)(H3DSAMPLE samp);
  934. typedef void (AILCALL FAR * M3D_RESUME_3D_SAMPLE)(H3DSAMPLE samp);
  935. typedef void (AILCALL FAR * M3D_END_3D_SAMPLE)(H3DSAMPLE samp);
  936. typedef S32 (AILCALL FAR * M3D_SET_3D_SAMPLE_DATA)(H3DSAMPLE samp,
  937. AILSOUNDINFO FAR *info);
  938. typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_VOLUME)(H3DSAMPLE samp,
  939. S32 volume);
  940. typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp,
  941. S32 playback_rate);
  942. typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OFFSET)(H3DSAMPLE samp,
  943. U32 offset);
  944. typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp,
  945. U32 loops);
  946. typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_BLOCK)(H3DSAMPLE S,
  947. S32 loop_start_offset,
  948. S32 loop_end_offset);
  949. typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_STATUS)(H3DSAMPLE samp);
  950. typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_ATTRIBUTE)(H3DSAMPLE samp, HATTRIB index);
  951. typedef S32 (AILCALL FAR * M3D_3D_SET_SAMPLE_PREFERENCE)(H3DSAMPLE samp, HATTRIB preference, void FAR* value);
  952. typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_VOLUME)(H3DSAMPLE samp);
  953. typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp);
  954. typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_OFFSET)(H3DSAMPLE samp);
  955. typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LENGTH)(H3DSAMPLE samp);
  956. typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp);
  957. typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp,
  958. F32 max_front_dist,
  959. F32 min_front_dist,
  960. F32 max_back_dist,
  961. F32 min_back_dist);
  962. typedef void (AILCALL FAR * M3D_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp,
  963. F32 FAR * max_front_dist,
  964. F32 FAR * min_front_dist,
  965. F32 FAR * max_back_dist,
  966. F32 FAR * min_back_dist);
  967. typedef S32 (AILCALL FAR * M3D_ACTIVE_3D_SAMPLE_COUNT)(void);
  968. typedef H3DPOBJECT (AILCALL FAR * M3D_3D_OPEN_LISTENER)(void);
  969. typedef void (AILCALL FAR * M3D_3D_CLOSE_LISTENER)(H3DPOBJECT listener);
  970. typedef H3DPOBJECT (AILCALL FAR * M3D_3D_OPEN_OBJECT)(void);
  971. typedef void (AILCALL FAR * M3D_3D_CLOSE_OBJECT)(H3DPOBJECT obj);
  972. typedef void (AILCALL FAR * M3D_SET_3D_POSITION)(H3DPOBJECT obj,
  973. F32 X,
  974. F32 Y,
  975. F32 Z);
  976. typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY)(H3DPOBJECT obj,
  977. F32 dX_per_ms,
  978. F32 dY_per_ms,
  979. F32 dZ_per_ms,
  980. F32 magnitude);
  981. typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY_VECTOR)(H3DPOBJECT obj,
  982. F32 dX_per_ms,
  983. F32 dY_per_ms,
  984. F32 dZ_per_ms);
  985. typedef void (AILCALL FAR * M3D_SET_3D_ORIENTATION)(H3DPOBJECT obj,
  986. F32 X_face,
  987. F32 Y_face,
  988. F32 Z_face,
  989. F32 X_up,
  990. F32 Y_up,
  991. F32 Z_up);
  992. typedef void (AILCALL FAR * M3D_3D_POSITION)(H3DPOBJECT obj,
  993. F32 FAR *X,
  994. F32 FAR *Y,
  995. F32 FAR *Z);
  996. typedef void (AILCALL FAR * M3D_3D_VELOCITY)(H3DPOBJECT obj,
  997. F32 FAR *dX_per_ms,
  998. F32 FAR *dY_per_ms,
  999. F32 FAR *dZ_per_ms);
  1000. typedef void (AILCALL FAR * M3D_3D_ORIENTATION)(H3DPOBJECT obj,
  1001. F32 FAR *X_face,
  1002. F32 FAR *Y_face,
  1003. F32 FAR *Z_face,
  1004. F32 FAR *X_up,
  1005. F32 FAR *Y_up,
  1006. F32 FAR *Z_up);
  1007. typedef void (AILCALL FAR * M3D_3D_UPDATE_POSITION)(H3DPOBJECT obj,
  1008. F32 dt_milliseconds);
  1009. typedef void (AILCALL FAR * M3D_3D_AUTO_UPDATE_POSITION)(H3DPOBJECT obj,
  1010. S32 enable);
  1011. //############################################################################
  1012. //## ##
  1013. //## Interface "MSS mixer services" ##
  1014. //## ##
  1015. //############################################################################
  1016. //
  1017. // Operation flags used by mixer module
  1018. //
  1019. #define M_DEST_STEREO 1 // Set to enable stereo mixer output
  1020. #define M_SRC_16 2 // Set to enable mixing of 16-bit samples
  1021. #define M_FILTER 4 // Set to enable filtering when resampling
  1022. #define M_SRC_STEREO 8 // Set to enable mixing of stereo input samples
  1023. #define M_VOL_SCALING 16 // Set to enable volume scalars other than 2047
  1024. #define M_RESAMPLE 32 // Set to enable playback ratios other than 65536
  1025. #define M_ORDER 64 // Set to reverse L/R stereo order for sample
  1026. #ifdef IS_32
  1027. //
  1028. // Initialize mixer
  1029. //
  1030. // No other mixer functions may be called outside a MIXER_startup() /
  1031. // MIXER_shutdown() pair, except for the standard RIB function
  1032. // PROVIDER_query_attribute(). All provider attributes must be accessible
  1033. // without starting up the module.
  1034. //
  1035. typedef void (AILCALL FAR *MIXER_STARTUP)(void);
  1036. //
  1037. // Shut down mixer
  1038. //
  1039. typedef void (AILCALL FAR *MIXER_SHUTDOWN)(void);
  1040. //
  1041. // Flush mixer buffer
  1042. //
  1043. typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest,
  1044. S32 len,
  1045. S32 FAR *reverb_buffer,
  1046. S32 reverb_level,
  1047. U32 MMX_available);
  1048. //
  1049. // Perform audio mixing operation
  1050. //
  1051. typedef void (AILCALL FAR *MIXER_MERGE) (void FAR * FAR *src,
  1052. U32 FAR *src_fract,
  1053. void FAR *src_end,
  1054. S32 FAR * FAR *dest,
  1055. void FAR *dest_end,
  1056. S32 FAR *left_val,
  1057. S32 FAR *right_val,
  1058. S32 playback_ratio,
  1059. S32 scale_left,
  1060. S32 scale_right,
  1061. U32 operation,
  1062. U32 MMX_available);
  1063. //
  1064. // Translate mixer buffer contents to final output format
  1065. //
  1066. typedef void (AILCALL FAR *MIXER_COPY) (void FAR *src,
  1067. S32 src_len,
  1068. void FAR *dest,
  1069. U32 operation,
  1070. U32 MMX_available);
  1071. #else
  1072. //
  1073. // Initialize mixer
  1074. //
  1075. // No other mixer functions may be called outside a MIXER_startup() /
  1076. // MIXER_shutdown() pair, except for the standard RIB function
  1077. // PROVIDER_query_attribute(). All provider attributes must be accessible
  1078. // without starting up the module.
  1079. //
  1080. typedef void (AILCALL FAR *MIXER_STARTUP)(void);
  1081. //
  1082. // Shut down mixer
  1083. //
  1084. typedef void (AILCALL FAR *MIXER_SHUTDOWN)(void);
  1085. //
  1086. // Flush mixer buffer
  1087. //
  1088. typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest,
  1089. S32 len,
  1090. S32 FAR *reverb_buffer,
  1091. S32 reverb_level,
  1092. U32 MMX_available);
  1093. //
  1094. // Perform audio mixing operation
  1095. //
  1096. typedef void (AILCALL FAR *MIXER_MERGE) (U32 src_sel,
  1097. U32 dest_sel,
  1098. U32 FAR *src_fract,
  1099. U32 FAR *src_offset,
  1100. U32 FAR *dest_offset,
  1101. U32 src_end_offset,
  1102. U32 dest_end_offset,
  1103. S32 FAR *left_val,
  1104. S32 FAR *right_val,
  1105. S32 playback_ratio,
  1106. S32 scale_both,
  1107. U32 operation);
  1108. //
  1109. // Translate mixer buffer contents to final output format
  1110. //
  1111. typedef void (AILCALL FAR *MIXER_COPY) (void FAR *src,
  1112. S32 src_len,
  1113. void FAR *dest,
  1114. U32 operation,
  1115. U32 MMX_available);
  1116. #endif
  1117. //
  1118. // Type definitions
  1119. //
  1120. struct _DIG_DRIVER;
  1121. struct _MDI_DRIVER;
  1122. typedef struct _DIG_DRIVER FAR * HDIGDRIVER; // Handle to digital driver
  1123. typedef struct _MDI_DRIVER FAR * HMDIDRIVER; // Handle to XMIDI driver
  1124. typedef struct _SAMPLE FAR * HSAMPLE; // Handle to sample
  1125. typedef struct _SEQUENCE FAR * HSEQUENCE; // Handle to sequence
  1126. typedef S32 HTIMER; // Handle to timer
  1127. #ifdef IS_DOS
  1128. //
  1129. // Type definitions
  1130. //
  1131. typedef struct // I/O parameters structure
  1132. {
  1133. S16 IO;
  1134. S16 IRQ;
  1135. S16 DMA_8_bit;
  1136. S16 DMA_16_bit;
  1137. S32 IO_reserved[4];
  1138. }
  1139. IO_PARMS;
  1140. typedef struct // Standard MSS 3.X VDI driver header
  1141. {
  1142. S8 ID[8]; // "AIL3xxx" ID string, followed by ^Z
  1143. U32 driver_version;
  1144. REALFAR common_IO_configurations;
  1145. U16 num_IO_configurations;
  1146. REALFAR environment_string;
  1147. IO_PARMS IO;
  1148. S16 service_rate;
  1149. U16 busy;
  1150. U16 driver_num; // Driver number
  1151. U16 this_ISR; // Offset of INT 66H dispatcher
  1152. REALFAR prev_ISR; // Pointer to previous INT 66H ISR
  1153. S8 scratch[128]; // Shared scratch workspace
  1154. S8 dev_name[80]; // Device name (VDI version >= 1.12 only)
  1155. }
  1156. VDI_HDR;
  1157. typedef struct
  1158. {
  1159. U16 minimum_physical_sample_rate;
  1160. U16 nominal_physical_sample_rate;
  1161. U16 maximum_physical_sample_rate;
  1162. U16 minimum_DMA_half_buffer_size;
  1163. U16 maximum_DMA_half_buffer_size;
  1164. U32 flags;
  1165. }
  1166. DIG_MODE;
  1167. typedef struct
  1168. {
  1169. U8 format_supported[16];
  1170. DIG_MODE format_data[16];
  1171. }
  1172. DIG_DDT;
  1173. typedef struct
  1174. {
  1175. REALFAR DMA_buffer_A;
  1176. REALFAR DMA_buffer_B;
  1177. S16 active_buffer;
  1178. }
  1179. DIG_DST;
  1180. typedef struct
  1181. {
  1182. REALFAR library_environment;
  1183. REALFAR GTL_suffix;
  1184. U16 num_voices;
  1185. U16 max_melodic_channel;
  1186. U16 min_melodic_channel;
  1187. U16 percussion_channel;
  1188. }
  1189. MDI_DDT;
  1190. typedef struct
  1191. {
  1192. S8 library_directory[128];
  1193. S8 GTL_filename[128];
  1194. S8 MIDI_data[512];
  1195. }
  1196. MDI_DST;
  1197. typedef struct // Initialization file structure
  1198. {
  1199. char device_name[128]; // Device name
  1200. char driver_name[128]; // Driver filename
  1201. IO_PARMS IO; // I/O parameters for driver
  1202. }
  1203. AIL_INI;
  1204. typedef struct // Handle to driver
  1205. {
  1206. REALFAR seg; // Seg:off pointer to driver (off=0)
  1207. U32 sel; // Selector for driver (off=0)
  1208. void *buf; // Protected-mode pointer to driver
  1209. U32 size; // Size of driver image
  1210. VDI_HDR *VHDR; // Pointer to driver header (same as buf)
  1211. S32 type; // AIL3DIG or AIL3MDI (see below)
  1212. S32 initialized; // 1 if hardware successfully init'd, else 0
  1213. S32 PM_ISR; // -1 if no PM ISR hooked, else IRQ #
  1214. HTIMER server; // DRV_SERVE periodic timer, if requested
  1215. // Vector to high-level destructor, if any
  1216. void (AILCALL *destructor)(HDIGDRIVER);
  1217. // High-level descriptor (DIG_ or MDI_DRIVER)
  1218. void *descriptor;
  1219. }
  1220. AIL_DRIVER;
  1221. typedef struct // VDI interface register structure
  1222. {
  1223. S16 AX;
  1224. S16 BX;
  1225. S16 CX;
  1226. S16 DX;
  1227. S16 SI;
  1228. S16 DI;
  1229. }
  1230. VDI_CALL;
  1231. #endif
  1232. //
  1233. // Function pointer types
  1234. //
  1235. typedef void (AILCALLBACK FAR* AILINCB) (void FAR *data, S32 len, U32 user);
  1236. typedef void (AILCALLBACK FAR* AILTIMERCB) (U32 user);
  1237. typedef void (AILCALLBACK FAR* AILSAMPLECB) (HSAMPLE sample);
  1238. typedef S32 (AILCALLBACK FAR* AILEVENTCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 status,S32 data_1,S32 data_2);
  1239. typedef S32 (AILCALLBACK FAR* AILTIMBRECB) (HMDIDRIVER hmi,S32 bank,S32 patch);
  1240. typedef S32 (AILCALLBACK FAR* AILPREFIXCB) (HSEQUENCE seq,S32 log,S32 data);
  1241. typedef void (AILCALLBACK FAR* AILTRIGGERCB) (HSEQUENCE seq,S32 log,S32 data);
  1242. typedef void (AILCALLBACK FAR* AILBEATCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 beat,S32 measure);
  1243. typedef void (AILCALLBACK FAR* AILSEQUENCECB) (HSEQUENCE seq);
  1244. //
  1245. // Handle to sample and driver being managed by pipeline filter
  1246. //
  1247. typedef S32 HSAMPLESTATE;
  1248. typedef S32 HDRIVERSTATE;
  1249. //
  1250. // Digital pipeline stages
  1251. //
  1252. // These are the points at which external modules may be installed into
  1253. // a given HSAMPLE or HDIGDRIVER's processing pipeline
  1254. //
  1255. typedef enum
  1256. {
  1257. DP_ASI_DECODER=0, // Must be "ASI codec stream" provider
  1258. DP_FILTER, // Must be "MSS pipeline filter" provider
  1259. DP_MERGE, // Must be "MSS mixer" provider
  1260. N_SAMPLE_STAGES, // Placeholder for end of list (= # of valid stages)
  1261. SAMPLE_ALL_STAGES // Used to signify all pipeline stages, for shutdown
  1262. }
  1263. SAMPLESTAGE;
  1264. typedef enum
  1265. {
  1266. DP_FLUSH = 0, // Must be "MSS mixer" provider
  1267. DP_DEFAULT_FILTER, // Must be "MSS pipeline filter" provider (sets the default)
  1268. DP_DEFAULT_MERGE, // Must be "MSS mixer" provider (sets the default)
  1269. DP_COPY, // Must be "MSS mixer" provider
  1270. N_DIGDRV_STAGES, // Placeholder for end of list (= # of valid stages)
  1271. DIGDRV_ALL_STAGES // Used to signify all pipeline stages, for shutdown
  1272. }
  1273. DIGDRVSTAGE;
  1274. typedef struct
  1275. {
  1276. ASI_STREAM_OPEN ASI_stream_open;
  1277. ASI_STREAM_PROCESS ASI_stream_process;
  1278. ASI_STREAM_SEEK ASI_stream_seek;
  1279. ASI_STREAM_CLOSE ASI_stream_close;
  1280. ASI_STREAM_ATTRIBUTE ASI_stream_attribute;
  1281. ASI_STREAM_SET_PREFERENCE ASI_stream_set_preference;
  1282. HATTRIB INPUT_BIT_RATE;
  1283. HATTRIB INPUT_SAMPLE_RATE;
  1284. HATTRIB INPUT_BITS;
  1285. HATTRIB INPUT_CHANNELS;
  1286. HATTRIB OUTPUT_BIT_RATE;
  1287. HATTRIB OUTPUT_SAMPLE_RATE;
  1288. HATTRIB OUTPUT_BITS;
  1289. HATTRIB OUTPUT_CHANNELS;
  1290. HATTRIB POSITION;
  1291. HATTRIB PERCENT_DONE;
  1292. HATTRIB MIN_INPUT_BLOCK_SIZE;
  1293. HATTRIB RAW_RATE;
  1294. HATTRIB RAW_BITS;
  1295. HATTRIB RAW_CHANNELS;
  1296. HATTRIB REQUESTED_RATE;
  1297. HATTRIB REQUESTED_BITS;
  1298. HATTRIB REQUESTED_CHANS;
  1299. HASISTREAM stream;
  1300. }
  1301. ASISTAGE;
  1302. typedef struct
  1303. {
  1304. MIXER_FLUSH MSS_mixer_flush;
  1305. MIXER_MERGE MSS_mixer_merge;
  1306. MIXER_COPY MSS_mixer_copy;
  1307. }
  1308. MIXSTAGE;
  1309. typedef struct
  1310. {
  1311. struct _FLTPROVIDER FAR *provider;
  1312. HSAMPLESTATE sample_state;
  1313. }
  1314. FLTSTAGE;
  1315. typedef struct
  1316. {
  1317. S32 active; // Pass-through if 0, active if 1
  1318. HPROVIDER provider;
  1319. union
  1320. {
  1321. ASISTAGE ASI;
  1322. MIXSTAGE MIX;
  1323. FLTSTAGE FLT;
  1324. }
  1325. TYPE;
  1326. }
  1327. DPINFO;
  1328. //
  1329. // Other data types
  1330. //
  1331. typedef enum _AILDUPMODE
  1332. {
  1333. AIL_HALF_DUPLEX,
  1334. AIL_FULL_DUPLEX
  1335. }
  1336. AILDUPMODE;
  1337. #define AIL_FORCE_DUPLEX 1 // Force specified duplex mode to be used, else fail
  1338. #define AIL_FORCE_MODE 2 // Force specified format/rate to be used, else fail
  1339. #define AIL_FORCE_BUFSIZE 4 // Force specified input buffer size to be used, else fail
  1340. typedef struct _AILINPUTINFO // Input descriptor type
  1341. {
  1342. U32 device_ID; // DS LPGUID or wave device ID
  1343. U32 hardware_format; // e.g., DIG_F_STEREO_16
  1344. U32 hardware_rate; // e.g., 22050
  1345. AILDUPMODE duplex_mode; // AIL_HALF_DUPLEX | AIL_FULL_DUPLEX
  1346. AILINCB callback; // Callback function to receive incoming data
  1347. S32 buffer_size; // Maximum # of bytes to be passed to callback (-1 to use DIG_INPUT_LATENCY)
  1348. }
  1349. AILINPUTINFO;
  1350. typedef struct _AILTIMER // Timer instance
  1351. {
  1352. U32 status;
  1353. AILTIMERCB callback;
  1354. U32 user;
  1355. S32 elapsed;
  1356. S32 value;
  1357. S32 callingCT; // Calling EXE's task number (16 bit only)
  1358. S32 callingDS; // Calling EXE's DS (used in 16 bit only)
  1359. S32 IsWin32s; // Is this a Win32s callback
  1360. } AILTIMERSTR;
  1361. typedef struct _ADPCMDATATAG
  1362. {
  1363. U32 blocksize;
  1364. U32 extrasamples;
  1365. U32 blockleft;
  1366. U32 step;
  1367. U32 savesrc;
  1368. U32 sample;
  1369. U32 destend;
  1370. U32 srcend;
  1371. U32 samplesL;
  1372. U32 samplesR;
  1373. U16 moresamples[16];
  1374. } ADPCMDATA;
  1375. typedef struct _SAMPLE // Sample instance
  1376. {
  1377. char tag[4]; // HSAM
  1378. HDIGDRIVER driver; // Driver for playback
  1379. U32 status; // SMP_ flags: _FREE, _DONE, _PLAYING
  1380. void FAR *start[2]; // Sample buffer address (W)
  1381. U32 len [2]; // Sample buffer size in bytes (W)
  1382. U32 pos [2]; // Index to next byte (R/W)
  1383. U32 done [2]; // Nonzero if buffer with len=0 sent by app
  1384. U32 src_fract; // Fractional part of source address
  1385. S32 left_val; // Mixer source value from end of last buffer
  1386. S32 right_val; // Mixer source value from end of last buffer
  1387. S32 current_buffer; // Buffer # active (0/1)
  1388. S32 last_buffer; // Last active buffer (for double-buffering)
  1389. S32 starved; // Buffer stream has run out of data
  1390. S32 loop_count; // # of cycles-1 (1=one-shot, 0=indefinite)
  1391. S32 loop_start; // Starting offset of loop block (0=SOF)
  1392. S32 loop_end; // End offset of loop block (-1=EOF)
  1393. S32 format; // DIG_F format (8/16 bits, mono/stereo)
  1394. U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo only)
  1395. S32 playback_rate; // Playback rate in hertz
  1396. S32 volume; // Sample volume 0-127
  1397. S32 pan; // Mono panpot/stereo balance (0=L ... 127=R)
  1398. S32 left_scale; // Left/mono volume scalar 0-2047
  1399. S32 right_scale; // Right volume scalar 0-2047
  1400. S32 service_type; // 1 if single-buffered; 2 if streamed
  1401. AILSAMPLECB SOB; // Start-of-block callback function
  1402. AILSAMPLECB EOB; // End-of-buffer callback function
  1403. AILSAMPLECB EOS; // End-of-sample callback function
  1404. S32 user_data [8]; // Miscellaneous user data
  1405. S32 system_data[8]; // Miscellaneous system data
  1406. ADPCMDATA adpcm;
  1407. #ifdef IS_WINDOWS
  1408. S32 SOB_IsWin32s; // Is this a Win32s callback
  1409. S32 EOB_IsWin32s; // Is this a Win32s callback
  1410. S32 EOS_IsWin32s; // Is this a Win32s callback
  1411. //
  1412. // DirectSound-specific data
  1413. //
  1414. S32 secondary_buffer; // Secondary buffer index
  1415. S32 service_interval; // Service sample every n ms
  1416. S32 service_tick; // Current service countdown value
  1417. S32 buffer_segment_size; // Buffer segment size to fill
  1418. S32 prev_segment; // Previous segment # (0...n)
  1419. S32 prev_cursor; // Previous play cursor location
  1420. S32 bytes_remaining; // # of bytes left to play (if not -1)
  1421. S32 direct_control; // 1 if app controls buffer, 0 if MSS
  1422. #endif
  1423. S32 doeob; // Flags to trigger callbacks
  1424. S32 dosob;
  1425. S32 doeos;
  1426. //
  1427. // Sample pipeline stages
  1428. //
  1429. DPINFO pipeline[N_SAMPLE_STAGES];
  1430. //
  1431. // Reverb parms
  1432. //
  1433. F32 reverb_level; // Level [0.0, 1.0]
  1434. F32 reverb_reflect_time; // Reflect time in milliseconds
  1435. F32 reverb_decay_time; // Decay time [0.1, 20.0]
  1436. S32 base_scale; // Original 12-bit volume scalar
  1437. }
  1438. SAMPLE;
  1439. #ifdef IS_WINDOWS
  1440. typedef struct _DIG_INPUT_DRIVER FAR *HDIGINPUT; // Handle to digital input driver
  1441. typedef struct _DIG_INPUT_DRIVER // Handle to digital input driver
  1442. {
  1443. C8 tag[4]; // HDIN
  1444. HTIMER background_timer; // Background timer handle
  1445. AILINPUTINFO info; // Input device descriptor
  1446. U32 callback_user; // Callback user value
  1447. //
  1448. // Provider-independent data
  1449. //
  1450. U32 DMA_size; // Size of each DMA sub-buffer in bytes
  1451. void FAR *DMA[2]; // Simulated DMA buffers
  1452. U8 silence; // Silence value for current format (0 or 128)
  1453. S32 input_enabled; // 1 if enabled, 0 if not
  1454. S32 device_active; // 1 if buffers submittable, 0 if not
  1455. //
  1456. // waveOut-specific data
  1457. //
  1458. HWAVEIN hWaveIn; // Handle to wave input device
  1459. volatile WAVEHDR wavehdr[2]; // Handles to wave headers
  1460. }
  1461. DIG_INPUT_DRIVER;
  1462. #endif
  1463. typedef struct _DIG_DRIVER // Handle to digital audio driver
  1464. {
  1465. char tag[4]; // HDIG
  1466. HTIMER backgroundtimer; // Background timer handle
  1467. S32 quiet; // # of consecutive quiet sample periods
  1468. S32 n_active_samples; // # of samples being processed
  1469. S32 master_volume; // Master sample volume 0-127
  1470. S32 DMA_rate; // Hardware sample rate
  1471. S32 hw_format; // DIG_F code in use
  1472. U32 hw_mode_flags; // DIG_PCM_ flags for mode in use
  1473. S32 channels_per_sample; // # of channels per sample (1 or 2)
  1474. S32 bytes_per_channel; // # of bytes per channel (1 or 2)
  1475. S32 channels_per_buffer; // # of channels per half-buffer
  1476. S32 samples_per_buffer; // # of samples per half-buffer
  1477. S32 playing; // Playback active if non-zero
  1478. HSAMPLE samples; // Pointer to list of SAMPLEs
  1479. S32 n_samples; // # of SAMPLEs
  1480. S32 build_size; // # of bytes in build buffer
  1481. S32 FAR *build_buffer; // Build buffer (4 * samples_per_buffer)
  1482. S32 system_data[8]; // Miscellaneous system data
  1483. S32 buffer_size; // Size of each output buffer
  1484. #ifdef IS_WINDOWS
  1485. //
  1486. // waveOut-specific interface data
  1487. //
  1488. HWAVEOUT hWaveOut; // Wave output driver
  1489. U32 reset_works; // TRUE if OK to do waveOutReset
  1490. U32 request_reset; // If nonzero, do waveOutReset ASAP
  1491. LPWAVEHDR first; // Pointer to first WAVEHDR in chain
  1492. S32 n_buffers; // # of output WAVEHDRs in chain
  1493. LPWAVEHDR volatile FAR *return_list; // Circular list of returned WAVEHDRs
  1494. S32 volatile return_head; // Head of WAVEHDR list (insertion point)
  1495. S32 volatile return_tail; // Tail of WAVEHDR list (retrieval point)
  1496. U32 deviceid; // id from waveout open
  1497. PCMWAVEFORMAT wformat; // format from waveout open
  1498. //
  1499. // DirectSound-specific interface data
  1500. //
  1501. U32 guid; // The guid id of the ds driver
  1502. AILLPDIRECTSOUND pDS; // DirectSound output driver (don't
  1503. // use with Smacker directly anymore!)
  1504. S32 emulated_ds; // is ds emulated or not?
  1505. AILLPDIRECTSOUNDBUFFER lppdsb; // primary buffer or null
  1506. U32 dsHwnd; // HWND used with DirectSound
  1507. AILLPDIRECTSOUNDBUFFER FAR * lpbufflist; // List of pointers to secondary buffers
  1508. HSAMPLE FAR *samp_list; // HSAMPLE associated with each buffer
  1509. S32 FAR *sec_format; // DIG_F_ format for secondary buffer
  1510. S32 max_buffs; // Max. allowable # of secondary buffers
  1511. //
  1512. // Misc. data
  1513. //
  1514. S32 released; // has the sound manager been released?
  1515. U32 foreground_timer; // Foreground timer handle
  1516. HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
  1517. S32 callingCT; // Calling EXE's task number (16 bit only)
  1518. S32 callingDS; // Calling EXE's DS (used in 16 bit only)
  1519. //
  1520. // Vars for waveOut emulation
  1521. //
  1522. S32 DS_initialized;
  1523. AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none)
  1524. AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim)
  1525. S32 DS_buffer_size; // Size of entire output buffer
  1526. S32 DS_frag_cnt; // Total fragment count and size, and
  1527. S32 DS_frag_size; // last fragment occupied by play cursor
  1528. S32 DS_last_frag;
  1529. S32 DS_last_write;
  1530. S32 DS_last_timer;
  1531. S32 DS_skip_time;
  1532. S32 DS_use_default_format; // 1 to force use of default DS primary buffer format
  1533. #else
  1534. // must be first in the DOS section
  1535. void *DMA[2]; // Protected-mode pointers to half-buffers
  1536. // (note that DMA[0] may != DMA_buf)
  1537. REALFAR DMA_seg; // Seg:off pointer to DMA buffers (off=0)
  1538. U32 DMA_sel; // Selector for DMA buffers (off=0)
  1539. void *DMA_buf; // Protected-mode pointer to DMA buffers
  1540. S16 *buffer_flag; // Protected-mode pointer to buffer flag
  1541. S32 last_buffer; // Last active buffer flag value in driver
  1542. AIL_DRIVER *drvr; // Base driver descriptor
  1543. DIG_DDT *DDT; // Protected-mode pointer to DDT
  1544. DIG_DST *DST; // Protected-mode pointer to DST
  1545. #endif
  1546. S32 use_MMX; // Use MMX with this driver if TRUE
  1547. void FAR *decode_buffer; // Buffer used by optional ASI pipeline decoder
  1548. S32 decode_buffer_size; // # of bytes in decode buffer
  1549. U32 us_count;
  1550. U32 ms_count;
  1551. U32 last_ms_polled;
  1552. U32 last_percent;
  1553. //
  1554. // Digital driver pipeline stages
  1555. //
  1556. DPINFO pipeline[N_DIGDRV_STAGES];
  1557. //
  1558. // Reverb buffer
  1559. //
  1560. S32 FAR *reverb_buffer;
  1561. S32 reverb_buffer_size;
  1562. S32 reverb_buffer_position;
  1563. }
  1564. DIG_DRIVER;
  1565. typedef struct // MIDI status log structure
  1566. {
  1567. S32 program [NUM_CHANS]; // Program Change
  1568. S32 pitch_l [NUM_CHANS]; // Pitch Bend LSB
  1569. S32 pitch_h [NUM_CHANS]; // Pitch Bend MSB
  1570. S32 c_lock [NUM_CHANS]; // Channel Lock
  1571. S32 c_prot [NUM_CHANS]; // Channel Lock Protection
  1572. S32 c_mute [NUM_CHANS]; // Channel Mute
  1573. S32 c_v_prot [NUM_CHANS]; // Voice Protection
  1574. S32 bank [NUM_CHANS]; // Patch Bank Select
  1575. S32 gm_bank_l [NUM_CHANS]; // GM Bank Select
  1576. S32 gm_bank_m [NUM_CHANS]; // GM Bank Select
  1577. S32 indirect [NUM_CHANS]; // ICA indirect controller value
  1578. S32 callback [NUM_CHANS]; // Callback Trigger
  1579. S32 mod [NUM_CHANS]; // Modulation
  1580. S32 vol [NUM_CHANS]; // Volume
  1581. S32 pan [NUM_CHANS]; // Panpot
  1582. S32 exp [NUM_CHANS]; // Expression
  1583. S32 sus [NUM_CHANS]; // Sustain
  1584. S32 reverb [NUM_CHANS]; // Reverb
  1585. S32 chorus [NUM_CHANS]; // Chorus
  1586. S32 bend_range[NUM_CHANS]; // Bender Range (data MSB, RPN 0 assumed)
  1587. S32 RPN_L [NUM_CHANS]; // RPN # LSB
  1588. S32 RPN_M [NUM_CHANS]; // RPN # MSB
  1589. }
  1590. CTRL_LOG;
  1591. typedef struct _SEQUENCE // XMIDI sequence state table
  1592. {
  1593. char tag[4]; // HSEQ
  1594. HMDIDRIVER driver; // Driver for playback
  1595. U32 status; // SEQ_ flags
  1596. void FAR *TIMB; // XMIDI IFF chunk pointers
  1597. void FAR *RBRN;
  1598. void FAR *EVNT;
  1599. U8 FAR *EVNT_ptr; // Current event pointer
  1600. U8 FAR *ICA; // Indirect Controller Array
  1601. AILPREFIXCB prefix_callback; // XMIDI Callback Prefix handler
  1602. AILTRIGGERCB trigger_callback; // XMIDI Callback Trigger handler
  1603. AILBEATCB beat_callback; // XMIDI beat/bar change handler
  1604. AILSEQUENCECB EOS; // End-of-sequence callback function
  1605. S32 loop_count; // 0=one-shot, -1=indefinite, ...
  1606. S32 interval_count; // # of intervals until next event
  1607. S32 interval_num; // # of intervals since start
  1608. S32 volume; // Sequence volume 0-127
  1609. S32 volume_target; // Target sequence volume 0-127
  1610. S32 volume_accum; // Accumulated volume period
  1611. S32 volume_period; // Period for volume stepping
  1612. S32 tempo_percent; // Relative tempo percentage 0-100
  1613. S32 tempo_target; // Target tempo 0-100
  1614. S32 tempo_accum; // Accumulated tempo period
  1615. S32 tempo_period; // Period for tempo stepping
  1616. S32 tempo_error; // Error counter for tempo DDA
  1617. S32 beat_count; // Sequence playback position
  1618. S32 measure_count;
  1619. S32 time_numerator; // Sequence timing data
  1620. S32 time_fraction;
  1621. S32 beat_fraction;
  1622. S32 time_per_beat;
  1623. void FAR *FOR_ptrs [FOR_NEST]; // Loop stack
  1624. S32 FOR_loop_count [FOR_NEST];
  1625. S32 chan_map [NUM_CHANS]; // Physical channel map for sequence
  1626. CTRL_LOG shadow; // Controller values for sequence
  1627. S32 note_count; // # of notes "on"
  1628. S32 note_chan [MAX_NOTES]; // Channel for queued note (-1=free)
  1629. S32 note_num [MAX_NOTES]; // Note # for queued note
  1630. S32 note_time [MAX_NOTES]; // Remaining duration in intervals
  1631. S32 user_data [8]; // Miscellaneous user data
  1632. S32 system_data[8]; // Miscellaneous system data
  1633. #ifdef IS_WINDOWS
  1634. S32 PREFIX_IsWin32s; // Is this a Win32s callback
  1635. S32 TRIGGER_IsWin32s; // Is this a Win32s callback
  1636. S32 BEAT_IsWin32s; // Is this a Win32s callback
  1637. S32 EOS_IsWin32s; // Is this a Win32s callback
  1638. #endif
  1639. } SEQUENCE;
  1640. typedef struct _MDI_DRIVER // Handle to XMIDI driver
  1641. {
  1642. char tag[4]; // HMDI
  1643. HTIMER timer; // XMIDI quantization timer
  1644. S32 interval_time; // XMIDI quantization timer interval in uS
  1645. S32 disable; // > 0 to disable XMIDI service
  1646. HSEQUENCE sequences; // Pointer to list of SEQUENCEs
  1647. S32 n_sequences; // # of SEQUENCEs
  1648. S32 lock [NUM_CHANS]; // 1 if locked, 2 if protected, else 0
  1649. HSEQUENCE locker[NUM_CHANS]; // HSEQUENCE which locked channel
  1650. HSEQUENCE owner [NUM_CHANS]; // HSEQUENCE which owned locked channel
  1651. HSEQUENCE user [NUM_CHANS]; // Last sequence to use channel
  1652. S32 state [NUM_CHANS]; // Lock state prior to being locked
  1653. S32 notes [NUM_CHANS]; // # of active notes in channel
  1654. AILEVENTCB event_trap; // MIDI event trap callback function
  1655. AILTIMBRECB timbre_trap; // Timbre request callback function
  1656. S32 master_volume; // Master XMIDI note volume 0-127
  1657. S32 system_data[8]; // Miscellaneous system data
  1658. #ifdef IS_WINDOWS
  1659. S32 EVENT_IsWin32s; // Is this a Win32s callback
  1660. S32 TIMBRE_IsWin32s; // Is this a Win32s callback
  1661. MIDIHDR FAR *mhdr; // SysEx header
  1662. U8 FAR *sysdata; // SysEx buffer
  1663. HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
  1664. S32 callingCT; // Calling EXE's task number (16 bit only)
  1665. S32 callingDS; // Calling EXE's DS (used in 16 bit only)
  1666. HMIDIOUT hMidiOut; // MIDI output driver
  1667. U32 deviceid; // ID of the MIDI device
  1668. S32 released; // has the hmidiout handle been released
  1669. #else
  1670. S32 message_count; // MIDI message count
  1671. S32 offset; // MIDI buffer offset
  1672. AIL_DRIVER *drvr; // Base driver descriptor
  1673. MDI_DDT *DDT; // Protected-mode pointer to DDT
  1674. MDI_DST *DST; // Protected-mode pointer to DST
  1675. #endif
  1676. }
  1677. MDI_DRIVER;
  1678. typedef struct // XMIDI TIMB IFF chunk
  1679. {
  1680. S8 name[4];
  1681. U8 msb;
  1682. U8 lsb;
  1683. U8 lsb2;
  1684. U8 lsb3;
  1685. U16 n_entries;
  1686. U16 timbre[1];
  1687. }
  1688. TIMB_chunk;
  1689. typedef struct // XMIDI RBRN IFF entry
  1690. {
  1691. S16 bnum;
  1692. U32 offset;
  1693. }
  1694. RBRN_entry;
  1695. typedef struct // Wave library entry
  1696. {
  1697. S32 bank; // XMIDI bank, MIDI patch for sample
  1698. S32 patch;
  1699. S32 root_key; // Root MIDI note # for sample (or -1)
  1700. U32 file_offset; // Offset of wave data from start-of-file
  1701. U32 size; // Size of wave sample in bytes
  1702. S32 format; // DIG_F format (8/16 bits, mono/stereo)
  1703. U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo)
  1704. S32 playback_rate; // Playback rate in hertz
  1705. }
  1706. WAVE_ENTRY;
  1707. typedef struct // Virtual "wave synthesizer" descriptor
  1708. {
  1709. HMDIDRIVER mdi; // MIDI driver for use with synthesizer
  1710. HDIGDRIVER dig; // Digital driver for use with synthesizer
  1711. WAVE_ENTRY FAR *library; // Pointer to wave library
  1712. AILEVENTCB prev_event_fn; // Previous MIDI event trap function
  1713. AILTIMBRECB prev_timb_fn; // Previous timbre request trap function
  1714. CTRL_LOG controls; // MIDI controller states
  1715. WAVE_ENTRY FAR *wave [NUM_CHANS];// Pointer to WAVE_ENTRY for each channel
  1716. HSAMPLE S [MAX_W_VOICES]; // List of HSAMPLE voices
  1717. S32 n_voices; // Actual # of voices allocated to synth
  1718. S32 chan [MAX_W_VOICES]; // MIDI channel for each voice, or -1
  1719. S32 note [MAX_W_VOICES]; // MIDI note number for voice
  1720. S32 root [MAX_W_VOICES]; // MIDI root note for voice
  1721. S32 rate [MAX_W_VOICES]; // Playback rate for voice
  1722. S32 vel [MAX_W_VOICES]; // MIDI note velocity for voice
  1723. U32 time [MAX_W_VOICES]; // Timestamp for voice
  1724. U32 event; // Event counter for LRU timestamps
  1725. }
  1726. WAVE_SYNTH;
  1727. typedef WAVE_SYNTH FAR * HWAVESYNTH;// Handle to virtual wave synthesizer
  1728. //
  1729. // Handle to thread which called AIL_startup()
  1730. //
  1731. // This thread is suspended by MSS callback threads, to simulate DOS-style
  1732. // interrupt handler behavior
  1733. //
  1734. #ifdef IS_WIN32
  1735. extern HANDLE hAppThread;
  1736. #endif
  1737. //
  1738. // Background flag for timers
  1739. //
  1740. extern volatile S32 AIL_bkgnd_flag;
  1741. //
  1742. // Global preference array
  1743. //
  1744. extern S32 AIL_preference [N_PREFS];
  1745. //
  1746. // DIG_DRIVER list
  1747. //
  1748. extern HDIGDRIVER DIG_first;
  1749. //
  1750. // MDI_DRIVER list
  1751. //
  1752. extern HMDIDRIVER MDI_first;
  1753. //
  1754. // Miscellaneous system services
  1755. //
  1756. #define FILE_READ_WITH_SIZE ((void FAR*)(S32)-1)
  1757. #ifndef NO_OLD_SYS_FUNCTIONS
  1758. #define MEM_alloc_lock AIL_mem_alloc_lock
  1759. #define MEM_free_lock AIL_mem_free_lock
  1760. #define FILE_error AIL_file_error
  1761. #define FILE_size AIL_file_size
  1762. #define FILE_read AIL_file_read
  1763. #define FILE_write AIL_file_write
  1764. #ifdef IS_DOS
  1765. #define MEM_alloc AIL_mem_alloc
  1766. #define MEM_free AIL_mem_free
  1767. #define MEM_use_malloc AIL_mem_use_malloc
  1768. #define MEM_use_free AIL_mem_use_free
  1769. #define MEM_alloc_DOS AIL_mem_alloc_DOS
  1770. #define MEM_free_DOS AIL_mem_free_DOS
  1771. #define VMM_lock_range AIL_vmm_lock_range
  1772. #define VMM_unlock_range AIL_vmm_unlock_range
  1773. #define VMM_lock AIL_vmm_lock
  1774. #define VMM_unlock AIL_vmm_unlock
  1775. #endif
  1776. #endif
  1777. extern S32 AILCALLBACK DP_ASI_DECODER_callback(U32 user,
  1778. void FAR *dest,
  1779. S32 bytes_requested,
  1780. S32 offset);
  1781. DXDEC void FAR * AILCALL AIL_mem_alloc_lock(U32 size);
  1782. DXDEC void AILCALL AIL_mem_free_lock (void FAR *ptr);
  1783. DXDEC S32 AILCALL AIL_file_error (void);
  1784. DXDEC S32 AILCALL AIL_file_size (char FAR *filename);
  1785. DXDEC void FAR * AILCALL AIL_file_read (char FAR *filename,
  1786. void FAR *dest);
  1787. DXDEC S32 AILCALL AIL_file_write (char FAR *filename,
  1788. void FAR *buf,
  1789. U32 len);
  1790. DXDEC S32 AILCALL AIL_WAV_file_write
  1791. (char FAR *filename,
  1792. void FAR *buf,
  1793. U32 len,
  1794. S32 rate,
  1795. S32 format);
  1796. DXDEC S32 AILCALL AIL_file_append (char FAR*filename,
  1797. void FAR*buf, U32 len);
  1798. #ifdef IS_DOS
  1799. extern void * AILCALLBACK (*AIL_mem_alloc) (U32);
  1800. extern void AILCALLBACK (*AIL_mem_free) (void *);
  1801. void * cdecl AIL_mem_use_malloc(void * AILCALLBACK (*fn)(U32));
  1802. void * cdecl AIL_mem_use_free (void AILCALLBACK (*fn)(void *));
  1803. //
  1804. // Other memory-management functions
  1805. //
  1806. DXDEC S32 AILCALL AIL_mem_alloc_DOS (U32 n_paras,
  1807. void **protected_ptr,
  1808. U32 *segment_far_ptr,
  1809. U32 *selector);
  1810. DXDEC void AILCALL AIL_mem_free_DOS (void *protected_ptr,
  1811. U32 segment_far_ptr,
  1812. U32 selector);
  1813. DXDEC S32 AILCALL AIL_vmm_lock_range (void *p1, void *p2);
  1814. DXDEC S32 AILCALL AIL_vmm_unlock_range (void *p1, void *p2);
  1815. DXDEC S32 AILCALL AIL_vmm_lock (void *start, U32 size);
  1816. DXDEC S32 AILCALL AIL_vmm_unlock (void *start, U32 size);
  1817. DXDEC U32 AILCALL AIL_sel_base (U32 sel);
  1818. DXDEC void AILCALL AIL_sel_set_limit (U32 sel,
  1819. U32 limit);
  1820. //
  1821. // Last IO_PARMS structure used to attempt device detection
  1822. //
  1823. extern IO_PARMS AIL_last_IO_attempt;
  1824. //
  1825. // Low-level support services
  1826. //
  1827. DXDEC REALFAR AILCALL AIL_get_real_vect (U32 vectnum);
  1828. DXDEC void AILCALL AIL_set_real_vect (U32 vectnum,
  1829. REALFAR real_ptr);
  1830. DXDEC void AILCALL AIL_set_USE16_ISR (S32 IRQ,
  1831. REALFAR real_base,
  1832. U32 ISR_offset);
  1833. DXDEC void AILCALL AIL_restore_USE16_ISR (S32 IRQ);
  1834. DXDEC U32 AILCALL AIL_disable_interrupts (void);
  1835. DXDEC void AILCALL AIL_restore_interrupts (U32 FD_register);
  1836. DXDEC void AILCALL AIL_switch_stack (void *stack,
  1837. U32 size,
  1838. U32 *SS,
  1839. void **ESP,
  1840. void **EBP);
  1841. DXDEC void AILCALL AIL_restore_stack (U32 SS,
  1842. void *ESP,
  1843. void *EBP);
  1844. DXDEC S32 AILCALL AIL_call_driver (AIL_DRIVER *drvr,
  1845. S32 fn,
  1846. VDI_CALL *in,
  1847. VDI_CALL *out);
  1848. DXDEC S32 AILCALL AIL_read_INI (AIL_INI *INI,
  1849. char *filename);
  1850. DXDEC U32 AILCALL AIL_interrupt_divisor (void);
  1851. #endif
  1852. #ifdef __WATCOMC__
  1853. void MSSBreakPoint();
  1854. #pragma aux MSSBreakPoint = "int 3";
  1855. #else
  1856. #define MSSBreakPoint() __asm {int 3}
  1857. #endif
  1858. //
  1859. // High-level support services
  1860. //
  1861. #ifdef IS_DOS
  1862. #ifdef IS_WATCOM
  1863. #if !defined(max) // Watcom stdlib.h doesn't define these for C++
  1864. #define max(a,b) (((a) > (b)) ? (a) : (b))
  1865. #endif
  1866. #if !defined(min)
  1867. #define min(a,b) (((a) < (b)) ? (a) : (b))
  1868. #endif
  1869. #endif
  1870. #ifdef __SW_3R
  1871. extern S32 AILCALL AIL_startup_reg (void);
  1872. #define AIL_startup AIL_startup_reg
  1873. #else
  1874. extern S32 AILCALL AIL_startup_stack (void);
  1875. #define AIL_startup AIL_startup_stack
  1876. #endif
  1877. #define AIL_quick_startup(ud,um,opr,opb,ops) AIL_quick_startup_with_start(&AIL_startup,ud,um,opr,opb,ops)
  1878. extern S8 AIL_driver_directory [256];
  1879. DXDEC char FAR* AILCALL AIL_set_driver_directory (char FAR*dir);
  1880. #define AIL_get_preference(number) (AIL_preference[number])
  1881. #else
  1882. DXDEC S32 AILCALL AIL_startup (void);
  1883. DXDEC S32 AILCALL AIL_get_preference (U32 number);
  1884. #endif
  1885. DXDEC void AILCALL AIL_shutdown (void);
  1886. DXDEC S32 AILCALL AIL_set_preference (U32 number,
  1887. S32 value);
  1888. DXDEC char FAR *AILCALL AIL_last_error (void);
  1889. DXDEC void AILCALL AIL_set_error (char FAR* error_msg);
  1890. //
  1891. // Low-level support services
  1892. //
  1893. DXDEC void __cdecl AIL_debug_printf (C8 FAR *fmt, ...);
  1894. DXDEC U32 AILCALL AIL_MMX_available (void);
  1895. DXDEC void AILCALL AIL_lock (void);
  1896. DXDEC void AILCALL AIL_unlock (void);
  1897. DXDEC void AILCALL AIL_delay (S32 intervals);
  1898. DXDEC S32 AILCALL AIL_background (void);
  1899. //
  1900. // Process services
  1901. //
  1902. DXDEC HTIMER AILCALL AIL_register_timer (AILTIMERCB fn);
  1903. DXDEC U32 AILCALL AIL_set_timer_user (HTIMER timer,
  1904. U32 user);
  1905. DXDEC void AILCALL AIL_set_timer_period (HTIMER timer,
  1906. U32 microseconds);
  1907. DXDEC void AILCALL AIL_set_timer_frequency (HTIMER timer,
  1908. U32 hertz);
  1909. DXDEC void AILCALL AIL_set_timer_divisor (HTIMER timer,
  1910. U32 PIT_divisor);
  1911. DXDEC void AILCALL AIL_start_timer (HTIMER timer);
  1912. DXDEC void AILCALL AIL_start_all_timers (void);
  1913. DXDEC void AILCALL AIL_stop_timer (HTIMER timer);
  1914. DXDEC void AILCALL AIL_stop_all_timers (void);
  1915. DXDEC void AILCALL AIL_release_timer_handle (HTIMER timer);
  1916. DXDEC void AILCALL AIL_release_all_timers (void);
  1917. #ifdef IS_WIN32
  1918. DXDEC U32 AILCALL AIL_get_timer_highest_delay (void);
  1919. DXDEC HWND AILCALL AIL_HWND (void);
  1920. #endif
  1921. //
  1922. // high-level digital services
  1923. //
  1924. #ifdef IS_WINDOWS
  1925. #define AIL_DLL_version(str,len) \
  1926. { \
  1927. HINSTANCE l=LoadLibrary(MSSDLLNAME); \
  1928. if ((U32)l<=32) \
  1929. *(str)=0; \
  1930. else { \
  1931. LoadString(l,1,str,len); \
  1932. FreeLibrary(l); \
  1933. } \
  1934. }
  1935. DXDEC S32 AILCALL AIL_waveOutOpen (HDIGDRIVER FAR *drvr,
  1936. LPHWAVEOUT FAR *lphWaveOut,
  1937. S32 wDeviceID,
  1938. LPWAVEFORMAT lpFormat);
  1939. DXDEC void AILCALL AIL_waveOutClose (HDIGDRIVER drvr);
  1940. DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr);
  1941. DXDEC S32 AILCALL AIL_digital_handle_reacquire
  1942. (HDIGDRIVER drvr);
  1943. DXDEC void AILCALL AIL_serve(void);
  1944. #else
  1945. //
  1946. // DOS installation services
  1947. //
  1948. DXDEC IO_PARMS * AILCALL AIL_get_IO_environment (AIL_DRIVER *drvr);
  1949. DXDEC AIL_DRIVER* AILCALL AIL_install_driver (U8 *driver_image,
  1950. U32 n_bytes);
  1951. DXDEC void AILCALL AIL_uninstall_driver (AIL_DRIVER *drvr);
  1952. DXDEC S32 AILCALL AIL_install_DIG_INI (HDIGDRIVER *dig);
  1953. DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_file
  1954. (char *filename,
  1955. IO_PARMS *IO);
  1956. DXDEC void AILCALL AIL_uninstall_DIG_driver (HDIGDRIVER dig);
  1957. DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_image
  1958. (void *driver_image,
  1959. U32 size,
  1960. IO_PARMS *IO);
  1961. #endif
  1962. DXDEC S32 AILCALL AIL_digital_CPU_percent(HDIGDRIVER dig);
  1963. DXDEC HSAMPLE AILCALL AIL_allocate_sample_handle
  1964. (HDIGDRIVER dig);
  1965. DXDEC HSAMPLE AILCALL AIL_allocate_file_sample (HDIGDRIVER dig,
  1966. void FAR *file_image,
  1967. S32 block);
  1968. DXDEC void AILCALL AIL_release_sample_handle (HSAMPLE S);
  1969. DXDEC void AILCALL AIL_init_sample (HSAMPLE S);
  1970. DXDEC S32 AILCALL AIL_set_sample_file (HSAMPLE S,
  1971. void FAR *file_image,
  1972. S32 block);
  1973. DXDEC S32 AILCALL AIL_set_named_sample_file (HSAMPLE S,
  1974. C8 FAR *file_type_suffix,
  1975. void FAR *file_image,
  1976. S32 file_size,
  1977. S32 block);
  1978. DXDEC HPROVIDER AILCALL AIL_set_sample_processor (HSAMPLE S,
  1979. SAMPLESTAGE pipeline_stage,
  1980. HPROVIDER provider);
  1981. DXDEC HPROVIDER AILCALL AIL_set_digital_driver_processor
  1982. (HDIGDRIVER dig,
  1983. DIGDRVSTAGE pipeline_stage,
  1984. HPROVIDER provider);
  1985. DXDEC void AILCALL AIL_set_sample_adpcm_block_size
  1986. (HSAMPLE S,
  1987. U32 blocksize);
  1988. DXDEC void AILCALL AIL_set_sample_address (HSAMPLE S,
  1989. void FAR *start,
  1990. U32 len);
  1991. DXDEC void AILCALL AIL_set_sample_type (HSAMPLE S,
  1992. S32 format,
  1993. U32 flags);
  1994. DXDEC void AILCALL AIL_start_sample (HSAMPLE S);
  1995. DXDEC void AILCALL AIL_stop_sample (HSAMPLE S);
  1996. DXDEC void AILCALL AIL_resume_sample (HSAMPLE S);
  1997. DXDEC void AILCALL AIL_end_sample (HSAMPLE S);
  1998. DXDEC void AILCALL AIL_set_sample_playback_rate
  1999. (HSAMPLE S,
  2000. S32 playback_rate);
  2001. DXDEC void AILCALL AIL_set_sample_volume (HSAMPLE S,
  2002. S32 volume);
  2003. DXDEC void AILCALL AIL_set_sample_pan (HSAMPLE S,
  2004. S32 pan);
  2005. DXDEC void AILCALL AIL_set_sample_loop_count (HSAMPLE S,
  2006. S32 loop_count);
  2007. DXDEC void AILCALL AIL_set_sample_loop_block (HSAMPLE S,
  2008. S32 loop_start_offset,
  2009. S32 loop_end_offset);
  2010. DXDEC U32 AILCALL AIL_sample_status (HSAMPLE S);
  2011. DXDEC S32 AILCALL AIL_sample_playback_rate (HSAMPLE S);
  2012. DXDEC S32 AILCALL AIL_sample_volume (HSAMPLE S);
  2013. DXDEC S32 AILCALL AIL_sample_pan (HSAMPLE S);
  2014. DXDEC S32 AILCALL AIL_sample_loop_count (HSAMPLE S);
  2015. DXDEC void AILCALL AIL_set_digital_master_volume
  2016. (HDIGDRIVER dig,
  2017. S32 master_volume);
  2018. DXDEC S32 AILCALL AIL_digital_master_volume (HDIGDRIVER dig);
  2019. DXDEC void AILCALL AIL_set_sample_reverb(HSAMPLE S,
  2020. F32 reverb_level,
  2021. F32 reverb_reflect_time,
  2022. F32 reverb_decay_time);
  2023. DXDEC void AILCALL AIL_sample_reverb (HSAMPLE S,
  2024. F32 FAR *reverb_level,
  2025. F32 FAR *reverb_reflect_time,
  2026. F32 FAR *reverb_decay_time);
  2027. //
  2028. // low-level digital services
  2029. //
  2030. DXDEC S32 AILCALL AIL_minimum_sample_buffer_size(HDIGDRIVER dig,
  2031. S32 playback_rate,
  2032. S32 format);
  2033. DXDEC S32 AILCALL AIL_sample_buffer_ready (HSAMPLE S);
  2034. DXDEC void AILCALL AIL_load_sample_buffer (HSAMPLE S,
  2035. U32 buff_num,
  2036. void FAR *buffer,
  2037. U32 len);
  2038. DXDEC S32 AILCALL AIL_sample_buffer_info (HSAMPLE S, //)
  2039. U32 FAR *pos0,
  2040. U32 FAR *len0,
  2041. U32 FAR *pos1,
  2042. U32 FAR *len1);
  2043. DXDEC U32 AILCALL AIL_sample_granularity (HSAMPLE S);
  2044. DXDEC void AILCALL AIL_set_sample_position (HSAMPLE S,
  2045. U32 pos);
  2046. DXDEC U32 AILCALL AIL_sample_position (HSAMPLE S);
  2047. DXDEC AILSAMPLECB AILCALL AIL_register_SOB_callback
  2048. (HSAMPLE S,
  2049. AILSAMPLECB SOB);
  2050. DXDEC AILSAMPLECB AILCALL AIL_register_EOB_callback
  2051. (HSAMPLE S,
  2052. AILSAMPLECB EOB);
  2053. DXDEC AILSAMPLECB AILCALL AIL_register_EOS_callback
  2054. (HSAMPLE S,
  2055. AILSAMPLECB EOS);
  2056. DXDEC AILSAMPLECB AILCALL AIL_register_EOF_callback
  2057. (HSAMPLE S,
  2058. AILSAMPLECB EOFILE);
  2059. DXDEC void AILCALL AIL_set_sample_user_data (HSAMPLE S,
  2060. U32 index,
  2061. S32 value);
  2062. DXDEC S32 AILCALL AIL_sample_user_data (HSAMPLE S,
  2063. U32 index);
  2064. DXDEC S32 AILCALL AIL_active_sample_count (HDIGDRIVER dig);
  2065. DXDEC void AILCALL AIL_digital_configuration (HDIGDRIVER dig,
  2066. S32 FAR *rate,
  2067. S32 FAR *format,
  2068. char FAR *string);
  2069. #ifdef IS_WIN32
  2070. DXDEC S32 AILCALL AIL_set_direct_buffer_control (HSAMPLE S,
  2071. U32 command);
  2072. DXDEC void AILCALL AIL_get_DirectSound_info (HSAMPLE S,
  2073. AILLPDIRECTSOUND *lplpDS,
  2074. AILLPDIRECTSOUNDBUFFER *lplpDSB);
  2075. DXDEC S32 AILCALL AIL_set_DirectSound_HWND(HDIGDRIVER dig, HWND wnd);
  2076. #endif
  2077. DXDEC void AILCALL AIL_set_sample_ms_position (HSAMPLE S, //)
  2078. S32 milliseconds);
  2079. DXDEC void AILCALL AIL_sample_ms_position (HSAMPLE S, //)
  2080. S32 FAR * total_milliseconds,
  2081. S32 FAR * current_milliseconds);
  2082. //
  2083. // Digital input services
  2084. //
  2085. #ifdef IS_WINDOWS
  2086. DXDEC HDIGINPUT AILCALL AIL_input_open (AILINPUTINFO FAR *info,
  2087. U32 constraints,
  2088. U32 callback_user_value);
  2089. DXDEC void AILCALL AIL_input_close (HDIGINPUT dig);
  2090. DXDEC AILINPUTINFO FAR *
  2091. AILCALL AIL_input_info (HDIGINPUT dig);
  2092. DXDEC S32 AILCALL AIL_set_input_state (HDIGINPUT dig,
  2093. S32 enable);
  2094. #endif
  2095. //
  2096. // High-level XMIDI services
  2097. //
  2098. #ifdef IS_WINDOWS
  2099. DXDEC S32 AILCALL AIL_midiOutOpen(HMDIDRIVER FAR *drvr,
  2100. LPHMIDIOUT FAR *lphMidiOut,
  2101. S32 dwDeviceID);
  2102. DXDEC void AILCALL AIL_midiOutClose (HMDIDRIVER mdi);
  2103. DXDEC S32 AILCALL AIL_MIDI_handle_release
  2104. (HMDIDRIVER mdi);
  2105. DXDEC S32 AILCALL AIL_MIDI_handle_reacquire
  2106. (HMDIDRIVER mdi);
  2107. #else
  2108. DXDEC S32 AILCALL AIL_install_MDI_INI (HMDIDRIVER *mdi);
  2109. DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_file
  2110. (char *filename,
  2111. IO_PARMS *IO);
  2112. DXDEC void AILCALL AIL_uninstall_MDI_driver (HMDIDRIVER mdi);
  2113. DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_image
  2114. (void *driver_image,
  2115. U32 size,
  2116. IO_PARMS *IO);
  2117. DXDEC S32 AILCALL AIL_MDI_driver_type (HMDIDRIVER mdi);
  2118. DXDEC void AILCALL AIL_set_GTL_filename_prefix (char *prefix);
  2119. DXDEC S32 AILCALL AIL_timbre_status (HMDIDRIVER mdi,
  2120. S32 bank,
  2121. S32 patch);
  2122. DXDEC S32 AILCALL AIL_install_timbre (HMDIDRIVER mdi,
  2123. S32 bank,
  2124. S32 patch);
  2125. DXDEC void AILCALL AIL_protect_timbre (HMDIDRIVER mdi,
  2126. S32 bank,
  2127. S32 patch);
  2128. DXDEC void AILCALL AIL_unprotect_timbre (HMDIDRIVER mdi,
  2129. S32 bank,
  2130. S32 patch);
  2131. #endif
  2132. DXDEC HSEQUENCE AILCALL AIL_allocate_sequence_handle
  2133. (HMDIDRIVER mdi);
  2134. DXDEC void AILCALL AIL_release_sequence_handle
  2135. (HSEQUENCE S);
  2136. DXDEC S32 AILCALL AIL_init_sequence (HSEQUENCE S,
  2137. void FAR *start,
  2138. S32 sequence_num);
  2139. DXDEC void AILCALL AIL_start_sequence (HSEQUENCE S);
  2140. DXDEC void AILCALL AIL_stop_sequence (HSEQUENCE S);
  2141. DXDEC void AILCALL AIL_resume_sequence (HSEQUENCE S);
  2142. DXDEC void AILCALL AIL_end_sequence (HSEQUENCE S);
  2143. DXDEC void AILCALL AIL_set_sequence_tempo (HSEQUENCE S,
  2144. S32 tempo,
  2145. S32 milliseconds);
  2146. DXDEC void AILCALL AIL_set_sequence_volume (HSEQUENCE S,
  2147. S32 volume,
  2148. S32 milliseconds);
  2149. DXDEC void AILCALL AIL_set_sequence_loop_count
  2150. (HSEQUENCE S,
  2151. S32 loop_count);
  2152. DXDEC U32 AILCALL AIL_sequence_status (HSEQUENCE S);
  2153. DXDEC S32 AILCALL AIL_sequence_tempo (HSEQUENCE S);
  2154. DXDEC S32 AILCALL AIL_sequence_volume (HSEQUENCE S);
  2155. DXDEC S32 AILCALL AIL_sequence_loop_count (HSEQUENCE S);
  2156. DXDEC void AILCALL AIL_set_XMIDI_master_volume
  2157. (HMDIDRIVER mdi,
  2158. S32 master_volume);
  2159. DXDEC S32 AILCALL AIL_XMIDI_master_volume (HMDIDRIVER mdi);
  2160. //
  2161. // Low-level XMIDI services
  2162. //
  2163. DXDEC S32 AILCALL AIL_active_sequence_count (HMDIDRIVER mdi);
  2164. DXDEC S32 AILCALL AIL_controller_value (HSEQUENCE S,
  2165. S32 channel,
  2166. S32 controller_num);
  2167. DXDEC S32 AILCALL AIL_channel_notes (HSEQUENCE S,
  2168. S32 channel);
  2169. DXDEC void AILCALL AIL_sequence_position (HSEQUENCE S,
  2170. S32 FAR *beat,
  2171. S32 FAR *measure);
  2172. DXDEC void AILCALL AIL_branch_index (HSEQUENCE S,
  2173. U32 marker);
  2174. DXDEC AILPREFIXCB AILCALL AIL_register_prefix_callback
  2175. (HSEQUENCE S,
  2176. AILPREFIXCB callback);
  2177. DXDEC AILTRIGGERCB AILCALL AIL_register_trigger_callback
  2178. (HSEQUENCE S,
  2179. AILTRIGGERCB callback);
  2180. DXDEC AILSEQUENCECB AILCALL AIL_register_sequence_callback
  2181. (HSEQUENCE S,
  2182. AILSEQUENCECB callback);
  2183. DXDEC AILBEATCB AILCALL AIL_register_beat_callback (HSEQUENCE S,
  2184. AILBEATCB callback);
  2185. DXDEC AILEVENTCB AILCALL AIL_register_event_callback (HMDIDRIVER mdi,
  2186. AILEVENTCB callback);
  2187. DXDEC AILTIMBRECB AILCALL AIL_register_timbre_callback
  2188. (HMDIDRIVER mdi,
  2189. AILTIMBRECB callback);
  2190. DXDEC void AILCALL AIL_set_sequence_user_data (HSEQUENCE S,
  2191. U32 index,
  2192. S32 value);
  2193. DXDEC S32 AILCALL AIL_sequence_user_data (HSEQUENCE S,
  2194. U32 index);
  2195. DXDEC void AILCALL AIL_register_ICA_array (HSEQUENCE S,
  2196. U8 FAR *array);
  2197. DXDEC S32 AILCALL AIL_lock_channel (HMDIDRIVER mdi);
  2198. DXDEC void AILCALL AIL_release_channel (HMDIDRIVER mdi,
  2199. S32 channel);
  2200. DXDEC void AILCALL AIL_map_sequence_channel (HSEQUENCE S,
  2201. S32 seq_channel,
  2202. S32 new_channel);
  2203. DXDEC S32 AILCALL AIL_true_sequence_channel (HSEQUENCE S,
  2204. S32 seq_channel);
  2205. DXDEC void AILCALL AIL_send_channel_voice_message
  2206. (HMDIDRIVER mdi,
  2207. HSEQUENCE S,
  2208. S32 status,
  2209. S32 data_1,
  2210. S32 data_2);
  2211. DXDEC void AILCALL AIL_send_sysex_message (HMDIDRIVER mdi,
  2212. void FAR *buffer);
  2213. DXDEC HWAVESYNTH
  2214. AILCALL AIL_create_wave_synthesizer (HDIGDRIVER dig,
  2215. HMDIDRIVER mdi,
  2216. void FAR *wave_lib,
  2217. S32 polyphony);
  2218. DXDEC void AILCALL AIL_destroy_wave_synthesizer (HWAVESYNTH W);
  2219. DXDEC void AILCALL AIL_set_sequence_ms_position (HSEQUENCE S, //)
  2220. S32 milliseconds);
  2221. DXDEC void AILCALL AIL_sequence_ms_position(HSEQUENCE S, //)
  2222. S32 FAR *total_milliseconds,
  2223. S32 FAR *current_milliseconds);
  2224. //
  2225. // red book functions
  2226. //
  2227. #ifdef IS_DOS
  2228. typedef struct _REDBOOKTRACKINFO {
  2229. U32 tracks;
  2230. U32 trackstarts[100];
  2231. } REDBOOKTRACKINFO;
  2232. #endif
  2233. typedef struct _REDBOOK {
  2234. U32 DeviceID;
  2235. U32 paused;
  2236. U32 pausedsec;
  2237. U32 lastendsec;
  2238. #ifdef IS_DOS
  2239. U32 readcontents;
  2240. REDBOOKTRACKINFO info;
  2241. #endif
  2242. } REDBOOK;
  2243. typedef struct _REDBOOK FAR* HREDBOOK;
  2244. #define REDBOOK_ERROR 0
  2245. #define REDBOOK_PLAYING 1
  2246. #define REDBOOK_PAUSED 2
  2247. #define REDBOOK_STOPPED 3
  2248. DXDEC HREDBOOK AILCALL AIL_redbook_open(U32 which);
  2249. DXDEC HREDBOOK AILCALL AIL_redbook_open_drive(S32 drive);
  2250. DXDEC void AILCALL AIL_redbook_close(HREDBOOK hand);
  2251. DXDEC void AILCALL AIL_redbook_eject(HREDBOOK hand);
  2252. DXDEC void AILCALL AIL_redbook_retract(HREDBOOK hand);
  2253. DXDEC U32 AILCALL AIL_redbook_status(HREDBOOK hand);
  2254. DXDEC U32 AILCALL AIL_redbook_tracks(HREDBOOK hand);
  2255. DXDEC U32 AILCALL AIL_redbook_track(HREDBOOK hand);
  2256. DXDEC void AILCALL AIL_redbook_track_info(HREDBOOK hand,U32 tracknum,
  2257. U32 FAR* startmsec,U32 FAR* endmsec);
  2258. DXDEC U32 AILCALL AIL_redbook_id(HREDBOOK hand);
  2259. DXDEC U32 AILCALL AIL_redbook_position(HREDBOOK hand);
  2260. DXDEC U32 AILCALL AIL_redbook_play(HREDBOOK hand,U32 startmsec, U32 endmsec);
  2261. DXDEC U32 AILCALL AIL_redbook_stop(HREDBOOK hand);
  2262. DXDEC U32 AILCALL AIL_redbook_pause(HREDBOOK hand);
  2263. DXDEC U32 AILCALL AIL_redbook_resume(HREDBOOK hand);
  2264. DXDEC S32 AILCALL AIL_redbook_volume(HREDBOOK hand);
  2265. DXDEC S32 AILCALL AIL_redbook_set_volume(HREDBOOK hand, S32 volume);
  2266. #ifdef IS_WIN16
  2267. #define AIL_ms_count timeGetTime
  2268. DXDEC U32 AILCALL AIL_us_count(void);
  2269. #else
  2270. DXDEC U32 AILCALL AIL_ms_count(void);
  2271. DXDEC U32 AILCALL AIL_us_count(void);
  2272. #endif
  2273. typedef struct _STREAM FAR* HSTREAM; // Handle to stream
  2274. typedef void (AILCALLBACK FAR* AILSTREAMCB) (HSTREAM stream);
  2275. typedef struct _STREAM {
  2276. S32 block_oriented; // 1 if this is an ADPCM or ASI-compressed stream
  2277. S32 using_ASI; // 1 if using ASI decoder to uncompress stream data
  2278. ASISTAGE FAR *ASI; // handy pointer to our ASI coded
  2279. HSAMPLE samp; // the sample handle
  2280. U32 fileh; // the open file handle
  2281. U8 FAR* bufs[3]; // the data buffers
  2282. U32 bufsizes[3]; // the size of each buffer
  2283. S32 bufsize; // size of each buffer
  2284. S32 readsize; // size of each read block
  2285. U32 buf1; // 0,1,2 (current buffer that we are reading into)
  2286. S32 size1; // holds the current amount of data read
  2287. U32 buf2; // 0,1,2 (the next buffer that we are reading into)
  2288. S32 size2; // next buffer loaded up to
  2289. U32 buf3; // 0,1,2 (the next buffer that we are reading into)
  2290. S32 size3; // next buffer loaded up to
  2291. U32 datarate; // datarate in bytes per second
  2292. S32 filerate; // original datarate of the file
  2293. S32 filetype; // file format type
  2294. U32 fileflags; // file format flags (signed or unsigned)
  2295. S32 totallen; // total length of the sound data
  2296. U32 blocksize; // ADPCM block size
  2297. S32 padding; // padding to be done
  2298. S32 padded; // padding done
  2299. S32 loadedsize; // size that has been loaded
  2300. S32 loadedsome; // have we done any loads?
  2301. U32 startpos; // point that the sound data begins
  2302. U32 totalread; // total bytes read from the disk
  2303. U32 loopsleft; // how many loops are left
  2304. U32 error; // read error has occurred
  2305. S32 preload; // preload the file into the first buffer
  2306. S32 dontclose; // don't close the file
  2307. S32 noback; // no background processing
  2308. S32 alldone; // alldone
  2309. S32 primeamount; // amount to load after a seek
  2310. S32 readatleast; // forced amount to read on next service
  2311. S32 playcontrol; // control: 0=stopped, 1=started, |8=paused, |16=sample paused
  2312. AILSTREAMCB callback; // end of stream callback
  2313. S32 user_data[8]; // Miscellaneous user data
  2314. void FAR* next; // pointer to next stream
  2315. #ifdef IS_WINDOWS
  2316. S32 autostreaming; // are we autostreaming this stream
  2317. S32 cb_IsWin32s; // Is the callback win32s?
  2318. #endif
  2319. S32 docallback; // set when it time to poll for a callback
  2320. } STREAM_TYPE;
  2321. DXDEC HSTREAM AILCALL AIL_open_stream(HDIGDRIVER dig, char FAR* filename, S32 stream_mem);
  2322. DXDEC void AILCALL AIL_close_stream(HSTREAM stream);
  2323. DXDEC S32 AILCALL AIL_service_stream(HSTREAM stream, S32 fillup);
  2324. DXDEC void AILCALL AIL_start_stream(HSTREAM stream);
  2325. DXDEC void AILCALL AIL_pause_stream(HSTREAM stream, S32 onoff);
  2326. DXDEC void AILCALL AIL_set_stream_volume(HSTREAM stream,S32 volume);
  2327. DXDEC void AILCALL AIL_set_stream_pan(HSTREAM stream,S32 pan);
  2328. DXDEC S32 AILCALL AIL_stream_volume(HSTREAM stream);
  2329. DXDEC S32 AILCALL AIL_stream_pan(HSTREAM stream);
  2330. DXDEC void AILCALL AIL_set_stream_playback_rate(HSTREAM stream, S32 rate);
  2331. DXDEC S32 AILCALL AIL_stream_playback_rate(HSTREAM stream);
  2332. DXDEC S32 AILCALL AIL_stream_loop_count(HSTREAM stream);
  2333. DXDEC void AILCALL AIL_set_stream_loop_count(HSTREAM stream, S32 count);
  2334. DXDEC S32 AILCALL AIL_stream_status(HSTREAM stream);
  2335. DXDEC void AILCALL AIL_set_stream_position(HSTREAM stream,S32 offset);
  2336. DXDEC S32 AILCALL AIL_stream_position(HSTREAM stream);
  2337. DXDEC void AILCALL AIL_stream_info(HSTREAM stream, S32 FAR* datarate, S32 FAR* sndtype, S32 FAR* length, S32 FAR* memory);
  2338. DXDEC AILSTREAMCB AILCALL AIL_register_stream_callback(HSTREAM stream, AILSTREAMCB callback);
  2339. DXDEC void AILCALL AIL_auto_service_stream(HSTREAM stream, S32 onoff);
  2340. DXDEC void AILCALL AIL_set_stream_user_data (HSTREAM S,
  2341. U32 index,
  2342. S32 value);
  2343. DXDEC S32 AILCALL AIL_stream_user_data (HSTREAM S,
  2344. U32 index);
  2345. DXDEC void AILCALL AIL_set_stream_ms_position (HSTREAM S,
  2346. S32 milliseconds);
  2347. DXDEC void AILCALL AIL_stream_ms_position (HSTREAM S, //)
  2348. S32 FAR * total_milliseconds,
  2349. S32 FAR * current_milliseconds);
  2350. DXDEC void AILCALL AIL_set_stream_reverb(HSTREAM S,
  2351. F32 reverb_level,
  2352. F32 reverb_reflect_time,
  2353. F32 reverb_decay_time);
  2354. DXDEC void AILCALL AIL_stream_reverb (HSTREAM S,
  2355. F32 FAR *reverb_level,
  2356. F32 FAR *reverb_reflect_time,
  2357. F32 FAR *reverb_decay_time);
  2358. //
  2359. // High-level DLS functions
  2360. //
  2361. typedef struct _DLSFILEID {
  2362. S32 id;
  2363. struct _DLSFILEID FAR* next;
  2364. } DLSFILEID;
  2365. typedef struct _DLSFILEID FAR* HDLSFILEID;
  2366. typedef struct _DLSDEVICE {
  2367. void FAR* pGetPref;
  2368. void FAR* pSetPref;
  2369. void FAR* pMSSOpen;
  2370. void FAR* pOpen;
  2371. void FAR* pClose;
  2372. void FAR* pLoadFile;
  2373. void FAR* pLoadMem;
  2374. void FAR* pUnloadFile;
  2375. void FAR* pUnloadAll;
  2376. void FAR* pGetInfo;
  2377. void FAR* pCompact;
  2378. void FAR* pSetAttr;
  2379. S32 DLSHandle;
  2380. U32 format;
  2381. U32 buffer_size;
  2382. void FAR* buffer[2];
  2383. HSAMPLE sample;
  2384. HMDIDRIVER mdi;
  2385. HDIGDRIVER dig;
  2386. HDLSFILEID first;
  2387. #ifdef IS_WINDOWS
  2388. HMODULE lib;
  2389. #else
  2390. char FAR* DOSname;
  2391. #endif
  2392. } DLSDEVICE;
  2393. typedef struct _DLSDEVICE FAR* HDLSDEVICE;
  2394. typedef struct _AILDLSINFO {
  2395. char Description[128];
  2396. S32 MaxDLSMemory;
  2397. S32 CurrentDLSMemory;
  2398. S32 LargestSize;
  2399. S32 GMAvailable;
  2400. S32 GMBankSize;
  2401. } AILDLSINFO;
  2402. #ifdef IS_DOS
  2403. typedef struct _AILDOSDLS {
  2404. char FAR* description;
  2405. void FAR* pDLSOpen;
  2406. void FAR* pMSSOpen;
  2407. void FAR* pOpen;
  2408. void FAR* pClose;
  2409. void FAR* pLoadFile;
  2410. void FAR* pLoadMem;
  2411. void FAR* pUnloadFile;
  2412. void FAR* pUnloadAll;
  2413. void FAR* pGetInfo;
  2414. void FAR* pCompact;
  2415. void FAR* pSetAttr;
  2416. } AILDOSDLS;
  2417. #endif
  2418. DXDEC HDLSDEVICE AILCALL AIL_DLS_open(HMDIDRIVER mdi, HDIGDRIVER dig,
  2419. #ifdef IS_WINDOWS
  2420. char FAR* libname,
  2421. #else
  2422. AILDOSDLS FAR* dosdls,
  2423. #endif
  2424. U32 flags, U32 rate, S32 bits, S32 channels);
  2425. //
  2426. // Parameters for the dwFlag used in DLSClose() and flags in AIL_DLS_close
  2427. //
  2428. #define RETAIN_DLS_COLLECTION 0x00000001
  2429. #define RETURN_TO_BOOTUP_STATE 0x00000002
  2430. #define RETURN_TO_GM_ONLY_STATE 0x00000004
  2431. #define DLS_COMPACT_MEMORY 0x00000008
  2432. DXDEC void AILCALL AIL_DLS_close(HDLSDEVICE dls, U32 flags);
  2433. DXDEC HDLSFILEID AILCALL AIL_DLS_load_file(HDLSDEVICE dls, char FAR* filename, U32 flags);
  2434. DXDEC HDLSFILEID AILCALL AIL_DLS_load_memory(HDLSDEVICE dls, void FAR* memfile, U32 flags);
  2435. //
  2436. // other parameters for AIL_DLS_unload
  2437. //
  2438. #define AIL_DLS_UNLOAD_MINE 0
  2439. #define AIL_DLS_UNLOAD_ALL ((HDLSFILEID)(U32)(S32)-1)
  2440. DXDEC void AILCALL AIL_DLS_unload(HDLSDEVICE dls, HDLSFILEID dlsid);
  2441. DXDEC void AILCALL AIL_DLS_compact(HDLSDEVICE dls);
  2442. DXDEC void AILCALL AIL_DLS_get_info(HDLSDEVICE dls, AILDLSINFO FAR* info, S32 FAR* PercentCPU);
  2443. DXDEC void AILCALL AIL_DLS_set_reverb(HDLSDEVICE dls,
  2444. F32 reverb_level,
  2445. F32 reverb_reflect_time,
  2446. F32 reverb_decay_time);
  2447. DXDEC void AILCALL AIL_DLS_get_reverb(HDLSDEVICE dls,
  2448. F32 FAR* reverb_level,
  2449. F32 FAR* reverb_reflect_time,
  2450. F32 FAR* reverb_decay_time);
  2451. //
  2452. // Quick-integration service functions and data types
  2453. //
  2454. typedef struct
  2455. {
  2456. U32 FAR *data;
  2457. S32 size;
  2458. S32 type;
  2459. void FAR *handle;
  2460. S32 status;
  2461. void FAR* next;
  2462. S32 speed;
  2463. S32 volume;
  2464. S32 extravol;
  2465. F32 rlevel;
  2466. F32 rrtime;
  2467. F32 rdtime;
  2468. HDLSFILEID dlsid;
  2469. void FAR* dlsmem;
  2470. void FAR* dlsmemunc;
  2471. S32 milliseconds;
  2472. S32 length;
  2473. S32 userdata;
  2474. }
  2475. AUDIO_TYPE;
  2476. #define QSTAT_DONE 1 // Data has finished playing
  2477. #define QSTAT_LOADED 2 // Data has been loaded, but not yet played
  2478. #define QSTAT_PLAYING 3 // Data is currently playing
  2479. typedef AUDIO_TYPE FAR * HAUDIO; // Generic handle to any audio data type
  2480. #define AIL_QUICK_USE_WAVEOUT 2
  2481. #define AIL_QUICK_MIDI_AND_DLS 2
  2482. #define AIL_QUICK_DLS_ONLY 3
  2483. #define AIL_QUICK_MIDI_AND_VORTEX_DLS 4
  2484. #define AIL_QUICK_MIDI_AND_SONICVIBES_DLS 5
  2485. DXDEC S32 AILCALL
  2486. #ifdef IS_WINDOWS
  2487. AIL_quick_startup (
  2488. #else
  2489. AIL_quick_startup_with_start(void* startup,
  2490. #endif
  2491. S32 use_digital,
  2492. S32 use_MIDI,
  2493. U32 output_rate,
  2494. S32 output_bits,
  2495. S32 output_channels);
  2496. DXDEC void AILCALL AIL_quick_shutdown (void);
  2497. DXDEC void AILCALL AIL_quick_handles (HDIGDRIVER FAR* pdig,
  2498. HMDIDRIVER FAR* pmdi,
  2499. HDLSDEVICE FAR* pdls );
  2500. DXDEC HAUDIO AILCALL AIL_quick_load (char FAR *filename);
  2501. DXDEC HAUDIO AILCALL AIL_quick_load_mem (void FAR *mem,
  2502. U32 size);
  2503. DXDEC HAUDIO AILCALL AIL_quick_copy (HAUDIO audio);
  2504. DXDEC void AILCALL AIL_quick_unload (HAUDIO audio);
  2505. DXDEC S32 AILCALL AIL_quick_play (HAUDIO audio,
  2506. U32 loop_count);
  2507. DXDEC void AILCALL AIL_quick_halt (HAUDIO audio);
  2508. DXDEC S32 AILCALL AIL_quick_status (HAUDIO audio);
  2509. DXDEC HAUDIO AILCALL AIL_quick_load_and_play (char FAR *filename,
  2510. U32 loop_count,
  2511. S32 wait_request);
  2512. DXDEC void AILCALL AIL_quick_set_speed (HAUDIO audio, S32 speed);
  2513. DXDEC void AILCALL AIL_quick_set_volume (HAUDIO audio, S32 volume, S32 extravol);
  2514. DXDEC void AILCALL AIL_quick_set_reverb (HAUDIO audio,
  2515. F32 reverb_level,
  2516. F32 reverb_reflect_time,
  2517. F32 reverb_decay_time);
  2518. DXDEC void AILCALL AIL_quick_set_ms_position(HAUDIO audio,S32 milliseconds);
  2519. DXDEC S32 AILCALL AIL_quick_ms_position(HAUDIO audio);
  2520. DXDEC S32 AILCALL AIL_quick_ms_length(HAUDIO audio);
  2521. #define AIL_QUICK_XMIDI_TYPE 1
  2522. #define AIL_QUICK_DIGITAL_TYPE 2
  2523. #define AIL_QUICK_DLS_XMIDI_TYPE 3
  2524. #define AIL_QUICK_MPEG_DIGITAL_TYPE 4
  2525. DXDEC S32 AILCALL AIL_quick_type(HAUDIO audio);
  2526. //
  2527. // used for AIL_process
  2528. //
  2529. typedef struct _AILMIXINFO {
  2530. AILSOUNDINFO Info;
  2531. ADPCMDATA mss_adpcm;
  2532. U32 src_fract;
  2533. S32 left_val;
  2534. S32 right_val;
  2535. } AILMIXINFO;
  2536. DXDEC S32 AILCALL AIL_WAV_info(void FAR* data, AILSOUNDINFO FAR* info);
  2537. DXDEC S32 AILCALL AIL_size_processed_digital_audio(
  2538. U32 dest_rate,
  2539. U32 dest_format,
  2540. S32 num_srcs,
  2541. AILMIXINFO FAR* src);
  2542. DXDEC S32 AILCALL AIL_process_digital_audio(
  2543. void FAR *dest_buffer,
  2544. S32 dest_buffer_size,
  2545. U32 dest_rate,
  2546. U32 dest_format,
  2547. S32 num_srcs,
  2548. AILMIXINFO FAR* src);
  2549. #define AIL_LENGTHY_INIT 0
  2550. #define AIL_LENGTHY_SET_PREFERENCE 1
  2551. #define AIL_LENGTHY_UPDATE 2
  2552. #define AIL_LENGTHY_DONE 3
  2553. typedef S32 (AILCALLBACK FAR* AILLENGTHYCB)(U32 state,U32 user);
  2554. typedef S32 (AILCALLBACK FAR* AILCODECSETPREF)(char FAR* preference,U32 value);
  2555. DXDEC S32 AILCALL AIL_compress_ASI(AILSOUNDINFO FAR* info, //)
  2556. char FAR* filename_ext,
  2557. void FAR* FAR* outdata,
  2558. U32 FAR* outsize,
  2559. AILLENGTHYCB callback);
  2560. DXDEC S32 AILCALL AIL_decompress_ASI(void FAR* indata, //)
  2561. U32 insize,
  2562. char FAR* filename_ext,
  2563. void FAR* FAR* wav,
  2564. U32 FAR* wavsize,
  2565. AILLENGTHYCB callback);
  2566. DXDEC S32 AILCALL AIL_compress_ADPCM(AILSOUNDINFO FAR * info,
  2567. void FAR* FAR* outdata, U32 FAR* outsize);
  2568. DXDEC S32 AILCALL AIL_decompress_ADPCM(AILSOUNDINFO FAR * info,
  2569. void FAR* FAR* outdata, U32 FAR* outsize);
  2570. DXDEC S32 AILCALL AIL_compress_DLS(void FAR* dls,
  2571. char FAR* compression_extension,
  2572. void FAR* FAR* mls, U32 FAR* mlssize,
  2573. AILLENGTHYCB callback);
  2574. DXDEC S32 AILCALL AIL_merge_DLS_with_XMI(void FAR* xmi, void FAR* dls,
  2575. void FAR* FAR* mss, U32 FAR* msssize);
  2576. DXDEC S32 AILCALL AIL_extract_DLS( void FAR *source_image, //)
  2577. S32 source_size,
  2578. void FAR * FAR *XMI_output_data,
  2579. S32 FAR *XMI_output_size,
  2580. void FAR * FAR *DLS_output_data,
  2581. S32 FAR *DLS_output_size,
  2582. AILLENGTHYCB callback);
  2583. #define AILFILTERDLS_USINGLIST 1
  2584. DXDEC S32 AILCALL AIL_filter_DLS_with_XMI(void FAR* xmi, void FAR* dls,
  2585. void FAR* FAR* dlsout, U32 FAR* dlssize,
  2586. S32 flags, AILLENGTHYCB callback);
  2587. #define AILMIDITOXMI_USINGLIST 1
  2588. #define AILMIDITOXMI_TOLERANT 2
  2589. DXDEC S32 AILCALL AIL_MIDI_to_XMI (void FAR* MIDI,
  2590. U32 MIDI_size,
  2591. void FAR* FAR*XMIDI,
  2592. U32 FAR* XMIDI_size,
  2593. S32 flags);
  2594. #define AILMIDILIST_ROLANDSYSEX 1
  2595. #define AILMIDILIST_ROLANDUN 2
  2596. #define AILMIDILIST_ROLANDAB 4
  2597. DXDEC S32 AILCALL AIL_list_MIDI (void FAR* MIDI,
  2598. U32 MIDI_size,
  2599. char FAR* FAR* lst,
  2600. U32 FAR* lst_size,
  2601. S32 flags);
  2602. #define AILDLSLIST_ARTICULATION 1
  2603. #define AILDLSLIST_DUMP_WAVS 2
  2604. DXDEC S32 AILCALL AIL_list_DLS (void FAR* DLS,
  2605. char FAR* FAR* lst,
  2606. U32 FAR* lst_size,
  2607. S32 flags,
  2608. C8 FAR* title);
  2609. #define AILFILETYPE_UNKNOWN 0
  2610. #define AILFILETYPE_PCM_WAV 1
  2611. #define AILFILETYPE_ADPCM_WAV 2
  2612. #define AILFILETYPE_OTHER_WAV 3
  2613. #define AILFILETYPE_VOC 4
  2614. #define AILFILETYPE_MIDI 5
  2615. #define AILFILETYPE_XMIDI 6
  2616. #define AILFILETYPE_XMIDI_DLS 7
  2617. #define AILFILETYPE_XMIDI_MLS 8
  2618. #define AILFILETYPE_DLS 9
  2619. #define AILFILETYPE_MLS 10
  2620. #define AILFILETYPE_MPEG_L1_AUDIO 11
  2621. #define AILFILETYPE_MPEG_L2_AUDIO 12
  2622. #define AILFILETYPE_MPEG_L3_AUDIO 13
  2623. DXDEC S32 AILCALL AIL_file_type(void FAR* data, U32 size);
  2624. DXDEC S32 AILCALL AIL_find_DLS (void FAR* data, U32 size,
  2625. void FAR* FAR* xmi, U32 FAR* xmisize,
  2626. void FAR* FAR* dls, U32 FAR* dlssize);
  2627. #ifdef IS_WIN32
  2628. //
  2629. // Auxiliary 2D interface calls
  2630. //
  2631. DXDEC HDIGDRIVER AILCALL AIL_primary_digital_driver (HDIGDRIVER new_primary);
  2632. //
  2633. // Filter result codes
  2634. //
  2635. typedef S32 FLTRESULT;
  2636. #define FLT_NOERR 0 // Success -- no error
  2637. #define FLT_NOT_ENABLED 1 // FLT not enabled
  2638. #define FLT_ALREADY_STARTED 2 // FLT already started
  2639. #define FLT_INVALID_PARAM 3 // Invalid parameters used
  2640. #define FLT_INTERNAL_ERR 4 // Internal error in FLT driver
  2641. #define FLT_OUT_OF_MEM 5 // Out of system RAM
  2642. #define FLT_ERR_NOT_IMPLEMENTED 6 // Feature not implemented
  2643. #define FLT_NOT_FOUND 7 // FLT supported device not found
  2644. #define FLT_NOT_INIT 8 // FLT not initialized
  2645. #define FLT_CLOSE_ERR 9 // FLT not closed correctly
  2646. //############################################################################
  2647. //## ##
  2648. //## Interface "MSS pipeline filter" ##
  2649. //## ##
  2650. //############################################################################
  2651. typedef FLTRESULT (AILCALL FAR *FLT_STARTUP)(void);
  2652. typedef FLTRESULT (AILCALL FAR *FLT_SHUTDOWN)(void);
  2653. typedef C8 FAR * (AILCALL FAR *FLT_ERROR)(void);
  2654. typedef S32 (AILCALL FAR *FLT_SET_PROVIDER_PREFERENCE)(HATTRIB preference,
  2655. void FAR* value);
  2656. typedef HDRIVERSTATE (AILCALL FAR *FLT_OPEN_DRIVER) (HDIGDRIVER dig,
  2657. S32 FAR *build_buffer,
  2658. S32 build_buffer_size);
  2659. typedef FLTRESULT (AILCALL FAR *FLT_CLOSE_DRIVER) (HDRIVERSTATE state);
  2660. typedef void (AILCALL FAR *FLT_PREMIX_PROCESS) (HDRIVERSTATE driver);
  2661. typedef void (AILCALL FAR *FLT_POSTMIX_PROCESS) (HDRIVERSTATE driver);
  2662. //############################################################################
  2663. //## ##
  2664. //## Interface "Pipeline filter sample services" ##
  2665. //## ##
  2666. //############################################################################
  2667. typedef HSAMPLESTATE (AILCALL FAR * FLTSMP_OPEN_SAMPLE) (HDRIVERSTATE driver,
  2668. HSAMPLE S);
  2669. typedef FLTRESULT (AILCALL FAR * FLTSMP_CLOSE_SAMPLE) (HSAMPLESTATE state);
  2670. typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_PROCESS) (HSAMPLESTATE state,
  2671. void FAR * FAR *orig_src,
  2672. U32 FAR * orig_src_fract,
  2673. void FAR * orig_src_end,
  2674. S32 FAR * FAR *build_dest,
  2675. void FAR * build_dest_end,
  2676. S32 FAR * left_val,
  2677. S32 FAR * right_val,
  2678. S32 playback_ratio,
  2679. S32 left_scale,
  2680. S32 right_scale,
  2681. S32 base_scale,
  2682. MIXSTAGE FAR * mixer_provider,
  2683. U32 mixer_operation);
  2684. typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_ATTRIBUTE) (HSAMPLESTATE state,
  2685. HATTRIB attribute);
  2686. typedef S32 (AILCALL FAR * FLTSMP_SET_SAMPLE_PREFERENCE) (HSAMPLESTATE state,
  2687. HATTRIB preference,
  2688. void FAR* value);
  2689. //
  2690. // Pipeline filter calls
  2691. //
  2692. DXDEC S32 AILCALL AIL_enumerate_filters (HPROENUM FAR *next,
  2693. HPROVIDER FAR *dest,
  2694. C8 FAR * FAR *name);
  2695. DXDEC HDRIVERSTATE
  2696. AILCALL AIL_open_filter (HPROVIDER lib,
  2697. HDIGDRIVER dig);
  2698. DXDEC void AILCALL AIL_close_filter (HDRIVERSTATE filter);
  2699. DXDEC S32 AILCALL AIL_enumerate_filter_attributes
  2700. (HPROVIDER lib,
  2701. HINTENUM FAR * next,
  2702. RIB_INTERFACE_ENTRY FAR * dest);
  2703. DXDEC void AILCALL AIL_filter_attribute (HPROVIDER lib,
  2704. C8 FAR * name,
  2705. void FAR * val);
  2706. DXDEC void AILCALL AIL_set_filter_preference
  2707. (HPROVIDER lib,
  2708. C8 FAR * name,
  2709. void FAR * val);
  2710. DXDEC S32 AILCALL AIL_enumerate_filter_sample_attributes
  2711. (HPROVIDER lib,
  2712. HINTENUM FAR * next,
  2713. RIB_INTERFACE_ENTRY FAR * dest);
  2714. DXDEC void AILCALL AIL_filter_sample_attribute
  2715. (HSAMPLE S,
  2716. C8 FAR * name,
  2717. void FAR * val);
  2718. DXDEC void AILCALL AIL_filter_stream_attribute
  2719. (HSTREAM S,
  2720. C8 FAR * name,
  2721. void FAR * val);
  2722. DXDEC void AILCALL AIL_filter_DLS_attribute
  2723. (HDLSDEVICE dls,
  2724. C8 FAR * name,
  2725. void FAR * val);
  2726. DXDEC void AILCALL AIL_set_filter_sample_preference
  2727. (HSAMPLE S,
  2728. C8 FAR * name,
  2729. void FAR * val);
  2730. DXDEC void AILCALL AIL_set_filter_stream_preference
  2731. (HSTREAM S,
  2732. C8 FAR * name,
  2733. void FAR * val);
  2734. DXDEC void AILCALL AIL_set_filter_DLS_preference
  2735. (HDLSDEVICE dls,
  2736. C8 FAR * name,
  2737. void FAR * val);
  2738. typedef struct _FLTPROVIDER
  2739. {
  2740. PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute;
  2741. FLT_STARTUP startup;
  2742. FLT_ERROR error;
  2743. FLT_SHUTDOWN shutdown;
  2744. FLT_SET_PROVIDER_PREFERENCE set_provider_preference;
  2745. FLT_OPEN_DRIVER open_driver;
  2746. FLT_CLOSE_DRIVER close_driver;
  2747. FLT_PREMIX_PROCESS premix_process;
  2748. FLT_POSTMIX_PROCESS postmix_process;
  2749. FLTSMP_OPEN_SAMPLE open_sample;
  2750. FLTSMP_CLOSE_SAMPLE close_sample;
  2751. FLTSMP_SAMPLE_PROCESS sample_process;
  2752. FLTSMP_SAMPLE_ATTRIBUTE sample_attribute;
  2753. FLTSMP_SET_SAMPLE_PREFERENCE set_sample_preference;
  2754. HDIGDRIVER dig;
  2755. HPROVIDER provider;
  2756. HDRIVERSTATE driver_state;
  2757. struct _FLTPROVIDER FAR *next;
  2758. }
  2759. FLTPROVIDER;
  2760. //
  2761. // 3D provider calls
  2762. //
  2763. DXDEC S32 AILCALL AIL_enumerate_3D_providers (HPROENUM FAR *next,
  2764. HPROVIDER FAR *dest,
  2765. C8 FAR * FAR *name);
  2766. DXDEC M3DRESULT AILCALL AIL_open_3D_provider (HPROVIDER lib);
  2767. DXDEC void AILCALL AIL_close_3D_provider (HPROVIDER lib);
  2768. DXDEC S32 AILCALL AIL_enumerate_3D_provider_attributes
  2769. (HPROVIDER lib,
  2770. HINTENUM FAR * next,
  2771. RIB_INTERFACE_ENTRY FAR * dest);
  2772. DXDEC void AILCALL AIL_3D_provider_attribute (HPROVIDER lib,
  2773. C8 FAR * name,
  2774. void FAR * val);
  2775. DXDEC void AILCALL AIL_set_3D_provider_preference(HPROVIDER lib,
  2776. C8 FAR * name,
  2777. void FAR * val);
  2778. struct H3D
  2779. {
  2780. H3DPOBJECT actual;
  2781. HPROVIDER owner;
  2782. S32 user_data[8];
  2783. };
  2784. typedef struct _M3DPROVIDER
  2785. {
  2786. PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute;
  2787. M3D_STARTUP startup;
  2788. M3D_ERROR error;
  2789. M3D_SHUTDOWN shutdown;
  2790. M3D_SET_PROVIDER_PREFERENCE set_provider_preference;
  2791. M3D_ACTIVATE activate;
  2792. M3D_ALLOCATE_3D_SAMPLE_HANDLE allocate_3D_sample_handle;
  2793. M3D_RELEASE_3D_SAMPLE_HANDLE release_3D_sample_handle;
  2794. M3D_START_3D_SAMPLE start_3D_sample;
  2795. M3D_STOP_3D_SAMPLE stop_3D_sample;
  2796. M3D_RESUME_3D_SAMPLE resume_3D_sample;
  2797. M3D_END_3D_SAMPLE end_3D_sample;
  2798. M3D_SET_3D_SAMPLE_DATA set_3D_sample_data;
  2799. M3D_SET_3D_SAMPLE_VOLUME set_3D_sample_volume;
  2800. M3D_SET_3D_SAMPLE_PLAYBACK_RATE set_3D_sample_playback_rate;
  2801. M3D_SET_3D_SAMPLE_OFFSET set_3D_sample_offset;
  2802. M3D_SET_3D_SAMPLE_LOOP_COUNT set_3D_sample_loop_count;
  2803. M3D_SET_3D_SAMPLE_LOOP_BLOCK set_3D_sample_loop_block;
  2804. M3D_3D_SAMPLE_STATUS sample_status;
  2805. M3D_3D_SAMPLE_VOLUME sample_volume;
  2806. M3D_3D_SAMPLE_PLAYBACK_RATE sample_playback_rate;
  2807. M3D_3D_SAMPLE_OFFSET sample_offset;
  2808. M3D_3D_SAMPLE_LENGTH sample_length;
  2809. M3D_3D_SAMPLE_LOOP_COUNT sample_loop_count;
  2810. M3D_SET_3D_SAMPLE_DISTANCES set_3D_sample_distances;
  2811. M3D_3D_SAMPLE_DISTANCES sample_distances;
  2812. M3D_ACTIVE_3D_SAMPLE_COUNT active_3D_sample_count;
  2813. M3D_3D_OPEN_LISTENER open_listener;
  2814. M3D_3D_CLOSE_LISTENER close_listener;
  2815. M3D_3D_OPEN_OBJECT open_object;
  2816. M3D_3D_CLOSE_OBJECT close_object;
  2817. M3D_SET_3D_POSITION set_3D_position;
  2818. M3D_SET_3D_VELOCITY set_3D_velocity;
  2819. M3D_SET_3D_VELOCITY_VECTOR set_3D_velocity_vector;
  2820. M3D_SET_3D_ORIENTATION set_3D_orientation;
  2821. M3D_3D_POSITION position;
  2822. M3D_3D_VELOCITY velocity;
  2823. M3D_3D_ORIENTATION orientation;
  2824. M3D_3D_UPDATE_POSITION update_position;
  2825. M3D_3D_AUTO_UPDATE_POSITION auto_update_position;
  2826. M3D_3D_SAMPLE_ATTRIBUTE sample_query_attribute;
  2827. M3D_3D_SET_SAMPLE_PREFERENCE set_sample_preference;
  2828. } M3DPROVIDER;
  2829. //
  2830. // Sample calls
  2831. //
  2832. DXDEC H3DSAMPLE AILCALL AIL_allocate_3D_sample_handle
  2833. (HPROVIDER lib);
  2834. DXDEC void AILCALL AIL_release_3D_sample_handle
  2835. (H3DSAMPLE S);
  2836. DXDEC void AILCALL AIL_start_3D_sample (H3DSAMPLE S);
  2837. DXDEC void AILCALL AIL_stop_3D_sample (H3DSAMPLE S);
  2838. DXDEC void AILCALL AIL_resume_3D_sample (H3DSAMPLE S);
  2839. DXDEC void AILCALL AIL_end_3D_sample (H3DSAMPLE S);
  2840. DXDEC S32 AILCALL AIL_set_3D_sample_file (H3DSAMPLE S,
  2841. void FAR *file_image);
  2842. DXDEC S32 AILCALL AIL_set_3D_sample_info (H3DSAMPLE S,
  2843. AILSOUNDINFO FAR *info);
  2844. DXDEC void AILCALL AIL_set_3D_sample_volume (H3DSAMPLE S,
  2845. S32 volume);
  2846. DXDEC void AILCALL AIL_set_3D_sample_offset (H3DSAMPLE S,
  2847. U32 offset);
  2848. DXDEC void AILCALL AIL_set_3D_sample_playback_rate
  2849. (H3DSAMPLE S,
  2850. S32 playback_rate);
  2851. DXDEC void AILCALL AIL_set_3D_sample_loop_count(H3DSAMPLE S,
  2852. U32 loops);
  2853. DXDEC void AILCALL AIL_set_3D_sample_loop_block(H3DSAMPLE S,
  2854. S32 loop_start_offset,
  2855. S32 loop_end_offset);
  2856. DXDEC U32 AILCALL AIL_3D_sample_status (H3DSAMPLE S);
  2857. DXDEC S32 AILCALL AIL_3D_sample_volume (H3DSAMPLE S);
  2858. DXDEC U32 AILCALL AIL_3D_sample_offset (H3DSAMPLE S);
  2859. DXDEC S32 AILCALL AIL_3D_sample_playback_rate (H3DSAMPLE S);
  2860. DXDEC U32 AILCALL AIL_3D_sample_length (H3DSAMPLE S);
  2861. DXDEC U32 AILCALL AIL_3D_sample_loop_count (H3DSAMPLE S);
  2862. #define AIL_set_3D_sample_distances AIL_set_3D_sample_float_distances
  2863. #define AIL_3D_sample_distances AIL_3D_sample_float_distances
  2864. DXDEC void AILCALL AIL_set_3D_sample_float_distances
  2865. (H3DSAMPLE S,
  2866. F32 max_front_dist,
  2867. F32 min_front_dist,
  2868. F32 max_back_dist,
  2869. F32 min_back_dist);
  2870. DXDEC void AILCALL AIL_3D_sample_float_distances
  2871. (H3DSAMPLE S,
  2872. F32 FAR * max_front_dist,
  2873. F32 FAR * min_front_dist,
  2874. F32 FAR * max_back_dist,
  2875. F32 FAR * min_back_dist);
  2876. DXDEC S32 AILCALL AIL_active_3D_sample_count (HPROVIDER lib);
  2877. DXDEC S32 AILCALL AIL_enumerate_3D_sample_attributes
  2878. (HPROVIDER lib,
  2879. HINTENUM FAR * next,
  2880. RIB_INTERFACE_ENTRY FAR * dest);
  2881. DXDEC void AILCALL AIL_3D_sample_attribute (H3DSAMPLE samp,
  2882. C8 FAR * name,
  2883. void FAR * val);
  2884. DXDEC void AILCALL AIL_set_3D_sample_preference (H3DSAMPLE samp,
  2885. C8 FAR * name,
  2886. void FAR * val);
  2887. //
  2888. // Positioning-object allocation calls
  2889. //
  2890. DXDEC H3DPOBJECT AILCALL AIL_open_3D_listener (HPROVIDER lib);
  2891. DXDEC void AILCALL AIL_close_3D_listener (H3DPOBJECT listener);
  2892. DXDEC H3DPOBJECT AILCALL AIL_open_3D_object (HPROVIDER lib);
  2893. DXDEC void AILCALL AIL_close_3D_object (H3DPOBJECT obj);
  2894. //
  2895. // 3D object calls
  2896. //
  2897. DXDEC void AILCALL AIL_set_3D_position (H3DPOBJECT obj,
  2898. F32 X,
  2899. F32 Y,
  2900. F32 Z);
  2901. DXDEC void AILCALL AIL_set_3D_velocity (H3DPOBJECT obj,
  2902. F32 dX_per_ms,
  2903. F32 dY_per_ms,
  2904. F32 dZ_per_ms,
  2905. F32 magnitude);
  2906. DXDEC void AILCALL AIL_set_3D_velocity_vector (H3DPOBJECT obj,
  2907. F32 dX_per_ms,
  2908. F32 dY_per_ms,
  2909. F32 dZ_per_ms);
  2910. DXDEC void AILCALL AIL_set_3D_orientation (H3DPOBJECT obj,
  2911. F32 X_face,
  2912. F32 Y_face,
  2913. F32 Z_face,
  2914. F32 X_up,
  2915. F32 Y_up,
  2916. F32 Z_up);
  2917. DXDEC void AILCALL AIL_3D_position (H3DPOBJECT obj,
  2918. F32 FAR *X,
  2919. F32 FAR *Y,
  2920. F32 FAR *Z);
  2921. DXDEC void AILCALL AIL_3D_velocity (H3DPOBJECT obj,
  2922. F32 FAR *dX_per_ms,
  2923. F32 FAR *dY_per_ms,
  2924. F32 FAR *dZ_per_ms);
  2925. DXDEC void AILCALL AIL_3D_orientation (H3DPOBJECT obj,
  2926. F32 FAR *X_face,
  2927. F32 FAR *Y_face,
  2928. F32 FAR *Z_face,
  2929. F32 FAR *X_up,
  2930. F32 FAR *Y_up,
  2931. F32 FAR *Z_up);
  2932. DXDEC void AILCALL AIL_3D_update_position (H3DPOBJECT obj,
  2933. F32 dt_milliseconds);
  2934. DXDEC void AILCALL AIL_3D_auto_update_position (H3DPOBJECT obj,
  2935. S32 enable);
  2936. DXDEC void AILCALL AIL_set_3D_user_data (H3DPOBJECT obj,
  2937. U32 index,
  2938. S32 value);
  2939. DXDEC S32 AILCALL AIL_3D_user_data (H3DPOBJECT obj,
  2940. U32 index);
  2941. // Obsolete 3D function names:
  2942. #define AIL_set_3D_object_user_data AIL_set_3D_user_data
  2943. #define AIL_3D_object_user_data AIL_3D_user_data
  2944. #define AIL_3D_open_listener AIL_open_3D_listener
  2945. #define AIL_3D_close_listener AIL_close_3D_listener
  2946. #define AIL_3D_open_object AIL_open_3D_object
  2947. #define AIL_3D_close_object AIL_close_3D_object
  2948. //
  2949. // enumerated values for EAX
  2950. //
  2951. #ifndef EAX_H_INCLUDED
  2952. enum
  2953. {
  2954. EAX_ENVIRONMENT_GENERIC, // factory default
  2955. EAX_ENVIRONMENT_PADDEDCELL,
  2956. EAX_ENVIRONMENT_ROOM, // standard environments
  2957. EAX_ENVIRONMENT_BATHROOM,
  2958. EAX_ENVIRONMENT_LIVINGROOM,
  2959. EAX_ENVIRONMENT_STONEROOM,
  2960. EAX_ENVIRONMENT_AUDITORIUM,
  2961. EAX_ENVIRONMENT_CONCERTHALL,
  2962. EAX_ENVIRONMENT_CAVE,
  2963. EAX_ENVIRONMENT_ARENA,
  2964. EAX_ENVIRONMENT_HANGAR,
  2965. EAX_ENVIRONMENT_CARPETEDHALLWAY,
  2966. EAX_ENVIRONMENT_HALLWAY,
  2967. EAX_ENVIRONMENT_STONECORRIDOR,
  2968. EAX_ENVIRONMENT_ALLEY,
  2969. EAX_ENVIRONMENT_FOREST,
  2970. EAX_ENVIRONMENT_CITY,
  2971. EAX_ENVIRONMENT_MOUNTAINS,
  2972. EAX_ENVIRONMENT_QUARRY,
  2973. EAX_ENVIRONMENT_PLAIN,
  2974. EAX_ENVIRONMENT_PARKINGLOT,
  2975. EAX_ENVIRONMENT_SEWERPIPE,
  2976. EAX_ENVIRONMENT_UNDERWATER,
  2977. EAX_ENVIRONMENT_DRUGGED,
  2978. EAX_ENVIRONMENT_DIZZY,
  2979. EAX_ENVIRONMENT_PSYCHOTIC,
  2980. EAX_ENVIRONMENT_COUNT // total number of environments
  2981. };
  2982. #define EAX_REVERBMIX_USEDISTANCE (-1.0F)
  2983. #endif
  2984. #else
  2985. typedef struct _FLTPROVIDER
  2986. {
  2987. U32 junk;
  2988. } FLTPROVIDER;
  2989. #endif
  2990. #ifdef __cplusplus
  2991. }
  2992. #endif
  2993. #ifdef _PUSHPOP_SUPPORTED
  2994. #pragma pack(pop)
  2995. #else
  2996. #pragma pack()
  2997. #endif
  2998. #endif