home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 3
/
Meeting_Pearls_III.iso
/
Pearls
/
mus
/
Maestix
/
demos
/
AnalyzeInput.s
< prev
next >
Wrap
Text File
|
1995-02-25
|
5KB
|
170 lines
*****************************************************************
* *
* maestix.library-Demo: AnalyzeInput *
* *
*****************************************************************
*
* Programmed by Richard Körber
* Date 1995-01-30
*
*****************************************************************
* This demonstration shows the basic functions of the maestix *
* library. It allocates the Maestro soundcard, select the de- *
* fault input and shows wether there is a signal, and if so, *
* it analyzes the rate, source and emphasis bits. *
*****************************************************************
INCDIR "include:"
INCLUDE exec.i ; Library call macros
INCLUDE dos.i
INCLUDE maestix.i
INCLUDE libraries/maestix.i ;Reference includes
SECTION text,CODE
*---------------------------------------------------------------*
* == START OF PROGRAM == *
* *
start ;-- Open all libraries -----------------;
lea maestname(PC),a1 ;maestix
moveq #35,d0 ; V35+
exec OpenLibrary ; open
move.l d0,maestbase ; store base
beq error1 ; not found!
lea dosname(PC),a1 ;dos for output
moveq #0,d0 ; all versions
exec OpenLibrary ; open
move.l d0,dosbase ; store base
beq error2 ; not found!
;-- Open STDOUT ------------------------;
dos Output ;get STDOUT
move.l d0,stdout
beq error3
;-- Allocate Maestro -------------------;
sub.l a0,a0 ;no tags
maest AllocMaestro
move.l d0,maestro ;^Maestro base
beq error3
lea msg_allocated(PC),a0
bsr print
;-- Set Modus --------------------------;
move.l maestro(PC),a0 ;^Maestro base
lea modustags(PC),a1 ;^Modus tags
maest SetMaestro ;set it now
lea msg_modusset(PC),a0
bsr print
;-- Read Status ------------------------;
move.l maestro(PC),a0 ;^Maestro base
moveq #MSTAT_Signal,d0 ;signal on input?
maest GetStatus ;get the card status
tst.l d0
bne.b .foundsig
lea msg_nosignal(PC),a0 ;no there is no signal
bsr print
bra exit ;leave
;-- Read Input Status ------------------;
.foundsig lea msg_sigfound(PC),a0 ;signal found
bsr print
move.l maestro(PC),a0 ;^Maestro base
moveq #MSTAT_Emphasis,d0
maest GetStatus ;get the input status
tst.l d0
bne.b .emphused
lea msg_no(PC),a0 ;no emphasis used
bsr print
.emphused lea msg_emphasis(PC),a0
bsr print
move.l maestro(PC),a0
moveq #MSTAT_CopyProh,d0
maest GetStatus
tst.l d0
bne.b .prohibit
lea msg_no(PC),a0 ;not prohibited
bsr print
.prohibit lea msg_prohibit(PC),a0
bsr print
move.l maestro(PC),a0
moveq #MSTAT_DATsrc,d0
maest GetStatus
tst.l d0
bne.b .datsrc
lea msg_no(PC),a0 ;no dat source
bsr print
.datsrc lea msg_datsource(PC),a0
bsr print
move.l maestro(PC),a0
moveq #MSTAT_Rate,d0
maest GetStatus
cmp.l #44100,d0
bne.b .not441
lea msg_44100hz(PC),a0 ; yep: show it
bsr print
bra exit ; and exit
.not441 cmp.l #48000,d0 ;48 kHz or 32 kHz?
bne.b .is32
lea msg_48000hz(PC),a0 ; is 48kHz
bsr print
bra exit
.is32 lea msg_32000hz(PC),a0 ; is 32kHz
bsr print
;-- Exit program -----------------------;
exit move.l maestro(PC),a0 ;Free Maestro
maest FreeMaestro
lea msg_freed(PC),a0
bsr print
error3 move.l dosbase(PC),a1 ;close dos library
exec CloseLibrary
error2 move.l maestbase(PC),a1 ;close maestix library
exec CloseLibrary
error1 moveq #0,d0 ;Reply 0
rts ;back to CLI
;-- Tags -------------------------------;
modustags dc.l MTAG_Input,INPUT_STD ;use standard input
dc.l MTAG_Output,OUTPUT_BYPASS
dc.l TAG_DONE
*-------------------------------------------------------*
* print Print some text to STDOUT *
* -» A0.l ^string, 0-terminated *
* *
print movem.l d0-d3/a0-a3,-(sp)
move.l stdout(PC),d1 ;prepare output
move.l a0,d2
moveq #-1,d3 ;get string length
.scanend addq.l #1,d3
tst.b (a0)+
bne.b .scanend
dos Write ;print to Stdout
movem.l (sp)+,d0-d3/a0-a3
rts
*---------------------------------------------------------------*
* == DATA SECTION == *
* *
maestbase dc.l 0 ;^Maestix Lib Base
dosbase dc.l 0 ;^Dos Lib Base
stdout dc.l 0 ;^Output FH
maestro dc.l 0 ;^Maestro Base
msg_allocated dc.b "** allocated maestro",$a,0
msg_modusset dc.b "** set modus",$a,$a,0
msg_nosignal dc.b "No signal on standard input",$a,0
msg_sigfound dc.b "Signal found on standard input",$a,$a,0
msg_no dc.b "no ",0
msg_emphasis dc.b "emphasis",$a,0
msg_prohibit dc.b "copy prohibition",$a,0
msg_datsource dc.b "DAT source",$a,0
msg_44100hz dc.b "rate: 44100 Hz",$a,0
msg_48000hz dc.b "rate: 48000 Hz",$a,0
msg_32000hz dc.b "rate: 32000 Hz",$a,0
msg_freed dc.b $a,"** freed maestro",$a,0
maestname dc.b "maestix.library",0 ;Maestix name
dosname dc.b "dos.library",0 ;Dos name
even
*---------------------------------------------------------------*
* == END == *
* *
END