From cfb96e9ef563e4cf39350b5b8721f4b5b70585d2 Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Sat, 16 Dec 2017 20:36:41 +0300 Subject: Added experimental VLC plugin Plugin is made for VLC 2.2.2 Weatherwax (pre-installed in Linux Mint 18.3) Existing issues: - No ability to change codec properties yet, this thing is WIP - By unknown reason, resulted sound has different (RANDOM) sample rate which is different from 44100 Hz --- src/adlmidi.cpp | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index dd4a3e1..b9e67cb 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -653,34 +653,21 @@ ADLMIDI_EXPORT int adl_generate(struct ADL_MIDIPlayer *device, int sampleCount, ssize_t n_periodCountStereo = 512; int left = sampleCount; - bool hasSkipped = setup.tick_skip_samples_delay > 0; - double delay = double(sampleCount) / double(setup.PCM_RATE); while(left > 0) { {//... const double eat_delay = delay < setup.maxdelay ? delay : setup.maxdelay; - if(hasSkipped) - { - size_t samples = setup.tick_skip_samples_delay > sampleCount ? sampleCount : setup.tick_skip_samples_delay; - n_periodCountStereo = samples / 2; - } - else - { - delay -= eat_delay; - setup.carry += setup.PCM_RATE * eat_delay; - n_periodCountStereo = static_cast(setup.carry); - setup.carry -= n_periodCountStereo; - } + delay -= eat_delay; + setup.carry += setup.PCM_RATE * eat_delay; + n_periodCountStereo = static_cast(setup.carry); + setup.carry -= n_periodCountStereo; { ssize_t leftSamples = left / 2; if(n_periodCountStereo > leftSamples) - { - setup.tick_skip_samples_delay = (n_periodCountStereo - leftSamples) * 2; n_periodCountStereo = leftSamples; - } //! Count of stereo samples ssize_t in_generatedStereo = (n_periodCountStereo > 512) ? 512 : n_periodCountStereo; //! Total count of samples @@ -719,13 +706,7 @@ ADLMIDI_EXPORT int adl_generate(struct ADL_MIDIPlayer *device, int sampleCount, gotten_len += (in_generatedPhys) /* - setup.stored_samples*/; } - if(hasSkipped) - { - setup.tick_skip_samples_delay -= n_periodCountStereo * 2; - hasSkipped = setup.tick_skip_samples_delay > 0; - } - else - player->TickIteratos(eat_delay); + player->TickIteratos(eat_delay); }//... } @@ -833,7 +814,7 @@ void adl_rt_patchChange(struct ADL_MIDIPlayer *device, ADL_UInt8 channel, ADL_UI player->realTime_PatchChange(channel, patch); } -void adl_rt_pitchBend(struct ADL_MIDIPlayer *device, ADL_UInt8 channel, ADL_UInt8 pitch) +void adl_rt_pitchBend(struct ADL_MIDIPlayer *device, ADL_UInt8 channel, ADL_UInt16 pitch) { if(!device) return; -- cgit v1.2.3