Subversion Repositories svn.mios

Rev

Rev 213 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 213 Rev 628
Line 20... Line 20...
20
20
21
package org.midibox.sidlibr;
21
package org.midibox.sidlibr;
22
22
23
import javax.sound.midi.Receiver;
23
import javax.sound.midi.Receiver;
24
24
25
public class EnsBank  {
-
 
-
 
25
public class EnsBank {
26
    private Ensemble[] bank;
26
    private Ensemble[] bank;
27
    public static int ensSize = 1048;  // Number of SysEx string characters
-
 
-
 
27
    public static int ensSize = 1048; // Number of SysEx string characters
28
    public static int bankSize = 128;
28
    public static int bankSize = 128;
29
    private Receiver receiver;
29
    private Receiver receiver;
30
   
-
 
-
 
30
31
    public EnsBank(Receiver receiver) {
31
    public EnsBank(Receiver receiver) {
32
        this.receiver = receiver;
32
        this.receiver = receiver;
33
        initBank();
33
        initBank();
34
    }
34
    }
35
   
-
 
-
 
35
36
    public void initBank() {
36
    public void initBank() {
37
        bank = new Ensemble[bankSize];
37
        bank = new Ensemble[bankSize];
38
        for (int c=0;c<bankSize;c++) {
-
 
-
 
38
        for (int c = 0; c < bankSize; c++) {
39
            bank[c] = new Ensemble(receiver);
39
            bank[c] = new Ensemble(receiver);
40
        }
40
        }
41
    }
41
    }
42
   
-
 
-
 
42
43
    public void setEnsembleAt(int i, Ensemble p) {
43
    public void setEnsembleAt(int i, Ensemble p) {
44
        bank[i] = p;
44
        bank[i] = p;
45
    }
45
    }
46
   
-
 
-
 
46
47
    public Ensemble getEnsembleAt(int i) {
47
    public Ensemble getEnsembleAt(int i) {
48
        return bank[i];
48
        return bank[i];
49
    }
49
    }
50
   
-
 
51
    public String parseBankSyx(String syx){    
-
 
-
 
50
-
 
51
    public String parseBankSyx(String syx) {
52
        String status = "succesful";
52
        String status = "succesful";
53
        try {  
-
 
-
 
53
        try {
54
            initBank();
54
            initBank();
55
            for (int i=0;i<syx.length()/ensSize;i++) {
-
 
-
 
55
            for (int i = 0; i < syx.length() / ensSize; i++) {
56
                bank[i] = new Ensemble(receiver);
56
                bank[i] = new Ensemble(receiver);
57
                String stat = bank[i].parseEnsemble(syx.substring(i*ensSize,(i+1)*ensSize));
-
 
-
 
57
                String stat = bank[i].parseEnsemble(syx.substring(i * ensSize,
-
 
58
                        (i + 1) * ensSize));
58
                if (status == "checksum error") {
59
                if (status == "checksum error") {
59
                    status = stat;
60
                    status = stat;
60
                    break;
61
                    break;
61
                }
62
                }
62
            }
63
            }