Skip to content

Commit

Permalink
updates to properly support AU plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
essej committed Aug 22, 2005
1 parent eb1d374 commit b92442e
Show file tree
Hide file tree
Showing 15 changed files with 179 additions and 82 deletions.
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ mac: all
cp -f mac/Info.plist $(MACDISTDIR)/SooperLooper.app/Contents/
cp -f mac/PkgInfo $(MACDISTDIR)/SooperLooper.app/Contents/
cp -f mac/slgui.icns $(MACDISTDIR)/SooperLooper.app/Contents/Resources/
cp -f mac/README_AudioUnit.txt $(MACDISTDIR)/
cp -rf mac/SooperLooperAU/build/SooperLooperAU.component $(MACDISTDIR)/
cp -f src/*.slb $(MACDISTDIR)/Presets/
cp -f README $(MACDISTDIR)/README.txt
cp -f COPYING $(MACDISTDIR)/COPYING.txt
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SOOP_MAJOR_VERSION=1
SOOP_MINOR_VERSION=0
SOOP_MICRO_VERSION=8

BETA=dev
BETA=

AC_SUBST(SOOP_MAJOR_VERSION)
AC_SUBST(SOOP_MINOR_VERSION)
Expand Down
2 changes: 1 addition & 1 deletion libs/midi++/mtc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Parser::process_mtc_quarter_frame (byte *msg)
true, just ignore this in terms of it being an error.
*/

if (1) { /* mtc_skipped ())
if (1) { /* mtc_skipped ()) */

/* no error, reset next expected frame */

Expand Down
2 changes: 1 addition & 1 deletion libs/pbd/dirname.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ PBD::dirname (const char *path)
len = (size_t) (slash - path);
ret = (char *) malloc (sizeof (char) * (len + 1));

snprintf (ret, len, "%*s", len, path);
snprintf (ret, len, "%*s", (int)len, path);
return ret;
}

Expand Down
15 changes: 11 additions & 4 deletions src/control_osc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ ControlOSC::terminate_osc_thread ()
void* status;

_shutdown = true;

poke_osc_thread ();

pthread_join (_osc_thread, &status);
Expand Down Expand Up @@ -439,7 +439,7 @@ ControlOSC::osc_receiver()
if ((ret = poll (pfd, nfds, timeout)) < 0) {
if (errno == EINTR) {
/* gdb at work, perhaps */
//cerr << "EINTR hit " << endl;
cerr << "EINTR hit " << endl;
goto again;
}

Expand All @@ -464,15 +464,20 @@ ControlOSC::osc_receiver()
{
// this invokes callbacks
//cerr << "invoking recv on " << pfd[i].fd << endl;
lo_server_recv (srvs[i]);
lo_server_recv(srvs[i]);
}
}

}

cerr << "SL engine shutdown" << endl;
//cerr << "SL engine shutdown" << endl;

if (_osc_server) {
int fd = lo_server_get_socket_fd(_osc_server);
if (fd >=0) {
// hack around
close(fd);
}
lo_server_free (_osc_server);
_osc_server = 0;
}
Expand All @@ -483,6 +488,8 @@ ControlOSC::osc_receiver()
_osc_unix_server = 0;
}

close(_request_pipe[0]);
close(_request_pipe[1]);
}


Expand Down
4 changes: 2 additions & 2 deletions src/control_osc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ class ControlOSC
std::string _osc_unix_socket_path;

int _port;
bool _ok;
bool _shutdown;
volatile bool _ok;
volatile bool _shutdown;
int _max_instance;

std::map<std::string, lo_address> _retaddr_map;
Expand Down
29 changes: 24 additions & 5 deletions src/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ bool Engine::initialize(AudioDriver * driver, int buschans, int port, string pin
}

_buffersize = _driver->get_buffersize();

_common_input_buffers.clear();
_common_outputs.clear();
_common_inputs.clear();

// create common io ports
for (int i=0; i < buschans; ++i)
Expand Down Expand Up @@ -168,6 +172,7 @@ Engine::cleanup()
{
if (_osc) {
delete _osc;
_osc = 0;
}

if (_event_queue) {
Expand Down Expand Up @@ -202,31 +207,45 @@ Engine::cleanup()

if (_internal_sync_buf) {
delete [] _internal_sync_buf;
_internal_sync_buf = 0;
}

if (_loop_manage_to_rt_queue) {
delete _loop_manage_to_rt_queue;
_loop_manage_to_rt_queue = 0;
}
if (_loop_manage_to_main_queue) {
delete _loop_manage_to_main_queue;
_loop_manage_to_main_queue = 0;
}

// delete temp common input buffers
for (int i=0; i < 2; ++i)
for (vector<sample_t *>::iterator iter = _temp_input_buffers.begin(); iter != _temp_input_buffers.end(); ++iter)
{
sample_t * inbuf = _temp_input_buffers[i];
delete [] inbuf;
sample_t * inbuf = *iter;
if (inbuf) {
delete [] inbuf;
}
}
_temp_input_buffers.clear();


// safe to do this, we assume all RT activity has stopped here
for (Instances::iterator iter = _instances.begin(); iter != _instances.end(); ++iter) {
delete *iter;
}
_instances.clear();
_rt_instances.clear();

_driver = 0;
_ok = false;

}

Engine::~Engine ()
{
cleanup ();
if (_driver) {
cleanup ();
}
}

void Engine::set_midi_bridge (MidiBridge * bridge)
Expand Down
8 changes: 8 additions & 0 deletions src/gui/config_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ void ConfigPanel::init()
wxBoxSizer * topsizer = new wxBoxSizer(wxVERTICAL);

LoopControl::SpawnConfig & config = _parent->get_loop_control().get_default_spawn_config();
LoopControl::SpawnConfig & currconfig = _parent->get_loop_control().get_spawn_config();

wxStaticBox * shotBox = new wxStaticBox(this, -1, wxT("Current Connection"), wxDefaultPosition, wxDefaultSize);
wxStaticBoxSizer * colsizer = new wxStaticBoxSizer(shotBox, wxVERTICAL);
Expand Down Expand Up @@ -122,6 +123,10 @@ void ConfigPanel::init()

_force_spawn = new wxCheckBox(this, -1, wxT("start new engine"));
rowsizer->Add (_force_spawn, 0, wxALL|wxALIGN_CENTRE_VERTICAL, 2);
cerr << "never spawn: " << config.never_spawn << endl;
if (currconfig.never_spawn) {
_force_spawn->Enable(false);
}

colsizer->Add (rowsizer, 0 , wxEXPAND|wxALL, 1);

Expand All @@ -132,6 +137,9 @@ void ConfigPanel::init()
rowsizer->Add (_disconnect_button, 0, wxALL|wxALIGN_CENTRE_VERTICAL, 2);
_shutdown_check = new wxCheckBox(this, -1, wxT("shutdown engine"));
rowsizer->Add (_shutdown_check, 0, wxALL|wxALIGN_CENTRE_VERTICAL, 2);
if (currconfig.never_spawn) {
_shutdown_check->Enable(false);
}

colsizer->Add (rowsizer, 0 , wxEXPAND|wxALL, 1);

Expand Down
9 changes: 8 additions & 1 deletion src/gui/plugin_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ bool PluginApp::OnInit()
wxString rcdir;
wxString jackdir;

//SetExitOnFrameDelete(TRUE);
SetExitOnFrameDelete(TRUE);


// use stderr as log
Expand Down Expand Up @@ -280,6 +280,13 @@ int PluginApp::OnRun()
// normall this calls the mainloop
// were not
cerr << "Run called" << endl;
//while (m_keepGoing)
//{
// MacDoOneEvent() ;
//}

MainLoop();
cerr << "Run done" << endl;
return 0;
}

Expand Down
41 changes: 29 additions & 12 deletions src/looper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ using namespace std;
using namespace SooperLooper;
using namespace PBD;

extern const LADSPA_Descriptor* ladspa_descriptor (unsigned long);
extern LADSPA_Descriptor* create_sl_descriptor ();
extern void cleanup_sl_descriptor (LADSPA_Descriptor *);


const LADSPA_Descriptor* Looper::descriptor = 0;

