Index: trunk/include/VBox/vmm/pdmaudiohostenuminline.h
===================================================================
--- trunk/include/VBox/vmm/pdmaudiohostenuminline.h	(revision 89223)
+++ trunk/include/VBox/vmm/pdmaudiohostenuminline.h	(revision 89229)
@@ -91,5 +91,4 @@
     {
         Assert(pDev->uMagic == PDMAUDIOHOSTDEV_MAGIC);
-        Assert(pDev->cRefCount == 0);
         pDev->uMagic = ~PDMAUDIOHOSTDEV_MAGIC;
         pDev->cbSelf = 0;
@@ -192,5 +191,5 @@
  * Appends copies of matching host device entries from one to another enumeration.
  *
- * @returns IPRT status code.
+ * @returns VBox status code.
  * @param   pDstDevEnm      The target to append copies of matching device to.
  * @param   pSrcDevEnm      The source to copy matching devices from.
@@ -227,4 +226,35 @@
 
 /**
+ * Moves all the device entries from one enumeration to another, destroying the
+ * former.
+ *
+ * @returns VBox status code.
+ * @param   pDstDevEnm          The target to put move @a pSrcDevEnm to.  This
+ *                              does not need to be initialized, but if it is it
+ *                              must not have any device entries.
+ * @param   pSrcDevEnm          The source to move from.  This will be empty
+ *                              upon successful return.
+ */
+DECLINLINE(int) PDMAudioHostEnumMove(PPDMAUDIOHOSTENUM pDstDevEnm, PPDMAUDIOHOSTENUM pSrcDevEnm)
+{
+    AssertPtrReturn(pDstDevEnm, VERR_INVALID_POINTER);
+    AssertReturn(pDstDevEnm->uMagic != PDMAUDIOHOSTENUM_MAGIC || pDstDevEnm->cDevices == 0, VERR_WRONG_ORDER);
+
+    AssertPtrReturn(pSrcDevEnm, VERR_INVALID_POINTER);
+    AssertReturn(pSrcDevEnm->uMagic == PDMAUDIOHOSTENUM_MAGIC, VERR_WRONG_ORDER);
+
+    pDstDevEnm->uMagic   = PDMAUDIOHOSTENUM_MAGIC;
+    RTListInit(&pDstDevEnm->LstDevices);
+    pDstDevEnm->cDevices = pSrcDevEnm->cDevices;
+    if (pSrcDevEnm->cDevices)
+    {
+        PPDMAUDIOHOSTDEV pCur;
+        while ((pCur = RTListRemoveFirst(&pSrcDevEnm->LstDevices, PDMAUDIOHOSTDEV, ListEntry)) != NULL)
+            RTListAppend(&pDstDevEnm->LstDevices, &pCur->ListEntry);
+    }
+    return VINF_SUCCESS;
+}
+
+/**
  * Get the default device with the given usage.
  *
@@ -236,5 +266,6 @@
  * @param   enmUsage    Usage to get default device for.
  *                      Pass PDMAUDIODIR_INVALID to get the first device with
- *                      PDMAUDIOHOSTDEV_F_DEFAULT set.
+ *                      either PDMAUDIOHOSTDEV_F_DEFAULT_OUT or
+ *                      PDMAUDIOHOSTDEV_F_DEFAULT_IN set.
  */
 DECLINLINE(PPDMAUDIOHOSTDEV) PDMAudioHostEnumGetDefault(PCPDMAUDIOHOSTENUM pDevEnm, PDMAUDIODIR enmUsage)
@@ -243,12 +274,17 @@
     AssertReturn(pDevEnm->uMagic == PDMAUDIOHOSTENUM_MAGIC, NULL);
 
+    Assert(enmUsage == PDMAUDIODIR_IN || enmUsage == PDMAUDIODIR_OUT || enmUsage == PDMAUDIODIR_INVALID);
+    uint32_t const fFlags = enmUsage == PDMAUDIODIR_IN      ? PDMAUDIOHOSTDEV_F_DEFAULT_IN
+                          : enmUsage == PDMAUDIODIR_OUT     ? PDMAUDIOHOSTDEV_F_DEFAULT_OUT
+                          : enmUsage == PDMAUDIODIR_INVALID ? PDMAUDIOHOSTDEV_F_DEFAULT_IN | PDMAUDIOHOSTDEV_F_DEFAULT_OUT
+                          : 0;
+
     PPDMAUDIOHOSTDEV pDev;
     RTListForEach(&pDevEnm->LstDevices, pDev, PDMAUDIOHOSTDEV, ListEntry)
     {
-        if (pDev->fFlags & PDMAUDIOHOSTDEV_F_DEFAULT)
+        if (pDev->fFlags & fFlags)
         {
-            if (   enmUsage == pDev->enmUsage
-                || enmUsage == PDMAUDIODIR_INVALID)
-                return pDev;
+            Assert(pDev->enmUsage == enmUsage || pDev->enmUsage == PDMAUDIODIR_DUPLEX || enmUsage == PDMAUDIODIR_INVALID);
+            return pDev;
         }
     }
@@ -286,5 +322,5 @@
 /** The max string length for all PDMAUDIOHOSTDEV_F_XXX.
  * @sa PDMAudioHostDevFlagsToString */
-#define PDMAUDIOHOSTDEV_MAX_FLAGS_STRING_LEN    (7 * 8)
+#define PDMAUDIOHOSTDEV_MAX_FLAGS_STRING_LEN    sizeof("DEFAULT_OUT DEFAULT_IN HOTPLUG BUGGY IGNORE LOCKED DEAD NO_DUP ")
 
 /**
@@ -301,5 +337,6 @@
     static const struct { const char *pszMnemonic; uint32_t cchMnemonic; uint32_t fFlag; } s_aFlags[] =
     {
-        { RT_STR_TUPLE("DEFAULT "), PDMAUDIOHOSTDEV_F_DEFAULT },
+        { RT_STR_TUPLE("DEFAULT_OUT "), PDMAUDIOHOSTDEV_F_DEFAULT_OUT },
+        { RT_STR_TUPLE("DEFAULT_IN "),  PDMAUDIOHOSTDEV_F_DEFAULT_IN },
         { RT_STR_TUPLE("HOTPLUG "), PDMAUDIOHOSTDEV_F_HOTPLUG },
         { RT_STR_TUPLE("BUGGY "),   PDMAUDIOHOSTDEV_F_BUGGY   },
Index: trunk/include/VBox/vmm/pdmaudioifs.h
===================================================================
--- trunk/include/VBox/vmm/pdmaudioifs.h	(revision 89223)
+++ trunk/include/VBox/vmm/pdmaudioifs.h	(revision 89229)
@@ -313,16 +313,18 @@
 /** No flags set. */
 #define PDMAUDIOHOSTDEV_F_NONE              UINT32_C(0)
-/** The device marks the default device within the host OS. */
-#define PDMAUDIOHOSTDEV_F_DEFAULT           RT_BIT_32(0)
+/** The default input (capture/recording) device (for the user). */
+#define PDMAUDIOHOSTDEV_F_DEFAULT_IN        RT_BIT_32(0)
+/** The default output (playback) device (for the user). */
+#define PDMAUDIOHOSTDEV_F_DEFAULT_OUT       RT_BIT_32(1)
 /** The device can be removed at any time and we have to deal with it. */
-#define PDMAUDIOHOSTDEV_F_HOTPLUG           RT_BIT_32(1)
+#define PDMAUDIOHOSTDEV_F_HOTPLUG           RT_BIT_32(2)
 /** The device is known to be buggy and needs special treatment. */
-#define PDMAUDIOHOSTDEV_F_BUGGY             RT_BIT_32(2)
+#define PDMAUDIOHOSTDEV_F_BUGGY             RT_BIT_32(3)
 /** Ignore the device, no matter what. */
-#define PDMAUDIOHOSTDEV_F_IGNORE            RT_BIT_32(3)
+#define PDMAUDIOHOSTDEV_F_IGNORE            RT_BIT_32(4)
 /** The device is present but marked as locked by some other application. */
-#define PDMAUDIOHOSTDEV_F_LOCKED            RT_BIT_32(4)
+#define PDMAUDIOHOSTDEV_F_LOCKED            RT_BIT_32(5)
 /** The device is present but not in an alive state (dead). */
-#define PDMAUDIOHOSTDEV_F_DEAD              RT_BIT_32(5)
+#define PDMAUDIOHOSTDEV_F_DEAD              RT_BIT_32(6)
 /** Set if the extra backend specific data cannot be duplicated. */
 #define PDMAUDIOHOSTDEV_F_NO_DUP            RT_BIT_32(31)
@@ -370,24 +372,12 @@
     /** Device flags, PDMAUDIOHOSTDEV_F_XXX. */
     uint32_t            fFlags;
-    /** Reference count indicating how many audio streams currently are relying on this device. */
-    uint8_t             cRefCount;
     /** Maximum number of input audio channels the device supports. */
     uint8_t             cMaxInputChannels;
     /** Maximum number of output audio channels the device supports. */
     uint8_t             cMaxOutputChannels;
-    uint8_t             bAlignment;
-    /** Device type union, based on enmType. */
-    union
-    {
-        /** USB type specifics. */
-        struct
-        {
-            /** Vendor ID. */
-            uint16_t    idVendor;
-            /** Product ID. */
-            uint16_t    idProduct;
-        } USB;
-        uint64_t        uPadding[ARCH_BITS >= 64 ? 3 : 4];
-    } Type;
+    uint8_t             abAlignment[ARCH_BITS == 32 ? 2 + 12 : 2];
+    /** Device identifier, OS specific, can be NULL.  It it isn't, it'll point to
+     *  the non-public part (or into szName if creative). */
+    const char         *pszId;
     /** Friendly name of the device, if any. Could be truncated. */
     char                szName[64];
@@ -400,5 +390,5 @@
 
 /** Magic value for PDMAUDIOHOSTDEV.  */
-#define PDMAUDIOHOSTDEV_MAGIC       PDM_VERSION_MAKE(0xa0d0, 1, 0)
+#define PDMAUDIOHOSTDEV_MAGIC       PDM_VERSION_MAKE(0xa0d0, 2, 0)
 
 
@@ -1525,5 +1515,5 @@
 
 /** PDMIHOSTAUDIO interface ID. */
-#define PDMIHOSTAUDIO_IID                           "ad56b303-0c1f-4b79-9bd1-4ec04ae08c4f"
+#define PDMIHOSTAUDIO_IID                           "a6b33abc-1393-4548-92ab-a308d54de1e8"
 
 
