gba-sprite-engine/src/engine/sound.cpp

33 lines
928 B
C++
Raw Normal View History

2018-08-07 14:32:20 +02:00
//
// Created by Wouter Groeneveld on 07/08/18.
//
#include <engine/gba/tonc_memmap.h>
#include "sound.h"
void SoundControl::accept(const void *data, int totalSamples, int ticksPerSample) {
*DMASourceAddress = (u32) data;
*DMADestinationAddress = (u32) FiFoBuffer;
vblanksTotal = vblanksRemaning = totalSamples * ticksPerSample * (1.0 / CYCLES_PER_BLANK);
};
std::unique_ptr<SoundControl> SoundControl::channelAControl() {
return std::unique_ptr<SoundControl>(new SoundControl{
2018-08-07 14:32:20 +02:00
&REG_DMA1CNT,
&REG_DMA1SAD,
&REG_DMA1DAD,
&REG_FIFOA,
SDS_AR | SDS_AL | SDS_ARESET
});
2018-08-07 14:32:20 +02:00
}
std::unique_ptr<SoundControl> SoundControl::channelBControl() {
return std::unique_ptr<SoundControl>(new SoundControl{
2018-08-07 14:32:20 +02:00
&REG_DMA2CNT,
&REG_DMA2SAD,
&REG_DMA2DAD,
&REG_FIFOB,
SDS_BR | SDS_BL | SDS_BRESET
});
2018-08-07 14:32:20 +02:00
}