Commit 4ae0a700 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Don't copy sound into intermediary buffer anymore

parent 3a6e0b9b
......@@ -760,7 +760,7 @@ static sscpu_timestamp_t MidSync(const sscpu_timestamp_t timestamp)
//
//printf("MidSync: %d\n", VDP2::PeekLine());
{
espec->SoundBufSize += SOUND_FlushOutput(espec->SoundBuf + (espec->SoundBufSize * 2), espec->SoundBufMaxSize - espec->SoundBufSize, false);
espec->SoundBufSize += SOUND_FlushOutput(NULL, espec->SoundBufMaxSize - espec->SoundBufSize, false);
espec->MasterCycles = timestamp * cur_clock_div;
}
//printf("%d\n", espec->SoundBufSize);
......@@ -828,7 +828,7 @@ static void Emulate(EmulateSpecStruct* espec_arg)
//
//
espec->MasterCycles = end_ts * cur_clock_div;
espec->SoundBufSize += SOUND_FlushOutput(espec->SoundBuf + (espec->SoundBufSize * 2), espec->SoundBufMaxSize - espec->SoundBufSize, espec->NeedSoundReverse);
espec->SoundBufSize += SOUND_FlushOutput(NULL, espec->SoundBufMaxSize - espec->SoundBufSize, espec->NeedSoundReverse);
espec->NeedSoundReverse = false;
//
//
......@@ -2819,7 +2819,10 @@ void retro_run(void)
audio_frames += spec.SoundBufSize;
video_cb(surf->pixels, width, height, 704 * sizeof(uint32_t));
audio_batch_cb(espec->SoundBuf, spec.SoundBufSize);
int16_t *interbuf = (int16_t*)&IBuffer;
audio_batch_cb(interbuf, spec.SoundBufSize);
}
void retro_get_system_info(struct retro_system_info *info)
......
......@@ -49,10 +49,8 @@ static int32 next_scsp_time;
static uint32 clock_ratio;
static sscpu_timestamp_t lastts;
static int16 IBuffer[1024][2];
int16_t IBuffer[1024][2];
static uint32 IBufferCount;
static int last_rate;
static uint32 last_quality;
static INLINE void SCSP_SoundIntChanged(unsigned level)
{
......@@ -89,9 +87,6 @@ void SOUND_Init(void)
memset(IBuffer, 0, sizeof(IBuffer));
IBufferCount = 0;
last_rate = -1;
last_quality = ~0U;
run_until_time = 0;
next_scsp_time = 0;
lastts = 0;
......@@ -227,18 +222,12 @@ sscpu_timestamp_t SOUND_Update(sscpu_timestamp_t timestamp)
void SOUND_StartFrame(double rate, uint32 quality)
{
if((int)rate != last_rate || quality != last_quality)
{
last_rate = (int)rate;
last_quality = quality;
}
}
int32 SOUND_FlushOutput(int16* SoundBuf, const int32 SoundBufMaxSize, const bool reverse)
{
int32 ret = IBufferCount;
memcpy(SoundBuf, IBuffer, IBufferCount * 2 * sizeof(int16));
IBufferCount = 0;
return(ret);
......
......@@ -22,6 +22,10 @@
#ifndef __MDFN_SS_SOUND_H
#define __MDFN_SS_SOUND_H
#include <stdint.h>
extern int16_t IBuffer[1024][2];
void SOUND_Init(void) MDFN_COLD;
void SOUND_Reset(bool powering_up) MDFN_COLD;
void SOUND_Kill(void) MDFN_COLD;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment