home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / mus / Maestix / demos / CSBchanger.s < prev    next >
Text File  |  1995-02-23  |  4KB  |  122 lines

  1. *****************************************************************
  2. *                                *
  3. *    maestix.library-Demo:    CSBchanger            *
  4. *                                *
  5. *****************************************************************
  6. *
  7. *    Programmed by        Richard Körber
  8. *    Date            1995-02-01
  9. *
  10. *****************************************************************
  11. *  This  demonstration  shows the  basic encoder  functions of  *
  12. *  the  maestix library.  It allocates the  Maestro soundcard,  *
  13. *  decodes the incoming signal  and encodes it again using new    *
  14. *  channel status bits.  In this example,  the copy protection    *
  15. *  will be removed.                        *
  16. *****************************************************************
  17.  
  18.         INCDIR    "include:"
  19.         INCLUDE    exec.i            ; Library call macros
  20.         INCLUDE    intuition.i
  21.         INCLUDE    graphics.i
  22.         INCLUDE    dos.i
  23.         INCLUDE    maestix.i
  24.         INCLUDE    libraries/maestix.i    ;Reference includes
  25.         INCLUDE    intuition/intuition.i
  26.         INCLUDE    dos/dostags.i
  27.         INCLUDE    exec/ports.i
  28.  
  29.         SECTION text,CODE
  30.  
  31. *---------------------------------------------------------------*
  32. *    == START OF PROGRAM ==                    *
  33. *                                *
  34. start    ;-- Open all libraries -----------------;
  35.         lea    maestname(PC),a1    ;maestix
  36.         moveq    #35,d0            ; V35+
  37.         exec    OpenLibrary        ; open
  38.         move.l    d0,maestbase        ; store base
  39.         beq    error1            ; not found!
  40.         lea    intuiname(PC),a1    ;intuition
  41.         moveq    #36,d0            ; V36+
  42.         exec    OpenLibrary        ; open
  43.         move.l    d0,intuibase        ; store base
  44.         beq    error2
  45.     ;-- Allocate Maestro -------------------;
  46.         sub.l    a0,a0            ;no tags
  47.         maest    AllocMaestro
  48.         move.l    d0,maestro        ;^Maestro base
  49.         beq    error3
  50.     ;-- Set Modus --------------------------;
  51.         move.l    maestro(PC),a0        ;^Maestro base
  52.         lea    modustags(PC),a1    ;^Modus tags
  53.         maest    SetMaestro        ;set it now
  54.     ;-- Open a window ----------------------;
  55.         sub.l    a0,a0            ;no newwindow struct
  56.         lea    windowtags(PC),a1    ; but loads of tags
  57.         intui    OpenWindowTagList
  58.         move.l    d0,window
  59.         beq    error4
  60.     ;-- Wait for reply (main loop) ---------;
  61. .mainloop    move.l    window(PC),a0        ;window message?
  62.         move.l    wd_UserPort(a0),a0    ; ^message port
  63.         exec    WaitPort
  64. .nextmsg    move.l    window(PC),a0        ;window message?
  65.         move.l    wd_UserPort(a0),a0    ; ^message port
  66.         exec    GetMsg            ; try to get it...
  67.         tst.l    d0            ; got one?
  68.         beq.b    .mainloop        ; nope: wait for next msg
  69.     ;---- got a window event ---------------;
  70.         move.l    d0,a0            ;^IDCMP-message -> a0
  71.         cmp.l    #IDCMP_CLOSEWINDOW,im_Class(a0) ;close window?
  72.         bne.b    .nextmsg        ; no -> look for next msg
  73.     ;-- Exit program -----------------------;
  74. exit        move.l    window(PC),a0        ;Close output window
  75.         intui    CloseWindow
  76. error4        move.l    maestro(PC),a0        ;Set maestro free
  77.         maest    FreeMaestro
  78. error3        move.l    intuibase(PC),a1    ;close intuition library
  79.         exec    CloseLibrary
  80. error2        move.l    maestbase(PC),a1    ;close maestix library
  81.         exec    CloseLibrary
  82. error1        moveq    #0,d0            ;Reply 0
  83.         rts                ;back to CLI
  84.  
  85. *---------------------------------------------------------------*
  86. *    == DATA SECTION ==                    *
  87. *                                *
  88. maestbase    dc.l    0            ;^Maestix Lib Base
  89. intuibase    dc.l    0            ;^Intuition Lib Base
  90. maestro        dc.l    0            ;^Maestro Base
  91. window        dc.l    0            ;^Window structure
  92.  
  93. modustags    dc.l    MTAG_Output,OUTPUT_INPUT ;Input -> Output
  94.         dc.l    MTAG_Input,INPUT_STD     ;Custom input
  95.         dc.l    MTAG_CopyProh,CPROH_OFF  ;No copy protection
  96.         dc.l    MTAG_Emphasis,EMPH_INPUT ;Emphasis see input
  97.         dc.l    MTAG_Source,SRC_INPUT     ;Source see input
  98.         dc.l    MTAG_Rate,RATE_INPUT     ;Rate see input
  99.         dc.l    TAG_DONE
  100.  
  101. windowtags    dc.l    WA_IDCMP,IDCMP_CLOSEWINDOW ;<- New window's tags
  102.         dc.l    WA_Title,.title
  103.         dc.l    WA_InnerWidth,150
  104.         dc.l    WA_InnerHeight,0
  105.         dc.l    WA_DragBar,-1
  106.         dc.l    WA_DepthGadget,-1
  107.         dc.l    WA_CloseGadget,-1
  108.         dc.l    WA_Activate,-1
  109.         dc.l    WA_RMBTrap,-1
  110.         dc.l    TAG_DONE
  111. .title        dc.b    "CSBchanger",0
  112.         even
  113.  
  114. maestname    dc.b    "maestix.library",0    ;Maestix name
  115. intuiname    dc.b    "intuition.library",0    ;Intuition name
  116.         even
  117.  
  118. *---------------------------------------------------------------*
  119. *    == END ==                        *
  120. *                                *
  121.         END
  122.