AVAudioPlayer. avtouch Application

Similar documents
iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin Flashlight CodeTour TouchCount CodeTour

AVAudioRecorder & System Sound Services

Navigation bar (Xcode version 4.5.2) 1. Create a new project. From the Xcode menu, select File > New > Project

src3/bettertextfield/bettertextfield/appdelegate.h // AppDelegate.h // BetterTextField

iphone App Basics iphone and ipod touch Development Fall 2009 Lecture 5

Your First iphone OS Application

Your First iphone Application

iphone Application Tutorial

} override func didreceivememorywarning() { 26 super.didreceivememorywarning() 27 } 28 } Pause Stop

Multitasking and Background Execution

lectures/2/src2/nib1/nib1/appdelegate.h // AppDelegate.h // Nib1 // David J. Malan // Harvard University //

MVC and Interface Builder IAP 2010

CS193p Spring 2010 Wednesday, May 26, 2010

Topics in Mobile Computing

Why Model-View-Controller?

CS193P: HelloPoly Walkthrough

ios Core Data Example Application

Document Version Date: 1st March, 2015

Intro to Native ios Development. Dave Koziol Arbormoon Software, Inc.

The MVC Design Pattern

Life Cycle. Chapter Explore the Game Application. Understanding the Views in a Game

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

Your First ios 7 App. Everything you need to know to build and submit your first ios app. Ash Furrow

COPYRIGHTED MATERIAL. part I Developing a Professional UI. Chapter 1: Creating a Personal Library. Chapter 2: Advancing with Tableviews

IOS - TEXT FIELD. Use of Text Field. Important Properties of Text Field. Updating Properties in xib

Building an Application

epicurious Anatomy of an ios app Robert Tolar Haining June 25, 2010 ConvergeSE

Designing iphone Applications

Building GUIs with UIKit. Kevin Cathey

Contents. iphone Training. Industry Trainers. Classroom Training Online Training ON-DEMAND Training. Read what you need

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

ITP 342 Advanced Mobile App Dev. Memory

User Interfaces. Lecture 15. Application Programming on Mac OS. Hamza Bennani September 4, 2018

News- ipad: ios(swift) Application

Mobile Apps 2010 iphone and Android

ITP 342 Mobile App Dev. Fundamentals

My First iphone App. 1. Tutorial Overview

Integrating Game Center into a BuzzTouch 1.5 app

Widget Tour. iphone and ipod touch Development Fall 2009 Lecture 7

ITP 342 Mobile App Dev. Connections

ITP 342 Mobile App Dev. Connections

OVERVIEW. Why learn ios programming? Share first-hand experience. Identify platform differences. Identify similarities with.net

Corrections and version notes

CS 47. Beginning iphone Application Development

Data IAP 2010 iphonedev.csail.mit.edu edward benson / Thursday, January 14, 2010

COMP327 Mobile Computing Session: Lecture Set 1a - Swift Introduction and the Foundation Framework Part 2

Announcements. Today s Topics

Objective-C Primer. iphone Programmer s Association. Lorenzo Swank September 10, 2008

InterfaceBuilder and user interfaces

Cocoa Touch Best Practices

My First iphone App (for Xcode version 6.4)

IPHONE DEVELOPMENT. Getting Started with the iphone SDK

UI Design and Storyboarding

iphone Programming Patrick H. Madden SUNY Binghamton Computer Science Department

Playing & Recording Audio Audio Queue Services Playback - AQPlayer Class

SDK Quick Start Guide

lecture 10 UI/UX and Programmatic Design cs : spring 2018

Social Pinboard: ios(swift) Application

Mobile Application Programming. Memory Management

Collections. Fall, Prof. Massimiliano "Max" Pala

Objectives. Submission. Register for an Apple account. Notes on Saving Projects. Xcode Shortcuts. CprE 388 Lab 1: Introduction to Xcode

Step 1: Open Xcode and select Create a new Xcode Project from the Welcome to Xcode menu.

Assignment I Walkthrough

CS193P - Lecture 16. iphone Application Development. Audio APIs Video Playback Displaying Web Content Settings

ios Mobile Development

Acollada ios Charting Components

Announcement. Final Project Proposal Presentations and Updates

View Controller Lifecycle

CS193E Lecture #3 Categories and Protocols Cocoa Memory Management

Mobile Application Programing: ios. Messaging

What s New in Core Audio

Design Phase. Create a class Person. Determine the superclass. NSObject (in this case)

App. Chapter 19 App. App (ViewController) App. Single View Application Single View Application View. (View Controller)

Developing Applications for ios

Praktikum Entwicklung von Mediensystemen mit ios

View Controllers CPRE 388

Running Code on an ios Device. Appendix. The ios Developer Program

Tip Calculator App Introducing Swift, Text Fields, Sliders, Outlets, Actions, View Controllers, Event Handling, NSDecimalNumber,

Developing Applications for ios

Timers Timer CPRE 388

Objective-C Runtime. Cocoa s Jewel in the Crown. NSConference Nicolas

Advanced Memory Analysis with Instruments. Daniel Delwood Performance Tools Engineer

Objective-C and COCOA Applications

From Hello World to Finished App. raywenderlich.com

Create an App that will drop PushPins onto a map based on addresses that the user inputs.

Stichwortverzeichnis. 379, #define 287, 407 #import 50, 99 #pragma mark 415

View Concepts. iphone Application Programming Lecture 4: User Interface Design. SDK provide many types of Views to show your content

Adobe Primetime TVSDK 1.4 for ios Programmer's Guide

Cisco StadiumVision Mobile API for Apple ios

App SandBox Directory

Review. Objective-C Classes, Methods, Properties, Protocols, Delegation, Memory Management

View Concepts. iphone Application Programming Lecture 4: User Interface Design. SDK provide many types of Views to show your content

CS193P - Lecture 3. iphone Application Development. Custom Classes Object Lifecycle Autorelease Properties

Announcements. Today s Topics

Advanced Object- C Features

CS193E Lecture 7. Document-based Applications NSTableView Key-Value Coding

MVC & Onwards. CS 442: Mobile App Development Michael Saelee

CLOCK4 TUTORIAL VERY SIMPLE HELLO WORLD COCOA APPLICATION

ios DeCal : Lecture 2 Structure of ios Applications: MVC and Auto Layout

A Vertical Slider for iphone

Transcription:

AVAudioPlayer avtouch Application iphone Application Index 1. iphone Application 1) iphone Application 2) iphone Application Main Method 3) iphone Application nib(.xib) 2. avtouch Application 1) avtouch 2) avtouch Classes & Resources 3) avtouchappdelegate 4) avtouchviewcontroller 5) avtouchcontroller 1) nib(.xib) 2) 3) 4) 5) / 6) / 7) 8) 9) 10)

iphone Application 1. iphone Application 2. iphone OS Application 3. 4. main() 5. Primary thread 6. UIApplicationMain() 7. UIApplication 8. info.plist 9. MainWindow.xib 10. xib iphone Application Main Method #import <UIKit/UIKit.h> nil Info.plist xib MainWindow.xib xib File s Owner UIApplication. int main(int argc, char *argv[]) NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retval = UIApplicationMain(argc, argv, nil, nil); // argc, argv C main // nil : // nil : [pool release]; return retval; nil UIApplicationMain() > MainWindow.xib > avtouch App Delegate. iphone UI UI ( iphone main UIApplicationMain )

iphone Application nib(.xib) iphone Application main UIApplicationMain nib(.xib) : File s Owner, First Responder, avtouch App Delegate, Window UIApplicationMain UIApplication File s Owner = UIApplication nib MainWindow.xib UIApplication MainWindow.xib File s Owner. UIApplication. avtouch Application Application avtouch / /

