Cocoa OpenEmu Plug-in:
- Fix compiling by updating the sound processing code. Fixes bug #3549080 - http://sourceforge.net/tracker/?func=detail&aid=3549080&group_id=164579&atid=832291
This commit is contained in:
parent
98329bf085
commit
dae7f8f2dd
|
@ -22,4 +22,9 @@
|
||||||
#define DESMUME_COCOA
|
#define DESMUME_COCOA
|
||||||
#define HAVE_OPENGL
|
#define HAVE_OPENGL
|
||||||
#define HAVE_LIBZ
|
#define HAVE_LIBZ
|
||||||
|
|
||||||
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
|
#define HAVE_JIT
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PORT_VERSION "OpenEmu"
|
#define PORT_VERSION "OpenEmu"
|
|
@ -54,6 +54,7 @@
|
||||||
|
|
||||||
// Set up the emulation core
|
// Set up the emulation core
|
||||||
CommonSettings.advanced_timing = true;
|
CommonSettings.advanced_timing = true;
|
||||||
|
CommonSettings.use_jit = false;
|
||||||
[CocoaDSCore startupCore];
|
[CocoaDSCore startupCore];
|
||||||
|
|
||||||
// Set up the DS firmware using the internal firmware
|
// Set up the DS firmware using the internal firmware
|
||||||
|
|
|
@ -41,6 +41,8 @@ void SNDOpenEmuMuteAudio();
|
||||||
void SNDOpenEmuUnMuteAudio();
|
void SNDOpenEmuUnMuteAudio();
|
||||||
void SNDOpenEmuSetVolume(int volume);
|
void SNDOpenEmuSetVolume(int volume);
|
||||||
void SNDOpenEmuClearBuffer();
|
void SNDOpenEmuClearBuffer();
|
||||||
|
void SNDOpenEmuFetchSamples(s16 *sampleBuffer, size_t sampleCount, ESynchMode synchMode, ISynchronizingAudioBuffer *theSynchronizer);
|
||||||
|
size_t SNDOpenEmuPostProcessSamples(s16 *postProcessBuffer, size_t requestedSampleCount, ESynchMode synchMode, ISynchronizingAudioBuffer *theSynchronizer);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
|
|
||||||
OERingBuffer *openEmuSoundInterfaceBuffer = nil;
|
OERingBuffer *openEmuSoundInterfaceBuffer = nil;
|
||||||
|
static pthread_mutex_t *mutexAudioSampleReadWrite = NULL;
|
||||||
|
pthread_mutex_t *mutexAudioEmulateCore = NULL;
|
||||||
|
|
||||||
// Sound interface to the SPU
|
// Sound interface to the SPU
|
||||||
SoundInterface_struct SNDOpenEmu = {
|
SoundInterface_struct SNDOpenEmu = {
|
||||||
|
@ -33,7 +35,9 @@ SoundInterface_struct SNDOpenEmu = {
|
||||||
SNDOpenEmuMuteAudio,
|
SNDOpenEmuMuteAudio,
|
||||||
SNDOpenEmuUnMuteAudio,
|
SNDOpenEmuUnMuteAudio,
|
||||||
SNDOpenEmuSetVolume,
|
SNDOpenEmuSetVolume,
|
||||||
SNDOpenEmuClearBuffer
|
SNDOpenEmuClearBuffer,
|
||||||
|
SNDOpenEmuFetchSamples,
|
||||||
|
SNDOpenEmuPostProcessSamples
|
||||||
};
|
};
|
||||||
|
|
||||||
SoundInterface_struct *SNDCoreList[] = {
|
SoundInterface_struct *SNDCoreList[] = {
|
||||||
|
@ -46,12 +50,23 @@ int SNDOpenEmuInit(int buffer_size)
|
||||||
{
|
{
|
||||||
[openEmuSoundInterfaceBuffer setLength:buffer_size];
|
[openEmuSoundInterfaceBuffer setLength:buffer_size];
|
||||||
|
|
||||||
|
if (mutexAudioSampleReadWrite == NULL)
|
||||||
|
{
|
||||||
|
mutexAudioSampleReadWrite = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
|
||||||
|
pthread_mutex_init(mutexAudioSampleReadWrite, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SNDOpenEmuDeInit()
|
void SNDOpenEmuDeInit()
|
||||||
{
|
{
|
||||||
// Do nothing. The OpenEmu frontend will take care of this.
|
if (mutexAudioSampleReadWrite != NULL)
|
||||||
|
{
|
||||||
|
pthread_mutex_destroy(mutexAudioSampleReadWrite);
|
||||||
|
free(mutexAudioSampleReadWrite);
|
||||||
|
mutexAudioSampleReadWrite = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SNDOpenEmuReset()
|
int SNDOpenEmuReset()
|
||||||
|
@ -89,3 +104,46 @@ void SNDOpenEmuClearBuffer()
|
||||||
{
|
{
|
||||||
// Do nothing. The OpenEmu frontend will take care of this.
|
// Do nothing. The OpenEmu frontend will take care of this.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SNDOpenEmuFetchSamples(s16 *sampleBuffer, size_t sampleCount, ESynchMode synchMode, ISynchronizingAudioBuffer *theSynchronizer)
|
||||||
|
{
|
||||||
|
if (mutexAudioSampleReadWrite == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pthread_mutex_lock(mutexAudioSampleReadWrite);
|
||||||
|
SPU_DefaultFetchSamples(sampleBuffer, sampleCount, synchMode, theSynchronizer);
|
||||||
|
pthread_mutex_unlock(mutexAudioSampleReadWrite);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t SNDOpenEmuPostProcessSamples(s16 *postProcessBuffer, size_t requestedSampleCount, ESynchMode synchMode, ISynchronizingAudioBuffer *theSynchronizer)
|
||||||
|
{
|
||||||
|
size_t processedSampleCount = 0;
|
||||||
|
|
||||||
|
switch (synchMode)
|
||||||
|
{
|
||||||
|
case ESynchMode_DualSynchAsynch:
|
||||||
|
if (mutexAudioEmulateCore != NULL)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(mutexAudioEmulateCore);
|
||||||
|
processedSampleCount = SPU_DefaultPostProcessSamples(postProcessBuffer, requestedSampleCount, synchMode, theSynchronizer);
|
||||||
|
pthread_mutex_unlock(mutexAudioEmulateCore);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ESynchMode_Synchronous:
|
||||||
|
if (mutexAudioSampleReadWrite != NULL)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(mutexAudioSampleReadWrite);
|
||||||
|
processedSampleCount = SPU_DefaultPostProcessSamples(postProcessBuffer, requestedSampleCount, synchMode, theSynchronizer);
|
||||||
|
pthread_mutex_unlock(mutexAudioSampleReadWrite);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return processedSampleCount;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue