Closed GoogleCodeExporter closed 8 years ago
This functionality could be added, it's related to something else on the big
to-do list.
Original comment by raynebc
on 27 Apr 2013 at 5:47
FWIW I sat down and wrote something up myself (mostly cut'n'pasted from
eof_gp_import_track) that appears to do what I want:
int eof_gp_import_all() {
int selected, tracknum, ctr;
if(eof_song && eof_song->track[eof_selected_track]->track_format == EOF_PRO_GUITAR_TRACK_FORMAT)
{ //Only perform this action if a pro guitar/bass track is active
if(!gp_import_undo_made)
{ //If an undo state wasn't already made
eof_prepare_undo(EOF_UNDO_TYPE_NONE); //Make one now
gp_import_undo_made = 1;
}
eof_clear_input();
key[KEY_Y] = 0;
key[KEY_N] = 0;
for(ctr = eof_song->text_events; ctr > 0; ctr--)
{ //For each of the project's text events (in reverse order)
if(eof_song->text_event[ctr - 1]->track == eof_selected_track)
{ //If the text event is assigned to the track being replaced
eof_song_delete_text_event(eof_song, ctr - 1); //Delete it
}
}
unsigned long tracknum = eof_song->track[eof_selected_track]->tracknum;
eof_parsed_gp_file->track[0]->parent = eof_song->pro_guitar_track[tracknum]->parent;
for(ctr = 0; ctr < eof_song->pro_guitar_track[tracknum]->notes; ctr++)
{ //For each note in the active track
free(eof_song->pro_guitar_track[tracknum]->note[ctr]); //Free its memory
}
free(eof_song->pro_guitar_track[tracknum]); //Free the active track
eof_song->pro_guitar_track[tracknum] = eof_parsed_gp_file->track[0]; //Replace it with the track imported from the Guitar Pro file
//Correct the track's tuning array from absolute to relative
for(ctr = 0; ctr < 6; ctr++)
{ //For each of the 6 supported strings
int default_tuning = eof_lookup_default_string_tuning_absolute(eof_song->pro_guitar_track[tracknum], eof_selected_track, ctr); //Get the default absolute tuning for this string
if(default_tuning >= 0)
{ //If the default tuning was found
eof_song->pro_guitar_track[tracknum]->tuning[ctr] -= default_tuning; //Convert the tuning to relative
eof_song->pro_guitar_track[tracknum]->tuning[ctr] %= 12; //Ensure the stored value is bounded to [-11,11]
}
}
free(eof_parsed_gp_file->names[0]); //Free the imported track's name
for (ctr = 0; ctr < eof_parsed_gp_file->track[0]->notes; ctr++) {
eof_parsed_gp_file->track[0]->note[ctr]->type = 0;
}
eof_song->pro_guitar_track[tracknum]->parent->difficulty = eof_parsed_gp_file->numtracks;
eof_song->pro_guitar_track[tracknum]->parent->numdiffs = eof_parsed_gp_file->numtracks;
eof_song->pro_guitar_track[tracknum]->parent->flags |= EOF_TRACK_FLAG_UNLIMITED_DIFFS;
for (selected = 1; selected < eof_parsed_gp_file->numtracks; selected++)
{
free(eof_parsed_gp_file->names[selected]); //Free the imported track's name
for (ctr = 0; ctr < eof_parsed_gp_file->track[selected]->notes; ctr++) {
EOF_PRO_GUITAR_NOTE *note = eof_pro_guitar_track_add_note(eof_song->pro_guitar_track[tracknum]);
memcpy(note, eof_parsed_gp_file->track[selected]->note[ctr], sizeof(EOF_PRO_GUITAR_NOTE));
note->type = selected;
}
}
eof_parsed_gp_file->numtracks = 0;
}
}
Original comment by quarns...@gmail.com
on 17 Jun 2013 at 12:03
Completed in r1159.
Original comment by raynebc
on 18 Jun 2013 at 8:35
Original issue reported on code.google.com by
quarns...@gmail.com
on 27 Apr 2013 at 7:45