handruin / spdif-ka

SPDIF Keep Alive utility
MIT License
64 stars 11 forks source link

Provide option to use 'Silence' to keep audio channel open #9

Closed Eldaw closed 7 years ago

Eldaw commented 7 years ago

Thanks for creating this useful application, which I'm actually using to keep an HDMI audio connection open, not SPDIF. There's just one thing it's lacking compared to another (very similarly named) program.

The other program is SPDIFKeepAlive: https://blog.rhysgoodwin.com/htpc/spdif-keepalive/

That program hasn't been updated in years, and is not quite as lightweight and attractive as spdif-ka, however it provides some options concerning how the audio channel should be kept open.

If you look at its screenshot, you'll see that in addition to being able to generate an 'Inaudible Tone', it also has another option called 'Silence'. I'm not sure exactly how that 'Silence' option is being implemented, but it actually works better for me than the other options.

Let me explain: I use a program called TrayStatus Pro from Binary Fortress Software to show an indicator on my taskbar which tells me when audio is being played. This is useful over a remote session, for example, as I can see whether any audio is currently playing on the remote machine. When I activate spdif-ka, the TrayStatus Pro icon constantly indicates that audio is playing, i.e. I lose the ability to tell whether any actual audible sound is being generated. In contrast, with the 'Silence' option in the other program, SPDIFKeepAlive, the HDMI audio connection is still kept alive successfully, but according to TrayStatus Pro there is no audio playing while that option is active. In other words, it allows me to still be able to tell whether any real sound is being played by the system.

Is there any chance that spdif-ka could include an option that works in a similar manner to the way the 'Silence' option works in SPDIFKeepAlive?

spdif-ka has a much better tray icon, which changes according to whether it's enabled or not, so I would prefer to use spdif-ka if possible.

handruin commented 7 years ago

Hey there. Thanks for reaching out to give me feedback and to let me know about the other spdif utility and the mode they offer called silence. I took a look at their source and it appears that the difference is in the WAV file used for playback when selecting the silence option.

I can add a similar feature by way of adding my own WAV file that has nothing inside and maybe that might offer you the solution you're looking for. I will likely need your help in testing as I'm unsure if I have the right configuration to test with. I'll see if I can get that option added and I'll let you know when I have something for you to try.

handruin commented 7 years ago

@Eldaw I've checked in my code and published a new release. When you have time, can you please give this new release a try and let me know if it works for you? I made sure to integrate the audio type selection into the saved user preferences so the audio type you select should hopefully persist when this utility is closed.

https://github.com/handruin/spdif-ka/releases/tag/v1.3.0

Eldaw commented 7 years ago

@handruin Thanks very much for looking into this and addressing it. I can confirm that the 'Silence' option in the latest version works brilliantly for my scenario.

Just a few other observations/suggestions (let me know if you agree with these and/or if you'd like me to split them out into new, separate issues):

a) You may wish to add this.Activate() at the end of the restore() method. This will provide 2 benefits: (1) when the application window is restored from the notification area, it will reliably be given focus and brought to the front, and (2) when the application window is already open but in the background somewhere, if the user clicks the notification area icon the application window will reliably be given focus and brought to the front.

b) You may wish to consider syncing the titlebar icon with the notification area icon so they're always showing the same thing.

c) It might be nice to have 2 new options: 'Minimize to notification area' (which is already built-in and active by default) and 'Minimize to notification area on Close'.

d) The red icon that is initially displayed when the program starts in a "stopped" state -- can that be included with the source code? Maybe it already is and I just don't know how to find it. I can't see it in the 'Resources' or in the included files.

e) In the latest version, 1.3.0, the version number is still 1.2.0 in the properties for the executable and in the About box.

handruin commented 7 years ago

I'm glad the new change is working for you. Thanks for the additional feedback. I'll take a look into those some more tonight if I have time.

Here are my thoughts on your suggestions. I may end up opening separate issues for these just so I can track them better but it's not a bug deal that they're here. I'm grateful for your feedback.

a) This sounds good. I'll add it in and do some testing to make sure it works fine. Thanks for the ideas.

b) I had tried to get this working at one point but had issues with the icon syncing and updating properly. I admit I moved on to other issues and did not revisit. I'll add a task to look into this.

c) I'm not sure I understand what the two options are. The minimize to notification area is already there but the second suggestion is not. I can add the second option as a selectable option if that's a preference. I don't quite follow what you're suggesting for the first of the two options.

d) I believe the red icon was previously included and I may have accidentally removed it. I'll fix that so it's located in the source code.

e) Thanks for catching this. I was sloppy last night when committing in the changes and missed this one. I had spent far too much time trying to get this to update as part of the build process but gave up after not being able to integrate it. I'll see if there's another way for me to make this work.

Eldaw commented 7 years ago

Just to further clarify point C:

[ ] Minimize to notification area:

If it is checked, when the application window is minimized it will only be visible as an icon in the notification area. There will be nothing visible on the taskbar.

If it is unchecked, when the application window is minimized it will be visible on the taskbar just like other minimized windows, as well as visible as an icon in the notification area.

[ ] Minimize to notification area on Close:

If it is checked, then when you hit the 'X' close button, the application remains running, and is visible as an icon in the notification area. There will be nothing visible on the taskbar. To exit the application, you have to use the context menu of the notification area icon. This is an option I like to enable on applications I want running in the background all the time, as it prevents me exiting the application by mistake.

If it is unchecked, then when you hit the 'X' close button the application quits.

handruin commented 7 years ago

Thanks for clarifying the suggested changes. This makes sense to me. My tentative plan is to add a third tab to the UI to separate the settings a bit. I may just move the audio output types to its own tab and use the existing settings tab to add these two items.

handruin commented 7 years ago

I've gone through and made separate issues for each of the items you've identified in this issue. I've also addressed all of them in the latest release located below. I'm going to close out this issue for now but if you notice anything wrong in the latest release, please feel free to re-open this issue or start a new issue so I can track the problem.

https://github.com/handruin/spdif-ka/releases/tag/v1.4.0