Merge remote-tracking branch 'remotes/upstream/develop' into develop
This commit is contained in:
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.
@@ -181,7 +181,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
if (_CurrentMusicStream != -1)
|
||||
{
|
||||
CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CSettings.BackgroundMusicFadeTime);
|
||||
CSound.Fade(_CurrentMusicStream, 100f, CSettings.BackgroundMusicFadeTime);
|
||||
CSound.Play(_CurrentMusicStream);
|
||||
if (_VideoEnabled && _Video != -1)
|
||||
CVideo.VdResume(_Video);
|
||||
@@ -276,6 +276,7 @@ namespace Vocaluxe.Base
|
||||
_CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
|
||||
}
|
||||
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath);
|
||||
CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
|
||||
|
||||
//Seek to #Start-Tag, if found
|
||||
if (_CurrentPlaylistElement.Start != 0f)
|
||||
@@ -311,6 +312,7 @@ namespace Vocaluxe.Base
|
||||
_CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
|
||||
|
||||
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath);
|
||||
CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
|
||||
if (_VideoEnabled)
|
||||
LoadVideo();
|
||||
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
|
||||
@@ -327,7 +329,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void ApplyVolume()
|
||||
{
|
||||
CSound.SetStreamVolume(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
|
||||
CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
|
||||
}
|
||||
|
||||
public static void AddOwnMusic()
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Vocaluxe.Base
|
||||
public const int iVersionSub = 0; // patches
|
||||
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 iDatabaseCoverVersion = 1;
|
||||
|
||||
@@ -108,6 +108,10 @@ namespace Vocaluxe.Base
|
||||
_Playback.SetStreamVolume(Stream, Volume);
|
||||
}
|
||||
|
||||
public static void SetStreamVolumeMax(int Stream, float Volume)
|
||||
{
|
||||
_Playback.SetStreamVolumeMax(Stream, Volume);
|
||||
}
|
||||
|
||||
public static float GetLength(int Stream)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
if (_Initialized)
|
||||
@@ -399,6 +414,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
private bool _Initialized;
|
||||
private int _ByteCount = 4;
|
||||
private float _Volume = 1f;
|
||||
private float _VolumeMax = 1f;
|
||||
|
||||
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
|
||||
{
|
||||
get
|
||||
@@ -826,7 +859,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
b[0] = buf[i];
|
||||
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 + 1] = b[1];
|
||||
|
||||
@@ -835,7 +868,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
b[0] = buf[i + 2];
|
||||
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 + 3] = b[1];
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
if (_Initialized)
|
||||
@@ -375,6 +390,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
private bool _Initialized;
|
||||
private int _ByteCount = 4;
|
||||
private float _Volume = 1f;
|
||||
private float _VolumeMax = 1f;
|
||||
|
||||
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
|
||||
{
|
||||
get
|
||||
@@ -817,7 +850,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
b[0] = buf[i];
|
||||
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 + 1] = b[1];
|
||||
|
||||
@@ -826,7 +859,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
b[0] = buf[i + 2];
|
||||
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 + 3] = b[1];
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ namespace Vocaluxe.Lib.Sound
|
||||
void Fade(int Stream, float TargetVolume, float Seconds);
|
||||
void FadeAndPause(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 GetPosition(int Stream);
|
||||
|
||||
@@ -73,6 +73,11 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
_SongMenu.Draw();
|
||||
}
|
||||
|
||||
public void ApplyVolume(float VolumeMax)
|
||||
{
|
||||
_SongMenu.ApplyVolume(VolumeMax);
|
||||
}
|
||||
|
||||
public bool IsActive()
|
||||
{
|
||||
return _SongMenu.IsActive();
|
||||
|
||||
@@ -117,6 +117,8 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
private int _LockedInternal = -1;
|
||||
protected bool _Active = false;
|
||||
|
||||
protected float _MaxVolume = 100f;
|
||||
|
||||
protected int _PreviewSelected //for preview only
|
||||
{
|
||||
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()
|
||||
{
|
||||
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);
|
||||
CSound.SetStreamVolumeMax(_stream, _MaxVolume);
|
||||
CSound.SetStreamVolume(_stream, 0f);
|
||||
|
||||
float startposition = CSongs.VisibleSongs[_actsong].PreviewStart;
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
void HandleMouse(ref MouseEvent MouseEvent);
|
||||
void Draw();
|
||||
|
||||
void ApplyVolume(float VolumeMax);
|
||||
|
||||
int GetSelectedSong();
|
||||
CStatic GetSelectedSongCover();
|
||||
void SetSelectedSong(int VisibleSongNr);
|
||||
|
||||
@@ -569,6 +569,7 @@ namespace Vocaluxe.Screens
|
||||
Texts[htTexts(TextSongName)].Text = songname;
|
||||
|
||||
_CurrentStream = CSound.Load(song.GetMP3(), true);
|
||||
CSound.SetStreamVolumeMax(_CurrentStream, 100f); //TODO: Add volume control var
|
||||
CSound.SetStreamVolume(_CurrentStream, _Volume);
|
||||
CSound.SetPosition(_CurrentStream, song.Start);
|
||||
_CurrentTime = song.Start;
|
||||
|
||||
Reference in new issue
Block a user