final String ourCode = AbstractApplication.getApplication().getMacOSCreator();
final int[][] channelMaps = createCacheChannelMaps();
AudioStake result = null;
AudioFileDescr afd;
byte[] appCode;
AudioFileCacheInfo infoA, infoB;
try {
for( int i = 0; i < cacheAFs.length; i++ ) {
// System.out.println( "openCacheForRead checking '" + f[ i ].getAbsolutePath() + "'" );
if( !f[ i ].isFile() ) return null;
cacheAFs[ i ] = AudioFile.openAsRead( f[ i ]);
cacheAFs[ i ].readAppCode();
afd = cacheAFs[ i ].getDescr();
final long expected = ((audioFiles[ i ].getFrameNum() + MAXCEILADD) & MAXMASK) >> decimHelps[ 0 ].shift;
// System.out.println( "expected " + expected+ "; cacheF " +
// cacheAFs[ i ].getFile().getAbsolutePath() );
if( expected != afd.length ) {
// System.err.println( "expected numFrames = "+ expected +
// ", but got " + afd.length );
return null;
}
appCode = (byte[]) afd.getProperty( AudioFileDescr.KEY_APPCODE );
// System.err.println( "ourCode = '" + ourCode + "'; afd.appCode
// = '" + afd.appCode + "'; appCode = '" + appCode + "'" );
if( ourCode.equals( afd.appCode ) && (appCode != null) ) {
infoA = AudioFileCacheInfo.decode( appCode );
if( infoA != null ) {
infoB = new AudioFileCacheInfo( audioFiles[ i ], decimModel, audioFiles[ i ].getFrameNum() );
if( !infoA.equals( infoB )) {
// System.err.println( "info mismatch!" );
return null;
}
// System.err.println( "ok. numChans = " +
// infoA.getNumChannels() );