Jump to content

Audio.au3


Bert
 Share

Recommended Posts

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Haha, it works with wmv files! Check this out:

#include <Sound.au3>
$file = 'C:\WINDOWS\system32\oobe\images\intro.wmv'
;open sound file
$sound = _SoundOpen($file)
If @error = 2 Then
    MsgBox(0, "Error", "The file does not exist")
    Exit
ElseIf @error = 3 Then
    MsgBox(0, "Error", "The alias was invalid")
    Exit
EndIf
_SoundPlay($sound)
Sleep(_SoundLength($sound, 2))
_SoundClose($sound)

It also played an mpg, but _SoundLength didn't return the right time. It told me that a 2 minute video was 4 seconds. I also tried .avi, and it wouldn't play at all, the window that appears is just glitched out (visually), and the _SoundLength for that was way off as well.

But wmv seems to work fine!

did you test with audio.au3? I simply added to sound.au3, so you should have the same result. If you don't, let me know, so I can test to see what I need to do to tweak it. Edited by Volly
Link to comment
Share on other sites

  • 2 weeks later...

I've been using Audio.au3 under XP and have found it to work wonderfully, thank you to all who have contributed!!

However, I've been trying to set the Microphone RECORD level.

The extract of code below seems to set the microphone PLAYBACK slider and not the RECORD slider.

Am I being thick??

Which function call modifes the microphone input level??

David

;===============================================================================

;

; Function Name: _SoundSetMicrophoneVolume

; Description:: Sets the Microphone input volume

; Parameter(s): $iVolume - % to set

; Requirement(s): AutoIt 3.2 ++

; Return Value(s): 1 - Success, 0 and @error = 1 - Failure

; Author(s): Volly

; Example: _SoundSetMicrophoneVolume(50)

;

;===============================================================================

;

func _SoundSetMicrophoneVolume($iVolume)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE, $iVolume)

If @error Then

Exit

else

SetExtended(1)

Return(@extended)

endif

EndFunc

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Yo Volly, you know I've been looking all over for a way of generating a sound... I've found lots of information for how to acomplish this using some functions in winmm.dll, but my lack of knowledge didn't even let me get started. Do you think it's possible?

I found someone who did it in VB:

http://forums.devx.com/archive/index.php/t-75011.html

Link to comment
Share on other sites

  • 3 weeks later...

I'm still working on the solution. If someone wishes to assist....

:P

I sent you a PM with some info but here is more.

Starting from Windows Vista, Microsoft changed the way that applications control the sound volume. When an application running in Vista changes the sound volume, it doesn't affect the master volume of the entire system anymore. Instead, it only affects the volume for the running application.

Unfortunately, this new "feature" creates huge compatibility problems to all applications and utilities that change the sound volume of the entire system.

Microsoft also released a new set of programming interfaces for controling the master volume in Vista.

These quotes were taken from information regarding VolMouse by Nir Sofer. Apparently he now has a version that will work with Vista so it can be done.

Edit: Also check this

MSDN

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

You should add this

Func _SoundGetWaveVolume()
    Local $WaveVol = -1, $p, $ret
    Const $MMSYSERR_NOERROR = 0
    $p = DllStructCreate("dword")
    If @error Then
        SetError(2)
        Return -2
    EndIf
    $ret = DllCall("winmm.dll", "long", "waveOutGetVolume", "long", -1, "long", DllStructGetPtr($p))
    If($ret[0] == $MMSYSERR_NOERROR) Then
        $WaveVol = Round(Dec(StringRight(Hex(DllStructGetData($p, 1), 8), 4)) / 0xFFFF * 100)
    Else
        SetError(1)
    EndIf
    $Struct = 0
    Return $WaveVol
EndFunc   ;==>_SoundGetWaveVolume

I didnt wirte that but GaryFrost did!

Edited by DBak

[center][/center]

Link to comment
Share on other sites

  • 2 months later...

Weird, none of these UDFs work for me ! Dunno why, but they worked on a fried PC. Anything that can be done ?

[size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent]
Link to comment
Share on other sites

  • 2 weeks later...

You should add this

Func _SoundGetWaveVolume()
    Local $WaveVol = -1, $p, $ret
    Const $MMSYSERR_NOERROR = 0
    $p = DllStructCreate("dword")
    If @error Then
        SetError(2)
        Return -2
    EndIf
    $ret = DllCall("winmm.dll", "long", "waveOutGetVolume", "long", -1, "long", DllStructGetPtr($p))
    If($ret[0] == $MMSYSERR_NOERROR) Then
        $WaveVol = Round(Dec(StringRight(Hex(DllStructGetData($p, 1), 8), 4)) / 0xFFFF * 100)
    Else
        SetError(1)
    EndIf
    $Struct = 0
    Return $WaveVol
EndFunc   ;==>_SoundGetWaveVolume

I didnt wirte that and i wish i knew who did i'd thank them!

http://www.autoitscript.com/forum/index.ph...ost&p=82967

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Sorry I should have included a link =P

You still appear to have missed who the author was. :)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...