mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-22 01:31:25 +00:00
SSI263: for amplitude (reg3), now scale the samples and not SetVolume().
Reason: calling SetVolume() in Play() is too early, and the previous phoneme won't have completed. Getting the timing right will be difficult, so better to just manipulate the samples as they get written to the playback buffer.
This commit is contained in:
parent
1e65528763
commit
80c1150183
@ -312,15 +312,6 @@ void SSI263::Play(unsigned int nPhoneme)
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD volume = 0; // 0=max
|
||||
if (!m_isVotraxPhoneme)
|
||||
volume = AMPLITUDE_MASK - (m_ctrlArtAmp & AMPLITUDE_MASK); // Invert so that: 0=max, 15=min
|
||||
|
||||
SSI263SingleVoice.nVolume = NewVolume(volume*volume, AMPLITUDE_MASK*AMPLITUDE_MASK); // logarithmic, but amplitude<8 can't be heard
|
||||
HRESULT hr = SSI263SingleVoice.lpDSBvoice->SetVolume(SSI263SingleVoice.nVolume);
|
||||
if (hr != S_OK)
|
||||
LogFileOutput("SSI263::Play: SetVolume(%d) res = %08X\n", SSI263SingleVoice.nVolume, hr);
|
||||
|
||||
if (m_dbgFirst)
|
||||
{
|
||||
m_dbgStartTime = g_nCumulativeCycles;
|
||||
@ -565,6 +556,8 @@ void SSI263::Update(void)
|
||||
|
||||
//-------------
|
||||
|
||||
const double amplitude = !m_isVotraxPhoneme ? (double)(m_ctrlArtAmp & AMPLITUDE_MASK) / (double)AMPLITUDE_MASK : 1.0;
|
||||
|
||||
bool bSpeechIRQ = false;
|
||||
|
||||
{
|
||||
@ -581,7 +574,8 @@ void SSI263::Update(void)
|
||||
UINT samplesWritten = 0;
|
||||
while (samplesWritten < (UINT)nNumSamples)
|
||||
{
|
||||
m_currSampleSum += (int)*m_pPhonemeData;
|
||||
double sample = (double)*m_pPhonemeData * amplitude;
|
||||
m_currSampleSum += (int)sample;
|
||||
m_currNumSamples++;
|
||||
|
||||
m_pPhonemeData++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user