home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / mm / admct / admcstat.c < prev    next >
C/C++ Source or Header  |  1999-05-11  |  24KB  |  710 lines

  1. /********************* START OF SPECIFICATIONS *********************
  2. *
  3. * SUBROUTINE NAME: MCISTAT.C
  4. *
  5. * DESCRIPTIVE NAME: Audio MCD status routine
  6. *
  7. *              Copyright (c) IBM Corporation  1991, 1993
  8. *                        All Rights Reserved
  9. *
  10. * FUNCTION: Get the status of several variables.
  11. *
  12. * NOTES: This source file illustrates the following concepts:
  13. *        A. When/If to report media position within a stream.
  14. *        B. How to determine the length of an existing file.
  15. *        C. How to determine the length of a file which is currently
  16. *           being recorded.
  17. *        D. Communicating with the amp/mixer to determine volume,
  18. *           and other amplifier specific commands.
  19. *        E. Reporting our current mode.
  20. *        F. Reporting the current time format.
  21. *
  22. *
  23. * INTERNAL REFERENCES:
  24. *                        ConvertTimeUnits ().
  25. *                        ConVertToMM
  26. *                        SetAudioDevice().
  27. *                        SetWaveDeviceDefaults().
  28. *                        CheckMem ().
  29. *
  30. * EXTERNAL REFERENCES:
  31. *                        SpiGetTime       ()        - MME API
  32. *                        mciSendCommand   ()        - MME API
  33. *
  34. *********************** END OF SPECIFICATIONS **********************/
  35.  
  36.  
  37. #define INCL_BASE                       // Base Dos APIs.
  38. #define INCL_ERRORS                     // All the errors.
  39. #define INCL_WINCLIPBOARD
  40. #define INCL_WINWINDOWMGR
  41. #define INCL_DOSSEMAPHORES
  42. #define INCL_DOSPROCESS
  43. #define INCL_ERRORS
  44. #define INCL_WINATOM
  45. #define INCL_HEAP
  46. #define INCL_DOSMEMMGR
  47.  
  48.  
  49. #include <os2.h>                        // OS2 includes.
  50. #include <string.h>                     // String Functions
  51. #include <math.h>                       // Math Functions
  52. #include <os2medef.h>                   // MME includes files.
  53. #include <ssm.h>                        // SSM spi includes.
  54. #include <meerror.h>                    // MM Error Messages.
  55. #include <mmioos2.h>                    // MMIO Include.
  56. #include <mcios2.h>                     // MM System Include.
  57. #include <mmdrvos2.h>                   // Mci Driver include.
  58. #include <mcd.h>                        // AUDIO IF DriverInterface.
  59. #include <hhpheap.h>                    // Heap Manager Definitions.
  60. #include <qos.h>
  61. #include <audiomcd.h>                   // Component Definitions.
  62. #include <admcfunc.h>                   // Function Prototypes
  63. #include <checkmem.h>
  64.  
  65. /********************* START OF SPECIFICATIONS *******************************
  66. *
  67. * SUBROUTINE NAME: MCISTAT.C
  68. *
  69. * DESCRIPTIVE NAME: Waveform Status Routine.
  70. *
  71. * FUNCTION: Get Current Status of an Waveform Instance.
  72. *
  73. * NOTES: After the status is obtained from the device specific DLL
  74. *        the corresponding field in the instance structure is updated
  75. *        to reflect the most recent state.
  76. *
  77. * ENTRY POINTS:
  78. *     LINKAGE:   CALL FAR
  79. *
  80. * INPUT:
  81. *
  82. * EXIT-NORMAL: Return Code 0.
  83. *
  84. * EXIT_ERROR:  Error Code.
  85. *
  86. * EFFECTS:
  87. *
  88. * INTERNAL REFERENCES: VSDIDriverEntry().
  89. *
  90. * EXTERNAL REFERENCES: DosQueryProcAddr - OS/2 API.
  91. *
  92. *********************** END OF SPECIFICATIONS *******************************/
  93.  
  94. RC MCIStat (FUNCTION_PARM_BLOCK *pFuncBlock)
  95.  
  96. {
  97.  
  98.   ULONG               ulrc;                // Error Value
  99.   ULONG               ulParam1;            // MCI Msg Flags
  100.   ULONG               ulFormatInfo = 0;    // Format of Clipboard data
  101.   INSTANCE*           ulpInstance;         // Local Instance
  102.   ULONG               ulTemp1;             // Temporary Stuff
  103.   ULONG               ulTemp2;             // Temporary Stuff
  104.   ULONG               ulStatFlags;         // Mask For Incoming Flags
  105.  
  106.   PMCI_STATUS_PARMS   pParams;             // Msg Data Ptr
  107.  
  108.   HAB            habClipboard;
  109.  
  110.   /* Derefernce pointers */
  111.  
  112.   ulParam1    = pFuncBlock->ulParam1;
  113.   pParams     = (PMCI_STATUS_PARMS) pFuncBlock->ulParam2;
  114.   ulpInstance = (INSTANCE *) pFuncBlock->ulpInstance;
  115.  
  116.   /*********************************************
  117.   * Mask out only flags that this MCD supports.
  118.   **********************************************/
  119.   ulStatFlags = ulParam1;
  120.  
  121.   ulStatFlags &= ~ (MCI_STATUS_ITEM + MCI_TRACK + MCI_WAIT + MCI_NOTIFY + MCI_STATUS_START );
  122.  
  123.   /**********************************
  124.   * Return error if caller passed in
  125.   * a flag we do not support.
  126.   ***********************************/
  127.  
  128.   if (ulStatFlags > 0 )
  129.      {
  130.      return ( MCIERR_INVALID_FLAG );
  131.      }
  132.  
  133.   /*******************************************
  134.   * The caller is required to pass in valid
  135.   * status parms--verify that this is true.
  136.   ********************************************/
  137.  
  138.   ulrc = CheckMem ( (PVOID)pParams,
  139.                     sizeof (MCI_STATUS_PARMS),
  140.                     PAG_READ);
  141.  
  142.   if (ulrc != MCIERR_SUCCESS)
  143.           return ( MCIERR_MISSING_PARAMETER );
  144.  
  145.   /* This MCD does not support the track flag */
  146.  
  147.   if (ulParam1 & MCI_TRACK)
  148.       return ( MCIERR_UNSUPPORTED_FLAG );
  149.  
  150.  
  151.   /*****************************************************************
  152.   * The waveaudio MCD only supports status requests with the
  153.   * STATUS_ITEM flag set.  All other requests will return an error
  154.   *****************************************************************/
  155.  
  156.   if (ulParam1 & MCI_STATUS_ITEM )
  157.     {
  158.  
  159.     switch (pParams->ulItem)
  160.       {
  161.       /* the caller wants to know the current media position */
  162.       case MCI_STATUS_POSITION_IN_TRACK:
  163.       case MCI_STATUS_POSITION:
  164.           {
  165.           if ( ulParam1 & MCI_STATUS_START )
  166.              {
  167.              pParams->ulReturn = 0;  // No Stream Alive
  168.              }
  169.           else
  170.              {
  171.              /********************************************
  172.              * If a stream has been previously created,
  173.              * then determine our position within the
  174.              * stream. If no stream has been created, (i.e.
  175.              * a file has been loaded, however, there has
  176.              * been actions after that.
  177.              **********************************************/
  178.    
  179.              if (ulpInstance->ulCreateFlag != CREATE_STATE )
  180.                 {
  181.                 STREAM.mmStreamTime = 0;
  182.    
  183.                 /********************************************
  184.                 * Query the stream for current stream time
  185.                 *********************************************/
  186.    
  187.                 ulrc = SpiGetTime ( STREAM.hStream,
  188.                                     (PMMTIME) &STREAM.mmStreamTime);
  189.                 if (!ulrc)
  190.    
  191.                    /*******************************************
  192.                    * Convert MMTIME units to current time base
  193.                    ********************************************/
  194.                    {
  195.                    ConvertTimeUnits ( ulpInstance,
  196.                                       &ulTemp1,
  197.                                       (ULONG) STREAM.mmStreamTime);
  198.                    }
  199.    
  200.                 pParams->ulReturn = (ULONG) ulTemp1;
  201.                 }
  202.               else
  203.                 {
  204.                 pParams->ulReturn = 0;  // No Stream Alive
  205.                 }
  206.              } /* not status start */
  207.  
  208.            ulrc = MAKEULONG (ulrc, MCI_INTEGER_RETURNED);
  209.  
  210.           } /* case STATUS_POSITION */
  211.  
  212.           break;
  213.  
  214.       /* The caller wants to know the length of the file */
  215.  
  216.       case MCI_STATUS_LENGTH:
  217.            {
  218.  
  219.            /* if we have not loaded a file, it can't have a length! */
  220.  
  221.            if (ulpInstance->fFileExists == FALSE)
  222.                return (MCIERR_FILE_NOT_FOUND);
  223.  
  224.            /*************************************************
  225.            * Playlist cannot report lengths, since they can
  226.            * contain infinite loops.
  227.            *************************************************/
  228.  
  229.            if (ulpInstance->usPlayLstStrm == TRUE)
  230.                return (MCIERR_INDETERMINATE_LENGTH );
  231.  
  232.            /*********************************************
  233.            * There is a big difference between record and
  234.            * playback lengths.  In the case of play, the
  235.            * file length will not change.  However, if
  236.            * a record is active, the file length could
  237.            * potentially be growing.
  238.            **********************************************/
  239.  
  240.            if (ulpInstance->ulOperation == MCIDRV_OUTPUT )
  241.               {
  242.               ulrc = GetAudioHeader( ulpInstance, 0  );
  243.  
  244.               if ( ulrc )
  245.                  {
  246.                  return ( ulrc );
  247.                  }
  248.  
  249.               /******************************************
  250.               * the function ConvertTimeUnits also
  251.               * returns media element length in the
  252.               * current time units.
  253.               ******************************************/
  254.  
  255.               ConvertTimeUnits (ulpInstance, &ulTemp1, FILE_LENGTH);
  256.  
  257.               pParams->ulReturn = ulTemp1;
  258.  
  259.               } /* the card is in playback mode */
  260.  
  261.            /* else if the card is in record mode */
  262.  
  263.            else
  264.               {
  265.               /* Test and see if the stream has been prerolled */
  266.  
  267.               if (ulpInstance->ulCreateFlag == PREROLL_STATE)
  268.                    {
  269.                    /************************************
  270.                    * Are we currently recording?
  271.                    * (cue could preroll the stream also
  272.                    ************************************/
  273.  
  274.                    if ( STRMSTATE == MCI_RECORD || STRMSTATE == MCI_PAUSE )
  275.                       {
  276.                       ulrc = SpiGetTime ( STREAM.hStream,
  277.                                           ( PMMTIME)&STREAM.mmStreamTime);
  278.  
  279.                       if (!ulrc)
  280.                          {
  281.                          ulTemp2 = STREAM.mmStreamTime;
  282.                          }
  283.  
  284.                       ConvertTimeUnits (ulpInstance, &ulTemp1, ulTemp2);
  285.  
  286.                       /******************************************
  287.                       * the function ConvertTimeUnits also
  288.                       * returns media element length in the
  289.                       * current time units.
  290.                       ******************************************/
  291.                       ConvertTimeUnits (ulpInstance, &ulTemp2, FILE_LENGTH);
  292.  
  293.                       /******************************************
  294.                       * if the current record position is smaller
  295.                       * tham the file length, then report the
  296.                       * file length.
  297.                       ******************************************/
  298.                       if ( ulTemp1 < ulTemp2 )
  299.                          {
  300.                          ulTemp1 = ulTemp2;
  301.                          }
  302.  
  303.                       pParams->ulReturn = ulTemp1;
  304.                       } /* if we are currently recording */
  305.                    else
  306.                       {
  307.                       ulrc = GetAudioHeader( ulpInstance, 0 );
  308.  
  309.                       if ( ulrc )
  310.                          {
  311.                          return ( ulrc );
  312.                          }
  313.  
  314.                       /******************************************
  315.                       * the function ConvertTimeUnits also
  316.                       * returns media element length in the
  317.                       * current time units.
  318.                       *******************************************/
  319.                       ConvertTimeUnits (ulpInstance, &ulTemp1, FILE_LENGTH);
  320.  
  321.                       pParams->ulReturn = ulTemp1;
  322.  
  323.                       } /* else we not are currently recording */
  324.  
  325.                    } /* Stream Created and Recording */
  326.  
  327.               /* The stream is not currently active */
  328.               else
  329.                  {
  330.                  ulrc = GetAudioHeader( ulpInstance, 0  );
  331.  
  332.                  if ( ulrc )
  333.                     {
  334.                     return ( ulrc );
  335.                     }
  336.  
  337.                   /******************************************
  338.                   * the function ConvertTimeUnits also
  339.                   * returns media element length in the
  340.                   * current time units.
  341.                   ******************************************/
  342.                   ConvertTimeUnits (ulpInstance, &ulTemp1, FILE_LENGTH);
  343.  
  344.                   pParams->ulReturn = ulTemp1;
  345.  
  346.                  } /* else we are not currently recording */
  347.  
  348.               } /* else we are in record mode */
  349.  
  350.            ulrc = MAKEULONG (ulrc, MCI_INTEGER_RETURNED);
  351.  
  352.            } /* status length */
  353.  
  354.            break;
  355.  
  356.  
  357.  
  358.       case MCI_STATUS_CURRENT_TRACK:
  359.       case MCI_STATUS_NUMBER_OF_TRACKS:
  360.              pParams->ulReturn = 1;
  361.              ulrc = MAKEULONG (ulrc, MCI_INTEGER_RETURNED);
  362.              break;
  363.  
  364.  
  365.       case MCI_STATUS_SPEED_FORMAT:
  366.  
  367.             return ( MCIERR_UNSUPPORTED_FLAG );
  368.  
  369.       /******************************************************
  370.       * For status volume, and of the amp commands should
  371.       * go the amp/mixer that we are connected to.
  372.       ******************************************************/
  373.  
  374.       case MCI_STATUS_VOLUME:
  375.             {
  376. // CONNECTOR FEATURE--check if amp is there
  377. #ifdef CONNECTION
  378.             if ( ulpInstance->fConnected )
  379. #endif
  380.                {
  381.                /********************************
  382.                * It is possbile that although we
  383.                * are connected, there is no amp
  384.                * in the network to forward the
  385.                * command to (i.e. cd->wave).
  386.                * Check to make sure.
  387.                *********************************/
  388. #ifdef CONNECTION
  389.  
  390.                ulrc = FindAmp( ulpInstance);
  391.                if ( ulrc )
  392.                   {
  393.                   return (ulrc);
  394.                   }
  395. #endif
  396.                ulrc = mciSendCommand ( ulpInstance->usAmpDeviceID,
  397.                                        MCI_STATUS,
  398.                                        MCI_STATUS_ITEM | MCI_WAIT,
  399.                                        (PVOID) pParams,
  400.                                        pFuncBlock->usUserParm);
  401.                ulrc = MAKEULONG (ulrc, MCI_COLONIZED2_RETURN);
  402.                }
  403. #ifdef CONNECTION
  404.             else
  405.                {
  406.                ulrc = MCIERR_NO_CONNECTION;
  407.                }
  408. #endif
  409. // CONNECTOR FEATURE--check if amp is there
  410.             } /* case status volume */
  411.           break;
  412.       case MCI_AMP_STATUS_BALANCE:
  413.       case MCI_AMP_STATUS_BASS   :
  414.       case MCI_AMP_STATUS_TREBLE :
  415.       case MCI_AMP_STATUS_GAIN   :
  416. // CONNECTOR FEATURE--check if amp is there
  417. #ifdef CONNECTION
  418.             if ( ulpInstance->fConnected )
  419. #endif
  420.                {
  421.  
  422.  
  423.  
  424.                /********************************
  425.                * It is possbile that although we
  426.                * are connected, there is no amp
  427.                * in the network to forward the
  428.                * command to (i.e. cd->wave).
  429.                * Check to make sure.
  430.                *********************************/
  431. #ifdef CONNECTION
  432.  
  433.                ulrc = FindAmp( ulpInstance);
  434.                if ( ulrc )
  435.                   {
  436.                   return (ulrc);
  437.                   }
  438. #endif
  439.  
  440.                ulrc = mciSendCommand ( ulpInstance->usAmpDeviceID,
  441.                                        MCI_STATUS,
  442.                                        MCI_STATUS_ITEM | MCI_WAIT,
  443.                                        (PVOID) pParams,
  444.                                        pFuncBlock->usUserParm );
  445.                ulrc = MAKEULONG (ulrc, MCI_INTEGER_RETURNED );
  446.                }
  447. #ifdef CONNECTION
  448.             else
  449.                {
  450.                ulrc = MCIERR_NO_CONNECTION;
  451.                }
  452. #endif
  453. // CONNECTOR FEATURE--check if amp is there
  454.  
  455.           break;
  456.  
  457.       case MCI_WAVE_STATUS_CHANNELS:
  458.             if ( ulpInstance->ulRealTimeTranslation ==MMIO_REALTIME )
  459.                {
  460.                pParams->ulReturn =
  461.                   ulpInstance->mmRealHeader.mmXWAVHeader.WAVEHeader.usChannels;
  462.                }
  463.             else
  464.                {
  465.                pParams->ulReturn = ulpInstance->mmAudioHeader.mmXWAVHeader.WAVEHeader.usChannels;
  466.                }
  467.             ulrc = MAKEULONG (ulrc, MCI_INTEGER_RETURNED);
  468.  
  469.           break;
  470.  
  471.       case MCI_WAVE_STATUS_SAMPLESPERSEC:
  472.             if ( ulpInstance->ulRealTimeTranslation ==MMIO_REALTIME )
  473.                {
  474.                pParams->ulReturn =
  475.                   ulpInstance->mmRealHeader.mmXWAVHeader.WAVEHeader.ulSamplesPerSec;
  476.                }
  477.             else
  478.                {
  479.                pParams->ulReturn =
  480.                   ulpInstance->mmAudioHeader.mmXWAVHeader.WAVEHeader.ulSamplesPerSec;
  481.                }
  482.             ulrc = MAKEULONG (ulrc, MCI_INTEGER_RETURNED);
  483.  
  484.           break;
  485.  
  486.       case MCI_WAVE_STATUS_AVGBYTESPERSEC:
  487.  
  488.              pParams->ulReturn = ulpInstance->ulAverageBytesPerSec;
  489.  
  490.              ulrc = MAKEULONG (ulrc, MCI_INTEGER_RETURNED);
  491.  
  492.           break;
  493.  
  494.       case MCI_WAVE_STATUS_BITSPERSAMPLE:
  495.             if ( ulpInstance->ulRealTimeTranslation ==MMIO_REALTIME )
  496.                {
  497.                pParams->ulReturn =
  498.                   ulpInstance->mmRealHeader.mmXWAVHeader.WAVEHeader.usBitsPerSample;
  499.                }
  500.             else
  501.                {
  502.                pParams->ulReturn =
  503.                   ulpInstance->mmAudioHeader.mmXWAVHeader.WAVEHeader.usBitsPerSample;
  504.                }
  505.             ulrc = MAKEULONG (ulrc, MCI_INTEGER_RETURNED);
  506.           break;
  507.  
  508.       case MCI_STATUS_CLIPBOARD :
  509.  
  510.          habClipboard = WinQueryAnchorBlock( HWND_DESKTOP );
  511.  
  512.          /*********************************************************************
  513.          * Check to see if there is a wave ( CF_WAVE is the defined type) in
  514.          * the clipboard.
  515.          *********************************************************************/
  516.  
  517.  
  518.           pParams->ulReturn = WinQueryClipbrdFmtInfo( habClipboard,
  519.                                         CF_WAVE,
  520.                                         &ulFormatInfo );
  521.  
  522.          ulrc = MAKEULONG(ulrc, MCI_TRUE_FALSE_RETURN);
  523.          break;
  524.  
  525.       case MCI_WAVE_STATUS_LEVEL:
  526. #ifdef STATUS_LEVEL
  527.            switch (STRMSTATE)
  528.               {
  529.                case MCI_PLAY:
  530.                case MCI_RECORD:
  531.                     pParams->ulReturn = ulpInstance->ulStatusLevel;
  532.                     break;
  533.  
  534.                default:
  535.                     pParams->ulReturn = 0;
  536.                     break;
  537.               }
  538.             ulpInstance->ulStatusLevelState = STATUS_LEVEL_ON;
  539. #else
  540.                     pParams->ulReturn = 0;
  541. #endif
  542. //            ulrc = MAKEULONG (ulrc, MCI_COLONIZED2_RETURN); // ?????
  543.  
  544.  
  545.             ulrc = MAKEULONG (ulrc, MCI_INTEGER_RETURNED);
  546.           break;
  547.  
  548.       case MCI_WAVE_STATUS_FORMATTAG:
  549.             if ( ulpInstance->ulRealTimeTranslation ==MMIO_REALTIME )
  550.                {
  551.                pParams->ulReturn =
  552.                   ulpInstance->mmRealHeader.mmXWAVHeader.WAVEHeader.usFormatTag;
  553.                }
  554.             else
  555.                {
  556.                pParams->ulReturn =
  557.                   ulpInstance->mmAudioHeader.mmXWAVHeader.WAVEHeader.usFormatTag;
  558.                }
  559.             ulrc = MAKEULONG (ulrc, MCI_FORMAT_TAG_RETURN);
  560.           break;
  561.  
  562.       case MCI_STATUS_MEDIA_PRESENT:
  563.             pParams->ulReturn = MCI_TRUE;
  564.             ulrc = MAKEULONG(ulrc, MCI_TRUE_FALSE_RETURN);
  565.           break;
  566.  
  567.       case MCI_WAVE_STATUS_BLOCKALIGN:
  568.            if ( ulpInstance->ulRealTimeTranslation ==MMIO_REALTIME )
  569.               {
  570.               pParams->ulReturn =
  571.                  ulpInstance->mmRealHeader.mmXWAVHeader.WAVEHeader.usBlockAlign;
  572.               }
  573.            else
  574.               {
  575.               pParams->ulReturn =
  576.                  ulpInstance->mmAudioHeader.mmXWAVHeader.WAVEHeader.usBlockAlign;
  577.               }
  578.            ulrc = MAKEULONG(ulrc, MCI_INTEGER_RETURNED);
  579.           break;
  580.  
  581.       case MCI_STATUS_MODE:
  582.            {
  583.               /********************************************
  584.                * Always Return an Integer for this case
  585.               ********************************************/
  586.               ulrc = MAKEULONG (ulrc, MCI_MODE_RETURN);
  587.  
  588.               /* if no file is loaded, we are not ready */
  589.              if (ulpInstance->fFileExists == FALSE)
  590.                 {
  591.                 pParams->ulReturn = MCI_MODE_NOT_READY;
  592.                 }
  593.              else
  594.                 {
  595.                   /* Our current mode depends on the action we are doing */
  596.  
  597.                   switch (STRMSTATE)
  598.                      {
  599.                       case MCI_PLAY:
  600.                             pParams->ulReturn = MCI_MODE_PLAY;
  601.                            break;
  602.  
  603.                       case MCI_RECORD:
  604.                             pParams->ulReturn = MCI_MODE_RECORD;
  605.                            break;
  606.  
  607.                       case MCI_STOP     :
  608.                       case STOP_PAUSED  :
  609.                       case CUEPLAY_STATE:
  610.                       case CUERECD_STATE:
  611.                             pParams->ulReturn = MCI_MODE_STOP;
  612.                            break;
  613.  
  614.                       case MCI_PAUSE:
  615.                             pParams->ulReturn = MCI_MODE_PAUSE;
  616.                            break;
  617.  
  618.                       default:
  619.                             pParams->ulReturn = MCI_MODE_NOT_READY;
  620.  
  621.                      } /* of Possible Modes (Switch) */
  622.                 }
  623.            }  /* Status Mode */
  624.           break;
  625.  
  626.       /* Return our current time format */
  627.  
  628.       case MCI_STATUS_TIME_FORMAT:
  629.            {
  630.             switch (ulpInstance->ulTimeUnits)
  631.             {
  632.              case lMMTIME:
  633.                    pParams->ulReturn = MCI_FORMAT_MMTIME;
  634.                   break;
  635.  
  636.              case lMILLISECONDS:
  637.                    pParams->ulReturn = MCI_FORMAT_MILLISECONDS;
  638.                   break;
  639.  
  640.              case lBYTES:
  641.                    pParams->ulReturn = MCI_FORMAT_BYTES;
  642.                   break;
  643.  
  644. /*case lSAMPLES:*/
  645.              default :
  646.                    pParams->ulReturn = MCI_FORMAT_SAMPLES;
  647.                   break;
  648.              } /* Switch */
  649.  
  650.              ulrc = MAKEULONG (ulrc, MCI_TIME_FORMAT_RETURN);
  651.  
  652.           }
  653.           break;
  654. // CONNECTOR FEATURE--check if amp is there
  655.       case MCI_STATUS_READY:
  656.             if (ulpInstance->fFileExists == MCI_TRUE
  657. #ifdef CONNECTION
  658.  
  659.             && ulpInstance->fConnected)
  660. #else
  661.             )
  662. #endif
  663.                  {
  664.                  /********************************
  665.                  * It is possbile that although we
  666.                  * are connected, there is no amp
  667.                  * in the network to forward the
  668.                  * command to (i.e. cd->wave).
  669.                  * Check to make sure.
  670.                  *********************************/
  671. #ifdef CONNECTION
  672.  
  673.                  ulrc = FindAmp( ulpInstance);
  674.                  if ( ulrc )
  675.                     {
  676.                     return (ulrc);
  677.                     }
  678. #endif
  679.                  /*****************************************
  680.                  * Check if Amp/Mixer is Ready and active
  681.                  *****************************************/
  682.                  ulrc = mciSendCommand ( ulpInstance->usAmpDeviceID,
  683.                                          MCI_STATUS,
  684.                                          MCI_STATUS_ITEM | MCI_WAIT,
  685.                                          (PVOID) pParams,
  686.                                          pFuncBlock->usUserParm );
  687.                  }
  688. // CONNECTOR FEATURE--check if amp is there
  689.             else
  690.                  pParams->ulReturn = MCI_FALSE;
  691.  
  692.             ulrc = MAKEULONG(ulrc, MCI_TRUE_FALSE_RETURN);
  693.           break;
  694.  
  695.       default:
  696.              return (MCIERR_INVALID_FLAG);
  697.  
  698.       } /* end of switch */
  699.  
  700.     } /* Status Item */
  701.   else
  702.     {
  703.     return ( MCIERR_MISSING_FLAG );
  704.  
  705.     } /* status item is not passed */
  706.  
  707.   return (ulrc);
  708.  
  709. } /* MCIStat */
  710.