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.3  08/10/2006 02:29:54  aka
15   Changed WENCGetEncodeBufferSize().
16 
17   Revision 1.2  08/09/2006 00:39:55  aka
18   Changed an argument.
19 
20   Revision 1.1  07/18/2006 05:44:31  aka
21   Initial check-in.
22 
23   $NoKeywords: $
24  *---------------------------------------------------------------------------*/
25 
26 #ifndef __WENC_H__
27 #define __WENC_H__
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 //----------------------------------------------------------------------------
34 // encode flag definition
35 //----------------------------------------------------------------------------
36 #define WENC_FLAG_FIRST  0x00000000
37 #define WENC_FLAG_CONT   0x00000001
38 #define WENC_FLAG_LAST   0x00000002
39 
40 //----------------------------------------------------------------------------
41 // encode information structure
42 //----------------------------------------------------------------------------
43 typedef struct
44 {
45     u8   data[32];
46 
47 } WENCInfo;
48 
49 //----------------------------------------------------------------------------
50 // Function:
51 //              WENCGetEncodeBufferSize()
52 // Input:
53 //              nSampleNum:                   number of PCM data.
54 // Return   :
55 //              output buffer size [byte].
56 // Description:
57 //              calculate output buffer size (byte) which application need to
58 //              alloc before calling WENCGetEncodeData().
59 //----------------------------------------------------------------------------
60 #define WENCGetEncodeBufferSize( nSampleNum )  (((nSampleNum) + 1) / 2 + 4)
61 
62 //----------------------------------------------------------------------------
63 // Function:
64 //              WENCGetEncodeData()
65 // Input:
66 //              WENCInfo*  info:              pointer to WENCInfo structure
67 //              u32        flag:              encode control flag
68 //              const s16* pbyPcmData:        PCM data
69 //              s32        nSampleNum:        number of PCM data.
70 // Output:
71 //              u8*        pbyEncData:        Encoded data
72 // Return   :
73 //              encoded samples
74 //----------------------------------------------------------------------------
75 s32 WENCGetEncodeData( WENCInfo*  info,
76                        u32        flag,
77                        const s16* pbyPcmData,
78                        s32        nSampleNum,
79                        u8*        pbyEncData );
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif // __WENC_H__
86