some code modification (audio)

This commit is contained in:
Dokugogagoji_cp 2008-08-03 21:40:12 +00:00
parent a6903d62c3
commit fdb228436d
4 changed files with 15 additions and 7 deletions

View file

@ -3,14 +3,19 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cosmos.Hardware.Audio.Devices
namespace Cosmos.Hardware.Audio
{
public class PCMStream
{
int rate;
int[] data;
public PCMStream(int rate, int[] data)
short[] data;
double phase;
public PCMStream(int rate, short[] data, double phase)
{
this.rate = rate;
this.data = data;
this.phase = phase;
}
}

View file

@ -51,7 +51,7 @@
<Compile Include="ES1370.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sample sound\SoundSamples.cs" />
<Compile Include="SampleSounds\SoundSamples.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cosmos.Build.Windows\Cosmos.Build.Windows.csproj">

View file

@ -18,6 +18,9 @@ namespace DokuTest
xAudioCard.Enable();
xAudioCard.InitializeDriver();
xAudioCard.DumpRegisters();
Console.WriteLine("Test sine waves");
Cosmos.Hardware.Audio.PCMStream sinewave = SampleSounds.SoundSamples.generateSineWaveForm(440, 44100, 0);
Console.WriteLine("Disabling first audio card...");
xAudioCard.Disable();
xAudioCard.DumpRegisters();

View file

@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DokuTest.Sample_sound
namespace DokuTest.SampleSounds
{
public static class 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 static Cosmos.Hardware.Audio.PCMStream generateSineWaveForm(double freq, int rate, double phase)
{
double max_phase = 1.0 / freq;
double step = 1.0 / (double)rate;
@ -18,7 +18,7 @@ namespace DokuTest.Sample_sound
List<int> frames = new List<int>();
int ind_chan;
while (count-- > 0)
//while (count-- > 0)
{/*
for (ind_chan = 0; ind_chan < nChannels; ind_chan++)
{