Ejemplo n.º 1
0
void MumuAudioFlangerAudioProcessor::setParameter (int index, float newValue)
{
    switch (index) {
            //Rate
        case knob1Param: m_knob1 = newValue;
            m_fLFORate = mapFunc(m_knob1,0,1,0.01,4);
            SineLFOL.setFrequency(m_fLFORate);
            SineLFOR.setFrequency(m_fLFORate);
            TriLFOL.setFrequency(m_fLFORate);
            TriLFOR.setFrequency(m_fLFORate);break;
            //Mod Depth
        case knob2Param: m_knob2 = newValue;
            m_fModDepth = mapFunc(m_knob2, 0, 1, 0.001, 0.015);
            break;
            //Mix Knob
        case knob3Param: m_knob3 = newValue;
            m_fWetLevel = m_knob3;
            FourPDelayL.setWetMix(m_fWetLevel);
            FourPDelayR.setWetMix(m_fWetLevel); break;
        case knob4Param: m_knob4 = newValue;
            m_fFeedback = mapFunc(m_knob4, 0, 1, -.98, 0.98);;
            FourPDelayL.setFeedback(m_fFeedback);
            FourPDelayR.setFeedback(m_fFeedback); break;
            //Button
        case button1Param: button1 = newValue; break;
        case button2Param: button2 = newValue; break;
            
        case windowComponentParam: m_windowParam = newValue; break;
        default: break;
    }
}
Ejemplo n.º 2
0
//==============================================================================
void MumuAudioFlangerAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{
    
    m_sampleRate = sampleRate;
    
    m_fLFORate = mapFunc(m_knob1,0,1,0.01,4);
    m_fModDepth = mapFunc(m_knob2, 0, 1, 0.001, 0.015);
    m_fWetLevel = m_knob3;
    m_fFeedback = mapFunc(m_knob4,0,1,-.985,.985);
    
    FourPDelayL.setMaxDelay(m_sampleRate, 0.5);
    FourPDelayL.setDelayTime(m_sampleRate, m_fDelayTime);
    FourPDelayL.setWetMix(m_fWetLevel);
    FourPDelayL.setFeedback(m_fFeedback);
    FourPDelayL.prepareToPlay();
    FourPDelayL.setPlayheads();
    
    FourPDelayR.setMaxDelay(m_sampleRate, 0.5);
    FourPDelayR.setDelayTime(m_sampleRate, m_fDelayTime);
    FourPDelayR.setWetMix(m_fWetLevel);
    FourPDelayR.setFeedback(m_fFeedback);
    FourPDelayR.prepareToPlay();
    FourPDelayR.setPlayheads();
    
    SineLFOL.setPhase(0);
    SineLFOL.setFrequency(m_fLFORate);
    SineLFOL.setSampleRate(m_sampleRate);
    
    SineLFOR.setPhase(0);
    SineLFOR.setFrequency(m_fLFORate);
    SineLFOR.setSampleRate(m_sampleRate);
    
    TriLFOL.setPhase(0);
    TriLFOL.setFrequency(m_fLFORate);
    TriLFOL.setSampleRate(m_sampleRate);
    
    TriLFOR.setPhase(0);
    TriLFOR.setFrequency(m_fLFORate);
    TriLFOR.setSampleRate(m_sampleRate);
    
    m_LPF_Left.flushDelays();
    m_LPF_Right.flushDelays();
    calculateLPFCoeffs(600, m_sampleRate);
    
    m_HPF_Left.flushDelays();
    m_HPF_Right.flushDelays();
    calculateHPFCoeffs(600, m_sampleRate);
    
    
}
Ejemplo n.º 3
0
// Same as the map function above, but also updates the values of the
// input array.
void RoomyList_mapAndModify(RoomyList *rl,
                     void (*mapFunc)(void* oldVal, void* newValOut)) {
    // if list is locally empty, return without mapping
    if(rl->lSize == 0) return;

    char listFile[RGLO_STR_SIZE];
    RoomyList_getListFileName(rl, RGLO_MY_RANK, listFile);
    uint64 bytesLeft = numBytesInFile(listFile);
    uint64 chunkSize = RGLO_BUFFER_SIZE;
    chunkSize = chunkSize - (chunkSize % rl->bytesPer);
    uint64 arraySize = chunkSize / rl->bytesPer;
    Array chunk = Array_make(rl->bytesPer, arraySize);
    FILE* f = fopen(listFile, "a+");
    uint64 filePos = 0;
    void* newVal = malloc(rl->bytesPer);
    while(bytesLeft) {
        // load chunk
        uint64 curChunkSize = chunkSize;
        if(curChunkSize > bytesLeft) curChunkSize = bytesLeft;
        uint64 curArraySize = curChunkSize / rl->bytesPer;
        fseek(f, filePos, SEEK_SET);
        Array_fileDescLoad(&chunk, f, curArraySize);

        // apply map function, with modifications
        int i;
        for(i=0; i<curArraySize; i++) {
            mapFunc(Array_get(&chunk, i), newVal);
            
            // keep track of predicate changes
            int p;
            for(p=0; p<rl->numPredicates; p++) {
                rl->predicateVals[p] += rl->predFuncs[p](newVal) -
                                        rl->predFuncs[p](Array_get(&chunk, i));
            }

            Array_set(&chunk, i, newVal);
        }

        // save chunk
        fseek(f, filePos, SEEK_SET);
        Array_fileDescSave(&chunk, f, curArraySize);
        
        filePos += curChunkSize;
        bytesLeft -= curChunkSize;
    }
    
    // clean up
    Array_destroy(&chunk);
    free(newVal);
    fclose(f);
}
Ejemplo n.º 4
0
// Given a function f to map, and a RoomyList rl: for
// each index i, execute the function f(i, rl[i]).
// In general, the map function will usually perform updates to some other
// Roomy data structures.
void RoomyList_map(RoomyList* rl, void (*mapFunc)(void* val)) {
    #ifdef DEBUG
    Roomy_logAny("Mapping over RL %s\n", rl->name);
    #endif
    
    // if list is locally empty, return without mapping
    if(rl->lSize == 0) return;

    RGLO_IN_PARALLEL = 1;

    char listFile[RGLO_STR_SIZE];
    RoomyList_getListFileName(rl, RGLO_MY_RANK, listFile);
    ReadBuffer buf = ReadBuffer_make(RGLO_BUFFER_SIZE, rl->bytesPer, listFile, 1);
    while(ReadBuffer_hasMore(&buf)) {
        // perform map
        mapFunc(ReadBuffer_current(&buf));
        ReadBuffer_next(&buf);
    }

    // clean up
    ReadBuffer_destroy(&buf);
    
    RGLO_IN_PARALLEL = 0;  
}