Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Aval

Pages: 1 [2] 3
16
Audio / LoadFromSamples Function
« on: March 14, 2009, 01:17:01 am »
Ah! Thanks. Is there a way to manually delete a buffer from memory, or do you just make it go out of scope?

17
Audio / LoadFromSamples Function
« on: March 13, 2009, 02:27:54 am »
I want to get the data recorded, stretch it by a factor, and play it back. I can access the data, and so I'm trying to load the buffer that has the modified sound back into the soundbuffer.

Declaring Buffer as a non-const doesn't work, because Recorder.GetBuffer() returns a const pointer.

18
Audio / LoadFromSamples Function
« on: March 10, 2009, 11:48:43 pm »
I cannot get LoadFromSamples to work.

I get samples in the form of a  const sf::Int16 *. Since I can't change a const pointer directly, I copy all of the data to a buffer. I modify it, and then I try to load the buffer back to the sf::SoundBuffer.

Code: [Select]
const sf::Int16 * pSample = Buffer.GetSamples();

int max = Buffer.GetSamplesCount()-1;
int channels = Buffer.GetChannelsCount();
int sampleRate = Buffer.GetSampleRate();

sf::Int16 * myBuffer = new sf::Int16[max];

for( int i = 0; i < max; i++ )
{
myBuffer[i] = pSample[i];
}

//Modify myBuffer

Buffer.LoadFromSamples( myBuffer, max, channels, sampleRate );


I get the following error:
error C2662: 'sf::SoundBuffer::LoadFromSamples' : cannot convert 'this' pointer from 'const sf::SoundBuffer' to 'sf::SoundBuffer &'        Conversion loses qualifiers

I declare Buffer as:
Code: [Select]
const sf::SoundBuffer& Buffer = Recorder.GetBuffer();

Maybe I'm doing something wrong with references?

19
General / Loud Fan Noise When Drawing Sprite
« on: January 05, 2009, 11:57:44 am »
I don't know how, but Tanktris is magical. I have chronic errors I can't solve, and they run it perfectly.

20
Window / Opening a window - problem
« on: January 02, 2009, 07:16:44 pm »
Are you linking the debug libraries for debugging, and release for the release mode?

Like sfml-window-d.lib for debug, and sfml-window.lib for release.

21
General / Access Violation at Program Close
« on: January 01, 2009, 12:06:44 am »
Hmm. With the dynamic libraries, sometimes I get the error even without an App.Close(). I must be setting something up wrongly. Can anyone send me  a Visual C++ Express project? I must have a linker error in there somewhere.

I've tried static and compiling it myself, but I'll try it again.

EDIT:

I've downloaded some SFML projects, and they run fine. So I must be setting something up wrong.

Can someone test this demo on their PC? It's just the source and images in a zip file for a really simple program that crashes on exit on my computer.

http://www.filesavr.com/demo_1

22
General / Access Violation at Program Close
« on: December 30, 2008, 01:35:37 am »
That explains why when I only have one sprite, there is no error, but it doesn't explain why, when I have more than one, calling Close() causes problems.

23
General / Access Violation at Program Close
« on: December 29, 2008, 05:06:26 pm »
Using the newest source doesn't help. I just swapped out the SetBackgRoundColor() at the beginning with a Clear() every frame.

 Wizzard is correct that if you call App.Close() manually, it will be called twice: once by you and once by the destructor. Not calling it makes everything better, but I'm not sure why you don't get the error message.

24
Graphics / Failed to load image
« on: December 29, 2008, 03:42:29 pm »
If you're debugging through vc++, you also need the images and dll's in the project directory.

25
General / Access Violation at Program Close
« on: December 29, 2008, 01:13:47 am »
The code that you gave doesn't compile, as the compiler complains about deleting non-pointers.

but the following code:

Code: [Select]

int main()
{
int *p;
delete p;
}


gets the same error message that I get.

EDIT:
I looked through the source. The sf::Window class, which sf::RenderWindow inherits from, does call Close() at its destructor. But constructors and destructors aren't inherited, right? Anyways, the destructor for a RenderWindow is this:

 
Code: [Select]

RenderWindow::~RenderWindow()
{
    // Nothing to do...
}


The Close() is not called when I use RenderWindows like in the example I posted near the top, so it shouldn't be causing the error.

EDIT2:
Man, I feel stupid. Apparently, destructors are called from the base class as well, just after the constructor for the class that is inheriting. So, RenderWindow's destructor runs, and then Window's destructor runs, when the object is destroyed. So Close() is called, after all, in the destruction process.

26
General / Access Violation at Program Close
« on: December 28, 2008, 03:18:01 pm »
I just clicked the download now button on the main page, and clicked the first download link for the full sdk on windows. I get the error when using App.Close() using the precompiled binaries, statically linked, or if I compile them myself.

27
General / Access Violation at Program Close
« on: December 28, 2008, 12:17:52 am »
I think the pong sample needs to be fixed.

28
General / Access Violation at Program Close
« on: December 28, 2008, 12:15:47 am »
Wow. I spent a day trying to fix that. I had to remove one line of code to do so.  :x

29
General / Access Violation at Program Close
« on: December 27, 2008, 11:55:30 pm »
So I don't have to call App.Close() manually?

30
General / Access Violation at Program Close
« on: December 27, 2008, 09:34:47 pm »
I've spent the entire morning trying to get this working, but I still haven't gotten it to stop crashing.

Whenever I close the app, it breaks. In fact, it breaks right after the program hits "return 0;" It gives the following error message in VC++ Express:

First-chance exception at 0x0262cbab in demo.exe: 0xC0000005: Access violation reading location 0xfeeefef6.
Unhandled exception at 0x0262cbab in demo.exe: 0xC0000005: Access violation reading location 0xfeeefef6.

and a runtime error when launched through windows explorer:

Pure virtual function call. :(

In fact, the following code, which simply loads two images and shows them for 5 seconds, crashes at the end.

 
Code: [Select]

#define SFML_DYNAMIC

#include <SFML/Graphics.hpp>

int main()
{
sf::Clock timer;
sf::RenderWindow App(sf::VideoMode(200, 200, 32), "Demo App");

App.SetBackgroundColor( sf::Color( 255, 255, 255 ) );

sf::Image Image1, Image2;
if (!Image1.LoadFromFile("pic1.png"))
return 1;
if (!Image2.LoadFromFile("pic2.png"))
return 1;

sf::Sprite Sprite1(Image1);
sf::Sprite Sprite2(Image2);

sf::Sleep( 1.0 );

//Not drawing the sprites fixes the problem, but I don't want a blank game.
while( App.IsOpened() )
{
App.Draw(Sprite1);
App.Draw(Sprite2);
App.Display();

if( timer.GetElapsedTime() > 5.0 )
App.Close();
}

//Crashes right here.
return 0;
}


If I don't call App.Close(), the errors don't happen, but I'm pretty sure that App.Close() does some cleanup work that I shouldn't not do. I must be doing something wrong, in my code. It only happens when I use more than one image and sprite. Help!

Pages: 1 [2] 3
anything