Problem ID Already returned =0 Ok Error Sound4.0

tauruslittrow84

New member
Joined
Nov 12, 2011
Messages
58
Reaction score
0
Points
0
I want a custom sound to play when my SolPanels open and when My Radar spins... Using OrbiterSound 4.0 I get the following in the Orbiter Sound Log:
Code:
Orbiter directory:  C:\Users\crice\Documents\orbiter\
Listing planets winds and bases sounds:
  6 planet wind sound found
  5 bases sound found
Passed initModule - Ok
Attempting RenderViewport initialisation...
Attempting GetStartValue initialisation...
Passed GetStartValue - Ok
Initialising directsound...
   Sound hardware capabilities: Driver is not certified.
   Maximum hardware mixing buffers: 1.
   Maximum hardware 3D buffers: 0. 
   Speaker configuration: stereo with wide (arc of 20 deg.) geometry  
   Attempt to create Primary buffer: 22050hz 16bits 3d: yes 
   3D primary buffer initialised OK
directsound initialised - OK
Passed RenderViewport - Ok
Attempting Mp3 initialisation...
M3U list found attempting loading it.
MP3 found in playlist =  20
Mp3 initialised - Ok
Focus changed attempting to load vessel wave
Info: Sound config found for class: chippersat. 30 parameters set.
Focus changed load vessel wave - OK
Vessel chippersat-01 requested an ID, returned= 0 OK 
Vessel chippersat-01 requested but had already an Id returned= 0 OK 
Vessel chippersat-01 requested but had already an Id returned= 0 OK 
Vessel chippersat-01 requested but had already an Id returned= 0 OK 
Vessel chippersat-01 requested but had already an Id returned= 0 OK 
Vessel chippersat-01 requested but had already an Id returned= 0 OK 
Vessel chippersat-01 requested but had already an Id returned= 0 OK 
Vessel chippersat-01 requested but had already an Id returned= 0 OK

in my .h file
Code:
#include "orbitersdk.h"
#include "payloadmanager.h"
#include "resource.h" 
#define SOLARPANELSOUND 56
#define RADARFLAGSOUND 57
// ==============================================================
// Some parameters and capabilities
// ==============================================================

 
const double SOLARPANEL_OPERATING_SPEED = 0.025;
const double RADARFLAG_OPERATING_SPEED = 1.500;
 

// ==============================================================
// chippersat class interface
// ==============================================================

class chippersat: public VesselWithPM<chippersat> {
public:
	enum DoorStatus { DOOR_CLOSED, DOOR_OPEN, DOOR_CLOSING, DOOR_OPENING } pan_status, radarflag_status;
	chippersat (OBJHANDLE hObj, int fmodel);
	void DefineAnimations (void);
	void ActivateSolarPanels (DoorStatus action);
	void RevertSolarPanels (void);
	void ActivateRadarflag (DoorStatus action);
	void RevertRadarflag (void);
	 

	// Overloaded callback functions
	void clbkSetClassCaps (FILEHANDLE cfg);
	void clbkLoadStateEx (FILEHANDLE scn, void *vs);
	void clbkSaveState (FILEHANDLE scn); 
	void clbkPostStep (double simt, double simdt, double mjd); 
	int  clbkConsumeBufferedKey (DWORD key, bool down, char *kstate);
	int  clbkGeneric (int msgid, int prm, void *context); 
	void PM_clbkPayloadJettisoned (int slot_idx, OBJHANDLE jettisoned_ship);
	void PM_clbkVehicleCapsChanged();
	int MyID;

bool shouldAnimateTheThing;
private:
    void DefineThrusters();
	void Test();
	UINT anim_pan, anim_radarflag;
    char j_name[32];
	double j_timer;
	double pan_proc, radarflag_proc;
 

 

	// script interface-related methods, implemented in HST_Lua.cpp
	int Lua_InitInterpreter (void *context);
	int Lua_InitInstance (void *context);
};

#endif // !__chippersat_H

in my .cpp file
Code:
{
	MyID=ConnectToOrbiterSoundDLL(GetHandle());
    SetMyDefaultWaveDirectory("Sound\\_CustomVesselsSounds\\Chippersat\\");
	RequestLoadVesselWave(MyID,SOLARPANELSOUND,"mypanelopening.wav",BOTHVIEW_FADED_MEDIUM);
	RequestLoadVesselWave(MyID,RADARFLAGSOUND,"radflagstart.wav",BOTHVIEW_FADED_MEDIUM);

	 
	 
}




int chippersat::clbkConsumeBufferedKey (DWORD key, bool down, char *kstate)
{
	if (!down) return 0; // only process keydown events

	if (KEYMOD_CONTROL (kstate)) {

		switch (key) {
        case OAPI_KEY_DIVIDE:  // enable/disable RCS
			if (SetAttitudeMode (GetAttitudeMode() >= 1 ? 0 : 1));
			 
			return 1;
			case OAPI_KEY_1:
			PM_DetachPayloadByIndex(0);
			return 1;
		case OAPI_KEY_2:
			PM_DetachPayloadByIndex(1);
			return 1;
		case OAPI_KEY_3:
			PM_DetachPayloadByIndex(2);
			return 1;
		case OAPI_KEY_4:
			PM_DetachPayloadByIndex(3);
			return 1;
		case OAPI_KEY_5:
			PM_DetachPayloadByIndex(4);
			return 1;
		case OAPI_KEY_6:
			PM_DetachPayloadByIndex(5);
			return 1;
		case OAPI_KEY_7:
			PM_DetachPayloadByIndex(6);
			return 1;
		case OAPI_KEY_8:
			PM_DetachPayloadByIndex(7);
			return 1;
		case OAPI_KEY_9:
			PM_DetachPayloadByIndex(8);
			return 1;
		case OAPI_KEY_0:
			PM_DetachPayloadByIndex(9);
			return 1;
		}
	}else{
	switch (key) {
		case OAPI_KEY_1: // deploy/retract solar panels
			PlayVesselWave(MyID,SOLARPANELSOUND,NOLOOP,255);
			RevertSolarPanels();
			return 1;
		case OAPI_KEY_2: // start/stop radarflag
			PlayVesselWave(MyID,RADARFLAGSOUND,LOOP,255);
			shouldAnimateTheThing = !shouldAnimateTheThing; 
			return 1;
		case OAPI_KEY_J:
			// Pressing J-key will starting payloads jettisoning sequence
			PM_BeginDetachPayloads();
			return 1;
	}
	 
	}
	return 0;
}
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,704
Reaction score
2,681
Points
203
Location
Dallas, TX
try sticking this like this in cpp:
Code:
void chippersat::clbkPostCreation (void)
{
	MyID=ConnectToOrbiterSoundDLL(GetHandle());
    SetMyDefaultWaveDirectory("Sound\\_CustomVesselsSounds\\Chippersat\\");
	RequestLoadVesselWave(MyID,SOLARPANELSOUND,"mypanelopening.wav",BOTHVIEW_FADED_MEDIUM);
	RequestLoadVesselWave(MyID,RADARFLAGSOUND,"radflagstart.wav",BOTHVIEW_FADED_MEDIUM);

	 
	 
}
and h:
Code:
  void clbkPostCreation (void);
 
Top