Ben dus net van start gegaan met VC++ en tot nu toe viel alles me alleszins mee, maar zoals te verwachten loop ik nu toch ff enorm vast. Ongetwijfeld een belachelijk simpel probleem voor de kenner, maar ik kom er echt totaal niet uit. Googlen naar de errormessage en op dit forum rondzoeken zorgde ook niet voor het beoogde resultaat, dus bij deze
.
Het doel: een wav file afspelen mbv DirectSound.
De foutmeldingen:
.\Tunemaker.cpp(35) : error C2691: 'Microsoft::DirectX::DirectSound::EffectsReturnValue' : a managed array cannot have this element type
This diagnostic occurred while importing type 'Microsoft::DirectX::DirectSound::SecondaryBuffer ' from assembly 'Microsoft.DirectX.DirectSound, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
.\Tunemaker.cpp(35) : error C2691: 'Microsoft::DirectX::DirectSound::EffectsReturnValue' : a managed array cannot have this element type
This diagnostic occurred while importing type 'Microsoft::DirectX::DirectSound::SecondaryBuffer ' from assembly 'Microsoft.DirectX.DirectSound, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
.\Tunemaker.cpp(35) : error C3767: 'Microsoft::DirectX::DirectSound::SecondaryBuffer::SecondaryBuffer': candidate function(s) not accessible
.\Tunemaker.cpp(36) : error C2039: 'Play' : is not a member of 'Microsoft::DirectX::DirectSound::SecondaryBuffer'
c:\windows\microsoft.net\directx for managed code\1.0.2902.0\microsoft.directx.directsound.dll : see declaration of 'Microsoft::DirectX::DirectSound::SecondaryBuffer'
Het probleem zit hem dus in wanneer ik een SecondaryBuffer probeer aan te maken, maar ik heb werkelijk geen idee wat ik verkeerd doe.
------
edit: Ongelofelijk, na tijden lang te hebben gekloot en uiteindelijk helemaal een topic te hebben aangemaakt vind je natuurlijk binnen notime het probleem.
Had de verkeerde Microsoft.DirectX bij de References gezet. Er waren twee verschillende versies.
Het doel: een wav file afspelen mbv DirectSound.
De foutmeldingen:
.\Tunemaker.cpp(35) : error C2691: 'Microsoft::DirectX::DirectSound::EffectsReturnValue' : a managed array cannot have this element type
This diagnostic occurred while importing type 'Microsoft::DirectX::DirectSound::SecondaryBuffer ' from assembly 'Microsoft.DirectX.DirectSound, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
.\Tunemaker.cpp(35) : error C2691: 'Microsoft::DirectX::DirectSound::EffectsReturnValue' : a managed array cannot have this element type
This diagnostic occurred while importing type 'Microsoft::DirectX::DirectSound::SecondaryBuffer ' from assembly 'Microsoft.DirectX.DirectSound, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
.\Tunemaker.cpp(35) : error C3767: 'Microsoft::DirectX::DirectSound::SecondaryBuffer::SecondaryBuffer': candidate function(s) not accessible
.\Tunemaker.cpp(36) : error C2039: 'Play' : is not a member of 'Microsoft::DirectX::DirectSound::SecondaryBuffer'
c:\windows\microsoft.net\directx for managed code\1.0.2902.0\microsoft.directx.directsound.dll : see declaration of 'Microsoft::DirectX::DirectSound::SecondaryBuffer'
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
| #include "stdafx.h"
#using <mscorlib.dll>
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
using namespace System;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using namespace System::Drawing;
using namespace Microsoft::DirectX;
using namespace Microsoft::DirectX::DirectSound;
__gc public class CppForm: public Form
{
private: Button* btn1;
private: ComboBox* combo1;
Device *sDevice;
Microsoft::DirectX::DirectSound::SecondaryBuffer *buffer;
private:
void Btn1_Clicked (Object* pSender, EventArgs* pArgs){
buffer= new Microsoft::DirectX::DirectSound::SecondaryBuffer("bla.wav",sDevice);
buffer->Play(0,BufferPlayFlags::Default);
};
public:
CppForm(){
Text=S"Test";
sDevice=new Device();
initComponents();
};
public:
Button* addButton(System::String __gc *caption, int left, int top, int width , int height){
Button* tempbutton;
tempbutton=new Button();
tempbutton->Text=caption;
tempbutton->Location=Point(left,top);
tempbutton->Size=System::Drawing::Size(width,height);
Controls->Add(tempbutton);
return tempbutton;
}
private:
void initComponents(){
btn1=addButton("test",100,100,100,100);
btn1->Click+=new EventHandler(this, &CppForm::Btn1_Clicked);
combo1=new ComboBox();
combo1->DropDownStyle=ComboBoxStyle::DropDownList;
combo1->Location=Point(20,20);
combo1->Items->Add(S"test");
Controls->Add(combo1);
}
};
int _tmain()
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(new CppForm());
return 0;
} |
Het probleem zit hem dus in wanneer ik een SecondaryBuffer probeer aan te maken, maar ik heb werkelijk geen idee wat ik verkeerd doe.
------
edit: Ongelofelijk, na tijden lang te hebben gekloot en uiteindelijk helemaal een topic te hebben aangemaakt vind je natuurlijk binnen notime het probleem.
Had de verkeerde Microsoft.DirectX bij de References gezet. Er waren twee verschillende versies.
[ Voor 8% gewijzigd door BarôZZa op 20-04-2006 16:47 ]