static const double MinResamplingRate = 0.25f;
static const double MaxResamplingRate = 4.0f;
Expand Down Expand Up @@ -112,10 +112,10 @@ Looper::initialize (unsigned int index, unsigned int chan_count, float loopsecs,
_output_peak = 0.0f;
_panner = 0;
_relative_sync = false;

descriptor = 0;

if (!descriptor) {
descriptor = ladspa_descriptor (0);
descriptor = create_sl_descriptor ();
}


Expand Down Expand Up @@ -226,14 +226,17 @@ Looper::initialize (unsigned int index, unsigned int chan_count, float loopsecs,

descriptor->activate (_instances[i]);

_lp_filter[i] = new OnePoleFilter(srate);

#ifdef HAVE_SAMPLERATE
// SRC stuff
_in_src_states[i] = src_new (SrcAudioQuality, 1, &dummyerror);
_out_src_states[i] = src_new (SrcAudioQuality, 1, &dummyerror);
_lp_filter[i]->set_cutoff (_src_in_ratio * _lp_filter[i]->get_samplerate() * 0.48f);
#endif

_lp_filter[i] = new OnePoleFilter(srate);
_lp_filter[i]->set_cutoff (_src_in_ratio * _lp_filter[i]->get_samplerate() * 0.48f);


}

size_t comnouts = _driver->get_engine()->get_common_output_count();
Expand Down Expand Up @@ -264,6 +267,11 @@ Looper::initialize (unsigned int index, unsigned int chan_count, float loopsecs,
Looper::~Looper ()
{
destroy();

if (descriptor) {
cleanup_sl_descriptor (descriptor);
}

}


Expand Down Expand Up @@ -336,6 +344,11 @@ Looper::destroy()
src_delete (_insync_src_state);
if (_outsync_src_state)
src_delete (_outsync_src_state);

if (_src_sync_buffer)
delete [] _src_sync_buffer;
if (_src_in_buffer)
delete [] _src_in_buffer;
#endif

}
Expand Down Expand Up @@ -373,8 +386,9 @@ Looper::set_buffer_size (nframes_t bufsize)
_use_sync_buf = 0;
}

if (_our_syncin_buf)
if (_our_syncin_buf) {
delete [] _our_syncin_buf;
}

if (_our_syncout_buf)
delete [] _our_syncout_buf;
Expand Down Expand Up @@ -819,7 +833,7 @@ Looper::run_loops (nframes_t offset, nframes_t nframes)
/* do it */
descriptor->run (_instances[i], nframes);

if (_use_common_outs) {
if (_panner && _use_common_outs) {
// mix this output into common outputs
(*_panner)[i]->distribute (outbuf, com_obufs, 1.0f, nframes);
}
Expand Down Expand Up @@ -1042,7 +1056,7 @@ Looper::run_loops_resampled (nframes_t offset, nframes_t nframes)
_lp_filter[i]->run_lowpass (_src_data.data_out, nframes);
}

if (_use_common_outs) {
if (_panner && _use_common_outs) {
// mix this output into common outputs
(*_panner)[i]->distribute (outbuf, com_obufs, 1.0f, nframes);
}
Expand Down Expand Up @@ -1401,8 +1415,9 @@ Looper::get_state () const
node->add_property ("relative_sync", buf);

// panner
node->add_child_nocopy (_panner->state (true));

if (_panner) {
node->add_child_nocopy (_panner->state (true));
}

XMLNode *controls = new XMLNode ("Controls");

Expand Down Expand Up @@ -1486,7 +1501,9 @@ Looper::set_state (const XMLNode& node)

for (iter = node.children().begin(); iter != node.children().end(); ++iter) {
if ((*iter)->name() == "Panner") {
_panner->set_state (**iter);
if (_panner) {
_panner->set_state (**iter);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/looper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class Looper
peak = p;
}


int requested_cmd;
int last_requested_cmd;

Expand All @@ -117,7 +118,7 @@ class Looper
LADSPA_Handle * _instances;
float _loopsecs;

static const LADSPA_Descriptor* descriptor;
LADSPA_Descriptor* descriptor;

LADSPA_Data ports[LASTPORT];

Expand Down
1 change: 1 addition & 0 deletions src/midi_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ MidiBridge::MidiBridge (string name, PortRequest & req)
_port->input()->any.connect (slot (*this, &MidiBridge::incoming_midi));

init_thread();

_ok = true;

}
Expand Down
1 change: 1 addition & 0 deletions src/panner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ Panner::Panner (string name)

Panner::~Panner ()
{
clear();
}

void
Expand Down
Loading

0 comments on commit b92442e

Please sign in to comment.