home *** CD-ROM | disk | FTP | other *** search
/ Amiga Dream 59 / CDDream59.ISO / BeOs / Sound / Intel / PPBeDevKit.ZIP / PLAYERPR.TAR / PlayerPRO / Source / PPPlug.h < prev    next >
C/C++ Source or Header  |  1998-12-26  |  10KB  |  263 lines

  1. /********************                        ***********************/
  2. //
  3. //    Player PRO 5.0 - DRIVER SOURCE CODE -
  4. //
  5. //    Library Version 5.0
  6. //
  7. //    To use with MAD Library for Mac: Symantec, CodeWarrior and MPW
  8. //
  9. //    Antoine ROSSET
  10. //    16 Tranchees
  11. //    1206 GENEVA
  12. //    SWITZERLAND
  13. //
  14. //    COPYRIGHT ANTOINE ROSSET 1996, 1997, 1998
  15. //
  16. //    Thank you for your interest in PlayerPRO !
  17. //
  18. //    FAX:                (+41 22) 346 11 97
  19. //    PHONE:             (+41 79) 203 74 62
  20. //    Internet:     RossetAntoine@bluewin.ch
  21. //
  22. /********************                        ***********************/
  23.  
  24. #ifndef __PPPLUGH__
  25. #define __PPPLUGH__
  26.  
  27. #ifndef __RDRIVERH__
  28. #include "RDriver.h"
  29. #endif
  30.  
  31. #if defined(powerc) || defined (__powerc)
  32. #pragma options align=mac68k
  33. #else
  34. #if !defined(THINK_C)
  35. #pragma options align=mac68k
  36. #endif
  37. #endif
  38.  
  39. /******************************************************************/
  40. //    *****************    FILTERS FOR SAMPLES/SOUNDS    ***************/
  41. //
  42. //    Your main function have to be in this form:
  43. //    OSErr main(     sData                    *theData,                    // Sample informations, see MAD.h
  44. //                    long                    SelectionStart,                // SelectionStart 
  45. //                    long                    SelectionEnd,                // SelectionEnd, your filter SHOULD apply his effect only on the selection
  46. //                    PPInfoPlug                *thePPInfoPlug                // Some functions of PlayerPRO that you can use in your plugs
  47. //                    short                    stereoMode)                    // StereoMode, see 'Silence.c' example
  48. //
  49. //    *****************                        ***********************/
  50. //
  51. //    If you want to reallocate theData or theData->data:
  52. //    
  53. //    if( theData->data != 0L) DisposPtr( theData->data);        // VERY IMPORTANT to free memory
  54. //    theData->data = NewPtr( newsize);                        // Use NewPtr ONLY to allocate memory!
  55. //    
  56. //    theData->size = newsize;                                // In bytes !! Even for 16 bits !
  57. //    
  58. //    Don't forget to UPDATE the theData->size !!!!!!!!!!!!
  59. //
  60. //    *****************                        ***********************/
  61. //
  62. //    About Resources:
  63. //
  64. //    Your Plug should have: Creator: 'SNPL', Type: 'PLug'
  65. //
  66. //    Your Plug have to have these resources:
  67. //
  68. //    - One resource CODE 1000 with 68k Code  ** You should NOT use the 68881 coprocessor **
  69. //    - One resource PPCC 1000 with PPC Code  (OPTIONAL: if PlayerPRO PPC version cannot find it, it will use the CODE 1000 68k resource)
  70. //    - One STR# resource :
  71. //
  72. //        1 string: Menu Name (see Instrument window in PlayerPRO)
  73. //
  74. /********************                        ***********************/
  75.  
  76. typedef struct
  77. {
  78.     void        *RPlaySoundUPP;            //    OSErr            RPlaySound( Ptr whichSound, long SoundSize, long whichTrack, long Period, long Amplitude, long loopStart, long loopLength)
  79.     void        *UpdateALLWindowUPP;    //    void            UpdateALLWindow( void)
  80.     void        *MyDlgFilterUPP;        //    pascal Boolean    MyDlgFilter( DialogPtr theDlg, EventRecord *theEvt, short *itemHit)
  81.     
  82. } PPInfoPlug;
  83.  
  84. typedef OSErr            (*RPlaySoundUPP)        ( Ptr, long, long, long, long, long, long, unsigned long, Boolean);
  85. typedef void            (*UpdateALLWindowUPP)    ( void);
  86. typedef pascal Boolean    (*MyDlgFilterUPP)        ( DialogPtr, EventRecord*, short*);
  87.  
  88.  
  89. #if defined(powerc) || defined(__powerc)
  90.  
  91. #include "mixedmode.h"
  92.  
  93.         /****** POWERPC calls *********/
  94.  
  95. #define         RPlaySoundCallMode (    kCStackBased|\
  96.                 RESULT_SIZE( SIZE_CODE( sizeof(OSErr) ))|\
  97.                 STACK_ROUTINE_PARAMETER( 1, SIZE_CODE( sizeof( Ptr)))|\
  98.                 STACK_ROUTINE_PARAMETER( 2, SIZE_CODE( sizeof( long)))|\
  99.                 STACK_ROUTINE_PARAMETER( 3, SIZE_CODE( sizeof( long)))|\
  100.                 STACK_ROUTINE_PARAMETER( 4, SIZE_CODE( sizeof( long)))|\
  101.                 STACK_ROUTINE_PARAMETER( 5, SIZE_CODE( sizeof( long)))|\
  102.                 STACK_ROUTINE_PARAMETER( 6, SIZE_CODE( sizeof( long)))|\
  103.                  STACK_ROUTINE_PARAMETER( 7, SIZE_CODE( sizeof( long)))|\
  104.                  STACK_ROUTINE_PARAMETER( 8, SIZE_CODE( sizeof( unsigned long)))|\
  105.                  STACK_ROUTINE_PARAMETER( 9, SIZE_CODE( sizeof( Boolean))))
  106.                  
  107. #define CallRPlaySoundUPP( v1, v2, v3, v4, v5, v6, v7, v8, v9)        \
  108.         CallUniversalProc( thePPInfoPlug->RPlaySoundUPP, RPlaySoundCallMode, v1, v2, v3, v4, v5, v6, v7, v8, v9)
  109.  
  110. /**/
  111.  
  112. #define UpdateALLWindowCallMode (    kCStackBased)
  113.  
  114. #define CallUpdateALLWindowUPP()        \
  115.         CallUniversalProc( thePPInfoPlug->UpdateALLWindowUPP, UpdateALLWindowCallMode)
  116.  
  117. /**/
  118.  
  119. #else    /******** 68K calls ***********/
  120.  
  121. #define CallRPlaySoundUPP( v1, v2, v3, v4, v5, v6, v7, v8, v9)        \
  122.         (* (RPlaySoundUPP) (thePPInfoPlug->RPlaySoundUPP))( v1, v2, v3, v4, v5, v6, v7, v8, v9)
  123.  
  124. /**/
  125.  
  126. #define CallUpdateALLWindowUPP()        \
  127.         (* (UpdateALLWindowUPP) (thePPInfoPlug->UpdateALLWindowUPP))
  128.  
  129. /**/
  130. #endif
  131.  
  132. /********************                        ***********************/
  133. //
  134. //
  135. // RPlaySoundUPP    : See Developper Toolkit documentation. Play a SoundPtr at a specific Period by using PlayerPRO Driver.
  136. // UpdateALLWindow    : Check all PlayerPRO windows and update them if need it.
  137. // MyDlgFilterUPP    : to use with a ModalDialog function: allow movable dialog, PlayerPRO windows updating, Item 1 Frame, Copy/Paste support, Key support
  138. //
  139. //
  140. /********************                        ***********************/
  141.  
  142.  
  143. /******************************************************************/
  144. //******************* DIGITAL EDITOR PLUGS  ***********************/
  145. //
  146. //    Your main function have to be in this form:
  147. //    OSErr main(     Pcmd                    *Pcmd,                        // Digital Selection
  148. //                    PPInfoPlug                *thePPInfoPlug)                // Some functions of PlayerPRO that you can use in your plugs
  149. //
  150. //
  151. //    *****************                        ***********************/
  152. //
  153. //    If you want to reallocate Pcmd:
  154. //    
  155. //    if( Pcmd != 0L) DisposPtr( (Ptr) Pcmd);                            // VERY IMPORTANT
  156. //    Pcmd = NewPtrClear( sizeof( Pcmd) + noCell * sizeof( Cmd));        // Use NewPtr ONLY to allocate memory!
  157. //
  158. //    myPcmd->structSize     = sizeof( Pcmd) + noCell * sizeof( Cmd);
  159. //    
  160. //    Don't forget to UPDATE the myPcmd->structSize !!!!!!!!!!!!
  161. //
  162. //    *****************                        ***********************/
  163. //
  164. //    About Resources:
  165. //
  166. //    Your Plug should have: Creator: 'SNPL', Type: 'PPDG'
  167. //
  168. //    Your Plug have to have these resources:
  169. //
  170. //    - One resource CODE 1000 with 68k Code  ** You should NOT use the 68881 coprocessor **
  171. //    - One resource PPCC 1000 with PPC Code  (OPTIONAL: if PlayerPRO in PPC cannot find it, it will use the CODE 1000 resource)
  172. //    - One STR# resource :
  173. //
  174. //        1 string: Menu Name (see Button in Digital Editor window in PlayerPRO)
  175. //
  176. /********************                        ***********************/
  177.  
  178. typedef struct
  179. {
  180.     short            tracks;                    // number of tracks in myCmd[]
  181.     short            length;                    // number of rows in myCmd[]
  182.     short            trackStart;                // track ID of first track in myCmd[]
  183.     short            posStart;                // row ID of first row in myCmd[]
  184.     long            structSize;                // struct size in bytes - see Definition
  185.     Cmd                myCmd[];
  186. } Pcmd;
  187.  
  188. /******************************************************************/
  189. //******************* INSTRUMENTS IMPORT/EXPORT PLUGS  ************/
  190. //
  191. //    Your main function have to be in this form:
  192. //    OSErr main(     OSType                    order,                        // Order to execute
  193. //                    InstrData                *InsHeader,                    // Ptr on instrument header
  194. //                    sData                    **sample,                    // Ptr on samples data
  195. //                    short                    *sampleID,                    // If you need to replace/add only a sample, not replace the entire instrument (by example for 'AIFF' sound)
  196. //                                                                        // If sampleID == -1 : add sample else replace selected sample.
  197. //                    FSSpec                    *AlienFile,                    // IN/OUT file
  198. //                    PPInfoPlug                *thePPInfoPlug)                // Some functions of PlayerPRO that you can use in your plugs
  199. //
  200. //
  201. //    *****************                        ***********************/
  202. //    Actual plug have to support these orders:
  203. //
  204. //    order: 'TEST':    check the AlienFile to see if your Plug really supports it.
  205. //    order: 'IMPT':    convert the AlienFile into a PlayerPRO instrument. You have to allocate/dispose your sData*. NOT InsHeader!
  206. //    order: 'EXPT':    Convert current instrument&samples into a file.
  207. //    order: 'PLAY':    Play the sound file at base note via PlayerPRO driver in SYNC.
  208. //    *****************                        ***********************/
  209. //
  210. //    About Resources:
  211. //
  212. //    Your Plug should have: Creator: 'SNPL', Type: 'PPIN'
  213. //
  214. //    Your Plug have to have these resources:
  215. //
  216. //    - One resource CODE 1000 with 68k Code  ** You should NOT use the 68881 coprocessor **
  217. //    - One resource PPCC 1000 with PPC Code  (OPTIONAL: if PlayerPRO in PPC cannot find it, it will use the CODE 1000 resource)
  218. //    - One STR# resource :
  219. //
  220. //
  221. //        1 string: which kind of files your plug support (OSType value !!! 4 char) By example: 'WAVE', 'snd ', 'AIFF', etc...
  222. //        2 string: what does your Plug: EXPL : only Export files, IMPL : only Import Files, EXIM : import AND export.
  223. //        3 string: string that will be used in Import and Export menu of PlayerPRO
  224. //        4 string: Copyright string of this plug.
  225. //        5 string: Is it a sample or an instrument format? 'INST' or 'SAMP'
  226. //
  227. /********************                        ***********************/
  228.  
  229. OSErr    PPINImportFile( OSType    kindFile, short ins, short *samp, FSSpec    *AlienFile);
  230. OSErr    PPINTestFile( OSType    kindFile, FSSpec    *AlienFile);
  231. OSErr    PPINExportFile( OSType    kindFile, short ins, short samp, FSSpec    *AlienFile);
  232. OSType    PressPPINMenu( Rect    *PopUpRect, OSType curType, short, Str255);
  233. OSErr    PPINAvailablePlug( OSType    kindFile, OSType *plugType); // plugType == 'INST' or 'SAMP'
  234. OSErr    PPINGetPlugByID( OSType *type, short id, short samp);
  235.  
  236.  
  237. // SndUtils.c Definition :
  238.  
  239. Ptr     MyExp1to6( Ptr sound, unsigned long numSampleFrames);
  240. Ptr     MyExp1to3( Ptr sound, unsigned long numSampleFrames);
  241. void     ConvertInstrumentIn( register    Byte    *tempPtr,    register long sSize);
  242. OSErr inAddSoundToMAD(    Ptr                theSound,
  243.                         long            lS,
  244.                         long            lE,
  245.                         short            sS,
  246.                         short            bFreq,
  247.                         unsigned long    rate,
  248.                         Boolean            stereo,
  249.                         Str255            name,
  250.                         InstrData        *InsHeader,                    // Ptr on instrument header
  251.                         sData            **sample,                    // Ptr on samples data
  252.                         short            *sampleID);
  253. sData    * inMADCreateSample();
  254.  
  255.  
  256. #if defined(powerc) || defined (__powerc)
  257. #pragma options align=reset
  258. #else
  259. #if !defined(THINK_C)
  260. #pragma options align=reset
  261. #endif
  262. #endif
  263. #endif