X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/26e7dbbdfdddcb98beb83c19a83b8e35416821ff..8cd3a5dd6d2ff6cc246b5db466bfbebd79c6ce46:/ITMTRemote.h diff --git a/ITMTRemote.h b/ITMTRemote.h index b20eaee..cc96262 100755 --- a/ITMTRemote.h +++ b/ITMTRemote.h @@ -1,128 +1,222 @@ -/* - * MenuTunes - * ITMTRemote - * Plugin definition for audio player control via MenuTunes - * - * Original Author : Matt Judy - * Responsibility : Matt Judy - * - * Copyright (c) 2002 - 2003 iThink Software. - * All Rights Reserved - * - * This header defines the Objective-C protocol which all MenuTunes Remote - * plugins must implement. To build a remote, create a subclass of this - * object, and implement each method in the @protocol below. - * - */ - -/* - * TO DO: - * - * - Capability methods - * - */ - -/*! @header ITMTRemote - * @abstract Declares the necessary protocol and class to implement a MenuTunes Remote. - */ +/**************************************** + ITMTRemote 1.0 (MenuTunes Remotes) + ITMTRemote.h + + Responsibility: + Joseph Spiros + + Copyright (c) 2002 - 2003 by iThink Software. + All Rights Reserved. +****************************************/ #import typedef enum { - stopped = -1, - paused, - playing, - rewinding, - forwarding -} PlayerState; - -/*! @protocol ITMTRemote - * @abstract Declares what a MenuTunes Remote must be able to do. - * @discussion A MenuTunes Remote must be able to return and change state information. - */ -@protocol ITMTRemote + ITMTNameProperty, + ITMTImageProperty +} ITMTGenericProperty; + +typedef enum { + ITMTRemoteNameProperty, + ITMTRemoteImageProperty, + ITMTRemoteAuthorProperty, + ITMTRemoteDescriptionProperty, + ITMTRemoteURLProperty, + ITMTRemoteCopyrightProperty, + ITMTRemoteActivationStringProperty, + ITMTRemoteDeactivationStringProperty +} ITMTRemoteProperty; +typedef enum { + ITMTTrackTitle, + ITMTTrackArtist, + ITMTTrackComposer, + ITMTTrackYear, + ITMTTrackImage, + ITMTTrackAlbum, + ITMTTrackNumber, + ITMTTrackTotal, + ITMTDiscNumber, + ITMTDiscTotal, + ITMTTrackComments, + ITMTTrackGenre, + ITMTTrackRating +} ITMTTrackProperty; + +/*! + @typedef ITMTPlayerStyle + @constant ITMTSinglePlayerStyle Like iTunes, One player controls all available songs. + @constant ITMTMultiplePlayerStyle Like Audion, Multiple players control multiple playlists. + @constant ITMTSinglePlayerSinglePlaylistStyle Like *Amp, XMMS. Not recommended, but instead, developers are urged to use ITMTSinglePlayerStyle with emulated support for multiple playlists. +*/ +typedef enum { + ITMTSinglePlayerStyle, + ITMTMultiplePlayerStyle, + ITMTSinglePlayerSinglePlaylistStyle +} ITMTPlayerStyle; + +typedef enum { + ITMT32HzEqualizerBandLevel, + ITMT64HzEqualizerBandLevel, + ITMT125HzEqualizerBandLevel, + ITMT250HzEqualizerBandLevel, + ITMT500HzEqualizerBandLevel, + ITMT1kHzEqualizerBandLevel, + ITMT2kHzEqualizerBandLevel, + ITMT4kHzEqualizerBandLevel, + ITMT8kHzEqualizerBandLevel, + ITMT16kHzEqualizerBandLevel, + ITMTEqualizerPreampLevel +} ITMTEqualizerLevel; -/*! @method remote - * @abstract Returns an autoreleased instance of the remote. - * @discussion Should be very quick and compact. - * EXAMPLE: - * + (id)remote - * { - * return [[[MyRemote alloc] init] autorelease]; - * } - * @result The instance. - */ +typedef enum { + ITMTTrackStopped = -1, + ITMTTrackPaused, + ITMTTrackPlaying, + ITMTTrackForwarding, + ITMTTrackRewinding +} ITMTTrackState; + +typedef enum { + ITMTRepeatNoneMode, + ITMTRepeatOneMode, + ITMTRepeatAllMode +} ITMTRepeatMode; + +@class ITMTRemote, ITMTPlayer, ITMTPlaylist, ITMTTrack, ITMTEqualizer; + +@protocol ITMTRemote + (id)remote; -/*! @method title: - * @abstract Returns the title of the plugin, which should be player name. - * @result An NSString containing the title. - */ -- (NSString *)title; - -/*! @method description: - * @abstract Returns a description of the remote. - * @result An NSString containing the description. - */ -- (NSString *)information; - -/*! @method icon: - * @abstract Returns a icon for the remote. - * @result An NSImage containing the icon. - */ -- (NSImage *)icon; - -/*! @method begin: - * @abstract Sent when the plugin should begin operation. - * @result A result code signifying success. - */ -- (BOOL)begin; - -/*! @method halt: - * @abstract Sent when the plugin should cease operation. - * @result A result code signifying success. - */ -- (BOOL)halt; - -- (BOOL)isAppRunning; -- (PlayerState)playerState; +- (id)valueOfProperty:(ITMTRemoteProperty)property; + +- (NSDictionary *)propertiesAndValues; + +- (ITMTPlayerStyle)playerStyle; + +- (BOOL)activate; +- (BOOL)deactivate; + +- (ITMTPlayer *)currentPlayer; +- (BOOL)selectPlayer:(ITMTPlayer *)player; +- (NSArray *)players; +@end + +@interface ITMTRemote : NSObject +@end + +/*! + @protocol ITMTPlayer + @abstract Object representation for a controlled player. + @discussion Object representation for a controlled player. Players can be defined as things that control playlist(s) objects, a pool of track objects, and possibly, equalizer objects. +*/ +@protocol ITMTPlayer +- (BOOL)writable; + +- (BOOL)show; + +- (BOOL)setValue:(id)value forProperty:(ITMTGenericProperty)property; +- (id)valueOfProperty:(ITMTGenericProperty)property; +- (NSDictionary *)propertiesAndValues; + +- (ITMTRemote *)remote; + +- (ITMTPlaylist *)currentPlaylist; +- (BOOL)selectPlaylist:(ITMTPlaylist *)playlist; +- (ITMTTrack *)currentTrack; +- (BOOL)selectTrack:(ITMTTrack *)track; +- (ITMTEqualizer *)currentEqualizer; +- (BOOL)selectEqualizer:(ITMTEqualizer *)equalizer; - (NSArray *)playlists; -- (int)numberOfSongsInPlaylistAtIndex:(int)index; -- (NSString *)classOfPlaylistAtIndex:(int)index; -- (int)currentPlaylistIndex; -- (NSString *)songTitleAtIndex:(int)index; -- (int)currentSongIndex; +- (NSArray *)tracks; +- (ITMTPlaylist *)libraryPlaylist; -- (NSString *)currentSongTitle; -- (NSString *)currentSongArtist; -- (NSString *)currentSongAlbum; -- (NSString *)currentSongGenre; -- (NSString *)currentSongLength; -- (NSString *)currentSongRemaining; +- (NSArray *)equalizers; -- (int)currentSongRating; -- (BOOL)setCurrentSongRating:(int)rating; +- (ITMTRepeatMode)repeatMode; +- (BOOL)setRepeatMode:(ITMTRepeatMode)repeatMode; -- (NSArray *)eqPresets; -- (int)currentEQPresetIndex; +- (BOOL)shuffleEnabled; +- (BOOL)enableShuffle:(BOOL)shuffle; +@end + +@interface ITMTPlayer : NSObject +@end + +@protocol ITMTPlaylist +- (BOOL)isEqualToPlaylist:(ITMTPlaylist *)playlist; + +- (BOOL)writable; + +- (BOOL)show; + +- (BOOL)setValue:(id)value forProperty:(ITMTGenericProperty)property; +- (id)valueOfProperty:(ITMTGenericProperty)property; +- (NSDictionary *)propertiesAndValues; + +- (ITMTPlayer *)player; + +- (BOOL)addTrack:(ITMTTrack *)track; +- (BOOL)insertTrack:(ITMTTrack *)track atIndex:(int)index; + +- (BOOL)removeTrack:(ITMTTrack *)item; +- (BOOL)removeTrackAtIndex:(int)index; + +- (ITMTTrack *)trackAtIndex:(int)index; + +- (int)indexOfTrack:(ITMTTrack *)track; +- (ITMTTrack *)trackWithProperty:(ITMTTrackProperty)property ofValue:(id)value allowPartialMatch:(BOOL)partial; +- (NSArray *)tracksWithProperty:(ITMTTrackProperty)property ofValue:(id)value allowPartialMatches:(BOOL)partial; +- (int)indexOfTrackWithProperty:(ITMTTrackProperty)property ofValue:(id)value allowPartialMatch:(BOOL)partial; +- (NSArray *)indexesOfTracksWithProperty:(ITMTTrackProperty)property ofValue:(id)value allowPartialMatches:(BOOL)partial; + +- (int)trackCount; +- (NSArray *)tracks; -- (BOOL)play; -- (BOOL)pause; -- (BOOL)goToNextSong; -- (BOOL)goToPreviousSong; -- (BOOL)fastForward; -- (BOOL)rewind; +- (ITMTTrack *)currentTrack; +- (int)indexOfCurrentTrack; -- (BOOL)switchToPlaylistAtIndex:(int)index; -- (BOOL)switchToSongAtIndex:(int)index; -- (BOOL)switchToEQAtIndex:(int)index; +- (BOOL)selectTrack:(ITMTTrack *)track; +- (BOOL)selectTrackAtIndex:(int)index; +@end +@interface ITMTPlaylist : NSObject @end +@protocol ITMTTrack +- (BOOL)isEqualToTrack:(ITMTTrack *)track; -@interface ITMTRemote : NSObject +- (BOOL)writable; +- (BOOL)addToPlaylist:(ITMTPlaylist *)playlist; +- (BOOL)addToPlaylist:(ITMTPlaylist *)playlist atIndex:(int)index; + +- (ITMTPlayer *)player; +- (NSArray *)playlists; +- (ITMTPlaylist *)currentPlaylist; +- (BOOL)setCurrentPlaylist:(ITMTPlaylist *)playlist; + +- (BOOL)setValue:(id)value forProperty:(ITMTTrackProperty)property; +- (id)valueOfProperty:(ITMTTrackProperty)property; +- (NSDictionary *)propertiesAndValues; + +- (BOOL)setState:(ITMTTrackState)state; +- (ITMTTrackState)state; @end + +@interface ITMTTrack : NSObject +@end + +@protocol ITMTEqualizer +- (BOOL)writable; + +- (ITMTPlayer *)player; + +- (float)dBForLevel:(ITMTEqualizerLevel)level; +- (BOOL)setdB:(float)dB forLevel:(ITMTEqualizerLevel)level; +@end + +@interface ITMTEqualizer : NSObject +@end \ No newline at end of file