summaryrefslogtreecommitdiff
path: root/music/pokeredmusicdisasm/Volume.cpp
blob: a0c2d192d59122abea89127b342c2949e6376aad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <sstream>
#include "Volume.h"
using namespace std;

Volume::Volume()
{
	volume = 0;
}

Volume::Volume(unsigned char* byte) // Parse Immidiately
{
	Parse(byte);
}

Volume::Volume(unsigned char volume, bool) // Set value
{
	SetVolume(volume);
}

unsigned char Volume::GetVolume()
{
	return volume;
}

void Volume::SetVolume(unsigned char value)
{
	volume = value;
}

bool Volume::IsValid(unsigned char* byte)
{
	if(byte[0] == 0xF0)
	{
		error = false;
		return true;
	}
	else
	{
		error = true;
		return false;
	}
}

string Volume::GenAsm()
{
	string tmpRet = AbstractData::GenAsm();
	if(tmpRet != "") return tmpRet;

	stringstream tmpAsmOut;
	tmpAsmOut << "mus_volume" << " " << (short)volume;
	return tmpAsmOut.str();
}

bool Volume::Parse(unsigned char* byte)
{
	// If it's not a Note, don't even bother parsing
	if(!AbstractData::Parse(byte)) return false;

	volume = byte[1];
	return true;
}

unsigned int Volume::Arguments()
{
	// 1 1-byte argument = 1
	return 1;
}