updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / dosbox-svn-patched / swapstereo.patch
blobd08ad03808a69200055c79f46d14388b14f2995b
1 diff -urN dosbox.orig/src/dosbox.cpp dosbox/src/dosbox.cpp
2 --- dosbox.orig/src/dosbox.cpp 2011-01-14 18:31:43.731310313 -0300
3 +++ dosbox/src/dosbox.cpp 2011-01-14 19:11:12.957976979 -0300
4 @@ -587,6 +587,9 @@
5 Pbool = secprop->Add_bool("nosound",Property::Changeable::OnlyAtStart,false);
6 Pbool->Set_help("Enable silent mode, sound is still emulated though.");
8 + Pbool = secprop->Add_bool("swapstereo",Property::Changeable::OnlyAtStart,false);
9 + Pbool->Set_help("Swaps the left and right stereo channels.");
11 Pint = secprop->Add_int("rate",Property::Changeable::OnlyAtStart,44100);
12 Pint->Set_values(rates);
13 Pint->Set_help("Mixer sample rate, setting any device's rate higher than this will probably lower their sound quality.");
14 diff -urN dosbox.orig/src/hardware/mixer.cpp dosbox/src/hardware/mixer.cpp
15 --- dosbox.orig/src/hardware/mixer.cpp 2011-01-14 18:31:43.747976978 -0300
16 +++ dosbox/src/hardware/mixer.cpp 2011-01-14 19:18:46.057976977 -0300
17 @@ -72,6 +72,7 @@
18 bool nosound;
19 Bit32u freq;
20 Bit32u blocksize;
21 + bool swapstereo;
22 } mixer;
24 Bit8u MixTemp[MIXER_BUFSIZE];
25 @@ -167,6 +168,9 @@
26 Bitu mixpos=mixer.pos+done;
27 freq_index&=MIXER_REMAIN;
28 Bitu pos=0;Bitu new_pos;
29 + int offset[2];
30 + offset[0] = mixer.swapstereo ? 1:0;
31 + offset[1] = mixer.swapstereo ? 0:1;
33 goto thestart;
34 for (;;) {
35 @@ -180,15 +184,15 @@
36 if ( sizeof( Type) == 1) {
37 if (!signeddata) {
38 if (stereo) {
39 - diff[0]=(((Bit8s)(data[pos*2+0] ^ 0x80)) << 8)-last[0];
40 - diff[1]=(((Bit8s)(data[pos*2+1] ^ 0x80)) << 8)-last[1];
41 + diff[0]=(((Bit8s)(data[pos*2+offset[0]] ^ 0x80)) << 8)-last[0];
42 + diff[1]=(((Bit8s)(data[pos*2+offset[1]] ^ 0x80)) << 8)-last[1];
43 } else {
44 diff[0]=(((Bit8s)(data[pos] ^ 0x80)) << 8)-last[0];
46 } else {
47 if (stereo) {
48 - diff[0]=(data[pos*2+0] << 8)-last[0];
49 - diff[1]=(data[pos*2+1] << 8)-last[1];
50 + diff[0]=(data[pos*2+offset[0]] << 8)-last[0];
51 + diff[1]=(data[pos*2+offset[1]] << 8)-last[1];
52 } else {
53 diff[0]=(data[pos] << 8)-last[0];
55 @@ -198,8 +202,8 @@
56 if (signeddata) {
57 if (stereo) {
58 if (nativeorder) {
59 - diff[0]=data[pos*2+0]-last[0];
60 - diff[1]=data[pos*2+1]-last[1];
61 + diff[0]=data[pos*2+offset[0]]-last[0];
62 + diff[1]=data[pos*2+offset[1]]-last[1];
63 } else {
64 if ( sizeof( Type) == 2) {
65 diff[0]=(Bit16s)host_readw((HostPt)&data[pos*2+0])-last[0];
66 @@ -223,8 +227,8 @@
67 } else {
68 if (stereo) {
69 if (nativeorder) {
70 - diff[0]=(Bits)data[pos*2+0]-32768-last[0];
71 - diff[1]=(Bits)data[pos*2+1]-32768-last[1];
72 + diff[0]=(Bits)data[pos*2+offset[0]]-32768-last[0];
73 + diff[1]=(Bits)data[pos*2+offset[1]]-32768-last[1];
74 } else {
75 if ( sizeof( Type) == 2) {
76 diff[0]=(Bits)host_readw((HostPt)&data[pos*2+0])-32768-last[0];
77 @@ -621,6 +625,7 @@
78 mixer.freq=section->Get_int("rate");
79 mixer.nosound=section->Get_bool("nosound");
80 mixer.blocksize=section->Get_int("blocksize");
81 + mixer.swapstereo=section->Get_bool("swapstereo");
83 /* Initialize the internal stuff */
84 mixer.channels=0;