move SoundResampleQuality into RageSoundReader_Resample
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include "RageDisplay.h"
|
||||
#include "RageUtil.h"
|
||||
#include "arch/arch_default.h"
|
||||
#include "RageSoundReader_Resample.h" /* for ResampleQuality */
|
||||
#include "RageFile.h"
|
||||
#include "ProductInfo.h"
|
||||
#include "Foreach.h"
|
||||
@@ -400,7 +399,6 @@ PrefsManager::PrefsManager() :
|
||||
m_iSoundWriteAhead ( "SoundWriteAhead", 0 ),
|
||||
m_iSoundDevice ( "SoundDevice", "" ),
|
||||
m_iSoundPreferredSampleRate ( "SoundPreferredSampleRate", 44100 ),
|
||||
m_SoundResampleQuality ( "SoundResampleQuality", RageSoundReader_Resample::RESAMP_NORMAL ),
|
||||
m_sInputDrivers ( "InputDrivers", "" ),
|
||||
m_sLightsDriver ( "LightsDriver", "" ),
|
||||
m_sMovieDrivers ( "MovieDrivers", "" ),
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "Grade.h" // for NUM_GRADE_TIERS
|
||||
#include "Preference.h"
|
||||
#include "RageSoundReader_Resample.h" // for ResampleQuality
|
||||
class IniFile;
|
||||
|
||||
const int MAX_SONGS_PER_PLAY = 7;
|
||||
@@ -224,7 +223,6 @@ public:
|
||||
Preference<int> m_iSoundWriteAhead;
|
||||
Preference<CString> m_iSoundDevice;
|
||||
Preference<int> m_iSoundPreferredSampleRate;
|
||||
Preference<RageSoundReader_Resample::ResampleQuality,int> m_SoundResampleQuality;
|
||||
private:
|
||||
Preference<CString> m_sInputDrivers; // "" == default
|
||||
Preference<CString> m_sLightsDriver; // "" == default
|
||||
|
||||
@@ -226,7 +226,7 @@ void RageSound::LoadSoundReader( SoundReader *pSound )
|
||||
const int iNeededRate = SOUNDMAN->GetDriverSampleRate( pSound->GetSampleRate() );
|
||||
if( iNeededRate != pSound->GetSampleRate() )
|
||||
{
|
||||
RageSoundReader_Resample *Resample = RageSoundReader_Resample::MakeResampler( PREFSMAN->m_SoundResampleQuality );
|
||||
RageSoundReader_Resample *Resample = RageSoundReader_Resample::MakeResampler();
|
||||
Resample->Open( pSound );
|
||||
Resample->SetSampleRate( iNeededRate );
|
||||
pSound = Resample;
|
||||
|
||||
@@ -2,9 +2,16 @@
|
||||
#include "RageSoundReader_Resample.h"
|
||||
#include "RageSoundReader_Resample_Fast.h"
|
||||
#include "RageSoundReader_Resample_Good.h"
|
||||
#include "Preference.h"
|
||||
|
||||
static Preference<RageSoundReader_Resample::ResampleQuality,int>
|
||||
g_SoundResampleQuality( "SoundResampleQuality", RageSoundReader_Resample::RESAMP_NORMAL );
|
||||
|
||||
RageSoundReader_Resample *RageSoundReader_Resample::MakeResampler( ResampleQuality q )
|
||||
{
|
||||
if( q == RESAMP_INVALID )
|
||||
q = g_SoundResampleQuality;
|
||||
|
||||
switch( q )
|
||||
{
|
||||
case RESAMP_FAST:
|
||||
|
||||
@@ -8,14 +8,22 @@
|
||||
class RageSoundReader_Resample: public SoundReader
|
||||
{
|
||||
public:
|
||||
enum ResampleQuality
|
||||
{
|
||||
RESAMP_FAST,
|
||||
RESAMP_NORMAL,
|
||||
RESAMP_HIGHQUALITY,
|
||||
RESAMP_INVALID
|
||||
};
|
||||
|
||||
/* We own source. */
|
||||
virtual void Open( SoundReader *pSource ) = 0;
|
||||
|
||||
/* Change the actual sample rate of a sound. */
|
||||
virtual void SetSampleRate( int iRate ) = 0;
|
||||
|
||||
enum ResampleQuality { RESAMP_FAST, RESAMP_NORMAL, RESAMP_HIGHQUALITY };
|
||||
static RageSoundReader_Resample *MakeResampler( ResampleQuality q );
|
||||
/* If q = RESAMP_INVALID, the preferred resampler will be used. */
|
||||
static RageSoundReader_Resample *MakeResampler( ResampleQuality q = RESAMP_INVALID );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user