예제 #1
0
AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, float start)
{
	try
	{
		ReadDevice* device = new ReadDevice(convCToDSpec(specs));
		device->setQuality(true);
		device->setVolume(volume);

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

		f->setSpecs(convCToSpec(specs.specs));

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

		return new AUD_Device(device);
	}
	catch(Exception&)
	{
		return nullptr;
	}
}
예제 #2
0
AUD_API 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
	{
		Sequence* f = dynamic_cast<Sequence *>(sound->get());

		f->setSpecs(convCToSpec(specs.specs));

		std::vector<std::shared_ptr<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(FileWriter::createWriter(stream.str(), convCToDSpec(specs), static_cast<Container>(format), static_cast<Codec>(codec), bitrate));
		}

		std::shared_ptr<IReader> reader = f->createQualityReader();
		reader->seek(start);
		FileWriter::writeReader(reader, writers, length, buffersize);

		return nullptr;
	}
	catch(Exception& e)
	{
		return e.getMessage().c_str();
	}
}
예제 #3
0
AUD_API 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
	{
		Sequence* f = dynamic_cast<Sequence *>(sound->get());

		f->setSpecs(convCToSpec(specs.specs));
		std::shared_ptr<IReader> reader = f->createQualityReader();
		reader->seek(start);
		std::shared_ptr<IWriter> writer = FileWriter::createWriter(filename, convCToDSpec(specs), static_cast<Container>(format), static_cast<Codec>(codec), bitrate);
		FileWriter::writeReader(reader, writer, length, buffersize);

		return nullptr;
	}
	catch(Exception& e)
	{
		return e.getMessage().c_str();
	}
}