Update NTK.
[nondaw.git] / timeline / src / Engine / Engine.H
blob4f8a72673ddbd036005e9d2d59f28a7439e825a9
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 shutdown ( void );
38     int process ( nframes_t nframes );
39     int sync ( jack_transport_state_t state, jack_position_t *pos );
40     int xrun ( void );
41     void timebase ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos );
42     void freewheel ( bool yes );
43     int buffer_size ( nframes_t nframes );
44     void thread_init ( void );
46     Engine ( const Engine &rhs );
47     Engine & operator = ( const Engine &rhs );
49     void request_locate ( nframes_t frame );
51 private:
53     friend class Port;
54     friend class Transport;
56 public:
58     Engine ( );
59     ~Engine ( );
61     int dropped ( void ) const { return _buffers_dropped; }
63     nframes_t system_latency ( void ) const { return nframes(); }
65     float frames_to_milliseconds ( nframes_t frames )
66         {
67             return ( frames * 1000 ) / (float)frame_rate();
68         }
71 extern Engine * engine;