avtouch ClassesClasses & Resources avtouch & Resources AudioViews : avtouchappdelegate : avtouch avtouchviewcontroller : avtouch avtouchcontroller : avtouch main.m : avtouch audio main : avtouch images : avtouch avtouchviewcontroller.xib : avtouch MainWindow.xib : avtouch xib Info.plist : MainWindow.xib AudioToolbox : AVFoundation : AVAudioPlayer avtouchviewcontroller UI UI avtouchviewcontroller UISlider *progressbar; UILabel *filename; UILabel *currenttime; UILabel *duration; CALevelMeter *lvlmeter_in; UILabel UISlider *repeatfrom; UIButton *volumeslider; UILabel UIButton *rewbutton; UIButton UIButton *playbutton; *ffwbutton; *repeatbtn; *repeatto;

avtouch iphone Application 1. File > New Project iphone OS > Application View-based Application.

iphone Application 2. avtouchappdelegate, avtouchviewcontroller (header, implement ). - avtouchappdelegate :, xib,,. - avtouchviewcontroller :. * avtouch2 avtouch. avtouchappdelegate avtouch MainWindow.xib avtouchviewcontroller viewcontroller avtouchappdelegate.h avtouchappdelegate.m #import <UIKit/UIKit.h> @class avtouchviewcontroller; @interface avtouchappdelegate : NSObject <UIApplicationDelegate> IBOutlet UIWindow *window; // viewcontroller IBOutlet avtouchviewcontroller *viewcontroller; @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet avtouchviewcontroller *viewcontroller; @end #import "avtouchappdelegate.h" #import "avtouchviewcontroller.h" @implementation avtouchappdelegate @synthesize window; @synthesize viewcontroller; - (void)applicationdidfinishlaunching:(uiapplication *)application // viewcontroller mainwindow [window addsubview:viewcontroller.view]; [window makekeyandvisible]; - (void)dealloc [viewcontroller release]; [window release]; [super dealloc]; @end

avtouchviewcontroller avtouchappdelegate avtouch avtouchcontroller controller avtouchviewcontroller.h avtouchviewcontroller.m #import <UIKit/UIKit.h> @class avtouchcontroller; @interface avtouchviewcontroller : UIViewController IBOutlet avtouchcontroller *controller; @end #import "avtouchviewcontroller.h" #import "avtouchcontroller.h" @implementation avtouchviewcontroller - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceorientation // Return YES for supported orientations return (interfaceorientation == UIInterfaceOrientationPortrait); - (void)didreceivememorywarning [super didreceivememorywarning]; // Releases the view if it doesn't have a superview // Release anything that's not essential, such as cached data - (void)dealloc [super dealloc]; @end iphone Application * avtouchappdelegate.m applicationdidfinishlaunching - ios 4.0. void BOOL return YES;.. - (void)applicationdidfinishlaunching:(uiapplication *)application // Override point for customization after app launch [window addsubview:viewcontroller.view]; [window makekeyandvisible]; ios 3.0 - (BOOL)application:(UIApplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions // Override point for customization after application launch. // Add the view controller's view to the window and display. [window addsubview:viewcontroller.view]; [window makekeyandvisible]; ios 4.0 return YES;

iphone Application * avtouch,. Frameworks (control + ) Add > Existing Frameworks Add. ( command ) - AudioToolbox.framework : - AVFoundation.framework : - QuartzCore.framework : - OpenGLES.framework : iphone Application xib * Resource avtouchviewcontroller.xib MainWindow.xib. View-based ViewController xib. - MainWindow.xib - avtouchviewcontroller.xib * MainWindow.xib, iphone MVC,,.

iphone MainWindow.xib Application MainWindow.xib. @interface avtouch2appdelegate : NSObject <UIApplicationDelegate> UIWindow *window; avtouch2viewcontroller *viewcontroller; @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet avtouch2viewcontroller *viewcontroller; avtouchappdelegate.h [window addsubview:viewcontroller.view]; avtouchappdelegate.m avtouchappdelegate? avtouchviewcontroller viewcontroller, IBOutlet. IBOutlet Interface Builder Outlet, (.xip ) GUI. MainWindow.xib avtouchviewcontroller. avtouchviewcontroller. iphone avtouchcontroller Application 3. avtouchcontroller, avtouchviewcontroller.h. - File > New File iphone OS Cocoa Touch Class > Objective-C class (Subclass of NSObject) Next, avtouchcontroller Finish.

