Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin-GUI
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
yehaojie
plugin-GUI
Commits
7eb3a113
Commit
7eb3a113
authored
11 years ago
by
jsiegle
Browse files
Options
Downloads
Patches
Plain Diff
Add some logic to the ChannelMappingNode
parent
4c183d86
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/Processors/ChannelMappingNode.cpp
+51
-36
51 additions, 36 deletions
Source/Processors/ChannelMappingNode.cpp
Source/Processors/Editors/ChannelMappingEditor.cpp
+12
-5
12 additions, 5 deletions
Source/Processors/Editors/ChannelMappingEditor.cpp
with
63 additions
and
41 deletions
Source/Processors/ChannelMappingNode.cpp
+
51
−
36
View file @
7eb3a113
...
...
@@ -30,7 +30,8 @@
ChannelMappingNode
::
ChannelMappingNode
()
:
GenericProcessor
(
"Channel Mapping"
),
channelBuffer
(
1
,
10000
)
{
referenceArray
.
resize
(
1024
);
// make room for 1024 channels
channelArray
.
resize
(
1024
);
}
ChannelMappingNode
::~
ChannelMappingNode
()
...
...
@@ -51,18 +52,20 @@ AudioProcessorEditor* ChannelMappingNode::createEditor()
void
ChannelMappingNode
::
updateSettings
()
{
channelBuffer
.
setSize
(
getNumInputs
(),
10000
);
}
void
ChannelMappingNode
::
setParameter
(
int
parameterIndex
,
float
newValue
)
{
// editor->updateParameterButtons(parameterIndex);
// referenceChannel = (int) newValue;
// std::cout << "Reference set to " << referenceChannel << std::endl;
if
(
parameterIndex
==
1
)
{
referenceArray
.
set
(
currentChannel
,
(
int
)
newValue
);
}
else
{
channelArray
.
set
(
currentChannel
,
(
int
)
newValue
);
}
}
...
...
@@ -71,33 +74,45 @@ void ChannelMappingNode::process(AudioSampleBuffer& buffer,
int
&
nSamples
)
{
// if (referenceChannel > -1)
// {
// referenceBuffer.clear(0, 0, nSamples);
// referenceBuffer.addFrom(0, // destChannel
// 0, // destStartSample
// buffer, // source
// referenceChannel, // sourceChannel
// 0, // sourceStartSample
// nSamples, // numSamples
// -1.0f // gain to apply to source
// );
// for (int i = 0; i < buffer.getNumChannels(); i++)
// {
// buffer.addFrom(i, // destChannel
// 0, // destStartSample
// referenceBuffer, // source
// 0, // sourceChannel
// 0, // sourceStartSample
// nSamples, // numSamples
// 1.0f // gain to apply to source
// );
// }
// }
// copy everything into the channel buffer
channelBuffer
.
setDataToReferTo
(
buffer
.
getArrayOfChannels
(),
buffer
.
getNumChannels
(),
buffer
.
getNumSamples
());
// copy it back into the buffer according to the channel mapping
buffer
.
clear
();
for
(
int
i
=
0
;
i
<
buffer
.
getNumChannels
();
i
++
)
{
buffer
.
addFrom
(
i
,
// destChannel
0
,
// destStartSample
channelBuffer
,
// source
channelArray
[
i
],
// sourceChannel
0
,
// sourceStartSample
nSamples
,
// numSamples
1.0
f
// gain to apply to source (positive)
);
}
// now do the referencing
for
(
int
i
=
0
;
i
<
buffer
.
getNumChannels
();
i
++
)
{
if
(
referenceArray
[
i
]
>
-
1
)
{
buffer
.
addFrom
(
i
,
// destChannel
0
,
// destStartSample
channelBuffer
,
// source
referenceArray
[
i
],
// sourceChannel
0
,
// sourceStartSample
nSamples
,
// numSamples
-
1.0
f
// gain to apply to source (negative for reference)
);
}
}
}
This diff is collapsed.
Click to expand it.
Source/Processors/Editors/ChannelMappingEditor.cpp
+
12
−
5
View file @
7eb3a113
...
...
@@ -97,6 +97,11 @@ void ChannelMappingEditor::createElectrodeButtons(int numNeeded)
button
->
addListener
(
this
);
referenceArray
.
add
(
-
1
);
getProcessor
()
->
setCurrentChannel
(
i
);
getProcessor
()
->
setParameter
(
0
,
i
);
// set channel mapping to standard channel
getProcessor
()
->
setParameter
(
1
,
-
1
);
// set reference to none
channelArray
.
add
(
i
+
1
);
if
(
column
%
8
==
0
)
...
...
@@ -167,18 +172,20 @@ void ChannelMappingEditor::channelChanged(int chan)
electrodeButtons
[
i
]
->
setChannelNum
(
chan
);
electrodeButtons
[
i
]
->
repaint
();
getProcessor
()
->
setCurrentChannel
(
i
);
if
(
electrodeEditorButtons
[
1
]
->
getToggleState
())
// reference
{
referenceArray
.
set
(
i
,
chan
);
getProcessor
()
->
setParameter
(
1
,
chan
-
1
);
// set reference
}
else
{
channelArray
.
set
(
i
,
chan
);
}
getProcessor
()
->
setParameter
(
0
,
chan
-
1
);
// set mapping
}
// SpikeDetector* processor = (SpikeDetector*) getProcessor();
// processor->setChannel(electrodeList->getSelectedItemIndex(),
// i,
// chan-1);
}
}
}
...
...
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