Original Post
Hey Ppl''z!
I''ve recently started tinkering with DirectSound by incorporating it into an old game of mine. I got it to work! WOOHOO! But I used a procedural approach and I just don''t do procedures =)
Soooo, I went the OO route and have it setup like so: I created a class that contains the buffer as well as some info on the sound, such as panning, volume, etc. BTW, I''m not using 3D sound yet, so I''m just stickin'' to the basics for now. That said, each sound has its own instance of this object in an array. I''ve declare LPDIRECTSOUND as a static property of the array so that all the objects can easily reference it. Before anything happens, the init() method of my object is called which calls DirectSoundCreate, SetCooperativeLevel, etc. Then each sound is loaded from .wav''s into each buffer using my load() method. Fom there you can just call play to play the sound.
The strange thing is, I haven''t changed any code from the procedural approach. The only thing changed is structure. The problem occurs when I attempt to lock the buffer. DirectSound doesn''t just report the error, it just crashes entirely with an Application error saying that the memory could not be read.
I''ve checked the order in which everything is being done and it is in the proper order.
The array of objects are not created with the new operator... it is declare simply as CBufferCtrl sound[MAXSOUNDS];
Does anyone know what would produce this error when locking the buffer?
...btw, don''t bother tellin'' me to revert back to the procedural approach, you''ll only be wasting your time =)
Thanks guys!
- Jay
Many of the truths we cling to depend greatly on our own point of view
Get Tranced!
Get Tranced!