iphone avtouchcontroller Application 3. avtouchcontroller, avtouchviewcontroller.h. - Class avtouchcontroller. - avtouchviewcontroller.h avtouchcontroller controller IBOutlet. avtouchviewcontroller.xib avcontroller. #import <UIKit/UIKit.h> @class avtouchcontroller; @interface avtouch2viewcontroller : UIViewController IBOutlet avtouchcontroller *controller; @end avtouchviewcontroller.h... #import "avtouchcontroller.h"... avtouchviewcontroller.m avtouchviewcontroller.xib iphone Application 4. controller. avtouchviewcontroller.xib Tools > Inspector Library. Inspector Library. Library. avtouchcontroller. UISlider *progressbar; UILabel *filename; UILabel *currenttime; UILabel *duration; CALevelMeter *lvlmeter_in; UILabel *repeatfrom; UIButton *repeatbtn; UISlider *volumeslider; UILabel *repeatto; UIButton *rewbutton; UIButton *ffwbutton; UIButton *playbutton;

iphone avtouchcontroller.h Application 4.., xib,,. AppDelegate ViewController. import. #import <UIKit/UIKit.h> #import <AudioToolbox/AudioToolbox.h> #import <AVFoundation/AVFoundation.h>. IBOutlet UILabel *filename; IBOutlet UIButton *playbutton; IBOutlet UIButton *ffwbutton; IBOutlet UIButton *rewbutton; IBOutlet UISlider *volumeslider; IBOutlet UISlider *progressbar; IBOutlet UILabel *currenttime; IBOutlet UILabel *duration; IBOutlet UILabel *repeatfrom; IBOutlet UILabel *repeatto; IBOutlet UIButton *repeatbtn; IBOutlet CALevelMeter *lvlmeter_in; AVAudioPlayer *player; UIImage *playbtnbg; UIImage *pausebtnbg; NSTimer *updatetimer; NSTimer *rewtimer; NSTimer *ffwtimer; NSMutableArray *soundfiles; NSTimeInterval repeata,repeatb; kselectstate repeatstate; - (IBAction)playButtonPressed:(UIButton*)sender; // - (IBAction)rewButtonPressed:(UIButton*)sender; // - (IBAction)rewButtonReleased:(UIButton*)sender; // - (IBAction)ffwButtonPressed:(UIButton*)sender; // - (IBAction)ffwButtonReleased:(UIButton*)sender; // - (IBAction)volumeSliderMoved:(UISlider*)sender; // - (IBAction)progressSliderMoved:(UISlider*)sender; // - (IBAction)onRepeat; // avtouchcontroller.h avtouch, AudioToolbox, AVFoundation import #import <UIKit/UIKit.h> #import <AudioToolbox/AudioToolbox.h> #import <AVFoundation/AVFoundation.h> // typedef enum TimeNone=0,TimeFromSelected,TimeToSelected kselectstate; avtouchcontroller.h NSObject @interface avtouchcontroller : NSObject <UIPickerViewDelegate, AVAudioPlayerDelegate> // IB IBOutlet UILabel *filename; IBOutlet UIButton *playbutton;... // UI - (IBAction)playButtonPressed:(UIButton*)sender; - (IBAction)rewButtonPressed:(UIButton*)sender;... @property (nonatomic, retain)uilabel @property (nonatomic, retain)uibutton... @end *filename; *playbutton; value @property @property value setter/getter

xib iphone Application nib(.xib) avtouchcontroller. /, /,,,. avtouch.. - xib - - - 5., View Controller controller,. awakefromnib,.

nib(.xib) awakefromnib : AVAudioPlayer UI,, - (void)awakefromnib // AVAudioPlayer soundfiles = [[NSMutableArray alloc] initwithcapacity:3]; avtouchcontroller.mm playbtnbg = [[UIImage imagenamed:@"play.png"] retain]; pausebtnbg = [[UIImage imagenamed:@"pause.png"] retain]; [playbutton setimage:playbtnbg forstate:uicontrolstatenormal]; // updatetimer = nil; rewtimer = nil; AVAudioPlayer fileurl ffwtimer = nil;... // NSURL *fileurl = [[NSURL alloc] initfileurlwithpath: [[NSBundle mainbundle] pathforresource:@"mu02" oftype:@"mp3"]]; self.player = [[AVAudioPlayer alloc] initwithcontentsofurl:fileurl error:nil]; if (self.player) //, filename.text = [NSString stringwithformat: @"%@ (%d ch.)", [[player.url relativepath] lastpathcomponent], player.numberofchannels, nil]; [self updateviewforplayerinfo:player]; // [self updateviewforplayerstate:player]; // / player.numberofloops = 1; // player.delegate = self; // OSStatus result = AudioSessionInitialize(NULL, NULL, NULL, NULL); //... [fileurl release]; iphone Application 6.. 1, /. :,. currenttime.text = [NSString stringwithformat:@"%d:%02d", (int)p.currenttime / 60, (int)p.currenttime % 60, nil]; progressbar.value = p.currenttime; //progressbar,.. if (p.playing) // [playbutton setimage:((p.playing == YES)? pausebtnbg : playbtnbg) forstate:uicontrolstatenormal]; [lvlmeter_in setplayer:p]; updatetimer = [NSTimer scheduledtimerwithtimeinterval:.01 target:self selector:@selector(updatecurrenttime) userinfo:p repeats:yes]; else // [playbutton setimage:((p.playing == YES)? pausebtnbg : playbtnbg) forstate:uicontrolstatenormal]; [lvlmeter_in setplayer:nil]; updatetimer = nil;

: - avtouchcontroller.mm // -(void)updatecurrenttimeforplayer:(avaudioplayer *)p // ( : ) currenttime.text = [NSString stringwithformat:@"%d:%02d", (int)p.currenttime / 60, (int)p.currenttime % 60, nil]; progressbar.value = p.currenttime; //progressbar // / - (void)updateviewforplayerstate:(avaudioplayer *)p [self updatecurrenttimeforplayer:p]; if (updatetimer) [updatetimer invalidate]; if (p.playing) // [playbutton setimage:((p.playing == YES)? pausebtnbg : playbtnbg) forstate:uicontrolstatenormal]; [lvlmeter_in setplayer:p]; updatetimer = [NSTimer scheduledtimerwithtimeinterval:.01 target:self selector:@selector(updatecurrenttime) userinfo:p repeats:yes]; else // [playbutton setimage:((p.playing == YES)? pausebtnbg : playbtnbg) forstate:uicontrolstatenormal]; [lvlmeter_in setplayer:nil]; updatetimer = nil; 7., iphone. void RouteChangeListener( void * inclientdata, AudioSessionPropertyIDinID, UInt32 indatasize, const void * indata) avtouchcontroller* This = (avtouchcontroller*)inclientdata; if (inid == kaudiosessionproperty_audioroutechange) CFDictionaryRef routedict = (CFDictionaryRef)inData; NSNumber* reasonvalue = (NSNumber*)CFDictionaryGetValue (routedict, CFSTR(kAudioSession_AudioRouteChangeKey_Reason)); int reason = [reasonvalue intvalue]; if (reason == kaudiosessionroutechangereason_olddeviceunavailable) [This pauseplaybackforplayer:this.player]; avtouchcontroller.mm

8. avtouch :,. //. - (void)audioplayerdidfinishplaying:(avaudioplayer *)p successfully:(bool)flag avtouchcontroller.mm if (flag == NO) NSLog(@"Playback finished unsuccessfully"); [p setcurrenttime:0.]; [self updateviewforplayerstate:p]; p, flag yes, no //. - (void)audioplayerdecodeerrordidoccur:(avaudioplayer *)p error:(nserror *)error NSLog(@"ERROR IN DECODE: %@\n", error); // - (void)audioplayerbegininterruption:(avaudioplayer *)p NSLog(@"Interruption begin. Updating UI for new state"); // the object has already been paused, we just need to update UI [self updateviewforplayerstate:p]; // - (void)audioplayerendinterruption:(avaudioplayer *)p NSLog(@"Interruption ended. Resuming playback"); [self startplaybackforplayer:p]; p, error p p / /

