Playing a sound with XPCE



The following sample code shows two colored rectangles in a window. By
clicking on either rectangle a letter ( "a" and/or "o" in this example)
appears within one of the rectangles and its corresponding sound can be
heard:


go:-

new(W, window('xxxxx')),
send(W,background,colour(black)),
send(W,size, size(850,500)),


send(W, display,
new(B1, box(75,25)), point(35,20)),
send(B1, fill_pattern, colour(white)),
send(B1, recogniser,
click_gesture(left, '', double,
message(@prolog, message_a, W))),
win_shell(open, 'C:/WINDOWS/Media/a.wav', hide),

send(W, display,
new(B2, box(75,25)), point(135,20)),
send(B2fill_pattern, colour(blue)),
send(B2, recogniser,
click_gesture(left, '', double,
message(@prolog, message_o, W))),
..., win_shell(open,'C:/WINDOWS/Media/o.wav',hide),

send(W, open).


message_a(W) :-
new(Tx1, text('a')),
send(W, display, Tx1, point(75,25)),
send(W, display, Tx1, point(55,20)).
message_o(W) :-
new(Tx2, text('o')),
send(W, display, Tx2, point(160,25)).
....

However, this is not satisfactory for the following reasons: 1) It
takes between ten and twenty seconds for the sound to be heard (the
sound should be heard at the same time, or very shortly after its
corresponding letter appears on the screen). 2) The "hide" option in
"win_shell/3" doesn't always function under WindowsXP.

Any suggestion for improving this code would be welcome.

.



Relevant Pages

  • Re: Tech / help: MM display and power issue... AAarrrghh!
    ... see the test report which said "sound board error". ... (Corrupted data on the display chips? ... DMD stays dark and the only lights that come on are the coin mech ... Looking online seemed to suggest that some of the sound/display chips ...
    (rec.games.pinball)
  • Re: Twilight Zone problem: Boots but no attract mode
    ... I tried booting up the game by pulling the ribbon cables for the sound, ... display, etc, but no luck. ...
    (rec.games.pinball)
  • Re: Sound question for SKATEBALL owners
    ... >> have where the sound options are not on the mpu switches. ... > display not the player displays. ... I also think this is the same for the actual game. ...
    (rec.games.pinball)
  • last action hero, lightning damage
    ... The game boots up normal minus the sound, ... the first screen with the display version then goes blank. ... sound at all unless i unplug the data cable going to the sound board ... magnetic damage to the tube, fried a computer motherboard(looked at it ...
    (rec.games.pinball)
  • DVB/ATSC Sample Code
    ... Does anyone have any suggestions for pointing me to some sample code ... I would like to be able to display a non digital channel (i.e. channel ... Multiple digital TV cards (MyHD PCI, ...
    (microsoft.public.win32.programmer.directx.video)