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 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 class DACak4531 : DACEntity
{ {
public DACak4531(byte dacAddr,byte dacSizeAddr) : base(dacAddr, dacSizeAddr) { } public DACak4531() : base() { }
public enum Bit : byte public enum Bit : byte
{ {
@ -16,7 +16,19 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370.Components
LeftVoiceVol= 0x02, // channel volume left LeftVoiceVol= 0x02, // channel volume left
RightVoiceVol = 0x03, //channel volume right RightVoiceVol = 0x03, //channel volume right
LeftFMVol = 0x04, //FM volume left 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,6 +20,9 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370
private UARTInterfaceRegister uir; private UARTInterfaceRegister uir;
public int[] FixedRatesSupported={5512, 11025, 22050, 44100}; public int[] FixedRatesSupported={5512, 11025, 22050, 44100};
public const int SRClock = 1411200; 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) public ES1370(PCIDevice device) : base(device)
@ -28,9 +31,10 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370
sir = (SerialInterfaceRegister.Load(getMemReference())); sir = (SerialInterfaceRegister.Load(getMemReference()));
uir = (UARTInterfaceRegister.Load(getMemReference())); uir = (UARTInterfaceRegister.Load(getMemReference()));
cr=(ControlRegister.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(), cr.DAC1Enabled,(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.DAC2Enabled, (byte)MainRegister.Bit.Dac2FrameAddr, (byte)MainRegister.Bit.Dac2FrameSize));
foreach (var dac in dacs.ToArray())
preparePlayBackOnDac(dac);
} }
/// <summary> /// <summary>
/// Retrieve all Ensoniq AudioPCI 1370 cards found on computer. /// Retrieve all Ensoniq AudioPCI 1370 cards found on computer.
@ -121,9 +125,13 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370
} }
#endregion #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<ADCManager> adcs;
protected List<UARTManager> uarts; protected List<UARTManager> uarts;
#endregion #endregion
public GenericSoundCard(PCIDevice device){ public GenericSoundCard(PCIDevice device){

View file

@ -9,15 +9,21 @@ namespace Cosmos.Hardware.Audio.Managers
public class DACManager public class DACManager
{ {
private DACEntity dacEntity; private DACEntity dacEntity;
private long dataSize; private byte dacAddr;
public DACManager(DACEntity dacEntity) private byte dacSizeAddr;
bool dacEnabled;
public DACManager(DACEntity dacEntity, bool dacEnabled , byte dacAddr, byte dacSizeAddr)
{ {
this.dacEntity = dacEntity; 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 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 namespace DokuTest.Sample_sound
{ {
public static class SoundSamples public static class SoundSamples
{/* {
uint rate;
uint channels;
uint freq;
public SoundSamples(){} public static Cosmos.Hardware.Audio.Devices.PCMStream generateSineWaveForm(double freq, int rate, int count, int sampleSize, int[] channelsList, int period, int nPeriods, double phase)
public class sineSignal { } {
*/ 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;
}
} }
} }