Fixed MFC for my previous commit
This commit is contained in:
parent
8bc8270984
commit
a67fe271a9
|
@ -365,6 +365,7 @@ void flush_samples(Multi_Buffer * buffer)
|
|||
soundResume();
|
||||
|
||||
soundDriver->write(soundFinalWave, soundBufferLen);
|
||||
systemOnWriteDataToSoundBuffer(soundFinalWave, soundBufferLen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -469,19 +470,27 @@ static void remake_stereo_buffer()
|
|||
|
||||
void soundShutdown()
|
||||
{
|
||||
delete soundDriver;
|
||||
if (soundDriver)
|
||||
{
|
||||
delete soundDriver;
|
||||
soundDriver = 0;
|
||||
}
|
||||
|
||||
systemOnSoundShutdown();
|
||||
}
|
||||
|
||||
void soundPause()
|
||||
{
|
||||
soundPaused = true;
|
||||
soundDriver->pause();
|
||||
if (soundDriver)
|
||||
soundDriver->pause();
|
||||
}
|
||||
|
||||
void soundResume()
|
||||
{
|
||||
soundPaused = false;
|
||||
soundDriver->resume();
|
||||
if (soundDriver)
|
||||
soundDriver->resume();
|
||||
}
|
||||
|
||||
void soundSetVolume( float volume )
|
||||
|
@ -532,6 +541,11 @@ bool soundInit()
|
|||
return true;
|
||||
}
|
||||
|
||||
int soundGetQuality()
|
||||
{
|
||||
return soundQuality;
|
||||
}
|
||||
|
||||
void soundSetQuality(int quality)
|
||||
{
|
||||
if ( soundQuality != quality )
|
||||
|
|
|
@ -36,6 +36,7 @@ void soundShutdown();
|
|||
//// GBA sound options
|
||||
|
||||
// Sets sample rate to 44100 / quality
|
||||
int soundGetQuality();
|
||||
void soundSetQuality( int quality );
|
||||
|
||||
// Sound settings
|
||||
|
|
|
@ -67,6 +67,8 @@ extern u32 systemGetClock();
|
|||
extern void systemMessage(int, const char *, ...);
|
||||
extern void systemSetTitle(const char *);
|
||||
extern SoundDriver * systemSoundInit();
|
||||
extern void systemOnWriteDataToSoundBuffer(const u16 * finalWave, int length);
|
||||
extern void systemOnSoundShutdown();
|
||||
extern void systemScreenMessage(const char *);
|
||||
extern void systemUpdateMotionSensor();
|
||||
extern int systemGetSensorX();
|
||||
|
|
|
@ -161,6 +161,14 @@ SoundDriver * systemSoundInit()
|
|||
return new SoundSDL();
|
||||
}
|
||||
|
||||
void systemOnSoundShutdown()
|
||||
{
|
||||
}
|
||||
|
||||
void systemOnWriteDataToSoundBuffer(const u16 * finalWave, int length)
|
||||
{
|
||||
}
|
||||
|
||||
void debuggerMain()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -2716,3 +2716,11 @@ SoundDriver * systemSoundInit()
|
|||
|
||||
return new SoundSDL();
|
||||
}
|
||||
|
||||
void systemOnSoundShutdown()
|
||||
{
|
||||
}
|
||||
|
||||
void systemOnWriteDataToSoundBuffer(const u16 * finalWave, int length)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "../agb/GBA.h"
|
||||
#include "../Globals.h"
|
||||
#include "../Sound.h"
|
||||
#include "../common/SoundDriver.h"
|
||||
|
||||
// DirectSound8
|
||||
#include <dsound.h>
|
||||
|
|
|
@ -1531,8 +1531,8 @@ void MainWnd::OnUpdateOptionsEmulatorGameoverrides(CCmdUI* pCmdUI)
|
|||
void MainWnd::OnOptionsSoundHardwareacceleration()
|
||||
{
|
||||
theApp.dsoundDisableHardwareAcceleration = !theApp.dsoundDisableHardwareAcceleration;
|
||||
systemSoundShutdown();
|
||||
systemSoundInit();
|
||||
soundShutdown();
|
||||
soundInit();
|
||||
}
|
||||
|
||||
void MainWnd::OnUpdateOptionsSoundHardwareacceleration(CCmdUI *pCmdUI)
|
||||
|
@ -1556,8 +1556,8 @@ void MainWnd::OnOutputapiDirectsound()
|
|||
{
|
||||
if( theApp.audioAPI != DIRECTSOUND ) {
|
||||
theApp.audioAPI = DIRECTSOUND;
|
||||
systemSoundShutdown();
|
||||
systemSoundInit();
|
||||
soundShutdown();
|
||||
soundInit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1572,8 +1572,8 @@ void MainWnd::OnOutputapiXaudio2()
|
|||
#ifndef NO_XAUDIO2
|
||||
if( theApp.audioAPI != XAUDIO2 ) {
|
||||
theApp.audioAPI = XAUDIO2;
|
||||
systemSoundShutdown();
|
||||
systemSoundInit();
|
||||
soundShutdown();
|
||||
soundInit();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1593,8 +1593,8 @@ void MainWnd::OnOutputapiOpenal()
|
|||
#ifndef NO_OAL
|
||||
if( theApp.audioAPI != OPENAL_SOUND ) {
|
||||
theApp.audioAPI = OPENAL_SOUND;
|
||||
systemSoundShutdown();
|
||||
systemSoundInit();
|
||||
soundShutdown();
|
||||
soundInit();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1618,7 +1618,7 @@ void MainWnd::OnOutputapiOalconfiguration()
|
|||
dlg.bufferCount = theApp.oalBufferCount;
|
||||
|
||||
if( dlg.DoModal() == IDOK ) {
|
||||
systemSoundShutdown();
|
||||
soundShutdown();
|
||||
// do this before changing any values OpenAL
|
||||
// might need for successful cleanup
|
||||
|
||||
|
@ -1631,7 +1631,7 @@ void MainWnd::OnOutputapiOalconfiguration()
|
|||
_tcscpy( theApp.oalDevice, dlg.selectedDevice.GetBuffer() );
|
||||
theApp.oalBufferCount = dlg.bufferCount;
|
||||
|
||||
systemSoundInit();
|
||||
soundInit();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1655,13 +1655,13 @@ void MainWnd::OnOutputapiXaudio2config()
|
|||
dlg.m_enable_upmixing = theApp.xa2Upmixing;
|
||||
|
||||
if( dlg.DoModal() == IDOK ) {
|
||||
systemSoundShutdown();
|
||||
soundShutdown();
|
||||
|
||||
theApp.xa2Device = dlg.m_selected_device_index;
|
||||
theApp.xa2BufferCount = dlg.m_buffer_count;
|
||||
theApp.xa2Upmixing = dlg.m_enable_upmixing;
|
||||
|
||||
systemSoundInit();
|
||||
soundInit();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -397,7 +397,7 @@ void MainWnd::OnToolsRecordStartavirecording()
|
|||
// add audio stream
|
||||
ret = theApp.aviRecorder->CreateAudioStream(
|
||||
2,
|
||||
44100 / soundQuality,
|
||||
44100 / soundGetQuality(),
|
||||
16,
|
||||
this->GetSafeHwnd()
|
||||
);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "../dmg/gbGlobals.h"
|
||||
#include "../dmg/gbPrinter.h"
|
||||
#include "../dmg/gbSound.h"
|
||||
#include "../common/SoundDriver.h"
|
||||
|
||||
/* Link
|
||||
---------------------*/
|
||||
|
@ -291,7 +292,6 @@ VBA::VBA()
|
|||
soundRecording = false;
|
||||
soundRecorder = NULL;
|
||||
dsoundDisableHardwareAcceleration = true;
|
||||
sound = NULL;
|
||||
aviRecording = false;
|
||||
aviRecorder = NULL;
|
||||
painting = false;
|
||||
|
@ -960,9 +960,8 @@ void VBA::updateThrottle( unsigned short throttle )
|
|||
systemFrameSkip = 0;
|
||||
}
|
||||
|
||||
if( theApp.sound ) {
|
||||
theApp.sound->setThrottle( throttle );
|
||||
}
|
||||
soundShutdown();
|
||||
soundInit();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1235,39 +1234,37 @@ int systemGetSensorY()
|
|||
}
|
||||
|
||||
|
||||
bool systemSoundInit()
|
||||
SoundDriver * systemSoundInit()
|
||||
{
|
||||
systemSoundShutdown();
|
||||
SoundDriver * drv = 0;
|
||||
soundShutdown();
|
||||
|
||||
switch( theApp.audioAPI )
|
||||
{
|
||||
case DIRECTSOUND:
|
||||
theApp.sound = newDirectSound();
|
||||
drv = newDirectSound();
|
||||
break;
|
||||
#ifndef NO_OAL
|
||||
case OPENAL_SOUND:
|
||||
theApp.sound = newOpenAL();
|
||||
drv = newOpenAL();
|
||||
break;
|
||||
#endif
|
||||
#ifndef NO_XAUDIO2
|
||||
case XAUDIO2:
|
||||
theApp.sound = newXAudio2_Output();
|
||||
drv = newXAudio2_Output();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool retVal = theApp.sound->init(soundQuality);
|
||||
soundBufferLen = theApp.sound->getBufferLength();
|
||||
|
||||
if( retVal ) {
|
||||
theApp.sound->setThrottle( theApp.throttle );
|
||||
if( drv ) {
|
||||
drv->setThrottle( theApp.throttle );
|
||||
}
|
||||
|
||||
return retVal;
|
||||
return drv;
|
||||
}
|
||||
|
||||
|
||||
void systemSoundShutdown()
|
||||
void systemOnSoundShutdown()
|
||||
{
|
||||
if( theApp.aviRecorder ) {
|
||||
delete theApp.aviRecorder;
|
||||
|
@ -1281,38 +1278,13 @@ void systemSoundShutdown()
|
|||
theApp.soundRecorder = NULL;
|
||||
}
|
||||
theApp.soundRecording = false;
|
||||
|
||||
|
||||
if( theApp.sound ) {
|
||||
delete theApp.sound;
|
||||
theApp.sound = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void systemSoundPause()
|
||||
{
|
||||
if(theApp.sound)
|
||||
theApp.sound->pause();
|
||||
}
|
||||
|
||||
void systemSoundReset()
|
||||
{
|
||||
if(theApp.sound)
|
||||
theApp.sound->reset();
|
||||
}
|
||||
|
||||
void systemSoundResume()
|
||||
{
|
||||
if(theApp.sound)
|
||||
theApp.sound->resume();
|
||||
}
|
||||
|
||||
void systemWriteDataToSoundBuffer()
|
||||
void systemOnWriteDataToSoundBuffer(const u16 * finalWave, int length)
|
||||
{
|
||||
if( theApp.soundRecording ) {
|
||||
if( theApp.soundRecorder ) {
|
||||
theApp.soundRecorder->AddSound( (const u8 *)soundFinalWave, soundBufferLen );
|
||||
theApp.soundRecorder->AddSound( (const u8 *)finalWave, length );
|
||||
} else {
|
||||
WAVEFORMATEX format;
|
||||
format.cbSize = 0;
|
||||
|
@ -1333,7 +1305,7 @@ void systemWriteDataToSoundBuffer()
|
|||
if( theApp.skipAudioFrames ) {
|
||||
theApp.skipAudioFrames--;
|
||||
} else {
|
||||
if( false == theApp.aviRecorder->AddAudioFrame( soundFinalWave ) ) {
|
||||
if( false == theApp.aviRecorder->AddAudioFrame( ( u8 *)finalWave ) ) {
|
||||
systemMessage( IDS_AVI_CANNOT_WRITE_AUDIO, "Cannot write audio frame to AVI file." );
|
||||
delete theApp.aviRecorder;
|
||||
theApp.aviRecorder = NULL;
|
||||
|
@ -1341,10 +1313,6 @@ void systemWriteDataToSoundBuffer()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( theApp.sound ) {
|
||||
theApp.sound->write(soundFinalWave, soundBufferLen);
|
||||
}
|
||||
}
|
||||
|
||||
bool systemCanChangeSoundQuality()
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "Display.h"
|
||||
#include "Input.h"
|
||||
#include "IUpdate.h"
|
||||
#include "../common/SoundDriver.h"
|
||||
#include "../System.h"
|
||||
#include "../Util.h"
|
||||
|
||||
|
@ -170,7 +169,6 @@ class VBA : public CWinApp
|
|||
WavWriter *soundRecorder;
|
||||
CString soundRecordName;
|
||||
bool dsoundDisableHardwareAcceleration;
|
||||
SoundDriver *sound;
|
||||
bool aviRecording;
|
||||
AVIWrite *aviRecorder;
|
||||
CString aviRecordName;
|
||||
|
|
Loading…
Reference in New Issue