[MMIXER] Cleanup mixer notifications opened by an application when it is closed.
[reactos.git] / reactos / sdk / lib / drivers / sound / mmixer / mixer.c
index b9335ba..3b8d900 100644 (file)
@@ -112,6 +112,39 @@ MMixerOpen(
     return MM_STATUS_SUCCESS;
 }
 
     return MM_STATUS_SUCCESS;
 }
 
+MIXER_STATUS
+MMixerClose(
+    IN PMIXER_CONTEXT MixerContext,
+    IN ULONG MixerId,
+    IN PVOID MixerEventContext,
+    IN PMIXER_EVENT MixerEventRoutine)
+{
+    MIXER_STATUS Status;
+    LPMIXER_INFO MixerInfo;
+
+    /* verify mixer context */
+    Status = MMixerVerifyContext(MixerContext);
+
+    if (Status != MM_STATUS_SUCCESS)
+    {
+        /* invalid context passed */
+        DPRINT1("invalid context\n");
+        return Status;
+    }
+
+    /* get mixer info */
+    MixerInfo = MMixerGetMixerInfoByIndex(MixerContext, MixerId);
+    if (!MixerInfo)
+    {
+        /* invalid mixer id */
+        DPRINT1("invalid mixer id %lu\n", MixerId);
+        return MM_STATUS_INVALID_PARAMETER;
+    }
+
+    /* remove event from list */
+    return MMixerRemoveEvent(MixerContext, MixerInfo, MixerEventContext, MixerEventRoutine);
+}
+
 MIXER_STATUS
 MMixerGetLineInfo(
     IN PMIXER_CONTEXT MixerContext,
 MIXER_STATUS
 MMixerGetLineInfo(
     IN PMIXER_CONTEXT MixerContext,