summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/JackAudioDriver.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-24 19:26:47 +0000
committerDavid Robillard <d@drobilla.net>2007-07-24 19:26:47 +0000
commitbb1c49dfa484db080938cff6f8f70167c9026a1c (patch)
tree6f6382fcbfddfead6d5c32d19977aed8020d32e4 /src/libs/engine/JackAudioDriver.h
parentf0f64e4425acfb8b8633a47faa70f87fc32a4399 (diff)
downloadingen-bb1c49dfa484db080938cff6f8f70167c9026a1c.tar.gz
ingen-bb1c49dfa484db080938cff6f8f70167c9026a1c.tar.bz2
ingen-bb1c49dfa484db080938cff6f8f70167c9026a1c.zip
Consistently rename all C++ files .cpp/.hpp.
Fix (some) inclusion guard names to not clash with other libs. git-svn-id: http://svn.drobilla.net/lad/ingen@613 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/JackAudioDriver.h')
-rw-r--r--src/libs/engine/JackAudioDriver.h179
1 files changed, 0 insertions, 179 deletions
diff --git a/src/libs/engine/JackAudioDriver.h b/src/libs/engine/JackAudioDriver.h
deleted file mode 100644
index a54b4a88..00000000
--- a/src/libs/engine/JackAudioDriver.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef JACKAUDIODRIVER_H
-#define JACKAUDIODRIVER_H
-
-#include <jack/jack.h>
-#include <jack/transport.h>
-#include <raul/Thread.h>
-#include <raul/Path.h>
-#include <raul/List.h>
-#include "AudioDriver.h"
-#include "Buffer.h"
-
-namespace Ingen {
-
-class Engine;
-class Patch;
-class Port;
-class DuplexPort;
-class JackAudioDriver;
-typedef jack_default_audio_sample_t jack_sample_t;
-
-
-/** Used internally by JackAudioDriver to represent a Jack port.
- *
- * A Jack port always has a one-to-one association with a Patch port.
- */
-class JackAudioPort : public DriverPort, public Raul::ListNode<JackAudioPort*>
-{
-public:
- JackAudioPort(JackAudioDriver* driver, DuplexPort* patch_port);
- ~JackAudioPort();
-
- void set_name(const std::string& name) { jack_port_set_name(_jack_port, name.c_str()); };
-
- void prepare_buffer(jack_nframes_t nframes);
-
- jack_port_t* jack_port() const { return _jack_port; }
- DuplexPort* patch_port() const { return _patch_port; }
-
-private:
- JackAudioDriver* _driver;
- jack_port_t* _jack_port;
- jack_sample_t* _jack_buffer; ///< Cached for output ports
- DuplexPort* _patch_port;
-};
-
-
-
-/** The Jack AudioDriver.
- *
- * The process callback here drives the entire audio thread by "pulling"
- * events from queues, processing them, running the patches, and passing
- * events along to the PostProcessor.
- *
- * \ingroup engine
- */
-class JackAudioDriver : public AudioDriver
-{
-public:
- JackAudioDriver(Engine& engine,
- std::string server_name = "",
- jack_client_t* jack_client = 0);
-
- ~JackAudioDriver();
-
- void activate();
- void deactivate();
- void enable();
- void disable();
-
- DriverPort* port(const Raul::Path& path);
- DriverPort* create_port(DuplexPort* patch_port);
-
- void add_port(DriverPort* port);
- DriverPort* remove_port(const Raul::Path& path);
-
- Patch* root_patch() { return _root_patch; }
- void set_root_patch(Patch* patch) { _root_patch = patch; }
-
- /** Transport state for this frame.
- * Intended to only be called from the audio thread. */
- inline const jack_position_t* position() { return &_position; }
- inline const jack_transport_state_t transport_state() { return _transport_state; }
-
- bool is_realtime() { return jack_is_realtime(_client); }
-
- jack_client_t* jack_client() const { return _client; }
- SampleCount buffer_size() const { return _buffer_size; }
- SampleCount sample_rate() const { return _sample_rate; }
- bool is_activated() const { return _is_activated; }
-
- inline SampleCount frame_time() const { return jack_frame_time(_client); }
-
-private:
- friend class JackAudioPort;
-
- // These are the static versions of the callbacks, they call
- // the non-static ones below
- inline static void thread_init_cb(void* const jack_driver);
- inline static void shutdown_cb(void* const jack_driver);
- inline static int process_cb(jack_nframes_t nframes, void* const jack_driver);
- inline static int buffer_size_cb(jack_nframes_t nframes, void* const jack_driver);
- inline static int sample_rate_cb(jack_nframes_t nframes, void* const jack_driver);
-
- // Non static callbacks
- void _thread_init_cb();
- void _shutdown_cb();
- int _process_cb(jack_nframes_t nframes);
- int _buffer_size_cb(jack_nframes_t nframes);
- int _sample_rate_cb(jack_nframes_t nframes);
-
- Engine& _engine;
- Raul::Thread* _jack_thread;
- jack_client_t* _client;
- jack_nframes_t _buffer_size;
- jack_nframes_t _sample_rate;
- bool _is_activated;
- bool _local_client; ///< Whether _client should be closed on destruction
- jack_position_t _position;
- jack_transport_state_t _transport_state;
-
- Raul::List<JackAudioPort*> _ports;
-
- Patch* _root_patch;
-};
-
-
-inline int JackAudioDriver::process_cb(jack_nframes_t nframes, void* jack_driver)
-{
- assert(jack_driver);
- return ((JackAudioDriver*)jack_driver)->_process_cb(nframes);
-}
-
-inline void JackAudioDriver::thread_init_cb(void* jack_driver)
-{
- assert(jack_driver);
- return ((JackAudioDriver*)jack_driver)->_thread_init_cb();
-}
-
-inline void JackAudioDriver::shutdown_cb(void* jack_driver)
-{
- assert(jack_driver);
- return ((JackAudioDriver*)jack_driver)->_shutdown_cb();
-}
-
-
-inline int JackAudioDriver::buffer_size_cb(jack_nframes_t nframes, void* jack_driver)
-{
- assert(jack_driver);
- return ((JackAudioDriver*)jack_driver)->_buffer_size_cb(nframes);
-}
-
-
-inline int JackAudioDriver::sample_rate_cb(jack_nframes_t nframes, void* jack_driver)
-{
- assert(jack_driver);
- return ((JackAudioDriver*)jack_driver)->_sample_rate_cb(nframes);
-}
-
-
-} // namespace Ingen
-
-#endif // JACKAUDIODRIVER_H