From fdb228436d00c126e1791f27cfb6231138186bb2 Mon Sep 17 00:00:00 2001 From: Dokugogagoji_cp Date: Sun, 3 Aug 2008 21:40:12 +0000 Subject: [PATCH] some code modification (audio) --- source/Cosmos/Cosmos.Hardware/Audio/PCMStream.cs | 11 ++++++++--- source/DokuTest/DokuTest.csproj | 2 +- source/DokuTest/ES1370.cs | 3 +++ .../{Sample sound => SampleSounds}/SoundSamples.cs | 6 +++--- 4 files changed, 15 insertions(+), 7 deletions(-) rename source/DokuTest/{Sample sound => SampleSounds}/SoundSamples.cs (72%) diff --git a/source/Cosmos/Cosmos.Hardware/Audio/PCMStream.cs b/source/Cosmos/Cosmos.Hardware/Audio/PCMStream.cs index 3aa2cf4c8..17fa16bce 100644 --- a/source/Cosmos/Cosmos.Hardware/Audio/PCMStream.cs +++ b/source/Cosmos/Cosmos.Hardware/Audio/PCMStream.cs @@ -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; + } } diff --git a/source/DokuTest/DokuTest.csproj b/source/DokuTest/DokuTest.csproj index 68ade5073..379792b61 100644 --- a/source/DokuTest/DokuTest.csproj +++ b/source/DokuTest/DokuTest.csproj @@ -51,7 +51,7 @@ - + diff --git a/source/DokuTest/ES1370.cs b/source/DokuTest/ES1370.cs index 4baad2ea8..e94f278c2 100644 --- a/source/DokuTest/ES1370.cs +++ b/source/DokuTest/ES1370.cs @@ -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(); diff --git a/source/DokuTest/Sample sound/SoundSamples.cs b/source/DokuTest/SampleSounds/SoundSamples.cs similarity index 72% rename from source/DokuTest/Sample sound/SoundSamples.cs rename to source/DokuTest/SampleSounds/SoundSamples.cs index c21334d51..33946f11f 100644 --- a/source/DokuTest/Sample sound/SoundSamples.cs +++ b/source/DokuTest/SampleSounds/SoundSamples.cs @@ -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 frames = new List(); int ind_chan; - while (count-- > 0) + //while (count-- > 0) {/* for (ind_chan = 0; ind_chan < nChannels; ind_chan++) {