Closed smad2005 closed 8 years ago
if you want you could implement it by yourself. There 2 ways: http://www.codeproject.com/Questions/879973/csharp-adjust-volume-of-played-wav-file or http://loekvandenouweland.com/content/playing-wav-files-in-a-xamlc-windows-store-app-using-sharpdx
I already did : public static SoundPlayer GetSound(string name) { uint defVolume = 0; waveOutGetVolume(IntPtr.Zero, out defVolume); int newVolume = ((ushort.MaxValue / 10) * 1); uint stereo = (((uint)newVolume & 0x0000ffff) | ((uint)newVolume << 16)); waveOutSetVolume(IntPtr.Zero, stereo); return soundLib[name]; } The thing is...it's hardcoded with a fixed value. I don't know how to add a picker/trackbar for volume setup. But, thanks for the SharpDx solution..i will look to that.
using System;
using System.Media;
namespace PoeHUD.Framework.Helpers
{
public static class SoundHelper
{
public static void Play(this SoundPlayer player, ushort volume)
{
const ushort MAX_VOLUME = 300;
if (volume > MAX_VOLUME)
volume = MAX_VOLUME;
var newVolume = (ushort)((float)volume / MAX_VOLUME * ushort.MaxValue);
var stereo = (newVolume | (uint)newVolume << 16);
WinApi.waveOutSetVolume(IntPtr.Zero, stereo);
player.Play();
}
}
Damn, i messed up everything trying to install sharpdx audio toolkit...:|. Wasn't even necessary :D. Question : Is there any need now for crafting bases when filter parser is used ?
Thanks for this code, i will start again from scratch :)
Damn, i messed up everything trying to install sharpdx audio toolkit...:|. Wasn't even necessary :D.
https://www.nuget.org/packages/SharpDX.XAudio2/3.0.0-beta01
Question : Is there any need now for crafting bases when filter parser is used ?
I don't know, i never used it.
Hi,... If you can add some kind of sound volume control for monster tracker/drop items...would be awesome as well. Ty,