insert coin noise works but crashes at end
This commit is contained in:
parent
4e9428cb5f
commit
935129baed
6 changed files with 7 additions and 3 deletions
BIN
ch32v-insert-coin/audio/coin3.raw
Normal file
BIN
ch32v-insert-coin/audio/coin3.raw
Normal file
Binary file not shown.
BIN
ch32v-insert-coin/audio/coin4.raw
Normal file
BIN
ch32v-insert-coin/audio/coin4.raw
Normal file
Binary file not shown.
BIN
ch32v-insert-coin/audio/coin5.raw
Normal file
BIN
ch32v-insert-coin/audio/coin5.raw
Normal file
Binary file not shown.
|
|
@ -470,7 +470,7 @@ impl App {
|
|||
|
||||
if self.services.sample_player.need_service() {
|
||||
self.services.sample_player.service();
|
||||
let out = self.services.sample_player.get_amplitude() / 3;
|
||||
let out = self.services.sample_player.get_amplitude() / 2;
|
||||
self.interfaces
|
||||
.pwm_core
|
||||
.write_amplitude(ch32_hal::timer::Channel::Ch4, out as u8);
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ impl<'a> TickService for DacService<'a> {
|
|||
fn service(&self) {
|
||||
let mut tc = self.service_data.borrow_mut();
|
||||
tc.ticks_remaining = tc.ticks_per_service;
|
||||
self.set_amplitude(self.dpcm_decoder.borrow_mut().output_next());
|
||||
if (self.dpcm_decoder.borrow().is_done()) {
|
||||
self.set_amplitude(0);
|
||||
} else {
|
||||
self.set_amplitude(self.dpcm_decoder.borrow_mut().output_next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ fn app_main(mut p: hal::Peripherals) -> ! {
|
|||
let dac_tick_per_service = tick_rate_hz / dac_sample_rate_hz;
|
||||
let dac_service_data = TickServiceData::new(dac_tick_per_service);
|
||||
|
||||
let coin_sound = include_bytes!("../audio/coin.raw");
|
||||
let coin_sound = include_bytes!("../audio/coin5.raw");
|
||||
// let coin_sound = include_bytes!("../audio/coin2.raw");
|
||||
|
||||
let sample_player = DacService::new(ch32_hal::timer::Channel::Ch4, dac_service_data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue