1 // ---------------------------------------------------------------------------- 2 // 3 // Copyright (C) 2013-2017 Fons Adriaensen <fons@linuxaudio.org> 4 // 5 // This program is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation; either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 // 18 // ---------------------------------------------------------------------------- 19 20 21 #ifndef __NETRX_H 22 #define __NETRX_H 23 24 #include <stdint.h> 25 #include "pxthread.h" 26 #include "lfqueue.h" 27 28 29 class Netrx : public Pxthread 30 { 31 public: 32 33 enum { INIT, WAIT, PROC, TNTP, TERM, FAIL }; 34 35 Netrx (void); 36 virtual ~Netrx (void); 37 38 int start (Lfq_audio *audioq, 39 Lfq_int32 *commq, 40 Lfq_timedata *timeq, 41 int *chlist, 42 int psmax, 43 int fsamp, 44 int fsize, 45 int rtprio, 46 int sockfd); 47 48 private: 49 50 virtual void thr_main (void); 51 52 void send (int flags, int32_t count, double tjack, uint32_t tsecs, uint32_t tfrac); 53 int write_audio (Netdata *D); 54 int write_zeros (int nfram); 55 56 int _state; 57 bool _first; 58 double _tq; 59 double _t0; 60 double _dt; 61 double _w1; 62 double _w2; 63 Lfq_audio *_audioq; 64 Lfq_int32 *_commq; 65 Lfq_timedata *_timeq; 66 int *_chlist; 67 int _fsamp; 68 int _fsize; 69 int _sockfd; 70 Netdata *_packet; 71 }; 72 73 74 #endif 75