Changeset 1605
- Timestamp:
- 07/23/09 04:57:42 (14 years ago)
- Files:
-
- trunk/libffado/src/motu/motu_avdevice.cpp (modified) (4 diffs)
- trunk/libffado/src/rme/fireface_settings_ctrls.h (modified) (1 diff)
- trunk/libffado/src/rme/rme_avdevice.cpp (modified) (3 diffs)
- trunk/libffado/src/rme/rme_avdevice.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/motu/motu_avdevice.cpp
r1531 r1605 827 827 MotuDevice::buildMixer() { 828 828 bool result = true; 829 830 destroyMixer(); 829 831 debugOutput(DEBUG_LEVEL_VERBOSE, "Building a MOTU mixer...\n"); 830 832 831 destroyMixer();832 833 833 // create the mixer object container 834 834 m_MixerContainer = new Control::Container(this, "Mixer"); … … 862 862 if (!m_ControlContainer) { 863 863 debugError("Could not create control container...\n"); 864 destroyMixer(); 864 865 return false; 865 866 } … … 868 869 869 870 if (!result) { 870 debugWarning("One or more device control elements could not be created .");871 debugWarning("One or more device control elements could not be created\n"); 871 872 // clean up those that couldn't be created 872 873 destroyMixer(); … … 886 887 bool 887 888 MotuDevice::destroyMixer() { 889 bool ret = true; 888 890 debugOutput(DEBUG_LEVEL_VERBOSE, "destroy mixer...\n"); 889 891 890 892 if (m_MixerContainer == NULL) { 891 893 debugOutput(DEBUG_LEVEL_VERBOSE, "no mixer to destroy...\n"); 892 return true; 893 } 894 894 } else 895 895 if (!deleteElement(m_MixerContainer)) { 896 896 debugError("Mixer present but not registered to the avdevice\n"); 897 ret urnfalse;898 } 899 900 // remove and delete (as in free) child control elements901 m_MixerContainer->clearElements(true);902 delete m_MixerContainer;903 m_MixerContainer = NULL;897 ret = false; 898 } else { 899 // remove and delete (as in free) child control elements 900 m_MixerContainer->clearElements(true); 901 delete m_MixerContainer; 902 m_MixerContainer = NULL; 903 } 904 904 905 905 // remove control container 906 906 if (m_ControlContainer == NULL) { 907 907 debugOutput(DEBUG_LEVEL_VERBOSE, "no controls to destroy...\n"); 908 return true; 909 } 910 908 } else 911 909 if (!deleteElement(m_ControlContainer)) { 912 910 debugError("Controls present but not registered to the avdevice\n"); 913 return false; 914 } 915 916 // remove and delete (as in free) child control elements 917 m_ControlContainer->clearElements(true); 918 delete m_ControlContainer; 919 m_ControlContainer = NULL; 920 921 return true; 911 ret = false; 912 } else { 913 // remove and delete (as in free) child control elements 914 m_ControlContainer->clearElements(true); 915 delete m_ControlContainer; 916 m_ControlContainer = NULL; 917 } 918 return ret; 922 919 } 923 920 trunk/libffado/src/rme/fireface_settings_ctrls.h
r1600 r1605 60 60 virtual int getValue(); 61 61 62 virtual bool setValue(int idx, int v) { return setValue(v); }; 63 virtual int getValue(int idx) { return getValue(); }; 64 virtual int getMinimum() {return 0; }; 65 virtual int getMaximum() {return 0; }; 66 62 67 protected: 63 68 Device &m_parent; trunk/libffado/src/rme/rme_avdevice.cpp
r1604 r1605 27 27 #include "rme/rme_avdevice.h" 28 28 #include "rme/fireface_def.h" 29 #include "rme/fireface_settings_ctrls.h" 29 30 30 31 #include "libieee1394/configrom.h" … … 95 96 Device::~Device() 96 97 { 97 98 destroyMixer(); 99 } 100 101 bool 102 Device::buildMixer() { 103 bool result = true; 104 105 destroyMixer(); 106 debugOutput(DEBUG_LEVEL_VERBOSE, "Building an RME mixer...\n"); 107 108 109 // Non-mixer device controls 110 m_ControlContainer = new Control::Container(this, "Control"); 111 if (!m_ControlContainer) { 112 debugError("Could not create control container\n"); 113 destroyMixer(); 114 return false; 115 } 116 117 result &= m_ControlContainer->addElement( 118 new RmeSettingsCtrl(*this, RME_CTRL_PHANTOM_SW, 0, 119 "Phantom", "Phantom switches", "")); 120 121 if (!result) { 122 debugWarning("One or more device control elements could not be created\n"); 123 destroyMixer(); 124 return false; 125 } 126 127 if (!addElement(m_ControlContainer)) { 128 debugWarning("Could not register mixer to device\n"); 129 // clean up 130 destroyMixer(); 131 return false; 132 } 133 134 return true; 135 } 136 137 bool 138 Device::destroyMixer() { 139 bool ret = true; 140 debugOutput(DEBUG_LEVEL_VERBOSE, "destroy mixer...\n"); 141 142 if (m_MixerContainer == NULL) { 143 debugOutput(DEBUG_LEVEL_VERBOSE, "no mixer to destroy...\n"); 144 } else 145 if (!deleteElement(m_MixerContainer)) { 146 debugError("Mixer present but not registered to the avdevice\n"); 147 ret = false; 148 } else { 149 // remove and delete (as in free) child control elements 150 m_MixerContainer->clearElements(true); 151 delete m_MixerContainer; 152 m_MixerContainer = NULL; 153 } 154 155 // remove control container 156 if (m_ControlContainer == NULL) { 157 debugOutput(DEBUG_LEVEL_VERBOSE, "no controls to destroy...\n"); 158 } else 159 if (!deleteElement(m_ControlContainer)) { 160 debugError("Controls present but not registered to the avdevice\n"); 161 ret = false; 162 } else { 163 // remove and delete (as in free) child control elements 164 m_ControlContainer->clearElements(true); 165 delete m_ControlContainer; 166 m_ControlContainer = NULL; 167 } 168 169 return false; 98 170 } 99 171 … … 163 235 164 236 init_hardware(); 237 238 if (!buildMixer()) { 239 debugWarning("Could not build mixer\n"); 240 } 165 241 166 242 // This is just for testing trunk/libffado/src/rme/rme_avdevice.h
r1600 r1605 56 56 std::auto_ptr<ConfigRom>( configRom )); 57 57 virtual ~Device(); 58 59 virtual bool buildMixer(); 60 virtual bool destroyMixer(); 58 61 59 62 static bool probe( Util::Configuration& c, ConfigRom& configRom, bool generic = false ); … … 150 153 signed int hardware_start_streaming(unsigned int listen_channel); 151 154 signed int hardware_stop_streaming(void); 155 156 Control::Container *m_MixerContainer; 157 Control::Container *m_ControlContainer; 152 158 }; 153 159