aboutsummaryrefslogtreecommitdiff
path: root/lib/xbadpcm/uXboxAdpcmDecoder.h
blob: 69356d4e76ff21c5bac92e217df5f5ed4e607163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
  TXboxAdpcmDecoder class
  (c) 2005 Benjamin Haisch

  Revision 2 with stereo support

###
  C conversion 0.1.3
  by Luigi Auriemma
  e-mail: aluigi@autistici.org
  web:    aluigi.org

    Copyright 2005,2006 Luigi Auriemma

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA

    http://www.gnu.org/licenses/gpl.txt
*/

#include <stdio.h>

typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed char int8_t;

#define XBOX_ADPCM_SRCSIZE  36
#define XBOX_ADPCM_DSTSIZE  130

int TXboxAdpcmDecoder_Decode_Memory(
    uint8_t *in,        // input buffer
    int     inlen,      // input size MUST BE a multiplier of XBOX_ADPCM_SRCSIZE
    uint8_t *out,       // output buffer
    int     FChannels   // channels
);

int TXboxAdpcmDecoder_Decode(
    FILE    *ASource,   // input file
    FILE    *ADest,     // output file
    int     SourcePos,  // fseek offset, use -1 for none
    int     SourceSize, // size of the input audio block, use -1 for all
    int     AChannels   // number of channels, usually 2
);


int TXboxAdpcmDecoder_guess_output_size(
    int     SourceSize  // size of the input audio block
);