Some Tweaks again.

This commit is contained in:
Valentin Boettcher 2018-04-05 22:36:33 +02:00
parent 888e639c97
commit b00eee264e
3 changed files with 116 additions and 120 deletions

View file

@ -94,6 +94,7 @@ void ClipSelector::clipName(int clip, std::string name)
void ClipSelector::setClipBeats(int scene, int beats, bool isBeatsToRecord) void ClipSelector::setClipBeats(int scene, int beats, bool isBeatsToRecord)
{ {
clips[scene].setBeats(beats, isBeatsToRecord); clips[scene].setBeats(beats, isBeatsToRecord);
redraw();
} }
double getCairoTextWith(cairo_t * cr, const char * str) double getCairoTextWith(cairo_t * cr, const char * str)
@ -286,10 +287,9 @@ void setRecordBarsCb(Fl_Widget *w, void* data)
long bars = (long)data; long bars = (long)data;
if(bars == -2){ if(bars == -2){
const char* answer = fl_input("Enter a custom number: "); const char* answer = fl_input("Enter a custom number: ");
bars = atoi(answer); if(!answer || atoi(bars) <= 0|| atoi(bars) > MAX_BARS) {
if(!answer || bars <= 0|| bars > MAX_BARS) {
bars = -1; bars = -1;
fl_message("Invalid Input. You may enter a number smaller than %i!", MAX_BARS); fl_message("Please enter value between 1 and %.", MAX_BARS);
} else } else
bars = atoi(answer); bars = atoi(answer);
} }
@ -367,7 +367,7 @@ int ClipSelector::handle(int event)
RECORD_BARS_MENU_ITEM(4), RECORD_BARS_MENU_ITEM(4),
RECORD_BARS_MENU_ITEM(6), RECORD_BARS_MENU_ITEM(6),
RECORD_BARS_MENU_ITEM(8), RECORD_BARS_MENU_ITEM(8),
{"Endless", 0, setRecordBarsCb, (void*)-1, FL_MENU_DIVIDER | (clips[clipNum].getBeatsToRecord() <= 0) ? FL_ACTIVATE : 0 {"Endless", 0, setRecordBarsCb, (void*)-1, FL_MENU_DIVIDER | FL_MENU_RADIO | ((clips[clipNum].getBeatsToRecord() <= 0) ? FL_ACTIVATE : 0)
| empty ? 0 : FL_MENU_INACTIVE}, | empty ? 0 : FL_MENU_INACTIVE},
{"Custom", 0, setRecordBarsCb, (void*)-2, empty ? 0 : FL_MENU_INACTIVE}, {"Custom", 0, setRecordBarsCb, (void*)-2, empty ? 0 : FL_MENU_INACTIVE},
{0}, {0},

View file

@ -65,7 +65,7 @@
#define LUPPP_RETURN_WARNING 1 #define LUPPP_RETURN_WARNING 1
#define LUPPP_RETURN_ERROR 2 #define LUPPP_RETURN_ERROR 2
#define MAX_BARS 100 #define MAX_BARS 64
/// debug.hxx for printing convienience /// debug.hxx for printing convienience
#include "debug.hxx" #include "debug.hxx"

View file

@ -110,10 +110,6 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
// handle state of clip, and do what needs doing: // handle state of clip, and do what needs doing:
// record into buffer, play from buffer, etc // record into buffer, play from buffer, etc
if ( clips[clip]->recording() ) { if ( clips[clip]->recording() ) {
if(clips[clip]->getBeatsToRecord() > 0 && clips[clip]->getBeats() >= clips[clip]->getBeatsToRecord() - 4)
clips[clip]->queuePlay(true);
if ( clips[clip]->recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST && if ( clips[clip]->recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST &&
!clips[clip]->newBufferInTransit() ) { !clips[clip]->newBufferInTransit() ) {
EventLooperClipRequestBuffer e( track, clip, clips[clip]->audioBufferSize() + LOOPER_SAMPLES_UPDATE_SIZE); EventLooperClipRequestBuffer e( track, clip, clips[clip]->audioBufferSize() + LOOPER_SAMPLES_UPDATE_SIZE);