]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1420b6.zip
authorToni Wilen <twilen@winuae.net>
Mon, 9 Apr 2007 08:37:57 +0000 (11:37 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:33:05 +0000 (21:33 +0200)
22 files changed:
audio.c
cfgfile.c
custom.c
debug.c
driveclick.c
filesys.c
gayle.c
hardfile.c
include/audio.h
include/filesys.h
inputdevice.c
od-win32/ahidsound.c
od-win32/avioutput.c
od-win32/keyboard_win32.c
od-win32/resources/winuae.rc
od-win32/sounddep/sound.c
od-win32/sounddep/sound.h
od-win32/win32.c
od-win32/win32.h
od-win32/win32gfx.c
od-win32/win32gui.c
od-win32/winuaechangelog.txt

diff --git a/audio.c b/audio.c
index 7b6615f2b05bee9c8b08af08f822132b193ef351..99782fda46279db02c3e69e62edb894a04839178 100755 (executable)
--- a/audio.c
+++ b/audio.c
@@ -21,9 +21,9 @@
 #include "newcpu.h"
 #include "autoconf.h"
 #include "gensound.h"
+#include "audio.h"
 #include "sounddep/sound.h"
 #include "events.h"
-#include "audio.h"
 #include "savestate.h"
 #include "driveclick.h"
 #include "zfile.h"
@@ -280,7 +280,7 @@ void init_sound_table16 (void)
 
     for (i = 0; i < 256; i++)
        for (j = 0; j < 64; j++)
-           sound_table[j][i] = j * (uae_s8)i * (currprefs.sound_stereo ? 2 : 1);
+           sound_table[j][i] = j * (uae_s8)i * get_audio_ismono() ? 1 : 2;
 }
 
 void init_sound_table8 (void)
@@ -289,7 +289,7 @@ void init_sound_table8 (void)
 
     for (i = 0; i < 256; i++)
        for (j = 0; j < 64; j++)
-           sound_table[j][i] = (j * (uae_s8)i * (currprefs.sound_stereo ? 2 : 1)) / 256;
+           sound_table[j][i] = (j * (uae_s8)i * get_audio_ismono() ? 1 : 2) / 256;
 }
 
 #define        MULTIPLICATION_PROFITABLE
@@ -310,7 +310,9 @@ typedef     uae_u8 sample8_t;
 #define        MAX_DELAY_BUFFER 1024
 static uae_u32 right_word_saved[MAX_DELAY_BUFFER];
 static uae_u32 left_word_saved[MAX_DELAY_BUFFER];
-static int saved_ptr;
+static uae_u32 right2_word_saved[MAX_DELAY_BUFFER];
+static uae_u32 left2_word_saved[MAX_DELAY_BUFFER];
+static int saved_ptr, saved_ptr2;
 
 #define        MIXED_STEREO_MAX 32
 static int mixed_on, mixed_stereo_size, mixed_mul1, mixed_mul2;
@@ -323,7 +325,7 @@ static int led_filter_forced, sound_use_filter, sound_use_filter_sinc, led_filte
 
 static struct filter_state {
     float rc1, rc2, rc3, rc4, rc5;
-} sound_filter_state[2];
+} sound_filter_state[4];
 
 static float a500e_filter1_a0;
 static float a500e_filter2_a0;
@@ -407,7 +409,7 @@ STATIC_INLINE void put_sound_word_right (uae_u32 w)
     PUT_SOUND_WORD_RIGHT (w);
 }
 
-STATIC_INLINE void put_sound_word_left (uae_u32        w)
+STATIC_INLINE void put_sound_word_left (uae_u32 w)
 {
     if (mixed_on) {
        uae_u32 rold, lold, rnew, lnew, tmp;
@@ -429,6 +431,38 @@ STATIC_INLINE void put_sound_word_left (uae_u32    w)
     PUT_SOUND_WORD_LEFT (w);
 }
 
+STATIC_INLINE void put_sound_word_right2 (uae_u32 w)
+{
+    if (mixed_on) {
+       right2_word_saved[saved_ptr2] = w;
+       return;
+    }
+    PUT_SOUND_WORD_RIGHT2 (w);
+}
+
+STATIC_INLINE void put_sound_word_left2 (uae_u32 w)
+{
+    if (mixed_on) {
+       uae_u32 rold, lold, rnew, lnew, tmp;
+
+       left2_word_saved[saved_ptr2] = w;
+       lnew = w - SOUND16_BASE_VAL;
+       rnew = right2_word_saved[saved_ptr2] - SOUND16_BASE_VAL;
+
+       saved_ptr2 = (saved_ptr2 + 1) & mixed_stereo_size;
+
+       lold = left2_word_saved[saved_ptr2] - SOUND16_BASE_VAL;
+       tmp = (rnew * mixed_mul1 + lold * mixed_mul2) / MIXED_STEREO_MAX;
+       tmp += SOUND16_BASE_VAL;
+       PUT_SOUND_WORD_RIGHT2 (tmp);
+
+       rold = right2_word_saved[saved_ptr2] - SOUND16_BASE_VAL;
+       w = (lnew * mixed_mul1 + rold * mixed_mul2) / MIXED_STEREO_MAX;
+    }
+    PUT_SOUND_WORD_LEFT2 (w);
+}
+
+
 #define        DO_CHANNEL(v, c) do { (v) &= audio_channel[c].adk_mask; data += v; } while (0);
 
 static void anti_prehandler(unsigned long best_evtime)
@@ -698,6 +732,7 @@ static void sample16i_crux_handler (void)
 }
 
 #ifdef HAVE_STEREO_SUPPORT
+
 void sample16ss_handler (void)
 {
     uae_u32 data0 = audio_channel[0].current_sample;
@@ -714,16 +749,37 @@ void sample16ss_handler (void)
     data2 &= audio_channel[2].adk_mask;
     data3 &= audio_channel[3].adk_mask;
 
-    PUT_SOUND_WORD (data0 << 2);
-    PUT_SOUND_WORD (data1 << 2);
-    PUT_SOUND_WORD (data3 << 2);
-    PUT_SOUND_WORD (data2 << 2);
+    put_sound_word_left (data0 << 2);
+    put_sound_word_right (data1 << 2);
+    if (currprefs.sound_stereo == SND_6CH) {
+       PUT_SOUND_WORD (0);
+       PUT_SOUND_WORD (0);
+    }
+    put_sound_word_left2 (data3 << 2);
+    put_sound_word_right2 (data2 << 2);
 
     check_sound_buffers ();
 }
 
 /* This interpolator examines sample points when Paula switches the output
  * voltage and computes the average of Paula's output */
+
+void sample16ss_anti_handler (void)
+{
+    int datas[4];
+
+    samplexx_anti_handler (datas);
+    put_sound_word_left (datas[0] << 2);
+    put_sound_word_right (datas[1] << 2);
+    if (currprefs.sound_stereo == SND_6CH) {
+       PUT_SOUND_WORD (0);
+       PUT_SOUND_WORD (0);
+    }
+    put_sound_word_left2 (datas[3] << 2);
+    put_sound_word_right2 (datas[2] << 2);
+    check_sound_buffers ();
+}
+
 static void sample16si_anti_handler (void)
 {
     int datas[4], data1, data2;
@@ -738,6 +794,21 @@ static void sample16si_anti_handler (void)
     check_sound_buffers ();
 }
 
+void sample16ss_sinc_handler (void)
+{
+    int datas[4];
+
+    samplexx_sinc_handler (datas);
+    put_sound_word_left (datas[0] << 2);
+    put_sound_word_right (datas[1] << 2);
+    if (currprefs.sound_stereo == SND_6CH) {
+       PUT_SOUND_WORD (0);
+       PUT_SOUND_WORD (0);
+    }
+    put_sound_word_left2 (datas[3] << 2);
+    put_sound_word_right2 (datas[2] << 2);
+    check_sound_buffers ();
+}
 
 static void sample16si_sinc_handler (void)
 {
@@ -1359,13 +1430,22 @@ void set_audio(void)
                          : currprefs.sound_interpol == 4 ? sample16si_crux_handler
                          : currprefs.sound_interpol == 2 ? sample16si_sinc_handler
                          : sample16si_anti_handler);
+    } else if (sample_handler == sample16ss_handler
+       || sample_handler == sample16ss_sinc_handler
+       || sample_handler == sample16ss_anti_handler)
+    {
+       sample_handler = (currprefs.sound_interpol == 0 ? sample16ss_handler
+                         : currprefs.sound_interpol == 3 ? sample16ss_handler
+                         : currprefs.sound_interpol == 4 ? sample16ss_handler
+                         : currprefs.sound_interpol == 2 ? sample16ss_sinc_handler
+                         : sample16ss_anti_handler);
     }
     sample_prehandler = NULL;
-    if (sample_handler == sample16si_sinc_handler || sample_handler == sample16i_sinc_handler) {
+    if (sample_handler == sample16si_sinc_handler || sample_handler == sample16i_sinc_handler || sample_handler == sample16ss_sinc_handler) {
        sample_prehandler = sinc_prehandler;
        sound_use_filter_sinc = sound_use_filter;
        sound_use_filter = 0;
-    } else if (sample_handler == sample16si_anti_handler || sample_handler == sample16i_anti_handler) {
+    } else if (sample_handler == sample16si_anti_handler || sample_handler == sample16i_anti_handler || sample_handler == sample16ss_anti_handler) {
        sample_prehandler = anti_prehandler;
     }
 
index 4ed2afde5ed8dcea9821362bf8c5727cc3c6d1ff..a6a2f446553e0226155375ea850c14c180f9e5c5 100755 (executable)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -14,6 +14,7 @@
 
 #include "options.h"
 #include "uae.h"
+#include "audio.h"
 #include "autoconf.h"
 #include "events.h"
 #include "custom.h"
@@ -126,7 +127,7 @@ static const char *soundmode1[] = { "none", "interrupts", "normal", "exact", 0 }
 static const char *soundmode2[] = { "none", "interrupts", "good", "best", 0 };
 static const char *centermode1[] = { "none", "simple", "smart", 0 };
 static const char *centermode2[] = { "false", "true", "smart", 0 };
-static const char *stereomode[] = { "mono", "stereo", "clonedstereo", "4ch", "mixed", 0 };
+static const char *stereomode[] = { "mono", "stereo", "clonedstereo", "4ch", "clonedstereo6ch", "6ch", "mixed", 0 };
 static const char *interpolmode[] = { "none", "anti", "sinc", "rh", "crux", 0 };
 static const char *collmode[] = { "none", "sprites", "playfields", "full", 0 };
 static const char *compmode[] = { "direct", "indirect", "indirectKS", "afterPic", 0 };
@@ -939,8 +940,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
     }
 
     if (cfgfile_strval (option, value, "sound_channels", &p->sound_stereo, stereomode, 1)) {
-       if (p->sound_stereo == 4) { /* "mixed stereo" compatibility hack */
-           p->sound_stereo = 1;
+       if (p->sound_stereo == SND_NONE) { /* "mixed stereo" compatibility hack */
+           p->sound_stereo = SND_STEREO;
            p->sound_mixed_stereo = 5;
            p->sound_stereo_separation = 7;
        }
@@ -1847,12 +1848,12 @@ static void parse_sound_spec (struct uae_prefs *p, char *spec)
     if (x1) {
        p->sound_stereo_separation = 0;
        if (*x1 == 'S') {
-           p->sound_stereo = 1;
+           p->sound_stereo = SND_STEREO;
            p->sound_stereo_separation = 7;
        } else if (*x1 == 's')
-           p->sound_stereo = 1;
+           p->sound_stereo = SND_STEREO;
        else
-           p->sound_stereo = 0;
+           p->sound_stereo = SND_MONO;
     }
     if (x2)
        p->sound_bits = atoi (x2);
@@ -2586,7 +2587,7 @@ void default_prefs (struct uae_prefs *p, int type)
     p->keyboard_lang = KBD_LANG_US;
 
     p->produce_sound = 3;
-    p->sound_stereo = 1;
+    p->sound_stereo = SND_STEREO;
     p->sound_stereo_separation = 7;
     p->sound_mixed_stereo = 0;
     p->sound_bits = DEFAULT_SOUND_BITS;
@@ -2766,7 +2767,7 @@ static void buildin_default_host_prefs (struct uae_prefs *p)
 {
 #if 0
     p->sound_filter = FILTER_SOUND_OFF;
-    p->sound_stereo = 1;
+    p->sound_stereo = SND_STEREO;
     p->sound_stereo_separation = 7;
     p->sound_mixed_stereo = 0;
 #endif
index a1e855f2f1508c7da18683c219daff62b4c29cef..6b8b24e2607cb21c2a2cc309f32a0da54cabb89d 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -26,6 +26,7 @@
 #include "options.h"
 #include "uae.h"
 #include "gensound.h"
+#include "audio.h"
 #include "sounddep/sound.h"
 #include "events.h"
 #include "memory.h"
@@ -36,7 +37,6 @@
 #include "blitter.h"
 #include "xwin.h"
 #include "inputdevice.h"
-#include "audio.h"
 #include "keybuf.h"
 #include "serial.h"
 #include "osemu.h"
diff --git a/debug.c b/debug.c
index 4cd8bc3a0312e8b3a076cf1884d1d80e6883ef6e..42e68a251862a3c80c36f060813aa4c64578f31c 100755 (executable)
--- a/debug.c
+++ b/debug.c
@@ -24,6 +24,7 @@
 #include "cia.h"
 #include "xwin.h"
 #include "identify.h"
+#include "audio.h"
 #include "sound.h"
 #include "disk.h"
 #include "savestate.h"
index 643a33cc6b1555233663eea54519653f9a327802..ea51ab39770c61e79d8a4b404635029fe84f9842 100755 (executable)
 
 #include "uae.h"
 #include "options.h"
+#include "audio.h"
 #include "sounddep/sound.h"
 #include "zfile.h"
 #include "events.h"
 #include "driveclick.h"
-#include "audio.h"
 
 static struct drvsample drvs[4][DS_END];
 static int freq = 44100;
@@ -293,7 +293,7 @@ static int clickcnt;
 
 static void mix (void)
 {
-    int total = ((uae_u8*)sndbufpt - (uae_u8*)sndbuffer) / ((currprefs.sound_stereo == 3) ? 8 : (currprefs.sound_stereo ? 4 : 2));
+    int total = ((uae_u8*)sndbufpt - (uae_u8*)sndbuffer) / (get_audio_nativechannels() * 2);
 
     if (currprefs.dfxclickvolume > 0) {
        while (clickcnt < total) {
@@ -323,7 +323,7 @@ void driveclick_mix (uae_s16 *sndbuffer, int size)
        return;
     mix();
     clickcnt = 0;
-    if (currprefs.sound_stereo) {
+    if (!get_audio_ismono()) {
        for (i = 0; i < size / 2; i++) {
            uae_s16 s = clickbuffer[i];
            sndbuffer[0] = limit(((sndbuffer[0] + s) * 2) / 3);
index 0c845e530b81b5dc2bd702746f19e4c7914b7762..f247b11d8ec56b62de244eda952627169e6bbc5e 100755 (executable)
--- a/filesys.c
+++ b/filesys.c
@@ -4968,7 +4968,7 @@ uae_u8 *restore_filesys (uae_u8 *src)
     int type, devno;
     UnitInfo *ui;
     char *devname = 0, *volname = 0, *rootdir = 0, *filesysdir = 0;
-    int bootpri, readonly, hdc;
+    int bootpri, readonly;
 
     if (restore_u32 () != 2)
        return src;
diff --git a/gayle.c b/gayle.c
index f0187ce70a64a1cf757702d8f0a0845f3a4e5e03..4166e32f3949e03273b5daecd2f37221ae4881d6 100755 (executable)
--- a/gayle.c
+++ b/gayle.c
@@ -184,12 +184,13 @@ static void ide_identify_drive(void)
     ps(10, "68000", 20); /* serial */
     pw(20, 3);
     pw(21, 512);
-    ps(23, "0.1", 8); /* firmware revision */
+    ps(23, "0.2", 8); /* firmware revision */
     ps(27, "UAE-IDE", 40); /* model */
     pw(47, 128); /* max 128 sectors multiple mode */
     pw(48, 1);
     pw(49, (1 << 9) | (1 << 8)); /* LBA and DMA supported */
-    pw(53, 1);
+    pw(51, 240 << 8); /* PIO0 to PIO2 supported */
+    pw(53, 1 | 2);
     pw(54, ide->cyls);
     pw(55, ide->heads);
     pw(56, ide->secspertrack);
@@ -203,15 +204,27 @@ static void ide_identify_drive(void)
     pw(61, totalsecs >> 16);
     pw(62, 0x0f);
     pw(63, 0x0f);
+    pw(64, 0x03); /* PIO3 and PIO4 */
+    pw(65, 120 << 8); /* MDMA2 supported */
+    pw(66, 120 << 8);
+    pw(67, 120 << 8);
+    pw(68, 120 << 8);
+    pw(80, (1 << 1) | (1 << 2) | (1 << 3)); /* ATA-1 to ATA-3 */
+    pw(81, 0x000A); /* ATA revision */
 }
 static void ide_initialize_drive_parameters(void)
 {
     struct ide_hdf *ide = &idedrive[ide_drv];
 
     if (ide->size) {
-       ide->secspertrack = ide_nsector;
+       ide->secspertrack = ide_nsector == 0 ? 256 : ide_nsector;
        ide->heads = (ide_select & 15) + 1;
        ide->cyls = (ide->size / 512) / (ide->secspertrack * ide->heads);
+       if (ide->heads * ide->cyls * ide->secspertrack > 16515072) {
+           ide->cyls = ide->cyls_def;
+           ide->heads = ide->heads_def;
+           ide->secspertrack = ide->secspertrack_def;
+       }
     } else {
        ide_error |= IDE_ERR_ABRT;
        idedrive[ide_drv].status |= IDE_STATUS_ERR;
@@ -1036,12 +1049,47 @@ void gayle_free_ide_units(void)
     }
 }
 
+void getchs2 (struct hardfiledata *hfd, int *pcyl, int *phead, int *psectorspertrack)
+{
+    unsigned int total = (unsigned int)(hfd->size / 512);
+    int i, head , cyl, spt;
+    int sptt[] = { 63, 127, 255, -1 };
+
+    if (total > 16515072) {
+        /* >8G, CHS=16383/16/63 */
+       *pcyl = 16383;
+       *phead = 16;
+       *psectorspertrack = 63;
+       return;
+    }
+
+    for (i = 0; sptt[i] >= 0; i++) {
+       spt = sptt[i];
+       for (head = 4; head <= 16;head++) {
+           cyl = total / (head * spt);
+           if (hfd->size <= 512 * 1024 * 1024) {
+               if (cyl <= 1023)
+                   break;
+           } else {
+               if (cyl < 16383)
+                   break;
+               if (cyl < 32767 && head >= 5)
+                   break;
+               if (cyl <= 65535)
+                   break;
+           }
+       }
+       if (head <= 16)
+           break;
+    }
+    *pcyl = cyl;
+    *phead = head;
+    *psectorspertrack = spt;
+}
+
 int gayle_add_ide_unit(int ch, char *path, int blocksize, int readonly)
 {
     struct ide_hdf *ide;
-    uae_u8 bufrdb[512];
-    int i;
-    int cyls, secspertrack, heads, tpt;
 
     if (ch >= 2)
        return -1;
@@ -1052,18 +1100,7 @@ int gayle_add_ide_unit(int ch, char *path, int blocksize, int readonly)
        return -1;
     ide->path = my_strdup(path);
     write_log("IDE%d initialized ('%s')\n", ch, path);
-    cyls = secspertrack = heads = 0;
-    for (i = 0; i < 64; i++) {
-       memset(bufrdb, 0, 512);
-       hdf_read(&ide->hfd, bufrdb, 0, 512);
-       if (!memcmp(bufrdb, "RDSK", 4)) {
-           ide->hfd.cylinders = rl (bufrdb + 64);
-           ide->hfd.sectors = rl (bufrdb + 68);
-           ide->hfd.heads = rl (bufrdb + 72);
-           break;
-       }
-    }
-    getchs2(&ide->hfd, &ide->cyls, &tpt, &ide->heads, &ide->secspertrack);
+    getchs2(&ide->hfd, &ide->cyls, &ide->heads, &ide->secspertrack);
     ide->cyls_def = ide->cyls;
     ide->secspertrack_def = ide->secspertrack;
     ide->heads_def = ide->heads;
index e03250245ec396c6fc1123b587dbc7bf0f61e533..52651adddc8eb73bb8adbffe9230ab6f2aa4d008 100755 (executable)
@@ -433,7 +433,7 @@ static uae_u32 REGPARAM2 hardfile_expunge (TrapContext *context)
     return 0; /* Simply ignore this one... */
 }
 
-void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec)
+static void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec)
 {
     unsigned int total = (unsigned int)(hfd->size / 1024);
     int heads;
index cdc6021a124a101d1928c40c3b2c3e106aadd754..7ad957713e5a10a4777098d53045903f9fb5f03d 100755 (executable)
@@ -37,3 +37,22 @@ extern int audio_activate(void);
 extern void audio_sampleripper(int);
 extern int sampleripper_enabled;
 extern void write_wavheader (struct zfile *wavfile, uae_u32 size, uae_u32 freq);
+
+enum {
+    SND_MONO, SND_STEREO, SND_4CH_CLONEDSTEREO, SND_4CH, SND_6CH_CLONEDSTEREO, SND_6CH, SND_NONE };
+STATIC_INLINE int get_audio_nativechannels(void)
+{
+    int ch[] = { 1, 2, 4, 4, 6, 6, 0 };
+    return ch[currprefs.sound_stereo];
+}
+STATIC_INLINE int get_audio_amigachannels(void)
+{
+    int ch[] = { 1, 2, 2, 4, 2, 4, 0 };
+    return ch[currprefs.sound_stereo];
+}
+STATIC_INLINE int get_audio_ismono(void)
+{
+    if (currprefs.sound_stereo == 0)
+       return 1;
+    return 0;
+}
\ No newline at end of file
index a3272a9ba7ea4c0100c1d934bcc81cc25c8b3836..b01a8f1536d293f63808337fa1ff665b0826814f 100755 (executable)
@@ -56,4 +56,3 @@ extern char *hdf_getnameharddrive (int index, int flags);
 extern int hdf_init (void);
 extern int isspecialdrive(const char *name);
 extern int get_native_path(uae_u32 lock, char *out);
-extern void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec);
index 349d4e9893261274a723554414ce46da932a78c9..6bbf045b163e8a2d3cb311093147a622c8e14b7f 100755 (executable)
@@ -38,6 +38,7 @@
 #include "ar.h"
 #include "gui.h"
 #include "disk.h"
+#include "audio.h"
 #include "sound.h"
 #include "savestate.h"
 #include "arcadia.h"
index d6842b8520319f2ec244f55386acddb3ee00be9c..b00fc011bcd6afaea8ade02c2a6fde3735a9bd0d 100755 (executable)
@@ -26,6 +26,7 @@
 
 #include "sysdeps.h"
 #include "options.h"
+#include "audio.h"
 #include "memory.h"
 #include "events.h"
 #include "custom.h"
index 78021d22a66443e8749b981851f8cdb77e6b4bd1..6a9a0f80e6548d4b511f4638554459d814f10094 100755 (executable)
@@ -19,6 +19,7 @@
 #include "sysconfig.h"
 #include "sysdeps.h"
 #include "options.h"
+#include "audio.h"
 #include "custom.h"
 #include "picasso96.h"
 #include "dxwrap.h"
@@ -200,7 +201,7 @@ static int AVIOutput_AllocateAudio(void)
 
     // set the source format
     wfxSrc.wFormatTag = WAVE_FORMAT_PCM;
-    wfxSrc.nChannels = currprefs.sound_stereo == 3 ? 4 : (currprefs.sound_stereo ? 2 : 1);
+    wfxSrc.nChannels = get_audio_nativechannels();
     wfxSrc.nSamplesPerSec = workprefs.sound_freq;
     wfxSrc.nBlockAlign = wfxSrc.nChannels * (workprefs.sound_bits / 8);
     wfxSrc.nAvgBytesPerSec = wfxSrc.nBlockAlign * wfxSrc.nSamplesPerSec;
@@ -834,7 +835,7 @@ static void writewavheader (uae_u32 size)
     uae_u16 tw;
     uae_u32 tl;
     int bits = 16;
-    int channels = currprefs.sound_stereo == 3 ? 4 : (currprefs.sound_stereo ? 2 : 1);
+    int channels = get_audio_nativechannels();
 
     fseek (wavfile, 0, SEEK_SET);
     fwrite ("RIFF", 1, 4, wavfile);
index 5c5d50b0119be65acc0996d4c4a1fb394b97eafb..1ea45a20af821b1f6a6f2de542fde864f6488fe6 100755 (executable)
@@ -21,6 +21,7 @@
 #include "uae.h"
 #include "gui.h"
 #include "options.h"
+#include "audio.h"
 #include "memory.h"
 #include "custom.h"
 #include "events.h"
index 922444f1e724d7a40c61309f12b3bccda37c5418..1b4b119565022ab832553ea0ba0c4b755b963101 100755 (executable)
@@ -272,12 +272,12 @@ BEGIN
     CONTROL         "Slider1",IDC_SOUNDBUFFERRAM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,138,81,106,19
     EDITTEXT        IDC_SOUNDBUFFERMEM,248,84,40,12,ES_CENTER | ES_READONLY
     GROUPBOX        "Settings",IDC_SOUNDINTERPOLATION2,6,114,290,60
-    LTEXT           "Frequency:",IDC_SOUNDFREQTXT,11,124,53,8,SS_CENTERIMAGE
-    COMBOBOX        IDC_SOUNDFREQ,13,133,51,75,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Frequency:",IDC_SOUNDFREQTXT,11,147,53,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_SOUNDFREQ,13,156,51,75,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
     LTEXT           "Audio filter:",IDC_SOUNDFILTERTXT,209,148,77,8,SS_CENTERIMAGE
     COMBOBOX        IDC_SOUNDFILTER,209,157,80,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-    LTEXT           "Stereo mode:",IDC_SOUNDSTEREOTXT,74,124,57,8,SS_CENTERIMAGE
-    COMBOBOX        IDC_SOUNDSTEREO,73,133,62,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Channel mode:",IDC_SOUNDSTEREOTXT,11,124,57,8,SS_CENTERIMAGE
+    COMBOBOX        IDC_SOUNDSTEREO,13,133,122,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     LTEXT           "Interpolation:",IDC_SOUNDINTERPOLATIONTXT,209,124,75,8,SS_CENTERIMAGE
     COMBOBOX        IDC_SOUNDINTERPOLATION,209,132,80,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     LTEXT           "Stereo separation:",IDC_SOUNDSTEREOSEPTXT,141,124,63,8,SS_CENTERIMAGE
@@ -1244,7 +1244,7 @@ END
 
 STRINGTABLE 
 BEGIN
-    IDS_SOUND_STEREO2       "Cloned Stereo"
+    IDS_SOUND_STEREO2       "Cloned Stereo (4 Channels)"
     IDS_INPUT_CUSTOMEVENT   "<Custom event>"
 END
 
index d9e2100db8637b7ddeb29efe53de88b40c29c6a6..8755c084a2d0a88130b562dcb871aab4db91ccec 100755 (executable)
@@ -13,6 +13,7 @@
 #include "sysdeps.h"
 
 #include "options.h"
+#include "audio.h"
 #include "memory.h"
 #include "events.h"
 #include "custom.h"
@@ -25,7 +26,6 @@
 #include "win32.h"
 #include "savestate.h"
 #include "driveclick.h"
-#include "audio.h"
 
 #include <windows.h>
 #include <mmsystem.h>
@@ -211,7 +211,7 @@ static void recalc_offsets(void)
     snd_totalmaxoffset_of = max_sndbufsize + (dsoundbuf - max_sndbufsize) * 3 / 9;
     snd_totalmaxoffset_uf = max_sndbufsize + (dsoundbuf - max_sndbufsize) * 7 / 9;
 }
-       
+
 const static GUID KSDATAFORMAT_SUBTYPE_PCM = {0x00000001,0x0000,0x0010,
     {0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71}};
 
@@ -223,17 +223,11 @@ static int open_audio_ds (int size)
     WAVEFORMATEXTENSIBLE wavfmt;
     LPDIRECTSOUNDBUFFER pdsb;
     int freq = currprefs.sound_freq;
-    int ch = (currprefs.sound_stereo == 3 || currprefs.sound_stereo == 2) ? 4 : (currprefs.sound_stereo ? 2 : 1);
+    int ch = get_audio_nativechannels();
     int round;
 
     enumerate_sound_devices (0);
-    if (ch == 4) {
-       size <<= 3;
-    } else {
-       size <<= 1;
-       if (ch == 2)
-           size <<= 1;
-    }
+    size *= ch * 2;
     snd_configsize = size;
     sndbufsize = size / 32;
     if (sndbufsize > SND_MAX_BUFFER)
@@ -302,8 +296,14 @@ static int open_audio_ds (int size)
        wavfmt.Format.nSamplesPerSec = freq;
        wavfmt.Format.wBitsPerSample = 16;
        if (extend) {
-           DWORD ksmode = round == 1 ? KSAUDIO_SPEAKER_QUAD : (round == 2 ? KSAUDIO_SPEAKER_SURROUND  : SPEAKER_ALL);
-           extname = round == 1 ? "QUAD" : (round == 2 ? "SUR" : "ALL");
+           DWORD ksmode;
+           if (ch == 6) {
+               ksmode = KSAUDIO_SPEAKER_5POINT1;
+               extname = "5.1";
+           } else {
+               ksmode = round == 1 ? KSAUDIO_SPEAKER_QUAD : (round == 2 ? KSAUDIO_SPEAKER_SURROUND  : SPEAKER_ALL);
+               extname = round == 1 ? "QUAD" : (round == 2 ? "SUR" : "ALL");
+           }
            wavfmt.Format.cbSize = sizeof (WAVEFORMATEXTENSIBLE) - sizeof (WAVEFORMATEX);
            wavfmt.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
            wavfmt.Samples.wValidBitsPerSample = 16;
@@ -349,10 +349,10 @@ static int open_audio_ds (int size)
     setvolume ();
     cleardsbuffer ();
     init_sound_table16 ();
-    if (currprefs.sound_stereo == 3)
+    if (get_audio_amigachannels() == 4)
        sample_handler = sample16ss_handler;
     else
-       sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler;
+       sample_handler = get_audio_ismono() ? sample16_handler : sample16s_handler;
 
     obtainedfreq = currprefs.sound_freq;
 
@@ -707,13 +707,29 @@ static void channelswap(uae_s16 *sndbuffer, int len)
        sndbuffer[i + 1] = t;
     }
 }
+static void channelswap6(uae_s16 *sndbuffer, int len)
+{
+    int i;
+    for (i = 0; i < len; i += 6) {
+       uae_s16 t = sndbuffer[i + 0];
+       sndbuffer[i + 0] = sndbuffer[i + 1];
+       sndbuffer[i + 1] = t;
+       t = sndbuffer[i + 4];
+       sndbuffer[i + 4] = sndbuffer[i + 5];
+       sndbuffer[i + 5] = t;
+    }
+}
 
 void finish_sound_buffer (void)
 {
     if (turbo_emulation)
        return;
-    if (ISSTEREO(currprefs) && currprefs.sound_stereo_swap_paula)
-        channelswap((uae_s16*)sndbuffer, sndbufsize / 2);
+    if (currprefs.sound_stereo_swap_paula) {
+       if (get_audio_nativechannels() == 2 || get_audio_nativechannels() == 4)
+           channelswap((uae_s16*)sndbuffer, sndbufsize / 2);
+       else if (get_audio_nativechannels() == 6)
+           channelswap6((uae_s16*)sndbuffer, sndbufsize / 2);
+    }
 #ifdef DRIVESOUND
     driveclick_mix ((uae_s16*)sndbuffer, sndbufsize / 2);
 #endif
index 422390feb90afdc26099b8b160d9d200742d9245..343c7da85fe6faed2f6799c977dc1841a3c78e79 100755 (executable)
@@ -27,10 +27,14 @@ extern void master_sound_volume (int);
 
 STATIC_INLINE void check_sound_buffers (void)
 {
-    if (currprefs.sound_stereo == 2) {
+    if (currprefs.sound_stereo == SND_4CH_CLONEDSTEREO) {
        ((uae_u16*)sndbufpt)[0] = ((uae_u16*)sndbufpt)[-2];
        ((uae_u16*)sndbufpt)[1] = ((uae_u16*)sndbufpt)[-1];
-       sndbufpt = (uae_u16 *)(((uae_u8 *)sndbufpt) + 4);
+       sndbufpt = (uae_u16 *)(((uae_u8 *)sndbufpt) + 2 * 2);
+    } else if (currprefs.sound_stereo == SND_6CH_CLONEDSTEREO) {
+       ((uae_u16*)sndbufpt)[2] = ((uae_u16*)sndbufpt)[-2];
+       ((uae_u16*)sndbufpt)[3] = ((uae_u16*)sndbufpt)[-1];
+       sndbufpt = (uae_u16 *)(((uae_u8 *)sndbufpt) + 4 * 2);
     }
     if ((char *)sndbufpt - (char *)sndbuffer >= sndbufsize) {
        finish_sound_buffer ();
@@ -50,6 +54,9 @@ STATIC_INLINE void clear_sound_buffers (void)
 #define PUT_SOUND_WORD_LEFT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[0]); PUT_SOUND_WORD(b); } while (0)
 #define PUT_SOUND_BYTE_RIGHT(b) PUT_SOUND_BYTE(b)
 #define PUT_SOUND_WORD_RIGHT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[1]); PUT_SOUND_WORD(b); } while (0)
+#define PUT_SOUND_WORD_LEFT2(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[2]); PUT_SOUND_WORD(b); } while (0)
+#define PUT_SOUND_WORD_RIGHT2(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[3]); PUT_SOUND_WORD(b); } while (0)
+
 #define PUT_SOUND_WORD_MONO(b) PUT_SOUND_WORD_LEFT(b)
 #define SOUND16_BASE_VAL 0
 #define SOUND8_BASE_VAL 128
@@ -67,4 +74,3 @@ STATIC_INLINE void clear_sound_buffers (void)
 #define FILTER_SOUND_TYPE_A500 0
 #define FILTER_SOUND_TYPE_A1200 1
 
-#define ISSTEREO(p) (p.sound_stereo == 1 || p.sound_stereo == 2)
index 791c37f101c0600d916e8b724362d63821ddacb9..86bfe33ae0e35c8ece24b69782a3188978626daa 100755 (executable)
@@ -31,6 +31,7 @@
 
 #include "sysdeps.h"
 #include "options.h"
+#include "audio.h"
 #include "sound.h"
 #include "uae.h"
 #include "memory.h"
@@ -65,7 +66,6 @@
 #include "lcd.h"
 #include "uaeipc.h"
 #include "ar.h"
-#include "audio.h"
 #include "akiko.h"
 #include "cdtv.h"
 
index b72e99ad74d3a807a0d148b2e7df507e8e236ac9..9351f0f8f201b9434c2a4a66eaf8c76113e9ebbc 100755 (executable)
@@ -15,9 +15,9 @@
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEBETA 5
+#define WINUAEBETA 6
 #define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2007, 4, 8)
+#define WINUAEDATE MAKEBD(2007, 4, 9)
 
 #define IHF_WINDOWHIDDEN 6
 #define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU)
index eeed1807966f3d4b7429d63c08fe60f7a1d548aa..17f3ab8392bed2e6cd3e83976b40a6b34794552b 100755 (executable)
@@ -19,6 +19,7 @@
 
 #include "sysdeps.h"
 #include "options.h"
+#include "audio.h"
 #include "uae.h"
 #include "memory.h"
 #include "custom.h"
index fb7e222f03bdec455e27b32f3d625045d66bd7b0..27c5e5dc6b42da40c1c7aca081cbd990f5747cf8 100755 (executable)
@@ -5408,11 +5408,11 @@ static void enable_for_sounddlg (HWND hDlg)
     ew (hDlg, IDC_FREQUENCY, workprefs.produce_sound);
     ew (hDlg, IDC_SOUNDFREQ, workprefs.produce_sound ? TRUE : FALSE);
     ew (hDlg, IDC_SOUNDSTEREO, workprefs.produce_sound);
-    ew (hDlg, IDC_SOUNDINTERPOLATION, workprefs.sound_stereo < 3 && workprefs.produce_sound);
+    ew (hDlg, IDC_SOUNDINTERPOLATION, workprefs.produce_sound);
     ew (hDlg, IDC_SOUNDVOLUME, workprefs.produce_sound);
     ew (hDlg, IDC_SOUNDVOLUME2, workprefs.produce_sound);
-    ew (hDlg, IDC_SOUNDSTEREOSEP, ISSTEREO(workprefs) && workprefs.produce_sound);
-    ew (hDlg, IDC_SOUNDSTEREOMIX, ISSTEREO(workprefs) && workprefs.produce_sound);
+    ew (hDlg, IDC_SOUNDSTEREOSEP, workprefs.sound_stereo > 0 && workprefs.produce_sound);
+    ew (hDlg, IDC_SOUNDSTEREOMIX, workprefs.sound_stereo > 0 && workprefs.produce_sound);
 
     ew (hDlg, IDC_SOUNDBUFFERMEM, workprefs.produce_sound);
     ew (hDlg, IDC_SOUNDBUFFERRAM, workprefs.produce_sound);
@@ -5553,6 +5553,8 @@ static void values_to_sounddlg (HWND hDlg)
     SendDlgItemMessage(hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt);
     WIN32GUI_LoadUIString (IDS_SOUND_4CHANNEL, txt, sizeof (txt));
     SendDlgItemMessage(hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt);
+    SendDlgItemMessage(hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)"Cloned Stereo (4 Channels in 5.1)");
+    SendDlgItemMessage(hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)"4 Channels in 5.1");
     SendDlgItemMessage (hDlg, IDC_SOUNDSTEREO, CB_SETCURSEL, workprefs.sound_stereo, 0);
 
     SendDlgItemMessage(hDlg, IDC_SOUNDSWAP, CB_RESETCONTENT, 0, 0);
index 82c60565332160154a0783bfe170751bfe823ce9..25de4a7722af976efe6a2ccbdf8b1ef87b7bcbdb 100755 (executable)
@@ -1,4 +1,20 @@
 
+Beta 6:
+
+- added 4 channel and cloned stereo in 5.1 native mode. Workaround for
+  non-working 4.0 modes on many sound cards. (5.1 center and lf
+  channels are silent currently)
+- 4ch/6ch mode swap channel, interpolation, filter (anti and sinc only)
+  and stereo separation support added
+- IDE CHS calculation fixed. Max heads is always 16 and max sectors is
+  63 for drives smaller than 8GB. (A600/A1200 crashed or gurued with
+  large HDF images) >8G should also work, current "hardware" max limit
+  is 128G (no LBA48 support) NOTE: CHS value is only imaginary value for
+  compatibility purposes and it has nothing to do with real geometry, it
+  can even change and HD still works fine. Internally it is always
+  translated to LBA.
+- added some ATA-3 bits to identify drive reply
+
 Beta 5:
 
 - A600/A1200 and A4000 IDE emulation (mount RDB HDF as a IDE drive)
@@ -36,6 +52,7 @@ Beta 5:
   basically are base IO address and different interrupt register..
   
 - HRTMon IDE activated if IDE emulation enabled. AR A1200 also works.
+- 68020/68030 + JIT random crashing fixed (b4)
 - non-3d filters work again (broke in 1.4.2b2)
 - Agnus/Denise revision settings re-added to advanced chipset
 - added non-EHB A1000 to Quickstart (not yet in advanced chipset),