mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-06-28 13:29:29 +00:00
Refactor : remove unnecessary DSGetLock()
This commit is contained in:
parent
72389b941a
commit
060c95e873
|
@ -1089,15 +1089,10 @@ static void MB_Update()
|
|||
|
||||
//
|
||||
|
||||
#ifdef APPLE2IX
|
||||
if(DSGetLock(MockingboardVoice,
|
||||
if(MockingboardVoice->Lock(MockingboardVoice->_this,
|
||||
/*unused*/0, (unsigned long)nNumSamples*sizeof(short)*g_nMB_NumChannels,
|
||||
#else
|
||||
if(DSGetLock(MockingboardVoice,
|
||||
dwByteOffset, (unsigned long)nNumSamples*sizeof(short)*g_nMB_NumChannels,
|
||||
#endif
|
||||
&pDSLockedBuffer0, &dwDSLockedBufferSize0,
|
||||
&pDSLockedBuffer1, &dwDSLockedBufferSize1))
|
||||
&pDSLockedBuffer1, &dwDSLockedBufferSize1, 0))
|
||||
return;
|
||||
|
||||
#ifdef APPLE2IX
|
||||
|
@ -1479,11 +1474,7 @@ static bool MB_DSInit()
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef APPLE2IX
|
||||
hr = DSGetLock(SSI263Voice[i], 0, 0, &pDSLockedBuffer, &dwDSLockedBufferSize, NULL, 0);
|
||||
#else
|
||||
hr = DSGetLock(SSI263Voice[i], 0, 0, &pDSLockedBuffer, &dwDSLockedBufferSize, NULL, 0);
|
||||
#endif
|
||||
hr = SSI263Voice[i]->Lock(SSI263Voice[i]->_this, 0, 0, &pDSLockedBuffer, &dwDSLockedBufferSize, NULL, 0, 0);
|
||||
//LOG("MB_DSInit: (%02d) DSGetLock(), res=%d\n", i, hr ? 1 : 0); // WARNING: Lock acquired && doing heavy-weight logging
|
||||
if(FAILED(hr))
|
||||
{
|
||||
|
|
|
@ -540,7 +540,7 @@ static long ALGetPosition(void *_this, unsigned long *bytes_queued, unsigned lon
|
|||
}
|
||||
|
||||
// DS->Lock()
|
||||
static long ALBegin(void *_this, unsigned long unused, unsigned long write_bytes, void **audio_ptr1, unsigned long *audio_bytes1, void **unused_audio_ptr2, unsigned long *unused_audio_bytes2, unsigned long flags_unused)
|
||||
static long ALBegin(void *_this, unsigned long unused, unsigned long write_bytes, INOUT int16_t **audio_ptr1, INOUT unsigned long *audio_bytes1, void **unused_audio_ptr2, unsigned long *unused_audio_bytes2, unsigned long flags_unused)
|
||||
{
|
||||
ALVoice *voice = (ALVoice*)_this;
|
||||
|
||||
|
|
|
@ -24,26 +24,6 @@ AudioBackend_s *audio_backend = NULL;
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
long DSGetLock(AudioBuffer_s *pVoice, unsigned long dwOffset, unsigned long dwBytes, INOUT int16_t **ppDSLockedBuffer0, INOUT unsigned long *pdwDSLockedBufferSize0, INOUT int16_t **ppDSLockedBuffer1, INOUT unsigned long *pdwDSLockedBufferSize1) {
|
||||
|
||||
long err = 0;
|
||||
do {
|
||||
if (dwBytes == 0) {
|
||||
err = pVoice->Lock(pVoice->_this, 0, 0, (void**)ppDSLockedBuffer0, pdwDSLockedBufferSize0, (void**)ppDSLockedBuffer1, pdwDSLockedBufferSize1, 0);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
err = pVoice->Lock(pVoice->_this, dwOffset, dwBytes, (void**)ppDSLockedBuffer0, pdwDSLockedBufferSize0, (void**)ppDSLockedBuffer1, pdwDSLockedBufferSize1, 0);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
long DSGetSoundBuffer(INOUT AudioBuffer_s **pVoice, unsigned long dwFlags, unsigned long dwBufferSize, unsigned long nSampleRate, int nChannels) {
|
||||
AudioParams_s params = { 0 };
|
||||
|
||||
|
|
|
@ -46,10 +46,10 @@ typedef struct AudioBuffer_s {
|
|||
long (*Play)(void* _this, unsigned long dwReserved1, unsigned long dwReserved2, unsigned long dwFlags);
|
||||
|
||||
// This method obtains a valid write pointer to the sound buffer's audio data
|
||||
long (*Lock)(void* _this, unsigned long dwWriteCursor, unsigned long dwWriteBytes, void **lplpvAudioPtr1, unsigned long *lpdwAudioBytes1, void **lplpvAudioPtr2, unsigned long *lpdwAudioBytes2, unsigned long dwFlags);
|
||||
long (*Lock)(void* _this, unsigned long dwWriteCursor, unsigned long dwWriteBytes, INOUT int16_t **lplpvAudioPtr1, INOUT unsigned long *lpdwAudioBytes1, void **lplpvAudioPtr2, unsigned long *lpdwAudioBytes2, unsigned long dwFlags);
|
||||
|
||||
// This method releases a locked sound buffer.
|
||||
long (*Unlock)(void* _this, void *lpvAudioPtr1, unsigned long dwAudioBytes1, void *lpvAudioPtr2, unsigned long dwAudioBytes2);
|
||||
long (*Unlock)(void* _this, int16_t *lpvAudioPtr1, unsigned long dwAudioBytes1, void *lpvAudioPtr2, unsigned long dwAudioBytes2);
|
||||
|
||||
long (*GetStatus)(void* _this, unsigned long *lpdwStatus);
|
||||
|
||||
|
@ -60,7 +60,6 @@ typedef struct AudioBuffer_s {
|
|||
} AudioBuffer_s;
|
||||
|
||||
|
||||
long DSGetLock(AudioBuffer_s *bufferObj, unsigned long dwOffset, unsigned long dwBytes, INOUT int16_t **samplesBuf, INOUT unsigned long *samplesBufSz, INOUT int16_t **samplesBufAlt, INOUT unsigned long *samplesBufAltSz);
|
||||
long DSGetSoundBuffer(INOUT AudioBuffer_s **pVoice, unsigned long dwFlags, unsigned long dwBufferSize, unsigned long nSampleRate, int nChannels);
|
||||
void DSReleaseSoundBuffer(INOUT AudioBuffer_s **pVoice);
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ static void _submit_samples_buffer_fullspeed(void) {
|
|||
|
||||
unsigned long system_buffer_size = 0;
|
||||
int16_t *system_samples_buffer = NULL;
|
||||
if (DSGetLock(speakerBuffer, /*unused*/ 0, num_samples_pad*sizeof(int16_t), &system_samples_buffer, &system_buffer_size, NULL, NULL)) {
|
||||
if (speakerBuffer->Lock(speakerBuffer->_this, /*unused*/ 0, num_samples_pad*sizeof(int16_t), &system_samples_buffer, &system_buffer_size, NULL, NULL, 0)) {
|
||||
return;
|
||||
}
|
||||
assert(num_samples_pad*sizeof(int16_t) <= system_buffer_size);
|
||||
|
@ -230,7 +230,7 @@ static void _submit_samples_buffer_fullspeed(void) {
|
|||
system_samples_buffer[i] = speaker_data;
|
||||
}
|
||||
|
||||
speakerBuffer->Unlock(speakerBuffer->_this, (void*)system_samples_buffer, system_buffer_size, NULL, 0);
|
||||
speakerBuffer->Unlock(speakerBuffer->_this, system_samples_buffer, system_buffer_size, NULL, 0);
|
||||
}
|
||||
|
||||
// Submits samples from the samples_buffer to the audio system backend when running at a normal scaled-speed. This also
|
||||
|
@ -284,7 +284,7 @@ static unsigned int _submit_samples_buffer(const unsigned int num_samples) {
|
|||
unsigned long system_buffer_size = 0;
|
||||
int16_t *system_samples_buffer = NULL;
|
||||
|
||||
if (DSGetLock(speakerBuffer, /*unused*/0, (unsigned long)num_samples_to_use*sizeof(int16_t), &system_samples_buffer, &system_buffer_size, NULL, NULL)) {
|
||||
if (speakerBuffer->Lock(speakerBuffer->_this, /*unused*/0, (unsigned long)num_samples_to_use*sizeof(int16_t), &system_samples_buffer, &system_buffer_size, NULL, NULL, 0)) {
|
||||
return num_samples;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user