colorchord/sound_null.c
2015-01-06 22:51:39 -05:00

45 lines
909 B
C

#include "sound.h"
#include "os_generic.h"
#include <stdlib.h>
#include "parameters.h"
struct SoundDriverNull
{
void (*CloseFn)( struct SoundDriverNull * object );
int (*SoundStateFn)( struct SoundDriverNull * object );
SoundCBType soundcb;
int channelsPlay;
int spsPlay;
int channelsRec;
int spsRec;
};
void CloseSoundNull( struct SoundDriverNull * object )
{
free( object );
}
int SoundStateNull( struct SoundDriverNull * object )
{
return 0;
}
void * InitSoundNull( SoundCBType cb )
{
struct SoundDriverNull * r = malloc( sizeof( struct SoundDriverNull ) );
r->CloseFn = CloseSoundNull;
r->SoundStateFn = SoundStateNull;
r->soundcb = cb;
r->spsPlay = GetParameterI( "samplerate", 44100 );
r->channelsPlay = GetParameterI( "channels", 2 );
r->spsRec = r->spsPlay;
r->channelsRec = r->channelsRec;
return r;
}
EXECUTE_AT_BOOT( NullSoundReg, RegSound( 1, "NULL", InitSoundNull ) );