gpt4 book ai didi

c++ - JUCE 无法在音频插件上插入按钮

转载 作者:行者123 更新时间:2023-11-28 05:07:26 24 4
gpt4 key购买 nike

我试图在音频插件中添加一个按钮,但在测试时似乎无法显示。

我正在使用插件主机来测试和查看 GUI。 pad1PluginEditor.h 中定义:

private:
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
CPAudioProcessor& processor;

TextButton pad1;

我在 PluginEditor.cpp 中放置了以下代码:

CPAudioProcessorEditor::CPAudioProcessorEditor (CPAudioProcessor& p)
: AudioProcessorEditor (&p), processor (p)
{
pad1.setColour(TextButton::buttonColourId, Colours::lime);
pad1.setButtonText("Press Me!");
addAndMakeVisible(pad1);

// Make sure that before the constructor has finished, you've set the
// editor's size to whatever you need it to be.
setSize (400, 300);
}

我按照本教程作为如何添加按钮的指南:https://www.juce.com/doc/tutorial_rectangle_advanced

有什么我想念的吗?它看起来与指南中的代码相同。

最佳答案

问题是我忘记在覆盖的 resized 方法中设置宽度/高度。

void CPAudioProcessorEditor::resized()
{
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
pad1.setBounds(10, 10, 100, 100);
}

关于c++ - JUCE 无法在音频插件上插入按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44355473/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com