DonationCoder.com Software > Finished Programs
FINISHED: Play a sound when a color appears on screen
Seed:
I have not posted before and I've already tried pixelnotifier. Pixel notifier watches one pixel - I'm looking for something that will watch several pixel at once - envision drawing a small box on your screen and if any of those pixels in that box hit the designated color, the alarm goes off.
p3lb0x:
I got the basic idea down, now I just need to wrap it in a UI.
FINISHED: Play a sound when a color appears on screenFINISHED: Play a sound when a color appears on screen
(Disregard that I am hijacking the console window to draw the captured bitmap, this is just for testing)
I am not sure if I am handling this in the best way possible, I am basically taking a screenshot every X milliseconds, and running through the entire bitmap looking for a pixel with the color you want.
anandcoral:
I am not sure if I am handling this in the best way possible, I am basically taking a screenshot every X milliseconds, and running through the entire bitmap looking for a pixel with the color you want.
-p3lb0x (July 14, 2017, 06:54 PM)
--- End quote ---
You are doing good job. This is the only way, AFAIK. Only you may change X milliseconds, if it is affecting CPU load.
Regards,
Anand
p3lb0x:
I have made this, is this about what you wanted in its simplest form?
edit: At the moment it can only play wave files, but that can pretty easily be changed, multiple files or checks isn't possible with how I set it up and the program would have to be done very differently (Although that is entirely possible to do with the code I have, I am just not that great at UI programming)
edit edit: I haven't tested it with very large resolution squares. Only in the 250x250 area. I am fairly certain that it won't perform very well at larger resolutions as it is checking every single pixel for a value at a frequency of 20 times a second.
edit edit edit: I also haven't tested it with multiple monitors as the monitors I have at the moment are way too ancient to interface with my videocard. But I am confident that way I am doing things can be fixed to work with multiple screens without too much work if it doesn't already.
edit edit edit edit: Tried it in a fairly large (1000x800'ish) area and it ran with no problems on my machine, but I am running a fairly beefy older generation i7.
Seed:
Awesome work - thanks! I'm excited to try it out.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version