News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Program's starting priority

Started by sinsi, October 29, 2007, 10:50:56 AM

Previous topic - Next topic

sinsi

Is there a way of starting a program in XP Home at a different priority?
I like to listen to my music when I play a game, so here's what I do:
- open "Shortcut to latest.wpl" which starts windows media player to play my mp3's
- run a program I wrote which can play/pause/skip/back WMP
- start task manager and change WMP's priority to above normal, since there are loooooong delays when playing the next song
- start a game

Now my little program can change WMP's priority if I need to, but if there is a simple box to be checked that would save poor lazy me writing some (superfluous) code.
Light travels faster than sound, that's why some people seem bright until you hear them.

Tedd

If task manager is available in XP Home - open it, view the process list, right-click on the chosen process -> set priority, ... bingo.
If not, I'm pretty sure there are various programs to do the same.
No snowflake in an avalanche feels responsible.

sinsi

Ummm...that was my step 3
Quote from: sinsi on October 29, 2007, 10:50:56 AM
- start task manager and change WMP's priority to above normal, since there are loooooong delays when playing the next song
Light travels faster than sound, that's why some people seem bright until you hear them.

Tedd

No snowflake in an avalanche feels responsible.

Mark Jones

This is an interesting idea. A friend is an avid video producer, and he uses Vegas Pro -- the newer versions of that program start with REALTIME priority, which needless to say, really locks up the computer hard. Some video renderings take a day or more to complete, so this basically means that the computer is totally useless during this time (if he forgot to change vegas.exe priority beforehand.) This is frankly, a stupid design consideration IMHO, and the vendor (Sony) has no work-around for it.

Obviously task manager is able to set a thread's priority. Perhaps it is just a matter of locating the desired thread and issuing it a SetThreadPriority,hThread,intPriority command. Details explained in Win32.hlp.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Ehtyar


u

How about solving the problem from its roots? WMP shouldn't be taking long between songs,  so why not use another player like Winamp? Simply assign hot-keys. Mine are: Numpad5 = play/pause; Ctl+Alt+PgDown = next song; Ctl+Alt+PgUp = previous song; Ctl+Alt+End = stop; Ctl+Alt+Down = volume down; Ctl+Alt+Up = volume up.
I always have winamp5 running, and continuing to play is simply done by pressing Numpad5, regardless if I'm in-game or not. Response is immediate. (though, I consider my PC a beast with its Sempron3000+ and 1GB RAM). Btw, Winamp5 has a Priority-Class setting in its options.

I think WMP takes too long between songs, because maybe on song-end it unloads the DirectShow filter for mp3 decoding, then on song-start it loads ALL filters and asks each of them "here's the file, can you read it", then opens DirectSound, then builds an audio-graph (network) of filters around it to feed DirectSound with data. There could be a codec that you've installed, which when asked "can you read this file" does a lot of processing, or is somehow missing and Windows searches for it all around. (in ControlPanel's "Sounds and Multimedia" -> Hardware, check all audio and video codecs for their Properties, to see whether some are corrupted, remove the corrupted ones). Meanwhile, WinAmp has just a few input plugins, with filename being a criterion for "can you read this file", and they're always loaded, except for the directshow plugin which is has lowest priority.
Please use a smaller graphic in your signature.

Mark Jones

Speaking of audio players which are more customizable, check out: http://www.foobar2000.org/

The engine has separate priority controls for each step of the audio rendering process, if I recall correctly. In any case though, it plays great on my system, with zero gap between songs. (Some configuration required.)

Quote from: Ehtyar on October 29, 2007, 07:38:53 PM
I use ProcessTamer for this kind of thing.

Very nice program! I'll be sure to pass that info on. This is one tool which should be in everyone's toolbox. :U
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

sinsi

Thanks for the ideas. I didn't really consider another player (I was looking at it purely as a programming problem - how blinkered  ::)), but I am trying winamp and foobar now.
Light travels faster than sound, that's why some people seem bright until you hear them.

sinsi

Mark: yes, foobar2000 is the way to go. Cheers :U

Configurable global keys...fairly small memory peak (~10M)... :bg
Light travels faster than sound, that's why some people seem bright until you hear them.