void debug_xm_sample_header(int instrument_ix, xm_sample_header_t * sample_header)
{
  printf("sample header: instrument_ix: %d:\n", instrument_ix);
  printf("  volume %d\n", sample_header->volume);
  printf("  finetune %d\n", sample_header->finetune);
  printf("  type %x\n", sample_header->type);
  printf("  panning %d\n", sample_header->panning);
  printf("  relative_note_number %d\n", sample_header->relative_note_number);
  printf("  sample_length      % 6d\n", s32(&sample_header->sample_length));
  printf("  sample_loop_start  % 6d\n", s32(&sample_header->sample_loop_start));
  printf("  sample_loop_length % 6d\n", s32(&sample_header->sample_loop_length));
}

void debug_note(interpreter_state& state, int ch, xm_pattern_format_t * pf)
{
  static xm_pattern_format_t column[8];
  /*
  printf("note[%d]\n", note_ix);
  printf("  note: %d\n", pf->note);
  printf("  instrument: %d\n", pf->instrument);
  printf("  volume_column_byte: %d\n", pf->volume_column_byte);
  printf("  effect_type: %d\n", pf->effect_type);
  printf("  effect_parameter: %d\n", pf->effect_parameter);
  */
  column[ch].note = pf->note;
  column[ch].instrument = pf->instrument;
  column[ch].volume_column_byte = pf->volume_column_byte;
  column[ch].effect_type = pf->effect_type;
  column[ch].effect_parameter = pf->effect_parameter;

  if (ch == 7) {
    printf("%3d %3d |", state.pattern_index, state.line_index);
    for (int i = 0; i < state.number_of_channels; i++)
      printf(" %2d %2d %2x%02x |",
             column[i].note,
             column[i].instrument,
             column[i].effect_type,
             column[i].effect_parameter);
    printf("\n");
  }
}
