差分発生行の前後
無視リスト:
更新日時:
2010/05/11 20:15:55 (2 年 前)
更新者:
h
ログメッセージ:

refs #2 #8 #9 #7 #6
現状のソースをコミット。一部完了。一部未完了。
関連づいてない完了チケットのチェンジセットもまとめて。
パッケージ階層も大幅に変更。

パス:
trunk/src/org/rayflood/mikuvat/io/vsq
ファイル:
1 追加
1 移動

凡例:

変更なし
追加
削除
  • trunk/src/org/rayflood/mikuvat/io/vsq/VSQFile.java

    r2 r4  
    1 package org.rayflood.mikuvat.io; 
    2  
    3 import static org.rayflood.mikuvat.io.VSQDecoder.decode; 
    4 import static org.rayflood.mikuvat.io.VSQDecoder.encode; 
    5 import static org.rayflood.mikuvat.io.VSQDecoder.setSectionBracket; 
    6  
     1package org.rayflood.mikuvat.io.vsq; 
     2 
     3import static org.rayflood.mikuvat.Utilities.setSectionBracket; 
     4 
     5import java.io.BufferedReader; 
    76import java.io.File; 
     7import java.io.FileNotFoundException; 
     8import java.io.IOException; 
     9import java.io.StringReader; 
     10import java.nio.charset.Charset; 
    811import java.util.ArrayList; 
     12import java.util.LinkedHashMap; 
    913import java.util.List; 
    1014import java.util.Map; 
    11  
    12 import javax.sound.midi.MidiEvent; 
    13 import javax.sound.midi.MidiSystem; 
     15import java.util.regex.Pattern; 
     16 
     17import javax.sound.midi.InvalidMidiDataException; 
    1418import javax.sound.midi.Sequence; 
    15 import javax.sound.midi.Track; 
    16  
    17 public class VSQFile extends ImmutableObject{ 
     19 
     20import org.rayflood.mikuvat.io.BaseObject; 
     21import org.rayflood.mikuvat.io.InvalidBaseObjectException; 
     22import org.rayflood.mikuvat.io.midi.MidiData; 
     23import org.rayflood.mikuvat.io.midi.MidiFile; 
     24import org.rayflood.mikuvat.io.midi.MidiMeta; 
     25import org.rayflood.mikuvat.io.midi.MidiTrack; 
     26 
     27public class VSQFile extends MidiFile{ 
    1828        private static final long serialVersionUID = -6314152290164983853L; 
     29        public static final Pattern MMHEADER = Pattern.compile("^DM:\\d+:"); 
     30        public static final Charset WIN31J = Charset.forName("Windows-31J"); 
     31        public static final Pattern SECTIONLINE = Pattern.compile("^\\[.+\\]$"); 
     32        public static final int TEXTLENGTH = 119; 
    1933        public static final String COMMON = "Common"; 
    2034        public static final String MASTER = "Master"; 
     
    2236        public static final String EVENTLIST = "EventList"; 
    2337 
    24         private File vsqFile; 
    25         private Integer fileType; 
    26         private Float divisionType; 
    27         private Integer resolution; 
    28         private MidiTrack conductor; 
    2938        private MasterSection master; 
    3039        private MixerSection mixer; 
    3140        private ArrayList<VSQTrack> tracks; 
    3241 
    33         public VSQFile(String vsq) throws Exception{ 
     42        public VSQFile(String vsq) throws IOException, InvalidMidiDataException{ 
    3443                this(); 
    35                 readVSQFile(vsq); 
    36         } 
    37  
    38         public VSQFile(File vsq) throws Exception{ 
     44                readMidiFile(vsq); 
     45                setVSQSequence(getMidiTracks()); 
     46        } 
     47 
     48        public VSQFile(File vsq) throws IOException, InvalidMidiDataException{ 
    3949                this(); 
    40                 readVSQFile(vsq); 
    41         } 
    42  
    43         public VSQFile(Sequence sq) throws Exception{ 
     50                readMidiFile(vsq); 
     51                setVSQSequence(getMidiTracks()); 
     52        } 
     53 
     54        public VSQFile(Sequence sq) throws IOException{ 
    4455                this(); 
    45                 setVSQSequence(sq); 
    46         } 
    47  
    48         public void readVSQFile(String vsq) throws Exception{ 
     56                setMidiSequence(sq); 
     57                setVSQSequence(getMidiTracks()); 
     58        } 
     59 
     60        public void readVSQFile(String vsq) throws IOException, InvalidMidiDataException{ 
    4961                readVSQFile(new File(vsq)); 
    5062        } 
    5163 
    52         public void readVSQFile(File vsq) throws Exception{ 
    53                 setVsqFile(vsq); 
    54                 setVSQSequence(MidiSystem.getSequence(getVsqFile())); 
    55         } 
    56  
    57         public void writeVSQFile() throws Exception{ 
     64        public void readVSQFile(File vsq) throws IOException, InvalidMidiDataException{ 
     65                super.readMidiFile(vsq); 
     66                setVSQSequence(getMidiTracks()); 
     67        } 
     68 
     69        public void writeVSQFile() throws IOException, InvalidMidiDataException, InvalidBaseObjectException{ 
    5870                writeVSQFile(getVsqFile()); 
    5971        } 
    6072 
    61         public void writeVSQFile(String vsq) throws Exception{ 
     73        public void writeVSQFile(String vsq) throws IOException, InvalidMidiDataException, InvalidBaseObjectException{ 
    6274                writeVSQFile(new File(vsq)); 
    6375        } 
    6476 
    65         public void writeVSQFile(File vsq) throws Exception{ 
    66                 MidiSystem.write(getVSQSequence(), getFileType(), vsq); 
    67         } 
    68  
    69         public void setVSQSequence(Sequence sq) throws Exception{ 
    70                 setFileType(MidiSystem.getMidiFileTypes(sq)[0]); 
    71                 setDivisionType(sq.getDivisionType()); 
    72                 setResolution(sq.getResolution()); 
    73                 Track t[] = sq.getTracks(); 
    74                 setConductor(t[0]); 
    75  
    76                 Map<String, List<String>> sections = decode(t[1]); 
     77        public void writeVSQFile(File vsq) throws IOException, InvalidMidiDataException, InvalidBaseObjectException{ 
     78                setMidiTracks(getVSQSequence()); 
     79                super.writeMidiFile(vsq); 
     80        } 
     81 
     82        public Map<String, List<String>> decode(List<MidiData> md) throws IOException{ 
     83                List<Byte> v = new ArrayList<Byte>(); 
     84                for(int i = 0; i < md.size(); i++){ 
     85                        MidiData m = md.get(i); 
     86                        if(m instanceof MidiMeta){ 
     87                                byte b[] = ((MidiMeta)m).getData(); 
     88                                if(b.length == 0){ 
     89                                        continue; 
     90                                } 
     91                                String mmheader = new String(b); 
     92                                String[] ss = MMHEADER.split(mmheader, 2); 
     93                                if(ss.length > 1){ 
     94                                        for(int k = mmheader.indexOf(ss[1]); k < b.length; k++){ 
     95                                                if(b[k] != 0x00){ 
     96                                                        v.add(b[k]); 
     97                                                } 
     98                                        } 
     99                                } 
     100                        } 
     101                } 
     102                byte b[] = new byte[v.size()]; 
     103                for(int i = 0; i < v.size(); i++){ 
     104                        b[i] = v.get(i); 
     105                } 
     106                String textevent = new String(b, WIN31J); 
     107                System.out.println(textevent); 
     108 
     109                Map<String, List<String>> sections = new LinkedHashMap<String, List<String>>(); 
     110                BufferedReader br = new BufferedReader(new StringReader(textevent)); 
     111                String bf; 
     112                String sn = ""; 
     113                List<String> sv = new ArrayList<String>(); 
     114                do{ 
     115                        bf = br.readLine(); 
     116                        if(bf == null || SECTIONLINE.matcher(bf).matches()){ 
     117                                if(sn.length() > 0 && !sections.containsKey(sn)){ 
     118                                        sections.put(sn.substring(1, sn.length() - 1), sv); 
     119                                } 
     120                                sn = bf; 
     121                                sv = new ArrayList<String>(); 
     122                        } 
     123                        else if(bf.length() > 0){ 
     124                                sv.add(bf); 
     125                        } 
     126                }while(bf != null); 
     127 
     128                return sections; 
     129        } 
     130 
     131        public List<MidiData> encode(List<String> trackSections){ 
     132                String te = ""; 
     133                for(int i = 0; i < trackSections.size(); i++){ 
     134                        String vts = trackSections.get(i); 
     135                        te += vts + "\n"; 
     136                } 
     137 
     138                List<MidiData> tme = new ArrayList<MidiData>(); 
     139                byte b[] = te.getBytes(WIN31J); 
     140                for(int j = 0; j <= b.length / TEXTLENGTH; j++){ 
     141                        int h = (int)StrictMath.ceil((double)Integer.toString(j).length() / 4.0); 
     142                        String mef = "DM:%0" + h * 4 + "d:"; 
     143                        byte header[] = String.format(mef, j).getBytes(WIN31J); 
     144                        List<Byte> mbl = new ArrayList<Byte>(); 
     145                        for(int k = 0; k < header.length; k++){ 
     146                                mbl.add(header[k]); 
     147                        } 
     148                        for(int k = 0; k < TEXTLENGTH; k++){ 
     149                                int bi = j * TEXTLENGTH + k; 
     150                                if(bi >= b.length){ 
     151                                        break; 
     152                                } 
     153                                mbl.add(b[bi]); 
     154                        } 
     155                        byte mb[] = new byte[mbl.size()]; 
     156                        for(int k = 0; k < mbl.size(); k++){ 
     157                                mb[k] = mbl.get(k); 
     158                        } 
     159                        tme.add(new MidiMeta(1, mb)); 
     160                } 
     161 
     162                return tme; 
     163        } 
     164 
     165        public void setVSQSequence(ArrayList<MidiTrack> t) throws IOException{ 
     166                Map<String, List<String>> sections = decode(t.get(0).getMidiData(0L)); 
    77167                setMaster(new MasterSection(sections.get(MASTER))); 
    78168                setMixer(new MixerSection(sections.get(MIXER))); 
    79                 addTrack(new VSQTrack(t[1].get(0), getMixerSetting(0), sections)); 
    80                 for(int i = 2; i < t.length; i++){ 
    81                         addTrack(new VSQTrack(t[i].get(0), getMixerSetting(i - 1), decode(t[i]))); 
    82                 } 
    83         } 
    84  
    85         public Sequence getVSQSequence() throws Exception{ 
    86                 Sequence sq = new Sequence(getDivisionType(), getResolution()); 
    87                 Track mt = sq.createTrack(); 
    88                 getConductor(mt); 
     169                addVSQTrack(new VSQTrack(getMixerSetting(0), sections)); 
     170                for(int i = 1; i < t.size(); i++){ 
     171                        addVSQTrack(new VSQTrack(getMixerSetting(i), decode(t.get(i).getMidiData(0L)))); 
     172                } 
     173        } 
     174 
     175        public ArrayList<MidiTrack> getVSQSequence() throws InvalidBaseObjectException{ 
     176                ArrayList<MidiTrack> t = new ArrayList<MidiTrack>(); 
    89177 
    90178                List<List<String>> tsections = getVSQText(); 
    91                 for(int i = 0; i < getTrackSize(); i++){ 
    92                         VSQTrack vt = getTrack(i); 
    93                         Track t = sq.createTrack(); 
    94                         t.add(vt.getTrackNameME()); 
    95                         List<MidiEvent> me = encode(tsections.get(i)); 
    96                         for(int j = 0; j < me.size(); j++){ 
    97                                 t.add(me.get(j)); 
    98                         } 
    99                 } 
    100  
    101                 return sq; 
    102         } 
    103  
    104         public List<List<String>> getVSQText() throws Exception{ 
    105                 if(!isReadied()){ 
    106                         throw new Exception(); 
    107                 } 
     179                for(int i = 0; i < getVSQTrackSize(); i++){ 
     180                        MidiTrack mt = new MidiTrack(); 
     181                        mt.setMidiData(0L, encode(tsections.get(i))); 
     182                        t.add(mt); 
     183                } 
     184 
     185                return t; 
     186        } 
     187 
     188        public List<List<String>> getVSQText() throws InvalidBaseObjectException{ 
     189                validate(); 
    108190 
    109191                List<List<String>> tcommons = new ArrayList<List<String>>(); 
    110192                List<List<String>> ttimelines = new ArrayList<List<String>>(); 
    111                 for(int i = 0; i < getTrackSize(); i++){ 
    112                         VSQTrack vt = getTrack(i); 
     193                for(int i = 0; i < getVSQTrackSize(); i++){ 
     194                        VSQTrack vt = getVSQTrack(i); 
    113195                        tcommons.add(vt.getCommon().getSection()); 
    114196                        ttimelines.add(vt.getTimeLine().getSectionFast()); 
     
    128210                vsqtext.add(sections); 
    129211 
    130                 for(int i = 1; i < getTrackSize(); i++){ 
     212                for(int i = 1; i < getVSQTrackSize(); i++){ 
    131213                        sections = new ArrayList<String>(); 
    132214                        sections.add(setSectionBracket(COMMON)); 
     
    164246        } 
    165247 
    166         public int getTrackSize(){ 
     248        public int getVSQTrackSize(){ 
    167249                return tracks.size(); 
    168250        } 
    169251 
    170         public void addTrack(VSQTrack vt){ 
     252        public void addVSQTrack(VSQTrack vt){ 
    171253                if(vt == null || vt.isDeleted()){ 
    172254                        return; 
     
    175257        } 
    176258 
    177         public void addTrack(int index, VSQTrack vt){ 
     259        public void addVSQTrack(int index, VSQTrack vt){ 
    178260                if(vt == null || vt.isDeleted()){ 
    179261                        return; 
    180262                } 
    181                 if(index < getTrackSize()){ 
     263                if(index < getVSQTrackSize()){ 
    182264                        tracks.add(index, vt); 
    183265                } 
    184266                else{ 
    185                         addTrack(vt); 
    186                 } 
    187         } 
    188  
    189         public void setTrack(int index, VSQTrack vt){ 
     267                        addVSQTrack(vt); 
     268                } 
     269        } 
     270 
     271        public void setVSQTrack(int index, VSQTrack vt){ 
    190272                if(vt == null || vt.isDeleted()){ 
    191                         removeTrack(index); 
    192                         return; 
    193                 } 
    194                 if(index < getTrackSize()){ 
     273                        removeVSQTrack(index); 
     274                        return; 
     275                } 
     276                if(index < getVSQTrackSize()){ 
    195277                        tracks.set(index, vt); 
    196278                } 
    197279                else{ 
    198                         addTrack(vt); 
    199                 } 
    200         } 
    201  
    202         public VSQTrack getTrack(int index){ 
    203                 if(index < getTrackSize()){ 
     280                        addVSQTrack(vt); 
     281                } 
     282        } 
     283 
     284        public VSQTrack getVSQTrack(int index){ 
     285                if(index < getVSQTrackSize()){ 
    204286                        return tracks.get(index); 
    205287                } 
     
    209291        } 
    210292 
    211         public VSQTrack removeTrack(int index){ 
    212                 if(index < getTrackSize()){ 
     293        public VSQTrack removeVSQTrack(int index){ 
     294                if(index < getVSQTrackSize()){ 
    213295                        return tracks.remove(index); 
    214296                } 
     
    223305                        sl.add("VsqFile=" + getVsqFileS()); 
    224306                } 
    225                 if(hasFileType()){ 
    226                         sl.add("FileType=" + getFileType()); 
    227                 } 
    228                 if(hasDivisionType()){ 
    229                         sl.add("DivisionType=" + getDivisionType()); 
    230                 } 
    231                 if(hasResolution()){ 
    232                         sl.add("Resolution=" + getResolution()); 
    233                 } 
    234                 if(hasConductor()){ 
    235                         sl.add("Conductor={" + getConductor().toString() + "}"); 
    236                 } 
    237307                if(hasMaster()){ 
    238308                        sl.add("Master={" + getMaster().toString() + "}"); 
     
    241311                        sl.add("Mixer={" + getMixer().toString() + "}"); 
    242312                } 
    243                 if(hasTracks()){ 
    244                         StringBuffer sb = new StringBuffer(); 
    245                         sb.append(getTrack(0).toString()); 
    246                         for(int i = 1; i < getTrackSize(); i++){ 
    247                                 sb.append("," + getTrack(i).toString()); 
     313                if(hasVSQTracks()){ 
     314                        StringBuilder sb = new StringBuilder(); 
     315                        sb.append(getVSQTrack(0).toString()); 
     316                        for(int i = 1; i < getVSQTrackSize(); i++){ 
     317                                sb.append("," + getVSQTrack(i).toString()); 
    248318                        } 
    249319                        sl.add("Tracks=[" + sb.toString() + "]"); 
    250320                } 
    251321 
    252                 StringBuffer sb = new StringBuffer(); 
     322                StringBuilder sb = new StringBuilder(); 
     323                sb.append(super.toString()); 
     324 
    253325                sb.append("VSQFile={"); 
    254326                if(!sl.isEmpty()){ 
     
    262334        } 
    263335 
    264         public boolean isReadied(){ 
    265                 boolean ready = true; 
    266                 ready &= hasFileType(); 
    267                 ready &= hasDivisionType(); 
    268                 ready &= hasResolution(); 
    269                 ready &= hasConductor() && getConductor().isReadied(); 
    270                 ready &= hasMaster() && getMaster().isReadied(); 
    271                 ready &= hasMixer() && getMixer().isReadied(); 
    272                 for(int i = 0; i < getTrackSize(); i++){ 
    273                         ready &= getTrack(i).isReadied(); 
     336        public boolean validate() throws InvalidBaseObjectException{ 
     337                boolean ready = super.validate(); 
     338                ready &= hasMaster() && getMaster().validate(); 
     339                ready &= hasMixer() && getMixer().validate(); 
     340                for(int i = 0; i < getVSQTrackSize(); i++){ 
     341                        ready &= getVSQTrack(i).validate(); 
     342                } 
     343                if(!ready){ 
     344                        throw new InvalidBaseObjectException(this); 
    274345                } 
    275346                return ready; 
    276347        } 
    277348 
    278         public int compareTo(ImmutableObject obj){ 
    279                 VSQFile vsqFile = (VSQFile)obj; 
    280                 return compare(getVsqFile().getPath(), vsqFile.getVsqFile().getPath()); 
    281         } 
    282  
    283         public VSQFile over(Object obj, boolean fill, boolean has){ 
     349        public VSQFile over(BaseObject obj, boolean fill, boolean has){ 
     350                super.over(obj, fill, has); 
    284351                VSQFile vsqFile = ((VSQFile)obj).clone(); 
    285                 if(vsqFile.hasFileType() && (fill || has == hasFileType())){ 
    286                         setFileType(vsqFile.getFileType()); 
    287                 } 
    288                 if(vsqFile.hasDivisionType() && (fill || has == hasDivisionType())){ 
    289                         setDivisionType(vsqFile.getDivisionType()); 
    290                 } 
    291                 if(vsqFile.hasResolution() && (fill || has == hasResolution())){ 
    292                         setResolution(vsqFile.getResolution()); 
    293                 } 
    294                 if(vsqFile.hasConductor()){ 
    295                         MidiTrack conductor = hasConductor() ? getConductor() : new MidiTrack(); 
    296                         setConductor(conductor.over(vsqFile.getConductor(), fill, has)); 
    297                 } 
    298352                if(vsqFile.hasMaster()){ 
    299353                        MasterSection master = hasMaster() ? getMaster() : new MasterSection(); 
     
    304358                        setMixer(mixer.over(vsqFile.getMixer(), fill, has)); 
    305359                } 
    306                 for(int i = 0; i < vsqFile.getTracks().size(); i++){ 
    307                         VSQTrack vt = getTrack(i); 
    308                         setTrack(i, vt.over(vsqFile.getTrack(i), fill, has)); 
    309                 } 
    310                 if(vsqFile.hasVsqFile() && (fill || has == hasVsqFile())){ 
    311                         setVsqFile(vsqFile.getVsqFile()); 
     360                for(int i = 0; i < vsqFile.getVSQTracks().size(); i++){ 
     361                        VSQTrack vt = getVSQTrack(i); 
     362                        setVSQTrack(i, vt.over(vsqFile.getVSQTrack(i), fill, has)); 
    312363                } 
    313364                return this; 
     
    315366 
    316367        public VSQFile setDefault(){ 
    317                 setFileType(1); 
    318                 setDivisionType(0.0f); 
    319                 setResolution(480); 
    320                 setConductor(new MidiTrack()); 
     368                super.setDefault(); 
    321369                setMaster(MasterSection.getDefault()); 
    322370                setMixer(MixerSection.getDefault()); 
    323                 deleteTracks(); 
    324                 addTrack(VSQTrack.getDefault()); 
    325                 deleteVsqFile(); 
     371                deleteVSQTracks(); 
     372                addVSQTrack(VSQTrack.getDefault()); 
    326373                return this; 
    327374        } 
     
    334381 
    335382        public VSQFile delete(){ 
    336                 deleteFileType(); 
    337                 deleteDivisionType(); 
    338                 deleteResolution(); 
    339                 deleteConductor(); 
     383                super.delete(); 
    340384                deleteMaster(); 
    341385                deleteMixer(); 
    342                 deleteTracks(); 
    343                 deleteVsqFile(); 
     386                deleteVSQTracks(); 
    344387                return this; 
    345388        } 
    346389 
    347390        public boolean isDeleted(){ 
    348                 boolean has = false; 
    349                 has |= hasFileType(); 
    350                 has |= hasDivisionType(); 
    351                 has |= hasResolution(); 
    352                 has |= hasConductor(); 
     391                boolean has = super.isDeleted(); 
    353392                has |= hasMaster(); 
    354393                has |= hasMixer(); 
    355                 has |= hasTracks(); 
    356                 has |= hasVsqFile(); 
     394                has |= hasVSQTracks(); 
    357395                return !has; 
    358396        } 
    359397 
    360398        public VSQFile(){ 
     399                super(); 
    361400                delete(); 
    362401        } 
    363402 
    364403        public File getVsqFile(){ 
    365                 return vsqFile; 
     404                return getMidiFile(); 
    366405        } 
    367406 
     
    371410 
    372411        public void setVsqFile(File vsqFile){ 
    373                 this.vsqFile = vsqFile; 
     412                setMidiFile(vsqFile); 
    374413        } 
    375414 
     
    379418 
    380419        public void deleteVsqFile(){ 
    381                 vsqFile = null; 
     420                deleteMidiFile(); 
    382421        } 
    383422 
    384423        public boolean hasVsqFile(){ 
    385                 return vsqFile != null; 
    386         } 
    387  
    388         public Integer getFileType(){ 
    389                 return fileType; 
    390         } 
    391  
    392         public void setFileType(Integer fileType){ 
    393                 this.fileType = fileType; 
    394         } 
    395  
    396         public void deleteFileType(){ 
    397                 fileType = null; 
    398         } 
    399  
    400         public boolean hasFileType(){ 
    401                 return fileType != null; 
    402         } 
    403  
    404         public Float getDivisionType(){ 
    405                 return divisionType; 
    406         } 
    407  
    408         public void setDivisionType(Float divisionType){ 
    409                 this.divisionType = divisionType; 
    410         } 
    411  
    412         public void deleteDivisionType(){ 
    413                 divisionType = null; 
    414         } 
    415  
    416         public boolean hasDivisionType(){ 
    417                 return divisionType != null; 
    418         } 
    419  
    420         public Integer getResolution(){ 
    421                 return resolution; 
    422         } 
    423  
    424         public void setResolution(Integer resolution){ 
    425                 this.resolution = resolution; 
    426         } 
    427  
    428         public void deleteResolution(){ 
    429                 resolution = null; 
    430         } 
    431  
    432         public boolean hasResolution(){ 
    433                 return resolution != null; 
    434         } 
    435  
    436         public MidiTrack getConductor(){ 
    437                 return conductor; 
    438         } 
    439  
    440         public void getConductor(Track t) throws Exception{ 
    441                 conductor.getTrack(t); 
    442         } 
    443  
    444         public void setConductor(MidiTrack conductor){ 
    445                 if(conductor == null || conductor.isDeleted()){ 
    446                         deleteConductor(); 
    447                         return; 
    448                 } 
    449                 this.conductor = conductor; 
    450         } 
    451  
    452         public void setConductor(Track t){ 
    453                 this.conductor = new MidiTrack(t); 
    454         } 
    455  
    456         public void deleteConductor(){ 
    457                 conductor = null; 
    458         } 
    459  
    460         public boolean hasConductor(){ 
    461                 return conductor != null; 
     424                return hasMidiFile(); 
    462425        } 
    463426 
     
    502465        } 
    503466 
    504         public ArrayList<VSQTrack> getTracks(){ 
     467        public ArrayList<VSQTrack> getVSQTracks(){ 
    505468                return tracks; 
    506469        } 
    507470 
    508         public void setTracks(ArrayList<VSQTrack> tracks){ 
     471        public void setVSQTracks(ArrayList<VSQTrack> tracks){ 
    509472                if(tracks == null){ 
    510                         deleteTracks(); 
     473                        deleteVSQTracks(); 
    511474                        return; 
    512475                } 
     
    514477        } 
    515478 
    516         public void deleteTracks(){ 
    517                 setTracks(new ArrayList<VSQTrack>()); 
    518         } 
    519  
    520         public boolean hasTracks(){ 
     479        public void deleteVSQTracks(){ 
     480                setVSQTracks(new ArrayList<VSQTrack>()); 
     481        } 
     482 
     483        public boolean hasVSQTracks(){ 
    521484                return !tracks.isEmpty(); 
    522485        } 
     
    526489        } 
    527490 
    528         public static VSQFile load(String file) throws Exception{ 
    529                 return (VSQFile)ImmutableObject.load(file); 
    530         } 
    531  
    532         public static VSQFile load(File file) throws Exception{ 
    533                 return (VSQFile)ImmutableObject.load(file); 
    534         } 
    535  
    536         public void store(String file) throws Exception{ 
     491        public static VSQFile load(String file) throws FileNotFoundException, IOException, ClassNotFoundException{ 
     492                return (VSQFile)BaseObject.load(file); 
     493        } 
     494 
     495        public static VSQFile load(File file) throws FileNotFoundException, IOException, ClassNotFoundException{ 
     496                return (VSQFile)BaseObject.load(file); 
     497        } 
     498 
     499        public void store(String file) throws FileNotFoundException, IOException{ 
    537500                super.store(file); 
    538501        } 
    539502 
    540         public void store(File file) throws Exception{ 
     503        public void store(File file) throws FileNotFoundException, IOException{ 
    541504                super.store(file); 
    542505        } 
    543506 
    544         public static VSQFile unzip(String file) throws Exception{ 
    545                 return (VSQFile)ImmutableObject.unzip(file); 
    546         } 
    547  
    548         public static VSQFile unzip(File file) throws Exception{ 
    549                 return (VSQFile)ImmutableObject.unzip(file); 
    550         } 
    551  
    552         public void zip(String file) throws Exception{ 
     507        public static VSQFile unzip(String file) throws IOException, ClassNotFoundException{ 
     508                return (VSQFile)BaseObject.unzip(file); 
     509        } 
     510 
     511        public static VSQFile unzip(File file) throws IOException, ClassNotFoundException{ 
     512                return (VSQFile)BaseObject.unzip(file); 
     513        } 
     514 
     515        public void zip(String file) throws IOException{ 
    553516                super.zip(file); 
    554517        } 
    555518 
    556         public void zip(File file) throws Exception{ 
     519        public void zip(File file) throws IOException{ 
    557520                super.zip(file); 
    558521        }