Computer Science Canada

Help with sounds! Urgent! help ASAP!

Author:  chibitenshi_03 [ Thu Jan 15, 2004 7:44 pm ]
Post subject:  Help with sounds! Urgent! help ASAP!

i have a program that is due tomorrow and i need a lot of help! i'm new to turing so i need help PLZ!
i have a box that is used for the draw,coloring ect. but i want to make it so that everytime the user draws outside the border then there would be sounds.

Author:  Mazer [ Thu Jan 15, 2004 7:50 pm ]
Post subject: 

code:

Music.PlayFile("filename.wav") % to play a wav file
% OR
Sound (frequency, duration) % frequency and duration both integer, make a sound

Author:  chibitenshi_03 [ Thu Jan 15, 2004 7:54 pm ]
Post subject: 

umm i kno the code for playing a sound but i don't know how to make it so that when the user touches the border there's a sound?

Author:  Mazer [ Thu Jan 15, 2004 8:03 pm ]
Post subject: 

You want it to play a sound when the user goes outside the border? Yikes. Well, all you'd need to do is check for the mouse coordinates and compare them to the coordinates of the drawing area.

code:

% X1, Y1 - bottom left corner of drawing area
% X2, Y2 - top right corner of drawing area
% mx, my - mouse coordinates
if mx <= X1 and mx >= X2 and my <= Y1 and my >= Y2 then
    % play your sound here
end if

But keep in mind, that every time the mouse goes out of the drawing area, constantly playing the sound until the mouse goes back within the specified borders. You might want to set it up so that it plays a sound when the mouse first leaves the drawing area, and plays again only if the mouse goes back inside and leaves again. Especially if you use turings sound command, which can be brutally painful.

Author:  shorthair [ Thu Jan 15, 2004 8:33 pm ]
Post subject: 

Good call by mazer , dont make hte user sit through those damn resinating frequencys, at least use an mp3 or somthing

Author:  chibitenshi_03 [ Thu Jan 15, 2004 9:59 pm ]
Post subject: 

thanks a lot mazer!! Surprised


: