mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-11 14:30:08 +00:00
Refactor : renamed methods and eliminated unused parameters
This commit is contained in:
parent
060c95e873
commit
433f079610
@ -1369,7 +1369,7 @@ static bool MB_DSInit()
|
||||
if(!audio_isAvailable)
|
||||
return false;
|
||||
|
||||
int hr = DSGetSoundBuffer(&MockingboardVoice, DSBCAPS_CTRLVOLUME, g_dwDSBufferSize, SAMPLE_RATE, 2);
|
||||
int hr = audio_createSoundBuffer(&MockingboardVoice, g_dwDSBufferSize, SAMPLE_RATE, 2);
|
||||
LOG("MB_DSInit: DSGetSoundBuffer(), hr=0x%08X\n", (unsigned int)hr);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
@ -1466,7 +1466,7 @@ static bool MB_DSInit()
|
||||
unsigned int nPhonemeByteLength = g_nPhonemeInfo[nPhoneme].nLength * sizeof(int16_t);
|
||||
|
||||
// NB. DSBCAPS_LOCSOFTWARE required for
|
||||
hr = DSGetSoundBuffer(&SSI263Voice[i], DSBCAPS_CTRLVOLUME+DSBCAPS_CTRLPOSITIONNOTIFY+DSBCAPS_LOCSOFTWARE, nPhonemeByteLength, 22050, 1);
|
||||
hr = audio_createSoundBuffer(&SSI263Voice[i], nPhonemeByteLength, 22050, 1);
|
||||
LOG("MB_DSInit: (%02d) DSGetSoundBuffer(), hr=0x%08X\n", i, (unsigned int)hr);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
@ -1614,7 +1614,7 @@ static void MB_DSUninit()
|
||||
MockingboardVoice->bActive = false;
|
||||
}
|
||||
|
||||
DSReleaseSoundBuffer(&MockingboardVoice);
|
||||
audio_destroySoundBuffer(&MockingboardVoice);
|
||||
|
||||
//
|
||||
|
||||
@ -1630,7 +1630,7 @@ static void MB_DSUninit()
|
||||
SSI263Voice[i]->bActive = false;
|
||||
}
|
||||
|
||||
DSReleaseSoundBuffer(&SSI263Voice[i]);
|
||||
audio_destroySoundBuffer(&SSI263Voice[i]);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -151,7 +151,7 @@ static void PlaylistDequeue(ALVoice *voice, ALPlayBuf *node)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static long openal_systemInit(const char *sound_device, AudioContext_s **audio_context)
|
||||
static long openal_systemSetup(const char *sound_device, AudioContext_s **audio_context)
|
||||
{
|
||||
assert(*audio_context == NULL);
|
||||
assert(voices == NULL);
|
||||
@ -821,7 +821,7 @@ __attribute__((constructor(CTOR_PRIORITY_EARLY)))
|
||||
static void _init_openal(void) {
|
||||
LOG("Initializing OpenAL sound system");
|
||||
|
||||
openal_audio_backend.init = &openal_systemInit;
|
||||
openal_audio_backend.setup = &openal_systemSetup;
|
||||
openal_audio_backend.shutdown = &openal_systemShutdown;
|
||||
openal_audio_backend.pause = &openal_systemPause;
|
||||
openal_audio_backend.resume = &openal_systemResume;
|
||||
|
@ -24,7 +24,7 @@ AudioBackend_s *audio_backend = NULL;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
long DSGetSoundBuffer(INOUT AudioBuffer_s **pVoice, unsigned long dwFlags, unsigned long dwBufferSize, unsigned long nSampleRate, int nChannels) {
|
||||
long audio_createSoundBuffer(INOUT AudioBuffer_s **pVoice, unsigned long dwBufferSize, unsigned long nSampleRate, int nChannels) {
|
||||
AudioParams_s params = { 0 };
|
||||
|
||||
params.nChannels = nChannels;
|
||||
@ -35,7 +35,7 @@ long DSGetSoundBuffer(INOUT AudioBuffer_s **pVoice, unsigned long dwFlags, unsig
|
||||
params.dwBufferBytes = dwBufferSize;
|
||||
|
||||
if (*pVoice) {
|
||||
DSReleaseSoundBuffer(pVoice);
|
||||
audio_destroySoundBuffer(pVoice);
|
||||
}
|
||||
|
||||
long err = 0;
|
||||
@ -49,8 +49,8 @@ long DSGetSoundBuffer(INOUT AudioBuffer_s **pVoice, unsigned long dwFlags, unsig
|
||||
return err;
|
||||
}
|
||||
|
||||
void DSReleaseSoundBuffer(INOUT AudioBuffer_s **pVoice) {
|
||||
audioContext->DestroySoundBuffer(pVoice);
|
||||
void audio_destroySoundBuffer(INOUT AudioBuffer_s **audioBuffer) {
|
||||
audioContext->DestroySoundBuffer(audioBuffer);
|
||||
}
|
||||
|
||||
bool audio_init(void) {
|
||||
|
@ -59,9 +59,15 @@ typedef struct AudioBuffer_s {
|
||||
|
||||
} AudioBuffer_s;
|
||||
|
||||
/*
|
||||
* Creates a sound buffer object.
|
||||
*/
|
||||
long audio_createSoundBuffer(INOUT AudioBuffer_s **audioBuffer, unsigned long bufferSize, unsigned long sampleRate, int numChannels);
|
||||
|
||||
long DSGetSoundBuffer(INOUT AudioBuffer_s **pVoice, unsigned long dwFlags, unsigned long dwBufferSize, unsigned long nSampleRate, int nChannels);
|
||||
void DSReleaseSoundBuffer(INOUT AudioBuffer_s **pVoice);
|
||||
/*
|
||||
* Destroy and nullify sound buffer object.
|
||||
*/
|
||||
void audio_destroySoundBuffer(INOUT AudioBuffer_s **pVoice);
|
||||
|
||||
/*
|
||||
* Prepare the audio subsystem, including the backend renderer.
|
||||
@ -109,7 +115,7 @@ typedef struct AudioContext_s {
|
||||
typedef struct AudioBackend_s {
|
||||
|
||||
// basic backend functionality controlled by soundcore
|
||||
PRIVATE long (*init)(const char *sound_device, INOUT AudioContext_s **audio_context);
|
||||
PRIVATE long (*setup)(const char *sound_device, INOUT AudioContext_s **audio_context);
|
||||
PRIVATE long (*shutdown)(INOUT AudioContext_s **audio_context);
|
||||
PRIVATE long (*enumerateDevices)(INOUT char ***sound_devices, const int maxcount);
|
||||
|
||||
|
@ -306,11 +306,11 @@ void speaker_destroy(void) {
|
||||
if (speakerBuffer) {
|
||||
speakerBuffer->Stop(speakerBuffer->_this);
|
||||
}
|
||||
DSReleaseSoundBuffer(&speakerBuffer);
|
||||
audio_destroySoundBuffer(&speakerBuffer);
|
||||
}
|
||||
|
||||
void speaker_init(void) {
|
||||
long err = DSGetSoundBuffer(&speakerBuffer, 0, SOUNDCORE_BUFFER_SIZE, SPKR_SAMPLE_RATE, 1);
|
||||
long err = audio_createSoundBuffer(&speakerBuffer, SOUNDCORE_BUFFER_SIZE, SPKR_SAMPLE_RATE, 1);
|
||||
assert(!err);
|
||||
_speaker_init_timing();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user