-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathPacketPlayMusicNow.m
47 lines (36 loc) · 948 Bytes
/
PacketPlayMusicNow.m
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
//
// PacketPlayMusicNow.m
// Snap
//
// Created by Abdullah Bakhach on 10/4/12.
// Copyright (c) 2012 Hollance. All rights reserved.
//
#import "PacketPlayMusicNow.h"
#import "NSData+SnapAdditions.h"
@implementation PacketPlayMusicNow
@synthesize delayTime = _delayTime;
+ (id)packetWithData:(NSData *)data
{
double delayTime;
size_t offset = PACKET_HEADER_SIZE;
delayTime = [[NSData dataWithBytes:(void *)([data bytes] + offset) length:sizeof(double)] rw_double64];
return [[self class] packetWithDelayTime:delayTime];
}
+ (id)packetWithDelayTime:(double) delayTime
{
return [[[self class] alloc] initWithDelayTime:delayTime
];
}
- (id)initWithDelayTime:(double)delayTime
{
if ((self = [super initWithType:PacketTypePlayMusicNow]))
{
self.delayTime = delayTime;
}
return self;
}
- (void)addPayloadToData:(NSMutableData *)data
{
[data rw_appendDouble64:self.delayTime];
}
@end