Jump to content

Soundplay?


Achilles
 Share

Recommended Posts

No I'm joking... that would be a very stupid question. But I do have a question about playing music, I know that in the SoundPlay function the last parameter lets you choose if you want the script to wait for the music to be done before you can move on. However, I'm creating my own media playing system (more to see if I can then any other reason) and I was wondering, how can you tell a the program to play the next song in the list after the current one is done... remember that I don't want it to freeze up the whole thing until the song is done playing. Any help greatly appreciated as always,

Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

?????

couldn't you just use

SoundPlay ("A song", 1)
SoundPlay ("Another song", 1)
Well, I was hoping someone would read the whole paragraph. When the last parameter is set to "1" the whole thing freezes until the song is done. Keeping that in mind, anybody have an ideas concerning my first post.

@Zedna: I don't get what objects are. The examples don't work on my computer either :)

Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

remember that I don't want it to freeze up the whole thing until the song is done playing.

:)

Try using StringSplit on a playlist, and putting that into a For Each loop. You can host the playlist using Adlib (no pun intended):

Right off the top of my head:

; [Assign hotkeys]

; [Assign global player objects]

Main()

Func Main()
; [GUI code]
; [GUI message loop, including handling any buttons, which can be directed to the hotkey-assigned functions also]
EndFunc


Func PlayTheList()
AdlibDisable() ; so it doesn't keep happening
Dim $Playlist=StringSplit(GetPlayList(),@LF)

Local $Song
For $Song In $PlayList
; [Play code]
EndFunc

Func GetPlayList()
; [probably dependent on your GUI]
EndFunc

; ... and the functions for the hotkeys, which will interact with the global player object. For example:
Func Play()
AdlibEnable("PlayTheList", 1000)
EndFunc

Func Pause()
player.Pause()
EndFunc

Edit: Put code in AutoIt tags

Edited by sohfeyr
Link to comment
Share on other sites

:)

Try using StringSplit on a playlist, and putting that into a For Each loop. You can host the playlist using Adlib (no pun intended):

Right off the top of my head:

; [Assign hotkeys]

; [Assign global player objects]

...

Hmm... could I have a simplified version of that please... I'm still kind of new at autoit and I don't get what the Adlib stuff does. I also don't really get how the rest of the stuff would help... I noticed you sort of built your suggestion around the way you though my code would look but it didn't really match so I've decided to post what I have so far. (For those of you who look at it it's pretty much done [for now] except I need to fix the add file part]) The script isn't directly related to the question I have but it might help. I just need to know a way to go to the next song when the one playing is done without freezing the whole thing...

@ Jasio: I saw one person who had some stuff like that but it was very inconsistent as far as the length of the song (at least on my computer)

Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

One (lazy) solution is to have 2 scripts:

Subscript:

#NoTrayIcon
SoundPlay($CmdLineRaw, 1)
ConsoleWrite("Done")oÝ÷ Øö«¶Ìj)Òr¸©µ«­¢+ØÀÌØíM½¹¥¹¥Í ôQÉÕ(ÀÌØíÁ¥ôÀ)]¡¥±Ä((%9}Q=}A1e}M=9Q¡¸(ÀÌØíM½¹¥¹¥Í ô±Í(ÀÌØíÁ¥ôIÕ¸ ÅÕ½ÐíÍÕÍÉ¥ÁйáÅÕ½ÐìµÀìÅÕ½ÐìÅÕ½ÐìµÀí95}=}M=9°ÅÕ½ÐìÅÕ½Ðì°M]}!%°È¤(¹%((ìììIMP=1==@((%MÑI ÀÌØíÁ¥°Ð°QÉÕ¤ôÅÕ½Ðí½¹ÅÕ½ÐìQ¡¸ÀÌØíM½¹¥¹¥Í ôQÉÕ()]¹

#)

Link to comment
Share on other sites

Hmm... could I have a simplified version of that please... I'm still kind of new at autoit and I don't get what the Adlib stuff does. I also don't really get how the rest of the stuff would help... I noticed you sort of built your suggestion around the way you though my code would look but it didn't really match so I've decided to post what I have so far. (For those of you who look at it it's pretty much done [for now] except I need to fix the add file part]) The script isn't directly related to the question I have but it might help. I just need to know a way to go to the next song when the one playing is done without freezing the whole thing...

@ Jasio: I saw one person who had some stuff like that but it was very inconsistent as far as the length of the song (at least on my computer)

Piano_Man

The Adlib was so your GUI didn't freeze while the song was playing (cf dabus), and that way you could have Stop, Pause, etc. buttons that actually do something. Dabus' idea should work too. A "simplified version" would be pretty much the same, but calling PlayTheList directly instead on through the Adlib.

(:) Am I the only one who thinks it altogether fitting and funny to thread a media player with a command called Adlib? Or am I just showing my age?)

If you aren't up to using Adlib, you probably won't be up to using DLLCall, but I'm just throwing this out as a possibility for other people who may look at this topic: check out PlaySound and sndPlaySound in winmm.dll, they have flags that support asynchronous playback. Probably not the best for use in a media player anyways, but it looks like they might be good for games or something.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...