Esempio n. 1
0
void AUD_updateSequencerData(AUD_Sound* sequencer, float speed_of_sound,
							 float factor, AUD_DistanceModel model)
{
	AUD_SequencerFactory* f = dynamic_cast<AUD_SequencerFactory*>(sequencer->get());
	f->setSpeedOfSound(speed_of_sound);
	f->setDopplerFactor(factor);
	f->setDistanceModel(model);
}
Esempio n. 2
0
const char *AUD_mixdown(AUD_Sound *sound, unsigned int start, unsigned int length, unsigned int buffersize, const char *filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate)
{
	try {
		AUD_SequencerFactory *f = dynamic_cast<AUD_SequencerFactory *>(sound->get());

		f->setSpecs(specs.specs);
		boost::shared_ptr<AUD_IReader> reader = f->createQualityReader();
		reader->seek(start);
		boost::shared_ptr<AUD_IWriter> writer = AUD_FileWriter::createWriter(filename, specs, format, codec, bitrate);
		AUD_FileWriter::writeReader(reader, writer, length, buffersize);

		return NULL;
	}
	catch(AUD_Exception& e)
	{
		return e.str;
	}
}
Esempio n. 3
0
const char *AUD_mixdown_per_channel(AUD_Sound *sound, unsigned int start, unsigned int length, unsigned int buffersize, const char *filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate)
{
	try {
		AUD_SequencerFactory *f = dynamic_cast<AUD_SequencerFactory *>(sound->get());

		f->setSpecs(specs.specs);

		std::vector<boost::shared_ptr<AUD_IWriter> > writers;

		int channels = specs.channels;
		specs.channels = AUD_CHANNELS_MONO;

		for (int i = 0; i < channels; i++) {
			std::stringstream stream;
			std::string fn = filename;
			size_t index = fn.find_last_of('.');
			size_t index_slash = fn.find_last_of('/');
			size_t index_backslash = fn.find_last_of('\\');

			if ((index == std::string::npos) ||
			    ((index < index_slash) && (index_slash != std::string::npos)) ||
			    ((index < index_backslash) && (index_backslash != std::string::npos)))
			{
				stream << filename << "_" << (i + 1);
			}
			else {
				stream << fn.substr(0, index) << "_" << (i + 1) << fn.substr(index);
			}
			writers.push_back(AUD_FileWriter::createWriter(stream.str(), specs, format, codec, bitrate));
		}

		boost::shared_ptr<AUD_IReader> reader = f->createQualityReader();
		reader->seek(start);
		AUD_FileWriter::writeReader(reader, writers, length, buffersize);

		return NULL;
	}
	catch(AUD_Exception& e)
	{
		return e.str;
	}
}
Esempio n. 4
0
AUD_Device *AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound *sequencer, float volume, float start)
{
	try {
		AUD_ReadDevice *device = new AUD_ReadDevice(specs);
		device->setQuality(true);
		device->setVolume(volume);

		AUD_SequencerFactory *f = dynamic_cast<AUD_SequencerFactory *>(sequencer->get());

		f->setSpecs(specs.specs);

		AUD_Handle handle = device->play(f->createQualityReader());
		if (handle.get()) {
			handle->seek(start);
		}

		return new AUD_Device(device);
	}
	catch(AUD_Exception&)
	{
		return NULL;
	}
}