mirror of
https://github.com/yokemura/Magical8bitPlug2.git
synced 2025-07-17 11:04:16 -04:00
Added code
This commit is contained in:
79
Source/Settings.cpp
Normal file
79
Source/Settings.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
Settings.cpp
|
||||
Created: 23 May 2019 11:54:44am
|
||||
Author: 除村 武志
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "Settings.h"
|
||||
#include "FrameSequenceParser.h"
|
||||
|
||||
bool SettingRefs::setSequenceWithString (const String& type, const String& input, ParseError* error)
|
||||
{
|
||||
FrameSequenceParser parser;
|
||||
|
||||
if (type == "volume")
|
||||
{
|
||||
FrameSequence res = parser.parse (input, 0, 15, error);
|
||||
|
||||
if (*error > kParseErrorLevelFatal)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
volumeSequence = res;
|
||||
volumeSequenceString = input;
|
||||
return true;
|
||||
}
|
||||
else if (type == "pitch")
|
||||
{
|
||||
FrameSequence res = parser.parse (input, -64, 63, error);
|
||||
|
||||
if (*error > kParseErrorLevelFatal)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pitchSequence = res;
|
||||
pitchSequenceString = input;
|
||||
return true;
|
||||
}
|
||||
else if (type == "duty")
|
||||
{
|
||||
FrameSequence res = parser.parse (input, 0, 2, error);
|
||||
|
||||
if (*error > kParseErrorLevelFatal)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dutySequence = res;
|
||||
dutySequenceString = input;
|
||||
return true;
|
||||
}
|
||||
|
||||
printf ("*** parameter type invalid!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
String& SettingRefs::getSequenceString (const String& type)
|
||||
{
|
||||
if (type == "volume")
|
||||
{
|
||||
return volumeSequenceString;
|
||||
}
|
||||
else if (type == "pitch")
|
||||
{
|
||||
return pitchSequenceString;
|
||||
}
|
||||
else if (type == "duty")
|
||||
{
|
||||
return dutySequenceString;
|
||||
}
|
||||
|
||||
printf ("*** parameter type invalid!\n");
|
||||
return volumeSequenceString;
|
||||
}
|
Reference in New Issue
Block a user