3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
|
* Copyright (C) 2005, 2006 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
117 |
entry.resource = NULL; |
entry.resource = NULL; |
118 |
entry.consumers.insert(pConsumer); |
entry.consumers.insert(pConsumer); |
119 |
ResourceEntries[Key] = entry; |
ResourceEntries[Key] = entry; |
120 |
// actually create the resource |
try { |
121 |
entry.resource = Create(Key, pConsumer, entry.arg); |
// actually create the resource |
122 |
|
entry.resource = Create(Key, pConsumer, entry.arg); |
123 |
|
} catch (...) { |
124 |
|
// creating the resource failed, so remove the entry |
125 |
|
ResourceEntries.erase(Key); |
126 |
|
// rethrow the same exception |
127 |
|
throw; |
128 |
|
} |
129 |
// now update the entry with the created resource |
// now update the entry with the created resource |
130 |
ResourceEntries[Key] = entry; |
ResourceEntries[Key] = entry; |
131 |
OnBorrow(entry.resource, pConsumer, entry.arg); |
OnBorrow(entry.resource, pConsumer, entry.arg); |