mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-09-27 09:56:08 +00:00
f234de116f
Squashed commit of the following: REFACTOR : fix comments, logging, and rename some variables REFACTOR : fix up some commentary, clean deadc0de REFACTOR : mostly fix all the audio glitches - amplitudes of samples are gradually shifted to zero when speaker has fallen silent - simplifies speaker state machine - fullspeed mode only enqueues quiet samples REFACTOR : fix up a number of other functions and comments REFACTOR : clean up code to submit normal speed wave buffer to OpenAL Move some initializations to the cpu_thread() REFACTOR : properly reset the speaker cycles access counter so we don't underflow and assert REFACTOR : should never get a split buffer from our soundcore implementation Fix warning from gcc ... static array size needs to be computed from integer values REFACTOR : gcc (but not clang) complains about these, so just make them preprocessor defines REFACTOR : use unsigned long long because we don't actually care that this counter is 64bit REFACTOR : remainder_buffer and miscellaneous tweaks - Adds implementation commentary to document remainder_buffer purpose - Also adds sample average for square wave boundary in case where remainder_buffer not used (whole-sample boundary) - Variable renaming and code shuffling REFACTOR : do not dynamically alloc remainder buffer - Never attribute to cache-coherancy bugs what is a simple thread race =P REFACTOR : comments and whitespace REFACTOR : rename public speaker API functions REFACTOR : clean up public speaker API REFACTOR : tabs to spaces REFACTOR : moar deadc0de clean up and renaming REFACTOR : remove deadc0de paths from soundcore REFACTOR : fully excise soundtype stuff now that we only support soundcard output Move a file static to function scope REFACTOR : rename more variables and remove deadc0de REFACTOR : samples_buffer naming and change to explict int16_t REFACTOR : removed deadc0de and shuffled code locations REFACTOR : remainder buffer naming and clarify type REFACTOR : move joystick timing to VM module and remove header visibility REFACTOR : clarify speaker variable name REFACTOR : clarify cycle counting codepaths REFACTOR : VBL/timing interfaces - eliminates passing around a common global REFACTOR : names and comments HACK around volume issue REFACTOR : rename speaker feedback variable REFACTOR : rename global total cycle count REFACTOR : rename a constant Fix test builds REFACTOR: rename to is_fullspeed REFACTOR : local variable naming changes REFACTOR : migrate cycle timing variables to correct location and remove header visibility Allow fullspeed codepath to update speaker REFACTOR : remove deadc0de paths in prep for cleanup REFACTOR : speaker now manages its own VM entry point
87 lines
2.4 KiB
C
87 lines
2.4 KiB
C
/*
|
|
* Apple // emulator for *nix
|
|
*
|
|
* This software package is subject to the GNU General Public License
|
|
* version 2 or later (your choice) as published by the Free Software
|
|
* Foundation.
|
|
*
|
|
* THERE ARE NO WARRANTIES WHATSOEVER.
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* Sources derived from AppleWin emulator
|
|
* Ported by Aaron Culliney
|
|
*/
|
|
|
|
#ifndef _SOUNDCORE_H_
|
|
#define _SOUNDCORE_H_
|
|
|
|
#include "audio/ds-shim.h"
|
|
|
|
#define MAX_SAMPLES (8*1024)
|
|
|
|
extern bool g_bDisableDirectSound;
|
|
|
|
typedef struct
|
|
{
|
|
LPDIRECTSOUNDBUFFER lpDSBvoice;
|
|
#ifdef APPLE2IX
|
|
// apparently lpDSNotify isn't used...
|
|
#define LPDIRECTSOUNDNOTIFY void*
|
|
#endif
|
|
LPDIRECTSOUNDNOTIFY lpDSNotify;
|
|
bool bActive; // Playback is active
|
|
bool bMute;
|
|
LONG nVolume; // Current volume (as used by DirectSound)
|
|
LONG nFadeVolume; // Current fade volume (as used by DirectSound)
|
|
DWORD dwUserVolume; // Volume from slider on Property Sheet (0=Max)
|
|
bool bIsSpeaker;
|
|
bool bRecentlyActive; // (Speaker only) false after 0.2s of speaker inactivity
|
|
} VOICE, *PVOICE;
|
|
|
|
|
|
bool DSGetLock(LPDIRECTSOUNDBUFFER pVoice, DWORD dwOffset, DWORD dwBytes,
|
|
SHORT** ppDSLockedBuffer0, DWORD* pdwDSLockedBufferSize0,
|
|
SHORT** ppDSLockedBuffer1, DWORD* pdwDSLockedBufferSize1);
|
|
|
|
HRESULT DSGetSoundBuffer(VOICE* pVoice, DWORD dwFlags, DWORD dwBufferSize, DWORD nSampleRate, int nChannels);
|
|
void DSReleaseSoundBuffer(VOICE* pVoice);
|
|
|
|
bool DSZeroVoiceBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSize);
|
|
bool DSZeroVoiceWritableBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSize);
|
|
|
|
typedef enum eFADE {FADE_NONE, FADE_IN, FADE_OUT} eFADE;
|
|
void SoundCore_SetFade(eFADE FadeType);
|
|
|
|
int SoundCore_GetErrorInc();
|
|
void SoundCore_SetErrorInc(const int nErrorInc);
|
|
int SoundCore_GetErrorMax();
|
|
void SoundCore_SetErrorMax(const int nErrorMax);
|
|
|
|
bool DSInit();
|
|
void DSUninit();
|
|
|
|
LONG NewVolume(DWORD dwVolume, DWORD dwVolumeMax);
|
|
|
|
void SysClk_WaitTimer();
|
|
bool SysClk_InitTimer();
|
|
void SysClk_UninitTimer();
|
|
void SysClk_StartTimerUsec(DWORD dwUsecPeriod);
|
|
void SysClk_StopTimer();
|
|
|
|
//
|
|
|
|
extern bool g_bDSAvailable;
|
|
|
|
#ifdef APPLE2IX
|
|
typedef struct IDirectSound SoundSystemStruct;
|
|
long SoundSystemCreate(const char *sound_device, SoundSystemStruct **sound_struct);
|
|
long SoundSystemDestroy(SoundSystemStruct **sound_struct);
|
|
long SoundSystemPause();
|
|
long SoundSystemUnpause();
|
|
long SoundSystemEnumerate(char ***sound_devices, const int maxcount);
|
|
#endif
|
|
|
|
#endif /* whole file */
|