Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 160 lines (135 sloc) 3.111 kb
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
/*

LiCK Library for ChucK.
Copyright (c) 2007-2014 held jointly by the individual authors.

This file is part of LiCK.

LiCK is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

LiCK is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with LiCK. If not, see <http://www.gnu.org/licenses/>.

*/

class Clap extends Sample
{
    {
        "samples/EmuDrumulator/Clap.wav" => buf.read;
    }
}

class Clave extends Sample
{
    {
        "samples/EmuDrumulator/Clave.wav" => buf.read;
    }
}

class ClosedHat extends Sample
{
    {
        "samples/EmuDrumulator/ClosedHat.wav" => buf.read;
    }
}

class CowBell extends Sample
{
    {
        "samples/EmuDrumulator/CowBell.wav" => buf.read;
    }
}

class Crash extends Sample
{
    {
        "samples/EmuDrumulator/Crash.wav" => buf.read;
    }
}

class HighTom extends Sample
{
    {
        "samples/EmuDrumulator/HighTom.wav" => buf.read;
    }
}

class Kick extends Sample
{
    {
        "samples/EmuDrumulator/Kick.wav" => buf.read;
    }
}

class LowTom extends Sample
{
    {
        "samples/EmuDrumulator/LowTom.wav" => buf.read;
    }
}

class MiddleTom extends Sample
{
    {
        "samples/EmuDrumulator/MiddleTom.wav" => buf.read;
    }
}

class OpenHat extends Sample
{
    {
        "samples/EmuDrumulator/OpenHat.wav" => buf.read;
    }
}

class Rim extends Sample
{
    {
        "samples/EmuDrumulator/Rim.wav" => buf.read;
    }
}

class Snare extends Sample
{
    {
        "samples/EmuDrumulator/Snare.wav" => buf.read;
    }
}

class PlaySample extends UnaryProcedure
{
    int velocity;

    fun void run(Object value)
    {
        value $ Sample @=> Sample sample;
        sample.asIntProcedure().run(velocity);
        500::ms => now;
    }
}

public class EmuDrumulator
{
    Clap clap;
    Clave clave;
    ClosedHat closedHat;
    CowBell cowBell;
    Crash crash;
    HighTom highTom;
    Kick kick;
    LowTom lowTom;
    MiddleTom middleTom;
    OpenHat openHat;
    Rim rim;
    Snare snare;

    fun void demo()
    {
        ArrayList samples;
        samples.add(clap);
        samples.add(clave);
        samples.add(closedHat);
        samples.add(cowBell);
        samples.add(crash);
        samples.add(highTom);
        samples.add(kick);
        samples.add(lowTom);
        samples.add(middleTom);
        samples.add(openHat);
        samples.add(rim);
        samples.add(snare);

        PlaySample playSample;
        32 => playSample.velocity;
        samples.forEach(playSample);

        64 => playSample.velocity;
        samples.forEach(playSample);

        127 => playSample.velocity;
        samples.forEach(playSample);
    }
}
Something went wrong with that request. Please try again.