Unverified Commit 1c509b5f authored by kps501's avatar kps501 Committed by GitHub
Browse files

libretro: compiler warnings

parent 462b335f
......@@ -132,9 +132,7 @@ static short const gauss [512] =
inline int SPC_DSP::interpolate( voice_t const* v )
{
// libretro: alternate methods
extern bool8 get_snes_interp();
extern int snes_interp(void *ptr);
if(get_snes_interp()) return snes_interp((void*)v);
if(libretro_get_snes_interp()) return libretro_snes_interp((void*)v);
// Make pointers into gaussian based on fractional position between samples
int offset = v->interp_pos >> 4 & 0xFF;
......
#include <snes/snes.hpp>
extern bool8 libretro_get_snes_interp();
extern int libretro_snes_interp(void *ptr);
#define DSP_CPP
namespace SNES {
......
......@@ -799,7 +799,7 @@ static void Remove_Header(uint8_t *&romptr, size_t &romsize, bool multicart_sufa
}
}
static bool LoadBIOS(uint8 *biosrom, const char *biosname, int biossize)
static bool LoadBIOS(uint8 *biosrom, const char *biosname, size_t biossize)
{
FILE *fp;
char name[PATH_MAX + 1];
......@@ -973,7 +973,7 @@ bool retro_load_game_special(unsigned game_type, const struct retro_game_info *i
uint8_t *romptr[3];
size_t romsize[3];
for(int lcv=0; lcv<num_info; lcv++)
for(size_t lcv=0; lcv<num_info; lcv++)
{
romptr[lcv] = (uint8_t *) info[lcv].data;
romsize[lcv] = info[lcv].size;
......@@ -1713,77 +1713,77 @@ void S9xAutoSaveSRAM()
return;
}
bool8 get_snes_interp()
bool8 libretro_get_snes_interp()
{
if(audio_interp_mode != 2) return true;
return false;
}
#include "fir_lut.h"
int snes_interp(void *ptr)
int libretro_snes_interp(void *ptr)
{
SNES::SPC_DSP::voice_t const* v = (SNES::SPC_DSP::voice_t const*) ptr;
int offset = v->buf_pos + (v->interp_pos >> 12);
int poffset = (v->interp_pos >> 4) & 0xff;
int output;
switch(audio_interp_mode)
{
// none
case 0:
output = v->buf[offset];
break;
// linear
case 1:
output = v->buf[offset + 0];
output += v->buf[offset + 1];
break;
// gaussian
case 2:
break;
// cubic
case 3:
output = (audio_cubic_table[poffset + 256*3] * v->buf[offset + 0]) >> 11;
output += (audio_cubic_table[poffset + 256*2] * v->buf[offset + 1]) >> 11;
output += (audio_cubic_table[poffset + 256*1] * v->buf[offset + 2]) >> 11;
output += (audio_cubic_table[poffset + 256*0] * v->buf[offset + 3]) >> 11;
break;
// 8-tap
case 4:
// 12-bit ==> 11-bit table
poffset = (v->interp_pos >> 1) & 0x7ff;
output = (audio_fir_lut[poffset*8 + 0] * v->buf[offset + 0]) >> 11;
output += (audio_fir_lut[poffset*8 + 1] * v->buf[offset + 1]) >> 11;
output += (audio_fir_lut[poffset*8 + 2] * v->buf[offset + 2]) >> 11;
output += (audio_fir_lut[poffset*8 + 3] * v->buf[offset + 3]) >> 11;
output += (audio_fir_lut[poffset*8 + 4] * v->buf[offset + 4]) >> 11;
output += (audio_fir_lut[poffset*8 + 5] * v->buf[offset + 5]) >> 11;
output += (audio_fir_lut[poffset*8 + 6] * v->buf[offset + 6]) >> 11;
output += (audio_fir_lut[poffset*8 + 7] * v->buf[offset + 7]) >> 11;
break;
}
float temp_f;
while(1)
{
temp_f = (float) output;
temp_f *= 32767.0f / audio_interp_max;
if( temp_f > 32767.0f ) audio_interp_max = output;
else if( temp_f < -32768.0f ) audio_interp_max = -output;
else break;
}
output = (int) temp_f;
if( output > 32767 ) output = 32767;
if( output < -32768 ) output = -32768;
return output;
int offset = v->buf_pos + (v->interp_pos >> 12);
int poffset = (v->interp_pos >> 4) & 0xff;
int output = 0;
switch(audio_interp_mode)
{
// none
case 0:
output = v->buf[offset];
break;
// linear
case 1:
output = v->buf[offset + 0];
output += v->buf[offset + 1];
break;
// gaussian
case 2:
break;
// cubic
case 3:
output = (audio_cubic_table[poffset + 256*3] * v->buf[offset + 0]) >> 11;
output += (audio_cubic_table[poffset + 256*2] * v->buf[offset + 1]) >> 11;
output += (audio_cubic_table[poffset + 256*1] * v->buf[offset + 2]) >> 11;
output += (audio_cubic_table[poffset + 256*0] * v->buf[offset + 3]) >> 11;
break;
// 8-tap
case 4:
// 12-bit ==> 11-bit table
poffset = (v->interp_pos >> 1) & 0x7ff;
output = (audio_fir_lut[poffset*8 + 0] * v->buf[offset + 0]) >> 11;
output += (audio_fir_lut[poffset*8 + 1] * v->buf[offset + 1]) >> 11;
output += (audio_fir_lut[poffset*8 + 2] * v->buf[offset + 2]) >> 11;
output += (audio_fir_lut[poffset*8 + 3] * v->buf[offset + 3]) >> 11;
output += (audio_fir_lut[poffset*8 + 4] * v->buf[offset + 4]) >> 11;
output += (audio_fir_lut[poffset*8 + 5] * v->buf[offset + 5]) >> 11;
output += (audio_fir_lut[poffset*8 + 6] * v->buf[offset + 6]) >> 11;
output += (audio_fir_lut[poffset*8 + 7] * v->buf[offset + 7]) >> 11;
break;
}
float temp_f;
while(1)
{
temp_f = (float) output;
temp_f *= 32767.0f / audio_interp_max;
if( temp_f > 32767.0f ) audio_interp_max = output;
else if( temp_f < -32768.0f ) audio_interp_max = -output;
else break;
}
output = (int) temp_f;
if( output > 32767 ) output = 32767;
if( output < -32768 ) output = -32768;
return output;
}
#ifndef __WIN32__
......
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