ftp.nice.ch/pub/next/audio/apps/Guitar.1.0.s.tar.gz#/Guitar/Note.m

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

#import "Note.h"

@implementation Note

- init;
{
	int i;
	
	[super init];
	sound = nil;
	name1[0]=name2[0]='\0';
	for(i=0;i<5;i++){
		loc[i].string = -1;
		loc[i].fret = -1;
	}
	not1.nr = -1;
	not2.nr = -1;
	nr = 0;
	
	return self;
}
- (char *)name1;
{
	return name1;
}
- (char *)name2;
{
	return name2;
}
- (Sound *)sound;
{
	return sound;
}
- (notationT *)not1;
{
	return &not1;
}
- (notationT *)not2;
{
	return &not2;
}
- (int)nr;
{
	return nr;
}
- (locationT *)loc:(int)i;
{
	if(i>=0 && i<5)return &loc[i];
	return NULL;
}
- (void)setName1:(char *)value1 name2:(char *)value2;
{
	if(value1)strncpy(name1, value1, 5);
	if(value2)strncpy(name2, value2, 5);
}
- (void)setNot1:(notationT *)value1 not2:(notationT *)value2;
{
	if(value1){
		not1.nr = value1->nr;
		not1.vorz = value1->vorz;
	}
	if(value2){
		not2.nr = value2->nr;
		not2.vorz = value2->vorz;
	}
}
- (void)setNr:(int)value;
{
	if(value >0 && value <= 47){
		nr = value;
		[self computeLocFromNr];
		[self getSound];
	}
}
- (void)computeLocFromNr;
{
	int i,j,n;
	static int offset[6] = {1,6,11,16,20,25};
	
	for(i=0,j=0;i<6;i++){
		n=nr-offset[i];
		if(n>=0 && n<=22){
			loc[j].string = i;
			loc[j].fret = n;
			j++;
		}
	}
}
- (void)setB:(BOOL)value;
{
	b = value;
}
- (BOOL)b;{return b;}
- (void)getSound;
{
	char c[10];	//s00.snd
	
	if(!nr){
		strcpy(c,"s48.snd");
	}else{
		sprintf(c,"s%02i.snd",nr-1);
	}
	sound = [Sound findSoundFor:c];
}
@end

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