Phase 22: add non-destructive audio splitting, clip gain and fades, and cached waveforms
This commit is contained in:
parent
73fc5eea8d
commit
01d8c1d661
23 changed files with 650 additions and 18 deletions
|
|
@ -351,6 +351,13 @@ static xtc_result read_project(reader *input, xtc_project *project, const char *
|
|||
return XTC_ERR_FORMAT;
|
||||
clip->midi = (int)value;
|
||||
}
|
||||
clip->gain = 1.0f;
|
||||
if (format_version >= 8U) {
|
||||
READ("AUDIO", 4U);
|
||||
if (!decode_float(input->tokens[1], &clip->gain)) return XTC_ERR_FORMAT;
|
||||
NUM(2U, clip->fade_in_tick);
|
||||
NUM(3U, clip->fade_out_tick);
|
||||
}
|
||||
}
|
||||
if (format_version >= 3U) {
|
||||
READ("NOTES", 3U);
|
||||
|
|
@ -513,6 +520,12 @@ static xtc_result write_project(FILE *file, const xtc_project *project, const ch
|
|||
return XTC_ERR_IO;
|
||||
if (fprintf(file, "MIDI %d\n", clip->midi) < 0)
|
||||
return XTC_ERR_IO;
|
||||
{
|
||||
uint32_t bits;
|
||||
memcpy(&bits, &clip->gain, sizeof(bits));
|
||||
if (fprintf(file, "AUDIO %08" PRIx32 " %" PRIu64 " %" PRIu64 "\n", bits,
|
||||
clip->fade_in_tick, clip->fade_out_tick) < 0) return XTC_ERR_IO;
|
||||
}
|
||||
}
|
||||
if (fprintf(file, "NOTES %" PRIu64 " %zu\n", project->next_note_id, project->note_count) < 0)
|
||||
return XTC_ERR_IO;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue