•Instrument Editor/Instrument Tests.c

 
#include "BigEasy2.h"
#include "BigEasyDialogs.h"
#include "Instrument Editor.h"
 
static long gScale = 12;
 
void PitchBendDoc(short n, short menuItem, short menuRef)
    {
    long t;
    long i;
    long x;
    TDoc *d;
    ComponentResult result;
 
    d = &gDoc[n - kFirstDocWindow];
 
    x = EasyDialogGetNumber("\pScale",
            "\pNumber of notes in equal tempered octave:",
            &gScale);
 
    if(x && gScale > 0 && gScale < 100)
        {
        GoWatch();
        result = MusicPlayNote(d->ci,1,60,100);
        Delay(15,&t);
        for(i = -gScale; i <= gScale; i++)
            {
            MusicSetController(d->ci,1,kControllerPitchBend,i * (12<<8) / gScale);
            Delay(12,&t);
            }
        result = MusicPlayNote(d->ci,1,60,0);       
        MusicSetController(d->ci,1,kControllerPitchBend,0);
        }
 
 
    GoArrow();
    }
 
void MicrotoneDoc(short n, short menuItem, short menuRef)
    {
    long t;
    long i;
    long x;
    long p;
    TDoc *d;
    ComponentResult result;
 
    d = &gDoc[n - kFirstDocWindow];
 
    x = EasyDialogGetNumber("\pScale",
            "\pNumber of notes in equal tempered octave:",
            &gScale);
 
    if(x && gScale > 0 && gScale < 100)
        {
        GoWatch();
        Delay(15,&t);
        for(i = -gScale; i <= gScale; i++)
            {
            p = (60<<8) + (i * (12<<8) / gScale);
            result = MusicPlayNote(d->ci,1, p,100);
            Delay(12,&t);
            result = MusicPlayNote(d->ci,1, p,0);
            Delay(3,&t);
            }
        }
 
 
    GoArrow();
    }
 
 
void NotesOnDoc(short n, short menuItem, short menuRef)
    {
    ComponentResult result;
    TDoc *d;
 
    d = &gDoc[n - kFirstDocWindow];
    result = MusicPlayNote(d->ci,1,60,100);
    result = MusicPlayNote(d->ci,1,67,70);
    }
 
void NotesOffDoc(short n, short menuItem, short menuRef)
    {
    ComponentResult result;
    TDoc *d;
 
    d = &gDoc[n - kFirstDocWindow];
    result = MusicPlayNote(d->ci,1,60,0);
    result = MusicPlayNote(d->ci,1,67,0);
    }