Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
juce6_test2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Lindgren
juce6_test2
Commits
3a44af73
Commit
3a44af73
authored
5 years ago
by
Per Lindgren
Browse files
Options
Downloads
Patches
Plain Diff
update works
parent
3f3a58bc
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Source/PluginEditor.cpp
+3
-2
3 additions, 2 deletions
Source/PluginEditor.cpp
Source/PluginProcessor.cpp
+19
-26
19 additions, 26 deletions
Source/PluginProcessor.cpp
Source/PluginProcessor.h
+6
-4
6 additions, 4 deletions
Source/PluginProcessor.h
with
28 additions
and
32 deletions
Source/PluginEditor.cpp
+
3
−
2
View file @
3a44af73
...
...
@@ -26,8 +26,9 @@ Test2AudioProcessorEditor::Test2AudioProcessorEditor(Test2AudioProcessor &p)
startTimerHz
(
60
);
setResizable
(
true
,
true
);
setResizeLimits
(
400
,
300
,
1024
,
1024
);
setSize
(
400
,
300
);
if
(
processor
.
m_flogger
)
processor
.
m_flogger
->
logMessage
(
"Editor initialized"
);
}
Test2AudioProcessorEditor
::~
Test2AudioProcessorEditor
()
...
...
@@ -43,7 +44,7 @@ void Test2AudioProcessorEditor::paint(juce::Graphics &g)
g
.
setColour
(
juce
::
Colours
::
white
);
g
.
setFont
(
15.0
f
);
g
.
drawFittedText
(
"
3
) Position : "
+
std
::
to_string
(
processor
.
position
),
getLocalBounds
(),
juce
::
Justification
::
centred
,
1
);
g
.
drawFittedText
(
"
9
) Position : "
+
std
::
to_string
(
processor
.
position
),
getLocalBounds
(),
juce
::
Justification
::
centred
,
1
);
// if (processor.m_flogger)
// processor.m_flogger->logMessage("paint called");
}
...
...
This diff is collapsed.
Click to expand it.
Source/PluginProcessor.cpp
+
19
−
26
View file @
3a44af73
...
...
@@ -11,20 +11,14 @@
//==============================================================================
Test2AudioProcessor
::
Test2AudioProcessor
()
#ifndef JucePlugin_PreferredChannelConfigurations
:
AudioProcessor
(
BusesProperties
()
#if !JucePlugin_IsMidiEffect
#if !JucePlugin_IsSynth
.
withInput
(
"Input"
,
juce
::
AudioChannelSet
::
stereo
(),
true
)
#endif
.
withOutput
(
"Output"
,
juce
::
AudioChannelSet
::
stereo
(),
true
)
#endif
)
#endif
.
withOutput
(
"Output"
,
juce
::
AudioChannelSet
::
stereo
(),
true
))
{
m_flogger
=
std
::
unique_ptr
<
juce
::
FileLogger
>
(
juce
::
FileLogger
::
createDateStampedLogger
(
"foo"
,
"mylog"
,
".txt"
,
"Welcome to plugin"
));
position
=
0
;
lastPosInfo
.
resetToDefault
();
addParameter
(
gain
=
new
juce
::
AudioParameterFloat
(
"no_gain"
,
// parameter ID
"NoGain"
,
// parameter name
...
...
@@ -53,11 +47,8 @@ bool Test2AudioProcessor::acceptsMidi() const
bool
Test2AudioProcessor
::
producesMidi
()
const
{
#if JucePlugin_ProducesMidiOutput
// Should that be true for automation parameters?
return
true
;
#else
return
false
;
#endif
}
bool
Test2AudioProcessor
::
isMidiEffect
()
const
...
...
@@ -111,28 +102,26 @@ void Test2AudioProcessor::releaseResources()
// spare memory, etc.
}
#ifndef JucePlugin_PreferredChannelConfigurations
bool
Test2AudioProcessor
::
isBusesLayoutSupported
(
const
BusesLayout
&
layouts
)
const
{
#if JucePlugin_IsMidiEffect
juce
::
ignoreUnused
(
layouts
);
return
true
;
#else
// This is the place where you check if the layout is supported.
// In this template code we only support mono or stereo.
if
(
layouts
.
getMainOutputChannelSet
()
!=
juce
::
AudioChannelSet
::
mono
()
&&
layouts
.
getMainOutputChannelSet
()
!=
juce
::
AudioChannelSet
::
stereo
())
// Only mono/stereo and input/output must have same layout
const
auto
&
mainOutput
=
layouts
.
getMainOutputChannelSet
();
const
auto
&
mainInput
=
layouts
.
getMainInputChannelSet
();
// input and output layout must either be the same or the input must be disabled altogether
if
(
!
mainInput
.
isDisabled
()
&&
mainInput
!=
mainOutput
)
return
false
;
// This checks if the input layout matches the output layout
#if !JucePlugin_IsSynth
if
(
layouts
.
getMainOutputChannelSet
()
!=
layouts
.
getMainInputChannelSet
())
// do not allow disabling the main buses
if
(
mainOutput
.
isDisabled
())
return
false
;
// only allow stereo and mono
if
(
mainOutput
.
size
()
>
2
)
return
false
;
#endif
return
true
;
#endif
}
#endif
void
Test2AudioProcessor
::
processBlock
(
juce
::
AudioBuffer
<
float
>
&
buffer
,
juce
::
MidiBuffer
&
midiMessages
)
{
...
...
@@ -162,6 +151,7 @@ void Test2AudioProcessor::processBlock(juce::AudioBuffer<float> &buffer, juce::M
// ..do something to the data...
}
// aggregate the position
for
(
const
auto
metadata
:
midiMessages
)
{
auto
msg
=
metadata
.
getMessage
();
...
...
@@ -191,6 +181,9 @@ void Test2AudioProcessor::processBlock(juce::AudioBuffer<float> &buffer, juce::M
};
};
};
// update time info
updateCurrentTimeInfoFromHost
();
}
//==============================================================================
...
...
This diff is collapsed.
Click to expand it.
Source/PluginProcessor.h
+
6
−
4
View file @
3a44af73
...
...
@@ -59,6 +59,10 @@ public:
// callback - the UI component will read this and display it.
juce
::
AudioPlayHead
::
CurrentPositionInfo
lastPosInfo
;
private:
//==============================================================================
juce
::
AudioParameterFloat
*
gain
;
//==============================================================================
void
updateCurrentTimeInfoFromHost
()
{
if
(
auto
*
ph
=
getPlayHead
())
...
...
@@ -68,6 +72,8 @@ public:
if
(
ph
->
getCurrentPosition
(
newTime
))
{
lastPosInfo
=
newTime
;
// Successfully got the current time from the host..
if
(
m_flogger
)
m_flogger
->
logMessage
(
"Got Pos from host"
);
return
;
}
}
...
...
@@ -76,9 +82,5 @@ public:
lastPosInfo
.
resetToDefault
();
}
private
:
//==============================================================================
juce
::
AudioParameterFloat
*
gain
;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
(
Test2AudioProcessor
)
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment