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
d10e0cd2
Commit
d10e0cd2
authored
11 years ago
by
Josh Siegle
Browse files
Options
Downloads
Patches
Plain Diff
Make ControlPanel red while recording
parent
04be2629
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/UI/ControlPanel.cpp
+31
-74
31 additions, 74 deletions
Source/UI/ControlPanel.cpp
Source/UI/ControlPanel.h
+11
-0
11 additions, 0 deletions
Source/UI/ControlPanel.h
with
42 additions
and
74 deletions
Source/UI/ControlPanel.cpp
+
31
−
74
View file @
d10e0cd2
...
@@ -185,7 +185,13 @@ Clock::~Clock()
...
@@ -185,7 +185,13 @@ Clock::~Clock()
void
Clock
::
paint
(
Graphics
&
g
)
void
Clock
::
paint
(
Graphics
&
g
)
{
{
g
.
fillAll
(
Colour
(
58
,
58
,
58
));
if
(
isRecording
)
{
g
.
fillAll
(
Colour
(
255
,
0
,
0
));
}
else
{
g
.
fillAll
(
Colour
(
58
,
58
,
58
));
}
drawTime
(
g
);
drawTime
(
g
);
}
}
...
@@ -211,7 +217,7 @@ void Clock::drawTime(Graphics& g)
...
@@ -211,7 +217,7 @@ void Clock::drawTime(Graphics& g)
if
(
isRecording
)
if
(
isRecording
)
{
{
g
.
setColour
(
Colours
::
red
);
g
.
setColour
(
Colours
::
black
);
m
=
floor
(
totalRecordTime
/
60000.0
);
m
=
floor
(
totalRecordTime
/
60000.0
);
s
=
floor
((
totalRecordTime
-
m
*
60000.0
)
/
1000.0
);
s
=
floor
((
totalRecordTime
-
m
*
60000.0
)
/
1000.0
);
...
@@ -434,6 +440,8 @@ ControlPanel::ControlPanel(ProcessorGraph* graph_, AudioComponent* audio_)
...
@@ -434,6 +440,8 @@ ControlPanel::ControlPanel(ProcessorGraph* graph_, AudioComponent* audio_)
startTimer
(
10
);
startTimer
(
10
);
setWantsKeyboardFocus
(
true
);
setWantsKeyboardFocus
(
true
);
backgroundColour
=
Colour
(
58
,
58
,
58
);
}
}
...
@@ -485,7 +493,7 @@ void ControlPanel::createPaths()
...
@@ -485,7 +493,7 @@ void ControlPanel::createPaths()
void
ControlPanel
::
paint
(
Graphics
&
g
)
void
ControlPanel
::
paint
(
Graphics
&
g
)
{
{
g
.
setColour
(
Colour
(
58
,
58
,
58
)
);
g
.
setColour
(
backgroundColour
);
g
.
fillRect
(
0
,
0
,
getWidth
(),
getHeight
());
g
.
fillRect
(
0
,
0
,
getWidth
(),
getHeight
());
if
(
open
)
if
(
open
)
...
@@ -569,12 +577,26 @@ void ControlPanel::labelTextChanged(Label* label)
...
@@ -569,12 +577,26 @@ void ControlPanel::labelTextChanged(Label* label)
}
}
void
ControlPanel
::
startRecording
()
{
playButton
->
setToggleState
(
true
,
false
);
masterClock
->
startRecording
();
// turn on recording
backgroundColour
=
Colour
(
255
,
0
,
0
);
repaint
();
}
void
ControlPanel
::
stopRecording
()
{
graph
->
setRecordState
(
false
);
// turn off recording in processor graph
masterClock
->
stopRecording
();
newDirectoryButton
->
setEnabledState
(
true
);
backgroundColour
=
Colour
(
58
,
58
,
58
);
repaint
();
}
void
ControlPanel
::
buttonClicked
(
Button
*
button
)
void
ControlPanel
::
buttonClicked
(
Button
*
button
)
{
{
//const MessageManagerLock mmLock;
//std::cout << "MessageManagerLock gained." << std::endl;
if
(
button
==
recordButton
)
if
(
button
==
recordButton
)
{
{
...
@@ -582,17 +604,12 @@ void ControlPanel::buttonClicked(Button* button)
...
@@ -582,17 +604,12 @@ void ControlPanel::buttonClicked(Button* button)
if
(
recordButton
->
getToggleState
())
if
(
recordButton
->
getToggleState
())
{
{
playButton
->
setToggleState
(
true
,
false
);
startRecording
();
masterClock
->
startRecording
();
// turn on recording
}
}
else
else
{
{
graph
->
setRecordState
(
false
);
// turn off recording in processor graph
stopRecording
();
//graph->getRecordNode()->setParameter(0,10.0f); // turn off recording
masterClock
->
stopRecording
();
newDirectoryButton
->
setEnabledState
(
true
);
}
}
dateText
->
setColour
(
Label
::
textColourId
,
Colours
::
black
);
dateText
->
setColour
(
Label
::
textColourId
,
Colours
::
black
);
...
@@ -632,59 +649,19 @@ void ControlPanel::buttonClicked(Button* button)
...
@@ -632,59 +649,19 @@ void ControlPanel::buttonClicked(Button* button)
if
(
graph
->
enableProcessors
())
if
(
graph
->
enableProcessors
())
{
{
//const MessageManagerLock mmLock;
MessageManager
*
mm
=
MessageManager
::
getInstance
();
if
(
mm
->
isThisTheMessageThread
())
std
::
cout
<<
"THIS IS THE MESSAGE THREAD -- CONTROL PANEL"
<<
std
::
endl
;
else
std
::
cout
<<
"NOT THE MESSAGE THREAD -- CONTROL PANEL"
<<
std
::
endl
;
//mm->stopDispatchLoop();
//if (mm->currentThreadHasLockedMessageManager())
// std::cout << "We have the lock." << std::endl;
//else
// std::cout << "We DO NOT have the lock." << std::endl;
//Thread* thread = Thread::getCurrentThread();
//if (thread != nullptr)
// std::cout << "Starting callbacks from thread named " << thread->getThreadId() << std::endl;
//else
// std::cout << "Current thread is null" << std::endl;
MessageManagerLock
mml
(
Thread
::
getCurrentThread
());
if
(
mml
.
lockWasGained
())
{
std
::
cout
<<
"CONTROL PANEL GOT THAT LOCK!"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"COULDN'T GET THE LOCK, RETURNING...!"
<<
std
::
endl
;
return
;
}
//std::cout << "Enabling processors from " << getThreadName() << " thread." << std::endl;
//std::cout << "Enabling processors from " << getThreadName() << " thread." << std::endl;
if
(
recordButton
->
getToggleState
())
if
(
recordButton
->
getToggleState
())
graph
->
setRecordState
(
true
);
graph
->
setRecordState
(
true
);
//graph->getRecordNode()->setParameter(1,10.0f);
stopTimer
();
stopTimer
();
audio
->
beginCallbacks
();
audio
->
beginCallbacks
();
masterClock
->
start
();
masterClock
->
start
();
startTimer
(
250
);
// refresh every 250 ms
startTimer
(
250
);
// refresh every 250 ms
// mm->runDispatchLoop();
}
}
}
}
...
@@ -705,26 +682,6 @@ void ControlPanel::buttonClicked(Button* button)
...
@@ -705,26 +682,6 @@ void ControlPanel::buttonClicked(Button* button)
if
(
audio
->
callbacksAreActive
())
if
(
audio
->
callbacksAreActive
())
{
{
//const MessageManagerLock mmLock;
Thread
*
thread
=
Thread
::
getCurrentThread
();
if
(
thread
!=
nullptr
)
std
::
cout
<<
"Stopping callbacks from thread named "
<<
thread
->
getThreadId
()
<<
std
::
endl
;
else
std
::
cout
<<
"Current thread is null"
<<
std
::
endl
;
MessageManagerLock
mml
(
Thread
::
getCurrentThread
());
if
(
mml
.
lockWasGained
())
{
std
::
cout
<<
"CONTROL PANEL GOT THAT LOCK!"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"COULDN'T GET THE LOCK...RETURNING!"
<<
std
::
endl
;
return
;
}
//std::cout << "Disabling processors from " << getThreadName() << " thread." << std::endl;
std
::
cout
<<
"Control panel requesting to end callbacks."
<<
std
::
endl
;
std
::
cout
<<
"Control panel requesting to end callbacks."
<<
std
::
endl
;
audio
->
endCallbacks
();
audio
->
endCallbacks
();
...
...
This diff is collapsed.
Click to expand it.
Source/UI/ControlPanel.h
+
11
−
0
View file @
d10e0cd2
...
@@ -240,6 +240,8 @@ public:
...
@@ -240,6 +240,8 @@ public:
/** Sets the open/closed state of the ControlPanelButton.*/
/** Sets the open/closed state of the ControlPanelButton.*/
void
setState
(
bool
);
void
setState
(
bool
);
/** Draws the button. */
/** Draws the button. */
void
paint
(
Graphics
&
g
);
void
paint
(
Graphics
&
g
);
...
@@ -252,6 +254,7 @@ private:
...
@@ -252,6 +254,7 @@ private:
ControlPanel
*
cp
;
ControlPanel
*
cp
;
bool
open
;
bool
open
;
};
};
...
@@ -349,6 +352,12 @@ private:
...
@@ -349,6 +352,12 @@ private:
void
resized
();
void
resized
();
void
buttonClicked
(
Button
*
button
);
void
buttonClicked
(
Button
*
button
);
/** Informs the Control Panel that recording has begun.*/
void
startRecording
();
/** Informs the Control Panel that recording has stopped.*/
void
stopRecording
();
bool
initialize
;
bool
initialize
;
...
@@ -371,6 +380,8 @@ private:
...
@@ -371,6 +380,8 @@ private:
/** Draws the boundaries around the FilenameComponent.*/
/** Draws the boundaries around the FilenameComponent.*/
void
createPaths
();
void
createPaths
();
Colour
backgroundColour
;
};
};
...
...
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