mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-06 01:21:38 -05:00
-Working on RadialView and ClipSelector
This commit is contained in:
parent
6af789a1f8
commit
387ce7f65f
7 changed files with 46 additions and 52 deletions
|
@ -61,6 +61,7 @@ class ClipState
|
||||||
void play(){_playing = true;}
|
void play(){_playing = true;}
|
||||||
void stop(){_playing = false; _recording = false;}
|
void stop(){_playing = false; _recording = false;}
|
||||||
void queue(){_queued = true;}
|
void queue(){_queued = true;}
|
||||||
|
void unqueue(){_queued = false;}
|
||||||
void stopQueue(){_queued = false;}
|
void stopQueue(){_queued = false;}
|
||||||
void record(){_recording = true; _loaded = true;}
|
void record(){_recording = true; _loaded = true;}
|
||||||
void stopRecord(){_recording = false;}
|
void stopRecord(){_recording = false;}
|
||||||
|
@ -131,17 +132,25 @@ class ClipSelector : public Fl_Button
|
||||||
{
|
{
|
||||||
case Looper::STATE_PLAYING:
|
case Looper::STATE_PLAYING:
|
||||||
printf("clipSelector setState() clip %i = CLIP_PLAYING\n", clipNum);
|
printf("clipSelector setState() clip %i = CLIP_PLAYING\n", clipNum);
|
||||||
|
for(int i = 0; i < numClips; i++ )
|
||||||
|
clips[clipNum].stop();
|
||||||
clips[clipNum].play();
|
clips[clipNum].play();
|
||||||
break;
|
break;
|
||||||
case Looper::STATE_PLAY_QUEUED:
|
case Looper::STATE_PLAY_QUEUED:
|
||||||
|
for(int i = 0; i < numClips; i++ )
|
||||||
|
clips[clipNum].unqueue();
|
||||||
clips[clipNum].queue();
|
clips[clipNum].queue();
|
||||||
printf("clipSelector setState() clip %i = CLIP_QUEUED\n", clipNum);
|
printf("clipSelector setState() clip %i = CLIP_QUEUED\n", clipNum);
|
||||||
break;
|
break;
|
||||||
case Looper::STATE_RECORDING:
|
case Looper::STATE_RECORDING:
|
||||||
|
for(int i = 0; i < numClips; i++ )
|
||||||
|
clips[clipNum].stopRecord();
|
||||||
clips[clipNum].record();
|
clips[clipNum].record();
|
||||||
printf("clipSelector setState() clip %i = CLIP_RECORDING\n", clipNum);
|
printf("clipSelector setState() clip %i = CLIP_RECORDING\n", clipNum);
|
||||||
break;
|
break;
|
||||||
case Looper::STATE_RECORD_QUEUED:
|
case Looper::STATE_RECORD_QUEUED:
|
||||||
|
for(int i = 0; i < numClips; i++ )
|
||||||
|
clips[clipNum].unqueue();
|
||||||
clips[clipNum].queue();
|
clips[clipNum].queue();
|
||||||
printf("clipSelector setState() clip %i = CLIP_QUEUED\n", clipNum);
|
printf("clipSelector setState() clip %i = CLIP_QUEUED\n", clipNum);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -84,57 +84,31 @@ class RadialStatus : public Fl_Slider
|
||||||
|
|
||||||
cairo_save( cr );
|
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 xc = (w) / 2.f;
|
||||||
int yc = (h) / 2.f;
|
int yc = (h) / 2.f;
|
||||||
|
|
||||||
float angle = value();
|
float angle = value();
|
||||||
|
|
||||||
|
/*
|
||||||
// draw background quadrants
|
// draw background quadrants
|
||||||
int nbeats = 4;
|
int nbeats = 4;
|
||||||
for(int i = 0; i < nbeats; i ++ )
|
for(int i = 0; i < nbeats; i ++ )
|
||||||
{
|
{
|
||||||
int mod = i % 4;
|
cairo_set_source_rgba(cr, 0.0, 0.0, 1.f, 1);
|
||||||
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);
|
|
||||||
|
|
||||||
float start = (i-1) * (3.1415*2)/nbeats;
|
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_line_cap ( cr, CAIRO_LINE_CAP_ROUND );
|
||||||
cairo_set_source_rgb( cr, _bgr, _bgg, _bgb );
|
cairo_move_to( cr, x + xc, y + yc );
|
||||||
cairo_arc_negative( cr, x + xc, y + yc, xc - 7, -(3.1415/2), angle * 6.28 - (3.1415/2) );
|
cairo_arc( 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_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);
|
cairo_stroke(cr);
|
||||||
|
|
||||||
// inside circle
|
// inside circle
|
||||||
|
@ -143,12 +117,10 @@ class RadialStatus : public Fl_Slider
|
||||||
cairo_set_line_width(cr, 4.2);
|
cairo_set_line_width(cr, 4.2);
|
||||||
cairo_fill(cr);
|
cairo_fill(cr);
|
||||||
|
|
||||||
|
|
||||||
cairo_move_to (cr,x + xc, y + yc);
|
cairo_move_to (cr,x + xc, y + yc);
|
||||||
cairo_set_source_rgba (cr, 1.0, 0.48, 0.0, 1);
|
cairo_set_source_rgba (cr, 1.0, 0.48, 0.0, 1);
|
||||||
cairo_rotate ( cr, angle * 6.28 );
|
cairo_rotate ( cr, angle * 6.28 );
|
||||||
cairo_rel_line_to ( cr,0, - (yc - 11) );
|
cairo_rel_line_to ( cr,0, - (yc - 11) );
|
||||||
cairo_set_line_cap ( cr, CAIRO_LINE_CAP_ROUND );
|
|
||||||
cairo_stroke(cr);
|
cairo_stroke(cr);
|
||||||
|
|
||||||
cairo_restore( cr );
|
cairo_restore( cr );
|
||||||
|
|
|
@ -43,7 +43,7 @@ class GTrack : public Fl_Group
|
||||||
title( strdup(l) ),
|
title( strdup(l) ),
|
||||||
bg( x, y , w, h, title ),
|
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,""),
|
clipSel(x + 5, y + 26 + 102, 100, 294,""),
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,9 @@ Looper::Looper(int t) :
|
||||||
stopRecordOnBar(false),
|
stopRecordOnBar(false),
|
||||||
endPoint (0),
|
endPoint (0),
|
||||||
lastWrittenSampleIndex(0),
|
lastWrittenSampleIndex(0),
|
||||||
playPoint (0)
|
playPoint (0),
|
||||||
|
uiUpdateConstant(44100/30),
|
||||||
|
uiUpdateCounter(44100/30)
|
||||||
{
|
{
|
||||||
// pre-zero the internal sample
|
// pre-zero the internal sample
|
||||||
for(int i = 0; i < 10; i++)
|
for(int i = 0; i < 10; i++)
|
||||||
|
@ -139,6 +141,8 @@ void Looper::updateControllers()
|
||||||
else if ( state == STATE_STOPPED )
|
else if ( state == STATE_STOPPED )
|
||||||
{
|
{
|
||||||
jack->getControllerUpdater()->clipSelect(track, scene, Controller::CLIP_MODE_LOADED);
|
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:
|
// FIXME:
|
||||||
// using the track output causes distortion: clipping / not proper writing.
|
// using the track output causes distortion: clipping / not proper writing.
|
||||||
// writing to master fixes issue, so its due to trackOutput or Looper 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* out = buffers->audio[Buffers::MASTER_OUTPUT];
|
||||||
|
|
||||||
float playbackSpeed = endPoint / ( float(numBeats) * fpb );
|
float playbackSpeed = endPoint / ( float(numBeats) * fpb );
|
||||||
semitoneShift = -( 12 * log ( playbackSpeed ) / log (2) );
|
semitoneShift = -( 12 * log ( playbackSpeed ) / log (2) );
|
||||||
|
|
||||||
if ( state == STATE_PLAYING ||
|
if ( state == STATE_PLAYING ||
|
||||||
(state == STATE_STOP_QUEUED && !stopRecordOnBar) )
|
state == STATE_STOP_QUEUED )
|
||||||
{
|
{
|
||||||
for(int i = 0; i < nframes; i++)
|
for(int i = 0; i < nframes; i++)
|
||||||
{
|
{
|
||||||
|
@ -197,16 +201,22 @@ void Looper::process(int nframes, Buffers* buffers)
|
||||||
playPoint += 1.0; //playbackSpeed;
|
playPoint += 1.0; //playbackSpeed;
|
||||||
|
|
||||||
//*out++ = sin( playPoint * 440 * 6.24 );
|
//*out++ = sin( playPoint * 440 * 6.24 );
|
||||||
*out++ = tmpBuffer[i];
|
*trk = tmpBuffer[i];
|
||||||
|
*out++ = *trk++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now pitch-shift the audio in the buffer
|
// now pitch-shift the audio in the buffer
|
||||||
//pitchShift( nframes, &tmpBuffer[0], out);
|
//pitchShift( nframes, &tmpBuffer[0], out);
|
||||||
|
|
||||||
|
if ( uiUpdateCounter > uiUpdateConstant )
|
||||||
|
{
|
||||||
float prog = (float(playPoint) / (fpb*numBeats));
|
float prog = (float(playPoint) / (fpb*numBeats));
|
||||||
EventLooperProgress e(track, prog );
|
EventLooperProgress e(track, prog );
|
||||||
writeToGuiRingbuffer( &e );
|
writeToGuiRingbuffer( &e );
|
||||||
}
|
}
|
||||||
|
uiUpdateCounter += nframes;
|
||||||
|
}
|
||||||
|
/*
|
||||||
// stopRecordOnBar ensures we record right up to the bar measure
|
// stopRecordOnBar ensures we record right up to the bar measure
|
||||||
else if ( state == STATE_RECORDING || stopRecordOnBar )
|
else if ( state == STATE_RECORDING || stopRecordOnBar )
|
||||||
{
|
{
|
||||||
|
@ -218,6 +228,7 @@ void Looper::process(int nframes, Buffers* buffers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,9 @@ class Looper : public Observer, public AudioProcessor
|
||||||
float fRec0[2];
|
float fRec0[2];
|
||||||
float crossfadeSize;
|
float crossfadeSize;
|
||||||
float fSamplingFreq;
|
float fSamplingFreq;
|
||||||
|
|
||||||
|
int uiUpdateConstant;
|
||||||
|
int uiUpdateCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LUPPP_LOOPER_H
|
#endif // LUPPP_LOOPER_H
|
||||||
|
|
|
@ -59,7 +59,7 @@ class TrackOutput : public AudioProcessor
|
||||||
previousInChain->process( nframes, buffers );
|
previousInChain->process( nframes, buffers );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
float* buf = buffers->audio[Buffers::TRACK_0 + track];
|
float* buf = buffers->audio[Buffers::TRACK_0 + track];
|
||||||
dbMeter.process( nframes, buf, buf );
|
dbMeter.process( nframes, buf, buf );
|
||||||
|
|
||||||
|
@ -70,7 +70,6 @@ class TrackOutput : public AudioProcessor
|
||||||
uiUpdateCounter = 0;
|
uiUpdateCounter = 0;
|
||||||
}
|
}
|
||||||
uiUpdateCounter += nframes;
|
uiUpdateCounter += nframes;
|
||||||
*/
|
|
||||||
|
|
||||||
/// copy audio data into reverb / sidechain / master buffers
|
/// copy audio data into reverb / sidechain / master buffers
|
||||||
float* trackBuf = buffers->audio[Buffers::TRACK_0 + track];
|
float* trackBuf = buffers->audio[Buffers::TRACK_0 + track];
|
||||||
|
|
2
wscript
2
wscript
|
@ -12,7 +12,7 @@ def options(opt):
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
conf.load('compiler_cxx')
|
conf.load('compiler_cxx')
|
||||||
#conf.env.append_value('CXXFLAGS', ['-g', '-Wall','-Werror','-Wextra']) #'-O2'
|
#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='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='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')
|
#conf.check_cfg(package='lilv-0',at_least_version='1.0',args='--cflags --libs',uselib_store='LILV')
|
||||||
|
|
Loading…
Add table
Reference in a new issue