home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / immdev.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  12.2 KB  |  371 lines

  1. #ifndef _IMMDEV_
  2.    #define _IMMDEV_
  3. /*******************************************************************************
  4. * FILE NAME:  immdev.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IMMDevice                                                                *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18. #include <istdntfy.hpp>
  19. #include <ipoint.hpp>
  20. #include <immtime.hpp>
  21. #include <immevt.hpp>
  22. #include <immspeed.hpp>
  23. #include <inotify.hpp>
  24. #include <istring.hpp>
  25.  
  26. class IMMDeviceHandler;
  27. class IMMDeviceNotifyHandler;
  28. class IMMDeviceData;
  29. class IMMMessageWindow;
  30.  
  31. #pragma pack(4)
  32.  
  33.  
  34. class IMMDevice : public IStandardNotifier {
  35. typedef IStandardNotifier
  36.   Inherited;
  37. public:
  38. /*-------------------------------- Constructors ------------------------------*/
  39. virtual
  40.   ~IMMDevice();
  41.  
  42. /*-------------------------------- Call Type ---------------------------------*/
  43. enum CallType
  44. {
  45.   nowait = 0X00000001,
  46.   wait   = 0x00000002
  47. };
  48.  
  49. /*-------------------------------- Device Type and Description ---------------*/
  50. static const unsigned long
  51.   IC_IMPORTM cdxa,
  52.   IC_IMPORTM audioCD,
  53.   IC_IMPORTM dat,
  54.   IC_IMPORTM audioTape,
  55.   IC_IMPORTM waveAudio,
  56.   IC_IMPORTM sequencer,
  57.   IC_IMPORTM ampMixer,
  58.   IC_IMPORTM videoTape,
  59.   IC_IMPORTM digitalVideo,
  60.   IC_IMPORTM videoDisc,
  61.   IC_IMPORTM overlay,
  62.   IC_IMPORTM animation,
  63.   IC_IMPORTM speaker,
  64.   IC_IMPORTM headphone,
  65.   IC_IMPORTM microphone,
  66.   IC_IMPORTM monitor,
  67.   IC_IMPORTM other,
  68.   IC_IMPORTM allDevices;
  69.  
  70. unsigned long
  71.   deviceType    (CallType call = wait) const;
  72. IString
  73.   description        (CallType call = wait) const;
  74.  
  75.  
  76. /*------------------------------- Capabilities -------------------------------*/
  77. Boolean
  78.   supportsVolumeAdjustment(CallType call = wait) const,
  79.   supportsRecordInsertion(CallType call = wait) const,
  80.   supportsDisableEject   (CallType call = wait) const,
  81.   supportsDigitalTransfer(CallType call = wait) const,
  82.   supportsStreaming      (CallType call = wait) const,
  83.   supportsCommand        (IMMNotifyEvent::Command command,
  84.                           CallType call = wait) const,
  85.   supportsEject          (CallType call = wait) const,
  86.   supportsPlay           (CallType call = wait) const,
  87.   supportsRecord         (CallType call = wait) const,
  88.   supportsSave           (CallType call = wait) const,
  89.   supportsAudio          (CallType call = wait) const,
  90.   supportsVideo          (CallType call = wait) const,
  91.   requiresFiles          (CallType call = wait) const;
  92.  
  93. /*-------------------------------- Share Mode & Acquire ----------------------*/
  94. enum ShareMode
  95. {
  96.   shareable,
  97.   isolatedExclusive = 0x00000100,
  98.   exclusive         = 0x00000200
  99. };
  100. virtual IMMDevice
  101.   &acquire   (ShareMode acquire = shareable,
  102.               Boolean queuedForResources = false,
  103.               CallType call = wait),
  104.   &release   (CallType call = wait);
  105. Boolean
  106.   isAcquired (CallType call = wait) const;
  107.  
  108. /*-------------------------------- Event Type and DeleteEvents ---------------*/
  109. enum EventType
  110. {
  111.   allEvents,
  112.   notifyEvent = 0x0500,
  113.   passDeviceEvent,
  114.   positionChangeEvent,
  115.   cuePointEvent,
  116.   deviceEvent,
  117.   synchEvent
  118. };
  119. virtual IMMDevice
  120.   &deletePendingEvents (EventType event = allEvents);
  121.  
  122. /*-------------------------------- Open and Close ----------------------------*/
  123. virtual IMMDevice
  124.   &close             (CallType call = wait),
  125.   &open              (const IString& fileOrDevice = IString(),
  126.                       Boolean shareable = true,
  127.                       CallType call = wait),
  128.   &openOnThread      (const IString& fileOrDevice = IString(),
  129.                       Boolean shareable = true,
  130.                       CallType call = wait);
  131. IMMDevice
  132.   &setCloseOnDestroy (Boolean close = true);
  133. Boolean
  134.   isOpen             () const,
  135.   isCloseOnDestroy   () const;
  136.  
  137. /*-------------------------------- Mode --------------------------------------*/
  138. enum Mode
  139. {
  140.   notReady  = 1,
  141.   paused,
  142.   playing,
  143.   stopped,
  144.   recording,
  145.   seeking
  146. };
  147. virtual Mode
  148.   mode  (CallType call = wait) const;
  149.  
  150. /*-------------------------------- Audio -------------------------------------*/
  151. enum AudioChannel
  152. {
  153.   all,
  154.   left,
  155.   right
  156. };
  157. virtual IMMDevice
  158.   &setVolume   (unsigned long volume,
  159.                 AudioChannel channel = all,
  160.                 const IMMMillisecondTime& over = IMMMillisecondTime(),
  161.                 CallType call = wait),
  162.   &enableAudio (Boolean enable= true,
  163.                 AudioChannel channel = all,
  164.                 const IMMMillisecondTime& over = IMMMillisecondTime(),
  165.                 CallType call = wait),
  166.   &disableAudio(AudioChannel channel = all,
  167.                 const IMMMillisecondTime& over = IMMMillisecondTime(),
  168.                 CallType call = wait);
  169. virtual unsigned long
  170.   volume       (AudioChannel channel = left,
  171.                 CallType call = wait) const;
  172. Boolean
  173.   isAudioEnabled(AudioChannel channel = all,
  174.                  CallType call = wait);
  175.  
  176. /*-------------------------------- Speed and Time ----------------------------*/
  177. IMMSpeed::Format
  178.   speedFormat     (CallType call = wait) const;
  179. virtual IMMDevice
  180.   &setSpeedFormat (IMMSpeed::Format format, CallType call = wait),
  181.   &setTimeFormat  (IMMTime::Format format, CallType call = wait);
  182. IMMTime::Format
  183.   timeFormat      (CallType call = wait) const;
  184.  
  185. /*-------------------------------- Connector Type ----------------------------*/
  186. #ifndef IC_WIN_FLAGNOP
  187. enum ConnectorType
  188. {
  189.   midiStream = 0x00000001,
  190.   cdStream   = 0x00000002,
  191.   waveStream = 0x00000003,
  192.   ampStream  = 0x00000004,
  193.   xaStream   = 0x00000005,
  194.   headphones = 0x00000006,
  195.   speakers   = 0x00000007,
  196.   microphones= 0x00000008,
  197.   lineIn     = 0x00000009,
  198.   lineOut    = 0x0000000a,
  199.   videoIn    = 0x0000000b,
  200.   videoOut   = 0x0000000c,
  201.   phoneSet   = 0x0000000d,
  202.   phoneLine  = 0x0000000e,
  203.   audioIn    = 0x0000000f,
  204.   audioOut   = 0x00000010,
  205.   universal  = 0x00000011
  206. };
  207. virtual IMMDevice
  208.   &enableConnector      (ConnectorType type,
  209.                          Boolean enable=true,
  210.                          CallType call = wait),
  211.   &disableConnector     (ConnectorType type,
  212.                          CallType call = wait);
  213. Boolean
  214.   isConnectionSupported (ConnectorType type,
  215.                          CallType call = wait) const,
  216.   isConnectorEnabled    (ConnectorType type,
  217.                          CallType call = wait) const;
  218. unsigned long
  219.   connectedDeviceId     (ConnectorType type,
  220.                          CallType call = wait) const;
  221. #endif
  222.  
  223. /*---------------------------- Device Information ----------------------------*/
  224. unsigned long
  225.   deviceId        () const;
  226. IString
  227.   aliasName       () const,
  228.   deviceName      () const;
  229.  
  230. /*----------------------- Notification Event Descriptions --------------------*/
  231. static INotificationId const
  232.   IC_IMPORTM commandNotifyId,
  233.   IC_IMPORTM passDeviceId,
  234.   IC_IMPORTM cuePointId,
  235.   IC_IMPORTM positionChangeId,
  236.   IC_IMPORTM deviceEventId;
  237.  
  238. /*----------------------- Observer Notification ------------------------------*/
  239. virtual IMMDevice
  240.  &enableNotification (Boolean enabled = true);
  241.  
  242. protected:
  243. /*----------------------------- Constructors ---------------------------------*/
  244.   IMMDevice ( const IString& fileOrDevice );
  245.   IMMDevice ( unsigned long deviceIdentifier,
  246.               const IString& newAlias = IString());
  247.  
  248. /*------------------- Observer Notification Implementation -------------------*/
  249. IMMDevice
  250.  &setNotificationHandler ( IMMDeviceNotifyHandler* notifyHandler );
  251.  
  252. IMMDeviceNotifyHandler
  253.  *notificationHandler    ( ) const;
  254.  
  255.  
  256. /*-------------------------------- Open Status -------------------------------*/
  257. enum OpenStatus
  258. {
  259.   openNotAttempted,
  260.   openSuccessful,
  261.   openFailed
  262. };
  263.  
  264. OpenStatus
  265.   openStatus     () const;
  266. IMMDevice
  267.   &setOpenStatus (OpenStatus status);
  268.  
  269. /*-------------------- Implementation ----------------------------------------*/
  270. unsigned long
  271.   itemStatus              (unsigned long item,
  272.                            unsigned long value = 0,
  273.                            CallType call = wait) const,
  274.   itemCapability          (unsigned long item, CallType call) const;
  275. IString
  276.    sendCommand            (const IString& command),
  277.    sendCommand            (const IString& command,unsigned short userParm);
  278. IMMDevice
  279.   &sendCommand            (unsigned short message, unsigned long param1,
  280.                            void *param2),
  281.   &sendCommand            (unsigned short message, unsigned long param1,
  282.                            void *param2, unsigned short userParm),
  283.   &setPassDeviceRequested (Boolean sawPassDevice),
  284.   &setUserParameter       (unsigned short userParm = 0);
  285. IMMMessageWindow
  286.   &deviceWindow() const;
  287. Boolean
  288.   wasPassDeviceRequested  () const;
  289. unsigned short
  290.   userParameter           () const;
  291.  
  292. virtual Boolean
  293.   isOpenStringValid       (const IString& deviceName) const;
  294.  
  295. virtual IMMDevice
  296.   &open                   (unsigned long instanceNumber,
  297.                            Boolean shareable = true,
  298.                            CallType call = nowait),
  299.   &openOnThread           (unsigned long instanceNumber,
  300.                            Boolean shareable = true);
  301.  
  302.  
  303. virtual IMMDevice
  304.   &saveDeviceSettings     (),
  305.   &restoreDeviceSettings  (Boolean newRecordMode = false);
  306.  
  307. /*-------------------- Mixer Controls ----------------------------------------*/
  308. unsigned long
  309.   systemMixerHandle       () const;
  310.  
  311. IMMDevice
  312.   &setSystemMixerHandle   (unsigned long hmx);
  313.  
  314. virtual Boolean
  315.   mixerControlValues      (unsigned long dwComponentType,
  316.                            unsigned long dwControlType,
  317.                            unsigned long *ulDetails,
  318.                            Boolean  uniform = true,
  319.                            unsigned long multipleItems = 0,
  320.                            unsigned long hmx = NULL),
  321.  
  322.   mixerControlValues      (unsigned long dwComponentType,
  323.                            unsigned long dwControlType,
  324.                            unsigned short *usDetails,
  325.                            Boolean  uniform = true,
  326.                            unsigned long multipleItems = 0,
  327.                            unsigned long hmx = NULL),
  328.  
  329.   setMixerControlValues   (unsigned long dwComponentType,
  330.                            unsigned long dwControlType,
  331.                            unsigned long *ulDetails,
  332.                            Boolean  uniform = true,
  333.                            unsigned long multipleItems = 0,
  334.                            unsigned long hmx = NULL),
  335.  
  336.   setMixerControlValues   (unsigned long dwComponentType,
  337.                            unsigned long dwControlType,
  338.                            unsigned short *usDetails,
  339.                            Boolean  uniform = true,
  340.                            unsigned long multipleItems = 0,
  341.                            unsigned long hmx = NULL);
  342.  
  343. /*---------------------------- Error Information -----------------------------*/
  344. unsigned long
  345.   lastError      () const;
  346. IMMDevice
  347.   &setLastError  (unsigned long errorId);
  348.  
  349. private:
  350. /*--------------------------------- Private ----------------------------------*/
  351. void
  352.   establishAlias (),
  353.   releaseAlias   (const IString& alias);
  354. IString
  355.   uniqueAlias    ();
  356.  
  357. unsigned short
  358.   firstUnacknowledgedCommand() ;
  359.  
  360. IMMDeviceData
  361.   *fDeviceData;
  362.  
  363. friend class IMMDeviceHandler;
  364. friend class IMMDeviceData;
  365. }; // IMMDevice
  366.  
  367.  
  368. #pragma pack()
  369.  
  370. #endif /* _IMMDEV_ */
  371.