root/trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.h

Revision 873, 3.1 kB (checked in by jwoithe, 16 years ago)

MOTU: Reinstate MIDI stream processing code removed during API cleanup.
MOTU: Implement silent audio packets in MOTU transmit stream processor.

Line 
1 /*
2  * Copyright (C) 2005-2008 by Jonathan Woithe
3  * Copyright (C) 2005-2008 by Pieter Palmers
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 2 of the License, or
13  * (at your option) version 3 of the License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24
25 #ifndef __FFADO_MOTURECEIVESTREAMPROCESSOR__
26 #define __FFADO_MOTURECEIVESTREAMPROCESSOR__
27
28 /**
29  * This class implements MOTU streaming
30  */
31
32 #include "debugmodule/debugmodule.h"
33
34 #include "../generic/StreamProcessor.h"
35 #include "../util/cip.h"
36
37 namespace Streaming {
38
39 class MotuAudioPort;
40 class MotuMidiPort;
41 /*!
42  * \brief The Base Class for a MOTU receive stream processor
43  *
44  * This class implements the outgoing stream processing for
45  * motu devices
46  *
47  */
48 class MotuReceiveStreamProcessor
49     : public StreamProcessor
50 {
51
52 public:
53     /**
54      * Create a MOTU receive StreamProcessor
55      * @param port 1394 port
56      * @param dimension number of substreams in the ISO stream
57      *                  (midi-muxed is only one stream)
58      */
59     MotuReceiveStreamProcessor(FFADODevice &parent, unsigned int event_size);
60     virtual ~MotuReceiveStreamProcessor() {};
61
62     enum eChildReturnValue processPacketHeader(unsigned char *data, unsigned int length,
63                   unsigned char channel, unsigned char tag, unsigned char sy,
64                   unsigned int cycle, unsigned int dropped);
65     enum eChildReturnValue processPacketData(unsigned char *data, unsigned int length,
66                   unsigned char channel, unsigned char tag, unsigned char sy,
67                   unsigned int cycle, unsigned int dropped);
68
69     virtual bool prepareChild();
70
71 public:
72     virtual unsigned int getEventSize()
73                 {return m_event_size;};
74     virtual unsigned int getMaxPacketSize();
75     virtual unsigned int getEventsPerFrame()
76                     { return 1; }; // FIXME: check
77     virtual unsigned int getNominalFramesPerPacket();
78
79 protected:
80     bool processReadBlock(char *data, unsigned int nevents, unsigned int offset);
81
82 private:
83     bool decodePacketPorts(quadlet_t *data, unsigned int nevents, unsigned int dbc);
84
85     int decodeMotuEventsToPort(MotuAudioPort *, quadlet_t *data, unsigned int offset, unsigned int nevents);
86     int decodeMotuMidiEventsToPort(MotuMidiPort *, quadlet_t *data, unsigned int offset, unsigned int nevents);
87
88     /*
89      * An iso packet mostly consists of multiple events.  m_event_size
90      * is the size of a single 'event' in bytes.
91      */
92     unsigned int m_event_size;
93 };
94
95
96 } // end of namespace Streaming
97
98 #endif /* __FFADO_MOTURECEIVESTREAMPROCESSOR__ */
99
Note: See TracBrowser for help on using the browser.