just some cleanup.

This commit is contained in:
AJ Kelly
2010-07-22 11:12:38 -05:00
parent ac0dd0789d
commit 5d06f50cbd
8 changed files with 112 additions and 124 deletions
-1
View File
@@ -57,7 +57,6 @@ struct DateTime
bool FromString( const RString sDateTime );
};
#endif
/*
+12 -17
View File
@@ -272,7 +272,7 @@ static void SearchForDifficulty( RString sTag, Steps *pOut )
{
sTag.MakeLower();
/* Only match "Light" in parentheses. */
// Only match "Light" in parentheses.
if( sTag.find( "(light" ) != sTag.npos )
{
pOut->SetDifficulty( Difficulty_Easy );
@@ -332,16 +332,14 @@ enum
BMS_TRACK_STOP = 9
};
/*
* Time signatures are often abused to tweak sync. Real time signatures should
/* Time signatures are often abused to tweak sync. Real time signatures should
* cause us to adjust the row offsets so one beat remains one beat. Fake time signatures,
* like 1.001 or 0.999, should be removed and converted to BPM changes. This is much
* more accurate, and prevents the whole song from being shifted off of the beat, causing
* BeatToNoteType to be wrong.
*
* Evaluate each time signature, and guess which time signatures should be converted
* to BPM changes. This isn't perfect, but errors aren't fatal.
*/
* to BPM changes. This isn't perfect, but errors aren't fatal. */
static void SetTimeSigAdjustments( const MeasureToTimeSig_t &sigs, Song &out, MeasureToTimeSig_t &sigAdjustmentsOut )
{
return;
@@ -353,7 +351,6 @@ static void SetTimeSigAdjustments( const MeasureToTimeSig_t &sigs, Song &out, Me
{
int iMeasure = it->first;
float fFactor = it->second;
#if 1
static const float ValidFactors[] =
{
@@ -377,7 +374,7 @@ static void SetTimeSigAdjustments( const MeasureToTimeSig_t &sigs, Song &out, Me
/* Alternate approach that I tried first: see if the ratio is sane. However,
* some songs have values like "1.4", which comes out to 7/4 and is not a valid
* time signature. */
/* Convert the factor to a ratio, and reduce it. */
// Convert the factor to a ratio, and reduce it.
int iNum = lrintf( fFactor * 1000 ), iDen = 1000;
int iDiv = gcd( iNum, iDen );
iNum /= iDiv;
@@ -525,9 +522,8 @@ static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameTo
}
/* This handles the hold notes in the RDM TYPE 1 style,
* like how uBMplay handles it. Different BMS simulators
* supports hold notes differently. see
* http://nvyu.net/rdm/ex.php for more info.
*/
* support hold notes differently. see
* http://nvyu.net/rdm/ex.php for more info. */
else if( iHoldStarts[bmsTrack] != -1 )
{
// This is ending a hold.
@@ -563,7 +559,7 @@ static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameTo
out.m_StepsType = DetermineStepsType( iPlayer, ndNotes, sPath );
if( out.m_StepsType == StepsType_beat_single5 && GetTagFromMap( mapNameToData, "#title", sData ) )
{
/* Hack: guess at 6-panel. */
// Hack: guess at 6-panel.
// extract the Steps description (looks like 'Music <BASIC>')
const size_t iOpenBracket = sData.find_first_of( "<(" );
@@ -795,7 +791,7 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
LOG->Trace( "Inserting keysound index %u '%s'", unsigned(out.m_vsKeysoundFile.size()-1), sWavID.c_str() );
}
/* Time signature tags affect all other global timing tags, so read them first. */
// Time signature tags affect all other global timing tags, so read them first.
MeasureToTimeSig_t mapMeasureToTimeSig;
ReadTimeSigs( mapNameToData, mapMeasureToTimeSig );
@@ -950,7 +946,7 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
}
}
/* Now that we're done reading BPMs, factor out weird time signatures. */
// Now that we're done reading BPMs, factor out weird time signatures.
SetTimeSigAdjustments( mapMeasureToTimeSig, out, sigAdjustmentsOut );
}
@@ -1003,7 +999,7 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
* called to begin with. */
ASSERT( arrayBMSFileNames.size() );
/* Read all BMS files. */
// Read all BMS files.
vector<NameToData_t> aBMSData;
for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
{
@@ -1021,7 +1017,7 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
LOG->UserLog( "Song", sDir, "has BMS files with inconsistent titles." );
}
/* Create a Steps for each. */
// Create a Steps for each.
vector<Steps*> apSteps;
for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
apSteps.push_back( new Steps );
@@ -1073,7 +1069,7 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
// As said before, all bets are off.
// From here on in, it's nothing but guesswork.
/* Try to figure out the difficulty of each file. */
// Try to figure out the difficulty of each file.
for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
{
// XXX: Is this really effective if Common Substring parsing failed?
@@ -1121,7 +1117,6 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
ConvertString( out.m_sArtist, "utf-8,japanese" );
ConvertString( out.m_sGenre, "utf-8,japanese" );
return true;
}
+10 -12
View File
@@ -4,21 +4,19 @@
#include "Foreach.h"
#include "RageLog.h"
/*
* Implement threaded read-ahead buffering.
/* Implement threaded read-ahead buffering.
*
* If a buffer is low on data, keep filling until it has a g_iMinFillFrames.
* Once beyond that, fill at a rate relative to realtime.
*
* This allows a stream to have a large buffer, for higher reliability, without
* causing major CPU bursts when the stream starts or underruns. Filling 32k
* takes more CPU than filling 4k frames, and may cause a skip.
*/
* takes more CPU than filling 4k frames, and may cause a skip. */
/* The amount of data to read at once: */
// The amount of data to read at once:
static const unsigned g_iReadBlockSizeFrames = 1024;
/* The maximum number of frames to buffer: */
// The maximum number of frames to buffer:
static const int g_iStreamingBufferFrames = 1024*32;
/* When a sound has fewer than g_iMinFillFrames buffered, buffer at maximum speed.
@@ -200,7 +198,7 @@ void RageSoundReader_ThreadedBuffer::BufferingThread()
continue;
}
/* Fill some data. */
// Fill some data.
m_bFilling = true;
int iFramesToFill = g_iReadBlockSizeFrames;
@@ -209,11 +207,11 @@ void RageSoundReader_ThreadedBuffer::BufferingThread()
int iRet = FillFrames( iFramesToFill );
/* Release m_bFilling, and signal the event to wake anyone waiting for it. */
// Release m_bFilling, and signal the event to wake anyone waiting for it.
m_bFilling = false;
m_Event.Broadcast();
/* On error or end of file, stop buffering the sound. */
// On error or end of file, stop buffering the sound.
if( iRet < 0 )
{
m_bEnabled = false;
@@ -253,7 +251,7 @@ int RageSoundReader_ThreadedBuffer::FillFrames( int iFrames )
if( iRet == 0 )
break;
/* On error or end of file, stop buffering the sound. */
// On error or end of file, stop buffering the sound.
if( iRet < 0 )
return iRet;
@@ -277,7 +275,7 @@ int RageSoundReader_ThreadedBuffer::FillBlock()
m_Event.Unlock();
{
/* We own m_pSource, even after unlocking, because m_bFilling is true. */
// We own m_pSource, even after unlocking, because m_bFilling is true.
unsigned iBufSize;
float *pBuf = m_DataBuffer.get_write_pointer( &iBufSize );
ASSERT( (iBufSize % iSamplesPerFrame) == 0 );
@@ -288,7 +286,7 @@ int RageSoundReader_ThreadedBuffer::FillBlock()
if( iGotFrames > 0 )
{
/* Add the data to the buffer. */
// Add the data to the buffer.
m_DataBuffer.advance_write_pointer( iGotFrames * iSamplesPerFrame );
if( iNextSourceFrame != m_StreamPosition.back().iPositionOfFirstFrame + m_StreamPosition.back().iFramesBuffered ||
fRate != m_StreamPosition.back().fRate )
+6 -6
View File
@@ -10,8 +10,7 @@ static ThemeMetric<float> THEME_SCREEN_HEIGHT("Common","ScreenHeight");
/* The theme's logical resolution specifies the minimum screen width and
* the minimum screen height with a 4:3 aspect ratio. Scale just one
* of the dimensions up to meet the requested aspect ratio.
*/
* of the dimensions up to meet the requested aspect ratio. */
/* The theme resolution isn't necessarily 4:3; a natively widescreen
* theme would have eg. 16:9 or 16:10.
@@ -25,9 +24,10 @@ float ScreenDimensions::GetThemeAspectRatio()
return THEME_NATIVE_ASPECT;
}
// ceilf was originally lrintf. However, lrintf causes odd resolutions like
// 639x480 (4:3) and 853x480 (16:9). ceilf gives the correct values of 640x480
// and 854x480 respectively. -aj
/* ceilf was originally lrintf. However, lrintf causes odd resolutions like
* 639x480 (4:3) and 853x480 (16:9). ceilf gives the correct values of 640x480
* and 854x480 (should really be 852 so that SCREEN_CENTER_X == 426 and not 427)
* respectively. -aj */
float ScreenDimensions::GetScreenWidth()
{
float fAspect = PREFSMAN->m_fDisplayAspectRatio;
@@ -50,7 +50,7 @@ float ScreenDimensions::GetScreenHeight()
void ScreenDimensions::ReloadScreenDimensions()
{
/* Important: explicitly refresh cached metrics that we use. */
// Important: explicitly refresh cached metrics that we use.
THEME_SCREEN_WIDTH.Read();
THEME_SCREEN_HEIGHT.Read();
+5 -9
View File
@@ -91,15 +91,13 @@ static Preference<bool> g_bAllowMultipleInstances( "AllowMultipleInstances", fal
void StepMania::GetPreferredVideoModeParams( VideoModeParams &paramsOut )
{
/*
* We can't rely on there being full-screen video modes that give us square
/* We can't rely on there being full-screen video modes that give us square
* pixels at non-4:3 aspects. The lowest non-4:3 resolution my new laptop
* with Radeon supports is 1280x720. In most cases, we'll using a 4:3
* resolution when full-screen let the monitor stretch to the correct aspect.
* When windowed (no monitor stretching), we will tweak the width so that
* we get square pixels.
* -Chris
*/
* -Chris */
int iWidth = PREFSMAN->m_iDisplayWidth;
if( PREFSMAN->m_bWindowed )
{
@@ -159,14 +157,12 @@ static void StoreActualGraphicOptions()
{
/* Store the settings that RageDisplay was actually able to use so that
* we don't go through the process of auto-detecting a usable video mode
* every time.
*/
* every time. */
const VideoModeParams &params = DISPLAY->GetActualVideoModeParams();
PREFSMAN->m_bWindowed .Set( params.windowed );
PREFSMAN->m_bWindowed.Set( params.windowed );
/* If we're windowed, we may have tweaked the width based on the aspect ratio.
* Don't save this new value over the preferred value.
*/
* Don't save this new value over the preferred value. */
if( !PREFSMAN->m_bWindowed )
{
PREFSMAN->m_iDisplayWidth .Set( params.width );