smad2005 / PoeHud

An application to display data read from application memory (without writing to it) ^.^
1 stars 0 forks source link

volume control for monster tracker/drop items #17

Closed smad2005 closed 8 years ago

ghost commented 8 years ago

Hi,... If you can add some kind of sound volume control for monster tracker/drop items...would be awesome as well. Ty,

smad2005 commented 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

ghost commented 8 years ago

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.

smad2005 commented 8 years ago
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();
        }
    }
ghost commented 8 years ago

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 :)

smad2005 commented 8 years ago

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.