/* /////////////////////////////////////////////////////////////////////////////////// / talkthru.asm / / / / Receives input from the AD1836 internal ADCs via the ADSP-21161 serial port / / (SPORT0), and transmits the data back to the AD1836 internal DACs (SPORT2). / / / / The samples from the AD1836 are 24 bit and are left-justified in the upper / / 24-bits of the the 32-bit word (timeslot). No shifting of the data is required / / in order to preserve the sign of the samples when they are converted to / / floating point numbers, as the audio data is already in the assumed 1.31 format./ / The values are also scaled to the range +/-1.0 with the integer to float / / conversion (f0 = float r0 by r1). / /////////////////////////////////////////////////////////////////////////////////// */ /* ADSP-21161 System Register bit definitions */ #include "def21161.h" #define HEADPHONE -0 // use this when using headphone output jack (connected to AD1836 DAC0) #define DAC0_RCA_JACK -0 // use thes definition in shifter instruction when using RCA outputs /*----------------------------------------------------------------------------------*/ .section /pm pm_code; //.GLOBAL Play_Song; //.GLOBAL Auto_Double_Tracking; .GLOBAL process_audio; //.GLOBAL user_code_init; .EXTERN Auto_Double_Tracking; .EXTERN Left_Channel_Out0; .EXTERN Right_Channel_Out0; .EXTERN Left_Channel_Out1; .EXTERN Right_Channel_Out1; .EXTERN Left_Channel; .EXTERN Right_Channel; .EXTERN Play_Song; .EXTERN chorus_effect; //.EXTERN user_code_init; process_audio: call Play_Song; /* generate song via sine wave generation routine */ DM(Left_Channel_Out1) = r8; /* send non-postprocessed left channel result to AD1836 Left DAC1 */ DM(Right_Channel_Out1) = r8; /* send non-postprocessed right channel result to AD1836 Right DAC1 */ if FLAG1_in jump skip_ADT_effect; /* pressing FLAG1 bypasses chorus and delay effects */ do_audio_post_processing: if FLAG3_IN jump skip_chorus_processing; /* pressing FLAG3 pushbutton will bypass Stereo Chorus Effect */ call (pc, chorus_effect); skip_chorus_processing: if FLAG2_IN jump skip_ADT_effect; call Auto_Double_Tracking; skip_ADT_effect: r0 = DM(Left_Channel); r2 = DM(Right_Channel); r0 = ASHIFT r0 by HEADPHONE; /* turn down the volume for headphone jack */ r2 = ASHIFT r2 by HEADPHONE; /* turn down the volume for headphone jack */ DM(Left_Channel_Out0) = r0; /* send left channel result to AD1836 Left DAC0 */ DM(Right_Channel_Out0) = r2; /* send right channel result to AD1836 Right DAC0 */ done_processing: rts; process_audio.end: