mirror of
https://github.com/86Box/86Box.git
synced 2026-02-24 20:35:32 -07:00
Add fast forward option
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <sys/audioio.h>
|
||||
#include <sys/param.h>
|
||||
@@ -41,6 +42,7 @@
|
||||
#define I_MIDI 6
|
||||
|
||||
static int audio[7] = {-1, -1, -1, -1, -1, -1, -1};
|
||||
extern bool fast_forward;
|
||||
|
||||
#ifdef USE_NEW_API
|
||||
static struct audio_swpar info[7];
|
||||
@@ -104,7 +106,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size)
|
||||
double gain;
|
||||
int target_rate;
|
||||
|
||||
if(audio[src] == -1)
|
||||
if(audio[src] == -1 || fast_forward)
|
||||
return;
|
||||
|
||||
gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#undef AL_API
|
||||
#undef ALC_API
|
||||
@@ -313,6 +314,7 @@ inital(void)
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
extern bool fast_forward;
|
||||
void
|
||||
givealbuffer_common(const void *buf, const uint8_t src, const int size, const int freq)
|
||||
{
|
||||
@@ -320,7 +322,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size, const in
|
||||
int state;
|
||||
ALuint buffer;
|
||||
|
||||
if (!initialized)
|
||||
if (!initialized || fast_forward)
|
||||
return;
|
||||
|
||||
alGetSourcei(source[src], AL_SOURCE_STATE, &state);
|
||||
@@ -331,7 +333,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size, const in
|
||||
|
||||
alGetSourcei(source[src], AL_BUFFERS_PROCESSED, &processed);
|
||||
if (processed >= 1) {
|
||||
const double gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0);
|
||||
const double gain = (sound_muted) ? 0.0 : pow(10.0, (double) sound_gain / 20.0);
|
||||
alListenerf(AL_GAIN, (float) gain);
|
||||
|
||||
alSourceUnqueueBuffers(source[src], 1, &buffer);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
@@ -32,6 +33,7 @@
|
||||
#define I_FDD 5
|
||||
#define I_HDD 6
|
||||
|
||||
extern bool fast_forward;
|
||||
static struct sio_hdl* audio[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||
static struct sio_par info[7];
|
||||
static int freqs[7] = { SOUND_FREQ, MUSIC_FREQ, WT_FREQ, CD_FREQ, SOUND_FREQ, SOUND_FREQ, 0 };
|
||||
@@ -83,7 +85,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size)
|
||||
int conv_size;
|
||||
double gain;
|
||||
int target_rate;
|
||||
if (audio[src] == NULL)
|
||||
if (audio[src] == NULL || fast_forward)
|
||||
return;
|
||||
|
||||
gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -56,6 +57,8 @@ static IXAudio2SourceVoice *srcvoicecd = NULL;
|
||||
static IXAudio2SourceVoice *srcvoicefdd = NULL;
|
||||
static IXAudio2SourceVoice *srcvoicehdd = NULL;
|
||||
|
||||
extern bool fast_forward;
|
||||
|
||||
#define FREQ SOUND_FREQ
|
||||
#define BUFLEN SOUNDBUFLEN
|
||||
|
||||
@@ -258,7 +261,7 @@ closeal(void)
|
||||
void
|
||||
givealbuffer_common(const void *buf, IXAudio2SourceVoice *sourcevoice, const size_t buflen)
|
||||
{
|
||||
if (!initialized)
|
||||
if (!initialized || fast_forward)
|
||||
return;
|
||||
|
||||
(void) IXAudio2MasteringVoice_SetVolume(mastervoice, sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0),
|
||||
|
||||
Reference in New Issue
Block a user