Commit 399c5fcf authored by Georg Krause's avatar Georg Krause

Make GUI part of Engine and move Disk reader/writer to Engine

This is a first step in making a headless run of Loopp possible. The GUI gets an
independend member of the Engine. This way we can decide on runtime wheather to create
or not.
parent 838a9943
Pipeline #899 passed with stages
in 1 minute and 19 seconds
......@@ -28,9 +28,6 @@
#include <FL/fl_draw.H>
#include "../gui.hxx"
extern Gui* gui;
using namespace std;
namespace Avtk
......@@ -77,10 +74,6 @@ public:
void resize(int X, int Y, int W, int H)
{
if ( stickToRight ) {
x = gui->getWindowWidth() - w;
}
redraw();
}
......
......@@ -25,8 +25,6 @@
#include "../gui.hxx"
extern Gui* gui;
namespace Avtk
{
......@@ -284,21 +282,22 @@ int ClipSelector::handle(int event)
if ( !m ) {
return 0;
} else if ( strcmp(m->label(), "Load") == 0 ) {
gui->selectLoadSample( ID, clipNum );
// gui->selectLoadSample( ID, clipNum ); TODO
} else if ( strcmp(m->label(), "Save") == 0 ) {
//gui->saveBufferPath = "/tmp/test.wav";
char* tmp = gui->selectSavePath();
if(tmp && strlen(tmp)) {
if( access( tmp, F_OK ) != -1 ) {
int overwrite = fl_choice("Overwrite file?","Cancel","Overwrite",0);
if (!overwrite) {
return 0;
}
}
gui->saveBufferPath = tmp;
free(tmp);
gui->selectSaveSample( ID, clipNum );
}
// TODO
// char* tmp = gui->selectSavePath();
// if(tmp && strlen(tmp)) {
// if( access( tmp, F_OK ) != -1 ) {
// int overwrite = fl_choice("Overwrite file?","Cancel","Overwrite",0);
// if (!overwrite) {
// return 0;
// }
// }
// gui->saveBufferPath = tmp;
// free(tmp);
// gui->selectSaveSample( ID, clipNum );
// }
} else if ( strcmp(m->label(), "1 ") == 0 ) {
EventLooperLoopLength e = EventLooperLoopLength(ID, clipNum ,1);
writeToDspRingbuffer( &e );
......
......@@ -26,6 +26,7 @@
#include <sys/stat.h>
#include "config.hxx"
#include "engine.hxx"
#include "gui.hxx"
#include "event.hxx"
#include "audiobuffer.hxx"
......@@ -37,11 +38,9 @@
#include <sndfile.hh>
#include <samplerate.h>
extern Gui* gui;
using namespace std;
DiskReader::DiskReader()
DiskReader::DiskReader(Gui* gui) : _gui(gui)
{
resampleQuality = 1;
......@@ -92,12 +91,12 @@ int DiskReader::loadPreferences()
s_home << getenv ( "HOME" )
<< "/.config/soundship/loopp/controllers/"
<< ctlr->valuestring;
gui->addMidiControllerToSetup (
_gui->addMidiControllerToSetup (
s_home.str () );
stringstream s_share;
s_share << "/usr/share/loopp/"
<< ctlr->valuestring;
gui->addMidiControllerToSetup (
_gui->addMidiControllerToSetup (
s_share.str () );
}
}
......@@ -113,13 +112,13 @@ int DiskReader::loadPreferences()
s<<dir<<"/"<<projDir->valuestring;
dir=s.str();
}
gui->setProjectsDir(dir);
Engine::getInstance()->setProjectsDir(dir);
//Enable per track send and resturn jack ports?
cJSON* jackPerTrackOutput=cJSON_GetObjectItem(preferencesJson,"enablePerTrackOutput");
if(jackPerTrackOutput) {
gui->enablePerTrackOutput=jackPerTrackOutput->valueint;
if(gui->enablePerTrackOutput)
Engine::getInstance()->enablePerTrackOutput=jackPerTrackOutput->valueint;
if(Engine::getInstance()->enablePerTrackOutput)
LOOPP_NOTE("Enabling per track output ports");
}
......@@ -146,7 +145,7 @@ int DiskReader::loadPreferences()
LOOPP_WARN("Preferences, file doesn't exist: ~/.config/soundship/loopp/loopp.prefs");
// so write default file
gui->getDiskWriter()->writeDefaultConfigToUserHome();
Engine::getInstance()->getDiskWriter()->writeDefaultConfigToUserHome();
return LOOPP_RETURN_OK;
}
......@@ -158,9 +157,9 @@ int DiskReader::showAudioEditor(AudioBuffer* ab)
{
while ( ab->getBeats() == 0 ) {
// FIXME: Cancel = no load sample?
gui->getAudioEditor()->show( ab, true );
_gui->getAudioEditor()->show( ab, true );
while ( gui->getAudioEditor()->shown() ) Fl::wait();
while ( _gui->getAudioEditor()->shown() ) Fl::wait();
// handle "cancel" return
if ( ab->getBeats() == -1 ) {
......@@ -207,10 +206,10 @@ int DiskReader::loadSample( int track, int scene, string path )
}
/// resample?
if ( infile.samplerate() != gui->samplerate ) {
LOOPP_NOTE("%s%i%s%i", "Resampling from ", infile.samplerate(), " to ", gui->samplerate);
if ( infile.samplerate() != _gui->samplerate ) {
LOOPP_NOTE("%s%i%s%i", "Resampling from ", infile.samplerate(), " to ", _gui->samplerate);
float resampleRatio = float(gui->samplerate) / infile.samplerate();
float resampleRatio = float(_gui->samplerate) / infile.samplerate();
std::vector<float> resampledL( infile.frames() / chnls * resampleRatio );
std::vector<float> resampledR( infile.frames() / chnls * resampleRatio );
......@@ -364,7 +363,7 @@ int DiskReader::loadSample( int track, int scene, string path )
writeToDspRingbuffer( &e );
// now write audiobuffer name to GUI on track, scene
gui->getTrack( track )->getClipSelector()->clipName( scene, n );
_gui->getTrack( track )->getClipSelector()->clipName( scene, n );
char* tmp = strdup( path.c_str() );
lastLoadedSamplePath = dirname( tmp );
......@@ -537,7 +536,7 @@ int DiskReader::readMaster()
{
cJSON* names = cJSON_GetObjectItem( master, "sceneNames");
if ( names ) {
GMasterTrack* master = gui->getMasterTrack();
GMasterTrack* master = _gui->getMasterTrack();
Avtk::ClipSelector* clipSelector = master->getClipSelector();
int nscenes = cJSON_GetArraySize( names );
for(int s = 0; s < nscenes; s++ ) {
......@@ -579,7 +578,7 @@ int DiskReader::readScenes(int t, cJSON* track)
// FIXME: check GUI ringbuffer after each sample: with resampling it can
// take quite some time, and the ->GUI ringbuffer can fill up
handleGuiEvents();
handleGuiEvents(_gui);
} // nClips loop
}
......@@ -606,7 +605,7 @@ int DiskReader::readTracks()
if( !name ) {
LOOPP_WARN("Track %i has no name data saved.", t);
} else {
gui->getTrack(t)->bg.copy_label( name->valuestring );
_gui->getTrack(t)->bg.copy_label( name->valuestring );
}
}
// fader
......
......@@ -24,6 +24,7 @@
#include "cjson/cJSON.h"
class AudioBuffer;
class Gui;
/** DiskReader
* This class reads a previously saved session from disk, restoring Loopp's
......@@ -40,7 +41,7 @@ class AudioBuffer;
class DiskReader
{
public:
DiskReader();
DiskReader(Gui* gui);
/// loads default settings for Loopp: controller instances etc
int loadPreferences();
......@@ -73,6 +74,8 @@ private:
// sample load dialog
int resampleQuality;
std::string lastLoadedSamplePath;
Gui* _gui;
};
#endif // LOOPP_DISK_READER_H
......@@ -37,11 +37,10 @@
#include <sndfile.hh>
extern Gui* gui;
using namespace std;
DiskWriter::DiskWriter()
DiskWriter::DiskWriter(Gui* gui) :
_gui(gui)
{
sessionJson = cJSON_CreateObject();
audioJson = cJSON_CreateObject();
......@@ -118,7 +117,7 @@ void DiskWriter::initialize(std::string path, std::string name )
sessionDirStream << path;
if ( !gui->getNsm() )
if ( !_gui->getNsm() )
sessionDirStream << "/" << sessionName << ".loopp";
sessionDir = sessionDirStream.str();
......@@ -283,7 +282,7 @@ int DiskWriter::writeAudioBuffer(int track, int scene, AudioBuffer* ab,
cJSON_AddNumberToObject(sampleClip,"beats", ab->getBeats() );
// get pretty name from GUI
std::string clipName = gui->getTrack(track)->getClipSelector()->clipName( scene );
std::string clipName = _gui->getTrack(track)->getClipSelector()->clipName( scene );
cJSON_AddItemToObject ( sampleClip, "name", cJSON_CreateString( clipName.c_str() ));
// write the AudioBuffer contents to <path>/audio/ as <name>.wav
......@@ -296,7 +295,7 @@ int DiskWriter::writeAudioBuffer(int track, int scene, AudioBuffer* ab,
}
SndfileHandle outfile( path.str(), SFM_WRITE, SF_FORMAT_WAV | SF_FORMAT_FLOAT, 2, gui->samplerate );
SndfileHandle outfile( path.str(), SFM_WRITE, SF_FORMAT_WAV | SF_FORMAT_FLOAT, 2, _gui->samplerate );
// FIXME: the size of the buffer is bigger than the audio contained in it:
// calculate the length that needs saving using getBeats() * framesPerBeat
......@@ -319,22 +318,22 @@ void DiskWriter::writeMaster()
// Master track stuff
cJSON* masterTrack = cJSON_CreateObject();
cJSON_AddItemToObject(sessionJson, "master", masterTrack );
GMasterTrack* master = gui->getMasterTrack();
GMasterTrack* master = _gui->getMasterTrack();
cJSON_AddNumberToObject( masterTrack, "fader", master->getVolume()->value() );
cJSON_AddNumberToObject( masterTrack, "bpm", gui->getMasterTrack()->getBpm() );
cJSON_AddNumberToObject( masterTrack, "bpm", _gui->getMasterTrack()->getBpm() );
// TODO add samplerate to session JSON
//cJSON_AddNumberToObject( masterTrack, "samplerate", gui->getMasterTrack()->getBpm() );
cJSON_AddNumberToObject( masterTrack, "inputVolume", gui->getMasterTrack()->getInputVolume()->value() );
cJSON_AddNumberToObject( masterTrack, "inputVolume", _gui->getMasterTrack()->getInputVolume()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToSndActive", gui->getMasterTrack()->getInputToSend()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToKeyActive", gui->getMasterTrack()->getInputToSidechainKey()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToMixActive", gui->getMasterTrack()->getInputToMix()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToSndActive", _gui->getMasterTrack()->getInputToSend()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToKeyActive", _gui->getMasterTrack()->getInputToSidechainKey()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToMixActive", _gui->getMasterTrack()->getInputToMix()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToSndVol", gui->getMasterTrack()->getInputToSendVol()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToXSide", gui->getMasterTrack()->getInputToXSide()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToMixVol", gui->getMasterTrack()->getInputToMixVol()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToSndVol", _gui->getMasterTrack()->getInputToSendVol()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToXSide", _gui->getMasterTrack()->getInputToXSide()->value() );
cJSON_AddNumberToObject( masterTrack, "inputToMixVol", _gui->getMasterTrack()->getInputToMixVol()->value() );
// scene names
Avtk::ClipSelector* clipSelector = master->getClipSelector();
......@@ -376,19 +375,19 @@ int DiskWriter::writeSession()
// add track metadata: volumes, sends etc
cJSON_AddNumberToObject( track, "ID", t );
cJSON_AddStringToObject( track, "name", gui->getTrack(t)->bg.label() );
cJSON_AddStringToObject( track, "name", _gui->getTrack(t)->bg.label() );
cJSON_AddNumberToObject( track, "fader", gui->getTrack(t)->getVolume()->value() );
cJSON_AddNumberToObject( track, "pan", gui->getTrack(t)->getPan());
cJSON_AddNumberToObject( track, "fader", _gui->getTrack(t)->getVolume()->value() );
cJSON_AddNumberToObject( track, "pan", _gui->getTrack(t)->getPan());
cJSON_AddNumberToObject( track, "sendAmount", gui->getTrack(t)->getSend() );
cJSON_AddNumberToObject( track, "sendActive", gui->getTrack(t)->getSendActive() );
cJSON_AddNumberToObject( track, "sendAmount", _gui->getTrack(t)->getSend() );
cJSON_AddNumberToObject( track, "sendActive", _gui->getTrack(t)->getSendActive() );
cJSON_AddNumberToObject( track, "jacksendAmount", gui->getTrack(t)->getJackSend() );
cJSON_AddNumberToObject( track, "jacksendActive", gui->getTrack(t)->getJackSendActivate() );
cJSON_AddNumberToObject( track, "jacksendAmount", _gui->getTrack(t)->getJackSend() );
cJSON_AddNumberToObject( track, "jacksendActive", _gui->getTrack(t)->getJackSendActivate() );
cJSON_AddNumberToObject( track, "xsideAmount", gui->getTrack(t)->getXSide() );
cJSON_AddNumberToObject( track, "keyActive", gui->getTrack(t)->getKeyActive() );
cJSON_AddNumberToObject( track, "xsideAmount", _gui->getTrack(t)->getXSide() );
cJSON_AddNumberToObject( track, "keyActive", _gui->getTrack(t)->getKeyActive() );
// write clipData vector into clip placeholder
cJSON* clips = cJSON_CreateArray();
......
......@@ -26,6 +26,7 @@
class AudioBuffer;
class Controller;
class Gui;
enum CONTROLLER_INFO {
CONTROLLER_NAME,
......@@ -53,7 +54,7 @@ public:
class DiskWriter
{
public:
DiskWriter();
DiskWriter(Gui* gui);
~DiskWriter();
/// sets up session write path etc
......@@ -98,6 +99,8 @@ private:
void writeMaster();
std::string controllerInfo[CONTROLLER_INFO_SIZE];
Gui* _gui;
};
#endif // LOOPP_DISK_WRITER_H
......@@ -11,20 +11,18 @@
#include "gui.hxx"
#include "jack.hxx"
#include "trackoutput.hxx"
#include "gui.hxx"
#include "event.hxx"
extern Gui* gui;
Engine* Engine::_engine = nullptr;
void Engine::setup(std::string name)
void Engine::setup(std::string name, const char* argZero)
{
if(_engine == 0) {
new Engine(name);
// TODO create GUI here
LOOPP_NOTE("create Engine");
new Engine(name, argZero);
LOOPP_NOTE("Engine created");
return;
} else {
LOOPP_WARN("Loopp Engine already exists!");
......@@ -34,12 +32,13 @@ void Engine::setup(std::string name)
Engine* Engine::getInstance()
{
if(!_engine)
Engine::setup("");
Engine::setup("", "");
return _engine;
}
Engine::Engine(std::string name) :
_state(new State()), _controllerUpdater(new ControllerUpdater())
Engine::Engine(std::string name, const char* argZero) :
_state(new State()),
_controllerUpdater(new ControllerUpdater())
{
_engine = this;
// construct Observer classes here, not in the initializer list as the _audioDriver*
......@@ -49,6 +48,17 @@ Engine::Engine(std::string name) :
_metronome = new Metronome();
_logic = new Logic();
_gridLogic = new GridLogic(_engine);
_gui = new Gui(argZero, _engine);
_diskReader = new DiskReader(_gui);
_diskWriter = new DiskWriter(_gui);
// read settings file using diskreader, and setup controllers etc
int prefs = _diskReader->loadPreferences();
if(prefs != LOOPP_RETURN_OK) {
LOOPP_WARN("No preferences loaded, using defaults.");
} else {
LOOPP_NOTE("Loaded preferences");
}
// CAREFUL: setup the size by default: otherwise malloc() is called on push_back
midiIO.reserve(CONTROLLERS_PREALLOC);
......@@ -115,9 +125,8 @@ Engine::Engine(std::string name) :
masterVol = 0.75f;
masterVolLag = 0.75f;
masterMeter = new DBMeter(
_audioDriver->getSamplerate());
inputMeter = new DBMeter(_audioDriver->getSamplerate());
masterMeter = new DBMeter(_audioDriver->getSamplerate());
inputMeter = new DBMeter(_audioDriver->getSamplerate());
_buffers.audio[Buffers::SEND_L] =
new float[_audioDriver->getBuffersize()];
......@@ -150,12 +159,15 @@ Engine::Engine(std::string name) :
}
// call into the GUI, telling it to register default controllers
gui->setupMidiControllers();
_gui->setupMidiControllers();
recordedClips = 0;
recordingClips = 0;
_audioDriver->activate();
// Main Application Loop
_gui->show();
}
Engine::~Engine()
......@@ -170,6 +182,9 @@ Engine::~Engine()
delete inputMeter;
delete masterMeter;
delete _diskReader;
delete _diskWriter;
// Traverse tracks using the first track as offset
for(int track = 0; track < NTRACKS; track++) {
// index = first-track + (track * channels)
......@@ -260,7 +275,7 @@ void Engine::process(unsigned int nframes)
memset(_buffers.audio[Buffers::HEADPHONES_OUT_R], 0,
sizeof(float) * nframes);
if(gui->enablePerTrackOutput) {
if(enablePerTrackOutput) {
// Traverse tracks using the first track as offset
for(int track = 0; track < NTRACKS; track++) {
// index = first-track + (track * channels)
......@@ -463,7 +478,7 @@ void Engine::processFrames(int nframes)
_buffers.audio[Buffers::JACK_SIDECHAIN_SIGNAL_R] =
&_buffers.audio[Buffers::JACK_SIDECHAIN_SIGNAL_R]
[nframes];
if(gui->enablePerTrackOutput) {
if(enablePerTrackOutput) {
// Traverse tracks using the first track as offset
for(int track = 0; track < NTRACKS; track++) {
// index = first-track + (track * channels)
......@@ -594,7 +609,11 @@ GridLogic* Engine::getGridLogic() { return _gridLogic; }
Metronome* Engine::getMetronome() { return _metronome; }
void Engine::quit() { _audioDriver->quit(); }
void Engine::quit()
{
_audioDriver->quit();
_gui->quit();
}
void Engine::resetMidiBindingState()
{
......@@ -642,4 +661,10 @@ void Engine::clearInternalBuffers(int nframes)
memset(_buffers.audio[Buffers::RETURN_TRACK_0_R + trackoffset],
0, sizeof(float) * nframes);
}
}
\ No newline at end of file
}
void Engine::reset() {
_gui->reset();
}
void Engine::setProjectsDir(string dir) { projectsDir = dir; }
\ No newline at end of file
......@@ -34,12 +34,15 @@ class MidiIO;
class DBMeter;
class JackSendReturn;
class Jack;
class Gui;
class DiskReader;
class DiskWriter;
using namespace std;
class Engine {
public:
static void setup(std::string name);
static void setup(std::string name, const char* argZero);
static Engine* getInstance();
~Engine();
void quit(); // TODO implement
......@@ -76,11 +79,11 @@ public:
void setFreeRecMode(bool e);
/// set the master i/o volume / sends
void inputVolume(float vol);
void masterVolume(float vol);
void returnVolume(float vol);
void inputTo(INPUT_TO to, float v);
void inputToActive(INPUT_TO to, bool a);
void inputVolume(float vol);
void masterVolume(float vol);
void returnVolume(float vol);
void inputTo(INPUT_TO to, float v);
void inputToActive(INPUT_TO to, bool a);
float getInputVolume() { return inputVol; }
// MIDI binding creation
......@@ -103,8 +106,20 @@ public:
float getSmoothingValue() { return _smoothingValue; };
DiskWriter* getDiskWriter() { return _diskWriter; }
DiskReader* getDiskReader() { return _diskReader; }
/// The project directory is the default directoy which is shown upon load/save
void setProjectsDir(string dir);
string getProjectsDir() { return projectsDir; };
void reset();
////Enable per track send and resturn jack ports // TODO setting per session
bool enablePerTrackOutput;
private:
Engine(string name);
Engine(string name, const char* argZero);
void init();
Jack* _audioDriver;
......@@ -114,6 +129,11 @@ private:
Logic* _logic;
GridLogic* _gridLogic;
ControllerUpdater* _controllerUpdater;
Gui* _gui;
std::string projectsDir;
DiskReader* _diskReader;
DiskWriter* _diskWriter;
Buffers _buffers;
......
......@@ -22,6 +22,8 @@
#include "event.hxx"
#include <jack/ringbuffer.h>
class Gui;
extern EventBase* processDspMem;
extern EventBase* processGuiMem;
......@@ -30,7 +32,7 @@ extern jack_ringbuffer_t* rbToGui;
// to process events in the ringbuffer
extern void handleDspEvents();
extern void handleGuiEvents();
extern void handleGuiEvents(Gui* gui);
// to write events to the ringbuffer
extern void writeToDspRingbuffer(EventBase* e);
......
......@@ -35,11 +35,9 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
extern Gui* gui;
using namespace std;
void handleGuiEvents()
void handleGuiEvents(Gui* gui)
{
uint availableRead = jack_ringbuffer_read_space( rbToGui );
......@@ -257,9 +255,9 @@ void handleGuiEvents()
cout << "EventSaveBuffer: " << ev.track << " " << ev.scene << " " << ev.ab->getID() << endl;
#endif
if(gui->saveBufferPath.empty()) {
gui->getDiskWriter()->writeAudioBuffer( ev.track, ev.scene, ev.ab );
Engine::getInstance()->getDiskWriter()->writeAudioBuffer( ev.track, ev.scene, ev.ab );
} else {
gui->getDiskWriter()->writeAudioBuffer(ev.track, ev.scene, ev.ab, gui->saveBufferPath.c_str());
Engine::getInstance()->getDiskWriter()->writeAudioBuffer(ev.track, ev.scene, ev.ab, gui->saveBufferPath.c_str());
gui->saveBufferPath = "";
}
......@@ -274,7 +272,7 @@ void handleGuiEvents()
#ifdef DEBUG_SAVE
cout << "EventSaveFinish!" << endl;
#endif
gui->getDiskWriter()->writeSession();
Engine::getInstance()->getDiskWriter()->writeSession();
}
break;
}
......@@ -487,7 +485,7 @@ void handleGuiEvents()
EventControllerInstanceGetToWrite ev;
jack_ringbuffer_read( rbToGui, (char*)&ev, sizeof(EventControllerInstanceGetToWrite) );
// write the contents of the GenericMIDI controller to .ctlr file
gui->getDiskWriter()->writeControllerFile( (Controller*)ev.controller );
Engine::getInstance()->getDiskWriter()->writeControllerFile( (Controller*)ev.controller );
}
break;
}
......
......@@ -23,7 +23,7 @@
#include "config.hxx"
#include "gui.hxx"
extern Gui* gui;
#include "timemanager.hxx"
#include "audiobuffer.hxx"
......@@ -67,7 +67,8 @@ void cancelCB(Fl_Widget*,void* data)
ae->setBeatsAndQuit( -1 );
}
AudioEditor::AudioEditor()
AudioEditor::AudioEditor(int samplerate):
_samplerate(samplerate)
{
window = new Fl_Double_Window(460,200,"Audio Editor : Beats?");
waveform = new Avtk::Waveform(5, 5, 450, 150, "Waveform");
......@@ -118,7 +119,7 @@ void AudioEditor::show( AudioBuffer* buf, bool modal )
for( int i = 0; i < 7; i++ ) {
int beat = beats[i];
int fpb = size / beat;
float bpm = (gui->samplerate / fpb) * 60;
float bpm = (_samplerate / fpb) * 60;
if ( bpm < MIN_TEMPO || bpm > MAX_TEMPO ) {
// disable option: not valid
......@@ -139,7 +140,7 @@ void AudioEditor::show( AudioBuffer* buf, bool modal )
// both valid: compare, and adjust color
if ( iBeatOne != -1 && iBeatTwo != -1 ) {
int masterFpb = (gui->samplerate * 60) / gui->getMasterTrack()->getBpm();
int masterFpb = Engine::getInstance()->getTimeManager()->getFpb();
int oneFpb = size / beats[iBeatOne];
int twoFpb = size / beats[iBeatTwo];
......
......@@ -33,7 +33,7 @@ class Button;
class AudioEditor
{
public:
AudioEditor();
AudioEditor(int samplerate);
~AudioEditor();
/// shows the window, and loads the audio buffer into the display
......@@ -57,6 +57,8 @@ private:
// Contents
AudioBuffer* ab;
int _samplerate;
};
#endif // LOOPP_AUDIO_EDITOR_H
......
......@@ -29,7 +29,6 @@
#include "event.hxx"
#include "gui.hxx"
extern Gui* gui;
static void addControllerUiDsp(OptionsWindow* self, GenericMIDI* c)
{
......@@ -189,9 +188,9 @@ static void writeControllerFile(Fl_Widget* w, void* data)
LOOPP_NOTE("Writing controller %li, %s ID %i .ctlr to disk", c, c->name.c_str(), c->controllerID );
// Set the Controller details in diskWriter, so it write it pretty
gui->getDiskWriter()->writeControllerInfo( CONTROLLER_NAME , c->name );
gui->getDiskWriter()->writeControllerInfo( CONTROLLER_AUTHOR, c->getAuthor());
gui->getDiskWriter()->writeControllerInfo( CONTROLLER_LINK , c->getLink() );
Engine::getInstance()->getDiskWriter()->writeControllerInfo( CONTROLLER_NAME , c->name );
Engine::getInstance()->getDiskWriter()->writeControllerInfo( CONTROLLER_AUTHOR, c->getAuthor());
Engine::getInstance()->getDiskWriter()->writeControllerInfo( CONTROLLER_LINK , c->getLink() );
EventControllerInstanceGetToWrite e( c->controllerID );
writeToDspRingbuffer( &e );
......
This diff is collapsed.
......@@ -37,6 +37,8 @@
#include "diskwriter.hxx"
#include "diskreader.hxx"
#include "engine.hxx"
// non-session-manager integration
#include "nsm.h"
......@@ -44,11 +46,12 @@
using namespace std;
class AudioBuffer;
class Engine;
class Gui
{
public:
Gui(const char* argZero);
Gui(const char* argZero, Engine* engine);
~Gui();
int show();
......@@ -75,15 +78,6 @@ public:
return master;
}
DiskWriter* getDiskWriter()
{
return diskWriter;
}
DiskReader* getDiskReader()
{
return diskReader;
}
/// used to load samples into the grid
void selectLoadSample( int track, int clip );
void selectSaveSample( int track, int clip );
......@@ -93,10 +87,7 @@ public:
static void selectLoadController(Fl_Widget* w, void*);
int samplerate;
////Enable per track send and resturn jack ports
bool enablePerTrackOutput;
int samplerate; // TODO Request this from Engine, do not store here!
int getWindowWidth()
{
......@@ -108,19 +99,16 @@ public:
return nsm;
}
/// current special clip:
/// current special clip: TODO move to engine
int specialTrack;
int specialScene;
/// The project directory is the default directoy which is shown upon load/save
void setProjectsDir(string dir);
string getProjectsDir();