test publish

Dependencies:   mbed GroveEarbudSensor

Scale.cpp

Committer:
age2pierre
Date:
2016-04-14
Revision:
13:879d678baf64
Parent:
6:7cc8a333e03b

File content as of revision 13:879d678baf64:

#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;
}