remove RageSoundManager::FlushPosMapQueue, etc
This commit is contained in:
@@ -39,7 +39,6 @@ RageSoundManager *SOUNDMAN = NULL;
|
|||||||
|
|
||||||
RageSoundManager::RageSoundManager()
|
RageSoundManager::RageSoundManager()
|
||||||
{
|
{
|
||||||
pos_map_queue.reserve( 1024 );
|
|
||||||
m_fMixVolume = 1.0f;
|
m_fMixVolume = 1.0f;
|
||||||
m_bPlayOnlyCriticalSounds = false;
|
m_bPlayOnlyCriticalSounds = false;
|
||||||
}
|
}
|
||||||
@@ -112,8 +111,6 @@ int64_t RageSoundManager::GetPosition( RageTimer *pTimer ) const
|
|||||||
|
|
||||||
void RageSoundManager::Update()
|
void RageSoundManager::Update()
|
||||||
{
|
{
|
||||||
FlushPosMapQueue();
|
|
||||||
|
|
||||||
/* Scan m_mapPreloadedSounds for sounds that are no longer loaded, and delete them. */
|
/* Scan m_mapPreloadedSounds for sounds that are no longer loaded, and delete them. */
|
||||||
g_SoundManMutex.Lock(); /* lock for access to m_mapPreloadedSounds, owned_sounds */
|
g_SoundManMutex.Lock(); /* lock for access to m_mapPreloadedSounds, owned_sounds */
|
||||||
{
|
{
|
||||||
@@ -182,18 +179,6 @@ int RageSoundManager::GetUniqueID()
|
|||||||
return ++iID;
|
return ++iID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSoundManager::CommitPlayingPosition( int ID, int64_t frameno, int64_t pos, int got_frames )
|
|
||||||
{
|
|
||||||
/* This can be called from realtime threads; don't lock any mutexes. */
|
|
||||||
queued_pos_map_t p;
|
|
||||||
p.ID = ID;
|
|
||||||
p.frameno = frameno;
|
|
||||||
p.pos = pos;
|
|
||||||
p.got_frames = got_frames;
|
|
||||||
|
|
||||||
pos_map_queue.write( &p, 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
RageSound *RageSoundManager::GetSoundByID( int ID )
|
RageSound *RageSoundManager::GetSoundByID( int ID )
|
||||||
{
|
{
|
||||||
LockMut( g_SoundManMutex );
|
LockMut( g_SoundManMutex );
|
||||||
@@ -206,27 +191,6 @@ RageSound *RageSoundManager::GetSoundByID( int ID )
|
|||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is only called by RageSoundManager::Update. */
|
|
||||||
void RageSoundManager::FlushPosMapQueue()
|
|
||||||
{
|
|
||||||
queued_pos_map_t p;
|
|
||||||
|
|
||||||
/* We don't need to lock to access pos_map_queue. */
|
|
||||||
while( pos_map_queue.read( &p, 1 ) )
|
|
||||||
{
|
|
||||||
RageSound *pSound = GetSoundByID( p.ID );
|
|
||||||
|
|
||||||
/* If we can't find the ID, the sound was probably deleted before we got here. */
|
|
||||||
if( pSound == NULL )
|
|
||||||
{
|
|
||||||
// LOG->Trace("ignored unknown (stale?) commit ID %i", p.ID);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
pSound->CommitPlayingPosition( p.frameno, p.pos, p.got_frames );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float RageSoundManager::GetPlayLatency() const
|
float RageSoundManager::GetPlayLatency() const
|
||||||
{
|
{
|
||||||
if( m_pDriver == NULL )
|
if( m_pDriver == NULL )
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ public:
|
|||||||
void RegisterSound( RageSound *p ); /* used by RageSound */
|
void RegisterSound( RageSound *p ); /* used by RageSound */
|
||||||
void UnregisterSound( RageSound *p ); /* used by RageSound */
|
void UnregisterSound( RageSound *p ); /* used by RageSound */
|
||||||
int GetUniqueID(); /* used by RageSound */
|
int GetUniqueID(); /* used by RageSound */
|
||||||
void CommitPlayingPosition( int ID, int64_t frameno, int64_t pos, int got_bytes ); /* used by drivers */
|
|
||||||
float GetPlayLatency() const;
|
float GetPlayLatency() const;
|
||||||
int GetDriverSampleRate() const;
|
int GetDriverSampleRate() const;
|
||||||
|
|
||||||
@@ -75,16 +74,6 @@ private:
|
|||||||
float m_fMixVolume;
|
float m_fMixVolume;
|
||||||
bool m_bPlayOnlyCriticalSounds;
|
bool m_bPlayOnlyCriticalSounds;
|
||||||
|
|
||||||
struct queued_pos_map_t
|
|
||||||
{
|
|
||||||
int ID, got_frames;
|
|
||||||
int64_t frameno;
|
|
||||||
int64_t pos;
|
|
||||||
};
|
|
||||||
|
|
||||||
CircBuf<queued_pos_map_t> pos_map_queue;
|
|
||||||
void FlushPosMapQueue();
|
|
||||||
|
|
||||||
RageSound *GetSoundByID( int ID );
|
RageSound *GetSoundByID( int ID );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user