Solved

Higher program importance

Posted on 2004-04-16
6
269 Views
Last Modified: 2010-04-05
Hi

    I've built myself an ACE little music player, which works brilliantly except when my computer gets busy (for example opening Delphi) when it pauses or stops playing? Is there any way around this? Can I set my program to have higher importance? So it wont get interrupted by heavy CPU usage?

Thanks in advance

David Birch
0
Comment
Question by:DavidBirch2dotCom
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 75 total points
ID: 10841248
Hi,
try this

SetPriorityClass( GetCurrentProcess,ABOVE_NORMAL_PRIORITY_CLASS);
or
SetPriorityClass( GetCurrentProcess,HIGH_PRIORITY_CLASS);
or
SetPriorityClass( GetCurrentProcess,REALTIME_PRIORITY_CLASS);
0
 
LVL 7

Author Comment

by:DavidBirch2dotCom
ID: 10841266
thanks mokule

when should i call that?

which would you suggest for a music player?

what is realtime?

David

0
 
LVL 17

Expert Comment

by:mokule
ID: 10841310
When?
Before start playing

You must try what give You best results. Though REALTIME_PRIORITY_CLASS rather not.


REALTIME_PRIORITY_CLASS

Process that has the highest possible priority. The threads of the process preempt the threads of all other processes, including operating system processes performing important tasks. For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or cause the mouse to be unresponsive

More read there

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setpriorityclass.asp
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 7

Author Comment

by:DavidBirch2dotCom
ID: 10841333
ok i wondered if i might need to call it in the project source part. Realtime sounds very dangerous so i will go with ,HIGH_PRIORITY which works great!

thanks

Mokule
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10841347
 The values are :

  1) REALTIME_PRIORITY_CLASS
  2) HIGH_PRIORITY_CLASS
  3) ABOVE_NORMAL_PRIORITY_CLASS
  4) NORMAL_PRIORITY_CLASS
  5) BELOW_NORMAL_PRIORITY_CLASS
  6) IDLE_PRIORITY_CLASS


  You can see in Winamp options that there is option for REAL TIME PRIORITY, but :
     1) It is not recommended
     2) Don't help

  The problem is in the way Windows manages the drives. It you read/write to HDD, CD Winmdmt.exe process takes very high CPU time.

   I don't agree with module that real time priority is good. It will cause you system to stuck for few moments. In my opinion the system processes are more important that yours, so you should let it function normally.

   Quote mokule :
   "For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or cause the mouse to be unresponsive"...

   It can slow your mouse and disk activity - not good idea....

0
 
LVL 17

Expert Comment

by:mokule
ID: 10841392
Hi Ivanov

I've never said that real-time will be good.

You can find also this my quote :)
"You must try what give You best results. Though REALTIME_PRIORITY_CLASS rather not."
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question