1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-22 01:34:21 +00:00

fix for win32 screen saver defeating, and a small tweak to VST hosting

This commit is contained in:
jules 2008-12-30 15:56:38 +00:00
parent d387f99f67
commit 5e5bf35f36
3 changed files with 29 additions and 28 deletions

View file

@ -65,7 +65,6 @@ extern bool juce_IsRunningInWine() throw();
static HPALETTE palette = 0;
static bool createPaletteIfNeeded = true;
static bool shouldDeactivateTitleBar = true;
static bool screenSaverAllowed = true;
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY) throw();
#define WM_TRAYNOTIFY WM_USER + 100
@ -2183,13 +2182,6 @@ private:
}
break;
case SC_MONITORPOWER:
case SC_SCREENSAVE:
if (! screenSaverAllowed)
return 0;
break;
}
break;
@ -2317,14 +2309,18 @@ void Desktop::setMousePosition (int x, int y) throw()
}
//==============================================================================
static bool juce_screenSaverEnabled = true;
void Desktop::setScreenSaverEnabled (const bool isEnabled) throw()
{
screenSaverAllowed = isEnabled;
juce_screenSaverEnabled = isEnabled;
SetThreadExecutionState (isEnabled ? (ES_DISPLAY_REQUIRED | ES_CONTINUOUS)
: ES_CONTINUOUS);
}
bool Desktop::isScreenSaverEnabled() throw()
{
return screenSaverAllowed;
return juce_screenSaverEnabled;
}
//==============================================================================

View file

@ -31725,6 +31725,10 @@ int VSTPluginInstance::dispatch (const int opcode, const int index, const int va
}
// handles non plugin-specific callbacks..
static const int defaultVSTSampleRateValue = 16384;
static const int defaultVSTBlockSizeValue = 512;
static VstIntPtr handleGeneralCallback (VstInt32 opcode, VstInt32 index, VstInt32 value, void *ptr, float opt)
{
(void) index;
@ -31775,10 +31779,10 @@ static VstIntPtr handleGeneralCallback (VstInt32 opcode, VstInt32 index, VstInt3
break;
case audioMasterGetSampleRate:
return 44100;
return (VstIntPtr) defaultVSTSampleRateValue;
case audioMasterGetBlockSize:
return 512;
return (VstIntPtr) defaultVSTBlockSizeValue;
case audioMasterSetOutputSampleRate:
return 0;
@ -31857,10 +31861,10 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs
return 1;
case audioMasterGetSampleRate:
return (VstIntPtr) (getSampleRate() > 0 ? getSampleRate() : 44100);
return (VstIntPtr) (getSampleRate() > 0 ? getSampleRate() : defaultVSTSampleRateValue);
case audioMasterGetBlockSize:
return (VstIntPtr) getBlockSize();
return (VstIntPtr) (getBlockSize() > 0 ? getBlockSize() : defaultVSTBlockSizeValue);
case audioMasterWantMidi:
wantsMidiMessages = true;
@ -241243,7 +241247,6 @@ extern bool juce_IsRunningInWine() throw();
static HPALETTE palette = 0;
static bool createPaletteIfNeeded = true;
static bool shouldDeactivateTitleBar = true;
static bool screenSaverAllowed = true;
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY) throw();
#define WM_TRAYNOTIFY WM_USER + 100
@ -243328,13 +243331,6 @@ private:
}
break;
case SC_MONITORPOWER:
case SC_SCREENSAVE:
if (! screenSaverAllowed)
return 0;
break;
}
break;
@ -243454,14 +243450,18 @@ void Desktop::setMousePosition (int x, int y) throw()
SetCursorPos (x, y);
}
static bool juce_screenSaverEnabled = true;
void Desktop::setScreenSaverEnabled (const bool isEnabled) throw()
{
screenSaverAllowed = isEnabled;
juce_screenSaverEnabled = isEnabled;
SetThreadExecutionState (isEnabled ? (ES_DISPLAY_REQUIRED | ES_CONTINUOUS)
: ES_CONTINUOUS);
}
bool Desktop::isScreenSaverEnabled() throw()
{
return screenSaverAllowed;
return juce_screenSaverEnabled;
}
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable)

View file

@ -2305,6 +2305,11 @@ int VSTPluginInstance::dispatch (const int opcode, const int index, const int va
//==============================================================================
// handles non plugin-specific callbacks..
static const int defaultVSTSampleRateValue = 16384;
static const int defaultVSTBlockSizeValue = 512;
static VstIntPtr handleGeneralCallback (VstInt32 opcode, VstInt32 index, VstInt32 value, void *ptr, float opt)
{
(void) index;
@ -2355,10 +2360,10 @@ static VstIntPtr handleGeneralCallback (VstInt32 opcode, VstInt32 index, VstInt3
break;
case audioMasterGetSampleRate:
return 44100;
return (VstIntPtr) defaultVSTSampleRateValue;
case audioMasterGetBlockSize:
return 512;
return (VstIntPtr) defaultVSTBlockSizeValue;
case audioMasterSetOutputSampleRate:
return 0;
@ -2437,10 +2442,10 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs
return 1;
case audioMasterGetSampleRate:
return (VstIntPtr) (getSampleRate() > 0 ? getSampleRate() : 44100);
return (VstIntPtr) (getSampleRate() > 0 ? getSampleRate() : defaultVSTSampleRateValue);
case audioMasterGetBlockSize:
return (VstIntPtr) getBlockSize();
return (VstIntPtr) (getBlockSize() > 0 ? getBlockSize() : defaultVSTBlockSizeValue);
case audioMasterWantMidi:
wantsMidiMessages = true;