Exemple #1
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);
 }
Exemple #2
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);
 }
Exemple #3
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;
      }
    }