trancexx Posted December 11, 2011 Share Posted December 11, 2011 With the release of latest beta v3.3.7.22 code regarding Interfaces is completely finished. This allows native usage of many objects that required additional UDFs before (mainly AutoItObject). No more.As example I will show how to use few DirectSound interfaces using nothing but built-in functions.Script this was based on was posted (I have highlighted keywords). DirecSound's IDirectSound8 in combination with IDirectSoundBuffer interface imitates old beep sound.Include script:DSBeep.au3An example could be (one of AZIJO's songs):expandcollapse popup#include "DSBeep.au3" Opt("MustDeclareVars", 1) HotKeySet("{ESC}", "_Quit") ; Error monitoring (thru the life time of the script) Global $oErrorObject = ObjEvent("AutoIt.Error", "_ErrFunc") ; Implemenation Func _ErrFunc($oError) ConsoleWrite("COM Error, ScriptLine(" & $oError.scriptline & ") : Number 0x" & Hex($oError.number, 8) & " - " & $oError.windescription & @CRLF) EndFunc ;==>_ErrFunc ; Initialize DSBeep _StartDSBeep() ; Play _Beep(8, 4, 100, 0, 0.8, 0) ; set tempo and tone _Beep(7,4,100) _Beep(8,4,100) _Beep(9,4,100) _Beep(8,4,100,100) _Beep(1,5,100,100) _Beep(8, 4, 100, 0, 1) ; new tempo _Beep(7,4,100) _Beep(8,4,100) _Beep(9,4,100) _Beep(8,4,100,100) _Beep(12,4,100,100) _Beep(8,4,100) _Beep(7,4,100) _Beep(8,4,100) _Beep(9,4,100) _Beep(8,4,100) _Beep(6, 5, 100, 0, 0.8) ; new tempo _Beep(3,5,100) _Beep(12,4,100) _Beep(8,4,100) _Beep(6,4,100) _Beep(5,4,100) _Beep(4,4,200,300) _Beep(1,5,100) _Beep(12,4,100) _Beep(11,4,100) _Beep(9,4,100) _Beep(1,5,100,100) _Beep(6,5,100,100) _Beep(4,5,100) _Beep(3,5,100) _Beep(1,5,100) _Beep(8,4,100) _Beep(1,5,100,100) _Beep(4,5,100,100) _Beep(4,5,100) _Beep(3,5,100) _Beep(1,5,100) _Beep(3,5,100) _Beep(3,4,100) _Beep(7,4,100) _Beep(10,4,100) _Beep(1,5,100) _Beep(4,5,100) _Beep(3,5,100) _Beep(1,5,100) _Beep(3,5,250,250) ;=========================== _Beep(8, 4, 100, 0, 1.1) ; new tempo _Beep(7, 4, 100) _Beep(8, 4, 100) _Beep(9, 4, 100) _Beep(8, 4, 100, 100) _Beep(1, 5, 100, 100) _Beep(8, 4, 100) _Beep(7, 4, 100) _Beep(8, 4, 100) _Beep(9, 4, 100) _Beep(8, 4, 100, 100) _Beep(12, 4, 100, 100) _Beep(8, 4, 100) _Beep(7, 4, 100) _Beep(8, 4, 100) _Beep(9, 4, 100) _Beep(8, 4, 100) _Beep(6, 5, 100) _Beep(3, 5, 100) _Beep(12, 4, 100) _Beep(8, 4, 100) _Beep(6, 4, 100) _Beep(5, 4, 100) _Beep(4, 4, 200, 300) _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(11, 4, 100) _Beep(9, 4, 100) _Beep(1, 5, 100, 100) _Beep(6, 5, 100, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(8, 4, 100) _Beep(1, 5, 100, 100) _Beep(4, 5, 100, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(3, 5, 100) ;============================= _Beep(8, 4, 100) _Beep(12, 4, 100) _Beep(3, 5, 100) _Beep(8, 5, 100) _Beep(6, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 300, 200) _Beep(3, 5, 100, 0, 1.8) ; new tempo _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(11, 4, 100) _Beep(4, 4, 100) _Beep(8, 4, 100) _Beep(11, 4, 100) _Beep(4, 4, 100) _Beep(8, 4, 100) _Beep(11, 4, 100) _Beep(12, 4, 100) _Beep(1, 5, 150, 150) _Beep(9, 4, 200, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(11, 4, 100) _Beep(3, 4, 100) _Beep(6, 4, 100) _Beep(11, 4, 100) _Beep(3, 4, 100) _Beep(6, 4, 100) _Beep(11, 4, 100) _Beep(12, 4, 100) _Beep(1, 5, 150, 150) _Beep(8, 4, 200, 100) _Beep(4, 5, 100, 0, 1.1) ; new tempo _Beep(3, 5, 100) _Beep(6, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(11, 4, 100) _Beep(3, 5, 150, 150) _Beep(11, 4, 300, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(11, 4, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(11, 4, 100) _Beep(9, 4, 100) _Beep(11, 4, 400, 100) _Beep(3, 5, 100, 0, 1.8) ; new tempo _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(11, 4, 100) _Beep(4, 4, 100) _Beep(8, 4, 100) _Beep(11, 4, 100) _Beep(4, 4, 100) _Beep(8, 4, 100) _Beep(11, 4, 100) _Beep(12, 4, 100) _Beep(1, 5, 150, 150) _Beep(9, 4, 200, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(11, 4, 100) _Beep(3, 4, 100) _Beep(6, 4, 100) _Beep(11, 4, 100) _Beep(3, 4, 100) _Beep(6, 4, 100) _Beep(11, 4, 100) _Beep(12, 4, 100) _Beep(1, 5, 150, 150) _Beep(8, 4, 150, 150) _Beep(4, 5, 100, 0, 1.2) ; new tempo _Beep(3, 5, 100) _Beep(2, 5, 100) _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(1, 5, 100) _Beep(3, 5, 100) _Beep(6, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(4, 5, 100) _Beep(11, 4, 100) _Beep(4, 5, 100) _Beep(8, 5, 100) _Beep(11, 5, 100, 0, 0.8) ; new tempo _Beep(10, 5, 100) _Beep(9, 5, 100) _Beep(8, 5, 100) _Beep(6, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(11, 4, 100) _Beep(9, 4, 100, 0, 0.5) ; new tempo _Beep(8, 4, 100) _Beep(6, 4, 100, 0, 0.2) ; new tempo _Beep(4, 4, 200) ; Stop the engine _StopDSBeep() ; Exit (redundant) _Quit() Func _Quit() Exit EndFunc ;==>_QuitHave that code in the same folder as DSBeep.au3. meoit 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
wakillon Posted December 11, 2011 Share Posted December 11, 2011 That rocks ! When will you stop to amaze us ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
czardas Posted December 12, 2011 Share Posted December 12, 2011 (edited) I was planning on waiting for the new release of AutoIt, since I have so many unfinished projects and fear being overwhelmed by the changes taking place. The first DSBeep was excellent since it called the current native beep function which allows you to set the pitch to any frequency. I am now slightly concerned that DSBeep will only play a limited range of frequencies (tempered notes).Some things I didn't like about AZIJO's original design. $iPause is a bad idea, and would be better replaced by the start time of the note. (eg Note starts at 6000 ms and lasts for 2 seconds). I'm not sure what is meant by $iTone. I presume it means you can alter the wave form. I'm also unclear about how $iTempo relates to note duration, or why it is even needed. Until I have the latest version of AutoIt I can't test it, but I'm sure it will be good regardless. It's just that I would have made some different choices for this particular script.Perhaps my concerns are needless, since all that I might need or use can be written as a UDF; and as you say, this is just an example. I don't yet know what treasures await me in the new release. I look forward to trying it when it arrives. Edit Number(I've forgotten)Aghh I'm sure it will all turn out to be good. Sorry for nitpicking about AZILO's design. Edited December 12, 2011 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
czardas Posted December 12, 2011 Share Posted December 12, 2011 (edited) Apologies. All is well since this can be altered. Local $iFrequency = 440 * 2 ^ (($iNote + $iToneLocal) / 12 + $iOctave + 1 / 6 - 4) Thanks for all the great stuff you keep producing. Edited December 12, 2011 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
JScript Posted December 13, 2011 Share Posted December 13, 2011 @trancexxHi, I confess that I do not understand much the code, especially the function: ObjCreateInterface()But I'll try to see the examples and maybe I'll end up understand better, anyway, very good scriptRegards,João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now