Playing a sound with XPCE
- From: "aliba" <linden@xxxxxxxxxx>
- Date: 20 Oct 2006 09:04:59 -0700
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.
.
- Follow-Ups:
- Re: Playing a sound with XPCE
- From: Jan Wielemaker
- Re: Playing a sound with XPCE
- Prev by Date: Re: SWI-Prolog - search in atoms
- Next by Date: Re: SWI-Prolog - search in atoms
- Previous by thread: SWI-Prolog - search in atoms
- Next by thread: Re: Playing a sound with XPCE
- Index(es):
Relevant Pages
|
|