Skip to content

Commit 0a92d0e

Browse files
committed
Cleanup audio
1 parent 6c18fff commit 0a92d0e

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

OdysseyGameCore.m

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -475,33 +475,17 @@ - (void)executeFrame
475475
{
476476
//run();
477477
cpu_exec();
478-
478+
479479
int len = evblclk == EVBLCLK_NTSC ? 44100/60 : 44100/50;
480-
//for(int x=0; x<len; x++)
481-
//[[current ringBufferAtIndex:0] write:soundBuffer maxLength:len];
482-
// signed short int *p=(signed short int *)SNDBUF;
483-
// for(int x=0; x<len; x++)
484-
// {
485-
// //[[current ringBufferAtIndex:0] write:p maxLength:len*4];
486-
// [[current ringBufferAtIndex:0] write:p[0] maxLength:2];
487-
// [[current ringBufferAtIndex:0] write:p[1] maxLength:2];
488-
// }
489-
490-
//audio_cb(*p, *p++);
491-
480+
492481
// Convert 8u to 16s
493-
for(int i = 0; i != len; i ++)
482+
for(int i = 0; i < len; i++)
494483
{
495-
int16_t sample16 = (soundBuffer[i] << 8) - 32768;
496-
int16_t frame[2] = {sample16, sample16};
497-
//audio_cb(frame[0], frame[1]);
498-
//[[current ringBufferAtIndex:0] write:frame maxLength:2];
499-
//[[current ringBufferAtIndex:0] write:frame[1] maxLength:2];
500-
501-
[[current ringBufferAtIndex:0] write:&frame[0] maxLength:2];
502-
[[current ringBufferAtIndex:0] write:&frame[1] maxLength:2];
484+
int16_t sample16 = (soundBuffer[i] - 128 ) << 8;
485+
486+
[[current ringBufferAtIndex:0] write:&sample16 maxLength:2];
503487
}
504-
488+
505489
RLOOP=1;
506490
}
507491

@@ -561,7 +545,7 @@ - (NSTimeInterval)frameInterval
561545

562546
- (NSUInteger)channelCount
563547
{
564-
return 2;
548+
return 1;
565549
}
566550

567551
- (double)audioSampleRate

0 commit comments

Comments
 (0)