I use the ManagedBass library to modify a stream or create the stream if it is a local file. I route the output through the Discord api gateway to a bot so I have to set the channel to decode and everything works fine so far, I can set FX effects etc. However, I can't change the volume and balance of the channel, but when I enable the rotate FX effect from BassFX, the effect works fine.
Here is my Code to set the Channel:
if (resource.ToLower().StartsWith("http://") || resource.ToLower().StartsWith("https://"))
{
... Download Stuff
h = Bass.CreateStream(resource, 0, BassFlags.Decode, null, IntPtr.Zero);
}
else
{
h = Bass.CreateStream(resource, 0, 0, BassFlags.Decode);
}
if (h == 0) return false;
int tStream = BassFx.TempoCreate(h, BassFlags.FxFreeSource | BassFlags.Decode);
if (tStream == 0) return false;
Handle = tStream;
And here is how I try to set the Volume for example:
Bass.ChannelSetAttribute(Handle, ChannelAttribute.Volume, value)
And here is my output stream for discord:
int read = 0;
using (AudioOutStream? stream = Client.CreatePCMStream(AudioApplication.Music))
{
byte[] buffer = new byte[4096];
do
{
read = Bass.ChannelGetData(Handle, buffer, buffer.Length);
if (read > 0) stream.Write(buffer, 0, buffer.Length);
}
while (read > 0);
}