How do I convert a function wrapper in to templates?
===

I have several very similar functions:

	v8::Handle<v8::Value> jsAudioPlay(const v8::Arguments &args) {
		Audio *audio = static_cast<Audio*>(args.This()->GetPointerFromInternalField(0));
		if (audio != NULL) audio->play(get(args[0], 0));
		return args.This();
	}
	
	v8::Handle<v8::Value> jsAudioPause(const v8::Arguments &args) {
		Audio *audio = static_cast<Audio*>(args.This()->GetPointerFromInternalField(0));
		if (audio != NULL) audio->pause();
		return args.This();
	}
	
	v8::Handle<v8::Value> jsAudioLoop(const v8::Arguments &args) {
		Audio *audio = static_cast<Audio*>(args.This()->GetPointerFromInternalField(0));
		if (audio != NULL) audio->loop(get(args[0], -1));
		return args.This();
	}
	
	v8::Handle<v8::Value> jsAudioVolume(const v8::Arguments &args) {
		Audio *audio = static_cast<Audio*>(args.This()->GetPointerFromInternalField(0));
		if (audio != NULL) audio->volume(get(args[0], 1.0f));
		return args.This();
	}

And I've been reading about C++ templates for hours and I'm convinced that it's possible to get rid of these functions and replace them with templates. I envision the end result will be something like:

	typedef Handle<Value> (*InvocationCallback)(const Arguments& args);
	
	template <class T> InvocationCallback FunctionWrapper ...;
	template <FunctionWrapper func> ...;
	template <FunctionWrapper func, class arg1> ...;
	template <FunctionWrapper func, class arg1, class arg2> ...;

I realize similar questions have been asked, but I can't find an example of a template within a template like the above.