Browse Source

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

tags/2021-05-28
jules 17 years ago
parent
commit
5e5bf35f36
3 changed files with 29 additions and 28 deletions
  1. +6
    -10
      build/win32/platform_specific_code/juce_win32_Windowing.cpp
  2. +14
    -14
      juce_amalgamated.cpp
  3. +9
    -4
      src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp

+ 6
- 10
build/win32/platform_specific_code/juce_win32_Windowing.cpp 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;
}
//==============================================================================


+ 14
- 14
juce_amalgamated.cpp 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)


+ 9
- 4
src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp 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;


Loading…
Cancel
Save