diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/snaporig.cpp | 7 | ||||
-rw-r--r-- | source/snapshot.cpp | 7 | ||||
-rw-r--r-- | source/snes9x.h | 2 | ||||
-rw-r--r-- | source/soundux.cpp | 29 | ||||
-rw-r--r-- | source/soundux.h | 6 |
5 files changed, 47 insertions, 4 deletions
diff --git a/source/snaporig.cpp b/source/snaporig.cpp index 219f67f..ac2045c 100644 --- a/source/snaporig.cpp +++ b/source/snaporig.cpp @@ -386,10 +386,17 @@ static int ReadOrigSnapshot (STREAM snap) sizeof (SOrigSoundData), snap)) != SUCCESS) return (result); +#ifndef FOREVER_FORWARD_STEREO SoundData.master_volume_left = OrigSoundData.master_volume_left; SoundData.master_volume_right = OrigSoundData.master_volume_right; SoundData.echo_volume_left = OrigSoundData.echo_volume_left; SoundData.echo_volume_right = OrigSoundData.echo_volume_right; +#else + SoundData.master_volume [0] = OrigSoundData.master_volume_left; + SoundData.master_volume [1] = OrigSoundData.master_volume_right; + SoundData.echo_volume [0] = OrigSoundData.echo_volume_left; + SoundData.echo_volume [1] = OrigSoundData.echo_volume_right; +#endif SoundData.echo_enable = OrigSoundData.echo_enable; SoundData.echo_feedback = OrigSoundData.echo_feedback; SoundData.echo_ptr = OrigSoundData.echo_ptr; diff --git a/source/snapshot.cpp b/source/snapshot.cpp index 8dd7f8c..c31d3ac 100644 --- a/source/snapshot.cpp +++ b/source/snapshot.cpp @@ -377,10 +377,17 @@ static FreezeData SnapAPURegisters [] = { #define OFFSET(f) Offset(f,SSoundData *) static FreezeData SnapSoundData [] = { +#ifndef FOREVER_FORWARD_STEREO {OFFSET (master_volume_left), 2, INT_V}, {OFFSET (master_volume_right), 2, INT_V}, {OFFSET (echo_volume_left), 2, INT_V}, {OFFSET (echo_volume_right), 2, INT_V}, +#else + {OFFSET (master_volume [0]), 2, INT_V}, + {OFFSET (master_volume [1]), 2, INT_V}, + {OFFSET (echo_volume [0]), 2, INT_V}, + {OFFSET (echo_volume [1]), 2, INT_V}, +#endif {OFFSET (echo_enable), 4, INT_V}, {OFFSET (echo_feedback), 4, INT_V}, {OFFSET (echo_ptr), 4, INT_V}, diff --git a/source/snes9x.h b/source/snes9x.h index ebcf5e3..6c93855 100644 --- a/source/snes9x.h +++ b/source/snes9x.h @@ -331,7 +331,9 @@ struct SSettings{ #ifndef FOREVER_STEREO bool8 Stereo; #endif +#ifndef FOREVER_FORWARD_STEREO bool8 ReverseStereo; +#endif #ifndef FOREVER_16_BIT_SOUND bool8 SixteenBitSound; #endif diff --git a/source/soundux.cpp b/source/soundux.cpp index c1a01c6..6f41f64 100644 --- a/source/soundux.cpp +++ b/source/soundux.cpp @@ -261,8 +261,10 @@ void S9xSetMasterVolume (short volume_left, short volume_right) { if (Settings.DisableMasterVolume || SNESGameFixes.EchoOnlyOutput) { +#ifndef FOREVER_FORWARD_STEREO SoundData.master_volume_left = 127; SoundData.master_volume_right = 127; +#endif SoundData.master_volume [0] = SoundData.master_volume [1] = 127; } else @@ -271,10 +273,15 @@ void S9xSetMasterVolume (short volume_left, short volume_right) if (!so.stereo) volume_left = (ABS (volume_right) + ABS (volume_left)) / 2; #endif +#ifndef FOREVER_FORWARD_STEREO SoundData.master_volume_left = volume_left; SoundData.master_volume_right = volume_right; SoundData.master_volume [Settings.ReverseStereo] = volume_left; SoundData.master_volume [1 ^ Settings.ReverseStereo] = volume_right; +#else + SoundData.master_volume [0] = volume_left; + SoundData.master_volume [1] = volume_right; +#endif } } @@ -284,10 +291,15 @@ void S9xSetEchoVolume (short volume_left, short volume_right) if (!so.stereo) volume_left = (ABS (volume_right) + ABS (volume_left)) / 2; #endif +#ifndef FOREVER_FORWARD_STEREO SoundData.echo_volume_left = volume_left; SoundData.echo_volume_right = volume_right; SoundData.echo_volume [Settings.ReverseStereo] = volume_left; SoundData.echo_volume [1 ^ Settings.ReverseStereo] = volume_right; +#else + SoundData.echo_volume [0] = volume_left; + SoundData.echo_volume [1] = volume_right; +#endif } void S9xSetEchoEnable (uint8 byte) @@ -378,10 +390,12 @@ void S9xFixSoundAfterSnapshotLoad () SoundData.channels [i].previous [0] = (int32) SoundData.channels [i].previous16 [0]; SoundData.channels [i].previous [1] = (int32) SoundData.channels [i].previous16 [1]; } +#ifndef FOREVER_FORWARD_STEREO SoundData.master_volume [Settings.ReverseStereo] = SoundData.master_volume_left; SoundData.master_volume [1 ^ Settings.ReverseStereo] = SoundData.master_volume_right; SoundData.echo_volume [Settings.ReverseStereo] = SoundData.echo_volume_left; SoundData.echo_volume [1 ^ Settings.ReverseStereo] = SoundData.echo_volume_right; +#endif IAPU.Scanline = 0; } @@ -1157,12 +1171,19 @@ void MixStereo (int sample_count) } if (pitch_mod & (1 << (J + 1))) - wave [I / 2] = ch->sample * ch->envx; + wave [I / 2] = ch->sample * ch->envx; +#ifndef FOREVER_FORWARD_STEREO MixBuffer [I ^ Settings.ReverseStereo] += VL; MixBuffer [I + (1 ^ Settings.ReverseStereo)] += VR; ch->echo_buf_ptr [I ^ Settings.ReverseStereo] += VL; ch->echo_buf_ptr [I + (1 ^ Settings.ReverseStereo)] += VR; +#else + MixBuffer [I ] += VL; + MixBuffer [I + 1] += VR; + ch->echo_buf_ptr [I ] += VL; + ch->echo_buf_ptr [I + 1] += VR; +#endif } stereo_exit: ; } @@ -1840,10 +1861,12 @@ void S9xResetSound (bool8 full) if (full) { +#ifndef FOREVER_FORWARD_STEREO SoundData.master_volume_left = 0; SoundData.master_volume_right = 0; SoundData.echo_volume_left = 0; SoundData.echo_volume_right = 0; +#endif SoundData.echo_enable = 0; SoundData.echo_write_enabled = 0; SoundData.echo_channel_enable = 0; @@ -1857,9 +1880,11 @@ void S9xResetSound (bool8 full) SoundData.echo_volume[1] = 0; SoundData.noise_hertz = 0; } - + +#ifndef FOREVER_FORWARD_STEREO SoundData.master_volume_left = 127; SoundData.master_volume_right = 127; +#endif SoundData.master_volume [0] = SoundData.master_volume [1] = 127; if (so.playback_rate) so.err_rate = (uint32) (FIXED_POINT * SNES_SCANLINE_TIME / (1.0 / so.playback_rate)); diff --git a/source/soundux.h b/source/soundux.h index 9bb2a22..5484e89 100644 --- a/source/soundux.h +++ b/source/soundux.h @@ -188,10 +188,12 @@ typedef struct { typedef struct { +#ifndef FOREVER_FORWARD_STEREO short master_volume_left; /* range is -128 .. 127 */ short master_volume_right; /* range is -128 .. 127 */ short echo_volume_left; /* range is -128 .. 127 */ short echo_volume_right; /* range is -128 .. 127 */ +#endif int echo_enable; int echo_feedback; /* range is -128 .. 127 */ int echo_ptr; @@ -203,8 +205,8 @@ typedef struct uint32 dummy [3]; Channel channels [NUM_CHANNELS]; bool8 no_filter; - int master_volume [2]; /* for reverse stereo */ - int echo_volume [2]; /* for reverse stereo */ + int master_volume [2]; /* range is -128 .. 127 */ + int echo_volume [2]; /* range is -128 .. 127 */ int noise_hertz; } SSoundData; |