| @@ -661,6 +661,7 @@ t_CKBOOL ChuckAudio::initialize( t_CKUINT dac_device, · 660 unmodified lines |
| 661 | 661 | if( useDefaultOut ) |
| 662 | 662 | { |
| 663 | 663 | // get the default |
| 664 | + // FYI: getDefaultInputDevice returns 0 either as a valid index OR if no default/any devices |
| 664 | 665 | m_dac_n = m_rtaudio->getDefaultOutputDevice(); |
| 665 | 666 | } |
| 666 | 667 | else |
| @@ -777,10 +778,11 @@ t_CKBOOL ChuckAudio::initialize( t_CKUINT dac_device, · 110 unmodified lines |
| 777 | 778 | if( useDefaultIn ) |
| 778 | 779 | { |
| 779 | 780 | // get default input device |
| 781 | + // FYI getDefaultInputDevice returns 0 either as a valid index OR if no default/any devices |
| 780 | 782 | m_adc_n = m_rtaudio->getDefaultInputDevice(); |
| 781 | | − |
| 782 | 783 | // ensure correct channel count if default device is requested |
| 783 | 784 | RtAudio::DeviceInfo device_info = m_rtaudio->getDeviceInfo((unsigned int)m_adc_n); |
| 785 | + |
| 784 | 786 | // remember |
| 785 | 787 | t_CKUINT inChannelsRequested = m_num_channels_in; |
| 786 | 788 | |
| @@ -818,22 +820,30 @@ t_CKBOOL ChuckAudio::initialize( t_CKUINT dac_device, · 31 unmodified lines |
| 818 | 820 | // will first check if the default input device has only 1 channel |
| 819 | 821 | // while we are requesting 2 channels... |
| 820 | 822 | // - |
| 823 | + |
| 821 | 824 | // if non-zero input channels |
| 822 | 825 | if( device_info.inputChannels > 0 ) |
| 823 | 826 | { |
| 824 | | − // find first device with *exactly* the requested channel count |
| 825 | | − m_adc_n = findMatchingInputDevice(m_rtaudio, device_info.inputChannels, sample_rate, FALSE ); |
| 827 | + // find a device with *exactly* the current device input channels |
| 828 | + m_adc_n = findMatchingInputDevice( m_rtaudio, device_info.inputChannels, sample_rate, FALSE ); |
| 829 | + } |
| 830 | + else // if device input channel count is 0 |
| 831 | + { |
| 832 | + // find a device with *exactly* the requested channel count |
| 833 | + m_adc_n = findMatchingInputDevice( m_rtaudio, m_num_channels_in, sample_rate, FALSE); |
| 826 | 834 | } |
| 827 | 835 | |
| 828 | 836 | // check if match |
| 829 | 837 | if( m_adc_n >= 0 ) |
| 830 | 838 | { |
| 839 | + // get updated device info (since m_adc_n may be updated by this point) |
| 840 | + device_info = m_rtaudio->getDeviceInfo((unsigned int)m_adc_n); |
| 831 | 841 | // update the request input channel request |
| 832 | 842 | m_num_channels_in = device_info.inputChannels; |
| 833 | 843 | } |
| 834 | 844 | else |
| 835 | 845 | { |
| 836 | | − // find first device with *at least* the requested channel count |
| 846 | + // find a device with *at least* the requested channel count |
| 837 | 847 | m_adc_n = findMatchingInputDevice(m_rtaudio, m_num_channels_in, sample_rate, TRUE ); |
| 838 | 848 | |
| 839 | 849 | // changed 1.3.1.2 (ge): for input, if no match found by this point, we just gonna try to open half-duplex |
| @@ -841,6 +851,12 @@ t_CKBOOL ChuckAudio::initialize( t_CKUINT dac_device, · 1 unmodified line |
| 841 | 851 | { |
| 842 | 852 | // set to 0 |
| 843 | 853 | m_num_channels_in = 0; |
| 854 | + // log |
| 855 | + EM_log( CK_LOG_SEVERE, "cannot find compatible audio input device..." ); |
| 856 | + EM_pushlog(); |
| 857 | + EM_log(CK_LOG_SEVERE, "defaulting to half-duplex (no audio input)..."); |
| 858 | + EM_poplog(); |
| 859 | + |
| 844 | 860 | // problem finding audio devices, most likely |
| 845 | 861 | // EM_error2( 0, "unable to find audio input device with requested channel count (%i)...", |
| 846 | 862 | // m_num_channels_in); |