Sha256: 93e3dcffc93e3aa095b66a4f1312bae01c70fd907655486ffc054cf6fad646c8

Contents?: true

Size: 1.2 KB

Versions: 19

Compression:

Stored size: 1.2 KB

Contents

#include "beeps/generator.h"


#include "beeps/exception.h"
#include "signals.h"


namespace Beeps
{


	struct FileIn::Data
	{

		String path;

		Signals signals;

	};// FileIn::Data


	FileIn::FileIn (const char* path)
	{
		if (path) set_path(path);
	}

	FileIn::~FileIn ()
	{
	}

	void
	FileIn::reset ()
	{
		Super::reset();
	}

	void
	FileIn::set_path (const char* path)
	{
		if (*this)
			invalid_state_error(__FILE__, __LINE__, "path is already set");

		self->signals = Signals_load(path);
		self->path    = path;

		set_updated();
	}

	const char*
	FileIn::path () const
	{
		return self->path;
	}

	double
	FileIn::sample_rate () const
	{
		return self->signals.sample_rate();
	}

	uint
	FileIn::nchannels () const
	{
		return self->signals.nchannels();
	}

	uint
	FileIn::nsamples () const
	{
		return self->signals.nsamples();
	}

	float
	FileIn::seconds () const
	{
		return Signals_get_seconds(self->signals);
	}

	void
	FileIn::generate (Context* context, Signals* signals, uint* offset)
	{
		Super::generate(context, signals, offset);

		*offset += Signals_copy(signals, self->signals, *offset);
	}

	FileIn::operator bool () const
	{
		if (!Super::operator bool()) return false;
		return self->signals;
	}


}// Beeps

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
beeps-0.3.2 src/file_in.cpp
beeps-0.3.1 src/file_in.cpp
beeps-0.3 src/file_in.cpp
beeps-0.2.1 src/file_in.cpp
beeps-0.2 src/file_in.cpp
beeps-0.1.46 src/file_in.cpp
beeps-0.1.45 src/file_in.cpp
beeps-0.1.44 src/file_in.cpp
beeps-0.1.43 src/file_in.cpp
beeps-0.1.42 src/file_in.cpp
beeps-0.1.41 src/file_in.cpp
beeps-0.1.40 src/file_in.cpp
beeps-0.1.39 src/file_in.cpp
beeps-0.1.38 src/file_in.cpp
beeps-0.1.37 src/file_in.cpp
beeps-0.1.36 src/file_in.cpp
beeps-0.1.35 src/file_in.cpp
beeps-0.1.34 src/file_in.cpp
beeps-0.1.33 src/file_in.cpp