Skip to content

Commit 3f84474

Browse files
author
Darcy Liu
committed
add AddMusic
1 parent ac2094f commit 3f84474

23 files changed

+2800
-1
lines changed

AddMusic.zip

425 KB
Binary file not shown.

AddMusic/AddMusic-Info.plist

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>${PRODUCT_NAME}</string>
9+
<key>CFBundleExecutable</key>
10+
<string>${EXECUTABLE_NAME}</string>
11+
<key>CFBundleIconFile</key>
12+
<string></string>
13+
<key>CFBundleIdentifier</key>
14+
<string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
15+
<key>CFBundleInfoDictionaryVersion</key>
16+
<string>6.0</string>
17+
<key>CFBundleName</key>
18+
<string>${PRODUCT_NAME}</string>
19+
<key>CFBundlePackageType</key>
20+
<string>APPL</string>
21+
<key>CFBundleSignature</key>
22+
<string>????</string>
23+
<key>CFBundleVersion</key>
24+
<string>1.0</string>
25+
<key>LSRequiresIPhoneOS</key>
26+
<true/>
27+
<key>NSMainNibFile</key>
28+
<string>MainWindow</string>
29+
<key>UIStatusBarStyle</key>
30+
<string>UIStatusBarStyleOpaqueBlack</string>
31+
</dict>
32+
</plist>

AddMusic/AddMusic.xcodeproj/project.pbxproj

Lines changed: 342 additions & 0 deletions
Large diffs are not rendered by default.

AddMusic/AddMusic_Prefix.pch

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//
2+
// Prefix header for all source files of the 'AddMusic' target in the 'AddMusic' project
3+
//
4+
5+
#ifdef __OBJC__
6+
#import <Foundation/Foundation.h>
7+
#import <UIKit/UIKit.h>
8+
#endif
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
File: AddMusicAppDelegate.h
3+
Abstract: Application delegate class for AddMusic.
4+
Version: 1.1
5+
6+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
7+
Inc. ("Apple") in consideration of your agreement to the following
8+
terms, and your use, installation, modification or redistribution of
9+
this Apple software constitutes acceptance of these terms. If you do
10+
not agree with these terms, please do not use, install, modify or
11+
redistribute this Apple software.
12+
13+
In consideration of your agreement to abide by the following terms, and
14+
subject to these terms, Apple grants you a personal, non-exclusive
15+
license, under Apple's copyrights in this original Apple software (the
16+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
17+
Software, with or without modifications, in source and/or binary forms;
18+
provided that if you redistribute the Apple Software in its entirety and
19+
without modifications, you must retain this notice and the following
20+
text and disclaimers in all such redistributions of the Apple Software.
21+
Neither the name, trademarks, service marks or logos of Apple Inc. may
22+
be used to endorse or promote products derived from the Apple Software
23+
without specific prior written permission from Apple. Except as
24+
expressly stated in this notice, no other rights or licenses, express or
25+
implied, are granted by Apple herein, including but not limited to any
26+
patent rights that may be infringed by your derivative works or by other
27+
works in which the Apple Software may be incorporated.
28+
29+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
30+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
31+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
32+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
33+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
34+
35+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
36+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
39+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
40+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
41+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
42+
POSSIBILITY OF SUCH DAMAGE.
43+
44+
Copyright (C) 2009 Apple Inc. All Rights Reserved.
45+
46+
*/
47+
48+
49+
#import <UIKit/UIKit.h>
50+
51+
@class MainViewController;
52+
53+
@interface AddMusicAppDelegate : NSObject <UIApplicationDelegate> {
54+
55+
UIWindow *window;
56+
IBOutlet MainViewController *mainViewController;
57+
}
58+
59+
@property (nonatomic, retain) IBOutlet UIWindow *window;
60+
@property (nonatomic, retain) IBOutlet MainViewController *mainViewController;
61+
62+
@end
63+
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
File: AddMusicAppDelegate.m
3+
Abstract: Application delegate class for AddMusic.
4+
Version: 1.1
5+
6+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
7+
Inc. ("Apple") in consideration of your agreement to the following
8+
terms, and your use, installation, modification or redistribution of
9+
this Apple software constitutes acceptance of these terms. If you do
10+
not agree with these terms, please do not use, install, modify or
11+
redistribute this Apple software.
12+
13+
In consideration of your agreement to abide by the following terms, and
14+
subject to these terms, Apple grants you a personal, non-exclusive
15+
license, under Apple's copyrights in this original Apple software (the
16+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
17+
Software, with or without modifications, in source and/or binary forms;
18+
provided that if you redistribute the Apple Software in its entirety and
19+
without modifications, you must retain this notice and the following
20+
text and disclaimers in all such redistributions of the Apple Software.
21+
Neither the name, trademarks, service marks or logos of Apple Inc. may
22+
be used to endorse or promote products derived from the Apple Software
23+
without specific prior written permission from Apple. Except as
24+
expressly stated in this notice, no other rights or licenses, express or
25+
implied, are granted by Apple herein, including but not limited to any
26+
patent rights that may be infringed by your derivative works or by other
27+
works in which the Apple Software may be incorporated.
28+
29+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
30+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
31+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
32+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
33+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
34+
35+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
36+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
39+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
40+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
41+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
42+
POSSIBILITY OF SUCH DAMAGE.
43+
44+
Copyright (C) 2009 Apple Inc. All Rights Reserved.
45+
46+
*/
47+
48+
49+
#import "AddMusicAppDelegate.h"
50+
#import "MainViewController.h"
51+
52+
@implementation AddMusicAppDelegate
53+
54+
@synthesize window, mainViewController;
55+
56+
57+
- (void) applicationDidFinishLaunching: (UIApplication *) application {
58+
59+
[window addSubview: [mainViewController view]];
60+
[window makeKeyAndVisible];
61+
}
62+
63+
64+
- (void)dealloc {
65+
66+
[window release];
67+
[super dealloc];
68+
}
69+
70+
71+
@end
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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

Comments
 (0)