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
be444e42
Commit
be444e42
authored
12 years ago
by
jsiegle
Browse files
Options
Downloads
Patches
Plain Diff
Added additional protection to RecordNode when closing files
parent
4cbcc5f0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Source/Processors/FilterNode.cpp
+2
-4
2 additions, 4 deletions
Source/Processors/FilterNode.cpp
Source/Processors/RecordNode.cpp
+29
-9
29 additions, 9 deletions
Source/Processors/RecordNode.cpp
Source/Processors/RecordNode.h
+3
-3
3 additions, 3 deletions
Source/Processors/RecordNode.h
with
34 additions
and
16 deletions
Source/Processors/FilterNode.cpp
+
2
−
4
View file @
be444e42
...
...
@@ -100,11 +100,9 @@ AudioProcessorEditor* FilterNode::createEditor()
void
FilterNode
::
updateSettings
()
{
filters
.
clear
();
// lowCuts.clear();
//highCuts.clear();
if
(
getNumInputs
()
<
100
&&
getNumInputs
()
!=
filters
.
size
())
{
if
(
getNumInputs
()
<
100
)
{
filters
.
clear
();
for
(
int
n
=
0
;
n
<
getNumInputs
();
n
++
)
{
...
...
This diff is collapsed.
Click to expand it.
Source/Processors/RecordNode.cpp
+
29
−
9
View file @
be444e42
...
...
@@ -31,6 +31,7 @@ RecordNode::RecordNode()
// newDataFolder = true; // defaults to creating a new data folder on startup
continuousDataBuffer
=
new
int16
[
10000
];
signalFilesShouldClose
=
false
;
}
...
...
@@ -238,14 +239,10 @@ void RecordNode::setParameter (int parameterIndex, float newValue)
if
(
isRecording
)
{
// close necessary files
for
(
int
i
=
0
;
i
<
continuousChannels
.
size
();
i
++
)
{
if
(
continuousChannels
[
i
].
isRecording
)
{
std
::
cout
<<
"CLOSING FILE: "
<<
continuousChannels
[
i
].
filename
<<
std
::
endl
;
fclose
(
continuousChannels
[
i
].
file
);
}
}
signalFilesShouldClose
=
true
;
}
isRecording
=
false
;
...
...
@@ -279,6 +276,19 @@ void RecordNode::setParameter (int parameterIndex, float newValue)
}
}
void
RecordNode
::
closeAllFiles
()
{
for
(
int
i
=
0
;
i
<
continuousChannels
.
size
();
i
++
)
{
if
(
continuousChannels
[
i
].
isRecording
)
{
std
::
cout
<<
"CLOSING FILE: "
<<
continuousChannels
[
i
].
filename
<<
std
::
endl
;
fclose
(
continuousChannels
[
i
].
file
);
}
}
}
bool
RecordNode
::
enable
()
{
isProcessing
=
true
;
...
...
@@ -349,7 +359,7 @@ void RecordNode::process(AudioSampleBuffer &buffer,
//buffer.applyGain(0, nSamples, 0.5);
// cycle through events -- extract the samples per channel
// NOT YET IMPLEMENTED
// cycle through buffer channels
for
(
int
i
=
0
;
i
<
buffer
.
getNumChannels
();
i
++
)
...
...
@@ -368,6 +378,16 @@ void RecordNode::process(AudioSampleBuffer &buffer,
}
return
;
}
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
+
3
−
3
View file @
be444e42
...
...
@@ -32,8 +32,6 @@
#include
"GenericProcessor.h"
/**
--UNDER CONSTRUCTION--
Receives inputs from all processors that want to save their data.
Writes data to disk using fwrite.
...
...
@@ -83,7 +81,7 @@ private:
/** Keep the RecordNode informed of acquisition and record states.
*/
bool
isRecording
,
isProcessing
;
bool
isRecording
,
isProcessing
,
signalFilesShouldClose
;
/** User-selectable directory for saving data files. Currently
defaults to the user's home directory.
...
...
@@ -125,6 +123,8 @@ private:
FILE
*
file
;
};
void
closeAllFiles
();
/** Map of continuous channels.
*/
std
::
map
<
int
,
Channel
>
continuousChannels
;
...
...
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