ravenfyre Posted July 31, 2004 Share Posted July 31, 2004 I have an interesting problem. It has been a while since I used one of my scripts which uses soundplay to give a sound confirmation that an action took place. I tried the script now and the sounds didn't play. All the files are in mp3 format, so I tried wav next and to my suprise wav played fine. Tried mp3 again, nothing. Filepaths are correct by the way, it just won't play mp3 files anymore. Between the time I used this script last, when it worked perfectly, and now, I installed the new MS Media Player 10 beta. It's possible that has something to do with it, but I thought AutoIt played the sound files itself instead of relying on another program. Any ideas? Link to comment Share on other sites More sharing options...
emmanuel Posted August 2, 2004 Share Posted August 2, 2004 (edited) I too have the ver 10.00.00.3473 beta... Just tried to soundplay an mp3 and it doesn't work for me either...Edit: Once I changed the soundplay to keep wait until the sound was finished to continue the script (one line script) it works.SoundPlay("C:\Program Files\Winamp\demo.mp3",1) Edited August 2, 2004 by emmanuel "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Valik Posted August 2, 2004 Share Posted August 2, 2004 Oh, duh. I forgot to point that out. When I saw the bug-fix for another Soundplay issue, I forgot to point out that when not waiting for the sound to finish playing, the handle to the file will be closed immediately and no sound will play. Although I didn't write the code or introduce the bug, I did see it and forgot to mention it, sorry about that. Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 2, 2004 Administrators Share Posted August 2, 2004 I am so sick of SoundPlay. I swear that it has never worked and every time we try and fix it it just gets worse. I'm just going to cut the thing and be done with it. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 2, 2004 Administrators Share Posted August 2, 2004 Well the bug was that if you played a sound and waited for it to finish and then tried to delete the file you couldn't because it was locked. The only change was to add to "close" after the "wait". And this seems to have broken mp3 playing? It was this: void Util_SoundPlay(const char *szFilename, bool bWait) { AString sMCI; char szBuffer[256]; sMCI = "open "; sMCI += '"'; sMCI += szFilename; sMCI += '"'; sMCI += " alias PlayMe"; mciSendString("status PlayMe mode",szBuffer,sizeof(szBuffer),NULL); if ( !szBuffer[0] == '\0' ) mciSendString("close PlayMe",NULL,0,NULL); if ( mciSendString(sMCI.c_str(),NULL,0,NULL)==0 ) { if (bWait) mciSendString("play PlayMe wait",NULL,0,NULL); else mciSendString("play PlayMe",NULL,0,NULL); } } // Util_SoundPlay() and the non-mp3-playing-current version is this: void Util_SoundPlay(const char *szFilename, bool bWait) { AString sMCI; char szBuffer[256]; sMCI = "open "; sMCI += '"'; sMCI += szFilename; sMCI += '"'; sMCI += " alias PlayMe"; mciSendString("status PlayMe mode",szBuffer,sizeof(szBuffer),NULL); if ( !szBuffer[0] == '\0' ) mciSendString("close PlayMe",NULL,0,NULL); if ( mciSendString(sMCI.c_str(),NULL,0,NULL)==0 ) { if (bWait) { mciSendString("play PlayMe wait",NULL,0,NULL); mciSendString("close PlayMe",NULL,0,NULL); } else mciSendString("play PlayMe",NULL,0,NULL); } } // Util_SoundPlay() So just a single line added in (bWait). Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
emmanuel Posted August 2, 2004 Share Posted August 2, 2004 (edited) I've got the .102 RC installed now... and this works: ;test soundplay SoundPlay("C:\Program Files\Winamp\demo.mp3",0) while 1 sleep(50) Wend Oddly enough, this worked too: SoundPlay("C:\Program Files\Winamp\demo1.mp3", 0) $test = FileMove("C:\Program Files\Winamp\demo1.mp3","C:\Program Files\Winamp\demo.mp3") MsgBox(4096,'debug:' , '$test:' & $test);### Debug MSGBOX yeah, I was able to rename as the file played. Edited August 2, 2004 by emmanuel "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
emmanuel Posted August 2, 2004 Share Posted August 2, 2004 (edited) FileMove is a copy/delete . Did the delete part work? LAr. <{POST_SNAPBACK}>Yes, and it returned a 1 for success on the filemove. Also, as soon as I click OK for the debug it closes the script and stops playing the sound. This is by design, I'm sure, and I'm sure not complaining, just mentioning it. The file is definately moved while still playing. And, just to triple check, it works like this, filedelete while playing: (I'm preserving it with the filecopy, I just enjoy whipping that Lama's ass, don't want to loose that ) $play = "C:\Program Files\Winamp\demo.mp3" SoundPlay($play, 0) $test = FileCopy($play , "C:\Program Files\Winamp\demo1.mp3") MsgBox(4096,'debug:' , '$test:' & $test);### Debug MSGBOX $delete = FileDelete($play) MsgBox(4096,'debug:' , '$delete:' & $delete);### Debug MSGBOX Edited August 2, 2004 by emmanuel "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
ravenfyre Posted August 3, 2004 Author Share Posted August 3, 2004 lol didn't expect so many view/replies for just a soundplay problem, guess it's as buggy as you guys make it out to be ^^ I tried setting the wait command to 1 but unfortunately that didn't help at all. Meh I'll just convert everything back to wav =) Link to comment Share on other sites More sharing options...
tutor2000 Posted August 3, 2004 Share Posted August 3, 2004 I am so sick of SoundPlay. I swear that it has never worked and every time we try and fix it it just gets worse. I'm just going to cut the thing and be done with it. <{POST_SNAPBACK}>Ummm it's part of my workout timer Please please please please keep it Rick Link to comment Share on other sites More sharing options...
this-is-me Posted August 3, 2004 Share Posted August 3, 2004 Just a side note, I love that little rant emoticon. I could watch it all day. Who else would I be? Link to comment Share on other sites More sharing options...
emmanuel Posted August 3, 2004 Share Posted August 3, 2004 lol didn't expect so many view/replies for just a soundplay problem, guess it's as buggy as you guys make it out to be ^^ I tried setting the wait command to 1 but unfortunately that didn't help at all. Meh I'll just convert everything back to wav =) <{POST_SNAPBACK}>could it have something to do with the format of the mp3's? do they play in media player? I'm not having any issues with mine... very odd. I was thinking about how much time I'd thought about this... don't know why I did at all, I've never used soundplay in a script yet. "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
napgravy Posted August 4, 2004 Share Posted August 4, 2004 I think the old way is best. if someone needs to delete a SoundPlayed file they can call SoundPlay with "" or a nonsense file "nonsense.wav". That will free up the file they want to delete. Or add a SoundPlayRelease() command Lar. <{POST_SNAPBACK}>I'm the guy who moaned about not being able to delete a wav file after having just SoundPlay'd it. Had I known that SoundPlay("") would have been an easy work-around to free up the file, I'd have been all over it! It isn't entirely intuitive though - perhaps just add that bit of information to the help file and leave things like they were... Sorry for the trouble! Nap 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