示例#1
0
/********************************************************************************************
 Begin vrpn_Sound_Server_Miles
 *******************************************************************************************/
vrpn_Sound_Server_Miles::vrpn_Sound_Server_Miles(const char * name, vrpn_Connection * c)
				  : vrpn_Sound_Server(name, c)
{
	AIL_startup();							//initialize the Miles SDK stuff

	
	//load a digital driver
	if (!AIL_quick_startup(1,0,44100,16,2)) {
     MessageBox(0,"Couldn't open a digital output device.","Error",MB_OK);
    }

    AIL_quick_handles(&DIG,0,0);

	
	// No sound played yet
	LastSoundId = -1;

	provider = 0;
	//Set variables to control size and growing of Audio handle array
	H_Max = vrpn_Sound_START;
	H_Cur = 0;

	//Allocate space for Audio Handle array
	samples = new H3DSAMPLE[H_Max];

	//Set variables to control size and growing of providers array
	P_Max = vrpn_Sound_START;
	P_Cur = 0;

	//Allocate space for Audio Handle array
	providers = new HPROVIDER[P_Max];

	// init eye from sensor matrix
	eye_f_sensor_m[0] = 1.0;
	eye_f_sensor_m[1] = 0.0;
	eye_f_sensor_m[2] = 0.0;
	eye_f_sensor_m[3] = 0.0;
	eye_f_sensor_m[4] = 0.0;
	eye_f_sensor_m[5] = 1.0;
	eye_f_sensor_m[6] = 0.0;
	eye_f_sensor_m[7] = 0.0;
	eye_f_sensor_m[8] = 0.0;
	eye_f_sensor_m[9] = 0.0;
	eye_f_sensor_m[10] = 1.0;
	eye_f_sensor_m[11] = 0.0;
	eye_f_sensor_m[12] = 0.0;
	eye_f_sensor_m[13] = 0.0;
	eye_f_sensor_m[14] = 0.0;
	eye_f_sensor_m[15] = 1.0;
	
}
示例#2
0
void SoundManager::InitSoundDriver()
{
#if defined(USE_SDL)
	int     use_digital     = 1;
	int     use_MIDI        = 0;
	int     output_rate     = 22050;	// 22khz @ 16 Bit stereo
	Uint16  output_format   = AUDIO_S16SYS;
	int     output_channels = 2;
	int     errcode         = SDL_Init(SDL_INIT_AUDIO | m_SDLInitFlags);

    if (errcode < 0) 
    {
        // char *err = SDL_GetError(); cerr << "SDL Init failed:" << err << endl;
    }
    else
    {
        errcode = Mix_OpenAudio(output_rate, output_format, output_channels, 8192);
        if (errcode < 0) 
        {
            // char *err = SDL_GetError(); cerr << "Opening mixer failed:" << err << endl;
        }
    } 

    m_noSound = (errcode < 0);
#else // !USE_SDL
	S32		use_digital     = 1;
	S32		use_MIDI        = 0;
	S32		output_rate     = 22050;	// 22khz @ 16 Bit stereo
	S32		output_bits     = 16;
	S32		output_channels = 2;

	m_noSound = !AIL_quick_startup
            (use_digital, use_MIDI, output_rate, output_bits, output_channels);
#endif // defined(USE_SDL)

	InitRedbook();

	SetVolume(SOUNDTYPE_SFX,   m_sfxVolume);
	SetVolume(SOUNDTYPE_VOICE, m_voiceVolume);
	SetVolume(SOUNDTYPE_MUSIC, m_musicVolume);
}