why doesn't MM register with Windows Core audio API?

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: why doesn't MM register with Windows Core audio API?

Re: why doesn't MM register with Windows Core audio API?

by AudioBabble » Sun Nov 03, 2024 4:32 pm

bloody typical... just after posting this... it works!

nothing to see here!!

why doesn't MM register with Windows Core audio API?

by AudioBabble » Sun Nov 03, 2024 4:29 pm

Hello,

I found this bit of code on reddit:

Code: Select all

#Requires AutoHotkey v2.0

SetTimer CheckAudioChange, 500 ; every 500 ms, SetTimer checks if audio is started or stopped.
OnAudioChange(isPlaying) {     ; this function is called by CheckAudioChange when it detects sound start/stop.
    if isPlaying {
        MsgBox "audio playing"
    } else {
        MsgBox "audio stopped"
    }
}

CheckAudioChange() {
    static audioMeter := ComValue(13, SoundGetInterface("{C02216F6-8C67-4B5B-9D00-D008E73E0064}")), peak := 0, playing := 0
    if audioMeter {
        ComCall 3, audioMeter, "float*", &peak
        if peak > 0.0001 {
            if playing = 1
                return
            playing := 1
            OnAudioChange(1)
        } else {
            if playing = 0
                return
            playing := 0
            OnAudioChange(0)
        }
    }
}
It's an AHK script... I'm hoping to make a script that keep the screen from entering sleep during playback [maybe there's an easier way?]

It LOOKS like it might do what I'm hoping... and it does -- with browser audio and also Windows Media player.

Why doesn't it work with MM5? (I'm running a portable install, if that makes any odds.).

Top