parent
e0e17ac6d9
commit
77c4523723
2 changed files with 19 additions and 13 deletions
|
@ -116,6 +116,10 @@ static INLINE void host_writed(HostPt off,Bit32u val) {
|
|||
|
||||
#if defined(WORDS_BIGENDIAN)
|
||||
|
||||
constexpr static INLINE int16_t host_to_le(int16_t val) {
|
||||
return __builtin_bswap16(val);
|
||||
}
|
||||
|
||||
constexpr static INLINE uint16_t host_to_le(uint16_t val) {
|
||||
return __builtin_bswap16(val);
|
||||
}
|
||||
|
@ -126,6 +130,10 @@ constexpr static INLINE uint32_t host_to_le(uint32_t val) {
|
|||
|
||||
#else
|
||||
|
||||
constexpr static INLINE int16_t host_to_le(int16_t val) {
|
||||
return val;
|
||||
}
|
||||
|
||||
constexpr static INLINE uint16_t host_to_le(uint16_t val) {
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ static INLINE Bit16s MIXER_CLIP(Bits SAMP) {
|
|||
}
|
||||
|
||||
static struct {
|
||||
Bit32s work[MIXER_BUFSIZE][2];
|
||||
int32_t work[MIXER_BUFSIZE][2];
|
||||
//Write/Read pointers for the buffer
|
||||
Bitu pos,done;
|
||||
Bitu needed, min_needed, max_needed;
|
||||
|
@ -497,19 +497,17 @@ static void MIXER_MixData(Bitu needed) {
|
|||
chan=chan->next;
|
||||
}
|
||||
if (CaptureState & (CAPTURE_WAVE|CAPTURE_VIDEO)) {
|
||||
Bit16s convert[1024][2];
|
||||
Bitu added=needed-mixer.done;
|
||||
if (added>1024)
|
||||
added=1024;
|
||||
Bitu readpos=(mixer.pos+mixer.done)&MIXER_BUFMASK;
|
||||
for (Bitu i=0;i<added;i++) {
|
||||
Bits sample=mixer.work[readpos][0] >> MIXER_VOLSHIFT;
|
||||
convert[i][0]=MIXER_CLIP(sample);
|
||||
sample=mixer.work[readpos][1] >> MIXER_VOLSHIFT;
|
||||
convert[i][1]=MIXER_CLIP(sample);
|
||||
readpos=(readpos+1)&MIXER_BUFMASK;
|
||||
int16_t convert[1024][2];
|
||||
const size_t added = std::min<size_t>(needed - mixer.done, 1024);
|
||||
size_t readpos = (mixer.pos + mixer.done) & MIXER_BUFMASK;
|
||||
for (size_t i = 0; i < added; i++) {
|
||||
const int32_t sample_1 = mixer.work[readpos][0] >> MIXER_VOLSHIFT;
|
||||
const int32_t sample_2 = mixer.work[readpos][1] >> MIXER_VOLSHIFT;
|
||||
convert[i][0] = host_to_le(MIXER_CLIP(sample_1));
|
||||
convert[i][1] = host_to_le(MIXER_CLIP(sample_2));
|
||||
readpos = (readpos + 1) & MIXER_BUFMASK;
|
||||
}
|
||||
CAPTURE_AddWave( mixer.freq, added, (Bit16s*)convert );
|
||||
CAPTURE_AddWave(mixer.freq, added, reinterpret_cast<int16_t*>(convert));
|
||||
}
|
||||
//Reset the the tick_add for constant speed
|
||||
if( Mixer_irq_important() )
|
||||
|
|
Loading…
Add table
Reference in a new issue