Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

SoundPlayClose() to close the sound handle


  • Please log in to reply
12 replies to this topic

#1 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 26 November 2007 - 11:15 PM

Hi,

I reported about SoundPlay() function problem here, and i thought that this is a bug, i understand now (after Valik has explained to me - thanks :P ) that it isn't - but now it would be great to have function like SoundPlayClose() (a proposal from Valik), and the function SoundPlay() should return a handle to the sound file if we use 0 as second parameter (no wait), so later in the script we could close this handle using new func SoundPlayClose(), this will help as to delete the sound file (if needed, if it is a FileInstall'ed temporary file) before we exit the script.

Thanks.
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team








#2 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 01 December 2007 - 08:26 PM

Sound.au3 has _SoundOpen and _SoundClose, look at the helpfile. AutoIt's built in soundplay basically does the same stuff as sound.au3, except does not close the mci alias used. In your case you would use:
#include <sound.au3> $hSound = _SoundOpen("file.mp3") _SoundPlay($hSound) ;rest of script _SoundClose($hSound)


@dev's
Could you possibly tell me the alias AutoIt uses when using SoundPlay? That way I could put it in _SoundClose remarks rather than a new built in function. (Up to you of course).
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.

#3 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,427 posts

Posted 01 December 2007 - 08:42 PM

Sound.au3 has _SoundOpen and _SoundClose, look at the helpfile. AutoIt's built in soundplay basically does the same stuff as sound.au3, except does not close the mci alias used. In your case you would use:

#include <sound.au3> $hSound = _SoundOpen("file.mp3") _SoundPlay($hSound) ;rest of script _SoundClose($hSound)


@dev's
Could you possibly tell me the alias AutoIt uses when using SoundPlay? That way I could put it in _SoundClose remarks rather than a new built in function. (Up to you of course).

"PlayMe" :)

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#4 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 01 December 2007 - 10:46 PM

Sound.au3 has _SoundOpen and _SoundClose, look at the helpfile

I know, thanks, but i thought that the built-in functions (Sound..()) should be able to release the sound handle, so we could use simple SoundPlay() (without including whole library of _Sound...()) and delete the file later.. i think if it Open the handle, it should have some tool to close it.
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#5 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 27 December 2007 - 04:05 PM

*Bump* :)
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#6 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,427 posts

Posted 27 December 2007 - 04:24 PM

What about doing it this way ?

FileCopy(@WindowsDir & "\media\tada.wav", @ScriptDir & "\tada.wav") SoundPlay(@ScriptDir & "\tada.wav", 0) Sleep(5000) SoundPlay("") FileDelete(@ScriptDir & "\tada.wav")

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#7 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 27 December 2007 - 04:54 PM

That's a good idea. We should just document that as the functionality to close a SoundPlay() handle.

#8 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,427 posts

Posted 27 December 2007 - 05:13 PM

That's a good idea. We should just document that as the functionality to close a SoundPlay() handle.

It is also the way to stop the soundfile from playing when submitted in the background so maybe add that too when updating the Helpfile page remarks section?

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#9 DerBen

DerBen

    Seeker

  • Active Members
  • 17 posts

Posted 04 January 2008 - 11:00 PM

A full sound function would be nice,

-Play
-Stop
-Pause/resume
-Length (or time when it will stop by itself)

If there was something like this we could open up way more possibilities.

Work with wavs and mp3's (which I think it does now for soundplay)
Umm, if anyone cares.. I have a website at http://ctg3d.tk where I put other free downloads, as I get time.

#10 JustinReno

JustinReno

    My custom made Vortex.

  • Banned (NOT IN USE)
  • 2,330 posts

Posted 05 January 2008 - 02:50 AM

A full sound function would be nice,

-Play
-Stop
-Pause/resume
-Length (or time when it will stop by itself)

If there was something like this we could open up way more possibilities.

Work with wavs and mp3's (which I think it does now for soundplay)


We already have those. :)

These play Wav, MP3, and I think WMA.

_SoundPlay()
_SoundStop()
_SoundPause()
_SoundResume()
_SoundPos() (I Think)

Edited by JustinReno, 05 January 2008 - 02:50 AM.


#11 DirtDBaK

DirtDBaK

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 978 posts

Posted 05 January 2008 - 04:37 AM

These play Wav, MP3, and I think WMA

Also MIDI
there are:

_SoundOpen
_SoundClose
_SoundPlay
_SoundPause
_SoundSeek
_SoundStop
_SoundLength
_SoundResume
_SoundStatus
_SoundPause

EDIT: along with MIDI there is ogg

Edited by DBak, 05 January 2008 - 04:38 AM.

Posted Image


#12 AdmiralClaws

AdmiralClaws

    Where is the fish?

  • Active Members
  • PipPipPipPipPipPip
  • 4,697 posts

Posted 05 January 2008 - 06:07 PM

EDIT: along with MIDI there is ogg

How did you get it to play ogg??

#13 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 11 January 2008 - 11:24 PM

I've added some remarks in the documentation about SoundPlay(""). Moving this to Complete.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users