ftp.nice.ch/pub/next/graphics/video/Laserdisc.N.bs.tar.gz#/Laserdisc/LDPlayer.m

This is LDPlayer.m in view mode; [Download] [Up]

/*	LDPlayer.m  
	15 February 1993
	Eric Celeste / AppTech / 5 Exeter Street / Belmont, MA 02178
	efc@mit.edu
	
	This object is next to useless as defined here. It is designed to be
	subclassed. Almost all the functions should be overridden to accomodate
	a particular brand of laserdisc player.
	
	It is often helpful to know whether a command actually worked or not.
	To make this error-checking possible, I've set up a standard method
	of reporting problems to the outside world. Any subclass you create
	will inherit, and should use, the reportProblem: method whenever
	it has a problem communicating with it's laserdisc player.
		
	I would enjoy seeing any improvements or subclasses you create.
	Please consider sharing them!
	
	////////////////////////////////////////// History
	930213	efc  created this generic class from SonyLDP1450 and
			     made that a subclass of this class
	930215	efc  switched to delegate method of error reporting

*/
#import "LDPlayer.h"

@implementation LDPlayer
////////////////////////////////////////////// Housekeeping Methods
- initDevice:(const char *)device baud:(int)rate
 {
 	self = [super init];
	port = [SerialPort new:(char *)device baud:rate];
	if (!port) return [self free];
	problem[0] = '\0';
	return self;
 }
 
- free
 {
 	if (port) [port free];
	return [super free];
 }

////////////////////////////////////////////// Delegation Methods
- setDelegate:anObject
 {
    delegate = anObject;
    return self;
 }

- delegate
 {
 	return delegate;
 }

////////////////////////////////////////////// Error Reporting Methods
- reportProblem:(const char *)string
 {
 	allOK = NO;
 	strcpy(problem, [[self class] name]);
	strcat(problem, ": ");
 	strcat(problem, string);
	/* splash an error report on the Console */
	fprintf(stderr, "%s... %d chars waiting\n", problem, [port hasInput]);
	/* notify the delegate that there was a problem */
	if (delegate && [delegate respondsTo:@selector(ldpProblem:)])
	    [delegate perform:@selector(ldpProblem:) with:self];
 	return self;
 }

- (const char *)problemString
 {
 	return ((const char *)problem);
 }

////////////////////////////////////////////// Override these Control Methods
- searchForChapter:(int)chapter
	/*	Searches through disc for given chapter. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }
 
- searchForFrame:(int)frame;
	/*	Searches through disc for given frame. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- still
	/*	Freezes the frame. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- halt
	/*	Stops playing (usually ends up with blank video-screen). */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- eject
	/*	Ejects the disk. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- playForward
	/*	Plays forwards. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- playBack
	/*	Plays backwards. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- fastForward
	/*	Plays forwards quickly. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- fastBack
	/*	Plays backwards quickly. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- slowForward
	/*	Plays forwards slowly. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- slowBack
	/*	Plays backwards slowly. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- scanForward
	/*	Scans forwards very quickly. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- scanBack
	/*	Scans backwards very quickly. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }


- frameForward
	/*	Steps forward one frame. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- frameBack
	/*	Steps back one frame. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- playFrom:(int)inFrame to:(int)outFrame repeating:(int)times;
	/*	Plays a clip over and over. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- motor:(BOOL)on
	/*	Turns motor on or off. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- index:(BOOL)on
	/*	Turns on-video-screen index numbers on or off. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }
 
- channelOne:(BOOL)on
	/*	Turns sound for channel 1 (analog left?) on or off. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }
 
- channelTwo:(BOOL)on
	/*	Turns sound for channel 2 (analog right?) on or off. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }
 
- channelThree:(BOOL)on
	/*	Turns sound for channel 3 (digital left?) on or off. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }
 
- channelFour:(BOOL)on
	/*	Turns sound for channel 4 (digital right?) on or off. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }
 
- mute:(BOOL)on
	/*	Turns player's muting on or off. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }
 
- noiseReduction:(BOOL)on
	/*	Turns player's (CX) noise reduction on or off. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

- clearAll
	/*	Resets the player so that it is ready to receive commands. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return self;
 }

////////////////////////////////////////////// Inquiry Methods
- (int)currentFrame
	/*	Returns the current frame. */
 {
	char report[500];
	strcpy(report, "does not implement ");
	strcat(report, sel_getName(_cmd));
	[self reportProblem:report];
	return 0;
 }

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.