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
161dcdb2
Commit
161dcdb2
authored
12 years ago
by
jsiegle
Browse files
Options
Downloads
Patches
Plain Diff
Minor updates to RecordNode
parent
0a2e9a47
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/RecordNode.cpp
+14
-8
14 additions, 8 deletions
Source/Processors/RecordNode.cpp
Source/Processors/RecordNode.h
+34
-2
34 additions, 2 deletions
Source/Processors/RecordNode.h
with
48 additions
and
10 deletions
Source/Processors/RecordNode.cpp
+
14
−
8
View file @
161dcdb2
...
...
@@ -30,7 +30,8 @@ RecordNode::RecordNode()
// newDataFolder = true; // defaults to creating a new data folder on startup
continuousDataBuffer
=
new
int16
[
10000
];
continuousDataIntegerBuffer
=
new
int16
[
10000
];
continuousDataFloatBuffer
=
new
float
[
10000
];
signalFilesShouldClose
=
false
;
}
...
...
@@ -142,10 +143,8 @@ void RecordNode::addInputChannel(GenericProcessor* sourceNode, int chan)
continuousChannels
.
insert
(
newPair
);
}
else
{
std
::
map
<
int
,
Channel
>
eventChans
;
int
ID
=
sourceNode
->
getNodeId
();
...
...
@@ -317,9 +316,15 @@ float RecordNode::getFreeSpace()
void
RecordNode
::
writeContinuousBuffer
(
float
*
data
,
int
nSamples
,
int
channel
)
{
// scale the data appropriately
for
(
int
n
=
0
;
n
<
nSamples
;
n
++
)
{
*
(
continuousDataFloatBuffer
+
n
)
=
*
(
data
+
n
)
/
10000.0
f
;
}
// find file and write samples to disk
AudioDataConverters
::
convertFloatToInt16BE
(
data
,
continuousDataBuffer
,
nSamples
);
AudioDataConverters
::
convertFloatToInt16BE
(
continuousDataFloatBuffer
,
continuousData
Integer
Buffer
,
nSamples
);
//int16 samps = nSamples;
...
...
@@ -333,7 +338,7 @@ void RecordNode::writeContinuousBuffer(float* data, int nSamples, int channel)
1
,
// count
continuousChannels
[
channel
].
file
);
// ptr to FILE object
int
n
=
fwrite
(
continuousDataBuffer
,
// ptr
int
n
=
fwrite
(
continuousData
Integer
Buffer
,
// ptr
2
,
// size of each element
nSamples
,
// count
continuousChannels
[
channel
].
file
);
// ptr to FILE object
...
...
@@ -354,10 +359,11 @@ void RecordNode::process(AudioSampleBuffer &buffer,
//std::cout << "Record node processing block." << std::endl;
//std::cout << "Num channels: " << buffer.getNumChannels() << std::endl;
timestamp
=
timer
.
getHighResolutionTicks
();
if
(
isRecording
)
{
timestamp
=
timer
.
getHighResolutionTicks
();
// WHY IS THIS AFFECTING THE LFP DISPLAY?
//buffer.applyGain(0, nSamples, 5.2438f);
...
...
@@ -385,10 +391,10 @@ void RecordNode::process(AudioSampleBuffer &buffer,
}
// this is intended to prevent parameter changes from closing files
// before recording stops
if
(
signalFilesShouldClose
)
{
// prevent parameter changes from closing files
// before recording stops
closeAllFiles
();
signalFilesShouldClose
=
false
;
}
...
...
This diff is collapsed.
Click to expand it.
Source/Processors/RecordNode.h
+
34
−
2
View file @
161dcdb2
...
...
@@ -52,9 +52,20 @@ public:
RecordNode
();
~
RecordNode
();
/** Handle incoming data and decide which files and events to write to disk.
*/
void
process
(
AudioSampleBuffer
&
buffer
,
MidiBuffer
&
eventBuffer
,
int
&
nSamples
);
/** Overrides implementation in GenericProcessor; used to change recording parameters
on the fly.
parameterIndex = 0: stop recording
parameterIndex = 1: start recording
parameterIndex = 2:
newValue = 0: turn off recording for current channel
newValue = 1: turn on recording for current channel
*/
void
setParameter
(
int
parameterIndex
,
float
newValue
);
void
addInputChannel
(
GenericProcessor
*
sourceNode
,
int
chan
);
...
...
@@ -67,16 +78,30 @@ public:
*/
float
getFreeSpace
();
/** Selects a channel relative to a particular processor with ID = id
*/
void
setChannel
(
int
id
,
int
chan
);
/** Turns recording on and off for a particular channel.
Channel numbers are absolute (based on RecordNode channel mapping).
*/
void
setChannelStatus
(
int
chan
,
bool
status
);
/** Used to clear all connections prior to the start of acquisition.
*/
void
resetConnections
();
/** Overrides implementation by GenericProcessor.
*/
bool
isAudioOrRecordNode
()
{
return
true
;}
/** Callback to indicate when user has chosen a new data directory.
*/
void
filenameComponentChanged
(
FilenameComponent
*
);
/** Creates a new data directory in the location specified by the fileNameComponent.
*/
void
createNewDirectory
();
private
:
...
...
@@ -102,7 +127,12 @@ private:
/** Holds data that has been converted from float to int16 before
saving.
*/
int16
*
continuousDataBuffer
;
int16
*
continuousDataIntegerBuffer
;
/** Holds data that has been converted from float to int16 before
saving.
*/
float
*
continuousDataFloatBuffer
;
/** Integer timestamp saved for each buffer.
*/
...
...
@@ -125,6 +155,8 @@ private:
FILE
*
file
;
};
/** Closes all open files after recording has finished.
*/
void
closeAllFiles
();
/** Map of continuous channels.
...
...
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