Update NTK.
[nondaw.git] / mixer / src / Engine / Engine.H
blobb967c199a7b32e62f051520de5fbbd13256c1355
2 /*******************************************************************************/
3 /* Copyright (C) 2008 Jonathan Moore Liles                                     */
4 /*                                                                             */
5 /* This program is free software; you can redistribute it and/or modify it     */
6 /* under the terms of the GNU General Public License as published by the       */
7 /* Free Software Foundation; either version 2 of the License, or (at your      */
8 /* option) any later version.                                                  */
9 /*                                                                             */
10 /* This program is distributed in the hope that it will be useful, but WITHOUT */
11 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       */
12 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for   */
13 /* more details.                                                               */
14 /*                                                                             */
15 /* You should have received a copy of the GNU General Public License along     */
16 /* with This program; see the file COPYING.  If not,write to the Free Software */
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18 /*******************************************************************************/
20 #pragma once
22 #include "Mutex.H"
24 class Port;
26 #include "JACK/Client.H"
28 #include "Thread.H"
30 class Engine : public JACK::Client, public Mutex
32     Thread _thread;                                            /* only used for thread checking */
34     int _buffers_dropped;                                       /* buffers dropped because of locking */
35 /*     int _buffers_dropped;                                       /\* buffers dropped because of locking *\/ */
37     void ( * _process_callback ) ( nframes_t, void * );
38     void *_process_callback_user_data;
40     void ( * _buffer_size_callback ) ( nframes_t, void * );
41     void *_buffer_size_callback_user_data;
43     void shutdown ( void );
44     int process ( nframes_t nframes );
45     int xrun ( void );
46     void freewheel ( bool yes );
47     int buffer_size ( nframes_t nframes );
48     void thread_init ( void );
50     Engine ( const Engine &rhs );
51     Engine & operator = ( const Engine &rhs );
53     void request_locate ( nframes_t frame );
55 private:
57     friend class Port;
58     friend class Transport;
60 public:
62     Engine ( void (*process_callback) (nframes_t, void *), void *user_data );
63     ~Engine ( );
65     int dropped ( void ) const { return _buffers_dropped; }
66     void buffer_size_callback ( void ( *buffer_size_callback ) ( nframes_t, void * ), void *user_data );