Exemplo n.º 1
0
/*! Set options, restarts audio stream */
v8::Handle<v8::Value> Audio::AudioEngine::setOptions( const v8::Arguments& args ) {
	HandleScope scope;
	Local<Object> options;

	if( args.Length() > 0 ) {
		if( !args[0]->IsObject() ) {
			return scope.Close( ThrowException(Exception::TypeError(String::New("First argument should be an object."))) );
		}

		options = Local<Object>::Cast( args[0] );
	} else {
		return scope.Close( Exception::TypeError(String::New("First argument does not exist.")) );
	}

	AudioEngine* pEngine = AudioEngine::Unwrap<AudioEngine>( args.This() );
	pEngine->applyOptions( options );

	return scope.Close( Undefined() );
} // end AudioEngine::SetOptions()x