Sounds not playing on VPS through cTrader
Sounds not playing on VPS through cTrader
12 Jun 2020, 12:08
Hi all:
I have the below Indicator code.
It plays fine on my local laptop.
It won't play any sounds on the VPS through cTRader.
I can go into control Panel on the VPS, select the individual sound, and play it fine.
When cTrader comes up, it plays its normal starting sound, and any sounds whenever I get in/out of a position.
but none of these sounds will play. The associated text in red/green/yellow shows, so I know it's going through the method.
Any ideas why the sounds won't play on a VPS?
using cAlgo.API;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, AccessRights = AccessRights.FullAccess)]
public class Test : Indicator
{
[Parameter("Play sound", DefaultValue = true)]
public bool PlaySound { get; set; }
private int _prevIndex;
protected override void Initialize()
{
_prevIndex = 0;
}
public override void Calculate(int index)
{
Chart.DrawText("Text", "Bar: " + index + ".", index, Bars.ClosePrices.Last(0), Color.Green);
if (index > _prevIndex && IsLastBar)
{
if (PlaySound)
{
Chart.DrawText("Text", "Playing Sounds.", index, Bars.ClosePrices.Last(0), Color.Red);
System.Media.SystemSounds.Question.Play();
System.Threading.Thread.Sleep(1000);
System.Media.SystemSounds.Exclamation.Play();
Chart.DrawText("Text", "Did you hear anything?", index, Bars.ClosePrices.Last(0), Color.Yellow);
System.Threading.Thread.Sleep(1000);
}
_prevIndex = index;
}
}
}
}
Replies
firemyst
12 Jun 2020, 13:07
( Updated at: 21 Dec 2023, 09:22 )
RE:
PanagiotisCharalampous said:
Hi firemyst,
Seems to be a common issue on Windows Server. Check here in case it helps.
Best Regards,
Panagiotis
@Panagiotis, I found the root cause and managed to fix it.
For future reference, in my case, this was disabled for some reason!
Once I enabled this, the sounds started playing again as expected.
Thank you.
@firemyst
PanagiotisCharalampous
12 Jun 2020, 12:14
Hi firemyst,
Seems to be a common issue on Windows Server. Check here in case it helps.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous