@@ -86,115 +86,94 @@ void AudioChannel::clear()
86
86
// max or 50%?
87
87
static u32 sceAudioOutputBlocking (u32 chan, int vol, u32 samplePtr) {
88
88
if (vol > 0xFFFF ) {
89
- ERROR_LOG (Log::sceAudio, " sceAudioOutputBlocking() - invalid volume" );
90
- return SCE_ERROR_AUDIO_INVALID_VOLUME;
89
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_INVALID_VOLUME, " invalid volume" );
91
90
} else if (chan >= PSP_AUDIO_CHANNEL_MAX) {
92
- ERROR_LOG (Log::sceAudio, " sceAudioOutputBlocking() - bad channel" );
93
- return SCE_ERROR_AUDIO_INVALID_CHANNEL;
91
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_INVALID_CHANNEL, " bad channel" );
94
92
} else if (!chans[chan].reserved ) {
95
- ERROR_LOG (Log::sceAudio, " sceAudioOutputBlocking() - channel not reserved" );
96
- return SCE_ERROR_AUDIO_CHANNEL_NOT_INIT;
97
- } else {
98
- DEBUG_LOG (Log::sceAudio, " sceAudioOutputBlocking(%08x, %08x, %08x)" , chan, vol, samplePtr);
99
- if (vol >= 0 ) {
100
- chans[chan].leftVolume = vol;
101
- chans[chan].rightVolume = vol;
102
- }
103
- chans[chan].sampleAddress = samplePtr;
104
- return __AudioEnqueue (chans[chan], chan, true );
93
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_NOT_INIT, " channel not reserved" );
94
+ }
95
+
96
+ if (vol >= 0 ) {
97
+ chans[chan].leftVolume = vol;
98
+ chans[chan].rightVolume = vol;
105
99
}
100
+ chans[chan].sampleAddress = samplePtr;
101
+ return hleLogDebug (Log::sceAudio, __AudioEnqueue (chans[chan], chan, true ));
106
102
}
107
103
108
104
static u32 sceAudioOutputPannedBlocking (u32 chan, int leftvol, int rightvol, u32 samplePtr) {
109
- int result = 0 ;
110
105
// For some reason, this is the only one that checks for negative.
111
106
if (leftvol > 0xFFFF || rightvol > 0xFFFF || leftvol < 0 || rightvol < 0 ) {
112
- ERROR_LOG (Log::sceAudio, " sceAudioOutputPannedBlocking() - invalid volume" );
113
- result = SCE_ERROR_AUDIO_INVALID_VOLUME;
107
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_INVALID_VOLUME, " invalid volume" );
114
108
} else if (chan >= PSP_AUDIO_CHANNEL_MAX) {
115
- ERROR_LOG (Log::sceAudio, " sceAudioOutputPannedBlocking() - bad channel" );
116
- result = SCE_ERROR_AUDIO_INVALID_CHANNEL;
109
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_INVALID_CHANNEL, " bad channel" );
117
110
} else if (!chans[chan].reserved ) {
118
- ERROR_LOG (Log::sceAudio, " sceAudioOutputPannedBlocking() - channel not reserved" );
119
- result = SCE_ERROR_AUDIO_CHANNEL_NOT_INIT;
120
- } else {
121
- if (leftvol >= 0 ) {
122
- chans[chan].leftVolume = leftvol;
123
- }
124
- if (rightvol >= 0 ) {
125
- chans[chan].rightVolume = rightvol;
126
- }
127
- chans[chan].sampleAddress = samplePtr;
128
- result = __AudioEnqueue (chans[chan], chan, true );
111
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_NOT_INIT, " channel not reserved" );
129
112
}
130
113
131
- DEBUG_LOG (Log::sceAudio, " %08x = sceAudioOutputPannedBlocking(%08x, %08x, %08x, %08x)" , result, chan, leftvol, rightvol, samplePtr);
132
- return result;
133
-
114
+ if (leftvol >= 0 ) {
115
+ chans[chan].leftVolume = leftvol;
116
+ }
117
+ if (rightvol >= 0 ) {
118
+ chans[chan].rightVolume = rightvol;
119
+ }
120
+ chans[chan].sampleAddress = samplePtr;
121
+ u32 result = __AudioEnqueue (chans[chan], chan, true );
122
+ return hleLogDebug (Log::sceAudio, result);
134
123
}
135
124
136
125
static u32 sceAudioOutput (u32 chan, int vol, u32 samplePtr) {
137
126
if (vol > 0xFFFF ) {
138
- ERROR_LOG (Log::sceAudio, " sceAudioOutput() - invalid volume" );
139
- return SCE_ERROR_AUDIO_INVALID_VOLUME;
127
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_INVALID_VOLUME, " invalid volume" );
140
128
} else if (chan >= PSP_AUDIO_CHANNEL_MAX) {
141
- ERROR_LOG (Log::sceAudio, " sceAudioOutput() - bad channel" );
142
- return SCE_ERROR_AUDIO_INVALID_CHANNEL;
129
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_INVALID_CHANNEL, " bad channel" );
143
130
} else if (!chans[chan].reserved ) {
144
- ERROR_LOG (Log::sceAudio, " sceAudioOutput(%08x, %08x, %08x) - channel not reserved" , chan, vol, samplePtr);
145
- return SCE_ERROR_AUDIO_CHANNEL_NOT_INIT;
146
- } else {
147
- DEBUG_LOG (Log::sceAudio, " sceAudioOutput(%08x, %08x, %08x)" , chan, vol, samplePtr);
148
- if (vol >= 0 ) {
149
- chans[chan].leftVolume = vol;
150
- chans[chan].rightVolume = vol;
151
- }
152
- chans[chan].sampleAddress = samplePtr;
153
- return __AudioEnqueue (chans[chan], chan, false );
131
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_NOT_INIT, " channel not reserved" );
154
132
}
133
+
134
+ if (vol >= 0 ) {
135
+ chans[chan].leftVolume = vol;
136
+ chans[chan].rightVolume = vol;
137
+ }
138
+ chans[chan].sampleAddress = samplePtr;
139
+ u32 result = __AudioEnqueue (chans[chan], chan, false );
140
+ return hleLogDebug (Log::sceAudio, result);
155
141
}
156
142
157
143
static u32 sceAudioOutputPanned (u32 chan, int leftvol, int rightvol, u32 samplePtr) {
158
144
if (leftvol > 0xFFFF || rightvol > 0xFFFF ) {
159
- ERROR_LOG (Log::sceAudio, " sceAudioOutputPanned() - invalid volume" );
160
- return SCE_ERROR_AUDIO_INVALID_VOLUME;
145
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_INVALID_VOLUME, " invalid volume" );
161
146
} else if (chan >= PSP_AUDIO_CHANNEL_MAX) {
162
- ERROR_LOG (Log::sceAudio, " sceAudioOutputPanned() - bad channel" );
163
- return SCE_ERROR_AUDIO_INVALID_CHANNEL;
147
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_INVALID_CHANNEL, " bad channel" );
164
148
} else if (!chans[chan].reserved ) {
165
- ERROR_LOG (Log::sceAudio, " sceAudioOutputPanned(%08x, %08x, %08x, %08x) - channel not reserved" , chan, leftvol, rightvol, samplePtr);
166
- return SCE_ERROR_AUDIO_CHANNEL_NOT_INIT;
149
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_NOT_INIT, " channel not reserved" );
167
150
} else {
168
- DEBUG_LOG (Log::sceAudio, " sceAudioOutputPanned(%08x, %08x, %08x, %08x)" , chan, leftvol, rightvol, samplePtr);
169
151
if (leftvol >= 0 ) {
170
152
chans[chan].leftVolume = leftvol;
171
153
}
172
154
if (rightvol >= 0 ) {
173
155
chans[chan].rightVolume = rightvol;
174
156
}
175
157
chans[chan].sampleAddress = samplePtr;
176
- return __AudioEnqueue (chans[chan], chan, false );
158
+ u32 result = __AudioEnqueue (chans[chan], chan, false );
159
+ return hleLogDebug (Log::sceAudio, result);
177
160
}
178
161
}
179
162
180
163
static int sceAudioGetChannelRestLen (u32 chan) {
181
164
if (chan >= PSP_AUDIO_CHANNEL_MAX) {
182
- ERROR_LOG (Log::sceAudio, " sceAudioGetChannelRestLen(%08x) - bad channel" , chan);
183
- return SCE_ERROR_AUDIO_INVALID_CHANNEL;
165
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_INVALID_CHANNEL, " bad channel" );
184
166
}
185
167
int remainingSamples = (int )chanSampleQueues[chan].size () / 2 ;
186
- VERBOSE_LOG (Log::sceAudio, " %d=sceAudioGetChannelRestLen(%08x)" , remainingSamples, chan);
187
- return remainingSamples;
168
+ return hleLogVerbose (Log::sceAudio, remainingSamples);
188
169
}
189
170
190
171
static int sceAudioGetChannelRestLength (u32 chan) {
191
172
if (chan >= PSP_AUDIO_CHANNEL_MAX) {
192
- ERROR_LOG (Log::sceAudio, " sceAudioGetChannelRestLength(%08x) - bad channel" , chan);
193
- return SCE_ERROR_AUDIO_INVALID_CHANNEL;
173
+ return hleLogError (Log::sceAudio, SCE_ERROR_AUDIO_INVALID_CHANNEL, " bad channel" );
194
174
}
195
175
int remainingSamples = (int )chanSampleQueues[chan].size () / 2 ;
196
- VERBOSE_LOG (Log::sceAudio, " %d=sceAudioGetChannelRestLength(%08x)" , remainingSamples, chan);
197
- return remainingSamples;
176
+ return hleLogVerbose (Log::sceAudio, remainingSamples);
198
177
}
199
178
200
179
static u32 GetFreeChannel () {
@@ -474,18 +453,14 @@ static u32 sceAudioSRCOutputBlocking(u32 vol, u32 buf) {
474
453
475
454
static int sceAudioInputBlocking (u32 maxSamples, u32 sampleRate, u32 bufAddr) {
476
455
if (!Memory::IsValidAddress (bufAddr)) {
477
- ERROR_LOG (Log::HLE, " sceAudioInputBlocking(%d, %d, %08x): invalid addresses" , maxSamples, sampleRate, bufAddr);
478
- return -1 ;
456
+ return hleLogError (Log::HLE, -1 , " invalid address" );
479
457
}
480
-
481
- INFO_LOG (Log::HLE, " sceAudioInputBlocking: maxSamples: %d, samplerate: %d, bufAddr: %08x" , maxSamples, sampleRate, bufAddr);
482
- return __MicInput (maxSamples, sampleRate, bufAddr, AUDIOINPUT);
458
+ return hleLogSuccessInfoI (Log::HLE, __MicInput (maxSamples, sampleRate, bufAddr, AUDIOINPUT));
483
459
}
484
460
485
461
static int sceAudioInput (u32 maxSamples, u32 sampleRate, u32 bufAddr) {
486
462
if (!Memory::IsValidAddress (bufAddr)) {
487
- ERROR_LOG (Log::HLE, " sceAudioInput(%d, %d, %08x): invalid addresses" , maxSamples, sampleRate, bufAddr);
488
- return -1 ;
463
+ return hleLogError (Log::HLE, -1 , " invalid address" );
489
464
}
490
465
491
466
ERROR_LOG (Log::HLE, " UNTEST sceAudioInput: maxSamples: %d, samplerate: %d, bufAddr: %08x" , maxSamples, sampleRate, bufAddr);
0 commit comments