PcmResampleFallback: use PcmBuffer instead of PcmResampler
Lighter API.
This commit is contained in:
		@@ -101,7 +101,7 @@ PcmResampler::ResampleFloat(unsigned channels, unsigned src_rate,
 | 
				
			|||||||
	   not do any math on the sample values, so this hack is
 | 
						   not do any math on the sample values, so this hack is
 | 
				
			||||||
	   possible: */
 | 
						   possible: */
 | 
				
			||||||
	return (const float *)
 | 
						return (const float *)
 | 
				
			||||||
		pcm_resample_fallback_32(this, channels,
 | 
							pcm_resample_fallback_32(buffer, channels,
 | 
				
			||||||
					 src_rate, (const int32_t *)src_buffer,
 | 
										 src_rate, (const int32_t *)src_buffer,
 | 
				
			||||||
					 src_size,
 | 
										 src_size,
 | 
				
			||||||
					 dest_rate, dest_size_r);
 | 
										 dest_rate, dest_size_r);
 | 
				
			||||||
@@ -123,7 +123,7 @@ PcmResampler::Resample16(unsigned channels,
 | 
				
			|||||||
	(void)error_r;
 | 
						(void)error_r;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pcm_resample_fallback_16(this, channels,
 | 
						return pcm_resample_fallback_16(buffer, channels,
 | 
				
			||||||
					src_rate, src_buffer, src_size,
 | 
										src_rate, src_buffer, src_size,
 | 
				
			||||||
					dest_rate, dest_size_r);
 | 
										dest_rate, dest_size_r);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -144,7 +144,7 @@ PcmResampler::Resample32(unsigned channels, unsigned src_rate,
 | 
				
			|||||||
	(void)error_r;
 | 
						(void)error_r;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pcm_resample_fallback_32(this, channels,
 | 
						return pcm_resample_fallback_32(buffer, channels,
 | 
				
			||||||
					src_rate, src_buffer, src_size,
 | 
										src_rate, src_buffer, src_size,
 | 
				
			||||||
					dest_rate, dest_size_r);
 | 
										dest_rate, dest_size_r);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* resampling code blatantly ripped from ESD */
 | 
					/* resampling code blatantly ripped from ESD */
 | 
				
			||||||
const int16_t *
 | 
					const int16_t *
 | 
				
			||||||
pcm_resample_fallback_16(PcmResampler *state,
 | 
					pcm_resample_fallback_16(PcmBuffer &buffer,
 | 
				
			||||||
			 unsigned channels,
 | 
								 unsigned channels,
 | 
				
			||||||
			 unsigned src_rate,
 | 
								 unsigned src_rate,
 | 
				
			||||||
			 const int16_t *src_buffer, size_t src_size,
 | 
								 const int16_t *src_buffer, size_t src_size,
 | 
				
			||||||
@@ -37,7 +37,7 @@ pcm_resample_fallback_16(PcmResampler *state,
 | 
				
			|||||||
		(src_frames * dest_rate + src_rate - 1) / src_rate;
 | 
							(src_frames * dest_rate + src_rate - 1) / src_rate;
 | 
				
			||||||
	unsigned dest_samples = dest_frames * channels;
 | 
						unsigned dest_samples = dest_frames * channels;
 | 
				
			||||||
	size_t dest_size = dest_samples * sizeof(*src_buffer);
 | 
						size_t dest_size = dest_samples * sizeof(*src_buffer);
 | 
				
			||||||
	int16_t *dest_buffer = (int16_t *)state->buffer.Get(dest_size);
 | 
						int16_t *dest_buffer = (int16_t *)buffer.Get(dest_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert((src_size % (sizeof(*src_buffer) * channels)) == 0);
 | 
						assert((src_size % (sizeof(*src_buffer) * channels)) == 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -65,7 +65,7 @@ pcm_resample_fallback_16(PcmResampler *state,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const int32_t *
 | 
					const int32_t *
 | 
				
			||||||
pcm_resample_fallback_32(PcmResampler *state,
 | 
					pcm_resample_fallback_32(PcmBuffer &buffer,
 | 
				
			||||||
			 unsigned channels,
 | 
								 unsigned channels,
 | 
				
			||||||
			 unsigned src_rate,
 | 
								 unsigned src_rate,
 | 
				
			||||||
			 const int32_t *src_buffer, size_t src_size,
 | 
								 const int32_t *src_buffer, size_t src_size,
 | 
				
			||||||
@@ -78,7 +78,7 @@ pcm_resample_fallback_32(PcmResampler *state,
 | 
				
			|||||||
		(src_frames * dest_rate + src_rate - 1) / src_rate;
 | 
							(src_frames * dest_rate + src_rate - 1) / src_rate;
 | 
				
			||||||
	unsigned dest_samples = dest_frames * channels;
 | 
						unsigned dest_samples = dest_frames * channels;
 | 
				
			||||||
	size_t dest_size = dest_samples * sizeof(*src_buffer);
 | 
						size_t dest_size = dest_samples * sizeof(*src_buffer);
 | 
				
			||||||
	int32_t *dest_buffer = (int32_t *)state->buffer.Get(dest_size);
 | 
						int32_t *dest_buffer = (int32_t *)buffer.Get(dest_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert((src_size % (sizeof(*src_buffer) * channels)) == 0);
 | 
						assert((src_size % (sizeof(*src_buffer) * channels)) == 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ pcm_resample_lsr_32(PcmResampler *state,
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const int16_t *
 | 
					const int16_t *
 | 
				
			||||||
pcm_resample_fallback_16(PcmResampler *state,
 | 
					pcm_resample_fallback_16(PcmBuffer &buffer,
 | 
				
			||||||
			 unsigned channels,
 | 
								 unsigned channels,
 | 
				
			||||||
			 unsigned src_rate,
 | 
								 unsigned src_rate,
 | 
				
			||||||
			 const int16_t *src_buffer, size_t src_size,
 | 
								 const int16_t *src_buffer, size_t src_size,
 | 
				
			||||||
@@ -80,7 +80,7 @@ pcm_resample_fallback_16(PcmResampler *state,
 | 
				
			|||||||
			 size_t *dest_size_r);
 | 
								 size_t *dest_size_r);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const int32_t *
 | 
					const int32_t *
 | 
				
			||||||
pcm_resample_fallback_32(PcmResampler *state,
 | 
					pcm_resample_fallback_32(PcmBuffer &buffer,
 | 
				
			||||||
			 unsigned channels,
 | 
								 unsigned channels,
 | 
				
			||||||
			 unsigned src_rate,
 | 
								 unsigned src_rate,
 | 
				
			||||||
			 const int32_t *src_buffer,
 | 
								 const int32_t *src_buffer,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user