mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2025-02-16 20:39:15 +01:00
Fixed sound (SID_SDL.i is no longer needed)
This commit is contained in:
parent
2cc88f4b8e
commit
3f0e81b274
@ -100,7 +100,7 @@ CIA_SC.o: CIA_SC.cpp CIA.h CPUC64.h CPU1541.h VIC.h Prefs.h
|
||||
main.o: sysdeps.h sysconfig.h main.h C64.h Display.h Prefs.h SAM.h main_x.i
|
||||
Display.o: sysdeps.h sysconfig.h Display.h main.h Prefs.h Display_SDL.i
|
||||
Prefs.o: sysdeps.h sysconfig.h Prefs.h Display.h C64.h main.h
|
||||
SID.o: sysdeps.h sysconfig.h SID.h Prefs.h SID_SDL.i
|
||||
SID.o: sysdeps.h sysconfig.h SID.h Prefs.h SID_linux.i
|
||||
REU.o: sysdeps.h sysconfig.h REU.h CPUC64.h C64.h Prefs.h
|
||||
IEC.o: sysdeps.h sysconfig.h IEC.h 1541fs.h 1541d64.h 1541t64.h Prefs.h
|
||||
IEC.o: Display.h
|
||||
|
@ -1367,9 +1367,6 @@ void DigitalRenderer::calc_buffer(int16 *buf, long count)
|
||||
#elif defined(GEKKO)
|
||||
#include "SID_wii.i"
|
||||
|
||||
#elif defined(HAVE_SDL)
|
||||
#include "SID_SDL.i"
|
||||
|
||||
#elif defined(__linux__)
|
||||
#include "SID_linux.i"
|
||||
|
||||
|
@ -15,13 +15,14 @@
|
||||
|
||||
void DigitalRenderer::init_sound(void)
|
||||
{
|
||||
this->sndbufsize = 1024;
|
||||
this->sndbufsize = 512;
|
||||
|
||||
ready = false;
|
||||
InitialiseAudio();
|
||||
ResetAudio();
|
||||
|
||||
this->sound_buffer = new int16[this->sndbufsize];
|
||||
memset(this->sound_buffer, 0, sizeof(int16) * this->sndbufsize);
|
||||
ready = true;
|
||||
}
|
||||
|
||||
@ -64,7 +65,6 @@ void DigitalRenderer::EmulateLine(void)
|
||||
{
|
||||
static int divisor = 0;
|
||||
static int to_output = 0;
|
||||
static int buffer_pos = 0;
|
||||
|
||||
if (!ready)
|
||||
return;
|
||||
@ -83,11 +83,11 @@ void DigitalRenderer::EmulateLine(void)
|
||||
* Calculate the sound data only when we have enough to fill
|
||||
* the buffer entirely.
|
||||
*/
|
||||
if ((buffer_pos + to_output) >= sndbufsize) {
|
||||
int datalen = sndbufsize - buffer_pos;
|
||||
if (to_output >= sndbufsize) {
|
||||
int datalen = sndbufsize;
|
||||
to_output -= datalen;
|
||||
calc_buffer(sound_buffer + buffer_pos, datalen*2);
|
||||
PlaySound((uint16_t*)sound_buffer, sndbufsize);
|
||||
buffer_pos = 0;
|
||||
calc_buffer(sound_buffer, datalen * 2);
|
||||
|
||||
PlaySound(sound_buffer, datalen);
|
||||
}
|
||||
}
|
||||
|
@ -118,19 +118,23 @@ void ResetAudio()
|
||||
* Puts incoming mono samples into mixbuffer
|
||||
* Splits mono samples into two channels (stereo)
|
||||
****************************************************************************/
|
||||
void PlaySound( uint16_t *Buffer, int count )
|
||||
void PlaySound( int16_t *Buffer, int count )
|
||||
{
|
||||
int i;
|
||||
u16 sample;
|
||||
u32 *dst = (u32 *)mixbuffer;
|
||||
u32 level;
|
||||
|
||||
/* Protect against interrupts while adjusting head */
|
||||
level = IRQ_Disable();
|
||||
for( i = 0; i < count; i++ )
|
||||
{
|
||||
sample = Buffer[i];
|
||||
sample = (Buffer[i] & 0xffff) + 8192;
|
||||
dst[mixhead++] = sample | ( sample << 16);
|
||||
if (mixhead == 4000)
|
||||
mixhead = 0;
|
||||
}
|
||||
IRQ_Restore(level);
|
||||
|
||||
// Restart Sound Processing if stopped
|
||||
if (IsPlaying == 0)
|
||||
|
@ -20,7 +20,7 @@ extern "C" {
|
||||
void InitialiseAudio();
|
||||
void StopAudio();
|
||||
void ResetAudio();
|
||||
void PlaySound( uint16_t *Buffer, int samples );
|
||||
void PlaySound( int16_t *Buffer, int samples );
|
||||
|
||||
#if defined(__cplusplus)
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user