sound options cleanup
fix invalid sample music start and length values (Bag and more)
This commit is contained in:
@@ -16,12 +16,11 @@ ColorP2=1.0,0.5,0.2,1 // orange
|
|||||||
InitialScreen=ScreenCompany
|
InitialScreen=ScreenCompany
|
||||||
|
|
||||||
[Notes]
|
[Notes]
|
||||||
|
|
||||||
DefaultScrollDirection=0
|
DefaultScrollDirection=0
|
||||||
|
|
||||||
[ScreenTitleMenu]
|
[ScreenTitleMenu]
|
||||||
ChoicesX=320
|
ChoicesX=320
|
||||||
ChoicesStartY=104
|
ChoicesStartY=92
|
||||||
ChoicesSpacingY=48
|
ChoicesSpacingY=48
|
||||||
ChoicesShadowLength=5
|
ChoicesShadowLength=5
|
||||||
HelpX=320
|
HelpX=320
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ enum {
|
|||||||
NUM_SOUND_OPTIONS_LINES
|
NUM_SOUND_OPTIONS_LINES
|
||||||
};
|
};
|
||||||
OptionRowData g_SoundOptionsLines[NUM_SOUND_OPTIONS_LINES] = {
|
OptionRowData g_SoundOptionsLines[NUM_SOUND_OPTIONS_LINES] = {
|
||||||
{ "Master\nVolume", 10, {"0","1","2","3","4","5","6","7","8","9"} },
|
{ "Master\nVolume", 6, {"MUTE","20%","40%","60%","80%","100%"} },
|
||||||
};
|
};
|
||||||
|
|
||||||
ScreenSoundOptions::ScreenSoundOptions() :
|
ScreenSoundOptions::ScreenSoundOptions() :
|
||||||
@@ -62,24 +62,15 @@ void ScreenSoundOptions::Input( const DeviceInput& DeviceI, const InputEventType
|
|||||||
|
|
||||||
void ScreenSoundOptions::ImportOptions()
|
void ScreenSoundOptions::ImportOptions()
|
||||||
{
|
{
|
||||||
m_iSelectedOption[0][SO_MASTER_VOLUME] = PREFSMAN->m_fSoundVolume;
|
float fVolPercent = PREFSMAN->m_fSoundVolume;
|
||||||
|
m_iSelectedOption[0][SO_MASTER_VOLUME] = (int)(fVolPercent*5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSoundOptions::ExportOptions()
|
void ScreenSoundOptions::ExportOptions()
|
||||||
{
|
{
|
||||||
switch( m_iSelectedOption[0][SO_MASTER_VOLUME] )
|
float fVolPercent = m_iSelectedOption[0][SO_MASTER_VOLUME] / 5.f;
|
||||||
{
|
SOUNDMAN->SetPrefs(fVolPercent);
|
||||||
case 0:SOUNDMAN->SetPrefs(0.10000f);PREFSMAN->m_fSoundVolume = 0.10000f;break;
|
PREFSMAN->m_fSoundVolume = fVolPercent;
|
||||||
case 1:SOUNDMAN->SetPrefs(0.20000f);PREFSMAN->m_fSoundVolume = 0.20000f;break;
|
|
||||||
case 2:SOUNDMAN->SetPrefs(0.30000f);PREFSMAN->m_fSoundVolume = 0.30000f;break;
|
|
||||||
case 3:SOUNDMAN->SetPrefs(0.40000f);PREFSMAN->m_fSoundVolume = 0.40000f;break;
|
|
||||||
case 4:SOUNDMAN->SetPrefs(0.50000f);PREFSMAN->m_fSoundVolume = 0.50000f;break;
|
|
||||||
case 5:SOUNDMAN->SetPrefs(0.60000f);PREFSMAN->m_fSoundVolume = 0.60000f;break;
|
|
||||||
case 6:SOUNDMAN->SetPrefs(0.70000f);PREFSMAN->m_fSoundVolume = 0.70000f;break;
|
|
||||||
case 7:SOUNDMAN->SetPrefs(0.80000f);PREFSMAN->m_fSoundVolume = 0.80000f;break;
|
|
||||||
case 8:SOUNDMAN->SetPrefs(0.90000f);PREFSMAN->m_fSoundVolume = 0.90000f;break;
|
|
||||||
case 9:SOUNDMAN->SetPrefs(1.00000f);PREFSMAN->m_fSoundVolume = 1.00000f;break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSoundOptions::GoToPrevState()
|
void ScreenSoundOptions::GoToPrevState()
|
||||||
|
|||||||
+15
-5
@@ -41,7 +41,9 @@
|
|||||||
#include "SDL_image.h"
|
#include "SDL_image.h"
|
||||||
|
|
||||||
|
|
||||||
const int FILE_CACHE_VERSION = 109; // increment this when Song or Notes changes to invalidate cache
|
const int FILE_CACHE_VERSION = 111; // increment this when Song or Notes changes to invalidate cache
|
||||||
|
|
||||||
|
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
|
||||||
|
|
||||||
|
|
||||||
static int CompareBPMSegments(const BPMSegment &seg1, const BPMSegment &seg2)
|
static int CompareBPMSegments(const BPMSegment &seg1, const BPMSegment &seg2)
|
||||||
@@ -83,7 +85,7 @@ Song::Song()
|
|||||||
m_bChangedSinceSave = false;
|
m_bChangedSinceSave = false;
|
||||||
m_fBeat0OffsetInSeconds = 0;
|
m_fBeat0OffsetInSeconds = 0;
|
||||||
m_fMusicSampleStartSeconds = 0;
|
m_fMusicSampleStartSeconds = 0;
|
||||||
m_fMusicSampleLengthSeconds = 12.0f; // start fading out at m_fMusicSampleLengthSeconds-1 seconds
|
m_fMusicSampleLengthSeconds = DEFAULT_MUSIC_SAMPLE_LENGTH;
|
||||||
m_iMusicBytes = 0;
|
m_iMusicBytes = 0;
|
||||||
m_fMusicLengthSeconds = 0;
|
m_fMusicLengthSeconds = 0;
|
||||||
m_fFirstBeat = -1;
|
m_fFirstBeat = -1;
|
||||||
@@ -447,13 +449,21 @@ void Song::TidyUpData()
|
|||||||
// We're going to try and do something intelligent here...
|
// We're going to try and do something intelligent here...
|
||||||
// The MusicSampleStart always seems to be about 100-120 beats into
|
// The MusicSampleStart always seems to be about 100-120 beats into
|
||||||
// the song regardless of BPM. Let's take a shot-in-the dark guess.
|
// the song regardless of BPM. Let's take a shot-in-the dark guess.
|
||||||
if( m_fMusicSampleStartSeconds == 0 )
|
if( m_fMusicSampleStartSeconds == 0 || m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds )
|
||||||
|
{
|
||||||
m_fMusicSampleStartSeconds = this->GetElapsedTimeFromBeat( 100 );
|
m_fMusicSampleStartSeconds = this->GetElapsedTimeFromBeat( 100 );
|
||||||
|
if( m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds )
|
||||||
|
{
|
||||||
|
int iBeat = (int)(m_fLastBeat/2);
|
||||||
|
iBeat = iBeat - iBeat%10;
|
||||||
|
m_fMusicSampleStartSeconds = this->GetElapsedTimeFromBeat( (float)iBeat ); // fix for BAG and other slow songs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Some DWIs have lengths in ms when they meant seconds, eg. #SAMPLELENGTH:10;.
|
/* Some DWIs have lengths in ms when they meant seconds, eg. #SAMPLELENGTH:10;.
|
||||||
* If the sample length is way too short, change it. */
|
* If the sample length is way too short, change it. */
|
||||||
if( m_fMusicSampleLengthSeconds < 3 )
|
if( m_fMusicSampleLengthSeconds < 3 || m_fMusicSampleLengthSeconds > 30 )
|
||||||
m_fMusicSampleLengthSeconds = 10;
|
m_fMusicSampleLengthSeconds = DEFAULT_MUSIC_SAMPLE_LENGTH;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Here's the problem: We have a directory full of images. We want to determine which
|
// Here's the problem: We have a directory full of images. We want to determine which
|
||||||
|
|||||||
@@ -429,6 +429,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
|||||||
<File
|
<File
|
||||||
RelativePath="ScreenSongOptions.h">
|
RelativePath="ScreenSongOptions.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ScreenSoundOptions.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ScreenSoundOptions.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenStage.cpp">
|
RelativePath="ScreenStage.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@@ -127,6 +127,8 @@ void DSoundBuf::SetVolume(float vol)
|
|||||||
ASSERT(vol >= 0);
|
ASSERT(vol >= 0);
|
||||||
ASSERT(vol <= 1);
|
ASSERT(vol <= 1);
|
||||||
|
|
||||||
|
if( vol == 0 )
|
||||||
|
vol = 0.001f; // fix log10f(0) == -INF
|
||||||
float vl2 = log10f(vol) / log10f(2); /* vol log 2 */
|
float vl2 = log10f(vol) / log10f(2); /* vol log 2 */
|
||||||
|
|
||||||
/* Volume is a multiplier; SetVolume wants attenuation in thousands of a
|
/* Volume is a multiplier; SetVolume wants attenuation in thousands of a
|
||||||
|
|||||||
Reference in New Issue
Block a user