root/branches/streaming-rework/src/rme/rme_avdevice.cpp

Revision 436, 3.8 kB (checked in by pieterpalmers, 16 years ago)

- fixed verbose level setting
- debugged DICE code, works with EVM

Line 
1 /* rme_avdevice.cpp
2  * Copyright (C) 2006 by Jonathan Woithe
3  * Copyright (C) 2006,2007 by Pieter Palmers
4  *
5  * This file is part of FreeBob.
6  *
7  * FreeBob is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  * FreeBob is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with FreeBob; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19  * MA 02111-1307 USA.
20  */
21 #warning RME support is currently useless (detection only)
22
23 #include "rme/rme_avdevice.h"
24
25 #include "libieee1394/configrom.h"
26 #include "libieee1394/ieee1394service.h"
27
28 #include "debugmodule/debugmodule.h"
29
30 #include <string>
31 #include <stdint.h>
32 #include <assert.h>
33 #include <netinet/in.h>
34
35 #include <iostream>
36 #include <sstream>
37
38 #include <libraw1394/csr.h>
39
40 namespace Rme {
41
42 // to define the supported devices
43 static VendorModelEntry supportedDeviceList[] =
44 {
45     {0x00000a35, 0x0001, "RME", "Fireface-800"},  // RME Fireface-800
46 };
47
48 RmeDevice::RmeDevice( std::auto_ptr< ConfigRom >( configRom ),
49                     Ieee1394Service& ieee1394service,
50                     int nodeId )
51     : IAvDevice( configRom, ieee1394service, nodeId )
52     , m_model( NULL )
53 {
54     debugOutput( DEBUG_LEVEL_VERBOSE, "Created Rme::RmeDevice (NodeID %d)\n",
55                  nodeId );
56 }
57
58 RmeDevice::~RmeDevice()
59 {
60
61 }
62
63 bool
64 RmeDevice::probe( ConfigRom& configRom )
65 {
66     unsigned int vendorId = configRom.getNodeVendorId();
67     unsigned int modelId = configRom.getModelId();
68
69     for ( unsigned int i = 0;
70           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
71           ++i )
72     {
73         if ( ( supportedDeviceList[i].vendor_id == vendorId )
74              && ( supportedDeviceList[i].model_id == modelId )
75            )
76         {
77             return true;
78         }
79     }
80
81     return false;
82 }
83
84 bool
85 RmeDevice::discover()
86 {
87     unsigned int vendorId = m_pConfigRom->getNodeVendorId();
88     unsigned int modelId = m_pConfigRom->getModelId();
89
90     for ( unsigned int i = 0;
91           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
92           ++i )
93     {
94         if ( ( supportedDeviceList[i].vendor_id == vendorId )
95              && ( supportedDeviceList[i].model_id == modelId )
96            )
97         {
98             m_model = &(supportedDeviceList[i]);
99         }
100     }
101
102     if (m_model != NULL) {
103         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
104                 m_model->vendor_name, m_model->model_name);
105         return true;
106     }
107
108     return false;
109 }
110
111 int
112 RmeDevice::getSamplingFrequency( ) {
113 /*
114  * Retrieve the current sample rate from the RME device.
115  */
116         return 48000;
117 }
118
119 bool
120 RmeDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency )
121 {
122 /*
123  * Set the RME device's samplerate.
124  */
125         if (samplingFrequency == eSF_48000Hz)
126                 return true;
127         return false;
128 }
129
130 bool
131 RmeDevice::lock() {
132
133     return true;
134 }
135
136
137 bool
138 RmeDevice::unlock() {
139
140     return true;
141 }
142
143 void
144 RmeDevice::showDevice()
145 {
146         debugOutput(DEBUG_LEVEL_VERBOSE,
147                 "%s %s at node %d\n", m_model->vendor_name, m_model->model_name,
148                 m_nodeId);
149 }
150
151 bool
152 RmeDevice::prepare() {
153
154         debugOutput(DEBUG_LEVEL_NORMAL, "Preparing RmeDevice...\n" );
155
156         return true;
157 }
158
159 int
160 RmeDevice::getStreamCount() {
161         return 0; // one receive, one transmit
162 }
163
164 Streaming::StreamProcessor *
165 RmeDevice::getStreamProcessorByIndex(int i) {
166     return NULL;
167 }
168
169 bool
170 RmeDevice::startStreamByIndex(int i) {
171     return false;
172 }
173
174 bool
175 RmeDevice::stopStreamByIndex(int i) {
176     return false;
177
178 }
179
180 }
Note: See TracBrowser for help on using the browser.