From: Toni Wilen Date: Mon, 9 Apr 2007 08:37:57 +0000 (+0300) Subject: imported winuaesrc1420b6.zip X-Git-Tag: 2100~229 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=9b5ffd2b37d9b55b9beea04d8b0967056ee07eeb;p=francis%2Fwinuae.git imported winuaesrc1420b6.zip --- diff --git a/audio.c b/audio.c index 7b6615f2..99782fda 100755 --- 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; } diff --git a/cfgfile.c b/cfgfile.c index 4ed2afde..a6a2f446 100755 --- 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 diff --git a/custom.c b/custom.c index a1e855f2..6b8b24e2 100755 --- 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 4cd8bc3a..42e68a25 100755 --- 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" diff --git a/driveclick.c b/driveclick.c index 643a33cc..ea51ab39 100755 --- a/driveclick.c +++ b/driveclick.c @@ -13,11 +13,11 @@ #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); diff --git a/filesys.c b/filesys.c index 0c845e53..f247b11d 100755 --- 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 f0187ce7..4166e32f 100755 --- 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; diff --git a/hardfile.c b/hardfile.c index e0325024..52651add 100755 --- a/hardfile.c +++ b/hardfile.c @@ -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; diff --git a/include/audio.h b/include/audio.h index cdc6021a..7ad95771 100755 --- a/include/audio.h +++ b/include/audio.h @@ -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 diff --git a/include/filesys.h b/include/filesys.h index a3272a9b..b01a8f15 100755 --- a/include/filesys.h +++ b/include/filesys.h @@ -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); diff --git a/inputdevice.c b/inputdevice.c index 349d4e98..6bbf045b 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -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" diff --git a/od-win32/ahidsound.c b/od-win32/ahidsound.c index d6842b85..b00fc011 100755 --- a/od-win32/ahidsound.c +++ b/od-win32/ahidsound.c @@ -26,6 +26,7 @@ #include "sysdeps.h" #include "options.h" +#include "audio.h" #include "memory.h" #include "events.h" #include "custom.h" diff --git a/od-win32/avioutput.c b/od-win32/avioutput.c index 78021d22..6a9a0f80 100755 --- a/od-win32/avioutput.c +++ b/od-win32/avioutput.c @@ -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); diff --git a/od-win32/keyboard_win32.c b/od-win32/keyboard_win32.c index 5c5d50b0..1ea45a20 100755 --- a/od-win32/keyboard_win32.c +++ b/od-win32/keyboard_win32.c @@ -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" diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 922444f1..1b4b1195 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -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 "" END diff --git a/od-win32/sounddep/sound.c b/od-win32/sounddep/sound.c index d9e2100d..8755c084 100755 --- a/od-win32/sounddep/sound.c +++ b/od-win32/sounddep/sound.c @@ -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 #include @@ -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 diff --git a/od-win32/sounddep/sound.h b/od-win32/sounddep/sound.h index 422390fe..343c7da8 100755 --- a/od-win32/sounddep/sound.h +++ b/od-win32/sounddep/sound.h @@ -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) diff --git a/od-win32/win32.c b/od-win32/win32.c index 791c37f1..86bfe33a 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -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" diff --git a/od-win32/win32.h b/od-win32/win32.h index b72e99ad..9351f0f8 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -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) diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index eeed1807..17f3ab83 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -19,6 +19,7 @@ #include "sysdeps.h" #include "options.h" +#include "audio.h" #include "uae.h" #include "memory.h" #include "custom.h" diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index fb7e222f..27c5e5dc 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -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); diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 82c60565..25de4a77 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -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),