Greetings fellow Monks,

I'm working on a perl program that will include video playback, speech synthesis, and speech recognition. Using Win32::MultiMedia::Mci, I can playback video, and using Win32::OLE I can produce speech. But, when I try to combine both these features into a single program, the speech works, but the video no longer plays. The video window is black. Here's what the test code looks like:

use strict; use Tk; use Win32::MultiMedia::Mci; use Win32::OLE; use Win32::OLE::Const (".*Speech.*"); my $file = shift || 'test.wmv'; my $mw = MainWindow->new(); my $video_frame = $mw->Frame( -width => 352, -height => 240, -background => 'black' )->pack(-expand => 1); my $voice = Win32::OLE->new('SAPI.SpVoice'); my $spc = Win32::OLE::Const->Load($voice); my $timer = $mw->repeat (3000, sub { $voice->Speak("Wow. I'm multitasking.", $spc->{SVSFlagsAsync}); }); my $mci = Win32::MultiMedia::Mci->open($file, shareable => 1, style => 'child', parent => hex($video_frame->id) ); $mci->play(''); MainLoop();
If I comment out the 5 lines of speech code (the $voice and $timer definitions), then video playback works. My debug efforts so far include:

1. It's not overloading the CPU. When run individually, the video playback is consuming less than 5 percent of the CPU. Running the video and speech together uses less then 15 percent of the CPU (although the video does not display.)

2. It doesn't appear to be a conflict with the sound card. When only the video is playing, I can run an mp3 player in the background, and I hear the sound for both the mp3 player and the video. When only the speech is playing, I can also hear the mp3 player. So neither feature is claiming exclusive ownership of the sound port.

3. I've tried running the speech engine in synchronous and asynchronous modes. Neither helps the missing video.

4. If I comment out the $timer lines, so that the $voice is instantiated but not used, this still prevents video playback.

Any suggestions on what would cause this conflict?

Thanks,
TROGDOR

In reply to Conflict between Win32::MultiMedia::Mci and Win32::OLE by TROGDOR

Title:
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, details, 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, summary, 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.