mirror of
https://github.com/livingcomputermuseum/ContrAlto.git
synced 2026-01-23 02:47:48 +00:00
- Orbit controller: implemented and passes ROS-less diagnostics - ROS: In progress, not functional - DAC: For Ted Kaehler's Smalltalk Music system (FM and Sampling). Works, generates audio and can capture to WAV file. - Organ keybard: Stub, enough implemented to make the music system happy (so it will play back music and not crash.) Some minor cleanup. New dependency on NAudio package for DAC playback. Installer updated to include NAudio lib.
63 lines
1.8 KiB
C#
63 lines
1.8 KiB
C#
/*
|
|
This file is part of ContrAlto.
|
|
|
|
ContrAlto is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
ContrAlto is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with ContrAlto. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
using System;
|
|
|
|
namespace Contralto
|
|
{
|
|
public static class Conversion
|
|
{
|
|
public static string ToOctal(int i)
|
|
{
|
|
return Convert.ToString(i, 8);
|
|
}
|
|
|
|
public static string ToOctal(sbyte s)
|
|
{
|
|
if (s < 0)
|
|
{
|
|
return "-" + Convert.ToString(-s, 8);
|
|
}
|
|
else
|
|
{
|
|
return Convert.ToString(s, 8);
|
|
}
|
|
}
|
|
|
|
public static string ToOctal(int i, int digits)
|
|
{
|
|
string octalString = Convert.ToString(i, 8);
|
|
return new String('0', digits - octalString.Length) + octalString;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Conversion from millseconds to nanoseconds
|
|
/// </summary>
|
|
public static readonly ulong MsecToNsec = 1000000;
|
|
|
|
/// <summary>
|
|
/// Conversion from nanoseconds to milliseconds
|
|
/// </summary>
|
|
public static readonly double NsecToMsec = 0.000001;
|
|
|
|
/// <summary>
|
|
/// Conversion from microseconds to nanoseconds
|
|
/// </summary>
|
|
public static readonly ulong UsecToNsec = 1000;
|
|
}
|
|
}
|