Skip to content

Commit 8e29b4a

Browse files
committed
Version 2.0.2
- DynamicInitialize/DynamicDestroy APIs to dynamically load Superpowered. Allows for multiple loading into the same process. Example usecase: Superpowered in a VST plugin DLL. - Guitar distortion effect including Marshall cabinet, ADA cabinet and V-Twin preamp simulation, 5-band equalizer, bass and treble tone controls and two distortion sounds.
1 parent 4a6dee1 commit 8e29b4a

File tree

57 files changed

+72
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+72
-9
lines changed

Examples_Android/SuperpoweredRecorder/app/src/main/cpp/RecorderExample.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include <SuperpoweredRecorder.h>
88
#include <unistd.h>
99

10-
#define log_write __android_log_write
11-
1210
static SuperpoweredAndroidAudioIO *audioIO;
1311
static Superpowered::Recorder *recorder;
1412

@@ -85,7 +83,7 @@ Java_com_superpowered_recorder_MainActivity_StopRecording(JNIEnv * __unused env,
8583
// It's better to do this asynchronously, but we're just blocking (sleeping) now.
8684
while (!recorder->isFinished()) usleep(100000);
8785

88-
log_write(ANDROID_LOG_DEBUG, "RecorderExample", "Finished recording.");
86+
__android_log_print(ANDROID_LOG_DEBUG, "Recorder", "Finished recording.");
8987
delete recorder;
9088
}
9189

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,4 @@ Superpowered FFT benefits from ideas in Construction of a High-Performance FFT b
241241

242242
The Superpowered MP3 and AAC decoder benefits from optimizations by Ken Cooke.
243243

244-
Superpowered version 2.0.0
244+
Superpowered version 2.0.2

Superpowered/Superpowered.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
namespace Superpowered {
88

99
/// @fn Initialize(const char *licenseKey, bool enableAudioAnalysis, bool enableFFTAndFrequencyDomain, bool enableAudioTimeStretching, bool enableAudioEffects, bool enableAudioPlayerAndDecoder, bool enableCryptographics, bool enableNetworking);
10-
/// @brief Initializes the Superpowered SDKs.
10+
/// @brief Initializes the Superpowered SDKs. Use this only once, when your app or library initializes.
11+
/// Do not use this if Superpowered is loaded dynamically and might be loaded multiple times (a DLL in a VST host for example). @see DynamicInitialize
1112
/// @param licenseKey Visit https://superpowered.com/dev to register license keys.
1213
/// @param enableAudioAnalysis Enables Analyzer, LiveAnalyzer, Waveform and BandpassFilterbank.
1314
/// @param enableFFTAndFrequencyDomain Enables FrequencyDomain, FFTComplex, FFTReal and PolarFFT.
@@ -26,6 +27,17 @@ void Initialize(const char *licenseKey,
2627
bool enableCryptographics,
2728
bool enableNetworking);
2829

30+
/// @fn DynamicInitialize(const char *licenseKey);
31+
/// @brief Use this if Superpowered is loaded in a dynamically loaded library (such as a DLL on Windows). It allows for multiple loads (DLL in a VST host example). Enables all features.
32+
/// @param licenseKey Visit https://superpowered.com/dev to register license keys.
33+
void DynamicInitialize(const char *licenseKey);
34+
35+
/// @fn DynamicDestroy();
36+
/// @brief Use this if Superpowered is used in a dynamically loaded library (such as a DLL on Windows), when the dynamically loaded library instance unloads (even if multiple loads may happen).
37+
/// This function will block waiting for all Superpowered background threads to exit when the last instance of the library is unloaded.
38+
/// Please note that you still need to "properly" release all Superpowered objects _before_ this call, such as delete all players, effects, etc.
39+
void DynamicDestroy();
40+
2941
}
3042

