{
final File[] f = createCacheFileNames();
if( f == null ) return null;
final AudioFile[] audioFiles = fullScale.getAudioFiles();
final AudioFileDescr afdProto = new AudioFileDescr();
final CacheManager cm = PrefCacheManager.getInstance();
final Span[] fileSpans = new Span[ audioFiles.length ];
final AudioFile[] cacheAFs = new AudioFile[ audioFiles.length ];
final String ourCode = AbstractApplication.getApplication().getMacOSCreator();
final int[][] channelMaps = createCacheChannelMaps();
AudioStake result = null;
AudioFileDescr afd;
AudioFileCacheInfo info;
afdProto.type = AudioFileDescr.TYPE_AIFF;
afdProto.bitsPerSample = 32;
afdProto.sampleFormat = AudioFileDescr.FORMAT_FLOAT;
afdProto.rate = decimHelps[ 0 ].rate; // getRate();
afdProto.appCode = ourCode;
try {
for( int i = 0; i < f.length; i++ ) {
cm.removeFile( f[ i ]); // in case it existed
// System.out.println( "openCacheForWrite doing '" + f[ i ].getAbsolutePath() + "'" );
afd = new AudioFileDescr( afdProto );
afd.channels = channelMaps[ i ].length;
// System.out.println( "channels = " + afd.channels );
afd.file = f[ i ];
info = new AudioFileCacheInfo( audioFiles[ i ], decimModel, audioFiles[ i ].getFrameNum() );
afd.setProperty( AudioFileDescr.KEY_APPCODE, info.encode() );
cacheAFs[ i ] = AudioFile.openAsWrite( afd );
fileSpans[ i ] = new Span( 0, decimFrameNum );
}
// XXX WE NEED A WAY TO CLOSE THE FILES UPON STAKE DISPOSAL XXX
if( channelMaps.length == 1 ) {