root/branches/streaming-rework/src/maudio/maudio_avdevice.cpp

Revision 436, 3.3 kB (checked in by pieterpalmers, 15 years ago)

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

Line 
1 /* maudio_avdevice.cpp
2  * Copyright (C) 2006 by Daniel Wagner
3  *
4  * This file is part of FreeBoB.
5  *
6  * FreeBoB is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * FreeBoB 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 FreeBoB; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA.
19  */
20 #include "maudio/maudio_avdevice.h"
21 #include "bebob/bebob_avdevice.h"
22
23 #include "libieee1394/configrom.h"
24 #include "libieee1394/ieee1394service.h"
25
26 #include "libavc/avc_definitions.h"
27
28 #include "debugmodule/debugmodule.h"
29
30 #include <libxml/xmlmemory.h>
31 #include <libxml/parser.h>
32
33 #include <string>
34 #include <stdint.h>
35
36 namespace MAudio {
37
38 AvDevice::AvDevice( std::auto_ptr< ConfigRom >( configRom ),
39                     Ieee1394Service& ieee1394service,
40                     int iNodeId )
41     : BeBoB::AvDevice( configRom,
42                     ieee1394service,
43                     iNodeId )
44     , m_model ( NULL )
45 {
46     debugOutput( DEBUG_LEVEL_VERBOSE, "Created MAudio::AvDevice (NodeID %d)\n",
47                  iNodeId );
48 }
49
50 AvDevice::~AvDevice()
51 {
52 }
53
54 static VendorModelEntry supportedDeviceList[] =
55 {
56     //{0x0007f5, 0x00010048, "BridgeCo", "RD Audio1", "refdesign.xml"},
57
58     {0x000d6c, 0x00010046, "M-Audio", "FW 410", "fw410.xml"},
59     {0x000d6c, 0x00010058, "M-Audio", "FW 410", "fw410.xml"},       // Version 5.10.0.5036
60     {0x000d6c, 0x00010060, "M-Audio", "FW Audiophile", "fwap.xml"},
61 };
62
63 bool
64 AvDevice::probe( ConfigRom& configRom )
65 {
66     unsigned int iVendorId = configRom.getNodeVendorId();
67     unsigned int iModelId = configRom.getModelId();
68
69     for ( unsigned int i = 0;
70           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
71           ++i )
72     {
73         if ( ( supportedDeviceList[i].vendor_id == iVendorId )
74              && ( supportedDeviceList[i].model_id == iModelId ) )
75         {
76             return true;
77         }
78     }
79     return false;
80 }
81
82 bool
83 AvDevice::discover()
84 {
85     unsigned int vendorId = m_pConfigRom->getNodeVendorId();
86     unsigned int modelId = m_pConfigRom->getModelId();
87
88     for ( unsigned int i = 0;
89           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
90           ++i )
91     {
92         if ( ( supportedDeviceList[i].vendor_id == vendorId )
93              && ( supportedDeviceList[i].model_id == modelId )
94            )
95         {
96             m_model = &(supportedDeviceList[i]);
97             break;
98         }
99     }
100
101     if (m_model != NULL) {
102         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
103                 m_model->vendor_name, m_model->model_name);
104     } else return false;
105    
106     return true;
107 }
108
109 bool
110 AvDevice::setSamplingFrequency( ESamplingFrequency eSamplingFrequency )
111 {
112     // not supported
113     return false;
114 }
115
116 int AvDevice::getSamplingFrequency( ) {
117     return 44100;
118 }
119
120 void
121 AvDevice::showDevice()
122 {
123 }
124
125 bool
126 AvDevice::prepare() {
127
128     return true;
129 }
130
131 }
Note: See TracBrowser for help on using the browser.