on react move target rel 1,1 wait 10 ticks move target rel -1,-1 end react
---------------------------Disables QT: on mouseUp react set dontUseQT to true get the dontUseQT if true then answer "QT is not in use" else answer "QT is still in use" end mouseUp
--------------------Check if mciSendString is installed:
on sjekkeMCI react put "This computer probably lacks recording options." into line 1 of temp put "Check the presence of Windows Multimedia Tools." into line 2 of temp
put "This can be done by searching for the file 'mciwave.drv'." into line 3 of temp
put "More info about 'mciSendString': " into line 5 of temp
put "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_mcisendstring.asp" into line 7 of temp
put temp into svar
put specialfolderpath("system") into t
put "/system/mciwave.drv" after t
if there is not file t then answer svar
else
--Lists all devices:
put mciSendString("sysinfo all quantity") into xMax
#put empty into fld "deviceNames"
put empty into tDeviceNames
repeat with x = 1 to xMax
put "sysinfo all name" && x into commandString
# put mciSendString(commandString) & return after fld "deviceNames"
put mciSendString(commandString) & return after tDeviceNames
end repeat
#answer tDeviceNames
if "WaveAudio" is not in tDeviceNames then answer svar
else answer "Windows Multimedia Tools is available."
end if
end sjekkeMCI
----------------Finds the folder in which you store the audiofile ----------------and gives it a name
on mouseUp
global tFile --short name of the file, for instance "mySound.wav" global tLongPath --long name of file:"C:/.../.../SoundFolder/"mySound.wav"
answer folder "Save into which folder:" if it is empty or the result is "Cancel" then exit mouseUp put it into tFolder ask "Save as wave file:" with "----.wav" if it is empty or the result is "Cancel" then exit mouseUp put it into tFile put tFolder & "/" & tFile into tLongPath answer tLongPath end mouseUp
function myMCI tstring put mciSendString(tstring) into returnValue get the result if the result is not empty then return "error" else return returnValue end if end myMCI
-------------------------Records the sound: on RecordAudio
--Startvar: global tFile
react put 1500 into max_time get mcirecord(tFile, max_time) end RecordAudio
function mcirecord tFile, max_time get mymci("close myaudio") put "open new type waveaudio alias myaudio" into tstring get myMCI(tstring) if it is "error" then return "error -- opening part" exit mcirecord end if
--TIMEFORMAT get mymci("set myaudio time format milliseconds") if mymci("record myaudio") is not empty then get mymci("close all") return "error -- record part" exit mcirecord end if
end mcirecord
---------------------- Stops and saves the audio file to disk on stopRecording
--Viderevar: global tLongPath
react get mymci("stop") put "save myaudio " & quote & tLongPath & quote into x get mymci(x) return it end stopRecording
--------------------------Plays the audio file with mciSendString on listen global tFile, tLongPath
react if there is a file tLongPath then get playmysound(tFile) end listen
function playmysound tFile
get myMCI("close myaudio")
--OPEN
put "open"&& quote& tLongPath & quote&& "type waveaudio alias myaudio" into tstring
get myMCI(tstring)
--GET LENGTH
put myMCI("status myaudio length") into ttime
if ttime is "error" or ttime is not a number then
put 0 into ttime
return ttime
end if
--PLAY
if myMCI("play myaudio from 0") is "error" then
return 0
end if
return ttime
put ttime
end playmysound
----------------------------- Stops playing the audio file: on stopPlaying react get myMCI("close myaudio") end stopPlaying _______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution