Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Unable to stop looping DirectSound with this code.

Featured Replies

I've got this:

// BOOL32 audio_warning_muted;  // Defined globally in multi-gaugeFLOAT64 FSAPI	lrrpm_cb( PELEMENT_ICON pelement ){	double	rrpm = pelement->source_var.var_value.n;	MODULE_VAR r_rpm = {TURB_ENGINE_1_N2};	lookup_var(&r_rpm);	rrpm = r_rpm.var_value.n;	if (rrpm < 90) {				// Warning condition true		low_rrpm = 1;		if ( audio_warning_muted )			(GaugeStopSound)("lrrpm");		else			(GaugePlaySound)("soundBenchmark.B206B3LowRotor.Loop.wav","lrrpm",1);	}else{		(GaugeStopSound)("lrrpm");		// RRPM Normal (turn off Icon)		low_rrpm = 0;		// Reset audio mute		audio_warning_muted = 0;	}	return FALSE;}// Low Rotor RPM Warning ON bitmap as an icon.// This icon must be invisible when loadingMAKE_ICON(		lrrpm_on_icon,				BMP_LOW_ROTOR_ON,				NULL,				NULL,				IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | IMAGE_USE_BRIGHT | IMAGE_HIDDEN,				0,				0,0,				TURB_ENGINE_1_N2, 				lrrpm_cb,				ICON_SWITCH_TYPE_SET_CUR_ICON,				1,				0,				0 )PELEMENT_HEADER		lrrpm_on_icon_plist[] ={	&lrrpm_on_icon.header,	NULL};// Low Rotor RPM Warning OFF bitmap is the background.MAKE_STATIC (	lrrpm_off_icon,				BMP_LOW_ROTOR_OFF,				&lrrpm_on_icon_plist,				NULL,				IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | IMAGE_USE_BRIGHT,				0,				0,0 )PELEMENT_HEADER	lrrpm_list	= &lrrpm_off_icon.header;

which is the relevent part. Other parts are all tested, and working.Here is the gauge call back using gaugesound.dll

void FSAPI lrrpm_gcb (PGAUGEHDR pgauge, int service_id, UINT32 extra_data){	switch(service_id)	{		case	PANEL_SERVICE_PRE_INSTALL:			break;		case	PANEL_SERVICE_PRE_INITIALIZE:			//Register the click sound with FS when loading the panel			if (MGaugeSound == NULL) {MGaugeSound = LoadLibrary("GaugeSound");}			//bg_element = (PELEMENT_STATIC_IMAGE)pgauge->elements_list[0];			GaugePlaySound = (TGaugePlaySound)GetProcAddress(MGaugeSound,"GaugePlaySound");			GaugeStopSound = (TGaugeStopSound)GetProcAddress(MGaugeSound,"GaugeStopSound");			TerminateSounds = (TTerminateSounds)GetProcAddress(MGaugeSound,"TerminateSounds");			break;		case	PANEL_SERVICE_PRE_UPDATE:			//Now show and hide the switch bitmaps by showing and hiding the icons			if ( low_rrpm )			{				// LOW ROTOR WARNING LIGHT ON				SHOW_LISTELEMENT(pgauge->elements_list[0],1);			}else{				// LOW ROTOR WARNING LIGHT OFF				HIDE_LISTELEMENT(pgauge->elements_list[0],1);			}			break;		case	PANEL_SERVICE_PRE_DRAW:			break;		case	PANEL_SERVICE_PRE_KILL:			//Unregister the sound when unloading the panel			MGaugeSound = GetModuleHandle("GaugeSound");			if (MGaugeSound == NULL) {MGaugeSound = LoadLibrary("GaugeSound");}			GaugePlaySound = (TGaugePlaySound)GetProcAddress(MGaugeSound,"GaugePlaySound");			GaugeStopSound = (TGaugeStopSound)GetProcAddress(MGaugeSound,"GaugeStopSound");			TerminateSounds = (TTerminateSounds)GetProcAddress(MGaugeSound,"TerminateSounds");			(TerminateSounds)();			FreeLibrary(MGaugeSound);			break;	}}

You'll note that I am using the background as the "off" bitmap, and a single MAKE_ICON for the "on" condition. The ICON works per the parameters, and I've verfied the BOOL toggles, but for some reason, I can't shut the sound down.Any ideas?Thanks

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.