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
+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;