Visual Basic Titler for Sharp Recorders

Trucki ([email protected])

I wrote this program in Qbasic to title tracks on Sharp's MD-MT15. My program is based upon the (Sharp titling system from Thomas Meier) and requires his hardware. There is only one problem: Everytime the PC enters a character for you, you have to press the Enter/sync button on the MD. (Everytime you have to press it, the program gives you an audible signal.)


' TitleAid MD-MT15
' Program for remote control and title input on the
' Sharp MD-Recorder MD-MT15
' Trucki, Germany, M�nchen, 10.07.2000 / QuickBasic 1.1
' with help of Thomas H. Meier�s TitleAid 70x
'
' Hardware from www.mannheim-netz.de/user/meierth/MD70X.html
' Key:          Resist. output value
' none pressed  212k    &HF8
' Play Mode      72k    &HF7
' Display        50k5   &HF6
' Bass           35k5   &HF5
' Minus-Key (-)  25k5   &HF4
' Plus-Key (+)   18k6   &HF3
' Rewind <--     14k    &HF2
' Forward -->    10k    &HF1
' Stop           6k8    &HF0

CONST none% = &HF8
CONST mode% = &HF7
CONST disp% = &HF6
CONST bass% = &HF5
CONST minus% = &HF4
CONST plus% = &HF3
CONST rew% = &HF2
CONST forw% = &HF1
CONST stopp% = &HF0
          
' Get PrinterPort Address
DEF SEG = 64                            ' BIOS - DataSegment
lptdat% = PEEK(&H9) * 256 + PEEK(&H8)   ' get address of LPT1:
DEF SEG = 0                             ' Return to 0-Segment

maxloop = 10
PRINT "Please stand by !"
PRINT "Calibrating delay loop ";
calib:
PRINT ".";
'du$ = INKEY$
start = TIMER
FOR i = 1 TO maxloop: NEXT i
finish = TIMER
gone = finish - start                   ' choose a good period:
IF gone < 3! THEN maxloop = maxloop * 10: GOTO calib
cycles = maxloop / gone
delay = INT(cycles / 20)                ' one keytouch takes 2*1/10sec

' Init hardware of MD-Remote            ' none% = &HF8
send% = none%                           ' &HFx for voltage supply
GOSUB sendremote                        ' &Hx8 for "No key pressed"

char$ = "X"

WHILE char$ <> "E"
CLS
PRINT "Minimal Control (Delay="; delay; ")"
PRINT "==============="
PRINT "Stop       s     Playmode    p"
PRINT "Forward -> v     Bass        b"
PRINT "Back <-    z     Display     d"
PRINT "Plus       +     Minus       -"
PRINT "End        E     Write Title w"
IF silent = 0 THEN PRINT "Quiet Mode is off:     press q ";
IF silent = 1 THEN PRINT "Quiet Mode is on:      press q ";

DO                                      ' wait for key
char$ = INKEY$
LOOP UNTIL char$ <> ""

SELECT CASE char$
      
       CASE "s"
       send% = stopp%
       GOSUB sendremote
      
       CASE "v"
       send% = forw%
       GOSUB sendremote
     
       CASE "z"
       send% = rew%
       GOSUB sendremote
      
       CASE "+"
       send% = plus%
       GOSUB sendremote
     
       CASE "-"
       send% = minus%
       GOSUB sendremote
     
       CASE "b"
       send% = bass%
       GOSUB sendremote
     
       CASE "d"
       send% = disp%
       GOSUB sendremote
     
       CASE "p"
       send% = mode%
       GOSUB sendremote
      
       CASE "w"
       GOSUB WriteTitle
      
       CASE "q"
       IF silent = 0 THEN silent = 1 ELSE silent = 0
      
       CASE "E"
       send% = &HF8
       GOSUB sendremote
       CLS
       END

END SELECT
WEND                                            ' end of main loop


' *************** subroutines *********************

sendremote:
OUT (lptdat%), send%                            ' press key ...
FOR i = 1 TO delay: NEXT i
OUT (lptdat%), none%                            ' ... and release it !
FOR i = 1 TO delay: NEXT i
RETURN


