Changeset 246 for branches/libfreebob-2.0/src
- Timestamp:
- 06/05/06 06:41:55 (17 years ago)
- Files:
-
- branches/libfreebob-2.0/src/devicemanager.cpp (modified) (2 diffs)
- branches/libfreebob-2.0/src/libstreaming/AmdtpPortInfo.h (modified) (1 diff)
- branches/libfreebob-2.0/src/libstreaming/AmdtpStreamProcessor.cpp (modified) (2 diffs)
- branches/libfreebob-2.0/src/libstreaming/Makefile.am (modified) (1 diff)
- branches/libfreebob-2.0/src/libstreaming/MotuPort.cpp (copied) (copied from branches/libfreebob-2.0/src/libstreaming/AmdtpPort.cpp) (1 diff)
- branches/libfreebob-2.0/src/libstreaming/MotuPort.h (copied) (copied from branches/libfreebob-2.0/src/libstreaming/AmdtpPort.h) (3 diffs)
- branches/libfreebob-2.0/src/libstreaming/MotuPortInfo.cpp (copied) (copied from branches/libfreebob-2.0/src/libstreaming/AmdtpPortInfo.cpp) (1 diff)
- branches/libfreebob-2.0/src/libstreaming/MotuPortInfo.h (copied) (copied from branches/libfreebob-2.0/src/libstreaming/AmdtpPortInfo.h) (4 diffs)
- branches/libfreebob-2.0/src/libstreaming/MotuStreamProcessor.cpp (added)
- branches/libfreebob-2.0/src/libstreaming/MotuStreamProcessor.h (added)
- branches/libfreebob-2.0/src/libstreaming/Port.h (modified) (1 diff)
- branches/libfreebob-2.0/src/Makefile.am (modified) (3 diffs)
- branches/libfreebob-2.0/src/motu/motu_avdevice.cpp (modified) (5 diffs)
- branches/libfreebob-2.0/src/motu/motu_avdevice.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libfreebob-2.0/src/devicemanager.cpp
r242 r246 42 42 : m_1394Service( 0 ) 43 43 { 44 // m_probeList.push_back( probeMotu );45 44 m_probeList.push_back( probeBeBoB ); 45 m_probeList.push_back( probeMotu ); 46 46 m_probeList.push_back( probeBounce ); 47 47 } … … 174 174 } 175 175 176 //IAvDevice*177 //DeviceManager::probeMotu(Ieee1394Service& service, int id, int level)178 //{179 //IAvDevice* avDevice = new Motu::MotuDevice( service, id, level );180 //if ( !avDevice ) {181 //return NULL;182 //}183 // 184 //if ( !avDevice->discover() ) {185 //delete avDevice;186 //return NULL;187 //}188 //return avDevice;189 //}176 IAvDevice* 177 DeviceManager::probeMotu(Ieee1394Service& service, int id, int level) 178 { 179 IAvDevice* avDevice = new Motu::MotuDevice( service, id, level ); 180 if ( !avDevice ) { 181 return NULL; 182 } 183 184 if ( !avDevice->discover() ) { 185 delete avDevice; 186 return NULL; 187 } 188 return avDevice; 189 } 190 190 191 191 bool branches/libfreebob-2.0/src/libstreaming/AmdtpPortInfo.h
r225 r246 44 44 45 45 public: 46 /** 47 * Sometimes a channel can have multiple formats, depending on the 48 * device configuration (e.g. an SPDIF port could be plain audio in 24bit integer 49 * or AC3 passthrough in IEC compliant frames.) 50 * 51 * This kind of enum allows to discriminate these formats when decoding 52 * If all channels always have the same format, you won't be needing this 53 */ 46 54 enum E_Formats { 47 E_MBLA, 48 E_Midi, 49 E_SPDIF, 55 E_MBLA, ///< multibit linear audio 56 E_Midi, ///< midi 57 E_SPDIF,///< IEC.... format 50 58 }; 51 59 enum E_Types { branches/libfreebob-2.0/src/libstreaming/AmdtpStreamProcessor.cpp
r244 r246 135 135 /* there is no more data in the ringbuffer */ 136 136 137 /* If there are already more than on period 138 * of frames transfered to the XMIT buffer, there is no xrun. 139 * 140 */ 141 if(m_framecounter>m_period) { 142 // we stop processing this untill the next period boundary 143 // that's when new data is ready 144 145 //connection->pfd->events=0; 146 147 // reset the cip to the old value 148 memcpy(&m_cip_status,&old_cip,sizeof(struct iec61883_cip)); 149 150 // retry this packed 151 retval=RAW1394_ISO_AGAIN; 152 nevents=0; 153 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "again!\n"); 154 155 } else { 156 debugWarning("Transmit buffer underrun (cycle %d, FC=%d, PC=%d)\n", 157 cycle, m_framecounter, m_handler->getPacketCount()); 158 159 // signal underrun 160 m_xruns++; 161 162 retval=RAW1394_ISO_DEFER; 163 *length=0; 164 nevents=0; 165 } 137 debugWarning("Transmit buffer underrun (cycle %d, FC=%d, PC=%d)\n", 138 cycle, m_framecounter, m_handler->getPacketCount()); 139 140 // signal underrun 141 m_xruns++; 142 143 retval=RAW1394_ISO_DEFER; 144 *length=0; 145 nevents=0; 146 166 147 167 148 } else { … … 1005 986 if(m_framecounter > (int)m_period) { 1006 987 return true; 1007 } 988 } else return false; 1008 989 1009 990 } branches/libfreebob-2.0/src/libstreaming/Makefile.am
r233 r246 19 19 noinst_LTLIBRARIES = libstreaming.la 20 20 noinst_HEADERS = cip.h FreebobPosixThread.h FreebobThread.h FreebobAtomic.h \ 21 IsoHandler.h IsoHandlerManager.h IsoStream.h ringbuffer.h PacketBuffer.h \ 22 PortManager.h Port.h StreamProcessor.h StreamProcessorManager.h AmdtpPortInfo.h \ 23 AmdtpPort.h AmdtpStreamProcessor.h StreamRunner.h ringbuffer.h streamstatistics.h 21 IsoHandler.h IsoHandlerManager.h IsoStream.h ringbuffer.h PacketBuffer.h \ 22 PortManager.h Port.h StreamProcessor.h StreamProcessorManager.h AmdtpPortInfo.h \ 23 AmdtpPort.h AmdtpStreamProcessor.h StreamRunner.h ringbuffer.h streamstatistics.h \ 24 MotuStreamProcessor.h MotuPort.h MotuPortInfo.h 24 25 25 libstreaming_la_SOURCES = cip.c FreebobPosixThread.cpp \26 freebob_streaming.cpp IsoHandler.cpp IsoHandlerManager.cpp IsoStream.cpp PacketBuffer.cpp \27 PortManager.cpp Port.cpp StreamProcessor.cpp StreamProcessorManager.cpp \28 AmdtpPortInfo.cppAmdtpPort.cpp AmdtpStreamProcessor.cpp StreamRunner.cpp ringbuffer.c \29 streamstatistics.cpp26 libstreaming_la_SOURCES = cip.c FreebobPosixThread.cpp freebob_streaming.cpp \ 27 IsoHandler.cpp IsoHandlerManager.cpp IsoStream.cpp PacketBuffer.cpp PortManager.cpp \ 28 Port.cpp StreamProcessor.cpp StreamProcessorManager.cpp AmdtpPortInfo.cpp \ 29 AmdtpPort.cpp AmdtpStreamProcessor.cpp StreamRunner.cpp ringbuffer.c \ 30 streamstatistics.cpp MotuStreamProcessor.cpp MotuPort.cpp MotuPortInfo.cpp 30 31 31 32 INCLUDES = $(LIBRAW1394_CFLAGS) $(LIBIEC61883_CFLAGS) -I$(top_srcdir)/src \ branches/libfreebob-2.0/src/libstreaming/MotuPort.cpp
r228 r246 27 27 */ 28 28 29 #include " AmdtpPort.h"29 #include "MotuPort.h" 30 30 #include <assert.h> 31 31 branches/libfreebob-2.0/src/libstreaming/MotuPort.h
r228 r246 26 26 * 27 27 */ 28 #ifndef __FREEBOB_ AMDTPPORT__29 #define __FREEBOB_ AMDTPPORT__28 #ifndef __FREEBOB_MOTUPORT__ 29 #define __FREEBOB_MOTUPORT__ 30 30 31 31 /** 32 * This file implements the AMDTP ports as used in the BeBoB's32 * This file implements the ports used in Motu devices 33 33 */ 34 34 35 35 #include "../debugmodule/debugmodule.h" 36 36 #include "Port.h" 37 #include " AmdtpPortInfo.h"37 #include "MotuPortInfo.h" 38 38 39 39 namespace FreebobStreaming { 40 40 41 41 /*! 42 \brief The Base Class for an AMDTPAudio Port42 \brief The Base Class for Motu Audio Port 43 43 44 The AMDTP/AM824/IEC61883-6 port that represents audio. 45 44 46 45 */ 47 class AmdtpAudioPort48 : public AudioPort, public AmdtpPortInfo46 class MotuAudioPort 47 : public AudioPort, public MotuPortInfo 49 48 { 50 49 51 50 public: 52 51 53 AmdtpAudioPort(std::string name,52 MotuAudioPort(std::string name, 54 53 enum E_Direction direction, 55 int position, 56 int location, 57 enum E_Formats format, 58 int type) 54 int position) 59 55 : AudioPort(name, direction), 60 AmdtpPortInfo(name, position, location, format, type)56 MotuPortInfo(name, position) // TODO: add more port information parameters here if nescessary 61 57 {}; 62 58 63 virtual ~ AmdtpAudioPort() {};59 virtual ~MotuAudioPort() {}; 64 60 65 61 protected: … … 68 64 69 65 /*! 70 \brief The Base Class for an AMDTPMidi Port66 \brief The Base Class for an Motu Midi Port 71 67 72 The AMDTP/AM824/IEC61883-6 port that represents midi. 73 68 74 69 */ 75 class AmdtpMidiPort76 : public MidiPort, public AmdtpPortInfo70 class MotuMidiPort 71 : public MidiPort, public MotuPortInfo 77 72 { 78 73 79 74 public: 80 75 81 AmdtpMidiPort(std::string name,76 MotuMidiPort(std::string name, 82 77 enum E_Direction direction, 83 int position, 84 int location, 85 enum E_Formats format, 86 int type) 78 int position) 87 79 : MidiPort(name, direction), 88 AmdtpPortInfo(name, position, location, format, type)80 MotuPortInfo(name, position) // TODO: add more port information parameters here if nescessary 89 81 {}; 90 82 91 83 92 virtual ~AmdtpMidiPort() {}; 84 virtual ~MotuMidiPort() {}; 85 86 protected: 87 88 }; 89 90 /*! 91 \brief The Base Class for an Motu Control Port 92 93 94 */ 95 class MotuControlPort 96 : public ControlPort, public MotuPortInfo 97 { 98 99 public: 100 101 MotuControlPort(std::string name, 102 enum E_Direction direction, 103 int position) 104 : ControlPort(name, direction), 105 MotuPortInfo(name, position) // TODO: add more port information parameters here if nescessary 106 {}; 107 108 109 virtual ~MotuControlPort() {}; 93 110 94 111 protected: … … 98 115 } // end of namespace FreebobStreaming 99 116 100 #endif /* __FREEBOB_ AMDTPPORT__ */117 #endif /* __FREEBOB_MOTUPORT__ */ 101 118 102 119 branches/libfreebob-2.0/src/libstreaming/MotuPortInfo.cpp
r221 r246 27 27 */ 28 28 29 #include " AmdtpPortInfo.h"29 #include "MotuPortInfo.h" 30 30 #include <assert.h> 31 31 branches/libfreebob-2.0/src/libstreaming/MotuPortInfo.h
r225 r246 26 26 * 27 27 */ 28 #ifndef __FREEBOB_ AMDTPPORTINFO__29 #define __FREEBOB_ AMDTPPORTINFO__28 #ifndef __FREEBOB_MOTUPORTINFO__ 29 #define __FREEBOB_MOTUPORTINFO__ 30 30 31 31 #include "../debugmodule/debugmodule.h" … … 34 34 namespace FreebobStreaming { 35 35 /*! 36 \brief Class containing the stream information for a n AMDTPchannel36 \brief Class containing the stream information for a Motu channel 37 37 38 Contains the information that maps the port to an AMDTP stream position (i.e. channel) 39 this allows the AMDTP stream demultiplexer to find the channel associated 40 to this port. 41 38 Contains the information that enables the decoding routine to find 39 this port's data in the ISO events 40 42 41 */ 43 class AmdtpPortInfo {42 class MotuPortInfo { 44 43 45 44 public: 45 /** 46 * Sometimes a channel can have multiple formats, depending on the 47 * device configuration (e.g. an SPDIF port could be plain audio in 24bit integer 48 * or AC3 passthrough in IEC compliant frames.) 49 * 50 * This kind of enum allows to discriminate these formats when decoding 51 * If all channels always have the same format, you won't be needing this 52 */ 53 /* 46 54 enum E_Formats { 47 E_MBLA, 55 E_MBLA, // Multibit linear audio, is acutally AMDTP. Change if needed 48 56 E_Midi, 49 57 E_SPDIF, 50 58 }; 51 enum E_Types { 52 53 }; 54 55 AmdtpPortInfo(std::string name, int position, int location, enum E_Formats format, int type) 56 : m_name(name), m_position(position), m_location(location), m_format(format), m_type(type) 59 */ 60 61 /** 62 * Initialize Motu portinfo 63 * should not be called directly, is inherited by motu ports 64 * 65 * the position parameter is an example 66 * the name parameter is mandatory 67 * 68 * @param name 69 * @param position example parameter 70 * @return 71 */ 72 MotuPortInfo(std::string name, int position) 73 : m_name(name), m_position(position) 57 74 {}; 58 virtual ~ AmdtpPortInfo() {};75 virtual ~MotuPortInfo() {}; 59 76 60 77 61 78 std::string getName() {return m_name;}; 62 int getLocation() {return m_location;};63 79 int getPosition() {return m_position;}; 64 enum E_Formats getFormat() {return m_format;};65 int getType() {return m_type;};66 80 67 81 protected: … … 69 83 70 84 int m_position; 71 int m_location;72 enum E_Formats m_format;73 int m_type;74 85 75 86 }; … … 77 88 } // end of namespace FreebobStreaming 78 89 79 #endif /* __FREEBOB_ AMDTPPORTINFO__ */90 #endif /* __FREEBOB_MOTUPORTINFO__ */ 80 91 81 92 branches/libfreebob-2.0/src/libstreaming/Port.h
r235 r246 355 355 public: 356 356 357 ControlPort(std::string name, enum E_ SignalType type, enum E_BufferType buffertype, enum E_Direction direction)357 ControlPort(std::string name, enum E_Direction direction) 358 358 : Port(name, E_Control, direction) 359 359 {}; branches/libfreebob-2.0/src/Makefile.am
r242 r246 32 32 bebob_light/bebob_light_avdevicesubunit.h \ 33 33 bebob_light/bebob_light_avplug.h \ 34 bounce/bounce_avdevice.h 34 bounce/bounce_avdevice.h \ 35 motu/motu_avdevice.h 35 36 # bebob/bebob_avdevice.h \ 36 37 # bebob/bebob_avdevice_subunit.h \ 37 38 # bebob/bebob_avplug.h \ 38 # bebob/bebob_functionblock.h \ 39 # motu/motu_avdevice.h 39 # bebob/bebob_functionblock.h 40 40 41 41 libfreebob_la_SOURCES = \ … … 48 48 bebob_light/bebob_light_avdevicesubunit.cpp \ 49 49 bebob_light/bebob_light_avplug.cpp \ 50 bounce/bounce_avdevice.cpp 50 bounce/bounce_avdevice.cpp \ 51 motu/motu_avdevice.cpp 51 52 # bebob/bebob_avdevice.cpp \ 52 53 # bebob/bebob_avdevice_xml.cpp \ … … 54 55 # bebob/bebob_avplug.cpp \ 55 56 # bebob/bebob_avplug_xml.cpp \ 56 # bebob/bebob_functionblock.cpp \ 57 # motu/motu_avdevice.cpp 57 # bebob/bebob_functionblock.cpp 58 58 59 59 libfreebob_la_LDFLAGS = -version-info $(LT_VERSION) -lpthread $(LIBSIGC_LIBS) \ branches/libfreebob-2.0/src/motu/motu_avdevice.cpp
r208 r246 27 27 #include "debugmodule/debugmodule.h" 28 28 29 #include "libstreaming/MotuStreamProcessor.h" 30 #include "libstreaming/MotuPort.h" 31 29 32 #include <string> 30 33 #include <stdint.h> … … 42 45 , m_nodeId( nodeId ) 43 46 , m_verboseLevel( verboseLevel ) 47 , m_id(0) 48 , m_receiveProcessor ( 0 ) 49 , m_transmitProcessor ( 0 ) 50 44 51 { 45 52 if ( m_verboseLevel ) { … … 115 122 } 116 123 117 124 int 125 MotuDevice::getSamplingFrequency( ) { 126 /* 127 Implement the procedure to retrieve the samplerate here 128 */ 129 // FIXME: 130 return 44100; 131 132 } 118 133 119 134 bool 120 135 MotuDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency ) 121 136 { 137 /* 138 Implement the procedure to set the samplerate here 139 */ 140 122 141 quadlet_t new_rate=0; 123 142 int supported=true; … … 171 190 } 172 191 192 bool MotuDevice::setId( unsigned int id) { 193 debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %d...\n", id); 194 m_id=id; 195 return true; 196 } 197 173 198 void 174 199 MotuDevice::showDevice() const 175 200 { 176 201 printf( "%s %s at node %d\n", 177 m_configRom->getVendorName() ,178 m_configRom->getModelName() ,202 m_configRom->getVendorName().c_str(), 203 m_configRom->getModelName().c_str(), 179 204 m_nodeId ); 180 205 … … 182 207 183 208 bool 184 MotuDevice::addXmlDescription( xmlNodePtr deviceNode ) 185 { 186 return true; 187 } 209 MotuDevice::prepare() { 210 211 debugOutput(DEBUG_LEVEL_NORMAL, "Preparing MotuDevice...\n" ); 212 213 m_receiveProcessor=new FreebobStreaming::MotuReceiveStreamProcessor( 214 m_1394Service->getPort(), 215 getSamplingFrequency()); 216 217 // the first thing is to initialize the processor 218 // this creates the data structures 219 if(!m_receiveProcessor->init()) { 220 debugFatal("Could not initialize receive processor!\n"); 221 return false; 222 223 } 224 225 // now we add ports to the processor 226 debugOutput(DEBUG_LEVEL_VERBOSE,"Adding ports to receive processor\n"); 227 228 // TODO: change this into something based upon device detection/configuration 229 230 char *buff; 231 FreebobStreaming::Port *p=NULL; 232 233 // example of adding an audio port: 234 asprintf(&buff,"dev%d_cap_%s",m_id,"myportnamehere"); 235 236 p=new FreebobStreaming::MotuAudioPort( 237 buff, 238 FreebobStreaming::Port::E_Capture, 239 0 // you can add all other port specific stuff you 240 // need to pass by extending MotuXXXPort and MotuPortInfo 241 ); 242 243 free(buff); 244 245 if (!p) { 246 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",buff); 247 } else { 248 249 if (!m_receiveProcessor->addPort(p)) { 250 debugWarning("Could not register port with stream processor\n"); 251 return false; 252 } else { 253 debugOutput(DEBUG_LEVEL_VERBOSE, "Added port %s\n",buff); 254 255 } 256 } 257 258 // example of adding an midi port: 259 asprintf(&buff,"dev%d_cap_%s",m_id,"myportnamehere"); 260 261 p=new FreebobStreaming::MotuMidiPort( 262 buff, 263 FreebobStreaming::Port::E_Capture, 264 0 // you can add all other port specific stuff you 265 // need to pass by extending MotuXXXPort and MotuPortInfo 266 ); 267 268 free(buff); 269 270 if (!p) { 271 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",buff); 272 } else { 273 274 if (!m_receiveProcessor->addPort(p)) { 275 debugWarning("Could not register port with stream processor\n"); 276 return false; 277 } else { 278 debugOutput(DEBUG_LEVEL_VERBOSE, "Added port %s\n",buff); 279 280 } 281 } 282 283 // example of adding an control port: 284 asprintf(&buff,"dev%d_cap_%s",m_id,"myportnamehere"); 285 286 p=new FreebobStreaming::MotuControlPort( 287 buff, 288 FreebobStreaming::Port::E_Capture, 289 0 // you can add all other port specific stuff you 290 // need to pass by extending MotuXXXPort and MotuPortInfo 291 ); 292 293 free(buff); 294 295 if (!p) { 296 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",buff); 297 } else { 298 299 if (!m_receiveProcessor->addPort(p)) { 300 debugWarning("Could not register port with stream processor\n"); 301 return false; 302 } else { 303 debugOutput(DEBUG_LEVEL_VERBOSE, "Added port %s\n",buff); 304 305 } 306 } 307 308 309 // do the same for the transmit processor 310 m_transmitProcessor=new FreebobStreaming::MotuTransmitStreamProcessor( 311 m_1394Service->getPort(), 312 getSamplingFrequency()); 313 314 m_transmitProcessor->setVerboseLevel(getDebugLevel()); 315 316 if(!m_transmitProcessor->init()) { 317 debugFatal("Could not initialize transmit processor!\n"); 318 return false; 319 320 } 321 322 // now we add ports to the processor 323 debugOutput(DEBUG_LEVEL_VERBOSE,"Adding ports to transmit processor\n"); 324 325 // example of adding an audio port: 326 // we change the naming and the direction to E_Playback 327 asprintf(&buff,"dev%d_pbk_%s",m_id,"myportnamehere"); 328 329 p=new FreebobStreaming::MotuAudioPort( 330 buff, 331 FreebobStreaming::Port::E_Playback, 332 0 // you can add all other port specific stuff you 333 // need to pass by extending MotuXXXPort and MotuPortInfo 334 ); 335 336 free(buff); 337 338 if (!p) { 339 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",buff); 340 } else { 341 342 if (!m_transmitProcessor->addPort(p)) { 343 debugWarning("Could not register port with stream processor\n"); 344 return false; 345 } else { 346 debugOutput(DEBUG_LEVEL_VERBOSE, "Added port %s\n",buff); 347 348 } 349 } 350 351 // example of adding an midi port: 352 asprintf(&buff,"dev%d_pbk_%s",m_id,"myportnamehere"); 353 354 p=new FreebobStreaming::MotuMidiPort( 355 buff, 356 FreebobStreaming::Port::E_Playback, 357 0 // you can add all other port specific stuff you 358 // need to pass by extending MotuXXXPort and MotuPortInfo 359 ); 360 361 free(buff); 362 363 if (!p) { 364 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",buff); 365 } else { 366 367 if (!m_transmitProcessor->addPort(p)) { 368 debugWarning("Could not register port with stream processor\n"); 369 return false; 370 } else { 371 debugOutput(DEBUG_LEVEL_VERBOSE, "Added port %s\n",buff); 372 373 } 374 } 375 376 // example of adding an control port: 377 asprintf(&buff,"dev%d_pbk_%s",m_id,"myportnamehere"); 378 379 p=new FreebobStreaming::MotuControlPort( 380 buff, 381 FreebobStreaming::Port::E_Playback, 382 0 // you can add all other port specific stuff you 383 // need to pass by extending MotuXXXPort and MotuPortInfo 384 ); 385 386 free(buff); 387 388 if (!p) { 389 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",buff); 390 } else { 391 392 if (!m_transmitProcessor->addPort(p)) { 393 debugWarning("Could not register port with stream processor\n"); 394 return false; 395 } else { 396 debugOutput(DEBUG_LEVEL_VERBOSE, "Added port %s\n",buff); 397 398 } 399 } 400 401 return true; 402 } 403 404 int 405 MotuDevice::getStreamCount() { 406 return 2; // one receive, one transmit 407 } 408 409 FreebobStreaming::StreamProcessor * 410 MotuDevice::getStreamProcessorByIndex(int i) { 411 switch (i) { 412 case 0: 413 return m_receiveProcessor; 414 case 1: 415 return m_transmitProcessor; 416 default: 417 return NULL; 418 } 419 return 0; 420 } 421 422 int 423 MotuDevice::startStreamByIndex(int i) { 424 425 // NOTE: this assumes that you have two streams 426 switch (i) { 427 case 0: 428 // TODO: do the stuff that is nescessary to make the device 429 // transmit a stream 430 431 432 // set the streamprocessor channel to the one obtained by 433 // the connection management 434 // IMPORTANT!! 435 m_receiveProcessor->setChannel(1); // TODO: change the channel NR 436 break; 437 case 1: 438 // TODO: do the stuff that is nescessary to make the device 439 // receive a stream 440 441 // set the streamprocessor channel to the one obtained by 442 // the connection management 443 // IMPORTANT!! 444 m_transmitProcessor->setChannel(0); // TODO: change the channel NR 445 break; 446 447 default: // invalid index 448 return -1; 449 } 450 451 return 0; 452 453 } 454 455 int 456 MotuDevice::stopStreamByIndex(int i) { 457 // TODO: connection management: break connection 458 // cfr the start function 459 460 return 0; 461 } 462 463 464 188 465 189 466 /* ======================================================================== */ branches/libfreebob-2.0/src/motu/motu_avdevice.h
r208 r246 28 28 #include "libfreebob/xmlparser.h" 29 29 30 #include "libstreaming/MotuStreamProcessor.h" 31 30 32 #define MOTU_BASE_ADDR 0xfffff0000000ULL 31 33 #define MOTU_BASE_RATE_44100 (0<<4) … … 51 53 virtual bool discover(); 52 54 virtual ConfigRom& getConfigRom() const; 53 virtual bool addXmlDescription( xmlNodePtr deviceNode ); 55 56 // obsolete, will be removed soon, unused 57 virtual bool addXmlDescription( xmlNodePtr deviceNode ) {return true;}; 58 59 virtual void showDevice() const; 60 54 61 virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 55 virtual void showDevice() const; 62 virtual int getSamplingFrequency( ); 63 64 virtual bool setId(unsigned int id); 65 66 virtual int getStreamCount(); 67 virtual FreebobStreaming::StreamProcessor *getStreamProcessorByIndex(int i); 68 69 virtual bool prepare(); 70 71 virtual int startStreamByIndex(int i); 72 virtual int stopStreamByIndex(int i); 56 73 57 74 protected: … … 60 77 int m_nodeId; 61 78 int m_verboseLevel; 79 unsigned int m_id; 80 81 FreebobStreaming::MotuReceiveStreamProcessor *m_receiveProcessor; 82 FreebobStreaming::MotuTransmitStreamProcessor *m_transmitProcessor; 62 83 63 84 private: 85 64 86 unsigned int ReadRegister(unsigned int reg); 65 87 signed int WriteRegister(unsigned int reg, quadlet_t data);