mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-16 01:31:06 +00:00
Refactor : simplify function-pointer assignment
This commit is contained in:
parent
538b0aacd7
commit
6a12ae4081
@ -766,19 +766,18 @@ static long OpenALCreateSoundBuffer(const AudioParams_s *params, INOUT AudioBuff
|
||||
}
|
||||
|
||||
(*soundbuf_struct)->_this = voice;
|
||||
(*soundbuf_struct)->SetVolume = (int (*)(void *, long))ALSetVolume;
|
||||
(*soundbuf_struct)->GetVolume = (int (*)(void *, long *))ALGetVolume;
|
||||
(*soundbuf_struct)->GetCurrentPosition = (int (*)(void *, unsigned long *, unsigned long *))ALGetPosition;
|
||||
(*soundbuf_struct)->Stop = (int (*)(void *))ALStop;
|
||||
(*soundbuf_struct)->Restore = (int (*)(void *))ALRestore;
|
||||
(*soundbuf_struct)->Play = (int (*)(void *, unsigned long, unsigned long, unsigned long))ALPlay;
|
||||
(*soundbuf_struct)->Lock = (int (*)(void *, unsigned long, unsigned long, void **, unsigned long *, void **, unsigned long *, unsigned long))ALBegin;
|
||||
(*soundbuf_struct)->Unlock = (int (*)(void *, void *, unsigned long, void *, unsigned long))ALCommit;
|
||||
(*soundbuf_struct)->GetStatus = (int (*)(void *, unsigned long *))ALGetStatus;
|
||||
|
||||
(*soundbuf_struct)->SetVolume = &ALSetVolume;
|
||||
(*soundbuf_struct)->GetVolume = &ALGetVolume;
|
||||
(*soundbuf_struct)->GetCurrentPosition = &ALGetPosition;
|
||||
(*soundbuf_struct)->Stop = &ALStop;
|
||||
(*soundbuf_struct)->Restore = &ALRestore;
|
||||
(*soundbuf_struct)->Play = &ALPlay;
|
||||
(*soundbuf_struct)->Lock = &ALBegin;
|
||||
(*soundbuf_struct)->Unlock = &ALCommit;
|
||||
(*soundbuf_struct)->GetStatus = &ALGetStatus;
|
||||
// mockingboard-specific hacks
|
||||
(*soundbuf_struct)->UnlockStaticBuffer = (int (*)(void *, unsigned long))ALCommitStaticBuffer;
|
||||
(*soundbuf_struct)->Replay = (int (*)(void *))ALReplay;
|
||||
(*soundbuf_struct)->UnlockStaticBuffer = &ALCommitStaticBuffer;
|
||||
(*soundbuf_struct)->Replay = &ALReplay;
|
||||
|
||||
return 0;
|
||||
} while(0);
|
||||
|
@ -25,30 +25,30 @@ typedef struct AudioBuffer_s {
|
||||
|
||||
void *_this;
|
||||
|
||||
int (*SetVolume)(void* _this, long lVolume);
|
||||
long (*SetVolume)(void* _this, long lVolume);
|
||||
|
||||
int (*GetVolume)(void* _this, long *lplVolume);
|
||||
long (*GetVolume)(void* _this, long *lplVolume);
|
||||
|
||||
int (*GetCurrentPosition)(void* _this, unsigned long *lpdwCurrentPlayCursor, unsigned long *lpdwCurrentWriteCursor);
|
||||
long (*GetCurrentPosition)(void* _this, unsigned long *lpdwCurrentPlayCursor, unsigned long *lpdwCurrentWriteCursor);
|
||||
|
||||
int (*Stop)(void* _this);
|
||||
long (*Stop)(void* _this);
|
||||
|
||||
// This method restores the memory allocation for a lost sound buffer for the specified DirectSoundBuffer object.
|
||||
int (*Restore)(void *_this);
|
||||
long (*Restore)(void *_this);
|
||||
|
||||
int (*Play)(void* _this, unsigned long dwReserved1, unsigned long dwReserved2, unsigned long dwFlags);
|
||||
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
|
||||
int (*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, void **lplpvAudioPtr1, unsigned long *lpdwAudioBytes1, void **lplpvAudioPtr2, unsigned long *lpdwAudioBytes2, unsigned long dwFlags);
|
||||
|
||||
// This method releases a locked sound buffer.
|
||||
int (*Unlock)(void* _this, void *lpvAudioPtr1, unsigned long dwAudioBytes1, void *lpvAudioPtr2, unsigned long dwAudioBytes2);
|
||||
long (*Unlock)(void* _this, void *lpvAudioPtr1, unsigned long dwAudioBytes1, void *lpvAudioPtr2, unsigned long dwAudioBytes2);
|
||||
|
||||
int (*GetStatus)(void* _this, unsigned long *lpdwStatus);
|
||||
long (*GetStatus)(void* _this, unsigned long *lpdwStatus);
|
||||
|
||||
// Mockingboard-specific HACKS
|
||||
int (*UnlockStaticBuffer)(void* _this, unsigned long dwAudioBytes);
|
||||
int (*Replay)(void* _this);
|
||||
long (*UnlockStaticBuffer)(void* _this, unsigned long dwAudioBytes);
|
||||
long (*Replay)(void* _this);
|
||||
|
||||
} AudioBuffer_s;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user