mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Restored the rhythm section to fmopl.cpp and made some slight updates from
version 0.72 of MAME's fmopl.c. Also refactored CalcVoice so that the original MAME structure is more visible. SVN r1368 (trunk)
This commit is contained in:
parent
6ebbc920fb
commit
7f35a95942
6 changed files with 564 additions and 307 deletions
|
@ -1,4 +1,7 @@
|
||||||
January 24, 2009
|
January 24, 2009
|
||||||
|
- Restored the rhythm section to fmopl.cpp and made some slight updates from
|
||||||
|
version 0.72 of MAME's fmopl.c. Also refactored CalcVoice so that the
|
||||||
|
original MAME structure is more visible.
|
||||||
- Removed the SoundChans bitfield from AActor, since it seems there are race
|
- Removed the SoundChans bitfield from AActor, since it seems there are race
|
||||||
conditions I don't fully understand where it simply doesn't work.
|
conditions I don't fully understand where it simply doesn't work.
|
||||||
- Removed BaseTime initialization from sdl/i_system.cpp as per Chris's
|
- Removed BaseTime initialization from sdl/i_system.cpp as per Chris's
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -25,18 +25,18 @@ typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data);
|
||||||
typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
|
typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
|
||||||
|
|
||||||
|
|
||||||
int YM3812Init(int num, int clock, int rate);
|
void *YM3812Init(int clock, int rate);
|
||||||
void YM3812Shutdown(void);
|
void YM3812Shutdown(void *chip);
|
||||||
void YM3812ResetChip(int which);
|
void YM3812ResetChip(void *chip);
|
||||||
int YM3812Write(int which, int a, int v);
|
int YM3812Write(void *chip, int a, int v);
|
||||||
unsigned char YM3812Read(int which, int a);
|
unsigned char YM3812Read(void *chip, int a);
|
||||||
int YM3812TimerOver(int which, int c);
|
int YM3812TimerOver(void *chip, int c);
|
||||||
void YM3812UpdateOne(int which, float *buffer, int length);
|
void YM3812UpdateOne(void *chip, float *buffer, int length);
|
||||||
|
|
||||||
void YM3812SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
|
void YM3812SetTimerHandler(void *chip, OPL_TIMERHANDLER TimerHandler, int channelOffset);
|
||||||
void YM3812SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
|
void YM3812SetIRQHandler(void *chip, OPL_IRQHANDLER IRQHandler, int param);
|
||||||
void YM3812SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
|
void YM3812SetUpdateHandler(void *chip, OPL_UPDATEHANDLER UpdateHandler, int param);
|
||||||
|
|
||||||
FString YM3812GetVoiceString();
|
FString YM3812GetVoiceString(void *chip);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -58,8 +58,8 @@ void OPLio::WriteDelay(int ticks)
|
||||||
|
|
||||||
void OPLio::OPLwriteReg(int which, uint reg, uchar data)
|
void OPLio::OPLwriteReg(int which, uint reg, uchar data)
|
||||||
{
|
{
|
||||||
YM3812Write (which, 0, reg);
|
YM3812Write (chips[which], 0, reg);
|
||||||
YM3812Write (which, 1, data);
|
YM3812Write (chips[which], 1, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -300,16 +300,28 @@ void OPLio::OPLshutup(void)
|
||||||
*/
|
*/
|
||||||
int OPLio::OPLinit(uint numchips)
|
int OPLio::OPLinit(uint numchips)
|
||||||
{
|
{
|
||||||
if (!YM3812Init (numchips, 3579545, int(OPL_SAMPLE_RATE)))
|
assert(numchips >= 1 && numchips <= 2);
|
||||||
|
chips[0] = YM3812Init (3579545, int(OPL_SAMPLE_RATE));
|
||||||
|
if (chips[0] != NULL)
|
||||||
{
|
{
|
||||||
OPLchannels = OPL2CHANNELS * numchips;
|
if (numchips > 1)
|
||||||
OPLwriteInitState();
|
{
|
||||||
return 0;
|
chips[1] = YM3812Init (3579545, int(OPL_SAMPLE_RATE));
|
||||||
|
if (chips[1] == NULL)
|
||||||
|
{
|
||||||
|
YM3812Shutdown(chips[0]);
|
||||||
|
chips[0] = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
OPLchannels = OPL2CHANNELS * numchips;
|
||||||
|
OPLwriteInitState();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPLio::OPLwriteInitState()
|
void OPLio::OPLwriteInitState()
|
||||||
|
@ -328,5 +340,8 @@ void OPLio::OPLwriteInitState()
|
||||||
*/
|
*/
|
||||||
void OPLio::OPLdeinit(void)
|
void OPLio::OPLdeinit(void)
|
||||||
{
|
{
|
||||||
YM3812Shutdown ();
|
YM3812Shutdown (chips[0]);
|
||||||
|
chips[0] = NULL;
|
||||||
|
YM3812Shutdown (chips[1]);
|
||||||
|
chips[1] = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,6 +184,7 @@ struct OPLio {
|
||||||
virtual void WriteDelay(int ticks);
|
virtual void WriteDelay(int ticks);
|
||||||
|
|
||||||
uint OPLchannels;
|
uint OPLchannels;
|
||||||
|
void *chips[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DiskWriterIO : public OPLio
|
struct DiskWriterIO : public OPLio
|
||||||
|
|
|
@ -207,11 +207,8 @@ bool OPLmusicBlock::ServiceStream (void *buff, int numbytes)
|
||||||
|
|
||||||
if (samplesleft > 0)
|
if (samplesleft > 0)
|
||||||
{
|
{
|
||||||
YM3812UpdateOne (0, samples1, samplesleft);
|
YM3812UpdateOne (io->chips[0], samples1, samplesleft);
|
||||||
if (TwoChips)
|
YM3812UpdateOne (io->chips[1], samples1, samplesleft);
|
||||||
{
|
|
||||||
YM3812UpdateOne (1, samples1, samplesleft);
|
|
||||||
}
|
|
||||||
OffsetSamples(samples1, samplesleft);
|
OffsetSamples(samples1, samplesleft);
|
||||||
assert(NextTickIn == ticky);
|
assert(NextTickIn == ticky);
|
||||||
NextTickIn -= samplesleft;
|
NextTickIn -= samplesleft;
|
||||||
|
@ -230,11 +227,8 @@ bool OPLmusicBlock::ServiceStream (void *buff, int numbytes)
|
||||||
{
|
{
|
||||||
if (numsamples > 0)
|
if (numsamples > 0)
|
||||||
{
|
{
|
||||||
YM3812UpdateOne (0, samples1, numsamples);
|
YM3812UpdateOne (io->chips[0], samples1, numsamples);
|
||||||
if (TwoChips)
|
YM3812UpdateOne (io->chips[1], samples1, numsamples);
|
||||||
{
|
|
||||||
YM3812UpdateOne (1, samples1, numsamples);
|
|
||||||
}
|
|
||||||
OffsetSamples(samples1, numsamples);
|
OffsetSamples(samples1, numsamples);
|
||||||
}
|
}
|
||||||
res = false;
|
res = false;
|
||||||
|
@ -448,10 +442,12 @@ int OPLmusicFile::PlayTick ()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
ADD_STAT (opl)
|
ADD_STAT (opl)
|
||||||
{
|
{
|
||||||
return YM3812GetVoiceString ();
|
return YM3812GetVoiceString ();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
OPLmusicFile::OPLmusicFile(const OPLmusicFile *source, const char *filename)
|
OPLmusicFile::OPLmusicFile(const OPLmusicFile *source, const char *filename)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue