-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add validation to control objects #9
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8940f51
Implement optional validation of control object changes.
ywwg a5d9068
Different implementation of validators
ywwg 0c4b8f4
make sure to set validator in CDP when it's set in CO
ywwg 5797282
start to address notes
ywwg 5822490
add controlvalidator.h
ywwg 57d9d0a
address notes
ywwg 67cd7d3
Add Enabled/Disabled state to ControlPrivateDouble
ywwg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef CONTROLVALIDATOR_H | ||
#define CONTROLVALIDATOR_H | ||
|
||
class ControlValidator { | ||
public: | ||
virtual ~ControlValidator() {}; | ||
|
||
// Subclasses override this function to provide a way to reject invalid settings. | ||
// Returns true if the change is valid. | ||
virtual bool validateChange(double value) const = 0; | ||
}; | ||
|
||
#endif // CONTROLVALIDATOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,9 +108,6 @@ EngineBuffer::EngineBuffer(const char * _group, ConfigObject<ConfigValue> * _con | |
// Play button | ||
m_playButton = new ControlPushButton(ConfigKey(m_group, "play")); | ||
m_playButton->setButtonMode(ControlPushButton::TOGGLE); | ||
connect(m_playButton, SIGNAL(valueChanged(double)), | ||
this, SLOT(slotControlPlay(double)), | ||
Qt::DirectConnection); | ||
|
||
//Play from Start Button (for sampler) | ||
m_playStartButton = new ControlPushButton(ConfigKey(m_group, "start_play")); | ||
|
@@ -383,6 +380,7 @@ void EngineBuffer::slotTrackLoading() { | |
m_iTrackLoading = 1; | ||
m_pause.unlock(); | ||
|
||
m_playButton->setEnabled(true); | ||
m_playButton->set(0.0); //Stop playback | ||
m_pTrackSamples->set(0); // Stop renderer | ||
} | ||
|
@@ -398,6 +396,7 @@ void EngineBuffer::slotTrackLoaded(TrackPointer pTrack, | |
m_file_length_old = iTrackNumSamples; | ||
m_pTrackSamples->set(iTrackNumSamples); | ||
m_pTrackSampleRate->set(iTrackSampleRate); | ||
m_playButton->setEnabled(true); | ||
m_pause.unlock(); | ||
|
||
// All EngingeControls are connected directly | ||
|
@@ -441,6 +440,7 @@ void EngineBuffer::ejectTrack() { | |
m_playButton->set(0.0); | ||
m_visualBpm->set(0.0); | ||
slotControlSeek(0.); | ||
m_playButton->setEnabled(false); | ||
m_pause.unlock(); | ||
|
||
emit(trackUnloaded(pTrack)); | ||
|
@@ -475,16 +475,6 @@ void EngineBuffer::slotControlSeekAbs(double abs) | |
slotControlSeek(abs / m_file_length_old); | ||
} | ||
|
||
void EngineBuffer::slotControlPlay(double v) | ||
{ | ||
// If no track is currently loaded, turn play off. If a track is loading | ||
// allow the set since it might apply to a track we are loading due to the | ||
// asynchrony. | ||
if (v > 0.0 && !m_pCurrentTrack && m_iTrackLoading == 0) { | ||
m_playButton->set(0.0f); | ||
} | ||
} | ||
|
||
void EngineBuffer::slotControlStart(double v) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yey! :) |
||
{ | ||
if (v > 0.0) { | ||
|
@@ -895,13 +885,6 @@ void EngineBuffer::bindWorkers(EngineWorkerScheduler* pWorkerScheduler) { | |
pWorkerScheduler->bindWorker(m_pReader); | ||
} | ||
|
||
bool EngineBuffer::isTrackLoaded() { | ||
if (m_pCurrentTrack) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
void EngineBuffer::slotEjectTrack(double v) { | ||
if (v > 0) { | ||
ejectTrack(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally control.h/cpp shouldn't depend on controlobject.h/cpp