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