nobbe Posted January 19, 2007 Share Posted January 19, 2007 hi i added a few lines in sound.au3 to play other formats and video too (original code didnt display video on my machine) expandcollapse popup;=============================================================================== ; ; Function Name: _SoundOpen ; Description:: Opens a sound file for use with other _Sound functions ; Parameter(s): $hFile - The sound file, $sAlias[optianal] - a name such as sound1, ; if you do not specify one it is randomly generated ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): string(the sound id) - Success, 0 - Failure ; @extended <> 0 - open failed, @error = 2 - File doesn't exist, ; @error = 3 - alias contains whitespace ; Author(s): RazerM ; ;=============================================================================== ; Func _SoundOpen($hFile, $sAlias = "") ;Declare variables Local $sSnd_id, $iCurrentPos, $iRet ;check for file If Not FileExists($hFile) Then Return SetError(2, 0, 0) ;search for whitespace by character For $iCurrentPos = 1 To StringLen($sAlias) If StringIsSpace(StringMid($sAlias, $iCurrentPos, 1)) Then Return SetError(3, 0, 0) Next ;create random alias if one is not supplied If $sAlias = "" Then $sSnd_id = RandomStr(10) Else $sSnd_id = $sAlias EndIf ; ; for opening other files as well (AVI, MUS, DIVX) ; ; MUS = MPEG 1 Layer2 audio file format for Broadcast Station (DAB) etc .. ; If StringInStr(FileGetShortName($hFile), ".MUS") > 0 Or StringInStr(FileGetShortName($hFile), ".AVI") Or StringInStr(FileGetShortName($hFile), ".DIVX") Then $iRet = mciSendString("open " & FileGetShortName($hFile) & " type MPEGVideo alias " & $sSnd_id) Else $iRet = mciSendString("open " & FileGetShortName($hFile) & " alias " & $sSnd_id) EndIf ; --- end enhancement Return SetError(0, $iRet, $sSnd_id) EndFunc ;==>_SoundOpen Link to comment Share on other sites More sharing options...
RazerM Posted January 20, 2007 Share Posted January 20, 2007 Did it not occur to you that the Sound UDF's were for playing sounds? My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
nobbe Posted January 20, 2007 Author Share Posted January 20, 2007 Did it not occur to you that the Sound UDF's were for playing sounds?hiit wasnt meant as critics, just an enhancement . i work for a radio station and they use the MUSicam file format - this is sound, but can be played only with my little change, otherwise its not recognizes as a sound format ...Thanks anyways for a good job with the module.. 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