Volume up/down through remote, menu, and kb shortcuts.
parent
caf6fe2c9d
commit
7499b0615f
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
#import "PlaybackController.h"
|
||||||
|
|
||||||
#import "PlaylistController.h"
|
#import "PlaylistController.h"
|
||||||
#import "PlaylistView.h"
|
#import "PlaylistView.h"
|
||||||
|
|
||||||
|
@ -15,6 +17,7 @@
|
||||||
@interface AppController : NSObject
|
@interface AppController : NSObject
|
||||||
{
|
{
|
||||||
IBOutlet PlaylistController *playlistController;
|
IBOutlet PlaylistController *playlistController;
|
||||||
|
IBOutlet PlaybackController *playbackController;
|
||||||
|
|
||||||
IBOutlet NSPanel *mainWindow;
|
IBOutlet NSPanel *mainWindow;
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,11 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
|
||||||
break;
|
break;
|
||||||
case kRemoteButtonVolume_Plus_Hold:
|
case kRemoteButtonVolume_Plus_Hold:
|
||||||
//Volume Up
|
//Volume Up
|
||||||
|
[playbackController volumeUp: self];
|
||||||
break;
|
break;
|
||||||
case kRemoteButtonVolume_Minus_Hold:
|
case kRemoteButtonVolume_Minus_Hold:
|
||||||
//Volume Down
|
//Volume Down
|
||||||
|
[playbackController volumeDown: self];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (remoteButtonHeld)
|
if (remoteButtonHeld)
|
||||||
|
@ -75,8 +77,10 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case kRemoteButtonVolume_Plus:
|
case kRemoteButtonVolume_Plus:
|
||||||
|
[playbackController volumeUp: self];
|
||||||
break;
|
break;
|
||||||
case kRemoteButtonVolume_Minus:
|
case kRemoteButtonVolume_Minus:
|
||||||
|
[playbackController volumeDown: self];
|
||||||
break;
|
break;
|
||||||
case kRemoteButtonRight:
|
case kRemoteButtonRight:
|
||||||
[self clickNext];
|
[self clickNext];
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ACTIONS = {
|
ACTIONS = {
|
||||||
addFiles = id;
|
|
||||||
delEntries = id;
|
delEntries = id;
|
||||||
donate = id;
|
donate = id;
|
||||||
loadPlaylist = id;
|
loadPlaylist = id;
|
||||||
|
@ -27,7 +26,6 @@
|
||||||
CLASS = AppController;
|
CLASS = AppController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
addButton = NSButton;
|
|
||||||
fileButton = NSButton;
|
fileButton = NSButton;
|
||||||
fileDrawer = NSDrawer;
|
fileDrawer = NSDrawer;
|
||||||
fileOutlineView = FileOutlineView;
|
fileOutlineView = FileOutlineView;
|
||||||
|
@ -37,10 +35,10 @@
|
||||||
mainWindow = NSPanel;
|
mainWindow = NSPanel;
|
||||||
nextButton = NSButton;
|
nextButton = NSButton;
|
||||||
playButton = NSButton;
|
playButton = NSButton;
|
||||||
|
playbackController = PlaybackController;
|
||||||
playlistController = PlaylistController;
|
playlistController = PlaylistController;
|
||||||
playlistView = PlaylistView;
|
playlistView = PlaylistView;
|
||||||
prevButton = NSButton;
|
prevButton = NSButton;
|
||||||
remButton = NSButton;
|
|
||||||
repeatButton = NSButton;
|
repeatButton = NSButton;
|
||||||
showAlbumColumn = NSMenuItem;
|
showAlbumColumn = NSMenuItem;
|
||||||
showArtistColumn = NSMenuItem;
|
showArtistColumn = NSMenuItem;
|
||||||
|
@ -105,6 +103,8 @@
|
||||||
seek = id;
|
seek = id;
|
||||||
stop = id;
|
stop = id;
|
||||||
toggleShowTimeRemaining = id;
|
toggleShowTimeRemaining = id;
|
||||||
|
volumeDown = id;
|
||||||
|
volumeUp = id;
|
||||||
};
|
};
|
||||||
CLASS = PlaybackController;
|
CLASS = PlaybackController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>56 66 639 388 0 0 1024 746 </string>
|
<string>104 34 639 388 0 0 1680 1028 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1063</key>
|
<key>1063</key>
|
||||||
<string>0 228 136 49 0 0 1024 746 </string>
|
<string>0 228 136 49 0 0 1024 746 </string>
|
||||||
<key>1156</key>
|
<key>1156</key>
|
||||||
<string>391 336 241 366 0 0 1024 746 </string>
|
<string>719 527 241 366 0 0 1680 1028 </string>
|
||||||
<key>29</key>
|
<key>29</key>
|
||||||
<string>-3 695 383 44 0 0 1024 746 </string>
|
<string>-3 974 383 44 0 0 1680 1028 </string>
|
||||||
<key>463</key>
|
<key>463</key>
|
||||||
<string>341 447 341 145 0 0 1024 746 </string>
|
<string>669 637 341 145 0 0 1680 1028 </string>
|
||||||
<key>513</key>
|
<key>513</key>
|
||||||
<string>639 190 125 137 0 0 1024 746 </string>
|
<string>1105 278 125 137 0 0 1680 1028 </string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBFramework Version</key>
|
<key>IBFramework Version</key>
|
||||||
<string>446.1</string>
|
<string>446.1</string>
|
||||||
|
@ -33,12 +33,12 @@
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>513</integer>
|
<integer>513</integer>
|
||||||
<integer>21</integer>
|
|
||||||
<integer>29</integer>
|
<integer>29</integer>
|
||||||
|
<integer>21</integer>
|
||||||
<integer>1156</integer>
|
<integer>1156</integer>
|
||||||
<integer>463</integer>
|
<integer>463</integer>
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>8L127</string>
|
<string>8L2127</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
Binary file not shown.
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
int playbackStatus;
|
int playbackStatus;
|
||||||
|
|
||||||
float currentVolume;
|
double currentVolume;
|
||||||
|
|
||||||
BOOL showTimeRemaining;
|
BOOL showTimeRemaining;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,9 @@
|
||||||
- (IBAction)toggleShowTimeRemaining:(id)sender;
|
- (IBAction)toggleShowTimeRemaining:(id)sender;
|
||||||
- (IBAction)changeVolume:(id)sender;
|
- (IBAction)changeVolume:(id)sender;
|
||||||
|
|
||||||
|
- (IBAction)volumeDown:(id)sender;
|
||||||
|
- (IBAction)volumeUp:(id)sender;
|
||||||
|
|
||||||
- (IBAction)playPauseResume:(id)sender;
|
- (IBAction)playPauseResume:(id)sender;
|
||||||
- (IBAction)pauseResume:(id)sender;
|
- (IBAction)pauseResume:(id)sender;
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@
|
||||||
|
|
||||||
- (IBAction)changeVolume:(id)sender
|
- (IBAction)changeVolume:(id)sender
|
||||||
{
|
{
|
||||||
float percent;
|
double percent;
|
||||||
|
|
||||||
//Approximated log
|
//Approximated log
|
||||||
percent = (float)[sender doubleValue]/[sender maxValue];
|
percent = (float)[sender doubleValue]/[sender maxValue];
|
||||||
|
@ -176,6 +176,34 @@
|
||||||
[soundController setVolume:currentVolume];
|
[soundController setVolume:currentVolume];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction)volumeDown:(id)sender
|
||||||
|
{
|
||||||
|
double percent;
|
||||||
|
|
||||||
|
[volumeSlider setDoubleValue:([volumeSlider doubleValue] - 5)];
|
||||||
|
|
||||||
|
percent = (float)[volumeSlider doubleValue]/[volumeSlider maxValue];
|
||||||
|
percent = percent * percent * percent * percent;
|
||||||
|
|
||||||
|
currentVolume = percent * [volumeSlider maxValue];
|
||||||
|
|
||||||
|
[soundController setVolume:currentVolume];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)volumeUp:(id)sender
|
||||||
|
{
|
||||||
|
double percent;
|
||||||
|
|
||||||
|
[volumeSlider setDoubleValue:([volumeSlider doubleValue] + 5)];
|
||||||
|
|
||||||
|
percent = (float)[volumeSlider doubleValue]/[volumeSlider maxValue];
|
||||||
|
percent = percent * percent * percent * percent;
|
||||||
|
|
||||||
|
currentVolume = percent * [volumeSlider maxValue];
|
||||||
|
|
||||||
|
[soundController setVolume:currentVolume];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)updateTimeField:(double)pos
|
- (void)updateTimeField:(double)pos
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue