SFML community forums
Help => Audio => Topic started by: rahul8590 on March 18, 2010, 09:35:45 pm
-
I am running the music playing program from the tutorials , and it works awesome for smaller files which is in Kbs . But for larger files , which are in Mbs are just not being played . Wat could be the problem .. ?
-
The ogg file provided with the sound sample is 4.15 MB, and it has always worked so far.
Can you give more informations about your computer?
-
Firstly sorry for late reply .
The program is playing original ogg files .
But if i convert mp3 files to ogg format . i dunno why its not playing.
Is the converted flawed .. ?
-
Is the converted flawed .. ?
Probably. What converter are you using?
-
FLV to AVI MPEG WMV 3GP MP4 iPod Converter is a professional FLV converter software which can convert Flash Video FLV to AVI, FLV to MPEG, FLV to WMV, FLV to MP4 format
It also works on other conversion .. i have tested it
its built by Aone Technologies .
-
Do you have any message on the standard error output?
Can you send me one of the files that you converted and that doesn't work? I changed the ogg/vorbis library in SFML 2 (the official one) and I want to see if it makes a difference.
-
Well .. the file kinda worked when i ran the exe version of my program directly , but in the end the program crashed .. i mean while exiting i got an error saying this program has encountered with a problem .
http:// http://www.box.net/shared/rmgphb42xi
The above link has the program in exe and the sound file .
In case u need the code i will post it to.
-
The above link has the program in exe
I'd prefer a source code ;)
If yours is too big, you can provide a minimal example (if it's just about playing the music, it can fit in ten lines of code). This will also make sure that the bug is not caused by the rest of your code.
-
not a problem at all .. the below is the code ..
#include <SFML/Graphics.hpp>
#include<SFML/Audio.hpp>
#include<iostream>
int main()
{
// Create the main window
sf::RenderWindow App(sf::VideoMode(640, 480), "Rahul.Reincarnated ");
// Load a sprite to display
sf::Image Image;
if (!Image.LoadFromFile("image2.png"))
return EXIT_FAILURE;
sf::Sprite Sprite(Image);
// Adding some music to program
sf::Music Music;
if (!Music.OpenFromFile("hydrate.ogg"))
return EXIT_FAILURE;
// Create a graphical string to display
sf::Font Arial;
if (!Arial.LoadFromFile("arial.ttf"))
return EXIT_FAILURE;
sf::String Text("\t \t \t \t \t \t \t \t \t \t OpenGL Project \n \t \t \t \t \t \t \t \t By Rahul & Pooja ", Arial, 50);
// Play it
Music.Play();
const int SCROLL_SPEED = 20; // rendering 20 pixesl per second
Text.SetY(40); // text positions is above the screen
// std::cout<< Text.GetPosition();
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
}
// Clear screen
App.Clear();
// Draw the sprite
App.Draw(Sprite);
// Draw the string
App.Draw(Text);
// Increase Y Axis to move down
Text.Move( 0 ,App.GetFrameTime() * SCROLL_SPEED) ;
//Text.Move ( 10,100);
if( Text.GetPosition().y > 400 )
Text.SetPosition( 0.f, 10 );
// Update the window
App.Display();
// Loop while the music is playing
}
std::cout<<" thank you for using the program ";
getchar();
return EXIT_SUCCESS;
}
-
Thanks :)
The song doesn't work with SFML 1.x (it crashes after starting it, with a NULL pointer exception) but works perfectly in SFML 2.
-
Anything .. i can do to specifically fix this one ...
I mean i will have to later on attach my opengl code in here and do a lot of stuff . since my i have told my team members to built it using 1.5 platform only so .. i cant change it as of now .
-
Maybe try using another converter. You're the first one to report this kind of issue, so it should be easy to find a converter which is 100% compatible with SFML 1.5 ;)
-
My all time favorite ogg encoder is OggDropXPD. It does anything I ever needed, and it couldn't be easier to use!
Get it here: http://www.rarewares.org/ogg-oggdropxpd.php
Unfortunately, it doesn't read mp3 files, but if your converter can convert to wav, then you are all set.
Anyway, it is not optimal to convert between non-loss less compressed formats, as you will get the downsides of both compressions. If you can, you should get the original file in a pcm format, such as wav or aiff, and only compress it once, at the last stage.