3143
/**

Superpowered/SuperpoweredAdvancedAudioPlayer.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,11 @@ class AdvancedAudioPlayer {
8888
static const float MaxPlaybackRate; ///< The maximum playback rate or scratching speed: 20.
8989

9090
/// @brief Set the folder to store for temporary files. Used for HLS and progressive download only.
91-
/// Call this before any player instance is created. It will create a subfolder with the name "SuperpoweredAAP" in the folder.
91+
/// Call this before any player instance is created.
92+
/// It will create a subfolder with the name "SuperpoweredAAP" in the specified folder (and will clear all content inside SuperpoweredAAP if it exists already).
93+
/// If you need to clear the folder before your app quits, use NULL for the path.
9294
/// @param path File system path of the folder.
9395
static void setTempFolder(const char *path);
94-
95-
/// @brief Removes the temp folder and all content inside. Use this when your program ends.
96-
static void clearTempFolder();
9796

9897
/// @return Returns with the temporary folder path.
9998
static const char *getTempFolderPath();
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#ifndef Header_SuperpoweredGuitarDistortion
2+
#define Header_SuperpoweredGuitarDistortion
3+
4+
#include "SuperpoweredFX.h"
5+
6+
namespace Superpowered {
7+
8+
struct gdInternals;
9+
10+
/// @brief Guitar distortion effect including Marshall cabinet, ADA cabinet and V-Twin preamp simulation, 5-band equalizer, bass and treble tone controls and two distortion sounds.
11+
/// One instance allocates around 32 kb memory.
12+
class GuitarDistortion: public FX {
13+
public:
14+
float gainDecibel; ///< Gain value in decibel. Limit: -96 to 24.
15+
float drive; ///< Drive percentage, from 0 to 1.
16+
float bassFrequency; ///< High-pass filter frequency in Hz. From 1 Hz to 250 Hz.
17+
float trebleFrequency; ///< Low-pass filter frequency in Hz. From 6000 Hz to the half of the current sample rate.
18+
float eq80HzDecibel; ///< EQ 80 Hz decibel gain. Limit: -96 to 24.
19+
float eq240HzDecibel; ///< EQ 240 Hz decibel gain. Limit: -96 to 24.
20+
float eq750HzDecibel; ///< EQ 750 Hz decibel gain. Limit: -96 to 24.
21+
float eq2200HzDecibel; ///< EQ 2200 Hz decibel gain. Limit: -96 to 24.
22+
float eq6600HzDecibel; ///< EQ 6600 Hz decibel gain. Limit: -96 to 24.
23+
bool distortion0; ///< Enables the first distortion sound, that is similar to Boss DS-1.
24+
bool distortion1; ///< Enables the second distortion sound, that is similar to Tyrian.
25+
bool marshall; ///< Enables Marshall cabinet simulation.
26+
bool ada; ///< Enables ADA cabinet simulation. Adds a lot of bass and treble.
27+
bool vtwin; ///< Enables V-Twin preamp simulation. Recommended for blues/jazz.
28+
29+
/// @brief Constructor. Enabled is false by default.
30+
/// @param samplerate The initial sample rate in Hz.
31+
GuitarDistortion(unsigned int samplerate);
32+
~GuitarDistortion();
33+
34+
/// @brief Processes the audio. Always call it in the audio processing callback, regardless if the effect is enabled or not for smooth, audio-artifact free operation.
35+
/// It's never blocking for real-time usage. You can change all properties on any thread, concurrently with process().
36+
/// @return If process() returns with true, the contents of output are replaced with the audio output. If process() returns with false, the contents of output are not changed.
37+
/// @param input Pointer to floating point numbers. 32-bit interleaved stereo input. Can point to the same location with output (in-place processing).
38+
/// @param output Pointer to floating point numbers. 32-bit interleaved stereo output.
39+
/// @param numberOfFrames Number of frames to process. Recommendation for best performance: multiply of 4, minimum 64.
40+
bool process(float *input, float *output, unsigned int numberOfFrames);
41+
42+
private:
43+
gdInternals *internals;
44+
GuitarDistortion(const GuitarDistortion&);
45+
GuitarDistortion& operator=(const GuitarDistortion&);
46+
};
47+
48+
}
49+
50+
#endif
51+

Superpowered/SuperpoweredRSA.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ namespace Superpowered {
6262
/// @return Encrypted data or NULL on error. Don't forget to free() this at a later point to prevent memory leaks!
6363
unsigned char *encrypt(unsigned int inputLengthBytes, void *input, bool OAEP_PSS_V21);
6464

65+
/// @return Returns with the encrypted output data size in bytes.
66+
unsigned int getEncryptedOutputSizeBytes();
67+
6568
private:
6669
friend class RSAPrivateKey;
6770
RSAContext *internals;

0 commit comments

Comments
 (0)