iphone / Application. 9. / IBAction.,. if (player.playing == YES) [self pauseplaybackforplayer: player]; else [self startplaybackforplayer: player];,. -(void)pauseplaybackforplayer:(avaudioplayer*)p -(void)startplaybackforplayer:(avaudioplayer*)p < > < > / / : -, - // - (IBAction)playButtonPressed:(UIButton *)sender if (player.playing == YES) // [self pauseplaybackforplayer: player]; // else [self startplaybackforplayer: player]; // avtouchcontroller.mm // -(void)pauseplaybackforplayer:(avaudioplayer*)p [p pause]; [self updateviewforplayerstate:p]; // -(void)startplaybackforplayer:(avaudioplayer*)p if ([p play]) [self updateviewforplayerstate:p]; else NSLog(@"Could not play %@\n", p.url); / p player

/ (playbuttonpressed ) startplaybackforplayer / pauseplaybackforplayer updateviewforplayerstate updatecurrenttimeforplayer avtouchappdelegate avtouchcontroller applicationdidfinishlaunching: awakefromnib RouteChangeListener viewcontroller : window soundfiles : fileurl :,, dealloc: viewcontroller, window release player : AVAudioPlayer playbuttonpressed: player player startplaybackforplayer: pauseplaybackforplayer: updateviewforplayerinfo: p p avtouchviewcontroller updateviewforplayerstate: Controller : UI updatecurrenttimeforplayer: updatecurrenttime iphone / Application 10. /. / IBAction. rewtimer =[NSTimer scheduledtimerwithtimeinterval:skip_interval target:self selector:@selector(rewind) userinfo:player repeats:yes]; rewtimer = nil; rewtimer =[NSTimer scheduledtimerwithtimeinterval:skip_interval target:self selector:@selector(ffwd) userinfo:player repeats:yes]; rewtimer = nil; /. - (void)rewind - (void)ffwd < / >

/ / : / /, nil avtouchcontroller.mm // - (IBAction)rewButtonPressed:(UIButton *)sender if (rewtimer) [rewtimer invalidate]; rewtimer = [NSTimer scheduledtimerwithtimeinterval:skip_interval target:self selector:@selector(rewind) userinfo:player repeats:yes]; // - (IBAction)rewButtonReleased:(UIButton *)sender if (rewtimer) [rewtimer invalidate]; rewtimer = nil; // - (void)rewind AVAudioPlayer *p = rewtimer.userinfo; p.currenttime-= SKIP_TIME; [self updatecurrenttimeforplayer:p]; // - (IBAction)ffwButtonPressed:(UIButton *)sender if (ffwtimer) [ffwtimer invalidate]; ffwtimer = [NSTimer scheduledtimerwithtimeinterval:skip_interval target:self selector:@selector(ffwd) userinfo:player repeats:yes]; // - (IBAction)ffwButtonReleased:(UIButton *)sender if (ffwtimer) [ffwtimer invalidate]; ffwtimer = nil; // - (void)ffwd AVAudioPlayer *p = ffwtimer.userinfo; p.currenttime+= SKIP_TIME; [self updatecurrenttimeforplayer:p]; / / (rewbuttonpressed/ffwbuttonpressed ) -rewtimer / -ffwtimer -rewind / -ffwd updatecurrenttimeforplayer avtouchappdelegate avtouchcontroller applicationdidfinishlaunching: awakefromnib RouteChangeListener viewcontroller : window soundfiles : fileurl :,, ffwbuttonreleased: ffwbuttonpressed: dealloc: viewcontroller, window release player : AVAudioPlayer rewbuttonpressed: rewtimer rewbuttonreleased: updateviewforplayerinfo: player nil ffwtimer avtouchviewcontroller updateviewforplayerstate: p rewind: player nil Controller : UI updatecurrenttimeforplayer: updatecurrenttime p ffwd:

