Remove std prefix from int types

std::int* -> int*
This commit is contained in:
sukibaby
2024-10-08 20:52:52 -07:00
committed by teejusb
parent fbe0e0b658
commit a6a60e2e56
71 changed files with 256 additions and 256 deletions
+1 -1
View File
@@ -340,7 +340,7 @@ typedef unsigned IPos; // A Pos is an index in the character window. Pos is used
typedef std::int64_t lutime_t; // define it ourselves since we don't include time.h
typedef int64_t lutime_t; // define it ourselves since we don't include time.h
typedef struct iztimes {
lutime_t atime,mtime,ctime;
+2 -2
View File
@@ -544,7 +544,7 @@ void Model::PlayAnimation( const RString &sAniName, float fPlayRate )
{
// int iBoneIndex = (pMesh->m_iBoneIndex!=-1) ? pMesh->m_iBoneIndex : bone;
RageVector3 &pos = Vertices[j].p;
std::int8_t bone = Vertices[j].bone;
int8_t bone = Vertices[j].bone;
if( bone != -1 )
{
pos[0] -= m_vpBones[bone].m_Absolute.m[3][0];
@@ -701,7 +701,7 @@ void Model::UpdateTempGeometry()
RageVector3 &tempNormal = tempVertices[j].n;
const RageVector3 &originalPos = origVertices[j].p;
const RageVector3 &originalNormal = origVertices[j].n;
std::int8_t bone = origVertices[j].bone;
int8_t bone = origVertices[j].bone;
if( bone == -1 )
{
+2 -2
View File
@@ -17,14 +17,14 @@ struct msTriangle
struct msMesh
{
RString sName;
std::int8_t nMaterialIndex;
int8_t nMaterialIndex;
std::vector<RageModelVertex> Vertices;
// OPTIMIZATION: If all verts in a mesh are transformed by the same bone,
// then send the transform to the graphics card for the whole mesh instead
// of transforming each vertex on the CPU;
std::int8_t m_iBoneIndex; // -1 = no bone
int8_t m_iBoneIndex; // -1 = no bone
std::vector<msTriangle> Triangles;
};
+1 -1
View File
@@ -147,7 +147,7 @@ static void LoadFromSMNoteDataStringWithPlayer( NoteData& out, const RString &sS
int iHeadRow;
if( !out.IsHoldNoteAtRow( iTrack, iIndex, &iHeadRow ) )
{
int n = std::intptr_t(endLine) - std::intptr_t(beginLine);
int n = intptr_t(endLine) - intptr_t(beginLine);
LOG->Warn( "Unmatched 3 in \"%.*s\"", n, beginLine );
}
else
+1 -1
View File
@@ -1361,7 +1361,7 @@ void NoteDisplay::DrawActor(const TapNote& tn, Actor* pActor, NotePart part,
break;
case NoteColorType_ProgressAlternate:
fScaledBeat = fBeat * cache->m_iNoteColorCount[part];
if( fScaledBeat - std::int64_t(fScaledBeat) == 0.0f )
if( fScaledBeat - int64_t(fScaledBeat) == 0.0f )
//we're on a boundary, so move to the previous frame.
//doing it this way ensures that fScaledBeat is never negative so std::fmod works.
fScaledBeat += cache->m_iNoteColorCount[part] - 1;
+6 -6
View File
@@ -287,10 +287,10 @@ uint16_t FileReading::read_u16_le( RageFileBasic &f, RString &sError )
return 0;
}
std::int16_t FileReading::read_16_le( RageFileBasic &f, RString &sError )
int16_t FileReading::read_16_le( RageFileBasic &f, RString &sError )
{
std::int16_t val;
ReadBytes( f, &val, sizeof(std::int16_t), sError );
int16_t val;
ReadBytes( f, &val, sizeof(int16_t), sError );
if( sError.size() == 0 )
return Swap16LE( val );
else
@@ -307,10 +307,10 @@ uint32_t FileReading::read_u32_le( RageFileBasic &f, RString &sError )
return 0;
}
std::int32_t FileReading::read_32_le( RageFileBasic &f, RString &sError )
int32_t FileReading::read_32_le( RageFileBasic &f, RString &sError )
{
std::int32_t val;
ReadBytes( f, &val, sizeof(std::int32_t), sError );
int32_t val;
ReadBytes( f, &val, sizeof(int32_t), sError );
if( sError.size() == 0 )
return Swap32LE( val );
else
+2 -2
View File
@@ -104,9 +104,9 @@ namespace FileReading
void Seek( RageFileBasic &f, int iOffset, RString &sError );
RString ReadString( RageFileBasic &f, int size, RString &sError );
uint8_t read_8( RageFileBasic &f, RString &sError );
std::int16_t read_16_le( RageFileBasic &f, RString &sError );
int16_t read_16_le( RageFileBasic &f, RString &sError );
uint16_t read_u16_le( RageFileBasic &f, RString &sError );
std::int32_t read_32_le( RageFileBasic &f, RString &sError );
int32_t read_32_le( RageFileBasic &f, RString &sError );
uint32_t read_u32_le( RageFileBasic &f, RString &sError );
};
+2 -2
View File
@@ -366,7 +366,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
if( iFlags & FEXTRA )
{
std::int16_t iSize = FileReading::read_16_le( *pFile, sError );
int16_t iSize = FileReading::read_16_le( *pFile, sError );
FileReading::SkipBytes( *pFile, iSize, sError );
}
@@ -386,7 +386,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
ASSERT( bOK );
uint16_t iExpectedCRC16 = FileReading::read_u16_le( *pFile, sError );
uint16_t iActualCRC16 = std::int16_t( iActualCRC32 & 0xFFFF );
uint16_t iActualCRC16 = int16_t( iActualCRC32 & 0xFFFF );
if( sError != "" )
return nullptr;
+6 -6
View File
@@ -266,7 +266,7 @@ void RageSound::LoadSoundReader( RageSoundReader *pSound )
* conditions are masked and will be seen on the next call. Otherwise, the requested
* number of frames will always be returned.
*/
int RageSound::GetDataToPlay( float *pBuffer, int iFrames, std::int64_t &iStreamFrame, int &iFramesStored )
int RageSound::GetDataToPlay( float *pBuffer, int iFrames, int64_t &iStreamFrame, int &iFramesStored )
{
/* We only update m_iStreamFrame; only take a shared lock, so we don't block the main thread. */
// LockMut(m_Mutex);
@@ -316,7 +316,7 @@ int RageSound::GetDataToPlay( float *pBuffer, int iFrames, std::int64_t &iStream
}
/* Indicate that a block of audio data has been written to the device. */
void RageSound::CommitPlayingPosition( std::int64_t iHardwareFrame, std::int64_t iStreamFrame, int iGotFrames )
void RageSound::CommitPlayingPosition( int64_t iHardwareFrame, int64_t iStreamFrame, int iGotFrames )
{
m_Mutex.Lock();
m_HardwareToStreamMap.Insert( iHardwareFrame, iGotFrames, iStreamFrame );
@@ -371,7 +371,7 @@ void RageSound::SoundIsFinishedPlaying()
return;
/* Get our current hardware position. */
std::int64_t iCurrentHardwareFrame = SOUNDMAN->GetPosition(nullptr);
int64_t iCurrentHardwareFrame = SOUNDMAN->GetPosition(nullptr);
m_Mutex.Lock();
@@ -473,12 +473,12 @@ float RageSound::GetLengthSeconds()
return iLength / 1000.f; // ms -> secs
}
int RageSound::GetSourceFrameFromHardwareFrame( std::int64_t iHardwareFrame ) const
int RageSound::GetSourceFrameFromHardwareFrame( int64_t iHardwareFrame ) const
{
if( m_HardwareToStreamMap.IsEmpty() || m_StreamToSourceMap.IsEmpty() )
return 0;
std::int64_t iStreamFrame = m_HardwareToStreamMap.Search( iHardwareFrame );
int64_t iStreamFrame = m_HardwareToStreamMap.Search( iHardwareFrame );
return static_cast<int>(m_StreamToSourceMap.Search( iStreamFrame ));
}
@@ -492,7 +492,7 @@ int RageSound::GetSourceFrameFromHardwareFrame( std::int64_t iHardwareFrame ) co
float RageSound::GetPositionSeconds( RageTimer *pTimestamp ) const
{
// Get our current hardware position.
std::int64_t iCurrentHardwareFrame = SOUNDMAN->GetPosition(pTimestamp);
int64_t iCurrentHardwareFrame = SOUNDMAN->GetPosition(pTimestamp);
// Lock the mutex after calling SOUNDMAN->GetPosition().
LockMut(m_Mutex);
+6 -6
View File
@@ -18,8 +18,8 @@ class RageSoundBase
public:
virtual ~RageSoundBase() { }
virtual void SoundIsFinishedPlaying() = 0;
virtual int GetDataToPlay( float *buffer, int size, std::int64_t &iStreamFrame, int &got_bytes ) = 0;
virtual void CommitPlayingPosition( std::int64_t iFrameno, std::int64_t iPosition, int iBytesRead ) = 0;
virtual int GetDataToPlay( float *buffer, int size, int64_t &iStreamFrame, int &got_bytes ) = 0;
virtual void CommitPlayingPosition( int64_t iFrameno, int64_t iPosition, int iBytesRead ) = 0;
virtual RageTimer GetStartTime() const { return RageZeroTimer; }
virtual RString GetLoadedFilePath() const = 0;
};
@@ -161,7 +161,7 @@ private:
/* Current position of the output sound, in frames. If < 0, nothing will play
* until it becomes positive. */
std::int64_t m_iStreamFrame;
int64_t m_iStreamFrame;
/* Hack: When we stop a playing sound, we can't ask the driver the position
* (we're not playing); and we can't seek back to the current playing position
@@ -175,7 +175,7 @@ private:
RString m_sError;
int GetSourceFrameFromHardwareFrame( std::int64_t iHardwareFrame ) const;
int GetSourceFrameFromHardwareFrame( int64_t iHardwareFrame ) const;
bool SetPositionFrames( int frames = -1 );
RageSoundParams::StopMode_t GetStopMode() const; // resolves M_AUTO
@@ -189,8 +189,8 @@ public:
* it signals the stream to stop; once it's flushed, SoundStopped will be
* called. Until then, SOUNDMAN->GetPosition can still be called; the sound
* is still playing. */
int GetDataToPlay( float *pBuffer, int iSize, std::int64_t &iStreamFrame, int &iBytesRead );
void CommitPlayingPosition( std::int64_t iHardwareFrame, std::int64_t iStreamFrame, int iGotFrames );
int GetDataToPlay( float *pBuffer, int iSize, int64_t &iStreamFrame, int &iBytesRead );
void CommitPlayingPosition( int64_t iHardwareFrame, int64_t iStreamFrame, int iGotFrames );
};
#endif
+1 -1
View File
@@ -89,7 +89,7 @@ bool RageSoundManager::Pause( RageSoundBase *pSound, bool bPause )
return m_pDriver->PauseMixing( pSound, bPause );
}
std::int64_t RageSoundManager::GetPosition( RageTimer *pTimer ) const
int64_t RageSoundManager::GetPosition( RageTimer *pTimer ) const
{
if( m_pDriver == nullptr )
return 0;
+1 -1
View File
@@ -39,7 +39,7 @@ public:
void StartMixing( RageSoundBase *snd ); /* used by RageSound */
void StopMixing( RageSoundBase *snd ); /* used by RageSound */
bool Pause( RageSoundBase *snd, bool bPause ); /* used by RageSound */
std::int64_t GetPosition( RageTimer *pTimer ) const; /* used by RageSound */
int64_t GetPosition( RageTimer *pTimer ) const; /* used by RageSound */
float GetPlayLatency() const;
int GetDriverSampleRate() const;
+1 -1
View File
@@ -72,7 +72,7 @@ void RageSoundMixBuffer::write( const float *pBuf, unsigned iSize, int iSourceSt
}
}
void RageSoundMixBuffer::read( std::int16_t *pBuf )
void RageSoundMixBuffer::read( int16_t *pBuf )
{
for( unsigned iPos = 0; iPos < m_iBufUsed; ++iPos )
{
+1 -1
View File
@@ -20,7 +20,7 @@ public:
// Extend the buffer as if write() was called with a buffer of silence.
void Extend( unsigned iSamples );
void read( std::int16_t *pBuf );
void read( int16_t *pBuf );
void read( float *pBuf );
void read_deinterlace( float **pBufs, int channels );
float *read() { return m_pMixbuf; }
+9 -9
View File
@@ -18,9 +18,9 @@ static int pos_map_backlog_frames = 80000;
struct pos_map_t
{
std::int64_t m_iSourceFrame;
std::int64_t m_iDestFrame;
std::int64_t m_iFrames;
int64_t m_iSourceFrame;
int64_t m_iDestFrame;
int64_t m_iFrames;
double m_fSourceToDestRatio;
pos_map_t() { m_iSourceFrame = 0; m_iDestFrame = 0; m_iFrames = 0; m_fSourceToDestRatio = 1.0; }
@@ -59,7 +59,7 @@ pos_map_queue &pos_map_queue::operator=( const pos_map_queue &rhs )
return *this;
}
void pos_map_queue::Insert(std::int64_t iSourceFrame, std::int64_t iFrames, std::int64_t iDestFrame, double fSourceToDestRatio)
void pos_map_queue::Insert(int64_t iSourceFrame, int64_t iFrames, int64_t iDestFrame, double fSourceToDestRatio)
{
bool merged = false;
if (!m_pImpl->m_Queue.empty())
@@ -95,7 +95,7 @@ void pos_map_queue::Insert(std::int64_t iSourceFrame, std::int64_t iFrames, std:
void pos_map_impl::Cleanup()
{
std::list<pos_map_t>::iterator it = m_Queue.end();
std::int64_t iTotalFrames = 0;
int64_t iTotalFrames = 0;
// Scan backwards until we have at least pos_map_backlog_frames.
while (iTotalFrames < pos_map_backlog_frames)
{
@@ -108,7 +108,7 @@ void pos_map_impl::Cleanup()
m_Queue.erase(m_Queue.begin(), it);
}
std::int64_t pos_map_queue::Search( std::int64_t iSourceFrame ) const
int64_t pos_map_queue::Search( int64_t iSourceFrame ) const
{
if( IsEmpty() )
{
@@ -116,7 +116,7 @@ std::int64_t pos_map_queue::Search( std::int64_t iSourceFrame ) const
}
// iSourceFrame is probably in pos_map. Search to figure out what position it maps to.
std::int64_t iClosestPosition = 0, iClosestPositionDist = std::numeric_limits<int64_t>::max();
int64_t iClosestPosition = 0, iClosestPositionDist = std::numeric_limits<int64_t>::max();
for (pos_map_t const &pm : m_pImpl->m_Queue)
{
// Loop over the queue until we know generally where iSourceFrame is
@@ -124,13 +124,13 @@ std::int64_t pos_map_queue::Search( std::int64_t iSourceFrame ) const
iSourceFrame < pm.m_iSourceFrame+pm.m_iFrames )
{
// If we are in the correct block, calculate its current position
std::int64_t iDiff = static_cast<std::int64_t>(iSourceFrame - pm.m_iSourceFrame);
int64_t iDiff = static_cast<int64_t>(iSourceFrame - pm.m_iSourceFrame);
iDiff = static_cast<int64_t>(( iDiff * pm.m_fSourceToDestRatio) + 0.5 );
return pm.m_iDestFrame + iDiff;
}
// See if the current position is close to the beginning of this block.
std::int64_t dist = llabs( pm.m_iSourceFrame - iSourceFrame );
int64_t dist = llabs( pm.m_iSourceFrame - iSourceFrame );
if( dist < iClosestPositionDist )
{
iClosestPositionDist = dist;
+2 -2
View File
@@ -16,10 +16,10 @@ public:
/* Insert a mapping from iSourceFrame to iDestFrame, containing iFrames.
* The double type is used to prevent precision loss leading to sync drift the longer the game runs. -sukibaby */
void Insert( std::int64_t iSourceFrame, std::int64_t iFrames, std::int64_t iDestFrame, double fSourceToDestRatio = 1.0 );
void Insert( int64_t iSourceFrame, int64_t iFrames, int64_t iDestFrame, double fSourceToDestRatio = 1.0 );
/* Return the iDestFrame for the given iSourceFrame. */
std::int64_t Search( std::int64_t iSourceFrame ) const;
int64_t Search( int64_t iSourceFrame ) const;
/* Erase all mappings. */
void Clear();
+1 -1
View File
@@ -62,7 +62,7 @@ private:
float fPan;
RageSoundReader *pSound; // nullptr if not activated
int GetOffsetFrame( int iSampleRate ) const { return int( std::int64_t(iOffsetMS) * iSampleRate / 1000 ); }
int GetOffsetFrame( int iSampleRate ) const { return int( int64_t(iOffsetMS) * iSampleRate / 1000 ); }
bool operator<( const Sound &rhs ) const { return iOffsetMS < rhs.iOffsetMS; }
};
std::vector<Sound> m_aSounds;
+3 -3
View File
@@ -18,7 +18,7 @@ Preference<bool> g_bSoundPreload16bit( "SoundPreload16bit", true );
/* If a sound is smaller than this, we'll load it entirely into memory. */
Preference<int> g_iSoundPreloadMaxSamples( "SoundPreloadMaxSamples", 1024*1024 );
#define samplesize (m_bBufferIs16Bit? sizeof(std::int16_t):sizeof(float))
#define samplesize (m_bBufferIs16Bit? sizeof(int16_t):sizeof(float))
#define framesize (samplesize * m_iChannels)
bool RageSoundReader_Preload::PreloadSound( RageSoundReader *&pSound )
@@ -93,7 +93,7 @@ bool RageSoundReader_Preload::Open( RageSoundReader *pSource )
/* Add the buffer. */
if( m_bBufferIs16Bit )
{
std::int16_t buffer16[1024];
int16_t buffer16[1024];
RageSoundUtil::ConvertFloatToNativeInt16( buffer, buffer16, iCnt*m_iChannels );
m_Buffer.Get()->append( (char *) buffer16, (char *) (buffer16+iCnt*m_iChannels) );
}
@@ -152,7 +152,7 @@ int RageSoundReader_Preload::Read( float *pBuffer, int iFrames )
return END_OF_FILE;
if( m_bBufferIs16Bit )
{
const std::int16_t *pIn = (const std::int16_t *) (m_Buffer->data() + (m_iPosition * framesize));
const int16_t *pIn = (const int16_t *) (m_Buffer->data() + (m_iPosition * framesize));
RageSoundUtil::ConvertNativeInt16ToFloat( pIn, pBuffer, iFrames * m_iChannels );
}
else
+2 -2
View File
@@ -548,7 +548,7 @@ private:
int RageSoundReader_Resample_Good::GetNextSourceFrame() const
{
std::int64_t iPosition = m_pSource->GetNextSourceFrame();
int64_t iPosition = m_pSource->GetNextSourceFrame();
iPosition -= m_apResamplers[0]->GetFilled();
iPosition *= m_iSampleRate;
@@ -648,7 +648,7 @@ RageSoundReader_Resample_Good::~RageSoundReader_Resample_Good()
int RageSoundReader_Resample_Good::SetPosition( int iFrame )
{
Reset();
iFrame = (int) SCALE( iFrame, 0, (std::int64_t) m_iSampleRate, 0, (std::int64_t) m_pSource->GetSampleRate() );
iFrame = (int) SCALE( iFrame, 0, (int64_t) m_iSampleRate, 0, (int64_t) m_pSource->GetSampleRate() );
return m_pSource->SetPosition( iFrame );
}
+3 -3
View File
@@ -185,7 +185,7 @@ int RageSoundReader_Vorbisfile::Read( float *buf, int iFrames )
{
int bstream;
#if defined(INTEGER_VORBIS)
int ret = ov_read( vf, (char *) buf, iFrames * channels * sizeof(std::int16_t), &bstream );
int ret = ov_read( vf, (char *) buf, iFrames * channels * sizeof(int16_t), &bstream );
#else // float vorbis decoder
float **pcm;
int ret = ov_read_float( vf, &pcm, iFrames, &bstream );
@@ -218,11 +218,11 @@ int RageSoundReader_Vorbisfile::Read( float *buf, int iFrames )
#if defined(INTEGER_VORBIS)
if( ret > 0 )
{
int iSamplesRead = ret / sizeof(std::int16_t);
int iSamplesRead = ret / sizeof(int16_t);
iFramesRead = iSamplesRead / channels;
/* Convert in reverse, so we can do it in-place. */
const std::int16_t *pIn = (std::int16_t *) buf;
const int16_t *pIn = (int16_t *) buf;
float *pOut = (float *) buf;
for( int i = iSamplesRead-1; i >= 0; --i )
pOut[i] = pIn[i] / 32768.0f;
+23 -23
View File
@@ -41,11 +41,11 @@ namespace
void ConvertLittleEndian16BitToFloat( void *pBuf, int iSamples )
{
/* Convert in reverse, so we can do it in-place. */
const std::int16_t *pIn = (std::int16_t *) pBuf;
const int16_t *pIn = (int16_t *) pBuf;
float *pOut = (float *) pBuf;
for( int i = iSamples-1; i >= 0; --i )
{
std::int16_t iSample = Swap16LE( pIn[i] );
int16_t iSample = Swap16LE( pIn[i] );
pOut[i] = iSample / 32768.0f;
}
}
@@ -60,7 +60,7 @@ namespace
{
pIn -= 3;
std::int32_t iSample =
int32_t iSample =
(int(pIn[0]) << 0) |
(int(pIn[1]) << 8) |
(int(pIn[2]) << 16);
@@ -76,11 +76,11 @@ namespace
void ConvertLittleEndian32BitToFloat( void *pBuf, int iSamples )
{
/* Convert in reverse, so we can do it in-place. */
const std::int32_t *pIn = (std::int32_t *) pBuf;
const int32_t *pIn = (int32_t *) pBuf;
float *pOut = (float *) pBuf;
for( int i = iSamples-1; i >= 0; --i )
{
std::int32_t iSample = Swap32LE( pIn[i] );
int32_t iSample = Swap32LE( pIn[i] );
pOut[i] = iSample / 2147483648.0f;
}
}
@@ -167,13 +167,13 @@ struct WavReaderPCM: public WavReader
int GetLength() const
{
const int iBytesPerSec = m_WavData.m_iSampleRate * m_WavData.m_iChannels * m_WavData.m_iBitsPerSample / 8;
std::int64_t iMS = (std::int64_t(m_WavData.m_iDataChunkSize) * 1000) / iBytesPerSec;
int64_t iMS = (int64_t(m_WavData.m_iDataChunkSize) * 1000) / iBytesPerSec;
return (int) iMS;
}
int SetPosition( int iFrame )
{
int iByte = (int) (std::int64_t(iFrame) * m_WavData.m_iChannels * m_WavData.m_iBitsPerSample / 8);
int iByte = (int) (int64_t(iFrame) * m_WavData.m_iChannels * m_WavData.m_iBitsPerSample / 8);
if( iByte > m_WavData.m_iDataChunkSize )
{
m_File.Seek( m_WavData.m_iDataChunkSize+m_WavData.m_iDataChunkPos );
@@ -196,8 +196,8 @@ struct WavReaderPCM: public WavReader
struct WavReaderADPCM: public WavReader
{
public:
std::vector<std::int16_t> m_iaCoef1, m_iaCoef2;
std::int16_t m_iFramesPerBlock;
std::vector<int16_t> m_iaCoef1, m_iaCoef2;
int16_t m_iFramesPerBlock;
float *m_pBuffer;
int m_iBufferAvail, m_iBufferUsed;
@@ -223,7 +223,7 @@ public:
m_File.Seek( m_WavData.m_iExtraFmtPos );
m_iFramesPerBlock = FileReading::read_16_le( m_File, m_sError );
std::int16_t iNumCoef = FileReading::read_16_le( m_File, m_sError );
int16_t iNumCoef = FileReading::read_16_le( m_File, m_sError );
m_iaCoef1.resize( iNumCoef );
m_iaCoef2.resize( iNumCoef );
for( int i = 0; i < iNumCoef; ++i )
@@ -259,8 +259,8 @@ public:
if( m_File.Tell() >= m_WavData.m_iDataChunkSize+m_WavData.m_iDataChunkPos || m_File.AtEOF() )
return true; /* past the data chunk */
std::int8_t iPredictor[2];
std::int16_t iDelta[2], iSamp1[2], iSamp2[2];
int8_t iPredictor[2];
int16_t iDelta[2], iSamp1[2], iSamp2[2];
for( int i = 0; i < m_WavData.m_iChannels; ++i )
iPredictor[i] = FileReading::read_8( m_File, m_sError );
for( int i = 0; i < m_WavData.m_iChannels; ++i )
@@ -304,11 +304,11 @@ public:
}
for( int i = 0; i < m_WavData.m_iChannels; ++i )
pBuffer[m_iBufferAvail++] = (std::int16_t)iSamp2[i] / 32768.0f;
pBuffer[m_iBufferAvail++] = (int16_t)iSamp2[i] / 32768.0f;
for( int i = 0; i < m_WavData.m_iChannels; ++i )
pBuffer[m_iBufferAvail++] = (std::int16_t)iSamp1[i] / 32768.0f;
pBuffer[m_iBufferAvail++] = (int16_t)iSamp1[i] / 32768.0f;
std::int8_t iBufSize = 0;
int8_t iBufSize = 0;
uint8_t iBuf = 0;
bool bDone = false;
@@ -330,24 +330,24 @@ public:
}
/* Store the nibble in signed char, so we get an arithmetic shift. */
std::int8_t iErrorDelta = (std::int8_t)(iBuf) >> 4;
int8_t iErrorDelta = (int8_t)(iBuf) >> 4;
uint8_t iErrorDeltaUnsigned = iBuf >> 4;
iBuf <<= 4;
--iBufSize;
std::int32_t iPredSample = (iSamp1[c] * iCoef1[c] + iSamp2[c] * iCoef2[c]) / (1<<8);
int32_t iPredSample = (iSamp1[c] * iCoef1[c] + iSamp2[c] * iCoef2[c]) / (1<<8);
if( iPredSample < -32768 ) iPredSample = -32768;
if( iPredSample > 32767 ) iPredSample = 32767;
std::int16_t iNewSample = (std::int16_t)iPredSample + (iDelta[c] * iErrorDelta);
int16_t iNewSample = (int16_t)iPredSample + (iDelta[c] * iErrorDelta);
pBuffer[m_iBufferAvail++] = iNewSample / 32768.0f;
static const int aAdaptionTable[] = {
230, 230, 230, 230, 307, 409, 512, 614,
768, 614, 512, 409, 307, 230, 230, 230
};
iDelta[c] = std::int16_t( (iDelta[c] * aAdaptionTable[iErrorDeltaUnsigned]) / (1<<8) );
iDelta[c] = std::max( (std::int16_t) 16, iDelta[c] );
iDelta[c] = int16_t( (iDelta[c] * aAdaptionTable[iErrorDeltaUnsigned]) / (1<<8) );
iDelta[c] = std::max( (int16_t) 16, iDelta[c] );
iSamp2[c] = iSamp1[c];
iSamp1[c] = iNewSample;
@@ -402,7 +402,7 @@ public:
iFrames += 2+iExtraADPCMFrames;
}
int iMS = int((std::int64_t(iFrames)*1000)/m_WavData.m_iSampleRate);
int iMS = int((int64_t(iFrames)*1000)/m_WavData.m_iSampleRate);
return iMS;
}
@@ -445,7 +445,7 @@ public:
int iFrame = iBlock * m_iFramesPerBlock;
int iBufferRemainingBytes = m_iBufferAvail - m_iBufferUsed;
int iBufferRemainingFrames = iBufferRemainingBytes / (m_WavData.m_iChannels * sizeof(std::int16_t));
int iBufferRemainingFrames = iBufferRemainingBytes / (m_WavData.m_iChannels * sizeof(int16_t));
iFrame -= iBufferRemainingFrames;
return iFrame;
@@ -496,7 +496,7 @@ RageSoundReader_FileReader::OpenResult RageSoundReader_WAV::Open( RageFileBasic
while( !bGotFormatChunk || !bGotDataChunk )
{
RString ChunkID = ReadString( *m_pFile, 4, sError );
std::int32_t iChunkSize = FileReading::read_32_le( *m_pFile, sError );
int32_t iChunkSize = FileReading::read_32_le( *m_pFile, sError );
if( sError.size() != 0 )
{
+2 -2
View File
@@ -30,8 +30,8 @@ public:
struct WavData
{
std::int32_t m_iDataChunkPos, m_iDataChunkSize, m_iExtraFmtPos, m_iSampleRate, m_iFormatTag;
std::int16_t m_iChannels, m_iBitsPerSample, m_iBlockAlign, m_iExtraFmtBytes;
int32_t m_iDataChunkPos, m_iDataChunkSize, m_iExtraFmtPos, m_iSampleRate, m_iFormatTag;
int16_t m_iChannels, m_iBitsPerSample, m_iBlockAlign, m_iExtraFmtBytes;
};
private:
+2 -2
View File
@@ -82,7 +82,7 @@ void RageSoundUtil::ConvertMonoToStereoInPlace( float *data, int iFrames )
}
}
void RageSoundUtil::ConvertNativeInt16ToFloat( const std::int16_t *pFrom, float *pTo, int iSamples )
void RageSoundUtil::ConvertNativeInt16ToFloat( const int16_t *pFrom, float *pTo, int iSamples )
{
for( int i = 0; i < iSamples; ++i )
{
@@ -90,7 +90,7 @@ void RageSoundUtil::ConvertNativeInt16ToFloat( const std::int16_t *pFrom, float
}
}
void RageSoundUtil::ConvertFloatToNativeInt16( const float *pFrom, std::int16_t *pTo, int iSamples )
void RageSoundUtil::ConvertFloatToNativeInt16( const float *pFrom, int16_t *pTo, int iSamples )
{
for( int i = 0; i < iSamples; ++i )
{
+2 -2
View File
@@ -10,8 +10,8 @@ namespace RageSoundUtil
void Pan( float *pBuffer, int iFrames, float fPos );
void Fade( float *pBuffer, int iFrames, int iChannels, float fStartVolume, float fEndVolume );
void ConvertMonoToStereoInPlace( float *pBuffer, int iFrames );
void ConvertNativeInt16ToFloat( const std::int16_t *pFrom, float *pTo, int iSamples );
void ConvertFloatToNativeInt16( const float *pFrom, std::int16_t *pTo, int iSamples );
void ConvertNativeInt16ToFloat( const int16_t *pFrom, float *pTo, int iSamples );
void ConvertFloatToNativeInt16( const float *pFrom, int16_t *pTo, int iSamples );
};
#endif
+6 -6
View File
@@ -7,7 +7,7 @@
#include <cstdint>
std::int32_t RageSurfacePalette::FindColor( const RageSurfaceColor &color ) const
int32_t RageSurfacePalette::FindColor( const RageSurfaceColor &color ) const
{
for( int i = 0; i < ncolors; ++i )
if( colors[i] == color )
@@ -16,7 +16,7 @@ std::int32_t RageSurfacePalette::FindColor( const RageSurfaceColor &color ) cons
}
/* XXX: untested */
std::int32_t RageSurfacePalette::FindClosestColor( const RageSurfaceColor &color ) const
int32_t RageSurfacePalette::FindClosestColor( const RageSurfaceColor &color ) const
{
int iBest = -1;
int iBestDist = INT_MAX;
@@ -70,9 +70,9 @@ void RageSurfaceFormat::GetRGB( uint32_t val, uint8_t *r, uint8_t *g, uint8_t *b
*g = palette->colors[val].g;
*b = palette->colors[val].b;
} else {
*r = std::int8_t( (val & Mask[0]) >> Shift[0] << Loss[0] );
*g = std::int8_t( (val & Mask[1]) >> Shift[1] << Loss[1] );
*b = std::int8_t( (val & Mask[2]) >> Shift[2] << Loss[2] );
*r = int8_t( (val & Mask[0]) >> Shift[0] << Loss[0] );
*g = int8_t( (val & Mask[1]) >> Shift[1] << Loss[1] );
*b = int8_t( (val & Mask[2]) >> Shift[2] << Loss[2] );
}
}
@@ -81,7 +81,7 @@ bool RageSurfaceFormat::MapRGBA( uint8_t r, uint8_t g, uint8_t b, uint8_t a, uin
if( BytesPerPixel == 1 )
{
RageSurfaceColor c( r, g, b, a );
std::int32_t n = palette->FindColor( c );
int32_t n = palette->FindColor( c );
if( n == -1 )
return false;
val = (uint32_t) n;
+7 -7
View File
@@ -33,11 +33,11 @@ inline bool operator!=(RageSurfaceColor const &lhs, RageSurfaceColor const &rhs)
struct RageSurfacePalette
{
RageSurfaceColor colors[256];
std::int32_t ncolors;
int32_t ncolors;
/* Find the exact color; returns -1 if not found. */
std::int32_t FindColor( const RageSurfaceColor &color ) const;
std::int32_t FindClosestColor( const RageSurfaceColor &color ) const;
int32_t FindColor( const RageSurfaceColor &color ) const;
int32_t FindClosestColor( const RageSurfaceColor &color ) const;
};
struct RageSurfaceFormat
@@ -46,8 +46,8 @@ struct RageSurfaceFormat
RageSurfaceFormat( const RageSurfaceFormat &cpy );
~RageSurfaceFormat() = default;
std::int32_t BytesPerPixel;
std::int32_t BitsPerPixel;
int32_t BytesPerPixel;
int32_t BitsPerPixel;
std::array<uint32_t, 4> Mask;
std::array<uint32_t, 4> Shift;
std::array<uint32_t, 4> Loss;
@@ -79,8 +79,8 @@ struct RageSurface
uint8_t *pixels;
bool pixels_owned;
std::int32_t w, h, pitch;
std::int32_t flags;
int32_t w, h, pitch;
int32_t flags;
RageSurface();
RageSurface( const RageSurface &cpy );
+2 -2
View File
@@ -132,7 +132,7 @@ void RageSurfaceUtils::OrderedDither( const RageSurface *src, RageSurface *dst )
}
static uint8_t EDDitherPixel( int x, int y, int intensity, int conv, std::int32_t &accumError )
static uint8_t EDDitherPixel( int x, int y, int intensity, int conv, int32_t &accumError )
{
// Convert the number to the destination range.
int out_intensity = intensity * conv;
@@ -195,7 +195,7 @@ void RageSurfaceUtils::ErrorDiffusionDither( const RageSurface *src, RageSurface
// For each row:
for(int row = 0; row < src->h; ++row)
{
std::int32_t accumError[4] = { 0, 0, 0, 0 }; // accum error values are reset every row
int32_t accumError[4] = { 0, 0, 0, 0 }; // accum error values are reset every row
const uint8_t *srcp = src->pixels + row * src->pitch;
uint8_t *dstp = dst->pixels + row * dst->pitch;
+2 -2
View File
@@ -210,7 +210,7 @@ void RageSurfaceUtils::Palettize( RageSurface *&pImg, int iColors, bool bDither
do
{
std::int32_t sc[4];
int32_t sc[4];
uint8_t pixel[4] = { pIn[0], pIn[1], pIn[2], pIn[3] };
if( bDither )
{
@@ -218,7 +218,7 @@ void RageSurfaceUtils::Palettize( RageSurface *&pImg, int iColors, bool bDither
for( int c = 0; c < 4; ++c )
{
sc[c] = pixel[c] + thiserr[col + 1].c[c] / FS_SCALE;
sc[c] = std::clamp( sc[c], 0, (std::int32_t) maxval );
sc[c] = std::clamp( sc[c], 0, (int32_t) maxval );
}
PAM_ASSIGN( pixel, (uint8_t)sc[0], (uint8_t)sc[1], (uint8_t)sc[2], (uint8_t)sc[3] );
+1 -1
View File
@@ -170,7 +170,7 @@ static RageSurface *RageSurface_Load_JPEG( RageFile *f, const char *fn, char err
for( int i = 0; i < 256; ++i )
{
RageSurfaceColor color;
color.r = color.g = color.b = (std::int8_t) i;
color.r = color.g = color.b = (int8_t) i;
color.a = 0xFF;
img->fmt.palette->colors[i] = color;
}
+1 -1
View File
@@ -144,7 +144,7 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
/* Fake PNG_COLOR_TYPE_GRAY. */
for( int i = 0; i < 256; ++i )
{
colors[i].r = colors[i].g = colors[i].b = (std::int8_t) i;
colors[i].r = colors[i].g = colors[i].b = (int8_t) i;
colors[i].a = 0xFF;
}
+3 -3
View File
@@ -91,9 +91,9 @@ RageSurface *RageSurface_Load_XPM( char * const *xpm, RString &error )
return nullptr;
}
std::int8_t *p = (std::int8_t *) img->pixels;
int8_t *p = (int8_t *) img->pixels;
p += y * img->pitch;
std::int32_t *p32 = (std::int32_t *) p;
int32_t *p32 = (int32_t *) p;
for( int x = 0; x < width; ++x )
{
RString color_name = row.substr( x*color_length, color_length );
@@ -108,7 +108,7 @@ RageSurface *RageSurface_Load_XPM( char * const *xpm, RString &error )
if( colors.size() <= 256 )
{
p[x] = (std::int8_t) it->second;
p[x] = (int8_t) it->second;
} else {
const RageSurfaceColor &color = colors[it->second];
p32[x] = (color.r << 24) + (color.g << 16) + (color.b << 8);
+5 -5
View File
@@ -31,7 +31,7 @@
#include <cstdint>
const uint64_t ONE_SECOND_IN_MICROSECONDS_ULL = 1000000ULL;
const std::int64_t ONE_SECOND_IN_MICROSECONDS_LL = 1000000LL;
const int64_t ONE_SECOND_IN_MICROSECONDS_LL = 1000000LL;
const uint_fast64_t ONE_SECOND_IN_MICROSECONDS_FAST_ULL = 1000000ULL;
const double ONE_SECOND_IN_MICROSECONDS_DBL = 1000000.0;
@@ -128,8 +128,8 @@ RageTimer RageTimer::Sum(const RageTimer& lhs, float tm)
/* Calculate the seconds and microseconds from the time:
* tm == 5.25 -> secs = 5, us = 5.25 - ( 5) = .25
* tm == -1.25 -> secs = -2, us = -1.25 - (-2) = .75 */
std::int64_t seconds = std::floor(tm);
std::int64_t us = static_cast<int64_t>((tm - seconds) * ONE_SECOND_IN_MICROSECONDS_LL);
int64_t seconds = std::floor(tm);
int64_t us = static_cast<int64_t>((tm - seconds) * ONE_SECOND_IN_MICROSECONDS_LL);
// Prevent unnecessarily checking the time
RageTimer ret(0, 0);
@@ -151,8 +151,8 @@ RageTimer RageTimer::Sum(const RageTimer& lhs, float tm)
double RageTimer::Difference(const RageTimer& lhs, const RageTimer& rhs)
{
// Calculate the difference in seconds and microseconds respectively
std::int64_t secs = lhs.m_secs - rhs.m_secs;
std::int64_t us = lhs.m_us - rhs.m_us;
int64_t secs = lhs.m_secs - rhs.m_secs;
int64_t us = lhs.m_us - rhs.m_us;
// Adjust seconds and microseconds if microseconds is negative
if ( us < 0 )
+1 -1
View File
@@ -360,7 +360,7 @@ struct RageModelVertex // doesn't have color. Relies on material color
RageVector3 p; // position
RageVector3 n; // normal
RageVector2 t; // texture coordinates
std::int8_t bone;
int8_t bone;
RageVector2 TextureMatrixScale; // usually 1,1
};
+4 -4
View File
@@ -203,7 +203,7 @@ void ScoreKeeperNormal::OnNextSong( int iSongInCourseIndex, const Steps* pSteps,
GAMESTATE->SetProcessedTimingData(nullptr);
}
static int GetScore(int p, int Z, std::int64_t S, int n)
static int GetScore(int p, int Z, int64_t S, int n)
{
/* There's a problem with the scoring system described below. Z/S is truncated
* to an int. However, in some cases we can end up with very small base scores.
@@ -221,7 +221,7 @@ static int GetScore(int p, int Z, std::int64_t S, int n)
return p * (Z / S) * n;
#elif 1
// This doesn't round down Z/S.
return int(std::int64_t(p) * n * Z / S);
return int(int64_t(p) * n * Z / S);
#else
// This also doesn't round down Z/S. Use this if you don't have 64-bit ints.
return int(p * n * (float(Z) / S));
@@ -282,8 +282,8 @@ void ScoreKeeperNormal::AddScoreInternal( TapNoteScore score )
m_iTapNotesHit++;
const std::int64_t N = uint64_t(m_iNumTapsAndHolds);
const std::int64_t sum = (N * (N + 1)) / 2;
const int64_t N = uint64_t(m_iNumTapsAndHolds);
const int64_t sum = (N * (N + 1)) / 2;
const int Z = m_iMaxPossiblePoints/10;
// Don't use a multiplier if the player has failed
+3 -3
View File
@@ -87,7 +87,7 @@ public:
* underlying timers may be 32-bit, but implementations should try to avoid
* wrapping if possible.
*/
static std::int64_t GetSystemTimeInMicroseconds();
static int64_t GetSystemTimeInMicroseconds();
/*
* Add file search paths, higher priority first.
@@ -131,8 +131,8 @@ public:
private:
/* This are helpers for GetSystemTimeInMicroseconds on systems with a timer
* that may loop or move backwards. */
static std::int64_t FixupTimeIfLooped( std::int64_t usecs );
static std::int64_t FixupTimeIfBackwards( std::int64_t usecs );
static int64_t FixupTimeIfLooped( int64_t usecs );
static int64_t FixupTimeIfBackwards( int64_t usecs );
static bool g_bQuitting;
static bool g_bToggleWindowed;
+9 -9
View File
@@ -27,15 +27,15 @@
* bAccurate == false.
*/
std::int64_t ArchHooks::FixupTimeIfLooped( std::int64_t usecs )
int64_t ArchHooks::FixupTimeIfLooped( int64_t usecs )
{
static std::int64_t last = 0;
static std::int64_t offset_us = 0;
static int64_t last = 0;
static int64_t offset_us = 0;
/* The time has wrapped if the last time was very high and the current time is very low. */
const std::int64_t i32BitMaxMs = uint64_t(1) << 32;
const std::int64_t i32BitMaxUs = i32BitMaxMs*1000;
const std::int64_t one_day = uint64_t(24*60*60)*1000000;
const int64_t i32BitMaxMs = uint64_t(1) << 32;
const int64_t i32BitMaxUs = i32BitMaxMs*1000;
const int64_t one_day = uint64_t(24*60*60)*1000000;
if( last > (i32BitMaxUs-one_day) && usecs < one_day )
offset_us += i32BitMaxUs;
@@ -44,10 +44,10 @@ std::int64_t ArchHooks::FixupTimeIfLooped( std::int64_t usecs )
return usecs + offset_us;
}
std::int64_t ArchHooks::FixupTimeIfBackwards( std::int64_t usecs )
int64_t ArchHooks::FixupTimeIfBackwards( int64_t usecs )
{
static std::int64_t last = 0;
static std::int64_t offset_us = 0;
static int64_t last = 0;
static int64_t offset_us = 0;
if( usecs < last )
{
+2 -2
View File
@@ -258,7 +258,7 @@ bool ArchHooks_MacOSX::GoToURL( RString sUrl )
return result == 0;
}
std::int64_t ArchHooks::GetSystemTimeInMicroseconds()
int64_t ArchHooks::GetSystemTimeInMicroseconds()
{
// http://developer.apple.com/qa/qa2004/qa1398.html
static double factor = 0.0;
@@ -270,7 +270,7 @@ std::int64_t ArchHooks::GetSystemTimeInMicroseconds()
mach_timebase_info( &timeBase );
factor = timeBase.numer / ( 1000.0 * timeBase.denom );
}
return std::int64_t( mach_absolute_time() * factor );
return int64_t( mach_absolute_time() * factor );
}
#include "RageFileManager.h"
+4 -4
View File
@@ -149,25 +149,25 @@ clockid_t ArchHooks_Unix::GetClock()
return g_Clock;
}
std::int64_t ArchHooks::GetSystemTimeInMicroseconds()
int64_t ArchHooks::GetSystemTimeInMicroseconds()
{
OpenGetTime();
timespec ts;
clock_gettime( g_Clock, &ts );
std::int64_t iRet = std::int64_t(ts.tv_sec) * 1000000 + std::int64_t(ts.tv_nsec)/1000;
int64_t iRet = int64_t(ts.tv_sec) * 1000000 + int64_t(ts.tv_nsec)/1000;
if( g_Clock != CLOCK_MONOTONIC )
iRet = ArchHooks::FixupTimeIfBackwards( iRet );
return iRet;
}
#else
std::int64_t ArchHooks::GetSystemTimeInMicroseconds()
int64_t ArchHooks::GetSystemTimeInMicroseconds()
{
struct timeval tv;
gettimeofday( &tv, nullptr );
std::int64_t iRet = std::int64_t(tv.tv_sec) * 1000000 + std::int64_t(tv.tv_usec);
int64_t iRet = int64_t(tv.tv_sec) * 1000000 + int64_t(tv.tv_usec);
ret = FixupTimeIfBackwards( ret );
return iRet;
}
+1 -1
View File
@@ -13,7 +13,7 @@ public:
void DumpDebugInfo();
void SetTime( tm newtime );
std::int64_t GetSystemTimeInMicroseconds();
int64_t GetSystemTimeInMicroseconds();
void MountInitialFilesystems( const RString &sDirOfExecutable );
float GetDisplayAspectRatio() { return 4.0f/3; }
+1 -1
View File
@@ -39,7 +39,7 @@ static void InitTimer()
QueryPerformanceFrequency(&g_liFrequency);
}
std::int64_t ArchHooks::GetSystemTimeInMicroseconds()
int64_t ArchHooks::GetSystemTimeInMicroseconds()
{
// Make sure the timer is initialized.
if (!g_bTimerInitialized) {
@@ -506,7 +506,7 @@ static int AVIORageFile_ReadPacket(void* opaque, uint8_t* buf, int buf_size)
return n;
}
static std::int64_t AVIORageFile_Seek(void* opaque, std::int64_t offset, int whence)
static int64_t AVIORageFile_Seek(void* opaque, int64_t offset, int whence)
{
RageFile* f = (RageFile*)opaque;
if (whence == AVSEEK_SIZE)
+2 -2
View File
@@ -337,7 +337,7 @@ bool Alsa9Buf::WaitUntilFramesCanBeFilled( int timeout_ms )
return err == 1;
}
void Alsa9Buf::Write( const std::int16_t *buffer, int frames )
void Alsa9Buf::Write( const int16_t *buffer, int frames )
{
/* We should be able to write it all. If we don't, treat it as an error. */
int wrote;
@@ -388,7 +388,7 @@ bool Alsa9Buf::Recover( int r )
return false;
}
std::int64_t Alsa9Buf::GetPosition() const
int64_t Alsa9Buf::GetPosition() const
{
if( dsnd_pcm_state(pcm) == SND_PCM_STATE_PREPARED )
return last_cursor_pos;
+4 -4
View File
@@ -13,7 +13,7 @@ private:
int channels, samplebits;
unsigned samplerate;
int buffersize;
std::int64_t last_cursor_pos;
int64_t last_cursor_pos;
snd_pcm_uframes_t preferred_writeahead, preferred_chunksize;
snd_pcm_uframes_t writeahead, chunksize;
@@ -40,15 +40,15 @@ public:
int GetNumFramesToFill();
bool WaitUntilFramesCanBeFilled( int timeout_ms );
void Write( const std::int16_t *buffer, int frames );
void Write( const int16_t *buffer, int frames );
void Play();
void Stop();
void SetVolume(float vol);
int GetSampleRate() const { return samplerate; }
std::int64_t GetPosition() const;
std::int64_t GetPlayPos() const { return last_cursor_pos; }
int64_t GetPosition() const;
int64_t GetPlayPos() const { return last_cursor_pos; }
};
#endif
+2 -2
View File
@@ -559,7 +559,7 @@ void DSoundBuf::release_output_buf( char *pBuffer, unsigned iBufferSize )
m_bBufferLocked = false;
}
std::int64_t DSoundBuf::GetPosition() const
int64_t DSoundBuf::GetPosition() const
{
DWORD iCursor, iJunk;
HRESULT hr = m_pBuffer->GetCurrentPosition( &iCursor, &iJunk );
@@ -589,7 +589,7 @@ std::int64_t DSoundBuf::GetPosition() const
if( iFramesBehind < 0 )
iFramesBehind += buffersize_frames(); /* unwrap */
std::int64_t iRet = m_iWriteCursorPos - iFramesBehind;
int64_t iRet = m_iWriteCursorPos - iFramesBehind;
/* Failsafe: never return a value smaller than we've already returned.
* This can happen once in a while in underrun conditions. */
+4 -4
View File
@@ -51,8 +51,8 @@ public:
int GetSampleRate() const { return m_iSampleRate; }
~DSoundBuf();
std::int64_t GetPosition() const;
std::int64_t GetOutputPosition() const { return m_iWriteCursorPos; }
int64_t GetPosition() const;
int64_t GetOutputPosition() const { return m_iWriteCursorPos; }
private:
int buffersize_frames() const { return m_iBufferSize / bytes_per_frame(); }
@@ -70,8 +70,8 @@ private:
int m_iWriteCursor, m_iBufferBytesFilled; /* bytes */
int m_iExtraWriteahead;
std::int64_t m_iWriteCursorPos; /* frames */
mutable std::int64_t m_iLastPosition;
int64_t m_iWriteCursorPos; /* frames */
mutable int64_t m_iLastPosition;
bool m_bPlaying;
bool m_bBufferLocked;
+12 -12
View File
@@ -50,8 +50,8 @@ public:
/* Get the current hardware frame position, in the same time base as passed to
* RageSound::CommitPlayingPosition. */
std::int64_t GetHardwareFrame( RageTimer *pTimer ) const;
virtual std::int64_t GetPosition() const = 0;
int64_t GetHardwareFrame( RageTimer *pTimer ) const;
virtual int64_t GetPosition() const = 0;
/* When a sound is finished playing (GetDataToPlay returns 0) and the sound has
* been completely flushed (so GetPosition is no longer meaningful), call
@@ -96,10 +96,10 @@ protected:
* This function only mixes data; it will not lock any mutexes or do any file access, and
* is safe to call from a realtime thread.
*/
void Mix( std::int16_t *pBuf, int iFrames, std::int64_t iFrameNumber, std::int64_t iCurrentFrame );
void Mix( float *pBuf, int iFrames, std::int64_t iFrameNumber, std::int64_t iCurrentFrame );
void Mix( int16_t *pBuf, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame );
void Mix( float *pBuf, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame );
void MixDeinterlaced( float **pBufs, int iChannels, int iFrames, std::int64_t iFrameNumber, std::int64_t iCurrentFrame );
void MixDeinterlaced( float **pBufs, int iChannels, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame );
private:
/* This mutex is used for serializing with the decoder thread. Locking this mutex
@@ -156,7 +156,7 @@ private:
float m_Buffer[samples_per_block];
float *m_BufferNext; // beginning of the unread data
int m_FramesInBuffer; // total number of frames at m_BufferNext
std::int64_t m_iPosition; // stream frame of m_BufferNext
int64_t m_iPosition; // stream frame of m_BufferNext
sound_block(): m_BufferNext(m_Buffer),
m_FramesInBuffer(0), m_iPosition(0) {}
};
@@ -176,8 +176,8 @@ private:
struct QueuedPosMap
{
int iFrames;
std::int64_t iStreamFrame;
std::int64_t iHardwareFrame;
int64_t iStreamFrame;
int64_t iHardwareFrame;
};
CircBuf<QueuedPosMap> m_PosMapQueue;
@@ -201,15 +201,15 @@ private:
/* List of currently playing sounds: XXX no vector */
Sound m_Sounds[32];
std::int64_t ClampHardwareFrame( std::int64_t iHardwareFrame ) const;
mutable std::int64_t m_iMaxHardwareFrame;
mutable std::int64_t m_iVMaxHardwareFrame;
int64_t ClampHardwareFrame( int64_t iHardwareFrame ) const;
mutable int64_t m_iMaxHardwareFrame;
mutable int64_t m_iVMaxHardwareFrame;
bool m_bShutdownDecodeThread;
static int DecodeThread_start( void *p );
void DecodeThread();
RageSoundMixBuffer &MixIntoBuffer( int iFrames, std::int64_t iFrameNumber, std::int64_t iCurrentFrame );
RageSoundMixBuffer &MixIntoBuffer( int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame );
RageThread m_DecodeThread;
int GetDataForSound( Sound &s );
@@ -19,7 +19,7 @@ REGISTER_SOUND_DRIVER_CLASS2( ALSA-sw, ALSA9_Software );
static const int channels = 2;
static const int samples_per_frame = channels;
static const int bytes_per_frame = sizeof(std::int16_t) * samples_per_frame;
static const int bytes_per_frame = sizeof(int16_t) * samples_per_frame;
/* Linux 2.6 has a fine-grained scheduler. We can almost always use a smaller buffer
* size than in 2.4. XXX: Some cards can handle smaller buffer sizes than others. */
@@ -54,7 +54,7 @@ bool RageSoundDriver_ALSA9_Software::GetData()
if( frames_to_fill <= 0 )
return false;
static std::int16_t *buf = nullptr;
static int16_t *buf = nullptr;
static int bufsize = 0;
if( buf && bufsize < frames_to_fill )
{
@@ -63,12 +63,12 @@ bool RageSoundDriver_ALSA9_Software::GetData()
}
if( !buf )
{
buf = new std::int16_t[frames_to_fill*samples_per_frame];
buf = new int16_t[frames_to_fill*samples_per_frame];
bufsize = frames_to_fill;
}
const std::int64_t play_pos = m_pPCM->GetPlayPos();
const std::int64_t cur_play_pos = m_pPCM->GetPosition();
const int64_t play_pos = m_pPCM->GetPlayPos();
const int64_t cur_play_pos = m_pPCM->GetPosition();
this->Mix( buf, frames_to_fill, play_pos, cur_play_pos );
m_pPCM->Write( buf, frames_to_fill );
@@ -77,7 +77,7 @@ bool RageSoundDriver_ALSA9_Software::GetData()
}
std::int64_t RageSoundDriver_ALSA9_Software::GetPosition() const
int64_t RageSoundDriver_ALSA9_Software::GetPosition() const
{
return m_pPCM->GetPosition();
}
@@ -16,7 +16,7 @@ public:
RString Init();
/* virtuals: */
std::int64_t GetPosition() const;
int64_t GetPosition() const;
float GetPlayLatency() const;
int GetSampleRate() const { return m_iSampleRate; }
+1 -1
View File
@@ -16,7 +16,7 @@ public:
~RageSoundDriver_AU();
float GetPlayLatency() const;
int GetSampleRate() const { return m_iSampleRate; }
std::int64_t GetPosition() const;
int64_t GetPosition() const;
protected:
void SetupDecodingThread();
+4 -4
View File
@@ -205,9 +205,9 @@ RageSoundDriver_AU::~RageSoundDriver_AU()
delete m_pNotificationThread;
}
std::int64_t RageSoundDriver_AU::GetPosition() const
int64_t RageSoundDriver_AU::GetPosition() const
{
return std::int64_t( m_TimeScale * AudioGetCurrentHostTime() );
return int64_t( m_TimeScale * AudioGetCurrentHostTime() );
}
@@ -350,8 +350,8 @@ OSStatus RageSoundDriver_AU::Render( void *inRefCon,
This->m_pIOThread = new RageThreadRegister( "HAL I/O thread" );
AudioBuffer &buf = ioData->mBuffers[0];
std::int64_t now = std::int64_t( This->m_TimeScale * AudioGetCurrentHostTime() );
std::int64_t next = std::int64_t( This->m_TimeScale * inTimeStamp->mHostTime );
int64_t now = int64_t( This->m_TimeScale * AudioGetCurrentHostTime() );
int64_t next = int64_t( This->m_TimeScale * inTimeStamp->mHostTime );
This->Mix( (float *)buf.mData, inNumberFrames, next, now );
if( unlikely(This->m_bDone) )
@@ -44,7 +44,7 @@ void RageSoundDriver_DSound_Software::MixerThread()
{
char *pLockedBuf;
unsigned iLen;
const std::int64_t iPlayPos = m_pPCM->GetOutputPosition(); /* must be called before get_output_buf */
const int64_t iPlayPos = m_pPCM->GetOutputPosition(); /* must be called before get_output_buf */
if( !m_pPCM->get_output_buf(&pLockedBuf, &iLen, chunksize()) )
{
@@ -52,7 +52,7 @@ void RageSoundDriver_DSound_Software::MixerThread()
continue;
}
this->Mix( (std::int16_t *) pLockedBuf, iLen/bytes_per_frame, iPlayPos, m_pPCM->GetPosition() );
this->Mix( (int16_t *) pLockedBuf, iLen/bytes_per_frame, iPlayPos, m_pPCM->GetPosition() );
m_pPCM->release_output_buf( pLockedBuf, iLen );
}
@@ -62,7 +62,7 @@ void RageSoundDriver_DSound_Software::MixerThread()
m_pPCM->Stop();
}
std::int64_t RageSoundDriver_DSound_Software::GetPosition() const
int64_t RageSoundDriver_DSound_Software::GetPosition() const
{
return m_pPCM->GetPosition();
}
@@ -14,7 +14,7 @@ public:
virtual ~RageSoundDriver_DSound_Software();
RString Init();
std::int64_t GetPosition() const;
int64_t GetPosition() const;
float GetPlayLatency() const;
int GetSampleRate() const;
@@ -56,14 +56,14 @@ int RageSoundDriver::DecodeThread_start( void *p )
return 0;
}
static std::int64_t g_iTotalAhead = 0;
static int64_t g_iTotalAhead = 0;
static int g_iTotalAheadCount = 0;
RageSoundMixBuffer &RageSoundDriver::MixIntoBuffer( int iFrames, std::int64_t iFrameNumber, std::int64_t iCurrentFrame )
RageSoundMixBuffer &RageSoundDriver::MixIntoBuffer( int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame )
{
ASSERT_M( m_DecodeThread.IsCreated(), "RageSoundDriver::StartDecodeThread() was never called" );
std::int64_t frameDifference = iFrameNumber - iCurrentFrame + static_cast<std::int64_t>(iFrames);
int64_t frameDifference = iFrameNumber - iCurrentFrame + static_cast<int64_t>(iFrames);
if (frameDifference > 0)
{
g_iTotalAhead += frameDifference;
@@ -100,9 +100,9 @@ RageSoundMixBuffer &RageSoundDriver::MixIntoBuffer( int iFrames, std::int64_t iF
if( !s.m_StartTime.IsZero() && iCurrentFrame != -1 )
{
/* If the sound is supposed to start at a time past this buffer, insert silence. */
const std::int64_t iFramesUntilThisBuffer = iFrameNumber - iCurrentFrame;
const int64_t iFramesUntilThisBuffer = iFrameNumber - iCurrentFrame;
const float fSecondsBeforeStart = -s.m_StartTime.Ago();
const std::int64_t iFramesBeforeStart = std::int64_t(fSecondsBeforeStart * GetSampleRate());
const int64_t iFramesBeforeStart = int64_t(fSecondsBeforeStart * GetSampleRate());
const int iSilentFramesInThisBuffer = std::clamp( int(iFramesBeforeStart-iFramesUntilThisBuffer), 0, iFramesLeft );
iGotFrames += iSilentFramesInThisBuffer;
@@ -170,19 +170,19 @@ RageSoundMixBuffer &RageSoundDriver::MixIntoBuffer( int iFrames, std::int64_t iF
return mix;
}
void RageSoundDriver::Mix( std::int16_t *pBuf, int iFrames, std::int64_t iFrameNumber, std::int64_t iCurrentFrame )
void RageSoundDriver::Mix( int16_t *pBuf, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame )
{
memset( pBuf, 0, iFrames*channels*sizeof(std::int16_t) );
memset( pBuf, 0, iFrames*channels*sizeof(int16_t) );
MixIntoBuffer( iFrames, iFrameNumber, iCurrentFrame ).read( pBuf );
}
void RageSoundDriver::Mix( float *pBuf, int iFrames, std::int64_t iFrameNumber, std::int64_t iCurrentFrame )
void RageSoundDriver::Mix( float *pBuf, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame )
{
memset( pBuf, 0, iFrames*channels*sizeof(float) );
MixIntoBuffer( iFrames, iFrameNumber, iCurrentFrame ).read( pBuf );
}
void RageSoundDriver::MixDeinterlaced( float **pBufs, int iChannels, int iFrames, std::int64_t iFrameNumber, std::int64_t iCurrentFrame )
void RageSoundDriver::MixDeinterlaced( float **pBufs, int iChannels, int iFrames, int64_t iFrameNumber, int64_t iCurrentFrame )
{
for (int i = 0; i < iChannels; ++i )
memset( pBufs[i], 0, iFrames*sizeof(float) );
@@ -478,7 +478,7 @@ RageSoundDriver::~RageSoundDriver()
}
}
std::int64_t RageSoundDriver::ClampHardwareFrame( std::int64_t iHardwareFrame ) const
int64_t RageSoundDriver::ClampHardwareFrame( int64_t iHardwareFrame ) const
{
/* It's sometimes possible for the hardware position to move backwards, usually
* on underrun. We can try to prevent this in each driver, but it's an obscure
@@ -487,8 +487,8 @@ std::int64_t RageSoundDriver::ClampHardwareFrame( std::int64_t iHardwareFrame )
{
/* Clamp the output to one per second, so one underruns don't cascade due to
* output spam. */
static std::int64_t lastTime = 0;
std::int64_t currentTime = RageTimer::GetTimeSinceStartMicroseconds();
static int64_t lastTime = 0;
int64_t currentTime = RageTimer::GetTimeSinceStartMicroseconds();
if( lastTime == 0 || (currentTime - lastTime) > 1000000 )
{
LOG->Trace("RageSoundDriver: driver returned a lesser position (%" PRId64 " < %" PRId64 ")", iHardwareFrame, m_iMaxHardwareFrame);
@@ -503,7 +503,7 @@ std::int64_t RageSoundDriver::ClampHardwareFrame( std::int64_t iHardwareFrame )
return m_iMaxHardwareFrame;
}
std::int64_t RageSoundDriver::GetHardwareFrame( RageTimer *pTimestamp=nullptr ) const
int64_t RageSoundDriver::GetHardwareFrame( RageTimer *pTimestamp=nullptr ) const
{
if( pTimestamp == nullptr )
return ClampHardwareFrame( GetPosition() );
@@ -518,7 +518,7 @@ std::int64_t RageSoundDriver::GetHardwareFrame( RageTimer *pTimestamp=nullptr )
* severe performance problems, anyway.
*/
int iTries = 3;
std::int64_t iPositionFrames;
int64_t iPositionFrames;
uint64_t iStartTime;
const uint64_t iThreshold = 2000ULL;
+1 -1
View File
@@ -186,7 +186,7 @@ RString RageSoundDriver_JACK::ConnectPorts()
return ret;
}
std::int64_t RageSoundDriver_JACK::GetPosition() const
int64_t RageSoundDriver_JACK::GetPosition() const
{
return jack_frame_time(client);
}
+1 -1
View File
@@ -18,7 +18,7 @@ public:
RString Init();
int GetSampleRate() const;
std::int64_t GetPosition() const;
int64_t GetPosition() const;
private:
jack_client_t *client;
+2 -2
View File
@@ -15,7 +15,7 @@ void RageSoundDriver_Null::Update()
/* "Play" frames. */
while( m_iLastCursorPos < GetPosition()+1024*4 )
{
std::int16_t buf[256*channels];
int16_t buf[256*channels];
this->Mix( buf, 256, m_iLastCursorPos, GetPosition() );
m_iLastCursorPos += 256;
}
@@ -23,7 +23,7 @@ void RageSoundDriver_Null::Update()
RageSoundDriver::Update();
}
std::int64_t RageSoundDriver_Null::GetPosition() const
int64_t RageSoundDriver_Null::GetPosition() const
{
return (RageTimer::GetTimeSinceStartMicroseconds() * m_iSampleRate) / 1000000;
}
+2 -2
View File
@@ -9,12 +9,12 @@ class RageSoundDriver_Null: public RageSoundDriver
{
public:
RageSoundDriver_Null();
std::int64_t GetPosition() const;
int64_t GetPosition() const;
int GetSampleRate() const;
void Update();
private:
std::int64_t m_iLastCursorPos;
int64_t m_iLastCursorPos;
int m_iSampleRate;
};
#define USE_RAGE_SOUND_NULL
+3 -3
View File
@@ -83,9 +83,9 @@ bool RageSoundDriver_OSS::GetData()
const int chunksize = ab.fragsize;
static std::int16_t *buf = nullptr;
static int16_t *buf = nullptr;
if(!buf)
buf = new std::int16_t[chunksize / sizeof(std::int16_t)];
buf = new int16_t[chunksize / sizeof(int16_t)];
this->Mix( buf, chunksize/bytes_per_frame, last_cursor_pos, GetPosition() );
@@ -101,7 +101,7 @@ bool RageSoundDriver_OSS::GetData()
/* XXX: There's a race on last_cursor_pos here: new data might be written after the
* ioctl returns, incrementing last_cursor_pos. */
std::int64_t RageSoundDriver_OSS::GetPosition() const
int64_t RageSoundDriver_OSS::GetPosition() const
{
ASSERT( fd != -1 );
+1 -1
View File
@@ -26,7 +26,7 @@ public:
int GetSampleRate() const { return samplerate; }
/* virtuals: */
std::int64_t GetPosition() const;
int64_t GetPosition() const;
float GetPlayLatency() const;
void SetupDecodingThread();
@@ -306,15 +306,15 @@ void RageSoundDriver_PulseAudio::StreamStateCb(pa_stream *s)
}
}
std::int64_t RageSoundDriver_PulseAudio::GetPosition() const
int64_t RageSoundDriver_PulseAudio::GetPosition() const
{
pa_threaded_mainloop_lock(m_PulseMainLoop);
std::int64_t position = GetPositionUnlocked();
int64_t position = GetPositionUnlocked();
pa_threaded_mainloop_unlock(m_PulseMainLoop);
return position;
}
std::int64_t RageSoundDriver_PulseAudio::GetPositionUnlocked() const
int64_t RageSoundDriver_PulseAudio::GetPositionUnlocked() const
{
pa_usec_t usec;
if(pa_stream_get_time(m_PulseStream, &usec) < 0)
@@ -329,12 +329,12 @@ std::int64_t RageSoundDriver_PulseAudio::GetPositionUnlocked() const
}
size_t length = pa_usec_to_bytes(usec, &m_ss);
return length / (sizeof(std::int16_t) * 2); /* we use 16-bit frames and 2 channels */
return length / (sizeof(int16_t) * 2); /* we use 16-bit frames and 2 channels */
}
void RageSoundDriver_PulseAudio::StreamWriteCb(pa_stream *s, size_t length)
{
std::int64_t curPos = GetPositionUnlocked();
int64_t curPos = GetPositionUnlocked();
while(length > 0)
{
void* buf;
@@ -344,10 +344,10 @@ void RageSoundDriver_PulseAudio::StreamWriteCb(pa_stream *s, size_t length)
RageException::Throw("Pulse: pa_stream_begin_write() failed: %s", pa_strerror(pa_context_errno(m_PulseCtx)));
}
const size_t nbframes = bufsize / sizeof(std::int16_t); /* we use 16-bit frames */
std::int64_t pos1 = m_LastPosition;
std::int64_t pos2 = pos1 + nbframes/2; /* Mix() position in stereo frames */
this->Mix( reinterpret_cast<std::int16_t*>(buf), pos2-pos1, pos1, curPos);
const size_t nbframes = bufsize / sizeof(int16_t); /* we use 16-bit frames */
int64_t pos1 = m_LastPosition;
int64_t pos2 = pos1 + nbframes/2; /* Mix() position in stereo frames */
this->Mix( reinterpret_cast<int16_t*>(buf), pos2-pos1, pos1, curPos);
if(pa_stream_write(m_PulseStream, buf, bufsize, nullptr, 0, PA_SEEK_RELATIVE) < 0)
{
+3 -3
View File
@@ -18,13 +18,13 @@ public:
RString Init();
std::int64_t GetPosition() const;
int64_t GetPosition() const;
inline int GetSampleRate() const { return m_ss.rate; };
protected:
std::int64_t GetPositionUnlocked() const;
int64_t GetPositionUnlocked() const;
std::int64_t m_LastPosition;
int64_t m_LastPosition;
pa_sample_spec m_ss;
char *m_Error;
+13 -13
View File
@@ -1025,7 +1025,7 @@ bool WinWdmStream::SubmitPacket( int iPacket, RString &sError )
#include <windows.h>
namespace
{
void MapChannels( const std::int16_t *pIn, std::int16_t *pOut, int iInChannels, int iOutChannels, int iFrames, const int *pChannelMap )
void MapChannels( const int16_t *pIn, int16_t *pOut, int iInChannels, int iOutChannels, int iFrames, const int *pChannelMap )
{
for( int i = 0; i < iFrames; ++i )
{
@@ -1049,7 +1049,7 @@ namespace
}
}
void MapChannels( const std::int16_t *pIn, std::int16_t *pOut, int iInChannels, int iOutChannels, int iFrames )
void MapChannels( const int16_t *pIn, int16_t *pOut, int iInChannels, int iOutChannels, int iFrames )
{
static const int i1ChannelMap[] = { -2 };
static const int i4ChannelMap[] = { 0, 1, 0, 1 };
@@ -1067,7 +1067,7 @@ namespace
MapChannels( pIn, pOut, iInChannels, iOutChannels, iFrames, pChannelMap );
}
void MapSampleFormatFromInt16( const std::int16_t *pIn, void *pOut, int iSamples, DeviceSampleFormat FromFormat )
void MapSampleFormatFromInt16( const int16_t *pIn, void *pOut, int iSamples, DeviceSampleFormat FromFormat )
{
switch( FromFormat )
{
@@ -1092,7 +1092,7 @@ namespace
}
case DeviceSampleFormat_Int32:
{
std::int16_t *pOutBuf = (std::int16_t *) pOut;
int16_t *pOutBuf = (int16_t *) pOut;
for( int i = 0; i < iSamples; ++i )
{
*pOutBuf++ = 0;
@@ -1112,29 +1112,29 @@ void RageSoundDriver_WDMKS::Read( void *pData, int iFrames, int iLastCursorPos,
if( m_pStream->m_iDeviceOutputChannels == iChannels &&
m_pStream->m_DeviceSampleFormat == DeviceSampleFormat_Int16 )
{
std::int16_t *pBuf = (std::int16_t *) pData;
int16_t *pBuf = (int16_t *) pData;
this->Mix( pBuf, iFrames, iLastCursorPos, iCurrentFrame );
return;
}
std::int16_t *pBuf = (std::int16_t *) alloca( iFrames * iChannels * sizeof(std::int16_t) );
this->Mix( (std::int16_t *) pBuf, iFrames, iLastCursorPos, iCurrentFrame );
int16_t *pBuf = (int16_t *) alloca( iFrames * iChannels * sizeof(int16_t) );
this->Mix( (int16_t *) pBuf, iFrames, iLastCursorPos, iCurrentFrame );
/* If the device has other than 2 channels, convert. */
if( m_pStream->m_iDeviceOutputChannels != iChannels )
{
std::int16_t *pTempBuf = (std::int16_t *) alloca( iFrames * m_pStream->m_iBytesPerOutputSample * m_pStream->m_iDeviceOutputChannels );
MapChannels( (std::int16_t *) pBuf, pTempBuf, iChannels, m_pStream->m_iDeviceOutputChannels, iFrames );
int16_t *pTempBuf = (int16_t *) alloca( iFrames * m_pStream->m_iBytesPerOutputSample * m_pStream->m_iDeviceOutputChannels );
MapChannels( (int16_t *) pBuf, pTempBuf, iChannels, m_pStream->m_iDeviceOutputChannels, iFrames );
pBuf = pTempBuf;
}
/* If the device format isn't std::int16_t, convert. */
/* If the device format isn't int16_t, convert. */
if( m_pStream->m_DeviceSampleFormat != DeviceSampleFormat_Int16 )
{
int iSamples = iFrames * m_pStream->m_iDeviceOutputChannels;
void *pTempBuf = alloca( iSamples * m_pStream->m_iBytesPerOutputSample );
MapSampleFormatFromInt16( (std::int16_t *) pBuf, pTempBuf, iSamples, m_pStream->m_DeviceSampleFormat );
pBuf = (std::int16_t *) pTempBuf;
MapSampleFormatFromInt16( (int16_t *) pBuf, pTempBuf, iSamples, m_pStream->m_DeviceSampleFormat );
pBuf = (int16_t *) pTempBuf;
}
memcpy( pData, pBuf, iFrames * m_pStream->m_iDeviceOutputChannels * m_pStream->m_iBytesPerOutputSample );
@@ -1236,7 +1236,7 @@ void RageSoundDriver_WDMKS::SetupDecodingThread()
LOG->Warn( werr_ssprintf(GetLastError(), "Failed to set sound thread priority") );
}
std::int64_t RageSoundDriver_WDMKS::GetPosition() const
int64_t RageSoundDriver_WDMKS::GetPosition() const
{
KSAUDIO_POSITION pos;
+1 -1
View File
@@ -18,7 +18,7 @@ public:
~RageSoundDriver_WDMKS();
RString Init();
std::int64_t GetPosition() const;
int64_t GetPosition() const;
float GetPlayLatency() const;
int GetSampleRate() const;
+2 -2
View File
@@ -75,7 +75,7 @@ bool RageSoundDriver_WaveOut::GetData()
return false;
/* Call the callback. */
this->Mix( (std::int16_t *) m_aBuffers[b].lpData, CHUNKSIZE_FRAMES, m_iLastCursorPos, GetPosition() );
this->Mix( (int16_t *) m_aBuffers[b].lpData, CHUNKSIZE_FRAMES, m_iLastCursorPos, GetPosition() );
MMRESULT ret = waveOutWrite( m_hWaveOut, &m_aBuffers[b], sizeof(m_aBuffers[b]) );
if( ret != MMSYSERR_NOERROR )
@@ -99,7 +99,7 @@ void RageSoundDriver_WaveOut::SetupDecodingThread()
LOG->Warn( werr_ssprintf(GetLastError(), "Failed to set sound thread priority") );
}
std::int64_t RageSoundDriver_WaveOut::GetPosition() const
int64_t RageSoundDriver_WaveOut::GetPosition() const
{
MMTIME tm;
tm.wType = TIME_SAMPLES;
+1 -1
View File
@@ -15,7 +15,7 @@ public:
RageSoundDriver_WaveOut();
~RageSoundDriver_WaveOut();
RString Init();
std::int64_t GetPosition() const;
int64_t GetPosition() const;
float GetPlayLatency() const;
int GetSampleRate() const { return m_iSampleRate; }
static const int NUM_BUFFERS = 32;
+4 -4
View File
@@ -39,9 +39,9 @@ static const char *itoa(unsigned n)
return p;
}
static std::intptr_t xtoi( const char *hex )
static intptr_t xtoi( const char *hex )
{
std::intptr_t ret = 0;
intptr_t ret = 0;
for(;;)
{
int val = -1;
@@ -502,7 +502,7 @@ static bool PointsToValidCall( vm_address_t start, const void *ptr )
/* We're reading buf backwards, between buf[-7] and buf[-1]. Find out how
* far we can read. */
const int len = std::min<int>(std::intptr_t(ptr) - start, 7);
const int len = std::min<int>(intptr_t(ptr) - start, 7);
// Permissible CALL sequences that we care about:
//
@@ -639,7 +639,7 @@ void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx )
buf[i++] = p;
}
}
frame = (Frame *)(std::intptr_t(frame)+4);
frame = (Frame *)(intptr_t(frame)+4);
continue;
}
// Valid.
+4 -4
View File
@@ -101,7 +101,7 @@ RString BacktraceNames::Format() const
#include <dlfcn.h>
void BacktraceNames::FromAddr( void * const p )
{
Address = (std::intptr_t) p;
Address = (intptr_t) p;
/*
* When calling a function that doesn't return, gcc will truncate a function.
@@ -226,7 +226,7 @@ static const char *osx_find_link_edit( const struct mach_header *header )
void BacktraceNames::FromAddr( void * const p )
{
Address = (std::intptr_t) p;
Address = (intptr_t) p;
/* Find the image with the given pointer. */
int index = osx_find_image( p );
@@ -298,7 +298,7 @@ void BacktraceNames::FromAddr( void * const p )
#include <execinfo.h>
void BacktraceNames::FromAddr( void * const p )
{
Address = (std::intptr_t) p;
Address = (intptr_t) p;
char **foo = backtrace_symbols(&p, 1);
if( foo == nullptr )
@@ -346,7 +346,7 @@ void BacktraceNames::FromString( RString s )
#warning Undefined BACKTRACE_LOOKUP_METHOD_*
void BacktraceNames::FromAddr( void * const p )
{
Address = std::intptr_t(p);
Address = intptr_t(p);
Offset = 0;
Symbol = "";
File = "";
+1 -1
View File
@@ -6,7 +6,7 @@
struct BacktraceNames
{
RString Symbol, File;
std::intptr_t Address;
intptr_t Address;
int Offset;
void FromAddr( void * const p );
void FromString( RString str );
+5 -5
View File
@@ -189,7 +189,7 @@ namespace VDDebugInfo
return heap;
}
std::intptr_t VDDebugInfoLookupRVA( const Context *pctx, uintptr_t rva, char *buf, int buflen )
intptr_t VDDebugInfoLookupRVA( const Context *pctx, uintptr_t rva, char *buf, int buflen )
{
if( !PointerIsInAnySegment(pctx, rva) )
return -1;
@@ -201,7 +201,7 @@ namespace VDDebugInfo
// Linearly unpack RVA deltas and find lower_bound
rva -= pctx->nFirstRVA;
if( static_cast<std::intptr_t>(rva) < 0 )
if( static_cast<intptr_t>(rva) < 0 )
return -1;
while( pr < pr_limit )
@@ -218,7 +218,7 @@ namespace VDDebugInfo
rva -= diff;
if (static_cast<std::intptr_t>(rva) < 0) {
if (static_cast<intptr_t>(rva) < 0) {
rva += diff;
break;
}
@@ -237,7 +237,7 @@ namespace VDDebugInfo
strncpy( buf, fn_name, buflen );
buf[buflen-1] = 0;
return static_cast<std::intptr_t>(rva);
return static_cast<intptr_t>(rva);
}
}
@@ -370,7 +370,7 @@ namespace SymbolLookup
VirtualQueryEx( g_hParent, ptr, &meminfo, sizeof meminfo );
char tmp[512];
std::intptr_t iAddress = VDDebugInfo::VDDebugInfoLookupRVA(pctx, reinterpret_cast<uintptr_t>(ptr), tmp, sizeof(tmp));
intptr_t iAddress = VDDebugInfo::VDDebugInfoLookupRVA(pctx, reinterpret_cast<uintptr_t>(ptr), tmp, sizeof(tmp));
if( iAddress >= 0 )
{
wsprintf( buf, "%" ADDRESS_ZEROS "Ix: %s [%" ADDRESS_ZEROS "Ix+%Ix+%Ix]", reinterpret_cast<uintptr_t>(ptr), Demangle(tmp),
+1 -1
View File
@@ -28,7 +28,7 @@ static LONG GetRegKey( HKEY key, RString subkey, LPTSTR retdata )
bool GotoURL( RString sUrl )
{
// First try ShellExecute()
std::intptr_t iRet = reinterpret_cast<std::intptr_t>(ShellExecute( nullptr, "open", sUrl, nullptr, nullptr, SW_SHOWDEFAULT ));
intptr_t iRet = reinterpret_cast<intptr_t>(ShellExecute( nullptr, "open", sUrl, nullptr, nullptr, SW_SHOWDEFAULT ));
// If it failed, get the .htm regkey and lookup the program
if( iRet > 32 )
+13 -13
View File
@@ -46,7 +46,7 @@ void dump_bin( const char *fn, const char *buf, int size )
close( fd );
}
void dump( const char *fn, const std::int16_t *buf, int samples )
void dump( const char *fn, const int16_t *buf, int samples )
{
FILE *f = fopen( fn, "w+");
ASSERT( f );
@@ -72,7 +72,7 @@ void dump( const char *buf, int size )
printf("\n\n");
}
void dump( const std::int16_t *buf, int samples )
void dump( const int16_t *buf, int samples )
{
for( int i = 0; i < samples; ++i )
printf( "0x%04hx,", buf[i] );
@@ -86,11 +86,11 @@ void dump( const float *buf, int samples )
printf( "\n" );
}
bool compare( const float *m1, const std::int16_t *m2, int iSamples )
bool compare( const float *m1, const int16_t *m2, int iSamples )
{
for( int i = 0; i < iSamples; ++i )
{
std::int16_t iSample1 = std::lrint(m1[i]*32768);
int16_t iSample1 = std::lrint(m1[i]*32768);
if( iSample1 != m2[i] )
return false;
}
@@ -99,7 +99,7 @@ bool compare( const float *m1, const std::int16_t *m2, int iSamples )
}
void compare_buffers( const std::int16_t *expect, const std::int16_t *got, int frames,
void compare_buffers( const int16_t *expect, const int16_t *got, int frames,
int &NumInaccurateSamplesAtStart,
int &NumInaccurateSamples )
{
@@ -125,7 +125,7 @@ void compare_buffers( const std::int16_t *expect, const std::int16_t *got, int f
}
bool compare_buffers( const std::int16_t *expect, const std::int16_t *got, int frames, int channels )
bool compare_buffers( const int16_t *expect, const int16_t *got, int frames, int channels )
{
/*
* Compare each channel separately. Try to figure out if
@@ -165,8 +165,8 @@ bool test_read( RageSoundReader *snd, float *expected_data, int frames )
int got = snd->Read( buf, frames );
ASSERT( got == frames );
//compare_buffers( (const std::int16_t *) expected_data,
// (const std::int16_t *) buf,
//compare_buffers( (const int16_t *) expected_data,
// (const int16_t *) buf,
// bytes/2,
// 2 );
@@ -258,7 +258,7 @@ const int TestDataSize = 2;
/* Find "haystack" in "needle". Start looking at "expect" and move outward; find
* the closest. */
void *xmemsearch( const float *haystack, size_t iHaystackSamples,
const std::int16_t *needle, size_t iNeedleSamples,
const int16_t *needle, size_t iNeedleSamples,
int expect )
{
if( !iNeedleSamples )
@@ -301,10 +301,10 @@ struct TestFile
int SilentFrames;
/* The first two frames (four samples): */
std::int16_t initial[TestDataSize*2];
int16_t initial[TestDataSize*2];
/* Frames of data half a second in: */
std::int16_t later[TestDataSize*2];
int16_t later[TestDataSize*2];
};
const int channels = 2;
@@ -378,7 +378,7 @@ bool RunTests( RageSoundReader *snd, const TestFile &tf )
dump( LaterData, 16 );
/* See if we can find the half second data. */
float *p = (float *) xmemsearch( sdata, one_second_bytes, tf.later, sizeof(tf.later), LaterOffsetSamples*sizeof(std::int16_t) );
float *p = (float *) xmemsearch( sdata, one_second_bytes, tf.later, sizeof(tf.later), LaterOffsetSamples*sizeof(int16_t) );
if( p )
{
int SamplesOff = p-sdata;
@@ -387,7 +387,7 @@ bool RunTests( RageSoundReader *snd, const TestFile &tf )
FramesOff, LaterOffsetFrames, FramesOff-LaterOffsetFrames );
}
// else
// dump( "foo", sdata, one_second/sizeof(std::int16_t) );
// dump( "foo", sdata, one_second/sizeof(int16_t) );
}
}