public void playBeat(TGTrack track, final List notes) {
   TGChannel tgChannel = this.songManager.getChannel(track.getChannelId());
   if (tgChannel != null) {
     int channelId = tgChannel.getChannelId();
     int bank = tgChannel.getBank();
     int program = tgChannel.getProgram();
     int volume = (int) ((this.getVolume() / 10.00) * tgChannel.getVolume());
     int balance = tgChannel.getBalance();
     int chorus = tgChannel.getChorus();
     int reverb = tgChannel.getReverb();
     int phaser = tgChannel.getPhaser();
     int tremolo = tgChannel.getTremolo();
     int size = notes.size();
     int[][] beat = new int[size][2];
     for (int i = 0; i < size; i++) {
       TGNote note = (TGNote) notes.get(i);
       beat[i][0] =
           track.getOffset()
               + (note.getValue()
                   + ((TGString) track.getStrings().get(note.getString() - 1)).getValue());
       beat[i][1] = note.getVelocity();
     }
     playBeat(channelId, bank, program, volume, balance, chorus, reverb, phaser, tremolo, beat);
   }
 }
  private void readChannel(TGSong song, TGTrack track, List channels) throws IOException {
    int index = (readInt() - 1);
    int effectChannel = (readInt() - 1);
    if (index >= 0 && index < channels.size()) {
      TGChannel channel = getFactory().newChannel();

      ((TGChannel) channels.get(index)).copy(channel);
      if (channel.getProgram() < 0) {
        channel.setProgram((short) 0);
      }
      if (!channel.isPercussionChannel()) {
        channel.setEffectChannel((short) effectChannel);
      }

      // ------------------------------------------//
      for (int i = 0; i < song.countChannels(); i++) {
        TGChannel channelAux = song.getChannel(i);
        if (channelAux.getChannel() == channel.getChannel()) {
          channel.setChannelId(channelAux.getChannelId());
        }
      }
      if (channel.getChannelId() <= 0) {
        channel.setChannelId(song.countChannels() + 1);
        channel.setName(("#" + channel.getChannelId()));
        song.addChannel(channel);
      }
      track.setChannelId(channel.getChannelId());
    }
  }
 private void updateProgram(TGChannel channel) {
   this.updateProgram(channel.getChannelId(), channel.getBank(), channel.getProgram());
 }