'''
Created on 15 juil. 2009

@author: Samuel Benveniste
'''

class Instrument:
    '''
    Object representing an instrument.
    
        notes:
            The MIDI numbers of the notes played by this instrument (usually a scale)
        channel:
            The channel corresponding to the instrument in the synthesizer
        image:
            The image for the instrument
    '''

    def __init__(self, notes, channel, image, octave = 0):
        '''
        Constructor
            
        notes:
            The MIDI numbers of the notes played by this instrument (usually a scale)
        channel:
            The channel corresponding to the instrument in the synthesizer
        image:
            The image for the instrument
        '''
        
        self.notes = [loop+12*octave for loop in notes]
        self.octave = octave
        self.channel = channel
        self.image = image
        
    def getNote(self,noteNumber):
        if noteNumber == None :
            return(None)
        else :
            return(self.notes[noteNumber])
        
    def getNoteByNoteNumber(self,baseMidiNoteNumber):
        if baseMidiNoteNumber == None:
            return(None)
        else :
            return(baseMidiNoteNumber+self.octave*12)