
#import "InfoManager.h"
#import "Imports.h"

@implementation InfoManager

- NoWindow
{
	[SoundType setStringValue:""];
	[Samples setIntValue:0];
	[Seconds setIntValue:0];
	[Channels setIntValue:0];
	[Fragmented setStringValue:""];
	return self;
}

- ChangeInfo:ThisSound
{
    int dataform;
	[Channels setIntValue:[ThisSound channelCount]];
	[Samples setIntValue:[ThisSound sampleCount]];
	if ([ThisSound sampleCount]==0)
		{[Seconds setFloatValue:0.0];}
	else
		{
		[Seconds setFloatValue:(float) 
			(((double)[ThisSound sampleCount])/[ThisSound samplingRate])];
		}
	if ([ThisSound needsCompacting])
		{[Fragmented setStringValue:"FRAGMENTED"];}
	else
		{[Fragmented setStringValue:""];}
	dataform=[ThisSound dataFormat];
	if (dataform==SND_FORMAT_MULAW_8)
		{[SoundType setStringValue:"8-Bit Mu-Law"];}
	else 
		{if (dataform==SND_FORMAT_LINEAR_16)
			{if ([ThisSound samplingRate]==SND_RATE_LOW)
				{[SoundType setStringValue:"16-Bit 22 KhZ"];}
			 else
			 	{[SoundType setStringValue:"16-Bit 44 KhZ"];}
			}
		 else
		 	{[SoundType setStringValue:"Unknown"];}
		}
	return self;
}


@end
