summaryrefslogtreecommitdiff
path: root/SmartDeviceLink-iOS/SmartDeviceLink/SDLSamplingRate.m
blob: d0a36d7301a82b7ee8751ad42674173d6d86b783 (plain)
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
//  SDLSamplingRate.m
//


#import "SDLSamplingRate.h"

SDLSamplingRate *SDLSamplingRate_8KHZ = nil;
SDLSamplingRate *SDLSamplingRate_16KHZ = nil;
SDLSamplingRate *SDLSamplingRate_22KHZ = nil;
SDLSamplingRate *SDLSamplingRate_44KHZ = nil;

NSArray *SDLSamplingRate_values = nil;

@implementation SDLSamplingRate

+ (SDLSamplingRate *)valueOf:(NSString *)value {
    for (SDLSamplingRate *item in SDLSamplingRate.values) {
        if ([item.value isEqualToString:value]) {
            return item;
        }
    }
    return nil;
}

+ (NSArray *)values {
    if (SDLSamplingRate_values == nil) {
        SDLSamplingRate_values = @[
            SDLSamplingRate._8KHZ,
            SDLSamplingRate._16KHZ,
            SDLSamplingRate._22KHZ,
            SDLSamplingRate._44KHZ,
        ];
    }
    return SDLSamplingRate_values;
}

+ (SDLSamplingRate *)_8KHZ {
    if (SDLSamplingRate_8KHZ == nil) {
        SDLSamplingRate_8KHZ = [[SDLSamplingRate alloc] initWithValue:@"8KHZ"];
    }
    return SDLSamplingRate_8KHZ;
}

+ (SDLSamplingRate *)_16KHZ {
    if (SDLSamplingRate_16KHZ == nil) {
        SDLSamplingRate_16KHZ = [[SDLSamplingRate alloc] initWithValue:@"16KHZ"];
    }
    return SDLSamplingRate_16KHZ;
}

+ (SDLSamplingRate *)_22KHZ {
    if (SDLSamplingRate_22KHZ == nil) {
        SDLSamplingRate_22KHZ = [[SDLSamplingRate alloc] initWithValue:@"22KHZ"];
    }
    return SDLSamplingRate_22KHZ;
}

+ (SDLSamplingRate *)_44KHZ {
    if (SDLSamplingRate_44KHZ == nil) {
        SDLSamplingRate_44KHZ = [[SDLSamplingRate alloc] initWithValue:@"44KHZ"];
    }
    return SDLSamplingRate_44KHZ;
}

@end