Skip to content
This repository was archived by the owner on May 17, 2025. It is now read-only.

Commit bf35370

Browse files
author
tlr
committed
fix fl studio glitches on stop play
1 parent b1d784b commit bf35370

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed

config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define PLUG_NAME "TIME1"
22
#define PLUG_MFR "tilr"
3-
#define PLUG_VERSION_HEX 0x00010000
4-
#define PLUG_VERSION_STR "1.0.0"
3+
#define PLUG_VERSION_HEX 0x00010001
4+
#define PLUG_VERSION_STR "1.0.1"
55
#define PLUG_UNIQUE_ID 'tm1'
66
#define PLUG_MFR_ID 'tilr'
77
#define PLUG_URL_STR "https://github.com/tiagolr/time1"
@@ -29,8 +29,8 @@
2929
#define PLUG_FPS 60
3030
#define PLUG_SHARED_RESOURCES 0
3131
#define PLUG_HOST_RESIZE 1
32-
#define PLUG_MIN_WIDTH 256
33-
#define PLUG_MIN_HEIGHT 256
32+
#define PLUG_MIN_WIDTH 540
33+
#define PLUG_MIN_HEIGHT 460
3434
#define PLUG_MAX_WIDTH 8192
3535
#define PLUG_MAX_HEIGHT 8192
3636

dist/TIME1.vst3

512 Bytes
Binary file not shown.

src/TIME1.cpp

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ TIME1::TIME1(const InstanceInfo& info)
6464
inited = true;
6565
layoutControls(g);
6666
};
67+
68+
onSyncChange(); // FIX - attempt to force set syncQN on Bitwig
6769
}
6870

6971
void TIME1::makeControls(IGraphics* g)
@@ -231,27 +233,7 @@ void TIME1::OnParamChange(int paramIdx)
231233
pattern = patterns[(int)GetParam(kPattern)->Value() - 1];
232234
}
233235
else if (paramIdx == kSync) {
234-
dirtyControls = true;
235-
auto sync = GetParam(kSync)->Value();
236-
if (sync == 0) syncQN = 1./4.; // 1/16
237-
if (sync == 1) syncQN = 1./2.; // 1/8
238-
if (sync == 2) syncQN = 1/1; // 1/4
239-
if (sync == 3) syncQN = 1*2; // 1/2
240-
if (sync == 4) syncQN = 1*4; // 1bar
241-
if (sync == 5) syncQN = 1*8; // 2bar
242-
if (sync == 6) syncQN = 1*16; // 4bar
243-
if (sync == 7) syncQN = 1./6.; // 1/16t
244-
if (sync == 8) syncQN = 1./3.; // 1/8t
245-
if (sync == 9) syncQN = 2./3.; // 1/4t
246-
if (sync == 10) syncQN = 4./3.; // 1/2t
247-
if (sync == 11) syncQN = 8./3.; // 1/1t
248-
if (sync == 12) syncQN = 1./4.*1.5; // 1/16.
249-
if (sync == 13) syncQN = 1./2.*1.5; // 1/8.
250-
if (sync == 14) syncQN = 1./1.*1.5; // 1/4.
251-
if (sync == 15) syncQN = 2./1.*1.5; // 1/2.
252-
if (sync == 16) syncQN = 4./1.*1.5; // 1/1.
253-
254-
resizeDelays();
236+
onSyncChange();
255237
}
256238
else if (paramIdx == kGrid) {
257239
gridSegs = (int)GetParam(kGrid)->Value();
@@ -264,6 +246,31 @@ void TIME1::OnParamChange(int paramIdx)
264246
}
265247
}
266248

249+
void TIME1::onSyncChange()
250+
{
251+
dirtyControls = true;
252+
auto sync = GetParam(kSync)->Value();
253+
if (sync == 0) syncQN = 1./4.; // 1/16
254+
if (sync == 1) syncQN = 1./2.; // 1/8
255+
if (sync == 2) syncQN = 1/1; // 1/4
256+
if (sync == 3) syncQN = 1*2; // 1/2
257+
if (sync == 4) syncQN = 1*4; // 1bar
258+
if (sync == 5) syncQN = 1*8; // 2bar
259+
if (sync == 6) syncQN = 1*16; // 4bar
260+
if (sync == 7) syncQN = 1./6.; // 1/16t
261+
if (sync == 8) syncQN = 1./3.; // 1/8t
262+
if (sync == 9) syncQN = 2./3.; // 1/4t
263+
if (sync == 10) syncQN = 4./3.; // 1/2t
264+
if (sync == 11) syncQN = 8./3.; // 1/1t
265+
if (sync == 12) syncQN = 1./4.*1.5; // 1/16.
266+
if (sync == 13) syncQN = 1./2.*1.5; // 1/8.
267+
if (sync == 14) syncQN = 1./1.*1.5; // 1/4.
268+
if (sync == 15) syncQN = 2./1.*1.5; // 1/2.
269+
if (sync == 16) syncQN = 4./1.*1.5; // 1/1.
270+
271+
resizeDelays();
272+
}
273+
267274
void TIME1::resizeDelays()
268275
{
269276
const int size = syncQN * GetSampleRate() * 60 / GetTempo();
@@ -408,6 +415,13 @@ void TIME1::ProcessBlock(sample** inputs, sample** outputs, int nFrames)
408415
outputs[1][s] = inputs[1][s];
409416
}
410417
}
418+
419+
else { // FIX FL studio glitches on stop play
420+
for (int s = 0; s < nFrames; ++s) {
421+
outputs[0][s] = inputs[0][s];
422+
outputs[1][s] = inputs[1][s];
423+
}
424+
}
411425
}
412426

413427
void TIME1::ProcessMidiMsg(const IMidiMsg& msg)

src/TIME1.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class TIME1 final : public Plugin
109109
void makeStyles();
110110
void makeControls(IGraphics* g);
111111

112+
void onSyncChange();
112113
void resizeDelays();
113114
void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override;
114115
void ProcessMidiMsg(const IMidiMsg& msg) override;

0 commit comments

Comments
 (0)