示例#1
0
int getSoundOutputFromUID(int outputid, const QString& uid)
{
    if(uid.isEmpty())
        return outputid;

    QVector<SoundDevice> outputdev;
    int count = 0;
    TT_GetSoundDevices(NULL, &count);
    outputdev.resize(count);
    if(count)
        TT_GetSoundDevices(&outputdev[0], &count);

    SoundDevice dev;
    if(getSoundDevice(uid, outputdev, dev))
        outputid = dev.nDeviceID;
    return outputid;
}
示例#2
0
void CWizSoundSysPage::ShowDrivers(SoundSystem nSoundSystem)
{
    //fill output
    int count = 0;
    TT_GetSoundDevices(NULL, &count);
    std::vector<SoundDevice> devices;
    if(count)
    {
        devices.resize(count);
        TT_GetSoundDevices(&devices[0], &count);
    }
    m_OutputDriversCombo.ResetContent();
    for(int i=0; i<count; i++)
    {
        if(devices[i].nSoundSystem != nSoundSystem ||
            devices[i].nMaxOutputChannels == 0)
            continue;
        int index = m_OutputDriversCombo.AddString(CString(devices[i].szDeviceName));
        m_OutputDriversCombo.SetItemData(index, devices[i].nDeviceID);
    }

    bool bFound = false;
    for(int i=0;i<m_OutputDriversCombo.GetCount();i++)
    {
        if(m_OutputDriversCombo.GetItemData(i) == m_nOutputDevice)
        {
            m_OutputDriversCombo.SetCurSel(i);
            bFound = true;
            break;
        }
    }
    if(!bFound && m_OutputDriversCombo.GetCount())
    {
        m_OutputDriversCombo.SetCurSel(0);
        m_nOutputDevice = int(m_OutputDriversCombo.GetItemData(0));
    }

    //fill input
    m_InputDriversCombo.ResetContent();
    for(int j=0;j<count;j++)
    {
        if(devices[j].nSoundSystem != nSoundSystem ||
            devices[j].nMaxInputChannels == 0)
            continue;
        int index = m_InputDriversCombo.AddString( CString(devices[j].szDeviceName) );
        m_InputDriversCombo.SetItemData(index, devices[j].nDeviceID);
    }

    bFound = false;
    for(int i=0;i<m_InputDriversCombo.GetCount();i++)
    {
        if(m_InputDriversCombo.GetItemData(i) == m_nInputDevice)
        {
            m_InputDriversCombo.SetCurSel(i);
            bFound = true;
            break;
        }
    }

    if(!bFound && m_InputDriversCombo.GetCount())
    {
        m_InputDriversCombo.SetCurSel(0);
        m_nInputDevice = int(m_InputDriversCombo.GetItemData(0));
    }
    OnCbnSelchangeComboOutputdriver();
    OnCbnSelchangeComboInputdriver();
}