Ignore:
Timestamp:
10/11/08 15:15:17 (16 years ago)
Author:
bjn8
Message:

Improved mix settings... Also fix widget anchoring bug in Apollo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src_apollo/org/apollo/io/MixIO.java

    r315 r366  
    130130         *              The mixes to write to file
    131131         *
    132          * @param usingLocalFlags
    133          *              Parallel list with banks. The isUsingLocal flag...
    134          */
    135         public static void saveBanks(String mixBatchPath, List<TrackMixSubject> banks, List<Boolean> usingLocalFlags) {
     132         */
     133        public static void saveBanks(String mixBatchPath, List<TrackMixSubject> banks) {
    136134               
    137135                assert(mixBatchPath != null);
    138136                assert(banks != null);
    139                 assert(usingLocalFlags != null);
    140                 assert(usingLocalFlags.size() == banks.size());
    141137               
    142138                File mixFile = new File(mixBatchPath);
     
    161157                                TrackMixSubject mix = banks.get(i);
    162158                                assert(mix != null);
    163                                
    164                                 Boolean flag = usingLocalFlags.get(i);
    165                                 assert(flag != null);
    166                                
    167159                                out.write(mix.toParseableString() + "\n");
    168                                 out.write(flag.booleanValue() ? "1\n" : "0\n");
    169160                        }
    170161
     
    193184         *              A list to load the banks into. Must not be null - must be empty.
    194185         *
    195          * @param usingLocalFlags
    196          *              A list to load the channel flags into... Must not be null - must be empty.
    197          *
    198186         * @return
    199187         *              True of success. False if IO operatoin failed / file does not exist.
     
    201189        public static boolean loadBanks(
    202190                        List<TrackMixSubject> banks,
    203                         List<Boolean> usingLocalFlags,
    204191                        String banksFilepath) {
    205192               
    206193                assert(banks != null);
    207                 assert(usingLocalFlags != null);
    208194                assert(banksFilepath != null);
    209195                assert(banks.isEmpty());
    210                 assert(usingLocalFlags.isEmpty());
    211196               
    212197                File mixFile = new File(banksFilepath);
     
    230215                        String line = null;
    231216                        // Read the sbase file...
    232                         boolean waitingOnFlag = false;
    233217                        while ((line = in.readLine()) != null) {
    234218                               
     
    237221                               
    238222                                TrackMixSubject mix = TrackMixSubject.fromString(line);
    239                                
    240                                 if (mix != null) {
    241                                        
    242                                         if (waitingOnFlag) { // missing flag for last mix line
    243                                                 usingLocalFlags.add(new Boolean(false)); // default to false
    244                                         }
    245                                        
     223                       
     224                                if (mix != null)
    246225                                        banks.add(mix);
    247                                         waitingOnFlag = true;
    248                                        
    249                                 } else if (waitingOnFlag) { // waiting on flag?
    250                                        
    251                                         if (line.equals("1")) {
    252                                                 usingLocalFlags.add(new Boolean(true));
    253                                                 waitingOnFlag = false;
    254                                         } else if (line.equals("0")) {
    255                                                 usingLocalFlags.add(new Boolean(false));
    256                                                 waitingOnFlag = false;
    257                                         }
    258                                 }
    259                                
    260                                
    261                         }
    262                        
    263                         if (usingLocalFlags.size() == (banks.size() - 1)) { // missing last flag
    264                                 usingLocalFlags.add(new Boolean(false));
    265                         }
    266                        
    267                         assert(usingLocalFlags.size() == banks.size());
    268                        
     226       
     227                        }
     228
    269229                } catch (Exception e) {
    270230                        e.printStackTrace();
Note: See TracChangeset for help on using the changeset viewer.