mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 06:53:01 +00:00
GA20: implement getSamplePos()
This commit is contained in:
parent
5f5617fc2c
commit
5af3804195
4 changed files with 23 additions and 1 deletions
|
@ -768,10 +768,12 @@ DivMacroInt* DivPlatformAmiga::getChanMacroInt(int ch) {
|
||||||
DivSamplePos DivPlatformAmiga::getSamplePos(int ch) {
|
DivSamplePos DivPlatformAmiga::getSamplePos(int ch) {
|
||||||
if (ch>=4) return DivSamplePos();
|
if (ch>=4) return DivSamplePos();
|
||||||
if (chan[ch].sample<0 || chan[ch].sample>=parent->song.sampleLen) return DivSamplePos();
|
if (chan[ch].sample<0 || chan[ch].sample>=parent->song.sampleLen) return DivSamplePos();
|
||||||
|
int audPer=amiga.audPer[ch];
|
||||||
|
if (audPer<1) audPer=1;
|
||||||
return DivSamplePos(
|
return DivSamplePos(
|
||||||
chan[ch].sample,
|
chan[ch].sample,
|
||||||
amiga.dmaLoc[ch]-sampleOff[chan[ch].sample],
|
amiga.dmaLoc[ch]-sampleOff[chan[ch].sample],
|
||||||
chipClock/amiga.audPer[ch]
|
chipClock/audPer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -336,6 +336,18 @@ DivMacroInt* DivPlatformGA20::getChanMacroInt(int ch) {
|
||||||
return &chan[ch].std;
|
return &chan[ch].std;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DivSamplePos DivPlatformGA20::getSamplePos(int ch) {
|
||||||
|
if (ch>=4) return DivSamplePos();
|
||||||
|
if (chan[ch].sample<0 || chan[ch].sample>=parent->song.sampleLen) return DivSamplePos();
|
||||||
|
if (!ga20.is_playing(ch)) return DivSamplePos();
|
||||||
|
unsigned char f=chan[ch].freq;
|
||||||
|
return DivSamplePos(
|
||||||
|
chan[ch].sample,
|
||||||
|
ga20.get_position(ch)-sampleOffGA20[chan[ch].sample],
|
||||||
|
chipClock/(4*(0x100-(int)f))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
DivDispatchOscBuffer* DivPlatformGA20::getOscBuffer(int ch) {
|
DivDispatchOscBuffer* DivPlatformGA20::getOscBuffer(int ch) {
|
||||||
return oscBuf[ch];
|
return oscBuf[ch];
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
|
||||||
virtual int dispatch(DivCommand c) override;
|
virtual int dispatch(DivCommand c) override;
|
||||||
virtual void* getChanState(int chan) override;
|
virtual void* getChanState(int chan) override;
|
||||||
virtual DivMacroInt* getChanMacroInt(int ch) override;
|
virtual DivMacroInt* getChanMacroInt(int ch) override;
|
||||||
|
virtual DivSamplePos getSamplePos(int ch) override;
|
||||||
virtual DivDispatchOscBuffer* getOscBuffer(int chan) override;
|
virtual DivDispatchOscBuffer* getOscBuffer(int chan) override;
|
||||||
virtual unsigned char* getRegisterPool() override;
|
virtual unsigned char* getRegisterPool() override;
|
||||||
virtual int getRegisterPoolSize() override;
|
virtual int getRegisterPoolSize() override;
|
||||||
|
|
|
@ -39,6 +39,12 @@ public:
|
||||||
u8 read(u32 offset);
|
u8 read(u32 offset);
|
||||||
|
|
||||||
inline void set_mute(const int ch, const bool mute) { m_channel[ch & 3].mute = mute; }
|
inline void set_mute(const int ch, const bool mute) { m_channel[ch & 3].mute = mute; }
|
||||||
|
inline unsigned int get_position(const int ch) {
|
||||||
|
return m_channel[ch&3].pos;
|
||||||
|
}
|
||||||
|
inline bool is_playing(const int ch) {
|
||||||
|
return m_channel[ch&3].play;
|
||||||
|
}
|
||||||
|
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
void device_reset();
|
void device_reset();
|
||||||
|
@ -46,6 +52,7 @@ public:
|
||||||
// sound stream update overrides
|
// sound stream update overrides
|
||||||
void sound_stream_update(short** outputs, int len);
|
void sound_stream_update(short** outputs, int len);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct channel_def
|
struct channel_def
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue