#include "pch.hpp"
//===========================================================================//
// File:	 ACM.cpp														 //
// Project:  GameOS					                                         //
// Contents: Wrappers for the Audio Compression Manager						 //
//---------------------------------------------------------------------------//
// Date      Who    Modification                                             //
// 01/23/98  JTR    Created													 //
//																			 //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp.						                 //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//

#include "ErrorHandler.hpp"
#include "DirectXDebugging.hpp"



MMRESULT wACMStreamPrepareHeader( HACMSTREAM hACMStream, ACMSTREAMHEADER *ACMHeader, DWORD fdwPrepare )
{
	SPEW(( GROUP_DIRECTSOUND, "acmStreamPrepareHeader(0x%x, 0x%x, 0x%x)", hACMStream, ACMHeader,fdwPrepare));

	MMRESULT result=acmStreamPrepareHeader(hACMStream,ACMHeader, fdwPrepare);

	if( FAILED(result) )
		PAUSE(( "FAILED (0x%x - %s) - acmStreamPrepareHeader(0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result),hACMStream, ACMHeader,fdwPrepare));

	return result;
}

MMRESULT wACMStreamConvert( HACMSTREAM hACMStream, ACMSTREAMHEADER *ACMHeader, DWORD flags )
{
	SPEW(( GROUP_DIRECTSOUND, "acmStreamConvert(0x%x, 0x%x, 0x%x)", hACMStream, ACMHeader,flags));

	MMRESULT result=acmStreamConvert(hACMStream,ACMHeader, flags);

	if( FAILED(result) )
		PAUSE(( "FAILED (0x%x - %s) - acmStreamConvert(0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result),hACMStream, ACMHeader,flags));

	return result;
}

MMRESULT wACMStreamUnprepareHeader( HACMSTREAM hACMStream, ACMSTREAMHEADER *ACMHeader, DWORD fdwPrepare )
{
	SPEW(( GROUP_DIRECTSOUND, "acmStreamUnprepareHeader(0x%x, 0x%x, 0x%x)", hACMStream, ACMHeader,fdwPrepare));

	MMRESULT result=acmStreamUnprepareHeader(hACMStream,ACMHeader, fdwPrepare);

	if( FAILED(result) )
		PAUSE(( "FAILED (0x%x - %s) - acmStreamUnprepareHeader(0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result),hACMStream, ACMHeader,fdwPrepare));

	return result;
}

MMRESULT wACMStreamClose( HACMSTREAM hACMStream, DWORD flags )
{
	SPEW(( GROUP_DIRECTSOUND, "acmStreamClose(0x%x, 0x%x)", hACMStream, flags));

	MMRESULT result=acmStreamClose(hACMStream, flags);

	if( FAILED(result) )
		PAUSE(( "FAILED (0x%x - %s) - acmStreamClose(0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result),hACMStream, flags ));

	return result;
}

MMRESULT wACMStreamOpen( LPHACMSTREAM phas, HACMDRIVER had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, LPWAVEFILTER pwfltr, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen )
{
	char Buffer[128];
	char Buffer1[128];
	SPEW(( GROUP_DIRECTSOUND, "acmStreamOpen(0x%x, 0x%x, %s, %s, 0x%x,0x%x, 0x%x, 0x%x)", phas, had, GetWaveFormat(Buffer,pwfxSrc), GetWaveFormat(Buffer1,pwfxDst), pwfltr, dwCallback, dwInstance, fdwOpen ));

	MMRESULT result=acmStreamOpen(phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen);

	if( FAILED(result) )
		PAUSE(( "FAILED (0x%x - %s) - acmStreamOpen(0x%x, 0x%x, %s, %s, 0x%x,0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result), phas, had, GetWaveFormat(Buffer,pwfxSrc), GetWaveFormat(Buffer1,pwfxDst), pwfltr, dwCallback, dwInstance, fdwOpen ));

	return result;
}

MMRESULT wACMStreamSize( HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize )
{
	SPEW(( GROUP_DIRECTSOUND, "acmStreamSize(0x%x, 0x%x, 0x%x, 0x%x)", has, cbInput, pdwOutputBytes, fdwSize ));

	MMRESULT result=acmStreamSize(has, cbInput, pdwOutputBytes, fdwSize);

	if( FAILED(result) )
		PAUSE(( "FAILED (0x%x - %s) - acmStreamSize(0x%x, 0x%x, 0x%x, 0x%x)",result,ErrorNumberToMessage(result), has, cbInput, pdwOutputBytes, fdwSize ));

	return result;
}

MMRESULT wACMFormatSuggest( HACMDRIVER had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest )
{
	char Buffer[128];
	char Buffer1[128];
	SPEW(( GROUP_DIRECTSOUND, "acmFormatSuggest(0x%x, %s, %s, 0x%x, 0x%x)", had, GetWaveFormat(Buffer,pwfxSrc), GetWaveFormat(Buffer1,pwfxDst), cbwfxDst, fdwSuggest ));

	MMRESULT result=acmFormatSuggest(had, pwfxSrc, pwfxDst,cbwfxDst, fdwSuggest);

	if( FAILED(result) )
		PAUSE(( "FAILED (0x%x - %s) - acmFormatSuggest(0x%x, %s, %s, 0x%x, 0x%x)",result,ErrorNumberToMessage(result),  had, GetWaveFormat(Buffer,pwfxSrc), GetWaveFormat(Buffer1,pwfxDst),cbwfxDst, fdwSuggest ));

	return result;
}

