make sound & AVI recording independent from sound output
git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@203 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
parent
6ba79876a2
commit
f05d2b145e
|
@ -264,41 +264,11 @@ void DirectSound::write()
|
|||
HRESULT hr;
|
||||
DWORD status = 0;
|
||||
DWORD play = 0;
|
||||
WAVEFORMATEX format;
|
||||
LPVOID lpvPtr1;
|
||||
DWORD dwBytes1 = 0;
|
||||
LPVOID lpvPtr2;
|
||||
DWORD dwBytes2 = 0;
|
||||
|
||||
|
||||
if( theApp.soundRecording ) {
|
||||
if( dsbSecondary ) {
|
||||
if( theApp.soundRecorder ) {
|
||||
theApp.soundRecorder->AddSound( (u8 *)soundFinalWave, soundBufferLen );
|
||||
} else {
|
||||
theApp.soundRecorder = new WavWriter;
|
||||
dsbSecondary->GetFormat( &format, sizeof(format), NULL );
|
||||
if( theApp.soundRecorder->Open( theApp.soundRecordName ) ) {
|
||||
theApp.soundRecorder->SetFormat( &format );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( theApp.aviRecording ) {
|
||||
if( theApp.aviRecorder ) {
|
||||
if( dsbSecondary ) {
|
||||
if( !theApp.aviRecorder->IsSoundAdded() ) {
|
||||
dsbSecondary->GetFormat( &format, sizeof(format), NULL );
|
||||
theApp.aviRecorder->SetSoundFormat( &format );
|
||||
}
|
||||
}
|
||||
theApp.aviRecorder->AddSound( (const char *)soundFinalWave, soundBufferLen );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( !speedup && synchronize && !theApp.throttle ) {
|
||||
hr = dsbSecondary->GetStatus(&status);
|
||||
if( status & DSBSTATUS_PLAYING ) {
|
||||
|
|
|
@ -1252,8 +1252,43 @@ void systemSoundResume()
|
|||
|
||||
void systemWriteDataToSoundBuffer()
|
||||
{
|
||||
if(theApp.sound)
|
||||
theApp.sound->write();
|
||||
if( theApp.soundRecording ) {
|
||||
if( theApp.soundRecorder ) {
|
||||
theApp.soundRecorder->AddSound( (const u8 *)soundFinalWave, soundBufferLen );
|
||||
} else {
|
||||
WAVEFORMATEX format;
|
||||
format.cbSize = 0;
|
||||
format.wFormatTag = WAVE_FORMAT_PCM;
|
||||
format.nChannels = 2;
|
||||
format.nSamplesPerSec = 44100 / soundQuality;
|
||||
format.wBitsPerSample = 16;
|
||||
format.nBlockAlign = format.nChannels * ( format.wBitsPerSample >> 3 );
|
||||
format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign;
|
||||
theApp.soundRecorder = new WavWriter;
|
||||
if( theApp.soundRecorder->Open( theApp.soundRecordName ) ) {
|
||||
theApp.soundRecorder->SetFormat( &format );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( theApp.aviRecording && theApp.aviRecorder ) {
|
||||
if( !theApp.aviRecorder->IsSoundAdded() ) {
|
||||
WAVEFORMATEX format;
|
||||
format.cbSize = 0;
|
||||
format.wFormatTag = WAVE_FORMAT_PCM;
|
||||
format.nChannels = 2;
|
||||
format.nSamplesPerSec = 44100 / soundQuality;
|
||||
format.wBitsPerSample = 16;
|
||||
format.nBlockAlign = format.nChannels * ( format.wBitsPerSample >> 3 );
|
||||
format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign;
|
||||
theApp.aviRecorder->SetSoundFormat( &format );
|
||||
}
|
||||
theApp.aviRecorder->AddSound( (const char *)soundFinalWave, soundBufferLen );
|
||||
}
|
||||
|
||||
if( theApp.sound ) {
|
||||
theApp.sound->write();
|
||||
}
|
||||
}
|
||||
|
||||
bool systemCanChangeSoundQuality()
|
||||
|
|
Loading…
Reference in New Issue