Bläddra i källkod

sampler: add a few sanity checks to sampler.

undefined
Sam Hocevar 9 år sedan
förälder
incheckning
0566c16b69
1 ändrade filer med 17 tillägg och 7 borttagningar
  1. +17
    -7
      src/sampler.cpp

+ 17
- 7
src/sampler.cpp Visa fil

@@ -47,25 +47,35 @@ int Sampler::Register(char const *path)

void Sampler::Deregister(int id)
{
data->samples.RemoveSlot(id - 1); /* ID 0 is for the empty sample */
if (id > 0)
data->samples.RemoveSlot(id - 1); /* ID 0 is for the empty sample */
}

void Sampler::PlaySample(int id)
{
Sample *sample = (Sample *)data->samples.GetEntity(id - 1);
sample->Play();
if (id > 0)
{
Sample *sample = (Sample *)data->samples.GetEntity(id - 1);
sample->Play();
}
}

void Sampler::LoopSample(int id)
{
Sample *sample = (Sample *)data->samples.GetEntity(id - 1);
sample->Loop();
if (id > 0)
{
Sample *sample = (Sample *)data->samples.GetEntity(id - 1);
sample->Loop();
}
}

void Sampler::StopSample(int id)
{
Sample *sample = (Sample *)data->samples.GetEntity(id - 1);
sample->Stop();
if (id > 0)
{
Sample *sample = (Sample *)data->samples.GetEntity(id - 1);
sample->Stop();
}
}

} /* namespace lol */


Laddar…
Avbryt
Spara