-Working on RadialView and ClipSelector

This commit is contained in:
Harry van Haaren 2013-07-30 18:34:47 +01:00
parent 6af789a1f8
commit 387ce7f65f
7 changed files with 46 additions and 52 deletions

View file

@ -61,6 +61,7 @@ class ClipState
void play(){_playing = true;}
void stop(){_playing = false; _recording = false;}
void queue(){_queued = true;}
void unqueue(){_queued = false;}
void stopQueue(){_queued = false;}
void record(){_recording = true; _loaded = true;}
void stopRecord(){_recording = false;}
@ -131,17 +132,25 @@ class ClipSelector : public Fl_Button
{
case Looper::STATE_PLAYING:
printf("clipSelector setState() clip %i = CLIP_PLAYING\n", clipNum);
for(int i = 0; i < numClips; i++ )
clips[clipNum].stop();
clips[clipNum].play();
break;
case Looper::STATE_PLAY_QUEUED:
for(int i = 0; i < numClips; i++ )
clips[clipNum].unqueue();
clips[clipNum].queue();
printf("clipSelector setState() clip %i = CLIP_QUEUED\n", clipNum);
break;
case Looper::STATE_RECORDING:
for(int i = 0; i < numClips; i++ )
clips[clipNum].stopRecord();
clips[clipNum].record();
printf("clipSelector setState() clip %i = CLIP_RECORDING\n", clipNum);
break;
case Looper::STATE_RECORD_QUEUED:
for(int i = 0; i < numClips; i++ )
clips[clipNum].unqueue();
clips[clipNum].queue();
printf("clipSelector setState() clip %i = CLIP_QUEUED\n", clipNum);
break;

View file

@ -84,57 +84,31 @@ class RadialStatus : public Fl_Slider
cairo_save( cr );
cairo_rectangle( cr, x+1, y+1, w-2, h-2 );
cairo_set_source_rgb( cr, _bgr, _bgg, _bgb );
cairo_fill_preserve(cr);
cairo_set_line_width(cr, 1.3);
cairo_rectangle( cr, x+1, y+1, w-2, h-2 );
if ( highlight )
{
cairo_set_source_rgba(cr, _r, _g, _b, 0.4);
cairo_fill_preserve(cr);
}
float alpha = 0.6;
if (mouseOver)
alpha = 1;
cairo_set_source_rgba(cr, 0.4, 0.4, 0.4, alpha);
if ( highlight )
cairo_set_line_width(cr, 2.2);
cairo_stroke(cr);
int xc = (w) / 2.f;
int yc = (h) / 2.f;
float angle = value();
/*
// draw background quadrants
int nbeats = 4;
for(int i = 0; i < nbeats; i ++ )
{
int mod = i % 4;
if ( mod == 0 )
cairo_set_source_rgba(cr,0.0,1,0.f , 1);
else if ( mod == 1 )
cairo_set_source_rgba(cr,1.0,1.0,0.0, 1);
else if ( mod == 2 )
cairo_set_source_rgba(cr,1.0,0.48,0 , 1);
else if ( mod == 3 )
cairo_set_source_rgba(cr,1.0,0.f,0.f, 1);
cairo_set_source_rgba(cr, 0.0, 0.0, 1.f, 1);
float start = (i-1) * (3.1415*2)/nbeats;
cairo_arc( cr, x + xc, y + yc, xc - 7, start, start + (3.1415/2) );
cairo_set_line_width(cr, 5.2);
cairo_stroke(cr);
}
*/
// blank rest of circle
cairo_set_source_rgb( cr, _bgr, _bgg, _bgb );
cairo_arc_negative( cr, x + xc, y + yc, xc - 7, -(3.1415/2), angle * 6.28 - (3.1415/2) );
cairo_set_line_width(cr, 5.4);
cairo_set_line_cap ( cr, CAIRO_LINE_CAP_ROUND );
cairo_move_to( cr, x + xc, y + yc );
cairo_arc( cr, x + xc, y + yc, xc - 7, -(3.1415/2), angle * 6.28 - (3.1415/2) );
cairo_set_source_rgba( cr, 0 / 255.f, 153 / 255.f , 255 / 255.f , 0.21 );
cairo_set_line_width(cr, 1.0);
cairo_stroke_preserve(cr);
cairo_fill_preserve(cr);
cairo_set_source_rgba( cr, 0 / 255.f, 153 / 255.f , 255 / 255.f , 0.8 );
cairo_set_line_width(cr, 5.2);
cairo_stroke(cr);
// inside circle
@ -143,12 +117,10 @@ class RadialStatus : public Fl_Slider
cairo_set_line_width(cr, 4.2);
cairo_fill(cr);
cairo_move_to (cr,x + xc, y + yc);
cairo_set_source_rgba (cr, 1.0, 0.48, 0.0, 1);
cairo_rotate ( cr, angle * 6.28 );
cairo_rel_line_to ( cr,0, - (yc - 11) );
cairo_set_line_cap ( cr, CAIRO_LINE_CAP_ROUND );
cairo_stroke(cr);
cairo_restore( cr );

View file

@ -43,7 +43,7 @@ class GTrack : public Fl_Group
title( strdup(l) ),
bg( x, y , w, h, title ),
radial( x+5, y+ 26, 100, 100, "Source UI"),
radial( x+5, y+ 26, 100, 100, ""),
clipSel(x + 5, y + 26 + 102, 100, 294,""),

View file

@ -20,7 +20,9 @@ Looper::Looper(int t) :
stopRecordOnBar(false),
endPoint (0),
lastWrittenSampleIndex(0),
playPoint (0)
playPoint (0),
uiUpdateConstant(44100/30),
uiUpdateCounter(44100/30)
{
// pre-zero the internal sample
for(int i = 0; i < 10; i++)
@ -139,6 +141,8 @@ void Looper::updateControllers()
else if ( state == STATE_STOPPED )
{
jack->getControllerUpdater()->clipSelect(track, scene, Controller::CLIP_MODE_LOADED);
EventLooperProgress e(track, 0 );
writeToGuiRingbuffer( &e );
}
}
@ -179,14 +183,14 @@ void Looper::process(int nframes, Buffers* buffers)
// FIXME:
// using the track output causes distortion: clipping / not proper writing.
// writing to master fixes issue, so its due to trackOutput or Looper writing...?
//float* out = buffers->audio[Buffers::TRACK_0 + track];
float* trk = buffers->audio[Buffers::TRACK_0 + track];
float* out = buffers->audio[Buffers::MASTER_OUTPUT];
float playbackSpeed = endPoint / ( float(numBeats) * fpb );
semitoneShift = -( 12 * log ( playbackSpeed ) / log (2) );
if ( state == STATE_PLAYING ||
(state == STATE_STOP_QUEUED && !stopRecordOnBar) )
state == STATE_STOP_QUEUED )
{
for(int i = 0; i < nframes; i++)
{
@ -197,16 +201,22 @@ void Looper::process(int nframes, Buffers* buffers)
playPoint += 1.0; //playbackSpeed;
//*out++ = sin( playPoint * 440 * 6.24 );
*out++ = tmpBuffer[i];
*trk = tmpBuffer[i];
*out++ = *trk++;
}
// now pitch-shift the audio in the buffer
//pitchShift( nframes, &tmpBuffer[0], out);
float prog = (float(playPoint) / (fpb*numBeats));
EventLooperProgress e(track, prog );
writeToGuiRingbuffer( &e );
if ( uiUpdateCounter > uiUpdateConstant )
{
float prog = (float(playPoint) / (fpb*numBeats));
EventLooperProgress e(track, prog );
writeToGuiRingbuffer( &e );
}
uiUpdateCounter += nframes;
}
/*
// stopRecordOnBar ensures we record right up to the bar measure
else if ( state == STATE_RECORDING || stopRecordOnBar )
{
@ -218,6 +228,7 @@ void Looper::process(int nframes, Buffers* buffers)
}
}
}
*/
}

