.key AIFFFILE/A,STUDIOBASE/A
.bra {
.ket }

; This script will convert a stereo AIFF file into two Studio 16 files.
;
; $VER: StereoAIFF2Studio 1.1 (07.12.97)
; Created by Kenneth 'Kenny' Nilsen (kenny@bgnett.no)
;
; USAGE: StereoAIFF2Studio <stereoAIFF> <Studio16base>
;
; NOTE: The commands must be in the command search path. To be safe
; copy the commands in C: or add the path where you keep the commands to
; the global search path (startup-sequence: path <path> ADD).

;** check files:

if not exists {AIFFFILE}
	echo "File '{AIFFFILE}' doesn't exist!"
	skip Final
	endif

if exists "{STUDIOBASE}_L"
    echo "WARNING: File '{STUDIOBASE}_L' already exist!"
    ask "Continue ? (y/N)"
    if not WARN
       echo "Terminating.."
       skip Final
       endif
    endif

if exists "{STUDIOBASE}_R"
    echo "WARNING: File '{STUDIOBASE}_R' already exist!"
    ask "Continue ? (y/N)"
    if not WARN
       echo "Terminating.."
       skip Final
       endif
    endif

;** Ok, start the programs

delete {STUDIOBASE}_L >nil:
delete {STUDIOBASE}_R >nil:

echo "Converting... please wait"

SplitAIFF {AIFFFILE} {STUDIOBASE} >nil:
if WARN
	echo "Error while splitting AIFF file!"
	skip Final
	endif

AIFF2Studio {STUDIOBASE}.L {STUDIOBASE}_L >nil:
if WARN
	echo "Error while converting AIFF to Studio 16 file!"
	skip Final
	endif

delete {STUDIOBASE}.L >nil:

AIFF2Studio {STUDIOBASE}.R {STUDIOBASE}_R >nil:
if WARN
	echo "Error while converting AIFF to Studio 16 file!"
	skip Final
	endif

delete {STUDIOBASE}.R >nil:

rename {STUDIOBASE}_L_MONO {STUDIOBASE}_L >nil:
rename {STUDIOBASE}_R_MONO {STUDIOBASE}_R >nil:

S16SetPan {STUDIOBASE}_L 0 >nil:
if WARN
	echo "Error while setting '{STUDIOBASE}_L' to LEFT"
	endif

S16SetPan {STUDIOBASE}_R 200 >nil:
if WARN
	echo "Error while setting '{STUDIOBASE}_R' to RIGHT"
	endif

;** We're done

Echo "Done"
Echo ""

Lab Final
