mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace DokuTest.SampleSounds
|
|
{
|
|
public static class SoundSamples
|
|
{/*
|
|
private const double PI=3.14159;
|
|
public const double maxPhase= PI* 2;
|
|
public static Cosmos.Hardware.Audio.PCMStream generateSineWaveForm(double freq, int rate, double phase, int periodSize)
|
|
{
|
|
double maxPhase = 1.0 / freq;
|
|
double step = 1.0 / (double)rate;
|
|
List<char> frames = new List<char>();
|
|
//int bps = width / 8;
|
|
char elem;
|
|
//if ((width % 8) != 0) return null;
|
|
while (periodSize-- > 0)
|
|
{
|
|
elem = (char)(Math.Sin(phase) * maxPhase);
|
|
frames.Add(elem);
|
|
phase += step;
|
|
if (phase > maxPhase)
|
|
phase -= maxPhase;
|
|
}
|
|
//return new Cosmos.Hardware.Audio.PCMStream(freq, frames.ToArray<char>());
|
|
return null;
|
|
}
|
|
*/
|
|
}
|
|
|
|
}
|