// (c) Theo Verelst // Uncommercial use only permitted with this notice clearly // visible, commercial rights reserved, contact: theover@tiscali.nl // Based on the piecewise contained audio talkthrough from AD // This project implements a // // Audio Synthesizer // // in prototype form, including a chorus unit. // This is a musical instrument effect which adds richness to the sound // by mixing in various delayed components of the input signal // to the output, each with a varying delay lenght, modulated by // independent low frequency sine waves. // //--------------------------------------------------------------------------// // // // Name: Talkthrough for the ADSP-BF533 EZ-KIT Lite // // // //--------------------------------------------------------------------------// // // // (C) Copyright 2003 - Analog Devices, Inc. All rights reserved. // // // // Project Name: BF533 C Talkthrough TDM // // // // Date Modified: 04/03/03 HD Rev 1.0 // // // // Software: VisualDSP++3.1 // // // // Hardware: ADSP-BF533 EZ-KIT Board // // // // Connections: Connect an input source (such as a radio) to the Audio // // input jack and an output source (such as headphones) to // // the Audio output jack // // // // Purpose: This program sets up the SPI port on the ADSP-BF533 to // // configure the AD1836 codec. The SPI port is disabled // // after initialization. The data to/from the codec are // // transfered over SPORT0 in TDM mode // // // //--------------------------------------------------------------------------// #include "Talkthrough.h" #include "sysreg.h" #include "ccblkfn.h" #include //--------------------------------------------------------------------------// // Variables // // // // Description: The variables iChannelxLeftIn and iChannelxRightIn contain // // the data coming from the codec AD1836. The (processed) // // playback data are written into the variables // // iChannelxLeftOut and iChannelxRightOut respectively, which // // are then sent back to the codec in the SPORT0 ISR. // // The values in the array iCodec1836TxRegs can be modified to // // set up the codec in different configurations according to // // the AD1885 data sheet. // //--------------------------------------------------------------------------// // left input data from ad1836 int iChannel0LeftIn, iChannel1LeftIn; // right input data from ad1836 int iChannel0RightIn, iChannel1RightIn; // left ouput data for ad1836 int iChannel0LeftOut, iChannel1LeftOut; // right ouput data for ad1836 int iChannel0RightOut, iChannel1RightOut; // array for registers to configure the ad1836 // names are defined in "Talkthrough.h" volatile short sCodec1836TxRegs[CODEC_1836_REGS_LENGTH] = { DAC_CONTROL_1 | 0x000, DAC_CONTROL_2 | 0x000, DAC_VOLUME_0 | 0x3ff, DAC_VOLUME_1 | 0x3ff, DAC_VOLUME_2 | 0x3ff, DAC_VOLUME_3 | 0x3ff, DAC_VOLUME_4 | 0x3ff, DAC_VOLUME_5 | 0x3ff, ADC_CONTROL_1 | 0x000, ADC_CONTROL_2 | 0x180, ADC_CONTROL_3 | 0x000 }; // SPORT0 DMA transmit buffer volatile int iTxBuffer1[8]; // SPORT0 DMA receive buffer volatile int iRxBuffer1[8]; extern Initaudiobuffer(); extern initmidi(); extern char *dm; extern int dodis, dodisval; extern unsigned char modulation, value; char str[64] = "Line 2"; int *sinewave; int sc, vul, vur; int si1,si2,si3; int sincr1, sincr2, sincr3; int *dell, *delr, dml, dmr, dil, dir, dol, dor, dom; int sine[MAXPOLY], sinincr[MAXPOLY]; unsigned char midinote[MAXPOLY], midivel[MAXPOLY], midibyte; int incrfromnote[127]; char notestate[MAXPOLY]; int noteampl[MAXPOLY]; unsigned char attack = 244, decay = 254, sustain = 128, release = 253; char midistate, midipstate; int *wavetable, wtlen; //int fils[MAXPOLY][4], filc[MAXPOLY]; int fils[MAXPOLY][4], filc[MAXPOLY]; initdelay() { int i; dell = 1024*1024; dml = 48000; // Delay Line Left, 1MB, max set to 1 sec delr = 2*1024*1024; dmr = 48000; // Delay Line Right, base address, # regarded samples (fits in about 200kB) dil=0; dir=0; // Delay Index Left and Right dol = 200; dor = 200; // Delay current Offset Left, Right dom = 200; // Delay offset mid channel for (i=0; i 0) { discontrol(0x01); discontrol(0x02); dismess(dm); discontrol(0xC0); //sprintf(str,"%d",(int) (* (unsigned char *) (0x20300000)) ); dismess("value: "); dodis = 0; dodisval = 1; } if (value != sh3 || dodisval > 0) { // discontrol(0xCD); discontrol(0xC7); sh3 = value; sh1 = sh3 /100; if (sh1 != 0) str[0] = ((unsigned char) sh1) + 48; else str[0] = ' '; sh2 = (value - (sh1*100))/10; if (sh2 != 0 || str[0] != ' ') str[1] = ((unsigned char) sh2) + 48; else str[1] = ' '; str[2] = ((unsigned char) (value %10)) + 48; str[3] = '\0'; dismess(str); dodisval = 0; } }; }