test publish

Dependencies:   mbed GroveEarbudSensor

Scale.cpp

Committer:
age2pierre
Date:
2016-03-26
Revision:
6:7cc8a333e03b
Parent:
5:ee265ab0752d

File content as of revision 6:7cc8a333e03b:

#include "Scale.h"

Scale::Scale(Notes argTonality)
{
    this->tonality = argTonality;
}

Notes Scale::applyOctaveUp(Notes myNote)
{
    return this->modify(12, myNote);
}

Notes Scale::applyOctaveDown(Notes myNote)
{
        return this->modify(-12, myNote);
}

Notes Scale::applySharp(Notes myNote)
{
        return this->modify(1, myNote);
}

Notes Scale::applyFlat(Notes myNote)
{
            return this->modify(-1, myNote);
}

Notes Scale::modify(int arg, Notes arg1)
{
    int rslt = (int) arg1 + arg;
    if((arg > (int) SI_6) || (arg < (int) DO_4))
        return arg1;
    else
        return (Notes) rslt;
}