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?
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.
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 );
const sf::SoundBuffer& Buffer = Recorder.GetBuffer();
int main()
{
int *p;
delete p;
}
RenderWindow::~RenderWindow()
{
// Nothing to do...
}
#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;
}