<commit_before>//
//  NVDSP.mm
//  NVDSP
//
//  Created by <NAME> on 13/05/2012.
//  Copyright (c) 2012 <NAME>. All rights reserved.
//  http://bartolsthoorn.nl
//

#import "NVDSP.h"

#define MAX_CHANNEL_COUNT 2

@implementation NVDSP

- (id)init {
    [super init];
    return self;
}

- (id)initWithSamplingRate:(float)sr {
    if ( self = [super init] )
    {
        samplingRate = sr;
        
        for(int i = 0; i < 5; i++) {
            coefficients[i] = 0.0f;
        }
        
        for(int i = 0; i < MAX_CHANNEL_COUNT; i++) {
            gInputKeepBuffer[i] = (float*) calloc(2, sizeof(float));
            gOutputKeepBuffer[i] = (float*) calloc(2, sizeof(float));
        }
        
        zero = 0.0f;
        one = 1.0f;
    }
    return self;
}

- (void) dealloc
{
    [super dealloc];
    
    for(int i = 0; i < MAX_CHANNEL_COUNT; i++) {
        free(gInputKeepBuffer[i]);
        free(gOutputKeepBuffer[i]);
    }
}

#pragma mark - Setters

- (void) setCoefficients {
    // // { b0/a0, b1/a0, b2/a0, a1/a0, a2/a0 }
    coefficients[0] = b0;
    coefficients[1] = b1;
    coefficients[2] = b2;
    coefficients[3] = a1;
    coefficients[4] = a2;
    
    [self stabilityWarning];<commit_msg>Fix weird init method and add support for ARC<commit_after>//
//  NVDSP.mm
//  NVDSP
//
//  Created by <NAME> on 13/05/2012.
//  Copyright (c) 2012 <NAME>. All rights reserved.
//  http://bartolsthoorn.nl
//

#import "NVDSP.h"

#define MAX_CHANNEL_COUNT 2

@implementation NVDSP

- (id)initWithSamplingRate:(float)sr {
    if (self = [self init]) {
        samplingRate = sr;

        for (int i = 0; i < 5; i++) {
            coefficients[i] = 0.0f;
        }

        for (int i = 0; i < MAX_CHANNEL_COUNT; i++) {
            gInputKeepBuffer[i] = (float *)calloc(2, sizeof(float));
            gOutputKeepBuffer[i] = (float *)calloc(2, sizeof(float));
        }

        zero = 0.0f;
        one = 1.0f;
    }
    return self;
}

- (void)dealloc {
    for (int i = 0; i < MAX_CHANNEL_COUNT; i++) {
        free(gInputKeepBuffer[i]);
        free(gOutputKeepBuffer[i]);
    }
#if !__has_feature(objc_arc)
    [super dealloc];
#endif
}

#pragma mark - Setters

- (void) setCoefficients {
    // // { b0/a0, b1/a0, b2/a0, a1/a0, a2/a0 }
    coefficients[0] = b0;
    coefficients[1] = b1;
    coefficients[2] = b2;
    coefficients[3] = a1;
    coefficients[4] = a2;
    
    [self stabilityWarning];
{'fraction_non_alphanumeric': 0.15970211005378568, 'fraction_numerical': 0.037236243276789406, 'mean_word_length': 2.080254777070064, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '27659', 'n_tokens_mistral': 975, 'n_tokens_neox': 937, 'n_words': 201}