#!/bin/bash

L1=L
L2=("Write Multisession CD")

function write_multisession_cd {

    msgbox "Specify Data Directory
First, put all audio files and a raw image in this directory
Data file must be named cdimage.raw
Audio files must be numbered (01.wav, 02.wav, etc)"

    select_inputdir

    until [ "$YNRETVAL" != "0" ]; do

	eject_cdrw
	cd $INDIR

	exec_command "cdrecord -v \
			       speed=$SPEED \
			       dev=$GENERIC \
			       fs=${BUFFERS}m \
			       $FORCE2 \
			       $DUMMY \
			       -nofix ./*.wav"

	exec_command "cdrecord -v \
			       speed=$SPEED \
			       dev=$GENERIC \
			       fs=${BUFFERS}m \
			       $FORCE2 \
			       $DUMMY \
			       -eject ./cdimage.raw"

	yesnobox "Repeat this session ? (Take out the CD-R(W) disk)"

    done
}
