Revert "Rewrite some code for ease of reading"
sorry, it got less readable now
This reverts commit 5448068426
.
This commit is contained in:
parent
5448068426
commit
a86f5df428
1 changed files with 10 additions and 7 deletions
|
@ -34,22 +34,25 @@ static inline void soundWait() {
|
|||
audio_info_t audioInfo;
|
||||
ioctl(sndfp, AUDIO_GETINFO, &audioInfo);
|
||||
int playedBefore = audioInfo.play.samples;
|
||||
while(audioInfo.play.samples - playedBefore < samplesPerGo) {
|
||||
int playedNow = audioInfo.play.samples;
|
||||
while(playedNow - playedBefore < samplesPerGo) {
|
||||
Backend_Delay(10);
|
||||
ioctl(sndfp, AUDIO_GETINFO, &audioInfo);
|
||||
playedNow = audioInfo.play.samples;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void feedOutSound(long* mix) {
|
||||
for(int i = 0; i < samplesPerGo * 2; i++) {
|
||||
short sample = mix[i];
|
||||
if(mix[i] > 0x7FFF) {
|
||||
mix[i] = 0x7FFF;
|
||||
sample = 0x7FFF;
|
||||
}
|
||||
else if(mix[i] < -0x7FFF) {
|
||||
mix[i] = -0x7FFF;
|
||||
if(mix[i] < -0x7FFF) {
|
||||
sample = -0x7FFF;
|
||||
}
|
||||
fputc((mix[i] >> 8) & 0xFF, sndfile);
|
||||
fputc(mix[i] & 0xFF, sndfile);
|
||||
fputc((sample >> 8) & 0xFF, sndfile);
|
||||
fputc(sample & 0xFF, sndfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue