mirror of
https://github.com/kyleneideck/BackgroundMusic
synced 2024-11-10 06:34:22 +00:00
parent
1ada18fd16
commit
6d0fde1780
5 changed files with 202 additions and 0 deletions
|
@ -41,6 +41,7 @@
|
|||
1CED616C1C316E1A002CAFCF /* BGMAudioDeviceManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CED616B1C316E1A002CAFCF /* BGMAudioDeviceManager.mm */; };
|
||||
271677BA1C6CBDFA0080B0A2 /* CACFNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 271677B81C6CBDFA0080B0A2 /* CACFNumber.cpp */; };
|
||||
27379B8A1C7C562D0084A24C /* BGMVLC.m in Sources */ = {isa = PBXBuildFile; fileRef = 27379B891C7C562D0084A24C /* BGMVLC.m */; };
|
||||
273F10DF1CC3D0B900C1C6DA /* BGMVox.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F10DE1CC3D0B900C1C6DA /* BGMVox.m */; };
|
||||
2769728C1CAFCEE8007A2F7C /* post_install.sh in Resources */ = {isa = PBXBuildFile; fileRef = 2769728B1CAFCEE8007A2F7C /* post_install.sh */; };
|
||||
2769728E1CAFCEFD007A2F7C /* com.bearisdriving.BGM.XPCHelper.plist.template in Resources */ = {isa = PBXBuildFile; fileRef = 2769728D1CAFCEFD007A2F7C /* com.bearisdriving.BGM.XPCHelper.plist.template */; };
|
||||
2769728F1CAFF22C007A2F7C /* com.bearisdriving.BGM.XPCHelper.plist.template in Resources */ = {isa = PBXBuildFile; fileRef = 2769728D1CAFCEFD007A2F7C /* com.bearisdriving.BGM.XPCHelper.plist.template */; };
|
||||
|
@ -150,6 +151,9 @@
|
|||
27379B881C7C562D0084A24C /* BGMVLC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BGMVLC.h; path = "Music Players/BGMVLC.h"; sourceTree = "<group>"; };
|
||||
27379B891C7C562D0084A24C /* BGMVLC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BGMVLC.m; path = "Music Players/BGMVLC.m"; sourceTree = "<group>"; };
|
||||
27379B8F1C7F57DA0084A24C /* BGMXPCHelper.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = BGMXPCHelper.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
273F10DC1CC3CF9C00C1C6DA /* Vox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Vox.h; path = "Music Players/Vox.h"; sourceTree = "<group>"; };
|
||||
273F10DD1CC3D0B900C1C6DA /* BGMVox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BGMVox.h; path = "Music Players/BGMVox.h"; sourceTree = "<group>"; };
|
||||
273F10DE1CC3D0B900C1C6DA /* BGMVox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BGMVox.m; path = "Music Players/BGMVox.m"; sourceTree = "<group>"; };
|
||||
2769728B1CAFCEE8007A2F7C /* post_install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = post_install.sh; path = BGMXPCHelper/post_install.sh; sourceTree = SOURCE_ROOT; };
|
||||
2769728D1CAFCEFD007A2F7C /* com.bearisdriving.BGM.XPCHelper.plist.template */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = com.bearisdriving.BGM.XPCHelper.plist.template; path = BGMXPCHelper/com.bearisdriving.BGM.XPCHelper.plist.template; sourceTree = SOURCE_ROOT; };
|
||||
276972901CB16008007A2F7C /* safe_install_dir.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = safe_install_dir.sh; path = BGMXPCHelper/safe_install_dir.sh; sourceTree = SOURCE_ROOT; };
|
||||
|
@ -282,6 +286,8 @@
|
|||
1C2336DE1BEAE10C004C1C4E /* BGMSpotify.m */,
|
||||
27379B881C7C562D0084A24C /* BGMVLC.h */,
|
||||
27379B891C7C562D0084A24C /* BGMVLC.m */,
|
||||
273F10DD1CC3D0B900C1C6DA /* BGMVox.h */,
|
||||
273F10DE1CC3D0B900C1C6DA /* BGMVox.m */,
|
||||
27379B841C7C53BE0084A24C /* Supporting Files */,
|
||||
);
|
||||
name = "Music Players";
|
||||
|
@ -384,6 +390,7 @@
|
|||
27379B851C7C54870084A24C /* iTunes.h */,
|
||||
27379B861C7C54870084A24C /* Spotify.h */,
|
||||
27379B871C7C552A0084A24C /* VLC.h */,
|
||||
273F10DC1CC3CF9C00C1C6DA /* Vox.h */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
|
@ -595,6 +602,7 @@
|
|||
files = (
|
||||
1C4699471BD5C0E400F78043 /* BGMiTunes.m in Sources */,
|
||||
1C1962E41BC94E15008A4DF7 /* CARingBuffer.cpp in Sources */,
|
||||
273F10DF1CC3D0B900C1C6DA /* BGMVox.m in Sources */,
|
||||
1CC1DF811BE5068A00FB8FE4 /* CACFArray.cpp in Sources */,
|
||||
1C0BD0A81BF1B029004F4CF5 /* BGMPreferencesMenu.mm in Sources */,
|
||||
1C1962F41BCABFC5008A4DF7 /* CAHALAudioObject.cpp in Sources */,
|
||||
|
|
30
BGMApp/BGMApp/Music Players/BGMVox.h
Normal file
30
BGMApp/BGMApp/Music Players/BGMVox.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
// This file is part of Background Music.
|
||||
//
|
||||
// Background Music is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// Background Music is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Background Music. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//
|
||||
// BGMVox.h
|
||||
// BGMApp
|
||||
//
|
||||
// Copyright © 2016 Kyle Neideck
|
||||
//
|
||||
|
||||
// Superclass/Protocol Import
|
||||
#import "BGMMusicPlayer.h"
|
||||
|
||||
|
||||
@interface BGMVox : BGMMusicPlayer
|
||||
|
||||
@end
|
||||
|
94
BGMApp/BGMApp/Music Players/BGMVox.m
Normal file
94
BGMApp/BGMApp/Music Players/BGMVox.m
Normal file
|
@ -0,0 +1,94 @@
|
|||
// This file is part of Background Music.
|
||||
//
|
||||
// Background Music is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// Background Music is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Background Music. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//
|
||||
// BGMVox.m
|
||||
// BGMApp
|
||||
//
|
||||
// Copyright © 2016 Kyle Neideck
|
||||
//
|
||||
|
||||
// Self Include
|
||||
#import "BGMVox.h"
|
||||
|
||||
// Auto-generated Scripting Bridge header
|
||||
#import "Vox.h"
|
||||
|
||||
// PublicUtility Includes
|
||||
#undef CoreAudio_ThreadStampMessages
|
||||
#define CoreAudio_ThreadStampMessages 0 // Requires C++
|
||||
#include "CADebugMacros.h"
|
||||
|
||||
|
||||
@implementation BGMVox
|
||||
|
||||
BGM_MUSIC_PLAYER_DEFAULT_LOAD_METHOD
|
||||
|
||||
+ (NSString*) name {
|
||||
return @"Vox";
|
||||
}
|
||||
|
||||
- (CFNumberRef) pid {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ (CFStringRef) bundleID {
|
||||
return CFSTR("com.coppertino.Vox");
|
||||
}
|
||||
|
||||
- (VoxApplication* __nullable) vox {
|
||||
return (VoxApplication*) self.sbApplication;
|
||||
}
|
||||
|
||||
- (BOOL) isRunning {
|
||||
return self.vox && [self.vox isRunning];
|
||||
}
|
||||
|
||||
- (BOOL) pause {
|
||||
// isPlaying checks isRunning, so we don't need to check it here and waste an Apple event
|
||||
BOOL wasPlaying = [self isPlaying];
|
||||
|
||||
if (wasPlaying) {
|
||||
DebugMsg("BGMVox::pause: Pausing Vox");
|
||||
[self.vox pause];
|
||||
}
|
||||
|
||||
return wasPlaying;
|
||||
}
|
||||
|
||||
- (BOOL) unpause {
|
||||
// isPaused checks isRunning, so we don't need to check it here and waste an Apple event
|
||||
BOOL wasPaused = [self isPaused];
|
||||
|
||||
if (wasPaused) {
|
||||
DebugMsg("BGMVox::unpause: Unpausing Vox");
|
||||
[self.vox playpause];
|
||||
}
|
||||
|
||||
return wasPaused;
|
||||
}
|
||||
|
||||
// Vox's comment for playerState says "playing = 1, paused = 0"
|
||||
|
||||
- (BOOL) isPlaying {
|
||||
return [self isRunning] && [self.vox playerState] == 1;
|
||||
}
|
||||
|
||||
- (BOOL) isPaused {
|
||||
return [self isRunning] && [self.vox playerState] == 0;
|
||||
}
|
||||
|
||||
@end
|
||||
|
70
BGMApp/BGMApp/Music Players/Vox.h
Normal file
70
BGMApp/BGMApp/Music Players/Vox.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Vox.h
|
||||
*
|
||||
* Generated with
|
||||
* sdef /Applications/Vox.app | sdp -fh --basename Vox
|
||||
*/
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <ScriptingBridge/ScriptingBridge.h>
|
||||
|
||||
|
||||
@class VoxApplication, VoxApplication;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Standard Suite
|
||||
*/
|
||||
|
||||
// The application's top level scripting object.
|
||||
@interface VoxApplication : SBApplication
|
||||
|
||||
@property (copy, readonly) NSString *name; // The name of the application.
|
||||
@property (readonly) BOOL frontmost; // Is this the frontmost (active) application?
|
||||
@property (copy, readonly) NSString *version; // The version of the application.
|
||||
|
||||
- (void) quit; // Quit an application.
|
||||
- (void) pause; // Pause playback.
|
||||
- (void) play; // Begin playback.
|
||||
- (void) playpause; // Toggle playback between playing and paused.
|
||||
- (void) next; // Skip to the next track in the playlist.
|
||||
- (void) previous; // Skip to the previous track in the playlist.
|
||||
- (void) shuffle; // Shuffle the tracks in the playlist.
|
||||
- (void) playUrl:(NSString *)x; // Play specified URL.
|
||||
- (void) addUrl:(NSString *)x; // Add specified URL to playlist
|
||||
- (void) rewindForward; // Rewind current track forward.
|
||||
- (void) rewindForwardFast; // Rewind current track forward fast.
|
||||
- (void) rewindBackward; // Rewind current track backward.
|
||||
- (void) rewindBackwardFast; // Rewind current track backward fast.
|
||||
- (void) increasVolume; // Increas volume.
|
||||
- (void) decreaseVolume; // Decrease volume.
|
||||
- (void) showHidePlaylist; // Show/Hide playlist.
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Vox Suite
|
||||
*/
|
||||
|
||||
// The application's top-level scripting object.
|
||||
@interface VoxApplication (VoxSuite)
|
||||
|
||||
@property (copy, readonly) NSData *tiffArtworkData; // Current track artwork data in TIFF format.
|
||||
@property (copy, readonly) NSImage *artworkImage; // Current track artwork as an image.
|
||||
@property (readonly) NSInteger playerState; // Player state (playing = 1, paused = 0)
|
||||
@property (copy, readonly) NSString *track; // Current track title.
|
||||
@property (copy, readonly) NSString *trackUrl; // Current track URL.
|
||||
@property (copy, readonly) NSString *artist; // Current track artist.
|
||||
@property (copy, readonly) NSString *albumArtist; // Current track album artist.
|
||||
@property (copy, readonly) NSString *album; // Current track album.
|
||||
@property (copy, readonly) NSString *uniqueID; // Unique identifier for the current track.
|
||||
@property double currentTime; // The current playback position.
|
||||
@property (readonly) double totalTime; // The total time of the currenty playing track.
|
||||
@property double playerVolume; // Player volume (0.0 to 1.0)
|
||||
@property NSInteger repeatState; // Player repeat state (none = 0, repeat one = 1, repeat all = 2)
|
||||
|
||||
@end
|
||||
|
Binary file not shown.
Loading…
Reference in a new issue