Exemple #1
0
	ErrorType SoundSource::Load(const String &fileName,
		SoundCollection *collection)
	{
		Stop();
		Bind(collection, collection->GetIDByName(fileName));
		if (-1 < mID)
			return kErrorNone;
		// No sound was found, load the sound data
		SoundData soundData;
		ErrorType error = soundData.Load(fileName);
		if (error)
			return Error::Throw(error, String("[%s(\"%s\")]",
				FastFunctionName, fileName.GetCString()));
		return LoadResource(fileName, soundData, collection);
	}
Exemple #2
0
	ErrorType SoundSource::Load(StreamReader *streamReader,
		SoundCollection *collection)
	{
		String name = streamReader->GetName();
		Stop();
		Bind(collection, collection->GetIDByName(name));
		if (-1 < mID)
			return kErrorNone;
		// No sound was found, load the sound data
		SoundData soundData;
		ErrorType error = soundData.Load(streamReader);
		if (error)
			return Error::Throw(error,
				String("[%s(%p): streamReader->mName=\"%s\"]",
					FastFunctionName, streamReader,
					streamReader->GetName().GetCString()));
		return LoadResource(name, soundData, collection);
	}