CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/HLE/sceAtrac.h
Views: 1401
1
// Copyright (c) 2012- PPSSPP Project.
2
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.
6
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.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
20
#include "sceAudiocodec.h"
21
22
class PointerWrap;
23
24
void Register_sceAtrac3plus();
25
void __AtracInit();
26
void __AtracDoState(PointerWrap &p);
27
void __AtracShutdown();
28
void __AtracLoadModule(int version, u32 crc);
29
30
enum AtracStatus : u8 {
31
ATRAC_STATUS_NO_DATA = 1,
32
ATRAC_STATUS_ALL_DATA_LOADED = 2,
33
ATRAC_STATUS_HALFWAY_BUFFER = 3,
34
ATRAC_STATUS_STREAMED_WITHOUT_LOOP = 4,
35
ATRAC_STATUS_STREAMED_LOOP_FROM_END = 5,
36
// This means there's additional audio after the loop.
37
// i.e. ~~before loop~~ [ ~~this part loops~~ ] ~~after loop~~
38
// The "fork in the road" means a second buffer is needed for the second path.
39
ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER = 6,
40
ATRAC_STATUS_LOW_LEVEL = 8,
41
ATRAC_STATUS_FOR_SCESAS = 16,
42
43
ATRAC_STATUS_STREAMED_MASK = 4,
44
};
45
46
#if COMMON_LITTLE_ENDIAN
47
typedef AtracStatus AtracStatus_le;
48
#else
49
typedef swap_struct_t<AtracStatus, swap_32_t<AtracStatus> > AtracStatus_le;
50
#endif
51
52
struct SceAtracIdInfo {
53
u32_le decodePos; // 0
54
u32_le endSample; // 4
55
u32_le loopStart; // 8
56
u32_le loopEnd; // 12
57
s32_le samplesPerChan; // 16
58
char numFrame; // 20
59
// 2: all the stream data on the buffer
60
// 6: looping -> second buffer needed
61
AtracStatus_le state; // 21
62
char unk22;
63
char numChan; // 23
64
u16_le sampleSize; // 24
65
u16_le codec; // 26
66
u32_le dataOff; // 28
67
u32_le curOff; // 32
68
u32_le dataEnd; // 36
69
s32_le loopNum; // 40
70
u32_le streamDataByte; // 44
71
u32_le unk48;
72
u32_le unk52;
73
u32_le buffer; // 56
74
u32_le secondBuffer; // 60
75
u32_le bufferByte; // 64
76
u32_le secondBufferByte; // 68
77
// make sure the size is 128
78
u8 unk[56];
79
};
80
81
struct SceAtracContext {
82
// size 128
83
SceAudiocodecCodec codec;
84
// size 128
85
SceAtracIdInfo info;
86
};
87
88
// External interface used by sceSas.
89
u32 AtracSasAddStreamData(int atracID, u32 bufPtr, u32 bytesToAdd);
90
u32 AtracSasDecodeData(int atracID, u8* outbuf, u32 outbufPtr, u32 *SamplesNum, u32* finish, int *remains);
91
int AtracSasGetIDByContext(u32 contextAddr);
92
93