This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
NSDictionary* parseRIFF(NSString* path) | |
parse RIFF file | |
General output dictionary | |
{ | |
formType = { | |
chunkId = ... ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <AudioToolbox/AudioToolbox.h> | |
/* | |
AudioUnit unit = AudioUnitCreate(kAudioUnitType_Output, kAudioUnitSubType_RemoteIO); | |
// set properties | |
AudioUnitInitialize(unit); | |
AudioOutputUnitStart(unit); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSMutableData* data = [NSMutableData data]; | |
char str[] = "foo"; | |
[data appendBytes:str length:sizeof(str)]; | |
NSLog(@"%s %s", [data bytes], str); // foo foo | |
str[0] = 0; | |
NSLog(@"%s %s", [data bytes], str); // foo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<meta http-equiv="Content-Script-Type" content="text/javascript" charset="utf-8"> | |
<title></title> | |
<style type="text/css"> | |
</style> | |
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// extract RAW PCM | |
NSURL* url = [[NSBundle mainBundle] URLForResource:@"" withExtension:@"mp3"]; | |
AVAsset* asset = [AVAsset assetWithURL:url]; | |
NSError* err = nil; | |
AVAssetReader* reader = [[AVAssetReader alloc] initWithAsset:asset error:&err]; | |
if (!err) { | |
AVAssetReaderAudioMixOutput* output = [[AVAssetReaderAudioMixOutput alloc] | |
initWithAudioTracks:[asset tracksWithMediaType:AVMediaTypeAudio] | |
audioSettings:nil]; | |
[reader addOutput:output]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewWillAppear:(BOOL)animated | |
{ | |
[super viewWillAppear:animated]; | |
// register for keyboard notifications | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(keyboardWillHide) | |
name:UIKeyboardWillHideNotification | |
object:nil]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface SomeViewController () | |
@property (weak) UITextView *logView; | |
@end | |
@implementation SomeViewController | |
- (void)writeOSDLog:(NSString *)log | |
{ | |
if (self.logView == nil) { | |
NSTextStorage *textStorage = [NSTextStorage new]; | |
NSLayoutManager *layoutManager = [NSLayoutManager new]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CNLiningUpView.swift | |
// CNLiningUpView | |
// | |
// Created by Chiharu Nameki on 2015/03/29. | |
// Copyright (c) 2015 Chiharu Nameki. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ScrollPageController.swift | |
// ScrollPageController | |
// | |
// Created by Chiharu Nameki on 2015/06/21. | |
// Copyright (c) 2015 Chiharu Nameki. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CNImageView.swift | |
// ImageView | |
// | |
// Created by Chiharu Nameki on 2015/08/02. | |
// Copyright (c) 2015 Chiharu Nameki. All rights reserved. | |
// | |
import UIKit |
OlderNewer