diff options
| author | iamgoofball <iamgoofball@gmail.com> | 2019-02-01 16:28:14 -0800 |
|---|---|---|
| committer | iamgoofball <iamgoofball@gmail.com> | 2019-02-01 16:28:14 -0800 |
| commit | fc984fcfe2a4416274810de81a8f36fe77b0dba9 (patch) | |
| tree | 567159b15acde3b546e795c52e24520919763a99 /src/aomusicplayer.cpp | |
| parent | 0649e7b28e16a054072d8656a5046c7cc3cfefb6 (diff) | |
bugfixes and shit
Diffstat (limited to 'src/aomusicplayer.cpp')
| -rw-r--r-- | src/aomusicplayer.cpp | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index fca3c16c..7fcb277f 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -5,9 +5,6 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject( { m_parent = parent; ao_app = p_ao_app; - music_loop_timer = new QTimer(this); - music_loop_timer->setSingleShot(true); - connect(music_loop_timer, SIGNAL(timeout()), this, SLOT(restart_loop())); } AOMusicPlayer::~AOMusicPlayer() @@ -27,17 +24,16 @@ void AOMusicPlayer::play(QString p_song) if (ao_app->get_audio_output_device() != "default") BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); - BASS_ChannelPlay(m_stream, false); - music_loop_timer->stop(); if(enable_looping) { - QWORD len=BASS_ChannelGetLength(m_stream, BASS_POS_BYTE); // the length in bytes - double time=BASS_ChannelBytes2Seconds(m_stream, len); // the length in seconds - if(time > 0) - { - music_loop_timer->start(time*1000); - } + BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); + } + else + { + BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP); } + BASS_ChannelPlay(m_stream, false); + } @@ -54,21 +50,8 @@ QString AOMusicPlayer::get_path() return f_path; } -void AOMusicPlayer::restart_loop() -{ - /* - m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); - if (ao_app->get_audio_output_device() != "default") - BASS_ChannelSetDevice(m_stream, BASS_GetDevice());*/ - QWORD len=BASS_ChannelGetLength(m_stream, BASS_POS_BYTE); // the length in bytes - double time=BASS_ChannelBytes2Seconds(m_stream, len); // the length in seconds - music_loop_timer->start(time*1000); - BASS_ChannelPlay(m_stream, true); -} - void AOMusicPlayer::kill_loop() { - music_loop_timer->stop(); BASS_ChannelStop(m_stream); } |
