Fix unintended song loop due to api change
This commit is contained in:
1 parent
292a9f3c69
commit
e908f923e8
6 files changed
+10
-15
No files matched your search
@@ -503,7 +503,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
CBase.BackgroundMusic.SetStatus(true);
|
||||
|
||||
_PreviewStream = CBase.Sound.Load(song.GetMP3(), false);
|
||||
_PreviewStream = CBase.Sound.Load(song.GetMP3());
|
||||
CBase.Sound.SetPosition(_PreviewStream, song.Preview.StartTime);
|
||||
CBase.Sound.SetStreamVolume(_PreviewStream, 0f);
|
||||
CBase.Sound.Play(_PreviewStream);
|
||||
@@ -527,7 +527,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
CSong song = CBase.Songs.GetSongByID(songID);
|
||||
CBase.BackgroundMusic.SetStatus(true);
|
||||
|
||||
_PreviewStream = CBase.Sound.Load(song.GetMP3(), false);
|
||||
_PreviewStream = CBase.Sound.Load(song.GetMP3());
|
||||
CBase.Sound.SetPosition(_PreviewStream, song.Preview.StartTime);
|
||||
CBase.Sound.SetStreamVolume(_PreviewStream, 0f);
|
||||
CBase.Sound.Play(_PreviewStream);
|
||||
|
||||
@@ -773,9 +773,9 @@ namespace Vocaluxe.Base
|
||||
|
||||
class CBsound : ISound
|
||||
{
|
||||
public int Load(string soundFile, bool prescan)
|
||||
public int Load(string soundFile, bool loop = false, bool prescan = false)
|
||||
{
|
||||
return CSound.Load(soundFile, prescan);
|
||||
return CSound.Load(soundFile, loop, prescan);
|
||||
}
|
||||
|
||||
public void SetPosition(int soundStream, float newPosition)
|
||||
|
||||
@@ -85,14 +85,9 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
|
||||
#region Stream Handling
|
||||
public static int Load(string media)
|
||||
public static int Load(string media, bool loop=false, bool prescan=false)
|
||||
{
|
||||
return _Playback.Load(media);
|
||||
}
|
||||
|
||||
public static int Load(string media, bool prescan)
|
||||
{
|
||||
return _Playback.Load(media, prescan);
|
||||
return _Playback.Load(media, loop, prescan);
|
||||
}
|
||||
|
||||
public static void Close(int stream)
|
||||
@@ -194,7 +189,7 @@ namespace Vocaluxe.Base
|
||||
if (!File.Exists(file))
|
||||
return -1;
|
||||
|
||||
int stream = Load(file, fade);
|
||||
int stream = Load(file, false, fade);
|
||||
if (stream < 0)
|
||||
return -1;
|
||||
Play(stream);
|
||||
|
||||
@@ -597,7 +597,7 @@ namespace Vocaluxe.Screens
|
||||
songname += " (" + CGame.RoundNr + "/" + rounds + ")";
|
||||
_Texts[_TextSongName].Text = songname;
|
||||
|
||||
_CurrentStream = CSound.Load(song.GetMP3(), true);
|
||||
_CurrentStream = CSound.Load(song.GetMP3(), false, true);
|
||||
CSound.SetStreamVolume(_CurrentStream, _Volume);
|
||||
CSound.SetPosition(_CurrentStream, song.Start);
|
||||
_CurrentTime = song.Start;
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace VocaluxeLib
|
||||
|
||||
public interface ISound
|
||||
{
|
||||
int Load(string soundFile, bool prescan);
|
||||
int Load(string soundFile, bool loop = false, bool prescan = false);
|
||||
void SetPosition(int soundStream, float newPosition);
|
||||
void Play(int soundStream);
|
||||
void Fade(int soundStream, float targetVolume, float duration);
|
||||
|
||||
@@ -523,7 +523,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (song == null)
|
||||
return;
|
||||
|
||||
int stream = CBase.Sound.Load(Path.Combine(song.Folder, song.MP3FileName), true);
|
||||
int stream = CBase.Sound.Load(Path.Combine(song.Folder, song.MP3FileName), true, true);
|
||||
|
||||
float startposition = song.Preview.StartTime;
|
||||
float length = CBase.Sound.GetLength(stream);
|
||||
|
||||
Reference in new issue
Block a user