Beispiel #1
0
  private TGChannel readChannel(List<TGChannel> channels) throws IOException {
    TGChannel result = null;

    int index = (readInt() - 1);
    int effectChannel = (readInt() - 1);
    if (index >= 0 && index < channels.size()) {
      result = channels.get(index).clone();
      if (result.getInstrument() < 0) {
        result.setInstrument((short) 0);
      }
      if (!result.isPercussionChannel()) {
        result.setEffectChannel((short) effectChannel);
      }
    }

    return result;
  }
Beispiel #2
0
 private List<TGChannel> readChannels() throws IOException {
   List<TGChannel> channels = new ArrayList<TGChannel>();
   for (int i = 0; i < 64; i++) {
     TGChannel channel = new TGChannel();
     channel.setChannel((short) i);
     channel.setEffectChannel((short) i);
     channel.setInstrument((short) readInt());
     channel.setVolume(toChannelShort(readByte()));
     channel.setBalance(toChannelShort(readByte()));
     channel.setChorus(toChannelShort(readByte()));
     channel.setReverb(toChannelShort(readByte()));
     channel.setPhaser(toChannelShort(readByte()));
     channel.setTremolo(toChannelShort(readByte()));
     channels.add(channel);
     skip(2);
   }
   return channels;
 }