mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-19 15:11:23 +01:00
Extensive changes to improve NoteTrack display and (some) editing, NoteTrack playback via MIDI, and Midi-to-Audio alignment.
This commit is contained in:
@@ -4,21 +4,41 @@
|
||||
*/
|
||||
|
||||
#include "allegro.h"
|
||||
#include "scorealign-glue.h"
|
||||
#include "audioreader.h"
|
||||
#include "audiomixerreader.h"
|
||||
#include "scorealign.h"
|
||||
#include "scorealign-glue.h"
|
||||
#include "audiomixerreader.h"
|
||||
|
||||
void scorealign(void *mixer, mixer_process_fn fn_ptr, int chans, double srate,
|
||||
double end_time, Alg_seq *seq)
|
||||
|
||||
int scorealign(void *mixer, mixer_process_fn fn_ptr, int chans, double srate,
|
||||
double end_time, Alg_seq *seq, SAProgress *progress,
|
||||
ScoreAlignParams ¶ms)
|
||||
{
|
||||
Scorealign sa;
|
||||
sa.frame_period = 0.2;
|
||||
sa.window_size = 0.2;
|
||||
sa.frame_period = params.mFramePeriod;
|
||||
sa.window_size = params.mWindowSize;
|
||||
sa.silence_threshold = params.mSilenceThreshold;
|
||||
sa.force_final_alignment = (params.mForceFinalAlignment != 0.0);
|
||||
sa.ignore_silence = (params.mIgnoreSilence != 0.0);
|
||||
sa.presmooth_time = params.mPresmoothTime;
|
||||
sa.line_time = params.mLineTime;
|
||||
sa.smooth_time = params.mSmoothTime;
|
||||
|
||||
Audio_mixer_reader reader(mixer, fn_ptr, chans, srate, end_time);
|
||||
reader.calculate_parameters(sa, false);
|
||||
sa.align_midi_to_audio(*seq, reader, true);
|
||||
sa.midi_tempo_align(*seq, false);
|
||||
sa.progress = progress;
|
||||
int result = sa.align_midi_to_audio(*seq, reader);
|
||||
|
||||
params.mMidiStart = sa.first_x * sa.actual_frame_period_0;
|
||||
params.mMidiEnd = (sa.last_x + 1) * sa.actual_frame_period_0;
|
||||
params.mAudioStart = sa.first_y * sa.actual_frame_period_1;
|
||||
params.mAudioEnd = (sa.last_y + 1) * sa.actual_frame_period_1;
|
||||
|
||||
if (result != SA_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
sa.midi_tempo_align(*seq);
|
||||
// seq has now been modified to conform to audio provided by mixer
|
||||
seq->set_real_dur(end_time);
|
||||
return SA_SUCCESS; // success
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user