AudioMixer.cpp revision 174f3dff60f96d89b320f9a322307118676db1db
/* $Id$ */
/** @file
* VBox audio: Mixing routines, mainly used by the various audio device
* devices LUNs.
*/
/*
* Copyright (C) 2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "AudioMixer.h"
#include <iprt/asm-math.h>
#ifdef LOG_GROUP
#endif
#define LOG_GROUP LOG_GROUP_DEV_AUDIO
{
/** ppSink is optional. */
int rc = VINF_SUCCESS;
if (pSink)
{
rc = VERR_NO_MEMORY;
if (RT_SUCCESS(rc))
{
LogFlowFunc(("pMixer=%p, pSink=%p, cSinks=%RU8\n",
if (ppSink)
}
else
}
else
rc = VERR_NO_MEMORY;
return rc;
}
int audioMixerAddStreamIn(PAUDMIXSINK pSink, PPDMIAUDIOCONNECTOR pConnector, PPDMAUDIOGSTSTRMIN pStream,
{
/** @todo Add flag validation. */
/* ppStream is optional. */
int rc;
return VERR_TOO_MUCH_DATA;
if (pMixStream)
{
/** @todo Process flags. */
LogFlowFunc(("pSink=%p, pStream=%p, cStreams=%RU8\n",
if (ppStream)
*ppStream = pMixStream;
rc = VINF_SUCCESS;
}
else
rc = VERR_NO_MEMORY;
return rc;
}
{
return VERR_NOT_IMPLEMENTED;
}
{
/** @todo Add flag validation. */
int rc = VINF_SUCCESS;
if (pMixer)
{
rc = VERR_NO_MEMORY;
if (RT_SUCCESS(rc))
{
}
else
}
else
rc = VERR_NO_MEMORY;
return rc;
}
{
if (pMixer)
{
while (pSink)
{
if (fLast)
break;
}
}
}
{
if (!pSink)
return;
}
{
if (!pStream)
return;
}
{
AssertPtrReturn(pMixer, 0);
return cStreams;
}
{
/* pcbProcessed is optional. */
if (!pvMixBuf)
return VERR_NO_MEMORY;
int rc = VERR_NOT_FOUND;
uint32_t cbProcessed = 0;
{
/** @todo Support output sinks as well! */
continue;
uint32_t cbTotalRead = 0;
while (cbToRead)
{
if ( RT_FAILURE(rc)
|| !cbRead)
break;
cbTotalRead += cbRead;
}
if (RT_FAILURE(rc))
continue;
}
if (RT_SUCCESS(rc))
{
if (pcbProcessed)
}
return rc;
}
{
if (!pSink)
return;
while (pStream)
{
if (fLast)
break;
}
LogFlowFunc(("pMixer=%p, pSink=%p, cSinks=%RU8\n",
}
{
if (!pStream)
return;
LogFlowFunc(("pSink=%p, pStream=%p, cStreams=%RU8\n",
}
{
/** @todo Perform a deep copy, if needed. */
return VINF_SUCCESS;
}