From c970d83d7394e73f4bdff9c69a186ec91ac5f9de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gl=C3=B6ckner?= Date: Mon, 25 Jan 2016 13:00:34 +0100 Subject: Fixed API-problems --- drumgizmo/input/jackmidi.cc | 2 +- drumgizmo/jackclient.cc | 4 ---- drumgizmo/jackclient.h | 16 ++++++---------- drumgizmo/output/jackaudio.cc | 6 +++--- 4 files changed, 10 insertions(+), 18 deletions(-) (limited to 'drumgizmo') diff --git a/drumgizmo/input/jackmidi.cc b/drumgizmo/input/jackmidi.cc index 9f54d9d..ba4e8b3 100644 --- a/drumgizmo/input/jackmidi.cc +++ b/drumgizmo/input/jackmidi.cc @@ -110,7 +110,7 @@ void JackMidiInputEngine::post() { void JackMidiInputEngine::process(jack_nframes_t num_frames) { assert(port != nullptr); - void* buffer = port->getBuffer(num_frames); + void* buffer = jack_port_get_buffer(port->port, num_frames); jack_nframes_t num_events = jack_midi_get_event_count(buffer); for(jack_nframes_t i = 0; i < num_events; ++i) { diff --git a/drumgizmo/jackclient.cc b/drumgizmo/jackclient.cc index 376f3fb..3d1a836 100644 --- a/drumgizmo/jackclient.cc +++ b/drumgizmo/jackclient.cc @@ -46,10 +46,6 @@ JackPort::~JackPort() { } } -void* JackPort::getBuffer(jack_nframes_t num_frames) { - return jack_port_get_buffer(port, num_frames); -} - // -------------------------------------------------------------------- int _wrap_jack_process(jack_nframes_t nframes, void* arg){ diff --git a/drumgizmo/jackclient.h b/drumgizmo/jackclient.h index 2574f18..ede6d9e 100644 --- a/drumgizmo/jackclient.h +++ b/drumgizmo/jackclient.h @@ -44,16 +44,12 @@ class JackProcess { // -------------------------------------------------------------------- // RAII-wrapper for jack_port_t -class JackPort { - public: - JackPort(JackClient& client, std::string const & name, const char * type, JackPortFlags flags); - ~JackPort(); - - void* getBuffer(jack_nframes_t num_frames); - - private: - jack_client_t* const client; - jack_port_t* const port; +struct JackPort { + JackPort(JackClient& client, std::string const & name, const char * type, JackPortFlags flags); + ~JackPort(); + + jack_client_t* const client; + jack_port_t* const port; }; // -------------------------------------------------------------------- diff --git a/drumgizmo/output/jackaudio.cc b/drumgizmo/output/jackaudio.cc index 634b7d1..240037a 100644 --- a/drumgizmo/output/jackaudio.cc +++ b/drumgizmo/output/jackaudio.cc @@ -51,7 +51,7 @@ bool JackAudioOutputEngine::init(Channels data) { // initialize new channel channels.emplace_back(client, name, buffer_size); - if (channels.back().port == nullptr) { + if (channels.back().port.port == nullptr) { std::cerr << "[JackAudioOutputEngine] Cannot create jack " << "port for channel #" << i << "\n"; return false; @@ -90,7 +90,7 @@ void JackAudioOutputEngine::process(jack_nframes_t num_frames) { for (auto& channel: channels) { auto ptr = static_cast( - jack_port_get_buffer(channel.port, num_frames)); + jack_port_get_buffer(channel.port.port, num_frames)); for (auto i = 0u; i < num_frames; ++i) { ptr[i] = channel.samples[i]; } @@ -107,7 +107,7 @@ size_t JackAudioOutputEngine::samplerate() { } JackAudioOutputEngine::Channel::Channel(JackClient& client, std::string const & name, std::size_t buffer_size) - : port{client, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0} + : port{client, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput} , samples{} { samples.resize(buffer_size); } -- cgit v1.2.3