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 - Koschi

Pages: [1]
1
Audio / Re: sf::Music playing a track again
« on: June 30, 2015, 04:05:45 pm »
Test this code on second computer with xp, there it works.

So I think is a hard/software problem on my Laptop.

Thnx for help.

2
Audio / Re: sf::Music playing a track again
« on: June 27, 2015, 11:15:47 pm »
I think there are a lot of computer out there with Win XP.

Can anyone with XP reproduce this error?

Not at all related to your actual issue, but still, why on earth don't you upgrade to VS2013 (and soon 2015)???
It is not a fault of VC2010, so it dosent matter.

More error description:
in my minimal code the second while loop is (always) 6 times entered, then the state will switch from Playing to Stopped.

This line in SFML Code
alCheck(alGetSourcei(m_source, AL_SOURCE_STATE, &status));
set 5 times the status to Playing and the sixth call will set status to Stopped.

3
Audio / Re: sf::Music playing a track again
« on: June 27, 2015, 09:26:48 pm »
On my Laptop:
Win XP SP3
SFML 2.3
VC2010 pro

Test it now on my desktop computer and here it works.
on desktop computer:
Win 7
SFML 2.3
VC2010 express

4
Audio / Re: sf::Music playing a track again
« on: June 27, 2015, 05:38:59 pm »
try a minimal excemple and it dont work.

#include <SFML/Audio.hpp>
#include <SFML/System.hpp>
 
int main()
{
        sf::Music music;
        music.openFromFile("res/music/neue_musik.ogg");
        music.play();
 
        while(music.getStatus() == sf::Music::Playing)
        {
                sf::sleep(sf::seconds(1.f));
        }
 
        music.play(); // <-- this second play() call dont work for me, i cant hear anything
 
        while(music.getStatus() == sf::Music::Playing)
        {
                sf::sleep(sf::seconds(1.f));
        }
}
 

5
Audio / Re: sf::Music playing a track again
« on: June 27, 2015, 04:31:19 pm »
Take a look at my Jukebox class. It can do what you want (and more) and is quite straight forward.
Thnx for sharing code, I can't see big difference.
Have you tried playing the just as is, without your logic code?
No, but i debuged my code and he worked well, except play() want start again the music.

I don't understand the need for testing m_isPlaying. Try removing that  :P
(basically, at the moment, it says that if "it's not playing" or "it is playing", you exit the update function)

Also, why are you using pointers to an sf::Music?
When i call MusicManager::play() m_isPlaying is set true, so update method will exit when not starting playing. 'Or' when sf::Music:: is playing update methode should exit. It works!

I use pointer because resourceManager hold the origin.

So is that right, after a track is finished a simple call of play() will start again the track?


6
Audio / sf::Music playing a track again
« on: June 27, 2015, 11:06:21 am »
Hi all,

I got a problem with playing a track again.

I got a std::vector<sf::Music*> with 2 tracks I can play every track once, but when i start playing again the first element nothing happens.

My question is how to repeat a played song again, without using the loop-function?
I tryed:
- stop() and then play()
- setPlayingOffset (sf::milisecond(0))
- setLoop(true) play() setLoop(false)

relevant code
void MusicManager::update()
{
    // m_isPlaying is true when manager start playing the first track
    if(!m_isPlaying || m_music[m_currentIndex]->getStatus() == sf::Music::Playing)
        return;

    if(m_currentIndex + 1 < m_music.size())
        ++m_currentIndex;
    else
        m_currentIndex = 0;
   
    m_music[m_currentIndex]->play();
}
 

Any suggestions?

Thnx.

Koschi

7
Graphics / Re: sf::drawable* Problem
« on: May 24, 2012, 08:36:32 am »
It Compiels well. The programm crash (only when the string is not empty).

8
Graphics / sf::drawable* Problem
« on: May 24, 2012, 08:21:42 am »
Hello everyone

I got a little problem with sf::drawable* and sf::String. I use SFML 1.6 and CodeBlocks.
I try to write a UI class for all UI Elements i wrote a abstract baseclass. This class has a function to give back a sf::drawable*
sf::drawable* Render_Element() = 0
 
My 2 UI elements class inherit from this baseclass.
CUI_Button works well the Render_Element():
// in h file
sf::Sprite*Sprite;

// in cpp file
sf::drawable* CUI_Button::Render_Element()
{
     return sprite;
}
 
With this Code i can Render my Sprite.
Now to the problem. In my CUI_Text class i go the same way but i didn't work.
// in h file
sf::String* text;

// in cpp file
sf::drawable* CUI_Button::Render_Element()
{
     return text;
}
 
This Function give the drawable* Object to the Draw function.

If the String empty it works, if something in the String it dont work.

I don't understand why this code Not work. I Hope someone can help.

Sorry for my bad englisch i hope you guys understand if :)

Koschi

Pages: [1]
anything