AutoHotkey Community

It is currently May 27th, 2012, 1:21 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: August 18th, 2008, 1:42 am 
Offline

Joined: June 7th, 2008, 6:00 am
Posts: 389
What I did was write a simple media player that uses no CPU usage at all... With one problem. When a song ends, I have to manually start the next one.

Is there something like:

Code:
Loop
{
     SoundPlay, C:\Song%Num%.MP3
     WaitSoundPlayDone
     Num += 1
}


Of course, it doesn't look like this, but is there a way to detect when it's not playing anymore and still use low CPU usage?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 18th, 2008, 5:37 am 
Offline

Joined: June 26th, 2008, 3:58 am
Posts: 56
Perhaps something along the lines of this
Code:
Start:
  SetTimer, PlaySong, -1
  return

PlaySong:
  SongIsDone := false
  SetTimer, CheckIfDone, 100
  SoundPlay, C:\Song%Num%.MP3, Wait
  SongIsDone := true
  return

CheckIfDone:
  if SongIsDone
    {
    Num++
    SetTimer, CheckIfDone, Off
    Gosub, Start
    }
  return

Maybe someone else has a simpler idea


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 18th, 2008, 6:37 am 
Offline

Joined: June 7th, 2008, 6:00 am
Posts: 389
I had already considered the idea of a timer, but they tend to start to use CPU usage, which is what I'm mainly trying to avoid.

It's a full media player and uses 0% of mine evn while playing and cycling music. The point is for using it while gaming to reduce lag and skipping.


EDIT: Wait... Does SoundPlay,,Wait actually wait until the song is done before continuing? I could use that!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 18th, 2008, 9:03 am 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
Wicked wrote:
EDIT: Wait... Does SoundPlay,,Wait actually wait until the song is done before continuing? I could use that!


Yup! That is exactly what you should use in this situation.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, chaosad, oldbrother and 18 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group