コード例 #1
0
ファイル: Sid.cs プロジェクト: ddugovic/RASuite
		public Sid(int[][] newWaveformTable, int newSampleRate, Region newRegion)
		{
			uint cyclesPerSec = 0;
			uint cyclesNum;
			uint cyclesDen;
			uint sampleRate = 44100;

			switch (newRegion)
			{
				case Region.NTSC: cyclesNum = 14318181; cyclesDen = 14; break;
				case Region.PAL: cyclesNum = 17734472; cyclesDen = 18; break;
				default: return;
			}

			waveformTable = newWaveformTable;

			envelopes = new Envelope[3];
			for (int i = 0; i < 3; i++)
				envelopes[i] = new Envelope();
			envelopeOutput = new int[3];

			voices = new Voice[3];
			for (int i = 0; i < 3; i++)
				voices[i] = new Voice(newWaveformTable);
			voiceOutput = new int[3];

			filterEnable = new bool[3];
			for (int i = 0; i < 3; i++)
				filterEnable[i] = false;

			resampler = new SpeexResampler(0, cyclesNum, sampleRate * cyclesDen, cyclesNum, sampleRate * cyclesDen, null, null);
		}
コード例 #2
0
ファイル: Sid.cs プロジェクト: ddugovic/RASuite
		public void Dispose()
		{
			if (resampler != null)
			{
				resampler.Dispose();
				resampler = null;
			}
		}
コード例 #3
0
ファイル: N64Audio.cs プロジェクト: ddugovic/RASuite
		/// <summary>
		/// Creates a N64 Audio subsystem
		/// </summary>
		/// <param name="api">Mupen64 api which is used for fetching sound</param>
		public N64Audio(mupen64plusApi core)
		{
			this.api = new mupen64plusAudioApi(core);

			_samplingRate = api.GetSamplingRate();
			Resampler = new SpeexResampler(6, SamplingRate, 44100,
				SamplingRate, 44100);

			core.VInterrupt += DoAudioFrame;
		}
コード例 #4
0
ファイル: Sid.cs プロジェクト: henke37/BizHawk
		public Sid(int[][] newWaveformTable, uint sampleRate, uint cyclesNum, uint cyclesDen)
		{
			waveformTable = newWaveformTable;

			envelopes = new Envelope[3];
			for (int i = 0; i < 3; i++)
				envelopes[i] = new Envelope();
			envelopeOutput = new int[3];

			voices = new Voice[3];
			for (int i = 0; i < 3; i++)
				voices[i] = new Voice(newWaveformTable);
			voiceOutput = new int[3];

			filterEnable = new bool[3];
			for (int i = 0; i < 3; i++)
				filterEnable[i] = false;

			resampler = new SpeexResampler(0, cyclesNum, sampleRate * cyclesDen, cyclesNum, sampleRate * cyclesDen, null, null);
		}
コード例 #5
0
ファイル: LibsnesCore.cs プロジェクト: ddugovic/RASuite
		void InitAudio()
		{
			resampler = new SpeexResampler(6, 64081, 88200, 32041, 44100);
		}
コード例 #6
0
ファイル: Atari7800.cs プロジェクト: ddugovic/RASuite
			public void ConnectToMachine(MachineBase m, EMU7800.Win.GameProgram g)
			{
				framebuffer = m.CreateFrameBuffer();
				BufferWidth = framebuffer.VisiblePitch;
				BufferHeight = framebuffer.Scanlines;
				vidbuffer = new int[BufferWidth * BufferHeight];

				uint newsamplerate = (uint)m.SoundSampleFrequency;
				if (newsamplerate != samplerate)
				{
					// really shouldn't happen (after init), but if it does, we're ready
					if (resampler != null)
						resampler.Dispose();
					resampler = new SpeexResampler(3, newsamplerate, 44100, newsamplerate, 44100, null, null);
					samplerate = newsamplerate;
					dcfilter = DCFilter.DetatchedMode(256);
				}
				if (g.MachineType == MachineType.A7800PAL || g.MachineType == MachineType.A2600PAL)
					palette = TIATables.PALPalette;
				else
					palette = TIATables.NTSCPalette;
			}
コード例 #7
0
        void SetupResampler(double fps, double sps)
        {
            Console.WriteLine("FPS {0} SPS {1}", fps, sps);

            // todo: more precise?
            uint spsnum = (uint)sps * 1000;
            uint spsden = (uint)1000;

            resampler = new SpeexResampler(5, 44100 * spsden, spsnum, (uint)sps, 44100, null, null);
        }