edgar-mtz-e / slimdx

Automatically exported from code.google.com/p/slimdx
0 stars 0 forks source link

DirectSound Bugs #395

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using the Nov. SDK. I'm working on some DirectSound samples and ran 
into some bugs.

** Default value higher than Max value, default should be 16.0f **
SlimDX.DirectSound.ChorusEffect.DelayMax = 20.0f
SlimDX.DirectSound.ChorusEffect.DelayDefault = 50.0f

** Enumerate Devices **
I got this exception trying to enumerate the DirectSound devices. Any 
ideas why?

System.ArgumentException was unhandled
  Message="Object contains non-primitive or non-blittable data."
  Source="mscorlib"
  StackTrace:
       at System.Runtime.InteropServices.GCHandle.InternalAlloc(Object 
value, GCHandleType type)
       at SlimDX.DirectSound.DirectSound.GetDevices()
       at EnumerateDevices.EnumerateDevice..ctor() in D:\SlimDX Audio 
Samples\EnumerateDevices\EnumerateDevice.cs:line 56
       at EnumerateDevices.EnumerateDevice.Main() in D:\SlimDX Audio 
Samples\EnumerateDevices\EnumerateDevice.cs:line 210
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] 
args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence 
assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Original issue reported on code.google.com by Grasshop...@gmail.com on 7 Jan 2009 at 11:22

GoogleCodeExporter commented 9 years ago
Yeah, that exception came up on GDNet recently as well. I'm looking into it.

Original comment by Mike.Popoloski on 7 Jan 2009 at 3:17

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I think this might help. The problem is it is trying to create a pointer to a 
non-
native object.

http://social.msdn.microsoft.com/forums/en-US/clr/thread/dd7a3afe-baef-49b5-a088
-
f4c68658de42

This is how it was done in the March SDk.

DeviceCollection^ results = gcnew DeviceCollection();
std::auto_ptr<DeviceCollectionShim> shim( new DeviceCollectionShim( results ) );

HRESULT hr = DirectSoundEnumerate( 
static_cast<LPDSENUMCALLBACK>(EnumerateDevices ), 
shim.get() );

if( RECORD_DSOUND( hr ).IsFailure )
    return nullptr;

return results;

Original comment by Grasshop...@gmail.com on 8 Jan 2009 at 12:54

GoogleCodeExporter commented 9 years ago
Fixed as of r861.

Original comment by Mike.Popoloski on 14 Jan 2009 at 7:57

GoogleCodeExporter commented 9 years ago

Original comment by Mike.Popoloski on 14 Jan 2009 at 7:57

GoogleCodeExporter commented 9 years ago
Wouldn't it be better to create the shim as a template class that could be used 
for 
other things?

template <class T> class Wrapper
{
public:
   Wrapper<T>(T obj) : _object(obj) {}

   T Unwrap() { return _object; }

private:
   gcroot<T> _object;
};

And then define the code like:

   DeviceCollection^ results = gcnew DeviceCollection();
   std::auto_ptr<Shim<DeviceCollection^>> shim(new Wrapper<DeviceCollection^>
(results));
   HRESULT hr = DirectSoundEnumerate(static_cast<LPDSENUMCALLBACK>
(EnumerateDevices), shim.Unwrap());

Original comment by Crystal_...@hotmail.com on 15 Jan 2009 at 8:22

GoogleCodeExporter commented 9 years ago
Wanted to add one more thing, why was the auto_ptr<> class added to the code? 
This 
can be found in STL.

#include <memory>

It is in the std namespace, so you can access it through std::auto_ptr<>.

Original comment by Crystal_...@hotmail.com on 15 Jan 2009 at 3:56

GoogleCodeExporter commented 9 years ago
auto_array, which Mike added, is not auto_ptr. In particular auto_ptr calls 
delete,
when in this scenario delete[] needed to be called.

Original comment by josh.petrie on 15 Jan 2009 at 4:47

GoogleCodeExporter commented 9 years ago
Ah, my bad. I saw another post regarding these changes that had auto_ptr<> in 
it and 
tried to connect the dots. But apparently there was a problem between the 
keyboard 
and the chair. :)

Original comment by Crystal_...@hotmail.com on 16 Jan 2009 at 3:37

GoogleCodeExporter commented 9 years ago
I still have the problem with the november 2008 version.  How can i relate a 
build 
with the corresponding version?

Original comment by steve.a.beaudoin on 5 Mar 2009 at 1:38

GoogleCodeExporter commented 9 years ago
You can wait for the next public release (should be some time in the few weeks) 
or
download from source and build it yourself.

Original comment by Mike.Popoloski on 5 Mar 2009 at 1:59