static void sound_Store(void) { unsigned i; uint32_t length; uint8_t sample[MAX_BUFFER_SIZE]; memset(sample, 0, MAX_BUFFER_SIZE); length = 48000 / prosystem_frequency; sound_Resample(tia_buffer, sample, length); /* Ballblazer, Commando, various homebrew and hacks */ if(cartridge_pokey) { uint32_t index; uint8_t pokeySample[MAX_BUFFER_SIZE]; memset(pokeySample, 0, MAX_BUFFER_SIZE); sound_Resample(pokey_buffer, pokeySample, length); for(index = 0; index < length; index++) { sample[index] += pokeySample[index]; sample[index] = sample[index] / 2; } } /* Convert 8u to 16s */ for(i = 0; i != length; i ++) { int16_t sample16 = (sample[i] << 8); int16_t frame[2] = {sample16, sample16}; audio_cb((int16_t)frame[0], (int16_t)frame[1]); //audio_batch_cb(frame, 2); } }
void sound_Store() { #ifdef SOUND_ENABLED byte sample[1920]; unsigned int i; unsigned int length = sound_GetSampleLength(obtained.freq, FPS, prosystem_frequency);; //obtained.freq/prosystem_frequency; sound_Resample(tia_buffer, sample, length); if(cartridge_pokey) { byte pokeySample[1920]; sound_Resample(pokey_buffer, pokeySample, length); for(i = 0; i < length; i++) { sample[i] += pokeySample[i]; sample[i] = sample[i] / 2; } } ringBuffer_Produce(sample, length); #endif }