home *** CD-ROM | disk | FTP | other *** search
/ Audio 4.94 - Over 11,000 Files / audio-11000.iso / mac / soundutl / vmtrs10s.hqx / VUMeters / Sources / SoundMonitor.h < prev    next >
Text File  |  1993-08-05  |  3KB  |  95 lines

  1. /*
  2.  *                  ARTA VUMeters for Macintosh
  3.  *                      Malcolm Slaney
  4.  *                 Advanced Technology Group
  5.  *                Apple Computer, Inc.
  6.  *                 malcolm@apple.com
  7.  *                     1992-1993
  8.  *
  9.  *    Warranty Information
  10.  *    Even though Apple has reviewed this software, Apple makes no warranty
  11.  *    or representation, either express or implied, with respect to this
  12.  *    software, its quality, accuracy, merchantability, or fitness for a 
  13.  *    particular purpose.  As a result, this software is provided "as is,"
  14.  *    and you, its user, are assuming the entire risk as to its quality
  15.  *    and accuracy.
  16.  *
  17.  *    Copyright (c) 1992-1993 by Apple Computer, Inc
  18.  *        All Rights Reserved.
  19.  */
  20.  
  21. /* SoundMonitor.h */
  22.  
  23. #ifndef SoundMonitor_h
  24. #define SoundMonitor_h
  25.  
  26. /*
  27.  *    NOTE...the DSP defines and the structure that follow MUST agree exactly.
  28.  *    They form the parameter blocks that are used to communicate between the 
  29.  *    DSP system and the host.  This parameter block will reside in main memory.
  30.  *    The DSP system will update the level variables during every frame (assuming 
  31.  *    that the the monitorLeft/monitorRight variables are nonzero).
  32.  */
  33. #ifdef    DSPCOMPILE
  34. monitorLeft:    int    0            /* Monitor Left Channel? */
  35. monitorRight:    int    0            /* Monitor Right Channel? */
  36. fastLeftLevel:    float    0.0            /* Left level without dynamics */
  37. fastRightLevel:    float    0.0            /* Right level without dynamics */
  38. slowLeftLevel:    float    0.0            /* Left level with meter dynamics */
  39. slowRightLevel:    float    0.0            /* Right level with meter dynamics */
  40. decayRate:    float    0.5            /* Meter Dynamics Decay Factor */
  41. frameScale:    float    1.0
  42.  
  43. #else
  44.  
  45. struct DSPMonitorParmStruct {
  46.     long    monitorLeft, monitorRight;    /* Monitor this channel? */
  47.     float    fastLeftLevel, fastRightLevel;    /* Level without meter dynamics */
  48.     float    slowLeftLevel, slowRightLevel;    /* Level with (slow) meter dynamics */
  49.     float    decayRate;            /* Meter Dynamics Decay Factor */
  50.     float    frameScale;            /* Scale Frame by this number */
  51. };
  52.  
  53.                         /* Define error conditions */
  54. #define NO_ERROR 0
  55. #define ERROR -1
  56.  
  57. #define FALSE 0
  58. #define TRUE 1
  59.  
  60. #define SMGetFastLevelsPtr(monitor) &((monitor)->dspParms->fastLeftLevel)
  61. #define SMGetSlowLevelsPtr(monitor) &((monitor)->dspParms->slowLeftLevel)
  62.  
  63. #define    SMMaxSetDecayRate(monitor,x) ((monitor)->dspParms->decayRate)=(x)
  64. #define    SMMaxSetScaleFactor(monitor,x) ((monitor)->dspParms->frameScale)=(x)
  65.  
  66.                         /* Monitor input or output */
  67. #define SMMonitorInput 0
  68. #define SMMonitorOutput 1
  69.  
  70.                         /* SMSetChannel Command Numbers */
  71. enum SMSetChannelParm {
  72.     SMChannelOff, SMChannelOn, SMChannelDontChange, 
  73.     SMChannelAddClient, SMChannelRemoveClient};
  74.  
  75. typedef struct DSPMonitorRecStruct {
  76.     DSPTaskRefNum            taskRef;    /* How do I refer to this task? */
  77.     struct DSPMonitorParmStruct    *dspParms;    /* Pointer to common variables */
  78.     StringPtr              typeName;    /* What type of task (power or peak) */
  79.     long                streamLocation;    /* Input or output stream? */
  80.     short                taskActive;    /* Is this task active */
  81. }  DSPMonitorRec, *DSPMonitor;
  82.  
  83. SoundStream        SMOpenDSPSoundStream();
  84. DSPCPUDeviceParamBlkPtr    SMOpenDSP3210(SoundStream sound_stream);
  85. long            SMCloseDSP3210(DSPCPUDeviceParamBlkPtr pblock);
  86. DSPMonitor        SMCreateDSPMonitor(DSPCPUDeviceParamBlkPtr ppblock,
  87.                                         SoundStream sound_stream,
  88.                                         StringPtr typeName,
  89.                                         long streamLocation);
  90. #endif    /* DSPCOMPILE */
  91.  
  92.  
  93. #endif    /* SoundMonitor_h */
  94.  
  95.