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

Revision 419, 4.4 kB (checked in by pieterpalmers, 17 years ago)

namespace simplification

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 IMPL_DEBUG_MODULE( RmeDevice, RmeDevice, DEBUG_LEVEL_NORMAL );
43
44 // to define the supported devices
45 static VendorModelEntry supportedDeviceList[] =
46 {
47     {0x00000a35, 0x0001, "RME", "Fireface-800"},  // RME Fireface-800
48 };
49
50 RmeDevice::RmeDevice( std::auto_ptr< ConfigRom >( configRom ),
51                     Ieee1394Service& ieee1394service,
52                     int nodeId,
53                     int verboseLevel )
54     : m_configRom( configRom )
55     , m_p1394Service( &ieee1394service )
56     , m_model( NULL )
57     , m_nodeId( nodeId )
58     , m_verboseLevel( verboseLevel )
59    
60 {
61     setDebugLevel( verboseLevel );
62    
63     debugOutput( DEBUG_LEVEL_VERBOSE, "Created Rme::RmeDevice (NodeID %d)\n",
64                  nodeId );
65
66 }
67
68 RmeDevice::~RmeDevice()
69 {
70
71 }
72
73 ConfigRom&
74 RmeDevice::getConfigRom() const
75 {
76     return *m_configRom;
77 }
78
79 bool
80 RmeDevice::probe( ConfigRom& configRom )
81 {
82     unsigned int vendorId = configRom.getNodeVendorId();
83     unsigned int modelId = configRom.getModelId();
84
85     for ( unsigned int i = 0;
86           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
87           ++i )
88     {
89         if ( ( supportedDeviceList[i].vendor_id == vendorId )
90              && ( supportedDeviceList[i].model_id == modelId )
91            )
92         {
93             return true;
94         }
95     }
96
97     return false;
98 }
99
100 bool
101 RmeDevice::discover()
102 {
103     unsigned int vendorId = m_configRom->getNodeVendorId();
104     unsigned int modelId = m_configRom->getModelId();
105
106     for ( unsigned int i = 0;
107           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
108           ++i )
109     {
110         if ( ( supportedDeviceList[i].vendor_id == vendorId )
111              && ( supportedDeviceList[i].model_id == modelId )
112            )
113         {
114             m_model = &(supportedDeviceList[i]);
115         }
116     }
117
118     if (m_model != NULL) {
119         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
120                 m_model->vendor_name, m_model->model_name);
121         return true;
122     }
123
124     return false;
125 }
126
127 int
128 RmeDevice::getSamplingFrequency( ) {
129 /*
130  * Retrieve the current sample rate from the RME device.
131  */
132         return 48000;
133 }
134
135 bool
136 RmeDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency )
137 {
138 /*
139  * Set the RME device's samplerate.
140  */
141         if (samplingFrequency == eSF_48000Hz)
142                 return true;
143         return false;
144 }
145
146 bool RmeDevice::setId( unsigned int id) {
147     // FIXME: decent ID system nescessary
148     std::ostringstream idstr;
149
150     idstr << "dev" << id;
151    
152     debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %s...\n", idstr.str().c_str());
153    
154     return setOption("id",idstr.str());
155 }
156
157 bool
158 RmeDevice::lock() {
159
160     return true;
161 }
162
163
164 bool
165 RmeDevice::unlock() {
166
167     return true;
168 }
169
170 void
171 RmeDevice::showDevice() const
172 {
173         debugOutput(DEBUG_LEVEL_VERBOSE,
174                 "%s %s at node %d\n", m_model->vendor_name, m_model->model_name,
175                 m_nodeId);
176 }
177
178 bool
179 RmeDevice::prepare() {
180
181         debugOutput(DEBUG_LEVEL_NORMAL, "Preparing RmeDevice...\n" );
182
183         return true;
184 }
185
186 int
187 RmeDevice::getStreamCount() {
188         return 0; // one receive, one transmit
189 }
190
191 Streaming::StreamProcessor *
192 RmeDevice::getStreamProcessorByIndex(int i) {
193     return NULL;
194 }
195
196 bool
197 RmeDevice::startStreamByIndex(int i) {
198     return false;
199 }
200
201 bool
202 RmeDevice::stopStreamByIndex(int i) {
203     return false;
204
205 }
206
207 }
Note: See TracBrowser for help on using the browser.