⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wmaudiointernal.c

📁 WM9713 audio codec driver for WinCE 5.0
💻 C
字号:
 /*-----------------------------------------------------------------------------
 * Copyright (c) Wolfson Microelectronics plc.  All rights reserved.
 *
 * This software as well as any related documentation is furnished under 
 * license and may only be used or copied in accordance with the terms of the 
 * license. The information in this file is furnished for informational use 
 * only, is subject to change without notice, and should not be construed as 
 * a commitment by Wolfson Microelectronics plc. Wolfson Microelectronics plc
 * assumes no responsibility or liability for any errors or inaccuracies that
 * may appear in this document or any software that may be provided in
 * association with this document. 
 *
 * Except as permitted by such license, no part of this document may be 
 * reproduced, stored in a retrieval system, or transmitted in any form or by 
 * any means without the express written consent of Wolfson Microelectronics plc. 
 *
 * $Id: WMAudioInternal.c 2326 2005-10-20 08:40:38Z ib $
 *
 * This file contains internal functions for audio in the Wolfson library.
 * These definitions and functions are only used internally, and are not
 * exported to clients of the library.
 *
 * Warning:
 *  This driver is specifically written for Wolfson Codecs. It is not a 
 *  general CODEC device driver.
 *
 * -----------------------------------------------------------------------------*/

/*
 * Include files
 */
#include "WMCommon.h"
#include "WMDevice.h"
#include "WMGlobals.h"
#include "WMACLink.h"
#include "WMAudio.h"
#include "WMAudioInternal.h"

/*
 * Only build this if we're doing Audio support.
 */
#if WM_AUDIO

/*
 * Global definitions
 */

/*
 * Private data
 */
 
/*
 * Function prototypes
 */

/*-----------------------------------------------------------------------------
 * Function:    _WMAudioStreamToChannel
 *
 * Looks up the channel which corresponds to the given stream on this device.
 *
 * Parameters:
 *      hDevice     handle to the device (from WMOpenDevice)
 *      stream      the stream to convert
 *
 * Returns:     WMAUDIO_CHANNEL
 *      The channel to use, or WMAUDIO_INVALID_CHANNEL on error.
 *---------------------------------------------------------------------------*/
WMAUDIO_CHANNEL _WMAudioStreamToChannel( WM_DEVICE_HANDLE hDevice,
                                         WM_STREAM_ID inputStream
                                       )
{
    const WM_CHIPDEF        *pChipDef;
    const WM_STREAM_MAPPING *pMapping;
    WMAUDIO_CHANNEL         APIChannel = WMAUDIO_INVALID_CHANNEL;
    WM_STREAM_ID            realStream;
    WM_STREAM_ID            stream;

    /* Look up our chipdef */
    pChipDef = WMGetChipDef( hDevice );
    if ( !pChipDef )
    {
        /* No chipdef - bomb out.  channel is already set to failure */
        WM_TRACE( hDevice, ( "StreamToChannel - not a supported device" ));
        goto end;
    }
    
    /* Convert default streams to the current real stream which corresponds */
    realStream = _WMAudioGetRealStream( hDevice, inputStream );
    
    /* Now run through the streams mappings looking for this one */
    for ( stream = 0; stream < pChipDef->streamCount; stream++ )
    {
        pMapping = &pChipDef->pStreamMappings[stream];
        
        if ( realStream == pMapping->stream )
        {
            APIChannel = pMapping->channel;
            break;
        }
    }
    
end:
    /* If we didn't find it, we defaulted to WMAUDIO_INVALID_CHANNEL */
    return APIChannel;
}

/*-----------------------------------------------------------------------------
 * Function:    _WMAudioGetRealStream
 *
 * This function returns the actual API stream corresponding to the stream
 * parameter.  This converts the default stream values to their corresponding
 * real stream values.
 *
 * Parameters:
 *      hDevice     handle to the device (from WMOpenDevice)
 *      stream      the stream to convert.
 *
 * Returns:     WM_STREAM_ID
 *      The real stream which should be used.
 *---------------------------------------------------------------------------*/
WM_STREAM_ID _WMAudioGetRealStream( WM_DEVICE_HANDLE hDevice, WM_STREAM_ID stream )
{
    WM_DEVICE_CONTEXT   *pDeviceContext = WMHANDLE_TO_DEVICE( hDevice );
    
    switch ( stream )
    {
        case WM_STREAM_DEFAULT_OUTPUT:
            return pDeviceContext->defaultOutputStream;
            
        case WM_STREAM_DEFAULT_INPUT:
            return pDeviceContext->defaultInputStream;

        default:
            return stream;       
    }
}
   
#endif  /* WM_AUDIO */

/*------------------------------ END OF FILE ---------------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -