Fix: karaoke effect was applied to all audio output
This commit is contained in:
1 parent
49b971d126
commit
3275aa091e
12 files changed
+23
-18
No files matched your search
@@ -22,6 +22,7 @@ using Vocaluxe.Lib.Sound.Playback.OpenAL;
|
|||||||
using Vocaluxe.Lib.Sound.Playback.PortAudio;
|
using Vocaluxe.Lib.Sound.Playback.PortAudio;
|
||||||
using VocaluxeLib;
|
using VocaluxeLib;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Vocaluxe.Lib.Sound;
|
||||||
|
|
||||||
namespace Vocaluxe.Base
|
namespace Vocaluxe.Base
|
||||||
{
|
{
|
||||||
@@ -88,9 +89,9 @@ namespace Vocaluxe.Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Stream Handling
|
#region Stream Handling
|
||||||
public static int Load(string media, bool loop = false, bool prescan = false)
|
public static int Load(string media, bool loop = false, bool prescan = false, EAudioEffect effekt = EAudioEffect.None)
|
||||||
{
|
{
|
||||||
return _Playback.Load(media, loop, prescan);
|
return _Playback.Load(media, loop, prescan, effekt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Close(int stream)
|
public static void Close(int stream)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace Vocaluxe.Lib.Sound.Playback
|
|||||||
private readonly int _ID;
|
private readonly int _ID;
|
||||||
protected readonly string _Medium;
|
protected readonly string _Medium;
|
||||||
protected readonly bool _Loop;
|
protected readonly bool _Loop;
|
||||||
|
protected readonly EAudioEffect _Effect;
|
||||||
|
|
||||||
protected ICloseStreamListener _CloseStreamListener;
|
protected ICloseStreamListener _CloseStreamListener;
|
||||||
|
|
||||||
@@ -48,11 +49,12 @@ namespace Vocaluxe.Lib.Sound.Playback
|
|||||||
public abstract bool IsPaused { get; set; }
|
public abstract bool IsPaused { get; set; }
|
||||||
public abstract bool IsFinished { get; }
|
public abstract bool IsFinished { get; }
|
||||||
|
|
||||||
protected CAudioStreamBase(int id, string medium, bool loop)
|
protected CAudioStreamBase(int id, string medium, bool loop, EAudioEffect effect = EAudioEffect.None)
|
||||||
{
|
{
|
||||||
_ID = id;
|
_ID = id;
|
||||||
_Medium = medium;
|
_Medium = medium;
|
||||||
_Loop = loop;
|
_Loop = loop;
|
||||||
|
_Effect = effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
~CAudioStreamBase()
|
~CAudioStreamBase()
|
||||||
|
|||||||
@@ -113,13 +113,13 @@ namespace Vocaluxe.Lib.Sound.Playback
|
|||||||
|
|
||||||
#region Stream Handling
|
#region Stream Handling
|
||||||
//Factory method to get a stream instance
|
//Factory method to get a stream instance
|
||||||
protected abstract IAudioStream _CreateStream(int id, string media, bool loop);
|
protected abstract IAudioStream _CreateStream(int id, string media, bool loop, EAudioEffect effect = EAudioEffect.None);
|
||||||
|
|
||||||
public int Load(string medium, bool loop = false, bool prescan = false)
|
public int Load(string medium, bool loop = false, bool prescan = false, EAudioEffect effect = EAudioEffect.None)
|
||||||
{
|
{
|
||||||
if (!_Initialized)
|
if (!_Initialized)
|
||||||
return -1;
|
return -1;
|
||||||
IAudioStream stream = _CreateStream(_NextID++, medium, loop);
|
IAudioStream stream = _CreateStream(_NextID++, medium, loop, effect);
|
||||||
|
|
||||||
if (stream.Open(prescan))
|
if (stream.Open(prescan))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
|
|||||||
Application.Deinit();
|
Application.Deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IAudioStream _CreateStream(int id, string media, bool loop)
|
protected override IAudioStream _CreateStream(int id, string media, bool loop, EAudioEffect effect = EAudioEffect.None)
|
||||||
{
|
{
|
||||||
return new CGstreamerSharpAudioStream(id, media, loop);
|
return new CGstreamerSharpAudioStream(id, media, loop, effect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CGstreamerSharpAudioStream(int id, string medium, bool loop) : base(id, medium, loop) {}
|
public CGstreamerSharpAudioStream(int id, string medium, bool loop, EAudioEffect effect = EAudioEffect.None) : base(id, medium, loop, effect) {}
|
||||||
|
|
||||||
public override bool Open(bool prescan)
|
public override bool Open(bool prescan)
|
||||||
{
|
{
|
||||||
@@ -125,7 +125,7 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
|
|||||||
|
|
||||||
var audioSinkBin = new Bin("Audiosink");
|
var audioSinkBin = new Bin("Audiosink");
|
||||||
Element audiokaraoke = null;
|
Element audiokaraoke = null;
|
||||||
if (CConfig.Config.Sound.KaraokeEffect == EOffOn.TR_CONFIG_ON)
|
if (_Effect.HasFlag(EAudioEffect.Karaoke))
|
||||||
{
|
{
|
||||||
audiokaraoke = ElementFactory.Make("audiokaraoke", "karaoke");
|
audiokaraoke = ElementFactory.Make("audiokaraoke", "karaoke");
|
||||||
audioSinkBin.Add(audiokaraoke);
|
audioSinkBin.Add(audiokaraoke);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace Vocaluxe.Lib.Sound.Playback
|
|||||||
void CloseAll();
|
void CloseAll();
|
||||||
|
|
||||||
#region stream Handling
|
#region stream Handling
|
||||||
int Load(string medium, bool loop = false, bool prescan = false);
|
int Load(string medium, bool loop = false, bool prescan = false, EAudioEffect effekt= EAudioEffect.None);
|
||||||
void Close(int streamID);
|
void Close(int streamID);
|
||||||
|
|
||||||
void Play(int streamID);
|
void Play(int streamID);
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
|
|||||||
_Context = null;
|
_Context = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IAudioStream _CreateStream(int id, string media, bool loop)
|
protected override IAudioStream _CreateStream(int id, string media, bool loop, EAudioEffect effect = EAudioEffect.None)
|
||||||
{
|
{
|
||||||
return new COpenAlStream(id, media, loop);
|
return new COpenAlStream(id, media, loop, effect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public COpenAlStream(int id, string medium, bool loop) : base(id, medium, loop) {}
|
public COpenAlStream(int id, string medium, bool loop, EAudioEffect effect = EAudioEffect.None) : base(id, medium, loop, effect) {}
|
||||||
|
|
||||||
protected override void _Dispose(bool disposing)
|
protected override void _Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IAudioStream _CreateStream(int id, string media, bool loop)
|
protected override IAudioStream _CreateStream(int id, string media, bool loop, EAudioEffect effect = EAudioEffect.None)
|
||||||
{
|
{
|
||||||
return new CPortAudioStream(id, media, loop);
|
return new CPortAudioStream(id, media, loop, effect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPortAudioStream(int id, string medium, bool loop) : base(id, medium, loop) {}
|
public CPortAudioStream(int id, string medium, bool loop, EAudioEffect effect = EAudioEffect.None) : base(id, medium, loop, effect) {}
|
||||||
|
|
||||||
public override bool Open(bool prescan)
|
public override bool Open(bool prescan)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ using System.Linq;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Vocaluxe.Base;
|
using Vocaluxe.Base;
|
||||||
using Vocaluxe.Base.Fonts;
|
using Vocaluxe.Base.Fonts;
|
||||||
|
using Vocaluxe.Lib.Sound;
|
||||||
using VocaluxeLib;
|
using VocaluxeLib;
|
||||||
using VocaluxeLib.Draw;
|
using VocaluxeLib.Draw;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
@@ -525,7 +526,7 @@ namespace Vocaluxe.Screens
|
|||||||
songname += " (" + CGame.RoundNr + "/" + rounds + ")";
|
songname += " (" + CGame.RoundNr + "/" + rounds + ")";
|
||||||
_Texts[_TextSongName].Text = songname;
|
_Texts[_TextSongName].Text = songname;
|
||||||
|
|
||||||
_CurrentStream = CSound.Load(song.GetMP3(), false, true);
|
_CurrentStream = CSound.Load(song.GetMP3(), false, true, CConfig.Config.Sound.KaraokeEffect == EOffOn.TR_CONFIG_ON ? EAudioEffect.Karaoke : EAudioEffect.None);
|
||||||
CSound.SetStreamVolume(_CurrentStream, 100);
|
CSound.SetStreamVolume(_CurrentStream, 100);
|
||||||
CSound.SetPosition(_CurrentStream, song.Start);
|
CSound.SetPosition(_CurrentStream, song.Start);
|
||||||
_CurrentTime = song.Start;
|
_CurrentTime = song.Start;
|
||||||
|
|||||||
@@ -185,6 +185,7 @@
|
|||||||
<Compile Include="Lib\Draw\CTextureBase.cs" />
|
<Compile Include="Lib\Draw\CTextureBase.cs" />
|
||||||
<Compile Include="Lib\Draw\CTextureProvider.cs" />
|
<Compile Include="Lib\Draw\CTextureProvider.cs" />
|
||||||
<Compile Include="Lib\Input\CGamePad.cs" />
|
<Compile Include="Lib\Input\CGamePad.cs" />
|
||||||
|
<Compile Include="Lib\Sound\EAudioEffect.cs" />
|
||||||
<Compile Include="Lib\Sound\Playback\CAudioStreamBase.cs" />
|
<Compile Include="Lib\Sound\Playback\CAudioStreamBase.cs" />
|
||||||
<Compile Include="Lib\Sound\Playback\CPlaybackBase.cs" />
|
<Compile Include="Lib\Sound\Playback\CPlaybackBase.cs" />
|
||||||
<Compile Include="Lib\Sound\Playback\CRingBuffer.cs" />
|
<Compile Include="Lib\Sound\Playback\CRingBuffer.cs" />
|
||||||
|
|||||||
Reference in new issue
Block a user