1
Audio / Re: Error loading audio file
« on: January 17, 2020, 11:44:23 am »
its a type but that wasnt the issue got it solved by a friend. issue was with it being in debug instead of realease mode.
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.
#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>z
#include <iostream>
#include <fstream>
#include <sstream>
#include <streambuf>
using namespace std;
#ifdef _DEBUG
#pragma comment(lib, "sfml-window-d.lib")
#pragma comment(lib, "sfml-system-d.lib")
#pragma comment(lib, "sfml-graphics-d.lib")
#pragma comment(lib, "sfml-audio-d.lib")
#else
#pragma comment(lib, "sfml-window.lib")
#pragma comment(lib, "sfml-system.lib")
#pragma comment(lib, "sfml-graphics.lib")
#pragma comment(lib, "sfml-audio.lib")
#endif
int main()
{
sf::SoundBuffer buffer;
if (!buffer.loadFromFile("sounds/canary.wav"))
{
std::ofstream file("sfml-log.txt");
std::streambuf* previous = sf::err().rdbuf(file.rdbuf());
cerr << "i wantt more debuf info than this";
return -1;
}
sf::Sound death;
death.setBuffer(buffer);
death.play();
getchar();
return 0;
}
if (!buffer.loadFromFile("death.wav"))
{
std::ofstream file("sfml-log.txt");
std::streambuf* previous = sf::err().rdbuf(file.rdbuf());
}
if (!buffer.loadFromFile("sample.wav"))
{
cout << "error loading the sound file" << endl;
}
deathSound.setBuffer(this->buffer);