1 /*---------------------------------------------------------------------------*
2   Project:  Revolution Audio encode/decode library for controller speaker
3   File:     wenc.h
4 
5   Copyright (C) 2006 Nintendo  All Rights Reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: wenc.h,v $
14   Revision 1.4  09/07/2006 08:29:04  aka
15   Modified WENCGetEncodeBufferSize().
16 
17   Revision 1.3  08/10/2006 02:29:54  aka
18   Changed WENCGetEncodeBufferSize().
19 
20   Revision 1.2  08/09/2006 00:39:55  aka
21   Changed an argument.
22 
23   Revision 1.1  07/18/2006 05:44:31  aka
24   Initial check-in.
25 
26   $NoKeywords: $
27  *---------------------------------------------------------------------------*/
28 
29 #ifndef __WENC_H__
30 #define __WENC_H__
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 //----------------------------------------------------------------------------
37 // encode flag definition
38 //----------------------------------------------------------------------------
39 #define WENC_FLAG_FIRST  0x00000000
40 #define WENC_FLAG_CONT   0x00000001
41 #define WENC_FLAG_LAST   0x00000002
42 
43 //----------------------------------------------------------------------------
44 // encode information structure
45 //----------------------------------------------------------------------------
46 typedef struct
47 {
48     u8   data[32];
49 
50 } WENCInfo;
51 
52 //----------------------------------------------------------------------------
53 // Function:
54 //              WENCGetEncodeBufferSize()
55 // Input:
56 //              nSampleNum:                   number of PCM data.
57 // Return:
58 //              output buffer size [byte].
59 // Description:
60 //              calculate output buffer size (byte) which application need to
61 //              alloc before calling WENCGetEncodeData().
62 //----------------------------------------------------------------------------
63 #define WENCGetEncodeBufferSize( nSampleNum )  (((nSampleNum) + 1) / 2)
64 
65 //----------------------------------------------------------------------------
66 // Function:
67 //              WENCGetEncodeData()
68 // Input:
69 //              WENCInfo*  info:              pointer to WENCInfo structure
70 //              u32        flag:              encode control flag
71 //              const s16* pbyPcmData:        PCM data
72 //              s32        nSampleNum:        number of PCM data.
73 // Output:
74 //              u8*        pbyEncData:        Encoded data
75 // Return:
76 //              encoded samples
77 //----------------------------------------------------------------------------
78 s32 WENCGetEncodeData( WENCInfo*  info,
79                        u32        flag,
80                        const s16* pbyPcmData,
81                        s32        nSampleNum,
82                        u8*        pbyEncData );
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif // __WENC_H__
89