wakillon Posted September 28, 2010 Share Posted September 28, 2010 @MelbaSo, I use the _soundplay helpfile example :#include <Sound.au3> ;open sound file : must be modified if run under Vista $sound = _SoundOpen("C:\38.mp3") $_Error = @error $extended = @extended ConsoleWrite ( "$_Error : " & $_Error & " $extended : " & $extended & @Crlf ) If $_Error = 2 Then MsgBox(0, "Error", "The file does not exist") Exit ElseIf $extended <> 0 Then $stText = DllStructCreate("char[128]") $errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128) MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.") Else MsgBox(0, "Success", "The file opened successfully") EndIf _SoundPlay($sound, 1) _SoundClose($sound)And it give me $_Error : 1 $extended : 10and no sound and the error message box is allways the same... 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...
Moderators Melba23 Posted September 28, 2010 Moderators Share Posted September 28, 2010 wakillon,As far as I can see, Error 10 from Windows means that a driver is not working correctly - which would chime with not being able to use SoundPlay to play the file either:Code 10 If the device has a "FailReasonString" value in its hardware key, that string is displayed as the error message. The driver or enumerator places this registry string value there. If there is no "FailReasonString" in the hardware key, the following generic error message is displayed: This device is either not present, not working properly, or does not have all the drivers installed. (Code 10) Try upgrading the device drivers for this device. Solution: Update Driver To resolve this error code, make sure the device is connected to the computer correctly. For example, make sure all cables are plugged in fully and that all adapter cards are properly seated. Follow the suggested solution button and update the device driver. It may be possible to remove the device and redetect it using the Add New Hardware wizard.As you can play wav files, I can only think that it is the codec for playing mp3 type files - but now I am getting seriously out of my depth. Sorry I cannot help any more.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
wakillon Posted September 28, 2010 Share Posted September 28, 2010 (edited) If it was a device problemwhy defaut players work well ?and i don't have any problem display in my device manager...So i have re-installed a codec pack but without result...It's strange ! Edited September 28, 2010 by wakillon 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...
failedtocompile Posted October 1, 2010 Share Posted October 1, 2010 (edited) Hi, I too am dealing with the same issue with regards to _SoundPlay , also Soundplay() works fine with .wav files but not with mp3 files tried to find a method of registering dlls but was not successful. OS: win7 x86 Autoit: 3.3.6.0 After modifying the example script "_SoundPlay" to utilize a mp3 file I repeatedly get error: "The File does not exist" Example Script: #include <Sound.au3> ;open sound file : must be modified if run under Vista #RequireAdmin $sound = _SoundOpen("mind_at_peace.wav") ;Have changed to multipel locations still yields same error, have tried mp3 files also If @error = 2 Then MsgBox(0, "Error", "The file does not exist") Exit ElseIf @extended <> 0 Then $extended = @extended ;assign because @extended will be set after DllCall $stText = DllStructCreate("char[128]") $errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128) MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.") Else MsgBox(0, "Success", "The file opened successfully") EndIf _SoundPlay($sound, 0) _SoundClose($sound) As I am writing i tried another path to a system .wav file "C:\Windows\Media\Windows Error.wav" this time a different error in msgbox popped up: The Open Failed Error Number: 10 Error Description: There is a problem with the device driver. The driver has closed. Cannot Access error. Please Note: The sound may still play correctly. Any chance of getting information with regards to system dependencies this function requires? so i maybe able to provide little more troubleshooting, just encase i am missing something? Thankyou ftc Edited October 1, 2010 by failedtocompile Link to comment Share on other sites More sharing options...
wakillon Posted October 2, 2010 Share Posted October 2, 2010 Pending a solution I'm using this : #include <Bass.au3> FileInstall ( 'bass.dll', @SystemDir & '\bass.dll' ) $_Mp3Path='C:\file.mp3' $bass_dll = DllOpen ( "BASS.dll" ) _BASS_Init ( $bass_dll, 0, -1, 44100, 0, "" ) _Mp3Play ( $_Mp3Path ) _BASS_Free ( $bass_dll ) Func _Mp3Play ( $_Mp3FilePath ) $MusicHandle = _BASS_StreamCreateFile ( $bass_dll, False, $_Mp3FilePath, 0, 0, 0 ) _BASS_ChannelPlay ( $bass_dll, $MusicHandle, 0 ) Sleep ( 2500 ) EndFunc ;==> _Mp3Play ( ) 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...
trancexx Posted October 2, 2010 Share Posted October 2, 2010 Change line 79 in Sound.au3 from: __SoundMciSendString("open " & FileGetShortName($sFile) & " alias " & $aSndID[0]) to:__SoundMciSendString('open "' & FileGetShortName($sFile) & '" alias ' & $aSndID[0]) ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
wakillon Posted October 2, 2010 Share Posted October 2, 2010 Change line 79 in Sound.au3 from: __SoundMciSendString("open " & FileGetShortName($sFile) & " alias " & $aSndID[0]) to:__SoundMciSendString('open "' & FileGetShortName($sFile) & '" alias ' & $aSndID[0]) Change made but same error displayed... 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...
trancexx Posted October 2, 2010 Share Posted October 2, 2010 Change made but same error displayed...Were you able to play "C:\Windows\Media\Windows Error.wav" before the change? And can you now? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
wakillon Posted October 2, 2010 Share Posted October 2, 2010 Were you able to play "C:\Windows\Media\Windows Error.wav" before the change? And can you now?Yes, before and after change i can play wav files... 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...
trancexx Posted October 2, 2010 Share Posted October 2, 2010 Yes, before and after change i can play wav files...We misunderstood each other. I meant in regard to that other issue failedtocompile experienced. That issue isn't related to any specific type of file. It's best seen with exactly "C:\Windows\Media\Windows Error.wav" ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 2, 2010 Moderators Share Posted October 2, 2010 failedtocompile, another path to a system .wav file "C:\Windows\Media\Windows Error.wav" this time a different errorThat error with files that have a space in their names in the Windows\Media folder is known and was reported as Ticket #1707. The problem is that these files do not have a "shortname" and the solution is basically as trancexx has suggested. My announcement about a temporary fix until the next release is here. As to the error 2 ("File does not exist") return from _SoundOpen, the only line that produces that particular error return is: If Not FileExists($sFile) Then Return SetError(2, 0, 0) Could you please try a similar check on the file's existence in your script BEFORE using _SoundOpen on a problem mp3 file and see if the error is also occurs there. At least we will then know if it is the UDF or the system - guess where my bet would go? Thanks in advance. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
failedtocompile Posted October 2, 2010 Share Posted October 2, 2010 failedtocompile, That error with files that have a space in their names in the Windows\Media folder is known and was reported as Ticket #1707. The problem is that these files do not have a "shortname" and the solution is basically as trancexx has suggested. My announcement about a temporary fix until the next release is here. As to the error 2 ("File does not exist") return from _SoundOpen, the only line that produces that particular error return is: If Not FileExists($sFile) Then Return SetError(2, 0, 0) Could you please try a similar check on the file's existence in your script BEFORE using _SoundOpen on a problem mp3 file and see if the error is also occurs there. At least we will then know if it is the UDF or the system - guess where my bet would go? Thanks in advance. M23 Will do tomorrow just playing D&D e4 just taking a quick 5 min break ftc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 2, 2010 Moderators Share Posted October 2, 2010 failedtocompile, Enjoy the game. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
failedtocompile Posted October 2, 2010 Share Posted October 2, 2010 As to the error 2 ("File does not exist") return from _SoundOpen, the only line that produces that particular error return is: [ autoIt ] ( Popup ) If Not FileExists($sFile) Then Return SetError(2, 0, 0) Could you please try a similar check on the file's existence in your script BEFORE using _SoundOpen on a problem mp3 file and see if the error is also occurs there. At least we will then know if it is the UDF or the system - guess where my bet would go? Thanks in advance. M23 No errors this time with locating audio file (except when attempting to play .mp3 file, it locates file but cannot play reports error 10 device driver, as before), still no errors after removing first check function with regards to .wav files. if FileExists("Giulio_Caccini_Ave_Maria.mp3") Then MsgBox(0, '', "File exists") elseif FileExists("Giulio_Caccini_Ave_Maria.mp3") ==0 Then MsgBox(0, "", "File not exisit") EndIf ;open sound file : must be modified if run under Vista $sound = _SoundOpen("Giulio_Caccini_Ave_Maria.mp3") If @error = 2 Then MsgBox(0, "Error", "The file does not exist") Exit ElseIf @extended <> 0 Then $extended = @extended ;assign because @extended will be set after DllCall $stText = DllStructCreate("char[128]") $errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128) MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.") Else MsgBox(0, "Success", "The file opened successfully") EndIf _SoundPlay($sound, 0) _SoundClose($sound) think the first error i encounted was related to id10t syndrome . ftc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 2, 2010 Moderators Share Posted October 2, 2010 failedtocompile,So If FileExists("Giulio_Caccini_Ave_Maria.mp3") BEFORE the _SoundOpen call says the file exists and yet If Not FileExists($sFile) Then Return SetError(2, 0, 0) WITHIN the UDF returns an error? I am confused! Could you please upload one of the troublesome mp3 files so I can look at it myself. I have found that a corrupt tag structure within the file can prevent it playing, but I have yet to meet one that does not exist within the UDF! M23P.S. You do not need == in your comparison - it forces a case-sensitive string comparison and here we are looking at numeric values. But that should not affect the result of the If statement in this case. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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