WriteTitle:
name$ = ""
CLS
PRINT CHR$(7)
PRINT "Press MDs EDIT key for Track/Disk name"
PRINT "Press MDs ENTER key for start input"
PRINT "Press MDs ENTER key if you hear / see signal"
PRINT "Please type in the name (max. 100 chars)"
PRINT "---------- (Display length)"
DO
  DO
    du$ = INKEY$
  LOOP UNTIL du$ <> ""
  'PRINT du$,
  'a$ = du$ + " "
  'PRINT ASC(a$)
  IF du$ = CHR$(8) THEN name$ = LEFT$(name$, LEN(name$) - 1): GOTO backout
  IF du$ = CHR$(13) THEN GOTO goon
  'Filtering Characters and Numbers:
  IF (ASC(UCASE$(du$)) > 31 AND ASC(UCASE$(du$)) < 91) OR (ASC(du$) = 95 OR ASC(du$) = 96) THEN
  name$ = name$ + du$
backout:
  LOCATE , 1
  PRINT name$ + "  ";
  END IF
LOOP UNTIL LEN(name$) = 100

goon:
PRINT
PRINT "Sending (look at Sharps display!)";
char% = 0
FOR i% = 1 TO LEN(name$)
  oldchar% = char%
  display% = 0
  du% = ASC(MID$(name$, i%, 1))
 
  ' blank char
  IF du% = 32 THEN char% = 5: GOTO further


  ' Numbers 0 to `
  IF du% > 47 AND du% < 58 THEN num% = du% - 49: char% = 0: display% = 2: GOTO further
  IF du% > 32 AND du% < 45 THEN num% = du% - 23: char% = 0: display% = 2: GOTO further
  IF du% > 58 AND du% < 65 THEN num% = du% - 33: char% = 0: display% = 2: GOTO further
  IF du% > 94 AND du% < 97 THEN num% = du% - 63: char% = 0: display% = 2: GOTO further
  IF du% = 46 THEN num% = 4: char% = 2:  GOTO further
  IF du% = 47 THEN num% = 2: char% = 2:  GOTO further
  IF du% = 45 THEN num% = 3: char% = 2:  GOTO further


  
  ' Capitals A to Z
  IF du% > 64 AND du% < 91 THEN num% = du% - 65: char% = 0: GOTO further
 
  ' small chars a to z
  IF du% > 96 AND du% < 123 THEN
  display% = 1
  num% = du% - 97
  char% = 0
  GOTO further
  END IF


further:

IF display% > 0 THEN
FOR j% = 1 TO display%
  send% = disp%
  GOSUB sendremote
NEXT j%
END IF

IF char% = 0 THEN
FOR j% = 1 TO num%
send% = forw%
GOSUB sendremote
NEXT j%
END IF

IF char% = 2 THEN
FOR j% = 1 TO num%
send% = rew%
GOSUB sendremote
NEXT j%
END IF


IF char% = 5 THEN
send% = plus%
GOSUB sendremote
END IF


REM +++++++++++++++++R�ckstellen
IF char% = 5 THEN GOTO 210
PRINT MID$(name$, i%, 1);
IF silent = 1 GOTO 190 ELSE PLAY "L21cl21d"
190 a = TIMER + .7
200 IF TIMER > a THEN GOTO 210 ELSE GOTO 200

210 IF char% = 0 THEN
FOR j% = 1 TO num%
send% = rew%
GOSUB sendremote
NEXT j%
END IF

IF char% = 2 THEN
FOR j% = 1 TO num%
send% = forw%
GOSUB sendremote
NEXT j%
END IF

IF display% = 2 THEN
send% = disp%
GOSUB sendremote
END IF

IF display% = 1 THEN
FOR j% = 1 TO 2
send% = disp%
GOSUB sendremote
NEXT j%
END IF

REM +++++++++++++++++Ende R�ckstellen

NEXT i%

PRINT
PRINT CHR$(7)
PRINT "Press Edit on Sharp, then any key on PC";
SLEEP
RETURN



Return to the MiniDisc Community Page.