-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
When a channel first starts playing there is an audible pop. If you turn off the channel and then start it again it pops again. If another channel is playing this does not happen. Seems to be the DAC or amp turning on? It does not happen in SDL and is not affected by volume setting.
Demonstration code that plays silence on two channels while turning them on and off:
#include <cstring>
#include "game.hpp"
bool on = false;
bool on2 = false;
void cb(blit::AudioChannel &channel) {
// wave_buffer is 16 bit signed.
memset(channel.wave_buffer, 0, 128);
}
void init() {
blit::channels[0].waveforms = blit::Waveform::WAVE;
blit::channels[0].wave_buffer_callback = &cb;
blit::channels[1].waveforms = blit::Waveform::WAVE;
blit::channels[1].wave_buffer_callback = &cb;
}
void render(uint32_t time) {
blit::screen.pen = blit::Pen(0, 0, 0);
blit::screen.clear();
blit::screen.pen = blit::Pen(255, 255, 255);
if (on)
blit::screen.text("ON", blit::minimal_font, blit::Point(5, 4));
else
blit::screen.text("OFF", blit::minimal_font, blit::Point(5, 4));
if (on2)
blit::screen.text("ON2", blit::minimal_font, blit::Point(25, 4));
else
blit::screen.text("OFF2", blit::minimal_font, blit::Point(25, 4));
}
void update(uint32_t time) {
static uint32_t last_time = 0;
static int32_t timer = 0;
timer += time - last_time;
last_time = time;
if (timer > 500) {
on = !on;
if (on) on2 = !on2;
timer -= 500;
}
if (on)
blit::channels[0].trigger_attack();
else
blit::channels[0].off();
if (on2)
blit::channels[1].trigger_attack();
else
blit::channels[1].off();
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels