Results 1 to 9 of 9

Thread: detect if microphone is using

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,170

    detect if microphone is using

    Is there an API that could detect if someone is using microphone to talk/speak? What happened was my program got closed when the screen saver kicks in, the user does not use mouse/keyboard and simply use microphone to interact with the computer. Screen saver kicks in because it "thinks" that user inactivity. So I want my program to detect that and then disable the screensaver.

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: detect if microphone is using

    Why don't you just disable screen saver during the use of your program


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: detect if microphone is using

    There really is not much need for a screen saver if you are using a LCD monitor anyway.

    The purpose of a screen saver was to prevent screen burn in which would happen over time on the CRT screens if a static image was displayed for very long periods, Plasmas were worse but is a none factor on LCD monitors. I am not sure about the LED ones.

  4. #4
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: detect if microphone is using

    Here's a simple hack based on some code I found on the Internet:

    Code:
    Private WithEvents tmrToggleScrollLock As VB.Timer
    
    Private Sub Form_Load()
        Set tmrToggleScrollLock = Controls.Add("VB.Timer", "tmrToggleScrollLock")
        tmrToggleScrollLock.Interval = 59000 '59 secs is < screensaver's min timeout
    End Sub
    
    Private Sub tmrToggleScrollLock_Timer()
        CreateObject("WScript.Shell").SendKeys "{SCROLLLOCK}{SCROLLLOCK}"
    End Sub                     'VB's SendKeys couldn't press ScrollLock
    It works by resetting the screensaver's timeout value by programmatically toggling the Scroll Lock key twice just before the minimum timeout (1 minute) for screensavers elapses.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  5. #5
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: detect if microphone is using

    Looks like OK code for disabling Screen Saver. I don't think he asked how to do that - he asked how to detect if mic is in use. I get impression for OP's post he already knows how to disable SS. But...then maybe not


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  6. #6
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: detect if microphone is using

    Quote Originally Posted by jmsrickland View Post
    I don't think he asked how to do that - he asked how to detect if mic is in use.
    Since the OP's program does use the mic, there's no point in trying to detect it. I believe what the OP really wants is to prevent the screensaver from starting whenever the OP's app is running. There are numerous ways of achieving that (as I found out via Google), including the disabling of the screensaver via some system setting.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  7. #7
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: detect if microphone is using

    Quote Originally Posted by jmsrickland View Post
    Why don't you just disable screen saver during the use of your program
    Quote Originally Posted by Bonnie West View Post
    I believe what the OP really wants is to prevent the screensaver from starting whenever the OP's app is running.
    Looks like you two are in violent agreement

    The OP could have been phrased better; I was getting hung up on "my program got closed when the screen saver kicks in" which I thought was strange and also "use microphone to interact with the computer" as opposed to "..... with my program".

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,170

    Re: detect if microphone is using

    I just got back to this. I know how to disable the screensaver. Does that mean there's no way to detect if microphone is in used?

  9. #9
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: detect if microphone is using

    That doesn't make any sense. If you are running an application on, let's say, PC1 you should know if the mic is in use because you or someone is at that computer. Besides, if you know how to disable Screen Saver then why be concerned about if the mic is in use just disable Screen Saver anyway; in other words pretend the mic is in use and do the disabling.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width