!!! Mode AutoInit 8-bits DMA RECORD (with source) DON'T WORK !!!

I need to know how to record in Mode AutoInit 8-bit DMA

All functions is full coded but it ever record blank sample ...

How can i code ??????



I have to code with DSP 3.xx !!!!!!!



That's the select input source code :



void MIX_SetSource(int Source)

{

int oldval ;

int value ;



if ((DSPVer >> 8) >= 4)

{ // DSP Ver 4.xx

oldval = MIX_Read(0x3E); // Entre droite desactiv

MIX_Write(0x3E , oldval&0x80);



//Record all sound with left channel

switch (Source)

{

case MIC :

oldval = MIX_Read(0x3D); // Entre gauche Mic activ

MIX_Write(0x3D , oldval|0x01);break;

case CD :

oldval = MIX_Read(0x3D); // Entre gauche CD activ

MIX_Write(0x3D , oldval|0x06);break;

case LINEIN :

oldval = MIX_Read(0x3D); // Entre gauche Line activ

MIX_Write(0x3D , oldval|0x18);break; // 0x18 = 24d

}

//Set volume

switch (Source)

{

case MIC : MIX_MicVol(max); break;

case CD : MIX_CDVol(max); break;

case LINEIN : MIX_LineInVol(max); break;

}

//Allow line and CD to be heard through speakers, but not microphone

switch (Source)

{

case MIC : MIX_Write(0x3C, 0); break;

case CD : MIX_Write(0x3C, 6); break;

case LINEIN : MIX_Write(0x3C, 24); break;

}

} // DSP Ver 3.xx

else

{

switch(Source)

{

case MIC : value = 0;break;

case CD : value = 2;break;

case LINEIN : value = 6;break;

}

// Filtre passe bas

//oldval = MIX_Read(0x0C);

//MIX_Write(0x0C , oldval|0x5);

oldval = MIX_Read(DSP_MIXERSETSOURCE);

MIX_Write(DSP_MIXERSETSOURCE ,oldval|value); //Selction du Micro

}

}



That's the other setting source code (DSP_Play) :



void DSP_Play (char *Sample , long Frequency, long SoundLength , mode iomode)

{

long Address;

unsigned int Page, OffSet;

unsigned int TimeFreq;



Done = 0 ;

switch(Copymode)

{

case play : RemSample -= BLOCK_SIZE ;

}

CurBlock = 0 ;



TimeFreq = (256 - (1000000 / (Frequency)));



Address = FP_SEG(Sample) ;

Address = (Address << 4) + FP_OFF(Sample);<br>
Page = Address >> 16; //Calcul page

OffSet = Address & 0xFFFF; //Calcul offset dans la page



outportb (0x0A, 4+SB_DMACHAN); //Bloque(masque) le Chan DMA

outportb (0x0C, 0x00); // Clear FIFO



switch(iomode)

{

case play : outportb (0x0B, AUTOINITPLAY+SB_DMACHAN);break; //Sorti du son

case rec : outportb (0x0B, AUTOINITRECORD+SB_DMACHAN);break; //Entre du son

}



outportb (DMA_ADDR[SB_DMACHAN], lo(OffSet)); //Mettre offset pour DMA controller

outportb (DMA_ADDR[SB_DMACHAN], hi(OffSet));

outportb (DMA_PAGE[SB_DMACHAN], Page); // Mette la page pour DMA controller

outportb (DMA_COUNT[SB_DMACHAN], lo(SoundLength-1));

outportb (DMA_COUNT[SB_DMACHAN], hi(SoundLength-1));

outportb (0x0A, SB_DMACHAN); //Libre le DMA channel



// ////////////////////////// DSP Setting ////////////////////////// //

if ((DSPVer >> 8) >= 4)

{ ///////////////////////////DSP ver 4.xx//////////////////////////////////

switch(iomode)

{

case play : DSP_Write(DSP_SETTIMECONSTANT4PLAY);break;

case rec : DSP_Write(DSP_SETTIMECONSTANT4REC);break;

}

DSP_Write(hi(Frequency));

DSP_Write(lo(Frequency));

}

else

{ ///////////////////////////DSP ver 3.xx//////////////////////////////////

DSP_Write(DSP_SETTIMECONSTANT); //DSP Command 40h - Set sample frequency

DSP_Write((TimeFreq)); //Defini la vitesse du sample (SB)

}

// Set Transfert Size

DSP_Write(DSP_SETTRANSFERSIZE);

DSP_Write(lo((SoundLength/2)-1));

DSP_Write(hi((SoundLength/2)-1));



if ((DSPVer >> 8) >= 4)

{ ///////////////////////////DSP ver 4.xx//////////////////////////////////

switch(iomode)

{

case play : DSP_Write(DSP_8DMAAUTODAC4);break;

case rec : DSP_Write(DSP_8DMAAUTOADC4);break;

}

DSP_Write(0x00); // Mode Mono non-sign

DSP_Write(lo(SoundLength-1));

DSP_Write(hi(SoundLength-1));

}

else

{ //////////////////////////DSP ver 3.xx///////////////////////////////////

switch(iomode)

{

case play : DSP_Write(DSP_8DMAAUTODAC);break; // DSP-command 1Ch - Mode Auto Initialized playback

case rec : DSP_Write(DSP_8DMAAUTOADC);break; // DSP-command 2Ch - Mode Auto Initialized record

}

}

switch(iomode)

{

case play : DSP_Write(DSP_SPEAKERON);break;

case rec : DSP_Write(DSP_SPEAKEROFF);break;

}

}

/////////////////////////////////////////////////////////////////////////////







Please Heolp ME !!!!!!

What i have to do for recording !!!

Allways record 000000000000000000000000000000000




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories