SegaPCM: implement getSamplePos()
This commit is contained in:
parent
62b9b98300
commit
591cd633d7
|
@ -382,6 +382,17 @@ DivMacroInt* DivPlatformSegaPCM::getChanMacroInt(int ch) {
|
||||||
return &chan[ch].std;
|
return &chan[ch].std;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DivSamplePos DivPlatformSegaPCM::getSamplePos(int ch) {
|
||||||
|
if (ch>=16) return DivSamplePos();
|
||||||
|
if (chan[ch].pcm.sample<0 || chan[ch].pcm.sample>=parent->song.sampleLen) return DivSamplePos();
|
||||||
|
if (!pcm.is_playing(ch)) return DivSamplePos();
|
||||||
|
return DivSamplePos(
|
||||||
|
chan[ch].pcm.sample,
|
||||||
|
pcm.get_addr(ch)-sampleOffSegaPCM[chan[ch].pcm.sample],
|
||||||
|
122*(chan[ch].pcm.freq+1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
DivDispatchOscBuffer* DivPlatformSegaPCM::getOscBuffer(int ch) {
|
DivDispatchOscBuffer* DivPlatformSegaPCM::getOscBuffer(int ch) {
|
||||||
return oscBuf[ch];
|
return oscBuf[ch];
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,7 @@ class DivPlatformSegaPCM: public DivDispatch {
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
DivSamplePos getSamplePos(int ch);
|
||||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||||
unsigned char* getRegisterPool();
|
unsigned char* getRegisterPool();
|
||||||
int getRegisterPoolSize();
|
int getRegisterPoolSize();
|
||||||
|
|
|
@ -134,6 +134,18 @@ uint8_t* segapcm_device::get_ram() {
|
||||||
return m_ram;
|
return m_ram;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int segapcm_device::get_addr(int ch) {
|
||||||
|
uint8_t *regs = &m_ram[8*ch];
|
||||||
|
int offset = (regs[0x86] & m_bankmask) << m_bankshift;
|
||||||
|
uint32_t addr = (regs[0x85] << 8) | (regs[0x84]) | offset;
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool segapcm_device::is_playing(int ch) {
|
||||||
|
uint8_t *regs = &m_ram[8*ch];
|
||||||
|
return !(regs[0x86]&1);
|
||||||
|
}
|
||||||
|
|
||||||
void segapcm_device::mute(int ch, bool doMute) {
|
void segapcm_device::mute(int ch, bool doMute) {
|
||||||
m_muted[ch&15]=doMute;
|
m_muted[ch&15]=doMute;
|
||||||
}
|
}
|
|
@ -34,6 +34,8 @@ public:
|
||||||
void write(unsigned int offset, uint8_t data);
|
void write(unsigned int offset, uint8_t data);
|
||||||
uint8_t read(unsigned int offset);
|
uint8_t read(unsigned int offset);
|
||||||
uint8_t* get_ram();
|
uint8_t* get_ram();
|
||||||
|
unsigned int get_addr(int ch);
|
||||||
|
bool is_playing(int ch);
|
||||||
void mute(int ch, bool doMute);
|
void mute(int ch, bool doMute);
|
||||||
|
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
|
|
Loading…
Reference in New Issue