Beebem startup sounds

discussion of beeb/electron applications, languages, utils and educational s/w
Post Reply
wnmderek
Posts: 27
Joined: Sun Oct 14, 2018 11:31 pm
Contact:

Beebem startup sounds

Post by wnmderek » Tue Oct 23, 2018 6:50 am

Is it possible on Beebem 4.14 to disable that beep and disk sounds etc when beebem starts up?

I've tried the sound settings and can't shut it up.

I only want sound if my program is playing sound.

Is it possible? If so and I have been silky and missed something obvious apologies in advance.
Last edited by wnmderek on Tue Oct 23, 2018 6:50 am, edited 1 time in total.

User avatar
jgharston
Posts: 3248
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Beebem startup sounds

Post by jgharston » Tue Oct 23, 2018 11:17 am

wnmderek wrote:
Tue Oct 23, 2018 6:50 am
Is it possible on Beebem 4.14 to disable that beep and disk sounds etc when beebem starts up?
I've tried the sound settings and can't shut it up.
Sound -> Sound Effects -> Disk drive -> Off

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

wnmderek
Posts: 27
Joined: Sun Oct 14, 2018 11:31 pm
Contact:

Re: Beebem startup sounds

Post by wnmderek » Tue Oct 23, 2018 11:44 am

Thank you for your reply. I have done that. I am now just stuck with that initial bbc startup beep. I put the .snd files in a backup folder. It's just I am re-assembling files each few minutes and each time beebem fires up it does that beep that takes ages to shup up - its my timer routine i know but it is annoying. On a normal Beeb it would of shut up before getting anywhere near my aging grotty code! :)

User avatar
jgharston
Posts: 3248
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Beebem startup sounds

Post by jgharston » Wed Oct 24, 2018 2:02 pm

wnmderek wrote:
Tue Oct 23, 2018 11:44 am
Thank you for your reply. I have done that. I am now just stuck with that initial bbc startup beep.
Well, to stop that you'd have to reprogram the MOS to stop a power-on-reset doing a beep! But power-on-reset <i>needs</i> to do a beep to put the sound hardware into a defined state - that's the burrrrr bit before the beep. Or do the BeebEm equivalent of unplugging the speaker with Sound -> Sound Off.
Last edited by jgharston on Wed Oct 24, 2018 2:02 pm, edited 1 time in total.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
1024MAK
Posts: 8008
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Beebem startup sounds

Post by 1024MAK » Wed Oct 24, 2018 2:35 pm

Yeah, just to be clear, in real hardware, when the power is applied to the sound chip, it’s internal registers are in an undefined state. So it produces sound. This is the first “burr” sound. The MOS has to explicitly tell the sound chip to “shut-up”. The second beep is generated by the MOS itself.

Mark

wnmderek
Posts: 27
Joined: Sun Oct 14, 2018 11:31 pm
Contact:

Re: Beebem startup sounds

Post by wnmderek » Wed Oct 24, 2018 2:43 pm

Hi,

Thanks for clarification. I kind of realise now it was a rather silly question!

:oops:

User avatar
ctr
Posts: 183
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

Re: Beebem startup sounds

Post by ctr » Wed Oct 24, 2018 5:37 pm

It's not silly. It does get irritating when you're repeatedly running beebem to test your software. You've prompted me to find a (hideous) workaround using powershell. Which does assume you're on Windows. And it's only tested on Windows 10.

Save this in a file called "runbeebem.ps1" (note that's a one not an ell on the end).

Code: Select all

# Parameters
param (
    [Parameter(Mandatory=$true)][string]$ssd
)
# Boilerplate to control the sound from:
# https://stackoverflow.com/a/19348221
Add-Type -TypeDefinition @'
using System.Runtime.InteropServices;

[Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IAudioEndpointVolume {
  // f(), g(), ... are unused COM method slots. Define these if you care
  int f(); int g(); int h(); int i();
  int SetMasterVolumeLevelScalar(float fLevel, System.Guid pguidEventContext);
  int j();
  int GetMasterVolumeLevelScalar(out float pfLevel);
  int k(); int l(); int m(); int n();
  int SetMute([MarshalAs(UnmanagedType.Bool)] bool bMute, System.Guid pguidEventContext);
  int GetMute(out bool pbMute);
}
[Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IMMDevice {
  int Activate(ref System.Guid id, int clsCtx, int activationParams, out IAudioEndpointVolume aev);
}
[Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IMMDeviceEnumerator {
  int f(); // Unused
  int GetDefaultAudioEndpoint(int dataFlow, int role, out IMMDevice endpoint);
}
[ComImport, Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")] class MMDeviceEnumeratorComObject { }

public class Audio {
  static IAudioEndpointVolume Vol() {
    var enumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator;
    IMMDevice dev = null;
    Marshal.ThrowExceptionForHR(enumerator.GetDefaultAudioEndpoint(/*eRender*/ 0, /*eMultimedia*/ 1, out dev));
    IAudioEndpointVolume epv = null;
    var epvid = typeof(IAudioEndpointVolume).GUID;
    Marshal.ThrowExceptionForHR(dev.Activate(ref epvid, /*CLSCTX_ALL*/ 23, 0, out epv));
    return epv;
  }
  public static float Volume {
    get {float v = -1; Marshal.ThrowExceptionForHR(Vol().GetMasterVolumeLevelScalar(out v)); return v;}
    set {Marshal.ThrowExceptionForHR(Vol().SetMasterVolumeLevelScalar(value, System.Guid.Empty));}
  }
  public static bool Mute {
    get { bool mute; Marshal.ThrowExceptionForHR(Vol().GetMute(out mute)); return mute; }
    set { Marshal.ThrowExceptionForHR(Vol().SetMute(value, System.Guid.Empty)); }
  }
}
'@

# Turn the sound off
[Audio]::Mute = $true
# Change beebem path here
& "S:\beebem\beebem.exe" $ssd
# Wait for three seconds
Start-Sleep 3
# Turn the sound on
[Audio]::Mute = $false
You can run the script with:

Code: Select all

powershell -ExecutionPolicy unrestricted -File S:\beebem\runbeebem.ps1 -ssd "S:\Games\Disc103-ChuckieEgg6.ssd"
Obviously you'll need to alter the path to beebem in the script and the the two paths in the command.

Post Reply