Fix PlaySound (Length not gotten if prescan off)
Add fade option to PlaySound
This commit is contained in:
1 parent
45e480785d
commit
88364ce64b
1 file changed
+7
-4
@@ -181,7 +181,7 @@ namespace Vocaluxe.Base
|
||||
#endregion Playback
|
||||
|
||||
#region Sounds
|
||||
public static int PlaySound(ESounds sound)
|
||||
public static int PlaySound(ESounds sound, bool fade = true)
|
||||
{
|
||||
string file = Path.Combine(Environment.CurrentDirectory, CSettings.FolderSounds);
|
||||
switch (sound)
|
||||
@@ -189,15 +189,18 @@ namespace Vocaluxe.Base
|
||||
case ESounds.T440:
|
||||
file = Path.Combine(file, CSettings.SoundT440);
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (file == "")
|
||||
if (!File.Exists(file))
|
||||
return -1;
|
||||
|
||||
int stream = Load(file);
|
||||
int stream = Load(file, true);
|
||||
float length = GetLength(stream);
|
||||
Play(stream);
|
||||
FadeAndClose(stream, 100f, length);
|
||||
if (fade)
|
||||
FadeAndClose(stream, 100f, length);
|
||||
return stream;
|
||||
}
|
||||
#endregion Sounds
|
||||
|
||||
Reference in new issue
Block a user