mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-07 08:05:23 +13:00
made changes in repo
hg-commit-id: 1145e088ee27
This commit is contained in:
parent
21caa525cc
commit
4d0797bc3a
30 changed files with 1748 additions and 0 deletions
80
music/pokeredmusicdisasm/Tempo.cpp
Normal file
80
music/pokeredmusicdisasm/Tempo.cpp
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
#include <sstream>
|
||||
#include "Tempo.h"
|
||||
using namespace std;
|
||||
|
||||
Tempo::Tempo()
|
||||
{
|
||||
divider = 0;
|
||||
modifier = 0;
|
||||
}
|
||||
|
||||
Tempo::Tempo(unsigned char* byte) // Parse Immidiately
|
||||
{
|
||||
Parse(byte);
|
||||
}
|
||||
|
||||
Tempo::Tempo(unsigned char divider, unsigned char modifier, bool) // Set value
|
||||
{
|
||||
SetDivider(divider);
|
||||
SetModifier(modifier);
|
||||
}
|
||||
|
||||
unsigned char Tempo::GetDivider()
|
||||
{
|
||||
return divider;
|
||||
}
|
||||
|
||||
void Tempo::SetDivider(unsigned char value)
|
||||
{
|
||||
divider = value;
|
||||
}
|
||||
|
||||
unsigned char Tempo::Getmodifier()
|
||||
{
|
||||
return modifier;
|
||||
}
|
||||
|
||||
void Tempo::SetModifier(unsigned char value)
|
||||
{
|
||||
modifier = value;
|
||||
}
|
||||
|
||||
bool Tempo::IsValid(unsigned char* byte)
|
||||
{
|
||||
if(byte[0] == 0xED)
|
||||
{
|
||||
error = false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
string Tempo::GenAsm()
|
||||
{
|
||||
string tmpRet = AbstractData::GenAsm();
|
||||
if(tmpRet != "") return false;
|
||||
|
||||
stringstream tmpAsmOut;
|
||||
tmpAsmOut << "mus_tempo" << " " << (short)divider << ", " << (short)modifier;
|
||||
return tmpAsmOut.str();
|
||||
}
|
||||
|
||||
bool Tempo::Parse(unsigned char* byte)
|
||||
{
|
||||
if(!AbstractData::Parse(byte)) return false;
|
||||
|
||||
divider = byte[1];
|
||||
modifier = byte[2];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int Tempo::Arguments()
|
||||
{
|
||||
// 2 1-byte arguments = 2
|
||||
return 2;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue