Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I installed Win32::MediaPlayer on Windows 7 and created the following test program based on the Synopsis. The test program operates correctly and the mp3 file is played, but the 'while' loop that keeps the program from ending before the media file is finished playing uses an enormous amount of CPU (25% of my available CPU). Is there another (better) way to make the program wait until the media file has finished playing that is not so CPU intensive? My thanks to all you helpful souls in the Monastery.

#!/usr/bin/perl use strict; use warnings; use Win32::MediaPlayer; my $winmm = new Win32::MediaPlayer; $winmm->load('test1.mp3'); $winmm->play; $winmm->volume(100); while ($winmm->pos < $winmm->length) { # Loop until finished playing media file }

"Its not how hard you work, its how much you get done."

In reply to Media Player - CPU Usage by roho

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (9)
    As of 2017-12-16 15:12 GMT
    Find Nodes?
      Voting Booth?
      What programming language do you hate the most?

      Results (454 votes). Check out past polls.