iphone Application 11. IBAction. volume. player.volume = [sender value]; < > // volumeslider player volume sender - (IBAction)volumeSliderMoved:(UISlider *)sender player.volume = [sender value]; avtouchcontroller.mm (volumeslidermoved ) player avtouchappdelegate avtouchcontroller applicationdidfinishlaunching: awakefromnib RouteChangeListener viewcontroller : window soundfiles : fileurl :,, dealloc: viewcontroller, window release player : AVAudioPlayer volumeslidermoved: avtouchviewcontroller Controller : UI updateviewforplayerinfo: updateviewforplayerstate: updatecurrenttimeforplayer: updatecurrenttime

iphone Application 12. IBAction.. player.currenttime = sender.value; [self updatecurrenttimeforplayer:player]; < > // progressslider player currenttime sender - (IBAction)progressSliderMoved:(UISlider *)sender player.currenttime = sender.value; [self updatecurrenttimeforplayer:player]; (progressslidermoved ) avtouchcontroller.mm player updatecurrenttimeforplayer avtouchappdelegate avtouchcontroller applicationdidfinishlaunching: awakefromnib RouteChangeListener viewcontroller : window soundfiles : fileurl :,, dealloc: viewcontroller, window release player : AVAudioPlayer progressslidermoved: avtouchviewcontroller updateviewforplayerinfo: updateviewforplayerstate: player Controller : UI updatecurrenttimeforplayer: updatecurrenttime

iphone Application 13. (from~to). from, to, reset IBAction. avtouchcontroller.h kselectstate.. typedef enum TimeNone=0, TimeFromSelected, TimeToSelected kselectstate; onrepeat. if (repeatstate == TimeNone) From else if (repeatstate == TimeFromSelected) to else reset if (repeatstate == TimeToSelected && player.currenttime >= repeatb) < > : (from~to) avtouchcontroller.mm - (IBAction)onRepeat if (repeatstate == TimeNone) // A.. From repeata repeata = player.currenttime; [repeatfrom settext:[nsstring stringwithformat:@"from : %.2d:%.2d",((int)repeatA / 60), ((int)repeata%60)]]; [repeatto settext:@"to : "]; [repeatbtn settitle:@"repeat to" forstate:uicontrolstatenormal]; [repeatbtn settitle:@"repeat to" forstate:uicontrolstatehighlighted]; repeatstate = TimeFromSelected; else if (repeatstate == TimeFromSelected) // B. To repeatb = player.currenttime; [repeatto settext:[nsstring stringwithformat:@"to : %.2d:%.2d",((int)repeatB / 60), ((int)repeatb%60)]]; [repeatbtn settitle:@"reset repeat" forstate:uicontrolstatenormal]; [repeatbtn settitle:@"reset repeat" forstate:uicontrolstatehighlighted]; repeatstate = TimeToSelected; else // [repeatto settext:@"to : "]; [repeatfrom settext:@"from : "]; [repeatbtn settitle:@"repeat from" forstate:uicontrolstatenormal]; [repeatbtn settitle:@"repeat from" forstate:uicontrolstatehighlighted]; repeatstate = TimeNone; if (repeatstate == TimeToSelected && player.currenttime >= repeatb) player.currenttime = repeata;

(volumeslidermoved ) player avtouchappdelegate avtouchcontroller applicationdidfinishlaunching: awakefromnib RouteChangeListener viewcontroller : window soundfiles : fileurl :,, dealloc: viewcontroller, window release player : AVAudioPlayer onrepeat: player avtouchviewcontroller Controller : UI updateviewforplayerinfo: updateviewforplayerstate: updatecurrenttimeforplayer: updatecurrenttime 14. : release. - (void)dealloc [super dealloc]; [filename release]; [playbutton release]; [ffwbutton release]; [rewbutton release]; [volumeslider release]; [progressbar release]; [currenttime release]; [duration release]; [lvlmeter_in release]; [updatetimer release]; [player release]; [playbtnbg release]; [pausebtnbg release]; avtouchcontroller.mm

Xib - 15.. control Controller Inspector.