2012年3月10日土曜日
gimp でボタンを作ってみた。
gimp でボンタをつくてみた。
以下を参考に。
http://mygimptutorial.com/round-web-20-button-with-a-metal-ring gimpむずいけど、チュートリアルがいっぱいあるので、
なにげにいろいろできて楽しくなってきた。
これ習得して、アプリの素材ばんばん自作できるようになろう、かな。
2012年2月25日土曜日
audiosessionで録音と再生(スピーカー)を使うメモ
AppDelegate.hで
#import
#import
@interface AppDelegate : UIResponder < UIApplicationDelegate ,AVAudioRecorderDelegate // 録音用 ,AVAudioPlayerDelegate // 再生用 >
AppDelegate.mで
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//オーディオセッション設定
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *error = nil;
// 使用している機種が録音に対応しているか
if ([audioSession inputIsAvailable]) {
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
}
if(error){
NSLog(@"audioSession: %@ %d %@", [error domain], [error code], [[error userInfo] description]);
//return;
}
// 録音機能をアクティブにする
[audioSession setActive:YES error:&error];
if(error){
NSLog(@"audioSession: %@ %d %@", [error domain], [error code], [[error userInfo] description]);
//return;
}
UInt32 doChangeDefaultRoute = 1;
AudioSessionSetProperty (
kAudioSessionProperty_OverrideCategoryDefaultToSpeaker,
sizeof (doChangeDefaultRoute),
&doChangeDefaultRoute
);
......
}
ViewController.hで
#import
@interface ViewController : UIViewController
< AVAudioRecorderDelegate // 録音用 ,AVAudioPlayerDelegate // 再生用 >
ViewController.mで
// 録音
-(void)audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag{
NSLog(@"録音成功");
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"録音完了" message:@"録音完了しました。" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK" , nil];
[alert show];
[recorder release];
}
-(void)recordKey{
NSLog(@"録音");
NSString *docFolder = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *soundFilePath = [NSString stringWithFormat:@"%@/sound.caf",docFolder];
NSLog(@"%@",soundFilePath);
NSURL *soundURL = [NSURL fileURLWithPath:soundFilePath];
NSLog(@"%@",soundURL);
NSError *error = nil;
AVAudioRecorder *recorder = [[AVAudioRecorder alloc] initWithURL:soundURL settings:nil error:&error];
if(error != nil){
NSLog(@"AVAudioRecorderのイニシャライズでエラー(%@)",[error localizedDescription]);
return;
}
[recorder setDelegate:self];
[recorder recordForDuration:3.0f];
}
-(IBAction)tapRecord:(id)sender{
[self recordKey];
}
// 再生
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag {
NSLog(@"再生成功");
[player release];
}
- (void)playKey{
NSLog(@"再生開始");
NSString *docFolder = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *soundFilePath = [NSString stringWithFormat:@"%@/sound.caf", docFolder];
NSURL *soundURL = [NSURL fileURLWithPath:soundFilePath];
if ( [[NSFileManager defaultManager] fileExistsAtPath:soundFilePath] == NO ) {
NSLog(@"ファイルがないため再生できません");
return;
}
NSError *error = nil;
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:&error];
if (error != nil) {
NSLog(@"AVAudioPlayerのイニシャライズでエラー(%@)",[error localizedDescription]);
[player release];
error=nil;
return;
}
[player setDelegate:self];
player.volume=1.0f;
[player play];
}
-(IBAction)tapPlay:(id)sender{
[self playKey];
}
#import
#import
@interface AppDelegate : UIResponder < UIApplicationDelegate ,AVAudioRecorderDelegate // 録音用 ,AVAudioPlayerDelegate // 再生用 >
AppDelegate.mで
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//オーディオセッション設定
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *error = nil;
// 使用している機種が録音に対応しているか
if ([audioSession inputIsAvailable]) {
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
}
if(error){
NSLog(@"audioSession: %@ %d %@", [error domain], [error code], [[error userInfo] description]);
//return;
}
// 録音機能をアクティブにする
[audioSession setActive:YES error:&error];
if(error){
NSLog(@"audioSession: %@ %d %@", [error domain], [error code], [[error userInfo] description]);
//return;
}
UInt32 doChangeDefaultRoute = 1;
AudioSessionSetProperty (
kAudioSessionProperty_OverrideCategoryDefaultToSpeaker,
sizeof (doChangeDefaultRoute),
&doChangeDefaultRoute
);
......
}
ViewController.hで
#import
@interface ViewController : UIViewController
< AVAudioRecorderDelegate // 録音用 ,AVAudioPlayerDelegate // 再生用 >
ViewController.mで
// 録音
-(void)audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag{
NSLog(@"録音成功");
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"録音完了" message:@"録音完了しました。" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK" , nil];
[alert show];
[recorder release];
}
-(void)recordKey{
NSLog(@"録音");
NSString *docFolder = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *soundFilePath = [NSString stringWithFormat:@"%@/sound.caf",docFolder];
NSLog(@"%@",soundFilePath);
NSURL *soundURL = [NSURL fileURLWithPath:soundFilePath];
NSLog(@"%@",soundURL);
NSError *error = nil;
AVAudioRecorder *recorder = [[AVAudioRecorder alloc] initWithURL:soundURL settings:nil error:&error];
if(error != nil){
NSLog(@"AVAudioRecorderのイニシャライズでエラー(%@)",[error localizedDescription]);
return;
}
[recorder setDelegate:self];
[recorder recordForDuration:3.0f];
}
-(IBAction)tapRecord:(id)sender{
[self recordKey];
}
// 再生
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag {
NSLog(@"再生成功");
[player release];
}
- (void)playKey{
NSLog(@"再生開始");
NSString *docFolder = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *soundFilePath = [NSString stringWithFormat:@"%@/sound.caf", docFolder];
NSURL *soundURL = [NSURL fileURLWithPath:soundFilePath];
if ( [[NSFileManager defaultManager] fileExistsAtPath:soundFilePath] == NO ) {
NSLog(@"ファイルがないため再生できません");
return;
}
NSError *error = nil;
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:&error];
if (error != nil) {
NSLog(@"AVAudioPlayerのイニシャライズでエラー(%@)",[error localizedDescription]);
[player release];
error=nil;
return;
}
[player setDelegate:self];
player.volume=1.0f;
[player play];
}
-(IBAction)tapPlay:(id)sender{
[self playKey];
}
2012年2月23日木曜日
vncサーバーによるgnome接続方法
vi /etc/sysconfig/vncservers でディスプレイ番号など初期設定
/etc/init.d/vncserver start でvncサーバー起動
リモート端末からvncクライアントソフト起動
id,pwを入力して接続
/etc/init.d/vncserver start でvncサーバー起動
リモート端末からvncクライアントソフト起動
id,pwを入力して接続
pptp-client 接続方法
su - でroot権限に。
/etc/init.d/pptp-client status で状態確認
/etc/init.d/pptp-client start で接続
/etc/init.d/pptp-client status で状態確認
/etc/init.d/pptp-client start で接続
2012年2月16日木曜日
javascript regexp 正規表現
matchによる正規表現 。。。
var s = "Is this all there is ?";
var pat = /..../;
document.write(s.match(pat));
/.../
/i 大文字小文字とわない
/g マッチするものはすべて
/[abc]/ abcどれか
/[^abc]/ abc以外のどれか
/[a-h]/ aからhのどれか
/[a-z]/ aからzのどれか
/[A-z]/ AからZ、aからzのどれか
/¥w/ 文字
/¥W/ 文字以外
/¥d/ 数字
/¥D/ 数字以外
/¥s/ 空白
/¥S/ 空白以外
/¥b/ 文頭
/¥B/ 文頭以外
/n+/g 少なくとも1個以上のn
/n*/g 0個以上のn
/n?/g 0か1個のn
/n{X}/g X個のn
/n{X,Y}/g XからY個のn
/n{X,}/g 少なくともX個以上のn
/n$/g nで終わる
/^n/g nで始まる
/n(?= m)/ mにつづくn
/n(?! m/ mにつづかないn
var s = "Is this all there is ?";
var pat = /..../;
document.write(s.match(pat));
/.../
/i 大文字小文字とわない
/g マッチするものはすべて
/[abc]/ abcどれか
/[^abc]/ abc以外のどれか
/[a-h]/ aからhのどれか
/[a-z]/ aからzのどれか
/[A-z]/ AからZ、aからzのどれか
/¥w/ 文字
/¥W/ 文字以外
/¥d/ 数字
/¥D/ 数字以外
/¥s/ 空白
/¥S/ 空白以外
/¥b/ 文頭
/¥B/ 文頭以外
/n+/g 少なくとも1個以上のn
/n*/g 0個以上のn
/n?/g 0か1個のn
/n{X}/g X個のn
/n{X,Y}/g XからY個のn
/n{X,}/g 少なくともX個以上のn
/n$/g nで終わる
/^n/g nで始まる
/n(?= m)/ mにつづくn
/n(?! m/ mにつづかないn
2011年8月17日水曜日
2011年4月15日金曜日
きょうしたこと
・弟にギフト(時計)。
・新書購入。
キュレーションの時代 「つながり」の情報革命が始まる (ちくま新書)
行動経済学―感情に揺れる経済心理 (中公新書)
マグネシウム文明論 (PHP新書)
脳の科学史 フロイトから脳地図、MRIへ 角川SSC新書 (角川SSC新書)
選定は適当に興味ありそうなもの。週末で4冊読破を目標に。
・HTML5のCANVASについてちら身調査。js.doitとかで。
今後すること。
・仕事ではユーザ分析を掘り下げてターゲットをし直す。
・読書、読書、読書、多ジャンルで。
・jQuery,jQueryMobileを使いこなしてwebアプリを一つ作る。
・HTML5を使いこなす。
・TitaniumMobileを使いこなす。
優先順位がつけれないなあ。なかなか進まないね。
・弟にギフト(時計)。
・新書購入。
キュレーションの時代 「つながり」の情報革命が始まる (ちくま新書)
行動経済学―感情に揺れる経済心理 (中公新書)
マグネシウム文明論 (PHP新書)
脳の科学史 フロイトから脳地図、MRIへ 角川SSC新書 (角川SSC新書)
選定は適当に興味ありそうなもの。週末で4冊読破を目標に。
・HTML5のCANVASについてちら身調査。js.doitとかで。
今後すること。
・仕事ではユーザ分析を掘り下げてターゲットをし直す。
・読書、読書、読書、多ジャンルで。
・jQuery,jQueryMobileを使いこなしてwebアプリを一つ作る。
・HTML5を使いこなす。
・TitaniumMobileを使いこなす。
優先順位がつけれないなあ。なかなか進まないね。
登録:
投稿 (Atom)
