| @@ -4,7 +4,10 @@ | |||
| <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" | |||
| android:xlargeScreens="true"/> | |||
| <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/> | |||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | |||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/> | |||
| <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> | |||
| <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> | |||
| <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> | |||
| @@ -15,7 +18,7 @@ | |||
| <uses-permission android:name="android.permission.INTERNET"/> | |||
| <uses-feature android:glEsVersion="0x00030000" android:required="true"/> | |||
| <application android:label="@string/app_name" android:name="com.rmsl.juce.JuceApp" android:icon="@drawable/icon" android:hardwareAccelerated="false"> | |||
| <activity android:name="com.rmsl.juce.JuceActivity" android:configChanges="keyboardHidden|orientation|screenSize" | |||
| <activity android:name="com.rmsl.juce.JuceActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|navigation" | |||
| android:screenOrientation="unspecified" android:launchMode="singleTask" android:hardwareAccelerated="true" | |||
| android:exported="true"> | |||
| <intent-filter> | |||
| @@ -25,7 +25,7 @@ using namespace dsp; | |||
| struct DSPDemoParameterBase : public ChangeBroadcaster | |||
| { | |||
| DSPDemoParameterBase (const String& labelName) : name (labelName) {} | |||
| virtual ~DSPDemoParameterBase() {} | |||
| virtual ~DSPDemoParameterBase() = default; | |||
| virtual Component* getComponent() = 0; | |||
| @@ -142,7 +142,7 @@ public: | |||
| loadURL (u); | |||
| } | |||
| URL getCurrentURL() { return currentURL; } | |||
| URL getCurrentURL() const { return currentURL; } | |||
| void setTransportSource (AudioTransportSource* newSource) | |||
| { | |||
| @@ -189,21 +189,7 @@ private: | |||
| currentURL = u; | |||
| InputSource* inputSource = nullptr; | |||
| #if ! JUCE_IOS | |||
| if (u.isLocalFile()) | |||
| { | |||
| inputSource = new FileInputSource (u.getLocalFile()); | |||
| } | |||
| else | |||
| #endif | |||
| { | |||
| if (inputSource == nullptr) | |||
| inputSource = new URLInputSource (u); | |||
| } | |||
| thumbnail.setSource (inputSource); | |||
| thumbnail.setSource (makeInputSource (u).release()); | |||
| if (notify) | |||
| sendChangeMessage(); | |||
| @@ -407,33 +393,27 @@ public: | |||
| transportSource.reset(); | |||
| readerSource.reset(); | |||
| AudioFormatReader* newReader = nullptr; | |||
| auto source = makeInputSource (fileToPlay); | |||
| #if ! JUCE_IOS | |||
| if (fileToPlay.isLocalFile()) | |||
| { | |||
| newReader = formatManager.createReaderFor (fileToPlay.getLocalFile()); | |||
| } | |||
| else | |||
| #endif | |||
| { | |||
| if (newReader == nullptr) | |||
| newReader = formatManager.createReaderFor (fileToPlay.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress))); | |||
| } | |||
| if (source == nullptr) | |||
| return false; | |||
| reader.reset (newReader); | |||
| auto stream = rawToUniquePtr (source->createInputStream()); | |||
| if (reader.get() != nullptr) | |||
| { | |||
| readerSource.reset (new AudioFormatReaderSource (reader.get(), false)); | |||
| readerSource->setLooping (loopState.getValue()); | |||
| if (stream == nullptr) | |||
| return false; | |||
| init(); | |||
| reader = rawToUniquePtr (formatManager.createReaderFor (std::move (stream))); | |||
| return true; | |||
| } | |||
| if (reader == nullptr) | |||
| return false; | |||
| readerSource.reset (new AudioFormatReaderSource (reader.get(), false)); | |||
| readerSource->setLooping (loopState.getValue()); | |||
| init(); | |||
| return false; | |||
| return true; | |||
| } | |||
| void togglePlay() | |||
| @@ -613,7 +593,7 @@ private: | |||
| { | |||
| if (fc.getURLResults().size() > 0) | |||
| { | |||
| auto u = fc.getURLResult(); | |||
| const auto u = fc.getURLResult(); | |||
| if (! audioFileReader.loadURL (u)) | |||
| NativeMessageBox::showAsync (MessageBoxOptions() | |||
| @@ -242,4 +242,19 @@ struct SlowerBouncingNumber : public BouncingNumber | |||
| } | |||
| }; | |||
| inline std::unique_ptr<InputSource> makeInputSource (const URL& url) | |||
| { | |||
| #if JUCE_ANDROID | |||
| if (auto doc = AndroidDocument::fromDocument (url)) | |||
| return std::make_unique<AndroidDocumentInputSource> (doc); | |||
| #endif | |||
| #if ! JUCE_IOS | |||
| if (url.isLocalFile()) | |||
| return std::make_unique<FileInputSource> (url.getLocalFile()); | |||
| #endif | |||
| return std::make_unique<URLInputSource> (url); | |||
| } | |||
| #endif // PIP_DEMO_UTILITIES_INCLUDED | |||
| @@ -89,9 +89,10 @@ | |||
| </MODULEPATHS> | |||
| </LINUX_MAKE> | |||
| <ANDROIDSTUDIO targetFolder="Builds/Android" androidMinimumSDK="23" microphonePermissionNeeded="1" | |||
| androidBluetoothNeeded="1" androidExternalReadNeeded="1" androidExternalWriteNeeded="1" | |||
| androidEnableContentSharing="1" androidExtraAssetsFolder="../Assets" | |||
| smallIcon="YyqWd2" bigIcon="YyqWd2" cameraPermissionNeeded="1"> | |||
| androidBluetoothNeeded="1" androidExternalWriteNeeded="1" androidEnableContentSharing="1" | |||
| androidExtraAssetsFolder="../Assets" smallIcon="YyqWd2" bigIcon="YyqWd2" | |||
| cameraPermissionNeeded="1" androidReadMediaAudioPermission="1" | |||
| androidReadMediaImagesPermission="1" androidReadMediaVideoPermission="1"> | |||
| <CONFIGURATIONS> | |||
| <CONFIGURATION isDebug="1" name="Debug" recommendedWarnings="LLVM"/> | |||
| <CONFIGURATION isDebug="0" name="Release" recommendedWarnings="LLVM"/> | |||
| @@ -4,7 +4,10 @@ | |||
| <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" | |||
| android:xlargeScreens="true"/> | |||
| <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/> | |||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | |||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/> | |||
| <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> | |||
| <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> | |||
| <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> | |||
| @@ -12,7 +15,7 @@ | |||
| <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/> | |||
| <uses-permission android:name="android.permission.INTERNET"/> | |||
| <application android:label="@string/app_name" android:name="com.rmsl.juce.JuceApp" android:hardwareAccelerated="false"> | |||
| <activity android:name="com.rmsl.juce.JuceActivity" android:configChanges="keyboardHidden|orientation|screenSize" | |||
| <activity android:name="com.rmsl.juce.JuceActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|navigation" | |||
| android:screenOrientation="unspecified" android:launchMode="singleTask" android:hardwareAccelerated="true" | |||
| android:exported="true"> | |||
| <intent-filter> | |||
| @@ -4,7 +4,10 @@ | |||
| <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" | |||
| android:xlargeScreens="true"/> | |||
| <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/> | |||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | |||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/> | |||
| <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> | |||
| <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> | |||
| <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> | |||
| @@ -14,7 +17,7 @@ | |||
| <uses-permission android:name="android.permission.INTERNET"/> | |||
| <uses-feature android:glEsVersion="0x00030000" android:required="true"/> | |||
| <application android:label="@string/app_name" android:name="com.rmsl.juce.JuceApp" android:icon="@drawable/icon" android:hardwareAccelerated="false"> | |||
| <activity android:name="com.rmsl.juce.JuceActivity" android:configChanges="keyboardHidden|orientation|screenSize" | |||
| <activity android:name="com.rmsl.juce.JuceActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|navigation" | |||
| android:screenOrientation="unspecified" android:launchMode="singleTask" android:hardwareAccelerated="true" | |||
| android:exported="true"> | |||
| <intent-filter> | |||
| @@ -25,7 +25,7 @@ using namespace dsp; | |||
| struct DSPDemoParameterBase : public ChangeBroadcaster | |||
| { | |||
| DSPDemoParameterBase (const String& labelName) : name (labelName) {} | |||
| virtual ~DSPDemoParameterBase() {} | |||
| virtual ~DSPDemoParameterBase() = default; | |||
| virtual Component* getComponent() = 0; | |||
| @@ -142,7 +142,7 @@ public: | |||
| loadURL (u); | |||
| } | |||
| URL getCurrentURL() { return currentURL; } | |||
| URL getCurrentURL() const { return currentURL; } | |||
| void setTransportSource (AudioTransportSource* newSource) | |||
| { | |||
| @@ -189,21 +189,7 @@ private: | |||
| currentURL = u; | |||
| InputSource* inputSource = nullptr; | |||
| #if ! JUCE_IOS | |||
| if (u.isLocalFile()) | |||
| { | |||
| inputSource = new FileInputSource (u.getLocalFile()); | |||
| } | |||
| else | |||
| #endif | |||
| { | |||
| if (inputSource == nullptr) | |||
| inputSource = new URLInputSource (u); | |||
| } | |||
| thumbnail.setSource (inputSource); | |||
| thumbnail.setSource (makeInputSource (u).release()); | |||
| if (notify) | |||
| sendChangeMessage(); | |||
| @@ -407,33 +393,27 @@ public: | |||
| transportSource.reset(); | |||
| readerSource.reset(); | |||
| AudioFormatReader* newReader = nullptr; | |||
| auto source = makeInputSource (fileToPlay); | |||
| #if ! JUCE_IOS | |||
| if (fileToPlay.isLocalFile()) | |||
| { | |||
| newReader = formatManager.createReaderFor (fileToPlay.getLocalFile()); | |||
| } | |||
| else | |||
| #endif | |||
| { | |||
| if (newReader == nullptr) | |||
| newReader = formatManager.createReaderFor (fileToPlay.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress))); | |||
| } | |||
| if (source == nullptr) | |||
| return false; | |||
| reader.reset (newReader); | |||
| auto stream = rawToUniquePtr (source->createInputStream()); | |||
| if (reader.get() != nullptr) | |||
| { | |||
| readerSource.reset (new AudioFormatReaderSource (reader.get(), false)); | |||
| readerSource->setLooping (loopState.getValue()); | |||
| if (stream == nullptr) | |||
| return false; | |||
| init(); | |||
| reader = rawToUniquePtr (formatManager.createReaderFor (std::move (stream))); | |||
| return true; | |||
| } | |||
| if (reader == nullptr) | |||
| return false; | |||
| readerSource.reset (new AudioFormatReaderSource (reader.get(), false)); | |||
| readerSource->setLooping (loopState.getValue()); | |||
| init(); | |||
| return false; | |||
| return true; | |||
| } | |||
| void togglePlay() | |||
| @@ -613,7 +593,7 @@ private: | |||
| { | |||
| if (fc.getURLResults().size() > 0) | |||
| { | |||
| auto u = fc.getURLResult(); | |||
| const auto u = fc.getURLResult(); | |||
| if (! audioFileReader.loadURL (u)) | |||
| NativeMessageBox::showAsync (MessageBoxOptions() | |||
| @@ -242,4 +242,19 @@ struct SlowerBouncingNumber : public BouncingNumber | |||
| } | |||
| }; | |||
| inline std::unique_ptr<InputSource> makeInputSource (const URL& url) | |||
| { | |||
| #if JUCE_ANDROID | |||
| if (auto doc = AndroidDocument::fromDocument (url)) | |||
| return std::make_unique<AndroidDocumentInputSource> (doc); | |||
| #endif | |||
| #if ! JUCE_IOS | |||
| if (url.isLocalFile()) | |||
| return std::make_unique<FileInputSource> (url.getLocalFile()); | |||
| #endif | |||
| return std::make_unique<URLInputSource> (url); | |||
| } | |||
| #endif // PIP_DEMO_UTILITIES_INCLUDED | |||
| @@ -4,7 +4,10 @@ | |||
| <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" | |||
| android:xlargeScreens="true"/> | |||
| <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/> | |||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | |||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/> | |||
| <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> | |||
| <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> | |||
| <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> | |||
| @@ -13,7 +16,7 @@ | |||
| <uses-permission android:name="android.permission.INTERNET"/> | |||
| <uses-feature android:glEsVersion="0x00020000" android:required="true"/> | |||
| <application android:label="@string/app_name" android:name="com.rmsl.juce.JuceApp" android:icon="@drawable/icon" android:hardwareAccelerated="false"> | |||
| <activity android:name="com.rmsl.juce.JuceActivity" android:configChanges="keyboardHidden|orientation|screenSize" | |||
| <activity android:name="com.rmsl.juce.JuceActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|navigation" | |||
| android:screenOrientation="unspecified" android:launchMode="singleTask" android:hardwareAccelerated="true" | |||
| android:exported="true"> | |||
| <intent-filter> | |||