-Working on FIXME list
This commit is contained in:
parent
3c1e956fc4
commit
0b44c1c55a
13 changed files with 43 additions and 30 deletions
3
run.sh
3
run.sh
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
make && xterm -e "sleep 1 && aj-snapshot -r .ajsnapshot" & bin/luppp
|
||||
make
|
||||
xterm -e "sleep 1 && aj-snapshot -r .ajsnapshot" & bin/luppp
|
||||
|
|
|
@ -8,3 +8,5 @@ grep -irn "FIXME" src/ >> FIXME
|
|||
|
||||
echo -e "\n\n\n===> TODO" >> FIXME
|
||||
grep -irn "TODO" src/ >> FIXME
|
||||
|
||||
geany FIXME
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define MAX_BUFFER_SIZE 1024
|
||||
// nsamples remaining during recording before Looper requests larger buffer
|
||||
#define LOOPER_SAMPLES_BEFORE_REQUEST 44100
|
||||
#define LOOPER_SAMPLES_UPDATE_SIZE 44100
|
||||
|
||||
#define LUPPP_RETURN_OK 0
|
||||
#define LUPPP_RETURN_ERROR 1
|
||||
|
|
|
@ -195,6 +195,7 @@ void DiskReader::readMaster()
|
|||
#endif
|
||||
}
|
||||
}
|
||||
// TODO add samplerate to session JSON
|
||||
|
||||
// sceneNames
|
||||
{
|
||||
|
|
|
@ -77,6 +77,8 @@ void DiskWriter::writeMaster()
|
|||
|
||||
cJSON_AddNumberToObject( masterTrack, "fader", master->getVolume()->value() );
|
||||
cJSON_AddNumberToObject( masterTrack, "bpm", gui->getMasterTrack()->getBpm() );
|
||||
// TODO add samplerate to session JSON
|
||||
//cJSON_AddNumberToObject( masterTrack, "samplerate", gui->getMasterTrack()->getBpm() );
|
||||
|
||||
// scene names
|
||||
Avtk::ClipSelector* clipSelector = master->getClipSelector();
|
||||
|
|
|
@ -22,7 +22,6 @@ extern int jackSamplerate;
|
|||
|
||||
Jack::Jack() :
|
||||
client( jack_client_open ( "Luppp", JackNullOption , 0 , 0 ) ),
|
||||
timeManager(),
|
||||
controllerUpdater( new ControllerUpdater() ),
|
||||
state( new State() ),
|
||||
clientActive(false)
|
||||
|
@ -30,11 +29,11 @@ Jack::Jack() :
|
|||
jack = this;
|
||||
// construct Observer classes here, not in the initializer list as the Jack*
|
||||
// will be 0x0 until then.
|
||||
timeManager = new TimeManager(),
|
||||
metronome = new Metronome();
|
||||
logic = new Logic();
|
||||
gridLogic = new GridLogic();
|
||||
|
||||
|
||||
buffers.nframes = jack_get_buffer_size( client );
|
||||
buffers.samplerate = jack_get_sample_rate( client );
|
||||
|
||||
|
@ -112,7 +111,7 @@ Jack::Jack() :
|
|||
|
||||
buffers.audio[Buffers::TRACK_0 + i] = new float[ buffers.nframes ];
|
||||
|
||||
timeManager.registerObserver( loopers.back() );
|
||||
timeManager->registerObserver( loopers.back() );
|
||||
}
|
||||
|
||||
/// setup DSP instances
|
||||
|
@ -378,7 +377,7 @@ int Jack::timebase(jack_transport_state_t state,
|
|||
buffers.transportState =&state;
|
||||
|
||||
// update "time" from JACK master, or write master?
|
||||
timeManager.process( &buffers );
|
||||
timeManager->process( &buffers );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class Jack
|
|||
Logic* getLogic(){return logic;}
|
||||
Metronome* getMetronome(){return metronome;}
|
||||
GridLogic* getGridLogic(){return gridLogic;}
|
||||
TimeManager* getTimeManager(){return &timeManager;}
|
||||
TimeManager* getTimeManager(){return timeManager;}
|
||||
ControllerUpdater* getControllerUpdater(){return controllerUpdater;}
|
||||
|
||||
/// register MIDI observers: they're called when a MIDI message arrives on
|
||||
|
@ -67,7 +67,7 @@ class Jack
|
|||
jack_client_t* client;
|
||||
|
||||
Buffers buffers;
|
||||
TimeManager timeManager;
|
||||
TimeManager* timeManager;
|
||||
Metronome* metronome;
|
||||
State* state;
|
||||
Logic* logic;
|
||||
|
|
|
@ -14,10 +14,11 @@ extern Jack* jack;
|
|||
Looper::Looper(int t) :
|
||||
AudioProcessor(),
|
||||
TimeObserver(),
|
||||
track(t),
|
||||
uiUpdateConstant(44100/30.f),
|
||||
uiUpdateCounter(44100/30.f)
|
||||
track(t)
|
||||
{
|
||||
uiUpdateConstant= jack->getSamplerate() / 30.f;
|
||||
uiUpdateCounter = jack->getSamplerate() / 30.f;
|
||||
|
||||
// pre-zero the internal sample
|
||||
//tmpRecordBuffer = (float*)malloc( sizeof(float) * MAX_BUFFER_SIZE );
|
||||
//memset( tmpRecordBuffer, 0, sizeof(float) * MAX_BUFFER_SIZE );
|
||||
|
@ -69,7 +70,7 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
|
|||
if ( clips[clip]->recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST &&
|
||||
!clips[clip]->newBufferInTransit() )
|
||||
{
|
||||
EventLooperClipRequestBuffer e( track, clip, clips[clip]->audioBufferSize() + 44100 * 4);
|
||||
EventLooperClipRequestBuffer e( track, clip, clips[clip]->audioBufferSize() + LOOPER_SAMPLES_UPDATE_SIZE);
|
||||
writeToGuiRingbuffer( &e );
|
||||
clips[clip]->newBufferInTransit(true);
|
||||
}
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
#include "jack.hxx"
|
||||
#include "buffers.hxx"
|
||||
|
||||
#include "observer/time.hxx"
|
||||
|
||||
extern Jack* jack;
|
||||
|
||||
using namespace std;
|
||||
|
||||
Metronome::Metronome() :
|
||||
|
@ -17,7 +19,7 @@ Metronome::Metronome() :
|
|||
playPoint (0)
|
||||
{
|
||||
// create beat and bar samples
|
||||
endPoint = (44100.f/441);
|
||||
endPoint = ( jack->getSamplerate() / 441 );
|
||||
// samples per cycle of
|
||||
float scale = 2 * 3.1415 / endPoint;
|
||||
|
||||
|
|
|
@ -16,10 +16,13 @@ extern Jack* jack;
|
|||
using namespace std;
|
||||
|
||||
TimeManager::TimeManager():
|
||||
fpb(22050),
|
||||
oldBeat(0),
|
||||
observers()
|
||||
{
|
||||
samplerate = jack->getSamplerate();
|
||||
// 120 BPM default
|
||||
fpb = samplerate / 2;
|
||||
|
||||
tapTempoPos = 0;
|
||||
tapTempo[0] = 0;
|
||||
tapTempo[1] = 0;
|
||||
|
@ -36,7 +39,7 @@ int TimeManager::getFpb()
|
|||
void TimeManager::setBpm(float bpm)
|
||||
{
|
||||
cout << "setBpm() " << bpm << endl;
|
||||
setFpb( jack->getSamplerate() / bpm * 60 );
|
||||
setFpb( samplerate / bpm * 60 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +48,7 @@ void TimeManager::setFpb(float f)
|
|||
fpb = f;
|
||||
//cout << "setFpb() " << fpb << endl;
|
||||
|
||||
int bpm = (44100 * 60) / f;
|
||||
int bpm = ( samplerate * 60) / f;
|
||||
|
||||
char buffer [50];
|
||||
sprintf (buffer, "TM, setFpb() %i, bpm = %i", int(f), int(bpm) );
|
||||
|
@ -67,7 +70,7 @@ void TimeManager::registerObserver(TimeObserver* o)
|
|||
observers.push_back(o);
|
||||
o->setFpb( fpb );
|
||||
|
||||
int bpm = (44100 * 60) / fpb;
|
||||
int bpm = ( samplerate * 60) / fpb;
|
||||
EventTimeBPM e2( bpm );
|
||||
writeToGuiRingbuffer( &e2 );
|
||||
}
|
||||
|
@ -75,8 +78,7 @@ void TimeManager::registerObserver(TimeObserver* o)
|
|||
void TimeManager::tap()
|
||||
{
|
||||
// reset tap tempo to "first tap" if more than 5 secs elapsed since last tap
|
||||
int sr = 44100;
|
||||
if ( tapTempo[0] < frame - sr * 5 )
|
||||
if ( tapTempo[0] < frame - samplerate * 5 )
|
||||
{
|
||||
tapTempoPos = 0;
|
||||
}
|
||||
|
@ -154,7 +156,7 @@ void TimeManager::process(Buffers* buffers)
|
|||
|
||||
buffers->transportPosition->ticks_per_beat = 1920;
|
||||
|
||||
int bpm = int(buffers->samplerate * fpb / 60.0);
|
||||
int bpm = int( samplerate * fpb / 60.0);
|
||||
buffers->transportPosition->beats_per_minute = bpm;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ class TimeManager
|
|||
void process(Buffers* buffers);
|
||||
|
||||
private:
|
||||
int samplerate;
|
||||
|
||||
float fpb;
|
||||
int oldBeat;
|
||||
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
|
||||
#include "trackoutput.hxx"
|
||||
|
||||
// valgrind no access code
|
||||
//#include <valgrind/memcheck.h>
|
||||
//VALGRIND_MAKE_MEM_NOACCESS( &_trackBuffer[0] , MAX_BUFFER_SIZE );
|
||||
#include "jack.hxx"
|
||||
extern Jack* jack;
|
||||
|
||||
TrackOutput::TrackOutput(int t, AudioProcessor* ap) :
|
||||
AudioProcessor(),
|
||||
track(t),
|
||||
_recordArm(false),
|
||||
previousInChain(ap),
|
||||
dbMeter(44100)
|
||||
previousInChain(ap)
|
||||
{
|
||||
// UI update
|
||||
uiUpdateConstant = 44100 / 30;
|
||||
uiUpdateCounter = 44100 / 30;
|
||||
uiUpdateConstant = jack->getSamplerate() / 30;
|
||||
uiUpdateCounter = jack->getSamplerate() / 30;
|
||||
|
||||
dbMeter = new DBMeter( jack->getSamplerate() );
|
||||
|
||||
_toReverb = 0.0;
|
||||
_toMaster = 0.8;
|
||||
|
@ -60,11 +60,11 @@ void TrackOutput::process(unsigned int nframes, Buffers* buffers)
|
|||
previousInChain->process( nframes, buffers );
|
||||
|
||||
// run the meter
|
||||
dbMeter.process( nframes, trackBuffer, trackBuffer );
|
||||
dbMeter->process( nframes, trackBuffer, trackBuffer );
|
||||
|
||||
if (uiUpdateCounter > uiUpdateConstant )
|
||||
{
|
||||
EventTrackSignalLevel e( track, dbMeter.getLeftDB() * _toMaster, dbMeter.getRightDB() * _toMaster );
|
||||
EventTrackSignalLevel e( track, dbMeter->getLeftDB() * _toMaster, dbMeter->getRightDB() * _toMaster );
|
||||
writeToGuiRingbuffer( &e );
|
||||
uiUpdateCounter = 0;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class TrackOutput : public AudioProcessor
|
|||
// Metering variables
|
||||
long uiUpdateCounter;
|
||||
long uiUpdateConstant;
|
||||
DBMeter dbMeter;
|
||||
DBMeter* dbMeter;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue