types
This commit is contained in:
@@ -792,11 +792,11 @@ void RageDisplay_D3D::DrawQuadsInternal( const RageSpriteVertex v[], int iNumVer
|
||||
int iNumIndices = iNumTriangles*3;
|
||||
|
||||
// make a temporary index buffer
|
||||
static vector<Uint16> vIndices;
|
||||
static vector<uint16_t> vIndices;
|
||||
unsigned uOldSize = vIndices.size();
|
||||
unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices);
|
||||
vIndices.resize( uNewSize );
|
||||
for( Uint16 i=(Uint16)uOldSize/6; i<(Uint16)iNumQuads; i++ )
|
||||
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
|
||||
{
|
||||
vIndices[i*6+0] = i*4+0;
|
||||
vIndices[i*6+1] = i*4+1;
|
||||
@@ -828,11 +828,11 @@ void RageDisplay_D3D::DrawQuadStripInternal( const RageSpriteVertex v[], int iNu
|
||||
int iNumIndices = iNumTriangles*3;
|
||||
|
||||
// make a temporary index buffer
|
||||
static vector<Uint16> vIndices;
|
||||
static vector<uint16_t> vIndices;
|
||||
unsigned uOldSize = vIndices.size();
|
||||
unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices);
|
||||
vIndices.resize( uNewSize );
|
||||
for( Uint16 i=(Uint16)uOldSize/6; i<(Uint16)iNumQuads; i++ )
|
||||
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
|
||||
{
|
||||
vIndices[i*6+0] = i*2+0;
|
||||
vIndices[i*6+1] = i*2+1;
|
||||
@@ -1253,8 +1253,8 @@ void RageDisplay_D3D::UpdateTexture(
|
||||
ASSERT( Texture );
|
||||
SDL_Rect area;
|
||||
area.x = area.y = 0;
|
||||
area.w = (Uint16) width;
|
||||
area.h = (Uint16) height;
|
||||
area.w = (uint16_t) width;
|
||||
area.h = (uint16_t) height;
|
||||
SDL_SetAlpha( img, 0, SDL_ALPHA_OPAQUE );
|
||||
// SDL_SetColorKey( img, 0, 0 );
|
||||
// SDL_BlitSurface( img, &area, Texture, &area );
|
||||
|
||||
+12
-12
@@ -227,17 +227,17 @@ void RageSound::RateChange(char *buf, int &cnt,
|
||||
|
||||
for(int c = 0; c < channels; ++c)
|
||||
{
|
||||
const Sint16 *in = (const Sint16 *) inbuf_tmp;
|
||||
Sint16 *out = (Sint16 *) buf;
|
||||
const int16_t *in = (const int16_t *) inbuf_tmp;
|
||||
int16_t *out = (int16_t *) buf;
|
||||
in += c;
|
||||
out += c;
|
||||
for(unsigned n = 0; n < cnt/(channels * sizeof(Sint16)); n += speed_input_samples)
|
||||
for(unsigned n = 0; n < cnt/(channels * sizeof(int16_t)); n += speed_input_samples)
|
||||
{
|
||||
|
||||
/* Input 4 samples, output 5; 25% slowdown with no
|
||||
* rounding error. */
|
||||
|
||||
Sint16 samps[20]; // max 2x rate
|
||||
int16_t samps[20]; // max 2x rate
|
||||
ASSERT(size_t(speed_input_samples) <= sizeof(samps)/sizeof(*samps));
|
||||
int s;
|
||||
for(s = 0; s < speed_input_samples; ++s) {
|
||||
@@ -254,7 +254,7 @@ void RageSound::RateChange(char *buf, int &cnt,
|
||||
if(s+1 < speed_output_samples)
|
||||
val += int(samps[p+1] * frac);
|
||||
|
||||
*out = Sint16(val);
|
||||
*out = int16_t(val);
|
||||
pos += incr;
|
||||
out += channels;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ int RageSound::FillBuf( int frames )
|
||||
|
||||
/* Read in blocks that are a multiple of a sample, the number of
|
||||
* channels and the number of input samples. */
|
||||
int block_size = sizeof(Sint16) * channels * m_Param.speed_input_samples;
|
||||
int block_size = sizeof(int16_t) * channels * m_Param.speed_input_samples;
|
||||
read_size = (read_size / block_size) * block_size;
|
||||
ASSERT(read_size < sizeof(inbuf));
|
||||
}
|
||||
@@ -354,7 +354,7 @@ int RageSound::GetData( char *buffer, int frames )
|
||||
}
|
||||
|
||||
/* Adjust the balance of buffer; fBalance is -1...+1. */
|
||||
void AdjustBalance( Sint16 *buffer, int frames, float fBalance )
|
||||
void AdjustBalance( int16_t *buffer, int frames, float fBalance )
|
||||
{
|
||||
if( fBalance == 0 )
|
||||
return; /* no change */
|
||||
@@ -379,15 +379,15 @@ void AdjustBalance( Sint16 *buffer, int frames, float fBalance )
|
||||
RAGE_ASSERT_M( channels == 2, ssprintf("%i", channels) );
|
||||
for( int samp = 0; samp < frames; ++samp )
|
||||
{
|
||||
Sint16 l = Sint16(buffer[0]*fLeftFactors[0] + buffer[1]*fLeftFactors[1]);
|
||||
Sint16 r = Sint16(buffer[0]*fRightFactors[0] + buffer[1]*fRightFactors[1]);
|
||||
int16_t l = int16_t(buffer[0]*fLeftFactors[0] + buffer[1]*fLeftFactors[1]);
|
||||
int16_t r = int16_t(buffer[0]*fRightFactors[0] + buffer[1]*fRightFactors[1]);
|
||||
buffer[0] = l;
|
||||
buffer[1] = r;
|
||||
buffer += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void FadeSound( Sint16 *buffer, int frames, float fStartVolume, float fEndVolume )
|
||||
void FadeSound( int16_t *buffer, int frames, float fStartVolume, float fEndVolume )
|
||||
{
|
||||
for( int samp = 0; samp < frames; ++samp )
|
||||
{
|
||||
@@ -503,10 +503,10 @@ bool RageSound::GetDataToPlay( int16_t *buffer, int size, int &sound_frame, int
|
||||
const float fLastSecond = m_Param.m_StartSecond+m_Param.m_LengthSeconds;
|
||||
const float fStartVolume = fLastSecond - float(decode_position) / samplerate();
|
||||
const float fEndVolume = fLastSecond - float(decode_position+got_frames) / samplerate();
|
||||
FadeSound( (Sint16 *) buffer, got_frames, fStartVolume, fEndVolume );
|
||||
FadeSound( buffer, got_frames, fStartVolume, fEndVolume );
|
||||
}
|
||||
|
||||
AdjustBalance( (Sint16 *) buffer, got_frames, m_Param.m_Balance );
|
||||
AdjustBalance( buffer, got_frames, m_Param.m_Balance );
|
||||
|
||||
sound_frame = decode_position;
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ bool RageSoundReader_Resample_Good::FillBuf()
|
||||
if( !samples_free )
|
||||
return true;
|
||||
|
||||
Sint16 tmpbuf[BUFSIZE*2];
|
||||
int cnt = source->Read((char *) tmpbuf, samples_free * sizeof(Sint16) * 2);
|
||||
int16_t tmpbuf[BUFSIZE*2];
|
||||
int cnt = source->Read((char *) tmpbuf, samples_free * sizeof(int16_t) * 2);
|
||||
|
||||
if( cnt == -1 )
|
||||
{
|
||||
@@ -132,10 +132,10 @@ bool RageSoundReader_Resample_Good::FillBuf()
|
||||
return false;
|
||||
}
|
||||
|
||||
if( (unsigned) cnt < samples_free * sizeof(Sint16) * 2 )
|
||||
if( (unsigned) cnt < samples_free * sizeof(int16_t) * 2 )
|
||||
eof = true;
|
||||
|
||||
cnt /= sizeof(Sint16);
|
||||
cnt /= sizeof(int16_t);
|
||||
cnt /= 2;
|
||||
|
||||
for( int c = 0; c < 2; ++c )
|
||||
@@ -149,7 +149,7 @@ bool RageSoundReader_Resample_Good::FillBuf()
|
||||
|
||||
int RageSoundReader_Resample_Good::Read(char *bufp, unsigned len)
|
||||
{
|
||||
Sint16 *buf = (Sint16 *) bufp;
|
||||
int16_t *buf = (int16_t *) bufp;
|
||||
len /= 2;
|
||||
const float factor = GetFactor();
|
||||
|
||||
@@ -176,7 +176,7 @@ int RageSoundReader_Resample_Good::Read(char *bufp, unsigned len)
|
||||
|
||||
for( int s = 0; s < samples_output; ++s )
|
||||
{
|
||||
buf[s*2+c] = Sint16(clamp(outbuf[s], -32768, 32767));
|
||||
buf[s*2+c] = int16_t(clamp(outbuf[s], -32768, 32767));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ int RageSoundReader_Resample_Good::Read(char *bufp, unsigned len)
|
||||
|
||||
len -= samples_output*2;
|
||||
buf += samples_output*2;
|
||||
bytes_read += samples_output*2*sizeof(Sint16);
|
||||
bytes_read += samples_output*2*sizeof(int16_t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -247,9 +247,9 @@ bool RageSoundReader_Vorbisfile::FillBuf()
|
||||
ASSERT( vi->channels == 1 || vi->channels == 2 );
|
||||
if( vi->channels == 1 )
|
||||
{
|
||||
Sint16 *indata = (Sint16 *)tmpbuf;
|
||||
Sint16 *outdata = (Sint16 *)buffer;
|
||||
int size = ret / sizeof(Sint16);
|
||||
int16_t *indata = (int16_t *)tmpbuf;
|
||||
int16_t *outdata = (int16_t *)buffer;
|
||||
int size = ret / sizeof(int16_t);
|
||||
for( unsigned pos = 0; pos < unsigned(size); ++pos )
|
||||
outdata[pos*2] = outdata[pos*2+1] = indata[pos];
|
||||
ret *= 2;
|
||||
|
||||
Reference in New Issue
Block a user