private SeekTable makeSeekTable() {
        long lastSampleNumber = 0;
        long lastStreamOffset = 0;
        
        // process selected files
        for (int i = 0; i < flacFiles.size(); i++) {
            File file = (File)flacFiles.get(i);
            try {
                FileInputStream is = new FileInputStream(file);
                FLACDecoder decoder = new FLACDecoder(is);
                decoder.readMetadata();
                StreamInfo info = decoder.getStreamInfo();
                if (masterStreamInfo == null) {
                    masterStreamInfo = info;
                    masterStreamInfo.setTotalSamples(0);
                }
                if (!info.compatiable(masterStreamInfo)) {
                    appendMsg("Bad StreamInfo " + file + ": " + info);
                    continue;
                }
                masterStreamInfo.addTotalSamples(info.getTotalSamples());
                
                SeekPoint seekPoint = new SeekPoint(lastSampleNumber, lastStreamOffset, 0);
                //decoder.processMetadata();
                long frameStartOffs = decoder.getTotalBytesRead();
                PackerFile aFile = new PackerFile(file, seekPoint, frameStartOffs);
                albumFiles.add(aFile);
                //System.out.println("Do decode " +i);
                try {
                    decoder.decodeFrames();
                } catch (EOFException e) {
                    //appendMsg("File " + file + ": " + e);
                }
                //System.out.println("Done decode");
                long frameEndOffs = decoder.getTotalBytesRead();
                //appendMsg(frameStartOffs + " " + frameEndOffs + " " + decoder.getSamplesDecoded());
                lastSampleNumber += decoder.getSamplesDecoded();
                lastStreamOffset += frameEndOffs - frameStartOffs;
            } catch (FileNotFoundException e) {
                appendMsg("File " + file + ": " + e);
            } catch (IOException e) {
                appendMsg("File " + file + ": " + e);
            }
        }
        
        // make Seek Table
        SeekPoint[] points = new SeekPoint[albumFiles.size()];
        SeekTable seekTable = new SeekTable(points, true);
        int metadataHeader = (Metadata.STREAM_METADATA_IS_LAST_LEN + Metadata.STREAM_METADATA_TYPE_LEN + Metadata.STREAM_METADATA_LENGTH_LEN) / 8;
        int metadataOffset = Constants.STREAM_SYNC_STRING.length + masterStreamInfo.calcLength() + seekTable.calcLength() + metadataHeader * 2;
        for (int i = 0; i < albumFiles.size(); i++) {
            PackerFile aFile = (PackerFile)albumFiles.get(i);
            appendMsg("SeekTable build " + i + " Offset=" + aFile.seekPoint.getStreamOffset() + " header=" + metadataOffset);
            aFile.seekPoint.setStreamOffset(aFile.seekPoint.getStreamOffset() + metadataOffset);
            points[i] = aFile.seekPoint;
        }
        
        return seekTable;
    }