home *** CD-ROM | disk | FTP | other *** search
- /*Sound use example*/
-
- /* a little setup*/
- soundobj=''
- volume=48
-
- /* build the gui*/
- call open(ca,'awnpipe:test/xc')
- call topipe('"Sound Player" defg fh v m ')
- call topipe('bitmap fn "speaker.ilbm" trans')
- volumegad=topipe('slider ui v minn 0 maxn 64 s 48 dis 1')
- call topipe('layout si so')
- newgad=topipe('button gt "Select Sound"')
- playgad=topipe('button gt "Play" dis 1')
- stopgad=topipe('button gt "Stop" dis 1')
- quitgad=topipe('button gt "Quit"')
- call topipe('le')
- call topipe('bitmap fn "wave.ilbm" trans')
- freqgad=topipe('slider ui v minn 1 maxn 1000 s 32 flip dis 1')
- call topipe('layout si so b 0')
- call topipe('space')
- call topipe('label gt "Volume changes only take place*nimmediately under ADOS 3.5" ')
- call topipe('space')
- call topipe('le')
- filegad=topipe('getfile asl ')
- call topipe('open')
- /* main loop*/
- do while ~eof(ca)
- call topipe('con')
- in= readln(ca)
- parse var in in1 in2 in3 in4 in5 .
- if in1='gadget' then call gadget()
- if in1='close' then do
- exit
- end
- end
- exit
-
- gadget:
- if in2=newgad then do
- call writeln(ca,'id 'filegad' s 1')
- parse value readln(ca) with ok '"' filename '"'
- if ok=0 then return(0)
- call writeln(ca,'define sound volume 'volume' fn "'filename'"')
- parse value readln(ca) with ok newsoundobj
- if ok~='ok' then return
- if soundobj~='' then call topipe('id 'soundobj' freesound')
- soundobj=newsoundobj
- period=x2d(topipe('id 'soundobj' get 800011f8'))
- call topipe('id 'freqgad' s 'period' ref ')
- call topipe('id 0 dis 0 ref')
- end
- if in2=quitgad then do
- exit
- end
- if in2=playgad then do
- call topipe('id 'soundobj' s 2 volume 'volume' period 'period)
- end
- if in2=stopgad then do
- call topipe('id 'soundobj' freesound')
- soundobj=topipe('define sound fn "'filename'"')
- end
- if in2=volumegad then do
- volume=in3
- call topipe('id 'soundobj' volume 'in3)
- end
- if in2=freqgad then do
- period=in3+1
- call topipe('id 'soundobj' s 2 period 'period)
- end
- return(0)
-
-
- topipe:
- parse arg out
- call writeln(ca,out)
- res=readln(ca)
- parse var res res1 res2 .
- if res1='ok' then return(res2)
- say 'error from: 'out
- say ' responce: ' res
- exit
-
-