
/* Generated by Interface Builder */

#import "SoundEffect.h"
#define DMASIZE 512

@implementation SoundEffect


- open
{
int k_err,protocol;
port_t read_port;

    [infoPanel makeKeyAndOrderFront:self];
    [displayView makeKeyAndOrderFront:self];
    k_err = SNDAcquire(SND_ACCESS_OUT|SND_ACCESS_DSP,0,0,0,
    	NULL_NEGOTIATION_FUN,0,&dev_port,&owner_port);
    Error(k_err,"SNDOUT and DSP acquisition");
    
    k_err = snddriver_set_sndout_bufsize(dev_port,owner_port,512);
    k_err = snddriver_get_dsp_cmd_port(dev_port,owner_port,&cmd_port);
    protocol = SNDDRIVER_DSP_PROTO_RAW;
    k_err = snddriver_stream_setup(dev_port, owner_port,
		    		SNDDRIVER_STREAM_DSP_TO_SNDOUT_44,
				DMASIZE, 2, 
				48*1024, 64*1024,
				&protocol, &read_port);
    Error(k_err,"Stream");
    k_err = snddriver_dsp_protocol(dev_port, owner_port, protocol);
    Error(k_err,"Protocol");
    return self;
}

-show
{
    [displayView makeKeyAndOrderFront:self];
    return self;
}

- buttonPush:sender
{
    return self;
}

- close
{
int k_err;

    k_err = SNDRelease(SND_ACCESS_OUT|SND_ACCESS_DSP,dev_port,owner_port);
    [infoPanel close];
    [displayView close];
    return self;
}

- sliderChange:sender
{
    return self;
}

- (char*)findPath:(char*)aPath
{
    fileName = (char*) calloc(200,sizeof(char));
    strcpy(fileName,parentname(NXArgv[0]));
    strcat(fileName,aPath);
    return fileName;
}


@end
