Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/HLE/sceAudiocodec.h
3187 views
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 <map>
21
22
class PointerWrap;
23
24
// audioType
25
enum PSPAudioType {
26
PSP_CODEC_AT3PLUS = 0x00001000,
27
PSP_CODEC_AT3 = 0x00001001,
28
PSP_CODEC_MP3 = 0x00001002,
29
PSP_CODEC_AAC = 0x00001003, // sceMp4 decodes this in an mp4 container
30
PSP_CODEC_WMA = 0x00001005,
31
};
32
33
struct SceAudiocodecCodec {
34
s32 unk_init;
35
s32 unk4;
36
s32 err; // 8
37
s32 edramAddr; // c // presumably in ME memory?
38
s32 neededMem; // 10 // 0x102400 for Atrac3+
39
s32 inited; // 14
40
u32 inBuf; // 18 // Before decoding, set this to the start of the raw frame.
41
s32 srcBytesRead; // 1c
42
u32 outBuf; // 20 // This is where the decoded data is written.
43
s32 dstSamplesWritten; // 24
44
// Probably, from here on out is a union with different fields for different codecs.
45
union { // offset 40 / 0x28
46
struct {
47
s8 unk40; // 28 format or looping related . Aka tailrelated
48
s8 unk41; // 29 format or looping related . Aka tailflag
49
s8 unk42;
50
s8 unk43;
51
};
52
u32 formatOutSamples;
53
};
54
union { // offset 44 / 0x2C
55
struct {
56
u8 unk44;
57
s8 unk45;
58
s8 unk46;
59
s8 unk47;
60
};
61
struct {
62
s16 unk44_16;
63
s16 unk46_16;
64
};
65
u32 unk44_32;
66
};
67
s32 unk48; // 30 Atrac3 (non-+) related. Zero with Atrac3+.
68
s32 unk52; // 34
69
s32 mp3_9999; // 38 // unk56
70
s32 mp3_3; // unk60 gets the value 3
71
s32 unk64; // Atrac3+ size related
72
s32 mp3_9;
73
s32 mp3_0;
74
s32 unk76;
75
s32 unk80;
76
s32 mp3_1_first;
77
s32 unk88;
78
s32 unk92;
79
s32 mp3_1;
80
s32 unk100;
81
u32 allocMem; // 104
82
// make sure the size is 128
83
u8 unk[20];
84
};
85
86
void __AudioCodecInit();
87
void __AudioCodecShutdown();
88
void Register_sceAudiocodec();
89
void __sceAudiocodecDoState(PointerWrap &p);
90
91
class AudioDecoder;
92
extern std::map<u32, AudioDecoder *> g_audioDecoderContexts;
93
94
bool IsAtrac3StreamJointStereo(int codecType, int bytesPerFrame, int channels);
95
96