figbug / gin Goto Github PK
View Code? Open in Web Editor NEWA few extras for juce
License: BSD 3-Clause "New" or "Revised" License
A few extras for juce
License: BSD 3-Clause "New" or "Revised" License
Changing the brightness affects completely invisible pixels whose alpha values are 0. When used on an image like that, and lowering the brightness, the invisible pixels become visibly darker.
It seems almost as if the alpha values are darkened too.
Note: this function interprets the input value for contrast correctly, so positive values increase contrast, negative values decrease it.
Currently the project exports a WebSocket client for use. Can this code be easily augmented to support hosting a WebSocket server?
I've been getting a "Connection error!" message while using the web sockets classes in Gin. Our javascript and other implementations seem to work correctly without issue on the same server so I'm wondering if it has to do with Gin specifically, or the low level juce classes that it uses. Just wondering if you've ever seen this behavior. Thanks by the way- awesome library all around.
The fni->FileNameLength field is the size of the file name in bytes, not the number of wchars in the String.
The fix is this :
e.file = folder.getChildFile(String(fni->FileName, fni->FileNameLength / sizeof(wchar_t)));
Most of the time you don't see the bug because for single event buffers the byte after the fni record is already null, but when you have multiple events, there is not always a null byte after the end of the string so it was creating invalid filenames.
this code won't work on macos if app sandbox is enabled. specifically only a single element is rendered:
i ended up getting it to work with this horribleness:
void Editor::resized() {
#if JUCE_DEBUG
#if JUCE_MAC
if (juce::SystemStats::isAppSandboxEnabled()) {
DBG("disabling layout reloading because AppSandbox is enabled");
layout.setLayout("layout.json");
} else {
auto f = juce::File(__FILE__).getChildFile("../../Resources/layout.json");
layout.setLayout("layout.json", f);
}
#else
auto f = juce::File(__FILE__).getChildFile("../../Resources/layout.json");
layout.setLayout("layout.json", f);
#endif
#else
layout.setLayout("layout.json");
#endif
}
i'm not suggesting you do this in the demos but maybe a comment about AppSandbox
compatibility would help the next person who hits this?
More a feature request really.
Use case:
I have a list in my GUI showing the files in a folder.
Said list gets updated when the FileSystemWatcher says something has changed.
The user can press a "browse" a button to change which folder has its content listed.
When the folder to display changes, I must tell the FileSystemWatcher to stop watching the old folder and watch the new one.
This implies that at that moment I must have a track of what the old folder was to call removeFolder(), while what I really would like to do is tell the watcher: "forget whatever folder you were watching before", and then call addFolder(newFolder) to watch the new one
The following snippet missing a lot of JUCE 6.1 functions
`void ResamplingFifo::pushAudioBufferInt (const juce::AudioSampleBuffer& src)
{
jassert (src.getNumSamples() <= blockSize);
int todo = src.getNumSamples();
int done = 0;
{
using SourceFormat = juce::AudioData::Format<juce::AudioData::Float32, juce::AudioData::NativeEndian>;
using DestFormat = juce::AudioData::Format<juce::AudioData::Float32, juce::AudioData::NativeEndian>;
juce::AudioData::interleaveSamples (juce::AudioData::NonInterleavedSource<SourceFormat> { src.getArrayOfReadPointers(), numChannels },
juce::AudioData::InterleavedDest<DestFormat> { ilInputBuffer.getWritePointer (0), numChannels },
src.getNumSamples());
}
SRC_DATA data;
data.data_in = ilInputBuffer.getReadPointer (0);
data.data_out = ilOutputBuffer.getWritePointer (0);
data.output_frames = 4 * blockSize;
data.src_ratio = ratio;
data.end_of_input = 0;
while (todo > 0)
{
data.input_frames = todo;
data.input_frames_used = 0;
data.output_frames_gen = 0;
data.data_in = ilInputBuffer.getReadPointer (0) + done * numChannels;
src_process (impl->state, &data);
todo -= data.input_frames_used;
done += data.input_frames_used;
if (data.output_frames_gen > 0)
{
using SourceFormat = juce::AudioData::Format<juce::AudioData::Float32, juce::AudioData::NativeEndian>;
using DestFormat = juce::AudioData::Format<juce::AudioData::Float32, juce::AudioData::NativeEndian>;
juce::AudioData::deinterleaveSamples (juce::AudioData::InterleavedSource<SourceFormat> { ilOutputBuffer.getReadPointer (0), numChannels },
juce::AudioData::NonInterleavedDest<DestFormat> { outputBuffer.getArrayOfWritePointers(), numChannels },
int (data.output_frames_gen));
outputFifo.write (outputBuffer, int (data.output_frames_gen));
}
}
}`
In DownloadManager
, the member atomic pause
(std::atomic<bool> pause;
) is left uninitialized.
This can cause random hangs if by any chance it's uninitialized state is true
.
It shoud be std::atomic<bool> pause = false;
The input parameter is backwards. Negative values increase the contrast, whereas positive value decreases it.
Hey Roland.
Thanks for fixing that I assert I posted.
I'm using your Perlin Noise class from Gin. It's saving us a lot of time, so thanks for making it.
I'm feeding it a 2D array of x/y coordinates ranging from 0 to 1, with the class declared as gin::PerlinNoise<float>
.
I'm expecting to see something like this:
I'm getting this instead when I use an input range of [0, 1]
If I use a higher range, some weird tiling happens:
Is this due to how many octaves you're calculating?
I've encountered this problem while working on PAPU, which supports LV2.
When building the Synth example in LV2 format on Linux, it seems that parameter name and parameter count is not detected properly. There's probably something missing for the lv2 helper program provided by Juce to map everything properly, although manually inspecting the generated dsp.ttl
file shows the the parameters were indeed found, with the right names and number.
Below is a screen capture of Carla showing the VST3 version (left) vs the LV2 version (right), showing the missing parameters.
Hello Roland,
I found a code that is probably a mistake.
As the title says, only the first channel of the audio buffer is referenced in LevelTracker component.
This code is causing, if the plugin can receive stereo signals, the level meter do not respond when the signal is input to the R channel only.
e.g. Compressor and Limiter in the slPlugins repository.
If I change this code as follows, such behavior will be collected.
trackBuffer (buffer.getReadPointer (i), buffer.getNumSamples());
Other functions are probably affected as well.
Hi! Love your work! I integrate the Gin module into a bigger application using the new JUCE 6's CMake mechanism.
I wrote a mini CMakeLists.txt for the Gin library, which works as expected on Linux and Windows, but utterly fails on the Mac build. Me, not being Mac savvy, have no idea what is going wrong. It seems the #import pragma somehow is wrong.
The CMakeLists.txt I have written is here: https://github.com/christofmuc/KnobKraft-orm/blob/master/third_party/CMakeLists.txt
I include Gin as a git submodule.
The error message on the Mac is in the build log (hope the access permissions allow you to follow that link:
https://dev.azure.com/christof0759/KnobKraft/_build/results?buildId=292&view=logs&j=e0fca624-2401-5624-f540-1c188feac080&t=95b3b2e9-1390-5b19-59f2-dbccb23e7f0a
Basically it reads:
In file included from /Users/runner/work/1/s/third_party/Gin/modules/gin/gin.cpp:30:
In file included from /Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer /SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8:
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System /Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:492:1: error: expected unqualified-id
@class NSString, Protocol;
^
The error seems to indicate it has interpreted the #import as Objective-C?
Sorry if that is confusing, but maybe it's an opportunity for you to update Gin to the latest JUCE?
Is it possible to add a gin module via FetchContent or CPM?
I prefer this method over Git submodules.
i can't seem to compile the demo project to my IOS phone (iphone 6).
i get about 20 errors, almost all are semantic issues.
the last couple:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/mmintrin.h:387:19: error: use of undeclared identifier '__builtin_ia32_paddw' return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/mmintrin.h:408:19: error: use of undeclared identifier '__builtin_ia32_paddd' return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/mmintrin.h:430:19: error: use of undeclared identifier '__builtin_ia32_paddsb' return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/mmintrin.h:453:19: error: use of undeclared identifier '__builtin_ia32_paddsw' return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/mmintrin.h:475:19: error: use of undeclared identifier '__builtin_ia32_paddusb' return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2); ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated.
my steps are:
Hello there,
Great piece of software that you did.
Do you plan to add a "glow effect" ? ;-)
Thanks
This constructor causes a jassert in juce::ArrayBase
:
PerlinNoise (unsigned int seed)
{
juce::Random r (seed);
for (int i = 0; i <= 255; i++)
p.add (i);
shuffleArray (r, p);
p.addArray (p);
}
the line in question is:
p.addArray (p);
The jassert being triggered is:
template <class OtherArrayType>
void addArray (const OtherArrayType& arrayToAddFrom)
{
jassert ((const void*) this != (const void*) &arrayToAddFrom); // can't add from our own elements!
Here is a solution that gets around the jassert:
PerlinNoise (unsigned int seed)
{
juce::Random r (seed);
for (int i = 0; i <= 255; i++)
p.add (i);
shuffleArray (r, p);
auto copy = p; //insert this line
p.addArray (copy);
}
FSEventStreamScheduleWithRunLoop
and FSEventStreamUnscheduleFromRunLoop
are deprecated. First deprecated in macOS 13.0 - use FSEventStreamSetDispatchQueue
instead.
Hi 👋 ,
There are seem to be some unhandled cases in the MessagePack serializer:
fromData
does not handle cases 0xd0
, 0xd1
, 0xd2
, and 0xd3
:...
else if (d == 0xd0)
{
return int(is.readByte());
}
else if (d == 0xd1)
{
return int(is.readShortBigEndian());
}
else if (d == 0xd2)
{
return is.readIntBigEndian();
}
else if (d == 0xd3)
{
return is.readInt64BigEndian();
}
...
toData
code reads...
else if (v >= 32768)
{
os.writeByte (char (0xd1));
os.writeShortBigEndian (short (v));
}
else if (v >= 2147483648)
{
os.writeByte (char (0xd2));
os.writeIntBigEndian (int (v));
}
...
has to be
...
else if (v >= -32768)
{
os.writeByte (char (0xd1));
os.writeShortBigEndian (short (v));
}
else if (v >= -2147483648LL)
{
os.writeByte (char (0xd2));
os.writeIntBigEndian (int (v));
}
...
else
{
os.writeByte (char (0xdc));
os.writeIntBigEndian (n);
}
must be
else
{
os.writeByte (char (0xdd));
os.writeIntBigEndian (n);
}
Thanks!
I don't really understand how to properly use this class. Here's my current usage:
// during setup:
m_limiter.setSampleRate(sampleRate);
m_limiter.setNumChannels(2);
m_limiter.setMode(gin::Dynamics::limiter);
m_limiter.setParams(
0.002f, // Attack in seconds
0.08f, // Release in seconds
0, // Threshold in dB?
10, // Ratio in ?
0 // Knee width in ?
);
// during processing:
m_limiter.process(buffer);
If I set the threshold to -50, it only seems to lower the output volume. Am I doing something wrong? What parameters do I use to get a similar result as juce::dsp::Limiter
?
Also, I assume the extra pointer in process()
is for displaying the envelope in UI?
I don't know so much about reverb algorithms, but I think there's a glitch in the initialization of this class. The comb1Length member variable (and the other combLengths) aren't initialized until setParameters is called. This would be fine, except the setParameters method checks if the input differs from the current fader values which actually are initialized in the constructor. Meaning, if someone called setParameters once with roomSizeIn=0.5 then the combLengths would continue to be uninitialized.
These uint8_t casts look like a typo:
https://github.com/FigBug/Gin/blob/master/modules/gin/utilities/gin_messagepack.cpp#L337
else if (d == 0xcd)
{
return int (uint8_t (is.readShortBigEndian()));
}
else if (d == 0xce)
{
return int (uint8_t (is.readIntBigEndian()));
}
else if (d == 0xcf)
{
return int (uint8_t (is.readInt64BigEndian()));
}
suggested: JUCE_DECLARE_WEAK_REFERENCEABLE(...)
https://docs.juce.com/develop/group__juce__core-memory.html#ga557fa9dbf924a150e27f0cf0dad368b0
Shouldn't value trees be passed by copy? They're reference-counted, and you have a reference member in this class.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.