예제 #1
0
int main(int argc, char* argv[])
{
	if (argc != 2){
		printf("Usage: dxlist.exe [-sound] [-s] [-display] [-d]\n");
		return 1;
	}

	if ((strcmp(argv[1],"-sound")==0) || (strcmp(argv[1],"-s")==0)) {
		sound_devices = 0;
		printf("Sound devices:\n");
		if (DirectSoundEnumerateA(DirectSoundEnum, NULL) != DS_OK){
			printf("Error: can't list the audio devices\n");
		}
	}
	else
	if ((strcmp(argv[1],"-display")==0) || (strcmp(argv[1],"-d")==0)) {	
		display_devices = 0;
		printf("Display devices:\n");
		if (DirectDrawEnumerateExA(DirectDrawEnum, NULL, DDENUM_ATTACHEDSECONDARYDEVICES) != DS_OK) {
			printf("Error: can't list the display devices\n");
		}
	}
	else
	printf("Unknown option %s\n", argv[1]);

	return 0;
}
예제 #2
0
UINT8 DSound_Init(void)
{
	HRESULT retVal;
	UINT32 curDev;
	
	if (isInit)
		return AERR_WASDONE;
	
	devLstAlloc = 0;
	devLstCount = 0;
	devList = NULL;
	retVal = DirectSoundEnumerateA(&DSEnumCallback, NULL);
	if (retVal != DS_OK)
		return AERR_API_ERR;
	
	deviceList.devNames = (char**)malloc(sizeof(char*) * devLstCount);
	for (curDev = 0; curDev < devLstCount; curDev ++)
		deviceList.devNames[curDev] = devList[curDev].devName;
	deviceList.devCount = curDev;
	
	
	memset(&defOptions, 0x00, sizeof(AUDIO_OPTS));
	defOptions.sampleRate = 44100;
	defOptions.numChannels = 2;
	defOptions.numBitsPerSmpl = 16;
	defOptions.usecPerBuf = 10000;	// 10 ms per buffer
	defOptions.numBuffers = 10;	// 100 ms latency
	
	
	activeDrivers = 0;
	isInit = 1;
	
	return AERR_OK;
}
예제 #3
0
// enum device
void dsound_enum_device(dsound_enum_callback &callback) {
  struct EnumDSound {
    static BOOL CALLBACK Func(LPGUID guid, LPCSTR desc, LPCSTR module, LPVOID context) {
      dsound_enum_callback *callback = (dsound_enum_callback *)context;
      (*callback)(desc);
      return TRUE;
    }
  };

  DirectSoundEnumerateA(&EnumDSound::Func, &callback);
}
예제 #4
0
HRESULT CDirectSoundAecCapture::EnumDevices()
{
    if (FAILED(DirectSoundEnumerateA(DSoundEnum, (LPVOID)this)))
    {
        return E_FAIL;
    }

    if (FAILED(DirectSoundCaptureEnumerateA(DSoundCapEnum, (LPVOID)this)))
    {
        return E_FAIL;
    }

    return S_OK;
}
예제 #5
0
void alcDSoundProbe(enum DevProbe type)
{
    HRESULT hr, hrcom;
    ALuint i;

    switch(type)
    {
        case ALL_DEVICE_PROBE:
            for(i = 0;i < NumPlaybackDevices;++i)
                free(PlaybackDeviceList[i].name);
            free(PlaybackDeviceList);
            PlaybackDeviceList = NULL;
            NumPlaybackDevices = 0;

            hr = DirectSoundEnumerateA(DSoundEnumPlaybackDevices, NULL);
            if(FAILED(hr))
                ERR("Error enumerating DirectSound playback devices (%#x)!\n", (unsigned int)hr);
            else
            {
                for(i = 0;i < NumPlaybackDevices;i++)
                    AppendAllDevicesList(PlaybackDeviceList[i].name);
            }
            break;

        case CAPTURE_DEVICE_PROBE:
            for(i = 0;i < NumCaptureDevices;++i)
                free(CaptureDeviceList[i].name);
            free(CaptureDeviceList);
            CaptureDeviceList = NULL;
            NumCaptureDevices = 0;

            /* Initialize COM to prevent name truncation */
            hrcom = CoInitialize(NULL);
            hr = DirectSoundCaptureEnumerateA(DSoundEnumCaptureDevices, NULL);
            if(FAILED(hr))
                ERR("Error enumerating DirectSound capture devices (%#x)!\n", (unsigned int)hr);
            else
            {
                for(i = 0;i < NumCaptureDevices;i++)
                    AppendCaptureDeviceList(CaptureDeviceList[i].name);
            }
            if(SUCCEEDED(hrcom))
                CoUninitialize();
            break;
    }
}
예제 #6
0
preferenceDialog::preferenceDialog(QWidget *parent,QSettings *settings) :
    QDialog(parent),
    ui(new Ui::preferenceDialog)
{
    _settings=settings;
    AudioDriverLst.clear();
    apply=false;
    resetsc=false;

    ui->setupUi(this);
    ui-> groupBox_17->setVisible(false);
#ifdef Q_OS_WIN
    if (DirectSoundEnumerateA(DirectSoundEnum, NULL) != DS_OK){
        qDebug( "Error: can't list the audio devices\n");


    }

    for (int i=0;i<AudioDriverLst.count();i++)
    {
        ui->cmbAO->addItem(AudioDriverLst.at(i));

    }
    ui->comboBoxStyle->addItem("windowsxp");
#endif


#ifdef Q_OS_LINUX
    ui->comboBox->setEnabled(false);
    ui->comboBoxStyle->addItem("GTK+");
#endif

    ui->stackedWidget->setCurrentIndex(0);
    on_listWidget_currentRowChanged(0);
    //Init sub encodings combo
    QStringList lstEncodings=QStringList(Languages::encodings().values());
    lstEncodings.sort();
    ui->comboBoxSubEncoding->addItems( lstEncodings);
    ui->labelVersion->setText("<span style=\" font-size:12pt; font-weight:600; color:#000000;\">ExMplayer v"+Version::stable()+ " Beta<span>");


}
예제 #7
0
/* IDirectMusic8Impl IDirectMusic part: */
static HRESULT WINAPI IDirectMusic8Impl_EnumPort(LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) {
	IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
	TRACE("(%p, %d, %p)\n", This, dwIndex, pPortCaps);
	if (NULL == pPortCaps) { return E_POINTER; }
	/* i guess the first port shown is always software synthesizer */
	if (dwIndex == 0) 
	{
		IDirectMusicSynth8* synth;
		TRACE("enumerating 'Microsoft Software Synthesizer' port\n");
		CoCreateInstance (&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth8, (void**)&synth);
		IDirectMusicSynth8_GetPortCaps (synth, pPortCaps);
		IDirectMusicSynth8_Release (synth);
		return S_OK;
	}

/* it seems that the rest of devices are obtained thru dmusic32.EnumLegacyDevices...*sigh*...which is undocumented*/
#if 0
	int numMIDI = midiOutGetNumDevs();
	int numWAVE = waveOutGetNumDevs();
	int i;
	/* then return digital sound ports */
	for (i = 1; i <= numWAVE; i++)
	{
		TRACE("enumerating 'digital sound' ports\n");	
		if (i == dwIndex)
		{
			DirectSoundEnumerateA(register_waveport, pPortCaps);
			return S_OK;	
		}
	}
	/* finally, list all *real* MIDI ports*/
	for (i = numWAVE + 1; i <= numWAVE + numMIDI; i++) 
	{
		TRACE("enumerating 'real MIDI' ports\n");		
		if (i == dwIndex)
			FIXME("Found MIDI port, but *real* MIDI ports not supported yet\n");
	}
#endif	
	return S_FALSE;
}
예제 #8
0
static ALCenum DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceName)
{
    DSoundPlaybackData *data = NULL;
    LPGUID guid = NULL;
    HRESULT hr;

    if(!PlaybackDeviceList)
    {
        hr = DirectSoundEnumerateA(DSoundEnumPlaybackDevices, NULL);
        if(FAILED(hr))
            ERR("Error enumerating DirectSound devices (%#x)!\n", (unsigned int)hr);
    }

    if(!deviceName && NumPlaybackDevices > 0)
    {
        deviceName = PlaybackDeviceList[0].name;
        guid = &PlaybackDeviceList[0].guid;
    }
    else
    {
        ALuint i;

        for(i = 0;i < NumPlaybackDevices;i++)
        {
            if(strcmp(deviceName, PlaybackDeviceList[i].name) == 0)
            {
                guid = &PlaybackDeviceList[i].guid;
                break;
            }
        }
        if(i == NumPlaybackDevices)
            return ALC_INVALID_VALUE;
    }

    //Initialise requested device
    data = calloc(1, sizeof(DSoundPlaybackData));
    if(!data)
        return ALC_OUT_OF_MEMORY;

    hr = DS_OK;
    data->NotifyEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    if(data->NotifyEvent == NULL)
        hr = E_FAIL;

    //DirectSound Init code
    if(SUCCEEDED(hr))
        hr = DirectSoundCreate(guid, &data->DS, NULL);
    if(SUCCEEDED(hr))
        hr = IDirectSound_SetCooperativeLevel(data->DS, GetForegroundWindow(), DSSCL_PRIORITY);
    if(FAILED(hr))
    {
        if(data->DS)
            IDirectSound_Release(data->DS);
        if(data->NotifyEvent)
            CloseHandle(data->NotifyEvent);
        free(data);
        ERR("Device init failed: 0x%08lx\n", hr);
        return ALC_INVALID_VALUE;
    }

    device->DeviceName = strdup(deviceName);
    device->ExtraData = data;
    return ALC_NO_ERROR;
}
예제 #9
0
static void dsound8_tests(void)
{
    HRESULT rc;
    rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
    ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}