Jump to content
Sign in to follow this  
Bert

Audio.au3

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi Volly, I notic that the banner regarding Vista has been removed and that the audio.au3 date/time stamp has changed, have you found a solutuion to making audio.au3 control the master device volume slider for Vista?

Best regards,

David

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!"

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

You can use the command "beep" to do what you want to do.

Beep? No, haha, I meant using the sound card.

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

@Volly: your UDF works great, I testes almost all functions on XP. Anyway:

- what about Vista compatibility?

- have you planned to add microphone registration volume setting?

Share this post


Link to post
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 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.

 

Share this post


Link to post
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!"

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...