support PREFSMAN->m_iSoundPreferredSampleRate
This commit is contained in:
@@ -15,8 +15,6 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
static const int channels = 2;
|
static const int channels = 2;
|
||||||
int samplerate = 44100;
|
|
||||||
|
|
||||||
static const int samples_per_frame = channels;
|
static const int samples_per_frame = channels;
|
||||||
static const int bytes_per_frame = sizeof(int16_t) * samples_per_frame;
|
static const int bytes_per_frame = sizeof(int16_t) * samples_per_frame;
|
||||||
|
|
||||||
@@ -106,9 +104,9 @@ CString RageSound_ALSA9_Software::Init()
|
|||||||
if( sError != "" )
|
if( sError != "" )
|
||||||
return sError;
|
return sError;
|
||||||
|
|
||||||
samplerate = m_pPCM->FindSampleRate( samplerate );
|
m_iSampleRate = m_pPCM->FindSampleRate( m_iSampleRate = PREFSMAN->m_iSoundPreferredSampleRate );
|
||||||
m_pPCM->SetSampleRate( samplerate );
|
m_pPCM->SetSampleRate( m_iSampleRate );
|
||||||
LOG->Info( "ALSA: Software mixing at %ihz", samplerate );
|
LOG->Info( "ALSA: Software mixing at %ihz", m_iSampleRate );
|
||||||
|
|
||||||
m_pPCM->SetWriteahead( g_iMaxWriteahead );
|
m_pPCM->SetWriteahead( g_iMaxWriteahead );
|
||||||
m_pPCM->SetChunksize( g_iMaxWriteahead / num_chunks );
|
m_pPCM->SetChunksize( g_iMaxWriteahead / num_chunks );
|
||||||
@@ -140,12 +138,7 @@ RageSound_ALSA9_Software::~RageSound_ALSA9_Software()
|
|||||||
|
|
||||||
float RageSound_ALSA9_Software::GetPlayLatency() const
|
float RageSound_ALSA9_Software::GetPlayLatency() const
|
||||||
{
|
{
|
||||||
return float(g_iMaxWriteahead)/samplerate;
|
return float(g_iMaxWriteahead) / m_iSampleRate;
|
||||||
}
|
|
||||||
|
|
||||||
int RageSound_ALSA9_Software::GetSampleRate( int iRate ) const
|
|
||||||
{
|
|
||||||
return samplerate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -10,23 +10,24 @@
|
|||||||
class RageSound_ALSA9_Software: public RageSound_Generic_Software
|
class RageSound_ALSA9_Software: public RageSound_Generic_Software
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/* virtuals: */
|
|
||||||
int64_t GetPosition( const RageSoundBase *pSound ) const;
|
|
||||||
float GetPlayLatency() const;
|
|
||||||
int GetSampleRate( int iRate ) const;
|
|
||||||
|
|
||||||
void SetupDecodingThread();
|
|
||||||
|
|
||||||
RageSound_ALSA9_Software();
|
RageSound_ALSA9_Software();
|
||||||
~RageSound_ALSA9_Software();
|
~RageSound_ALSA9_Software();
|
||||||
CString Init();
|
CString Init();
|
||||||
|
|
||||||
|
/* virtuals: */
|
||||||
|
int64_t GetPosition( const RageSoundBase *pSound ) const;
|
||||||
|
float GetPlayLatency() const;
|
||||||
|
int GetSampleRate( int iRate ) const { return m_iSampleRate; }
|
||||||
|
|
||||||
|
void SetupDecodingThread();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int MixerThread_start( void *p );
|
static int MixerThread_start( void *p );
|
||||||
void MixerThread();
|
void MixerThread();
|
||||||
bool GetData();
|
bool GetData();
|
||||||
|
|
||||||
bool m_bShutdown;
|
bool m_bShutdown;
|
||||||
|
int m_iSampleRate;
|
||||||
Alsa9Buf *m_pPCM;
|
Alsa9Buf *m_pPCM;
|
||||||
RageThread m_MixingThread;
|
RageThread m_MixingThread;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user