Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/HLE/sceAudio.h
3186 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 <queue>
21
22
#include "CommonTypes.h"
23
#include "sceKernel.h"
24
25
class PointerWrap;
26
27
enum PspAudioFormats { PSP_AUDIO_FORMAT_STEREO = 0, PSP_AUDIO_FORMAT_MONO = 0x10 };
28
enum PspAudioFrequencies { PSP_AUDIO_FREQ_44K = 44100, PSP_AUDIO_FREQ_48K = 48000 };
29
30
const u32 PSP_AUDIO_CHANNEL_MAX = 8;
31
32
const int PSP_AUDIO_CHANNEL_SRC = 8;
33
const int PSP_AUDIO_CHANNEL_OUTPUT2 = 8;
34
const int PSP_AUDIO_CHANNEL_VAUDIO = 8;
35
36
struct AudioChannelWaitInfo {
37
SceUID threadID;
38
int numSamples;
39
};
40
41
struct AudioChannel {
42
int index = 0;
43
bool reserved = false;
44
45
// last sample address
46
u32 sampleAddress = 0;
47
u32 sampleCount = 0; // Number of samples written in each OutputBlocking
48
u32 leftVolume = 0;
49
u32 rightVolume = 0;
50
u32 format = 0;
51
52
// For the debugger only. Not saved.
53
bool mute = false;
54
55
std::vector<AudioChannelWaitInfo> waitingThreads;
56
57
void DoState(PointerWrap &p);
58
59
void reset();
60
void clear();
61
};
62
63
// The extra channel is for SRC/Output2/Vaudio (who all share, apparently.)
64
extern AudioChannel g_audioChans[PSP_AUDIO_CHANNEL_MAX + 1];
65
66
void Register_sceAudio();
67
68
69