View file

@ -71,6 +71,9 @@ class Looper : public Observer, public AudioProcessor
float fRec0[2];
float crossfadeSize;
float fSamplingFreq;
int uiUpdateConstant;
int uiUpdateCounter;
};
#endif // LUPPP_LOOPER_H

View file

@ -59,7 +59,7 @@ class TrackOutput : public AudioProcessor
previousInChain->process( nframes, buffers );
}
/*
float* buf = buffers->audio[Buffers::TRACK_0 + track];
dbMeter.process( nframes, buf, buf );
@ -70,7 +70,6 @@ class TrackOutput : public AudioProcessor
uiUpdateCounter = 0;
}
uiUpdateCounter += nframes;
*/
/// copy audio data into reverb / sidechain / master buffers
float* trackBuf = buffers->audio[Buffers::TRACK_0 + track];

View file

@ -12,7 +12,7 @@ def options(opt):
def configure(conf):
conf.load('compiler_cxx')
#conf.env.append_value('CXXFLAGS', ['-g', '-Wall','-Werror','-Wextra']) #'-O2'
conf.env.append_value('CXXFLAGS', ['-g', '-Wall','-Werror','-march=native','-msse','-mfpmath=sse','-ffast-math']) #'-O2'
conf.env.append_value('CXXFLAGS', ['-g', '-Wall','-march=native','-msse','-mfpmath=sse','-ffast-math']) #'-O2','-Werror'
conf.check_cfg(package='ntk',at_least_version='1.3',args='--cflags --libs',uselib_store='NTK')
conf.check_cfg(package='jack',at_least_version='0.118',args='--cflags --libs',uselib_store='JACK')
#conf.check_cfg(package='lilv-0',at_least_version='1.0',args='--cflags --libs',uselib_store='LILV')