Browse Source

Projucer: Request audio recording permissions in the Audio Application template on platforms which require it

tags/2021-05-28
ed 7 years ago
parent
commit
9ade3b30d5
4 changed files with 52 additions and 12 deletions
  1. +26
    -6
      extras/Projucer/JuceLibraryCode/BinaryData.cpp
  2. +2
    -2
      extras/Projucer/JuceLibraryCode/BinaryData.h
  3. +12
    -2
      extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentSimpleTemplate.h
  4. +12
    -2
      extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentTemplate.cpp

+ 26
- 6
extras/Projucer/JuceLibraryCode/BinaryData.cpp View File

@@ -5514,8 +5514,18 @@ static const unsigned char temp_binary_data_27[] =
" // you add any child components.\r\n" " // you add any child components.\r\n"
" setSize (800, 600);\r\n" " setSize (800, 600);\r\n"
"\r\n" "\r\n"
" // specify the number of input and output channels that we want to open\r\n"
" setAudioChannels (2, 2);\r\n"
" // Some platforms require permissions to open input channels so request that here\r\n"
" if (RuntimePermissions::isRequired (RuntimePermissions::recordAudio)\r\n"
" && ! RuntimePermissions::isGranted (RuntimePermissions::recordAudio))\r\n"
" {\r\n"
" RuntimePermissions::request (RuntimePermissions::recordAudio,\r\n"
" [&] (bool granted) { if (granted) setAudioChannels (2, 2); });\r\n"
" }\r\n"
" else\r\n"
" {\r\n"
" // Specify the number of input and output channels that we want to open\r\n"
" setAudioChannels (2, 2);\r\n"
" }\r\n"
" }\r\n" " }\r\n"
"\r\n" "\r\n"
" ~%%content_component_class%%()\r\n" " ~%%content_component_class%%()\r\n"
@@ -5601,8 +5611,18 @@ static const unsigned char temp_binary_data_28[] =
" // you add any child components.\r\n" " // you add any child components.\r\n"
" setSize (800, 600);\r\n" " setSize (800, 600);\r\n"
"\r\n" "\r\n"
" // specify the number of input and output channels that we want to open\r\n"
" setAudioChannels (2, 2);\r\n"
" // Some platforms require permissions to open input channels so request that here\r\n"
" if (RuntimePermissions::isRequired (RuntimePermissions::recordAudio)\r\n"
" && ! RuntimePermissions::isGranted (RuntimePermissions::recordAudio))\r\n"
" {\r\n"
" RuntimePermissions::request (RuntimePermissions::recordAudio,\r\n"
" [&] (bool granted) { if (granted) setAudioChannels (2, 2); });\r\n"
" }\r\n"
" else\r\n"
" {\r\n"
" // Specify the number of input and output channels that we want to open\r\n"
" setAudioChannels (2, 2);\r\n"
" }\r\n"
"}\r\n" "}\r\n"
"\r\n" "\r\n"
"%%content_component_class%%::~%%content_component_class%%()\r\n" "%%content_component_class%%::~%%content_component_class%%()\r\n"
@@ -7818,8 +7838,8 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes)
case 0xd11e6d35: numBytes = 2085; return jucer_AnimatedComponentSimpleTemplate_h; case 0xd11e6d35: numBytes = 2085; return jucer_AnimatedComponentSimpleTemplate_h;
case 0x6cf2645e: numBytes = 1563; return jucer_AnimatedComponentTemplate_cpp; case 0x6cf2645e: numBytes = 1563; return jucer_AnimatedComponentTemplate_cpp;
case 0x97b055e3: numBytes = 1201; return jucer_AnimatedComponentTemplate_h; case 0x97b055e3: numBytes = 1201; return jucer_AnimatedComponentTemplate_h;
case 0xfb6f6d96: numBytes = 3194; return jucer_AudioComponentSimpleTemplate_h;
case 0xafccbd3f: numBytes = 2635; return jucer_AudioComponentTemplate_cpp;
case 0xfb6f6d96: numBytes = 3693; return jucer_AudioComponentSimpleTemplate_h;
case 0xafccbd3f: numBytes = 3094; return jucer_AudioComponentTemplate_cpp;
case 0x915d7304: numBytes = 1374; return jucer_AudioComponentTemplate_h; case 0x915d7304: numBytes = 1374; return jucer_AudioComponentTemplate_h;
case 0x27c5a93a: numBytes = 1356; return jucer_AudioPluginEditorTemplate_cpp; case 0x27c5a93a: numBytes = 1356; return jucer_AudioPluginEditorTemplate_cpp;
case 0x4d0721bf: numBytes = 977; return jucer_AudioPluginEditorTemplate_h; case 0x4d0721bf: numBytes = 977; return jucer_AudioPluginEditorTemplate_h;


+ 2
- 2
extras/Projucer/JuceLibraryCode/BinaryData.h View File

@@ -90,10 +90,10 @@ namespace BinaryData
const int jucer_AnimatedComponentTemplate_hSize = 1201; const int jucer_AnimatedComponentTemplate_hSize = 1201;
extern const char* jucer_AudioComponentSimpleTemplate_h; extern const char* jucer_AudioComponentSimpleTemplate_h;
const int jucer_AudioComponentSimpleTemplate_hSize = 3194;
const int jucer_AudioComponentSimpleTemplate_hSize = 3693;
extern const char* jucer_AudioComponentTemplate_cpp; extern const char* jucer_AudioComponentTemplate_cpp;
const int jucer_AudioComponentTemplate_cppSize = 2635;
const int jucer_AudioComponentTemplate_cppSize = 3094;
extern const char* jucer_AudioComponentTemplate_h; extern const char* jucer_AudioComponentTemplate_h;
const int jucer_AudioComponentTemplate_hSize = 1374; const int jucer_AudioComponentTemplate_hSize = 1374;


+ 12
- 2
extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentSimpleTemplate.h View File

@@ -25,8 +25,18 @@ public:
// you add any child components. // you add any child components.
setSize (800, 600); setSize (800, 600);
// specify the number of input and output channels that we want to open
setAudioChannels (2, 2);
// Some platforms require permissions to open input channels so request that here
if (RuntimePermissions::isRequired (RuntimePermissions::recordAudio)
&& ! RuntimePermissions::isGranted (RuntimePermissions::recordAudio))
{
RuntimePermissions::request (RuntimePermissions::recordAudio,
[&] (bool granted) { if (granted) setAudioChannels (2, 2); });
}
else
{
// Specify the number of input and output channels that we want to open
setAudioChannels (2, 2);
}
} }
~%%content_component_class%%() ~%%content_component_class%%()


+ 12
- 2
extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentTemplate.cpp View File

@@ -15,8 +15,18 @@
// you add any child components. // you add any child components.
setSize (800, 600); setSize (800, 600);
// specify the number of input and output channels that we want to open
setAudioChannels (2, 2);
// Some platforms require permissions to open input channels so request that here
if (RuntimePermissions::isRequired (RuntimePermissions::recordAudio)
&& ! RuntimePermissions::isGranted (RuntimePermissions::recordAudio))
{
RuntimePermissions::request (RuntimePermissions::recordAudio,
[&] (bool granted) { if (granted) setAudioChannels (2, 2); });
}
else
{
// Specify the number of input and output channels that we want to open
setAudioChannels (2, 2);
}
} }
%%content_component_class%%::~%%content_component_class%%() %%content_component_class%%::~%%content_component_class%%()


Loading…
Cancel
Save