示例#1
0
// draws the oscilloscope
void
Oscilloscope (DWORD grab_data)
{
	STAMP s;

	if (oscillDisabled)
		return;

	if (!grab_data)
		return;

	TFB_DrawImage_Image (scope_bg, 0, 0, 0, NULL, scope_surf);
	if (GetSoundData (scope_data)) 
	{
		int i, r, g, b;		
		TFB_DrawCanvas_GetPixel (scope_bg->NormalImg,
				scope_bg->extent.width / 2, scope_bg->extent.height / 2,
				&r, &g, &b);
		for (i = 0; i < RADAR_WIDTH - 3; ++i)
			TFB_DrawImage_Line (i + 1, scope_data[i], i + 2,
					scope_data[i + 1], r, g, b, scope_surf);
	}
	TFB_DrawImage_Image (scope_surf, 0, 0, 0, NULL, scope_frame->image);

	s.frame = scope_frame;
	s.origin.x = s.origin.y = 0;
	DrawStamp (&s);
}
示例#2
0
文件: Sound.cpp 项目: prophile/xsera
static ALuint GetSound(const std::string& name)
{
	BufferMap::iterator iter = sounds.find(name);
	if (iter != sounds.end())
		return iter->second;
	size_t length;
	ALubyte* data = GetSoundData("Sounds/" + name, length);
	ALuint buf = alureCreateBufferFromMemory(data, length);
	free(data);
	sounds.insert(std::make_pair(name, buf));
	return buf;
}
示例#3
0
文件: Sound.cpp 项目: prophile/xsera
void PlayMusic(const std::string& name)
{
	StopMusic();
	size_t length;
	ALubyte* data = GetSoundData("Music/" + name, length);
	currentMusicName = name;
	currentMusicStream = alureCreateStreamFromStaticMemory(data, length, CHUNK_LENGTH, 2, musicBufs);
	alurePlaySourceStream(musicSource, currentMusicStream, 2, 1, MusicEndCallback, data);
	LOG("Sound", LOG_MESSAGE, "Music: %s", name.c_str());
	if (!data)
		LOG("Sound", LOG_WARNING, "failed to find music");
}
示例#4
0
文件: Sound.cpp 项目: adam000/Apollo
static ALuint GetSound(const std::string& name)
{
	BufferMap::iterator iter = sounds.find(name);
	if (iter != sounds.end())
		return iter->second;
	size_t length;
	ALubyte* data = GetSoundData("Sounds/" + name, length);
	ALuint buf = alureCreateBufferFromMemory(data, length);
	free(data);
	sounds.insert(std::make_pair(name, buf));
#ifndef NDEBUG
    const ALchar* err = alureGetErrorString();
    if (strcmp(err, "No error"))
    {
        LOG("Sound", LOG_ERROR, "GetSound: %s", err);
        exit(1);
    }
#endif
	return buf;
}
示例#5
0
文件: Sound.cpp 项目: adam000/Apollo
void PlayMusic(const std::string& name)
{
	StopMusic();
	size_t length;
	ALubyte* data = GetSoundData("Music/" + name, length);
	currentMusicName = name;
	currentMusicStream = alureCreateStreamFromStaticMemory(data, length, CHUNK_LENGTH, 2, musicBufs);
	alurePlaySourceStream(musicSource, currentMusicStream, 2, 1, MusicEndCallback, data);
	LOG("Sound", LOG_MESSAGE, "Music: %s", name.c_str());
	if (!data)
		LOG("Sound", LOG_WARNING, "failed to find music");
#ifndef NDEBUG
    if (alGetError())
        LOG("Sound", LOG_ERROR, "OpenAL error");
    const ALchar* err = alureGetErrorString();
    if (strcmp(err, "No error"))
    {
        LOG("Sound", LOG_ERROR, "ALURE error attempting to play song %s: %s", name.c_str(), err);
        exit(1);
    }
#endif
}
示例#6
0
//static	BOOL FillSoundChannel(SoundManager *sm, char* Dir, char *Name, unsigned int* Handle )
static	BOOL FillSoundChannel(SoundManager *sm, geVFile *File, unsigned int* Handle )
{
	DSBUFFERDESC	dsBD;
	INT NumBytes;
	uint8		*data = NULL;
	BYTE *			pbWaveData;
//	char*	Name2;
	Channel* channel;

	*Handle = 0;
	if (!sm)
		return TRUE;

#if 0
	//Open the file
	if (Dir)
	{
		Name2 = malloc( strlen( Name ) + strlen( Dir ) + 3);  // 2 for the "//" and 1 for terminator
		if( !Name2 )
			return( 0 );
		sprintf(Name2, "%s\\%s", Dir, Name);
	}
	else
	{
		Name2 = malloc( strlen( Name ) + 3);  // 2 for the "//" and 1 for terminator
		if( !Name2 )
			return( 0 );

		sprintf(Name2, "%s", Name);
	}
#endif
	if(!GetSoundData( File, &data ))
		return( FALSE );

	if( !ParseData( data, &dsBD, &pbWaveData ) )
	{
		geRam_Free(data);
		return( FALSE );
	}

	NumBytes = dsBD.dwBufferBytes;
	
	//Create the channel
//	if( !CreateChannel( Name2, &dsBD, &channel ) )
	if	(!CreateChannel(&dsBD, &channel))
	{
		geRam_Free(data);
		return FALSE;
	}
	channel->next = sm->smChannels;
	channel->ID = sm->smNextChannelID++;
	channel->Data = data;

	sm->smChannels = channel;
	sm->smChannelCount++;

	//Fill the channel
	if (!DSFillSoundBuffer(channel->buffer, pbWaveData, NumBytes))
		return FALSE;
	
//	free( data );
//	geRam_Free(data);

	*Handle = channel->ID;
	return TRUE;
}