progress on ak4531 dac

This commit is contained in:
Dokugogagoji_cp 2008-08-02 20:11:44 +00:00
parent 4e61b7344a
commit 178bbb677b
7 changed files with 70 additions and 22 deletions

View file

@ -7,6 +7,6 @@ namespace Cosmos.Hardware.Audio.Devices
{
public class DACEntity
{
public DACEntity(byte dacAddr, byte dacSizeAddr) { }
public DACEntity() { }
}
}

View file

@ -7,7 +7,7 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370.Components
{
class DACak4531 : DACEntity
{
public DACak4531(byte dacAddr,byte dacSizeAddr) : base(dacAddr, dacSizeAddr) { }
public DACak4531() : base() { }
public enum Bit : byte
{
@ -16,7 +16,19 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370.Components
LeftVoiceVol= 0x02, // channel volume left
RightVoiceVol = 0x03, //channel volume right
LeftFMVol = 0x04, //FM volume left
RightFMVol = 0x05//FM volume right
RightFMVol = 0x05,//FM volume right
LeftCDVol = 0x06, //CD Volume left
RightCDVol = 0x07,
MonoLeft = 0x0c, //Mono volume left
MonoRight= 0x0d, //Mono volume right
MonoOutVol= 0x0f, //Mono out volume
Sw1Out=0x10, //Mixer output chooser 1
Sw2Out = 0x11, //Mixer output chooser 2
Sw1In = 0x12,
Sw2In = 0x13,
Reset=0x16,
Clock=0x17,
Ad=0x18
}
}
}

View file

@ -20,7 +20,10 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370
private UARTInterfaceRegister uir;
public int[] FixedRatesSupported={5512, 11025, 22050, 44100};
public const int SRClock = 1411200;
public const int minClockDen=29;
public const int maxClockDen=353;
public const int clockStep=1;
public ES1370(PCIDevice device) : base(device)
{
@ -28,9 +31,10 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370
sir = (SerialInterfaceRegister.Load(getMemReference()));
uir = (UARTInterfaceRegister.Load(getMemReference()));
cr=(ControlRegister.Load(getMemReference()));
dacs.Add(new DACManager(new DACak4531((byte)MainRegister.Bit.Dac1FrameAddr, (byte)MainRegister.Bit.Dac1FrameSize)));
dacs.Add(new DACManager(new DACak4531((byte)MainRegister.Bit.Dac2FrameAddr, (byte)MainRegister.Bit.Dac2FrameSize)));
dacs.Add(new DACManager(new DACak4531(), cr.DAC1Enabled,(byte)MainRegister.Bit.Dac1FrameAddr, (byte)MainRegister.Bit.Dac1FrameSize));
dacs.Add(new DACManager(new DACak4531(), cr.DAC2Enabled, (byte)MainRegister.Bit.Dac2FrameAddr, (byte)MainRegister.Bit.Dac2FrameSize));
foreach (var dac in dacs.ToArray())
preparePlayBackOnDac(dac);
}
/// <summary>
/// Retrieve all Ensoniq AudioPCI 1370 cards found on computer.
@ -121,9 +125,13 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370
}
#endregion
public void prepareStreamPlayBack(PCMStream pcmStream)
#region I/O Helper routine
private void setDataOnDACCodec(DACManager dacManager){ }
#endregion
private void preparePlayBackOnDac(DACManager dacManager)
{
bool state = dacManager.setDACStateEnabled(true);
Console.WriteLine("State: " + state);
}
}

View file

@ -14,7 +14,6 @@ namespace Cosmos.Hardware.Audio.Devices
protected List<ADCManager> adcs;
protected List<UARTManager> uarts;
#endregion
public GenericSoundCard(PCIDevice device){

View file

@ -9,15 +9,21 @@ namespace Cosmos.Hardware.Audio.Managers
public class DACManager
{
private DACEntity dacEntity;
private long dataSize;
public DACManager(DACEntity dacEntity)
private byte dacAddr;
private byte dacSizeAddr;
bool dacEnabled;
public DACManager(DACEntity dacEntity, bool dacEnabled , byte dacAddr, byte dacSizeAddr)
{
this.dacEntity = dacEntity;
this.dataSize = 0;
this.dacAddr = dacAddr;
this.dacSizeAddr = dacSizeAddr;
this.dacEnabled = dacEnabled;
}
protected void prepareDACStreamPlayBack(PCMStream pcmStream, int rate)
{
public bool setDACStateEnabled(bool state)
{
dacEnabled = state;
return dacEnabled;
}
}
}

View file

@ -7,6 +7,11 @@ namespace Cosmos.Hardware.Audio.Devices
{
public class PCMStream
{
int rate;
int[] data;
public PCMStream(int rate, int[] data)
{
}
}
}

View file

@ -6,13 +6,31 @@ using System.Text;
namespace DokuTest.Sample_sound
{
public static class SoundSamples
{/*
uint rate;
uint channels;
uint freq;
{
public SoundSamples(){}
public class sineSignal { }
*/
public static Cosmos.Hardware.Audio.Devices.PCMStream generateSineWaveForm(double freq, int rate, int count, int sampleSize, int[] channelsList, int period, int nPeriods, double phase)
{
double max_phase = 1.0 / freq;
double step = 1.0 / (double)rate;
double res;
float fres;
//PCMStream pcmStream = new PCMStream();
List<int> frames = new List<int>();
int ind_chan;
while (count-- > 0)
{/*
for (ind_chan = 0; ind_chan < nChannels; ind_chan++)
{
if (sampleSize == 8)
{
if (chn == channel)
{
}
}
}*/
}
return null;
}
}
}