Tony, apply this patch *over* your previous patch... it re-enables the SAM ioctl, unmutes (brute-force) SAM during overlay use, and restores the player SAM setting afterwards.

There's still some stuff that should be done in this area - for instance brute-forcing the unmute should be config.ini-able, but I can live with it as-is..




diff -Naru -X dontdiff linux-hj300+overlay/arch/arm/special/empeg_audio3.c linux-hj300+overlay+samfix/arch/arm/special/empeg_audio3.c
--- linux-hj300+overlay/arch/arm/special/empeg_audio3.c Sat Nov 23 17:15:26 2002
+++ linux-hj300+overlay+samfix/arch/arm/special/empeg_audio3.c Wed Nov 27 18:54:31 2002
@@ -121,6 +121,7 @@

int audio_overlay_bg_volume = AUDIO_OVERLAY_BG_VOLUME_MAX;
signed short audio_zero_sample[ AUDIO_BUFFER_SIZE/2 ] = { 0 };
+extern int sam;

/* Number of audio buffers that can be in use at any one time. This is
two less since the inactive two are actually still being used by
@@ -1228,8 +1229,18 @@
static int iSwitchToPCM = 0;
static int iFadeVolumeUp = 0;
static int iStoredVolume = 0;
+ static int iSam = 0; // Did we change SAM?
int iPreviousOverlayUsed = audio_overlay.used;
audio_dev *dev=&audio[0];
+
+ if ( audio_overlay.used > 0 && !iSam ) {
+ iSam = 1;
+ empeg_mixer_setsam(0); // Disable SAM whilst overlay is active.
+ }
+ else if ( audio_overlay.used == 0 && iSam ) {
+ iSam = 0;
+ empeg_mixer_setsam(sam); // Restore player's SAM setting.
+ }


if( empeg_mixer_get_input() != 1 ) // INPUT_PCM
diff -Naru -X dontdiff linux-hj300+overlay/arch/arm/special/empeg_mixer.c linux-hj300+overlay+samfix/arch/arm/special/empeg_mixer.c
--- linux-hj300+overlay/arch/arm/special/empeg_mixer.c Tue Nov 26 22:06:14 2002
+++ linux-hj300+overlay+samfix/arch/arm/special/empeg_mixer.c Wed Nov 27 18:47:33 2002
@@ -116,6 +116,7 @@
static struct empeg_eq_section_t eq_current[20];
static int eq_section_order[20];
static int mixer_compression = 0;
+ int sam;
static unsigned int eq_last[40];
static unsigned int eq_reg_last = 0;
static unsigned int radio_sensitivity;
@@ -621,11 +622,13 @@
}
case EMPEG_MIXER_SET_SAM:
{
- int sam;
+ /*int sam; Now global */

copy_from_user_ret((void *) &sam, (const void *) arg,
sizeof(int), -EFAULT);

+ empeg_mixer_setsam(sam);
+ /*
if(sam) dsp_write(Y_switch, 0);
else dsp_write(Y_switch, 0x5d4); // 4.6ms

@@ -634,7 +637,7 @@
": mixer_ioctl EMPEG_MIXER_SET_SAM %d\n",
sam);
#endif
-
+ */
return 0;
}
case EMPEG_MIXER_RAW_I2C_READ:
@@ -873,6 +876,18 @@
#endif
}

+void empeg_mixer_setsam(int on)
+{
+ if(on) dsp_write(Y_switch, 0);
+ else dsp_write(Y_switch, 0x5d4); // 4.6ms
+
+#if MIXER_DEBUG
+printk(MIXER_NAME
+ ": mixer_ioctl EMPEG_MIXER_SET_SAM %d\n",
+ sam);
+#endif
+}
+
int empeg_mixer_get_input()
{
return mixer_global.inputInternal;
@@ -1220,7 +1235,9 @@
(void) empeg_mixer_setvolume(vol);
}

-/*static*/ int empeg_mixer_setvolume(/*mixer_dev *dev,*/ int vol)
+
+/*static*/
+int empeg_mixer_setvolume(/*mixer_dev *dev,*/ int vol)
{
hijack_current_mixer_volume = vol;
dsp_write(Y_VAT, volume_table[vol].vat);
diff -Naru -X dontdiff linux-hj300+overlay/arch/arm/special/empeg_mixer.h linux-hj300+overlay+samfix/arch/arm/special/empeg_mixer.h
--- linux-hj300+overlay/arch/arm/special/empeg_mixer.h Sat Nov 23 17:15:26 2002
+++ linux-hj300+overlay+samfix/arch/arm/special/empeg_mixer.h Wed Nov 27 16:47:39 2002
@@ -30,4 +30,6 @@
int empeg_mixer_setvolume(int vol);
int empeg_mixer_getvolume(void);

+void empeg_mixer_setsam (int on);
+
#endif


Attachments
127182-samfix.patch (240 downloads)

_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.