From 6c118b8f8965a5fbb602ad556b584f6f8c0c26c0 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 3 May 2001 23:48:06 +0000 Subject: new devices are created by a (possibly externally provided) factory --- mixlib/mix_vm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mixlib/mix_vm.c') diff --git a/mixlib/mix_vm.c b/mixlib/mix_vm.c index 9a39247..39b3e6f 100644 --- a/mixlib/mix_vm.c +++ b/mixlib/mix_vm.c @@ -76,8 +76,10 @@ mix_vm_new (void) vm->devices[i] = NULL; vm->clock = mix_vm_clock_new (); + vm->factory = mix_device_new; vm_reset_ (vm); + return vm; } @@ -116,6 +118,15 @@ mix_vm_connect_device (mix_vm_t *vm, mix_device_t *device) return old; } +/* install a device factory for automatic connection */ +void +mix_vm_set_device_factory (mix_vm_t *vm, mix_device_factory_t factory) +{ + g_return_if_fail (vm != NULL); + g_return_if_fail (factory != NULL); + vm->factory = factory; +} + /* Reset a vm (set state as of a newly created one) */ void mix_vm_reset (mix_vm_t * vm) -- cgit v1.2.3