mirror of https://github.com/procxx/kepka.git
				
				
				
			Check only if at least one audio device is exist on startup
This makes https://github.com/telegramdesktop/tdesktop/issues/1548 don't affect on startup, but only when capture feature is used
This commit is contained in:
		
							parent
							
								
									447d4e6c47
								
							
						
					
					
						commit
						78c3c86fe6
					
				| 
						 | 
					@ -62,14 +62,14 @@ Instance::Instance() : _inner(new Inner(&_thread)) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Instance::check() {
 | 
					void Instance::check() {
 | 
				
			||||||
	_available = false;
 | 
						_available = false;
 | 
				
			||||||
	if (auto device = alcCaptureOpenDevice(nullptr, kCaptureFrequency, AL_FORMAT_MONO16, kCaptureFrequency / 5)) {
 | 
						if (auto device = alcGetString(0, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)) {
 | 
				
			||||||
		auto error = ErrorHappened(device);
 | 
							if (!QString::fromLocal8Bit(device).isEmpty()) {
 | 
				
			||||||
		alcCaptureCloseDevice(device);
 | 
								_available = true;
 | 
				
			||||||
		_available = !error;
 | 
								return;
 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		LOG(("Audio Error: Could not open capture device!"));
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						LOG(("Audio Error: No capture device found!"));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Instance::~Instance() {
 | 
					Instance::~Instance() {
 | 
				
			||||||
	_inner = nullptr;
 | 
						_inner = nullptr;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue