1
// Copyright (c) 2012- PPSSPP Project.
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
20
#include "sceAudiocodec.h"
24
void Register_sceAtrac3plus();
26
void __AtracDoState(PointerWrap &p);
27
void __AtracShutdown();
29
enum AtracStatus : u8 {
30
ATRAC_STATUS_NO_DATA = 1,
31
ATRAC_STATUS_ALL_DATA_LOADED = 2,
32
ATRAC_STATUS_HALFWAY_BUFFER = 3,
33
ATRAC_STATUS_STREAMED_WITHOUT_LOOP = 4,
34
ATRAC_STATUS_STREAMED_LOOP_FROM_END = 5,
35
// This means there's additional audio after the loop.
36
// i.e. ~~before loop~~ [ ~~this part loops~~ ] ~~after loop~~
37
// The "fork in the road" means a second buffer is needed for the second path.
38
ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER = 6,
39
ATRAC_STATUS_LOW_LEVEL = 8,
40
ATRAC_STATUS_FOR_SCESAS = 16,
42
ATRAC_STATUS_STREAMED_MASK = 4,
45
#if COMMON_LITTLE_ENDIAN
46
typedef AtracStatus AtracStatus_le;
48
typedef swap_struct_t<AtracStatus, swap_32_t<AtracStatus> > AtracStatus_le;
53
u32_le decodePos; // 0
54
u32_le endSample; // 4
55
u32_le loopStart; // 8
57
s32_le samplesPerChan; // 16
59
// 2: all the stream data on the buffer
60
// 6: looping -> second buffer needed
61
AtracStatus_le state; // 21
64
u16_le sampleSize; // 24
70
u32_le streamDataByte; // 44
74
u32_le secondBuffer; // 60
75
u32_le bufferByte; // 64
76
u32_le secondBufferByte; // 68
77
// make sure the size is 128
84
SceAudiocodecCodec codec;
89
// provide some decoder interface
91
u32 _AtracAddStreamData(int atracID, u32 bufPtr, u32 bytesToAdd);
92
u32 _AtracDecodeData(int atracID, u8* outbuf, u32 outbufPtr, u32 *SamplesNum, u32* finish, int *remains);
93
int _AtracGetIDByContext(u32 contextAddr);
b'\\ No newline at end of file'