Beispiel #1
0
 void RenderTill(Stamp stamp)
 {
   const uint_t samples = Clock.SamplesTill(stamp);
   Sound::ChunkBuilder builder;
   builder.Reserve(samples);
   Renderers.Render(stamp, samples, builder);
   Target->ApplyData(builder.CaptureResult());
   Target->Flush();
 }
Beispiel #2
0
 void RenderSamples(uint_t count, Sound::ChunkBuilder& tgt)
 {
     Sound::Sample* const out = tgt.Allocate(count);
     FM::Details::YM2203SampleType* const outRaw = safe_ptr_cast<FM::Details::YM2203SampleType*>(out);
     ::YM2203UpdateOne(Chips[0].get(), outRaw, count);
     ::YM2203UpdateOne(Chips[1].get(), outRaw, count);
     Helper.ConvertSamples(outRaw, outRaw + count, out);
 }
Beispiel #3
0
 void Render(uint_t samples, Sound::ChunkBuilder& target)
 {
   static_assert(Sound::Sample::CHANNELS == 2, "Incompatible sound channels count");
   static_assert(Sound::Sample::BITS == 16, "Incompatible sound bits count");
   ::SNES_SPC::sample_t* const buffer = safe_ptr_cast< ::SNES_SPC::sample_t*>(target.Allocate(samples));
   CheckError(Spc.play(samples * Sound::Sample::CHANNELS, buffer));
   Filter.run(buffer, samples * Sound::Sample::CHANNELS);
 }
Beispiel #4
0
    bool RenderFrame() override
    {
      try
      {
        ApplyParameters();

        Sound::ChunkBuilder builder;
        builder.Reserve(SamplesPerFrame);
        Tune->Render(SamplesPerFrame, builder);
        Resampler->ApplyData(builder.CaptureResult());
        Iterator->NextFrame(Looped);
        return Iterator->IsValid();
      }
      catch (const std::exception&)
      {
        return false;
      }
    }
Beispiel #5
0
    bool RenderFrame() override
    {
      static_assert(Sound::Sample::BITS == 16, "Incompatible sound bits count");

      try
      {
        ApplyParameters();

        Sound::ChunkBuilder builder;
        builder.Reserve(SamplesPerFrame);
        Engine->play(safe_ptr_cast<short*>(builder.Allocate(SamplesPerFrame)), SamplesPerFrame * Sound::Sample::CHANNELS);
        Target->ApplyData(builder.CaptureResult());
        Iterator->NextFrame(Looped);
        return Iterator->IsValid();
      }
      catch (const std::exception&)
      {
        return false;
      }
    }