Do less to update the frequency of an active SB DMA transfer, and include DSP command 0x41 (fixes SB16 sound in Tempest 2000). Handle DSP command 0x42 as unimplemented, because it is.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3896
This commit is contained in:
		
							parent
							
								
									3c8a5bdc95
								
							
						
					
					
						commit
						6cec6d144b
					
				
					 1 changed files with 15 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -758,6 +758,16 @@ static void DSP_ADC_CallBack(DmaChannel * /*chan*/, DMAEvent event) {
 | 
			
		|||
	ch->Register_Callback(0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void DSP_ChangeRate(Bitu freq) {
 | 
			
		||||
	if (sb.freq!=freq && sb.dma.mode!=DSP_DMA_NONE) {
 | 
			
		||||
		sb.chan->FillUp();
 | 
			
		||||
		sb.chan->SetFreq(freq / (sb.mixer.stereo ? 2 : 1));
 | 
			
		||||
		sb.dma.rate=(freq*sb.dma.mul) >> SB_SH;
 | 
			
		||||
		sb.dma.min=(sb.dma.rate*3)/1000;
 | 
			
		||||
	}
 | 
			
		||||
	sb.freq=freq;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bitu DEBUG_EnableDebugger(void);
 | 
			
		||||
 | 
			
		||||
#define DSP_SB16_ONLY if (sb.type != SBT_16) { LOG(LOG_SB,LOG_ERROR)("DSP:Command %2X requires SB16",sb.dsp.cmd); break; }
 | 
			
		||||
| 
						 | 
				
			
			@ -845,16 +855,14 @@ static void DSP_DoCommand(void) {
 | 
			
		|||
		if (sb.midi == true) MIDI_RawOutByte(sb.dsp.in.data[0]);
 | 
			
		||||
		break;
 | 
			
		||||
	case 0x40:	/* Set Timeconstant */
 | 
			
		||||
		sb.freq=(1000000 / (256 - sb.dsp.in.data[0]));
 | 
			
		||||
		/* Nasty kind of hack to allow runtime changing of frequency */
 | 
			
		||||
		if (sb.dma.mode != DSP_DMA_NONE && sb.dma.autoinit) {
 | 
			
		||||
			DSP_PrepareDMA_Old(sb.dma.mode,sb.dma.autoinit,sb.dma.sign);
 | 
			
		||||
		}
 | 
			
		||||
		DSP_ChangeRate(1000000 / (256 - sb.dsp.in.data[0]));
 | 
			
		||||
		break;
 | 
			
		||||
	case 0x41:	/* Set Output Samplerate */
 | 
			
		||||
	case 0x42:	/* Set Input Samplerate */
 | 
			
		||||
		DSP_SB16_ONLY;
 | 
			
		||||
		sb.freq=(sb.dsp.in.data[0] << 8)  | sb.dsp.in.data[1];
 | 
			
		||||
		DSP_ChangeRate((sb.dsp.in.data[0] << 8) | sb.dsp.in.data[1]);
 | 
			
		||||
		break;
 | 
			
		||||
	case 0x42:	/* Set Input Samplerate */
 | 
			
		||||
		LOG(LOG_SB,LOG_ERROR)("DSP:Unimplemented input sample rate command");
 | 
			
		||||
		break;
 | 
			
		||||
	case 0x48:	/* Set DMA Block Size */
 | 
			
		||||
		DSP_SB2_ABOVE;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue