|
From: <man...@us...> - 2013-04-03 13:08:19
|
Revision: 1716
http://sourceforge.net/p/modplug/code/1716
Author: manxorist
Date: 2013-04-03 13:08:12 +0000 (Wed, 03 Apr 2013)
Log Message:
-----------
[Fix] Probe WASAPI devices for supported sampling rates and only show those in settings dialog.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/SNDDEVX.H
trunk/OpenMPT/soundlib/Snddev.cpp
Modified: trunk/OpenMPT/soundlib/SNDDEVX.H
===================================================================
--- trunk/OpenMPT/soundlib/SNDDEVX.H 2013-04-03 10:18:33 UTC (rev 1715)
+++ trunk/OpenMPT/soundlib/SNDDEVX.H 2013-04-03 13:08:12 UTC (rev 1716)
@@ -286,6 +286,7 @@
float GetCurrentRealLatencyMS();
bool HasGetStreamPosition() const { return false; }
int64 GetStreamPositionSamples() const;
+ bool CanSampleRate(UINT nDevice, std::vector<UINT> &samplerates, std::vector<bool> &result);
int StreamCallback(
const void *input, void *output,
Modified: trunk/OpenMPT/soundlib/Snddev.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snddev.cpp 2013-04-03 10:18:33 UTC (rev 1715)
+++ trunk/OpenMPT/soundlib/Snddev.cpp 2013-04-03 13:08:12 UTC (rev 1716)
@@ -1825,7 +1825,30 @@
}
+bool CPortaudioDevice::CanSampleRate(UINT nDevice, std::vector<UINT> &samplerates, std::vector<bool> &result)
+//-----------------------------------------------------------------------------------------------------------
+{
+ result.clear();
+ for(UINT n=0; n<samplerates.size(); n++)
+ {
+ PaStreamParameters StreamParameters;
+ MemsetZero(StreamParameters);
+ StreamParameters.device = HostApiOutputIndexToGlobalDeviceIndex(nDevice, m_HostApi);
+ if(StreamParameters.device == -1)
+ {
+ result.assign(samplerates.size(), false);
+ return false;
+ }
+ StreamParameters.channelCount = 2;
+ StreamParameters.sampleFormat = paInt16;
+ StreamParameters.suggestedLatency = 0.0;
+ StreamParameters.hostApiSpecificStreamInfo = NULL;
+ result.push_back(Pa_IsFormatSupported(NULL, &StreamParameters, samplerates[n]) == paFormatIsSupported);
+ }
+ return true;
+}
+
int CPortaudioDevice::StreamCallback(
const void *input, void *output,
unsigned long frameCount,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|