Update NTK.
[nondaw.git] / timeline / src / Engine / Record_DS.H
blob278ada7c33645dd5a23edef6699a8fbde68febfb
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 "Disk_Stream.H"
24 #include "Audio_File_SF.H"
25 class Audio_File;
26 class Peak_Writer;
28 class Record_DS : public Disk_Stream
31     /* not permitted  */
32     Record_DS ( const Record_DS &rhs );
33     Record_DS & operator= ( const Record_DS &rhs );
35     Track::Capture *_capture;
37     nframes_t _frames_written;
38     volatile nframes_t _stop_frame;
40     volatile bool _recording;
42     Audio_File_SF *_af;                             /* capture file */
44     void write_block ( sample_t *buf, nframes_t nframes );
45     void disk_thread ( void );
47     void flush ( void ) { base_flush( false ); }
49 public:
51     Record_DS ( Track *th, float frame_rate, nframes_t nframes, int channels ) :
52         Disk_Stream( th, frame_rate, nframes, channels )
53         {
54             sem_destroy( &_blocks );
55             sem_init( &_blocks, 0, 0 );
57             _capture = NULL;
58             _recording = false;
59             _stop_frame = -1;
60             _frames_written = 0;
61         }
63 /*     bool seek_pending ( void ); */
64 /*     void seek ( nframes_t frame ); */
65     const Audio_Region * capture_region ( void ) const;
66     Track::Capture * capture ( void );
68     void start ( nframes_t frame );
69     void stop ( nframes_t frame );
70     nframes_t process ( nframes_t nframes );