|
| 1 | +/* |
| 2 | + File: MainViewController.h |
| 3 | +Abstract: View controller class for AddMusic. Sets up user interface, responds |
| 4 | +to and manages user interaction. |
| 5 | + Version: 1.1 |
| 6 | +
|
| 7 | +Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple |
| 8 | +Inc. ("Apple") in consideration of your agreement to the following |
| 9 | +terms, and your use, installation, modification or redistribution of |
| 10 | +this Apple software constitutes acceptance of these terms. If you do |
| 11 | +not agree with these terms, please do not use, install, modify or |
| 12 | +redistribute this Apple software. |
| 13 | +
|
| 14 | +In consideration of your agreement to abide by the following terms, and |
| 15 | +subject to these terms, Apple grants you a personal, non-exclusive |
| 16 | +license, under Apple's copyrights in this original Apple software (the |
| 17 | +"Apple Software"), to use, reproduce, modify and redistribute the Apple |
| 18 | +Software, with or without modifications, in source and/or binary forms; |
| 19 | +provided that if you redistribute the Apple Software in its entirety and |
| 20 | +without modifications, you must retain this notice and the following |
| 21 | +text and disclaimers in all such redistributions of the Apple Software. |
| 22 | +Neither the name, trademarks, service marks or logos of Apple Inc. may |
| 23 | +be used to endorse or promote products derived from the Apple Software |
| 24 | +without specific prior written permission from Apple. Except as |
| 25 | +expressly stated in this notice, no other rights or licenses, express or |
| 26 | +implied, are granted by Apple herein, including but not limited to any |
| 27 | +patent rights that may be infringed by your derivative works or by other |
| 28 | +works in which the Apple Software may be incorporated. |
| 29 | +
|
| 30 | +The Apple Software is provided by Apple on an "AS IS" basis. APPLE |
| 31 | +MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION |
| 32 | +THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS |
| 33 | +FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND |
| 34 | +OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. |
| 35 | +
|
| 36 | +IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL |
| 37 | +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 38 | +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 39 | +INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, |
| 40 | +MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED |
| 41 | +AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), |
| 42 | +STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE |
| 43 | +POSSIBILITY OF SUCH DAMAGE. |
| 44 | +
|
| 45 | +Copyright (C) 2009 Apple Inc. All Rights Reserved. |
| 46 | +
|
| 47 | +*/ |
| 48 | + |
| 49 | +#define PLAYER_TYPE_PREF_KEY @"player_type_preference" |
| 50 | +#define AUDIO_TYPE_PREF_KEY @"audio_technology_preference" |
| 51 | + |
| 52 | +#import <UIKit/UIKit.h> |
| 53 | +#import <MediaPlayer/MediaPlayer.h> |
| 54 | +#import <AVFoundation/AVFoundation.h> |
| 55 | +#import <AudioToolbox/AudioToolbox.h> |
| 56 | +#import "MusicTableViewController.h" |
| 57 | +#import "AddMusicAppDelegate.h" |
| 58 | + |
| 59 | +@interface MainViewController : UIViewController <MPMediaPickerControllerDelegate, MusicTableViewControllerDelegate, AVAudioPlayerDelegate> { |
| 60 | + |
| 61 | + AddMusicAppDelegate *applicationDelegate; |
| 62 | + IBOutlet UIBarButtonItem *artworkItem; |
| 63 | + IBOutlet UINavigationBar *navigationBar; |
| 64 | + IBOutlet UILabel *nowPlayingLabel; |
| 65 | + BOOL playedMusicOnce; |
| 66 | + |
| 67 | + AVAudioPlayer *appSoundPlayer; |
| 68 | + NSURL *soundFileURL; |
| 69 | + IBOutlet UIButton *appSoundButton; |
| 70 | + IBOutlet UIButton *addOrShowMusicButton; |
| 71 | + BOOL interruptedOnPlayback; |
| 72 | + BOOL playing ; |
| 73 | + |
| 74 | + UIBarButtonItem *playBarButton; |
| 75 | + UIBarButtonItem *pauseBarButton; |
| 76 | + MPMusicPlayerController *musicPlayer; |
| 77 | + MPMediaItemCollection *userMediaItemCollection; |
| 78 | + UIImage *noArtworkImage; |
| 79 | + NSTimer *backgroundColorTimer; |
| 80 | +} |
| 81 | + |
| 82 | +@property (nonatomic, retain) UIBarButtonItem *artworkItem; |
| 83 | +@property (nonatomic, retain) UINavigationBar *navigationBar; |
| 84 | +@property (nonatomic, retain) UILabel *nowPlayingLabel; |
| 85 | +@property (readwrite) BOOL playedMusicOnce; |
| 86 | + |
| 87 | +@property (nonatomic, retain) UIBarButtonItem *playBarButton; |
| 88 | +@property (nonatomic, retain) UIBarButtonItem *pauseBarButton; |
| 89 | +@property (nonatomic, retain) MPMediaItemCollection *userMediaItemCollection; |
| 90 | +@property (nonatomic, retain) MPMusicPlayerController *musicPlayer; |
| 91 | +@property (nonatomic, retain) UIImage *noArtworkImage; |
| 92 | +@property (nonatomic, retain) NSTimer *backgroundColorTimer; |
| 93 | + |
| 94 | +@property (nonatomic, retain) AVAudioPlayer *appSoundPlayer; |
| 95 | +@property (nonatomic, retain) NSURL *soundFileURL; |
| 96 | +@property (nonatomic, retain) IBOutlet UIButton *appSoundButton; |
| 97 | +@property (nonatomic, retain) IBOutlet UIButton *addOrShowMusicButton; |
| 98 | +@property (readwrite) BOOL interruptedOnPlayback; |
| 99 | +@property (readwrite) BOOL playing; |
| 100 | + |
| 101 | +- (IBAction) playOrPauseMusic: (id) sender; |
| 102 | +- (IBAction) AddMusicOrShowMusic: (id) sender; |
| 103 | +- (IBAction) playAppSound: (id) sender; |
| 104 | + |
| 105 | +- (BOOL) useiPodPlayer; |
| 106 | + |
| 107 | +@end |
0 commit comments