Browse Source

Made Process::isForegroundProcess() return a correct result on iOS.

tags/2021-05-28
jules 11 years ago
parent
commit
b5d10d753a
3 changed files with 30 additions and 1 deletions
  1. +9
    -0
      modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
  2. +5
    -1
      modules/juce_core/native/juce_mac_Threads.mm
  3. +16
    -0
      modules/juce_gui_basics/native/juce_ios_Windowing.mm

+ 9
- 0
modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp View File

@@ -1194,6 +1194,15 @@ public:
const int numInputChans = data.inputs != nullptr ? (int) data.inputs[0].numChannels : 0;
const int numOutputChans = data.outputs != nullptr ? (int) data.outputs[0].numChannels : 0;
if (numInputChans != pluginInstance->getNumInputChannels()
|| numOutputChans != pluginInstance->getNumOutputChannels())
{
const double sampleRate = pluginInstance->getSampleRate();
const int bufferSize = (int) data.numSamples;
pluginInstance->setPlayConfigDetails (numInputChans, numOutputChans, sampleRate, bufferSize);
pluginInstance->prepareToPlay (sampleRate, bufferSize);
}
int totalChans = 0;
while (totalChans < numInputChans)


+ 5
- 1
modules/juce_core/native/juce_mac_Threads.mm View File

@@ -31,13 +31,17 @@
live in juce_posix_SharedCode.h!
*/
#if JUCE_IOS
bool isIOSAppActive = true;
#endif
//==============================================================================
JUCE_API bool JUCE_CALLTYPE Process::isForegroundProcess()
{
#if JUCE_MAC
return [NSApp isActive];
#else
return true; // xxx change this if more than one app is ever possible on iOS!
return isIOSAppActive;
#endif
}


+ 16
- 0
modules/juce_gui_basics/native/juce_ios_Windowing.mm View File

@@ -22,6 +22,8 @@
==============================================================================
*/
extern bool isIOSAppActive;
} // (juce namespace)
@interface JuceAppStartupDelegate : NSObject <UIApplicationDelegate>
@@ -32,6 +34,8 @@
- (void) applicationWillTerminate: (UIApplication*) application;
- (void) applicationDidEnterBackground: (UIApplication*) application;
- (void) applicationWillEnterForeground: (UIApplication*) application;
- (void) applicationDidBecomeActive: (UIApplication*) application;
- (void) applicationWillResignActive: (UIApplication*) application;
@end
@@ -68,6 +72,18 @@
app->resumed();
}
- (void) applicationDidBecomeActive: (UIApplication*) application
{
(void) application;
isIOSAppActive = true;
}
- (void) applicationWillResignActive: (UIApplication*) application
{
(void) application;
isIOSAppActive = false;
}
@end
namespace juce


Loading…
Cancel
Save