1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-17 00:44:19 +00:00

Added device detection for DirectSound. New method addToDesktop() for ResizableWindow.

This commit is contained in:
Julian Storer 2011-06-24 11:43:38 +01:00
parent fb58d0c380
commit dbe5768527
9 changed files with 404 additions and 489 deletions

View file

@ -958,15 +958,15 @@ private:
//==============================================================================
class WASAPIAudioIODeviceType : public AudioIODeviceType
class WASAPIAudioIODeviceType : public AudioIODeviceType,
private DeviceChangeDetector
{
public:
WASAPIAudioIODeviceType()
: AudioIODeviceType ("Windows Audio"),
deviceChangeCatcher (_T("Windows Audio"), (WNDPROC) deviceChangeEventCallback),
DeviceChangeDetector (L"Windows Audio"),
hasScanned (false)
{
SetWindowLongPtr (deviceChangeCatcher.getHWND(), GWLP_USERDATA, (LONG_PTR) this);
}
//==============================================================================
@ -1038,7 +1038,6 @@ public:
StringArray inputDeviceNames, inputDeviceIds;
private:
HiddenMessageWindow deviceChangeCatcher;
bool hasScanned;
//==============================================================================
@ -1129,21 +1128,7 @@ private:
}
//==============================================================================
static LRESULT CALLBACK deviceChangeEventCallback (HWND h, const UINT message,
const WPARAM wParam, const LPARAM lParam)
{
if (message == WM_DEVICECHANGE
&& (wParam == 0x8000 /*DBT_DEVICEARRIVAL*/
|| wParam == 0x8004 /*DBT_DEVICEREMOVECOMPLETE*/
|| wParam == 0x0007 /*DBT_DEVNODES_CHANGED*/))
{
((WASAPIAudioIODeviceType*) GetWindowLongPtr (h, GWLP_USERDATA))->handleDeviceChange();
}
return DefWindowProc (h, message, wParam, lParam);
}
void handleDeviceChange()
void systemDeviceChanged()
{
StringArray newOutNames, newInNames, newOutIds, newInIds;
scan (newOutNames, newInNames, newOutIds, newInIds);