Merge remote-tracking branch 'remotes/upstream/develop' into develop

This commit is contained in:
Florian Kuepper committed 2012-12-07 19:57:03 +01:00
commit 2b943305a1
22 files changed
+102 -8

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4 -2
View File
@@ -181,7 +181,7 @@ namespace Vocaluxe.Base
{ {
if (_CurrentMusicStream != -1) if (_CurrentMusicStream != -1)
{ {
CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CSettings.BackgroundMusicFadeTime); CSound.Fade(_CurrentMusicStream, 100f, CSettings.BackgroundMusicFadeTime);
CSound.Play(_CurrentMusicStream); CSound.Play(_CurrentMusicStream);
if (_VideoEnabled && _Video != -1) if (_VideoEnabled && _Video != -1)
CVideo.VdResume(_Video); CVideo.VdResume(_Video);
@@ -276,6 +276,7 @@ namespace Vocaluxe.Base
_CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex]; _CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
} }
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath); _CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath);
CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
//Seek to #Start-Tag, if found //Seek to #Start-Tag, if found
if (_CurrentPlaylistElement.Start != 0f) if (_CurrentPlaylistElement.Start != 0f)
@@ -311,6 +312,7 @@ namespace Vocaluxe.Base
_CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex]; _CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath); _CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath);
CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
if (_VideoEnabled) if (_VideoEnabled)
LoadVideo(); LoadVideo();
CSound.SetStreamVolume(_CurrentMusicStream, 0f); CSound.SetStreamVolume(_CurrentMusicStream, 0f);
@@ -327,7 +329,7 @@ namespace Vocaluxe.Base
public static void ApplyVolume() public static void ApplyVolume()
{ {
CSound.SetStreamVolume(_CurrentMusicStream, CConfig.BackgroundMusicVolume); CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
} }
public static void AddOwnMusic() public static void AddOwnMusic()
+1 -1
View File
@@ -47,7 +47,7 @@ namespace Vocaluxe.Base
public const int iVersionSub = 0; // patches public const int iVersionSub = 0; // patches
public const ERevision VersionRevision = ERevision.Alpha; public const ERevision VersionRevision = ERevision.Alpha;
public const int iBuild = 68; // Increase on every published version! Never Reset! public const int iBuild = 69; // Increase on every published version! Never Reset!
public const int iDatabaseHighscoreVersion = 1; public const int iDatabaseHighscoreVersion = 1;
public const int iDatabaseCoverVersion = 1; public const int iDatabaseCoverVersion = 1;
+4
View File
@@ -108,6 +108,10 @@ namespace Vocaluxe.Base
_Playback.SetStreamVolume(Stream, Volume); _Playback.SetStreamVolume(Stream, Volume);
} }
public static void SetStreamVolumeMax(int Stream, float Volume)
{
_Playback.SetStreamVolumeMax(Stream, Volume);
}
public static float GetLength(int Stream) public static float GetLength(int Stream)
{ {
+35 -2
View File
@@ -234,6 +234,21 @@ namespace Vocaluxe.Lib.Sound
} }
} }
public void SetStreamVolumeMax(int Stream, float Volume)
{
if (_Initialized)
{
lock (MutexDecoder)
{
if (AlreadyAdded(Stream))
{
_Decoder[GetStreamIndex(Stream)].VolumeMax = Volume;
}
}
}
}
public float GetLength(int Stream) public float GetLength(int Stream)
{ {
if (_Initialized) if (_Initialized)
@@ -399,6 +414,7 @@ namespace Vocaluxe.Lib.Sound
private bool _Initialized; private bool _Initialized;
private int _ByteCount = 4; private int _ByteCount = 4;
private float _Volume = 1f; private float _Volume = 1f;
private float _VolumeMax = 1f;
private Stopwatch _fadeTimer = new Stopwatch(); private Stopwatch _fadeTimer = new Stopwatch();
@@ -500,6 +516,23 @@ namespace Vocaluxe.Lib.Sound
} }
} }
public float VolumeMax
{
get { return _VolumeMax * 100f; }
set
{
lock (MutexData)
{
_VolumeMax = value / 100f;
if (_VolumeMax < 0f)
_VolumeMax = 0f;
if (_VolumeMax > 1f)
_VolumeMax = 1f;
}
}
}
public float Position public float Position
{ {
get get
@@ -826,7 +859,7 @@ namespace Vocaluxe.Lib.Sound
b[0] = buf[i]; b[0] = buf[i];
b[1] = buf[i + 1]; b[1] = buf[i + 1];
b = BitConverter.GetBytes((Int16)(BitConverter.ToInt16(b, 0) * _Volume)); b = BitConverter.GetBytes((Int16)(BitConverter.ToInt16(b, 0) * _Volume * _VolumeMax));
buf[i] = b[0]; buf[i] = b[0];
buf[i + 1] = b[1]; buf[i + 1] = b[1];
@@ -835,7 +868,7 @@ namespace Vocaluxe.Lib.Sound
b[0] = buf[i + 2]; b[0] = buf[i + 2];
b[1] = buf[i + 3]; b[1] = buf[i + 3];
b = BitConverter.GetBytes((Int16)(BitConverter.ToInt16(b, 0) * _Volume)); b = BitConverter.GetBytes((Int16)(BitConverter.ToInt16(b, 0) * _Volume * _VolumeMax));
buf[i + 2] = b[0]; buf[i + 2] = b[0];
buf[i + 3] = b[1]; buf[i + 3] = b[1];
} }
+35 -2
View File
@@ -218,6 +218,21 @@ namespace Vocaluxe.Lib.Sound
} }
} }
public void SetStreamVolumeMax(int Stream, float Volume)
{
if (_Initialized)
{
lock (MutexDecoder)
{
if (AlreadyAdded(Stream))
{
_Decoder[GetStreamIndex(Stream)].VolumeMax = Volume;
}
}
}
}
public float GetLength(int Stream) public float GetLength(int Stream)
{ {
if (_Initialized) if (_Initialized)
@@ -375,6 +390,7 @@ namespace Vocaluxe.Lib.Sound
private bool _Initialized; private bool _Initialized;
private int _ByteCount = 4; private int _ByteCount = 4;
private float _Volume = 1f; private float _Volume = 1f;
private float _VolumeMax = 1f;
private Stopwatch _fadeTimer = new Stopwatch(); private Stopwatch _fadeTimer = new Stopwatch();
@@ -480,6 +496,23 @@ namespace Vocaluxe.Lib.Sound
} }
} }
public float VolumeMax
{
get { return _VolumeMax * 100f; }
set
{
lock (_LockData)
{
_VolumeMax = value / 100f;
if (_VolumeMax < 0f)
_VolumeMax = 0f;
if (_VolumeMax > 1f)
_VolumeMax = 1f;
}
}
}
public float Position public float Position
{ {
get get
@@ -817,7 +850,7 @@ namespace Vocaluxe.Lib.Sound
b[0] = buf[i]; b[0] = buf[i];
b[1] = buf[i + 1]; b[1] = buf[i + 1];
b = BitConverter.GetBytes((Int16)(BitConverter.ToInt16(b, 0) * _Volume)); b = BitConverter.GetBytes((Int16)(BitConverter.ToInt16(b, 0) * _Volume * _VolumeMax));
buf[i] = b[0]; buf[i] = b[0];
buf[i + 1] = b[1]; buf[i + 1] = b[1];
@@ -826,7 +859,7 @@ namespace Vocaluxe.Lib.Sound
b[0] = buf[i + 2]; b[0] = buf[i + 2];
b[1] = buf[i + 3]; b[1] = buf[i + 3];
b = BitConverter.GetBytes((Int16)(BitConverter.ToInt16(b, 0) * _Volume)); b = BitConverter.GetBytes((Int16)(BitConverter.ToInt16(b, 0) * _Volume * _VolumeMax));
buf[i + 2] = b[0]; buf[i + 2] = b[0];
buf[i + 3] = b[1]; buf[i + 3] = b[1];
} }
+2 -1
View File
@@ -37,7 +37,8 @@ namespace Vocaluxe.Lib.Sound
void Fade(int Stream, float TargetVolume, float Seconds); void Fade(int Stream, float TargetVolume, float Seconds);
void FadeAndPause(int Stream, float TargetVolume, float Seconds); void FadeAndPause(int Stream, float TargetVolume, float Seconds);
void FadeAndStop(int Stream, float TargetVolume, float Seconds); void FadeAndStop(int Stream, float TargetVolume, float Seconds);
void SetStreamVolume(int Stream, float Volume); void SetStreamVolume(int Stream, float Volume);
void SetStreamVolumeMax(int Stream, float Volume);
float GetLength(int Stream); float GetLength(int Stream);
float GetPosition(int Stream); float GetPosition(int Stream);
+5
View File
@@ -73,6 +73,11 @@ namespace Vocaluxe.Menu.SongMenu
_SongMenu.Draw(); _SongMenu.Draw();
} }
public void ApplyVolume(float VolumeMax)
{
_SongMenu.ApplyVolume(VolumeMax);
}
public bool IsActive() public bool IsActive()
{ {
return _SongMenu.IsActive(); return _SongMenu.IsActive();
@@ -117,6 +117,8 @@ namespace Vocaluxe.Menu.SongMenu
private int _LockedInternal = -1; private int _LockedInternal = -1;
protected bool _Active = false; protected bool _Active = false;
protected float _MaxVolume = 100f;
protected int _PreviewSelected //for preview only protected int _PreviewSelected //for preview only
{ {
get get
@@ -510,6 +512,16 @@ namespace Vocaluxe.Menu.SongMenu
} }
public virtual void ApplyVolume(float VolumeMax)
{
_MaxVolume = VolumeMax;
foreach (int stream in _streams)
{
CSound.SetStreamVolumeMax(stream, _MaxVolume);
}
}
public virtual bool IsActive() public virtual bool IsActive()
{ {
return _Active; return _Active;
@@ -624,6 +636,7 @@ namespace Vocaluxe.Menu.SongMenu
int _stream = CSound.Load(Path.Combine(CSongs.VisibleSongs[_actsong].Folder, CSongs.VisibleSongs[_actsong].MP3FileName), true); int _stream = CSound.Load(Path.Combine(CSongs.VisibleSongs[_actsong].Folder, CSongs.VisibleSongs[_actsong].MP3FileName), true);
CSound.SetStreamVolumeMax(_stream, _MaxVolume);
CSound.SetStreamVolume(_stream, 0f); CSound.SetStreamVolume(_stream, 0f);
float startposition = CSongs.VisibleSongs[_actsong].PreviewStart; float startposition = CSongs.VisibleSongs[_actsong].PreviewStart;
+2
View File
@@ -17,6 +17,8 @@ namespace Vocaluxe.Menu.SongMenu
void HandleMouse(ref MouseEvent MouseEvent); void HandleMouse(ref MouseEvent MouseEvent);
void Draw(); void Draw();
void ApplyVolume(float VolumeMax);
int GetSelectedSong(); int GetSelectedSong();
CStatic GetSelectedSongCover(); CStatic GetSelectedSongCover();
void SetSelectedSong(int VisibleSongNr); void SetSelectedSong(int VisibleSongNr);
+1
View File
@@ -569,6 +569,7 @@ namespace Vocaluxe.Screens
Texts[htTexts(TextSongName)].Text = songname; Texts[htTexts(TextSongName)].Text = songname;
_CurrentStream = CSound.Load(song.GetMP3(), true); _CurrentStream = CSound.Load(song.GetMP3(), true);
CSound.SetStreamVolumeMax(_CurrentStream, 100f); //TODO: Add volume control var
CSound.SetStreamVolume(_CurrentStream, _Volume); CSound.SetStreamVolume(_CurrentStream, _Volume);
CSound.SetPosition(_CurrentStream, song.Start); CSound.SetPosition(_CurrentStream, song.Start);
_CurrentTime = song.Start; _CurrentTime = song.Start;