You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
(288) |
Aug
(119) |
Sep
(31) |
Oct
(59) |
Nov
(458) |
Dec
(359) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(268) |
Feb
(26) |
Mar
(36) |
Apr
(48) |
May
(119) |
Jun
(37) |
Jul
(173) |
Aug
(429) |
Sep
(137) |
Oct
(156) |
Nov
(59) |
Dec
(45) |
| 2011 |
Jan
(398) |
Feb
(257) |
Mar
(49) |
Apr
(5) |
May
(34) |
Jun
(11) |
Jul
(38) |
Aug
(12) |
Sep
(1) |
Oct
(49) |
Nov
(5) |
Dec
(10) |
| 2012 |
Jan
(21) |
Feb
(32) |
Mar
(20) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(173) |
Aug
|
Sep
(25) |
Oct
(6) |
Nov
(44) |
Dec
|
|
From: Yoda-JM <yo...@us...> - 2012-09-16 21:25:33
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Sun Sep 16 23:23:32 2012 +0200
new: make torrent support optionnal
Automatically detect libtorrent availability. Use cmake NO_TORRENT to
explicitly disable torrent support
---
game/CMakeLists.txt | 17 ++++++++++++++++-
game/downloader.cc | 42 ++++++++++++++++++++++++++++++++----------
game/downloader.hh | 7 +++++++
game/main.cc | 2 ++
game/screen_downloads.cc | 2 ++
5 files changed, 59 insertions(+), 11 deletions(-)
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index 7593f6a..97b3974 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -71,7 +71,7 @@ include_directories(${Boost_INCLUDE_DIRS})
list(APPEND LIBS ${Boost_LIBRARIES})
# Find all the libs that don't require extra parameters
-foreach(lib ${OUR_LIBS} SDL PangoCairo LibRSVG LibXML++ GLEW AVFormat SWScale OpenGL Z Jpeg Png PortAudio LibTorrent)
+foreach(lib ${OUR_LIBS} SDL PangoCairo LibRSVG LibXML++ GLEW AVFormat SWScale OpenGL Z Jpeg Png PortAudio)
find_package(${lib} REQUIRED)
include_directories(${${lib}_INCLUDE_DIRS})
list(APPEND LIBS ${${lib}_LIBRARIES})
@@ -116,6 +116,21 @@ else()
message(STATUS "Webcam support: Disabled (explicitly disabled)")
endif()
+if(NOT NO_TORRENT)
+ find_package(LibTorrent)
+ if(LibTorrent_FOUND)
+ include_directories(${LibTorrent_INCLUDE_DIRS})
+ list(APPEND LIBS ${LibTorrent_LIBRARIES})
+ add_definitions(${LibTorrent_DEFINITIONS})
+ add_definitions("-DUSE_TORRENT")
+ message(STATUS "Torrent support: Enabled")
+ else()
+ message(STATUS "Torrent support: Disabled (libtorrent-rasterbar not found)")
+ endif()
+else()
+ message(STATUS "Torrent support: Disabled (explicitly disabled)")
+endif()
+
if(APPLE)
# Needed for ffmpeg.cc to compile cleanly on OSX (it's a (unsigned long) long story)
diff --git a/game/downloader.cc b/game/downloader.cc
index b8a15ca..8f31dcf 100644
--- a/game/downloader.cc
+++ b/game/downloader.cc
@@ -5,16 +5,6 @@
#include "fs.hh"
#include "config.hh"
#include "configuration.hh"
-#include "libtorrent/entry.hpp"
-#include "libtorrent/bencode.hpp"
-#include "libtorrent/magnet_uri.hpp"
-#include "libtorrent/torrent_info.hpp"
-#include "libtorrent/file.hpp"
-#include "libtorrent/session.hpp"
-#include "libtorrent/storage.hpp"
-#include "libtorrent/hasher.hpp"
-#include "libtorrent/create_torrent.hpp"
-#include "libtorrent/torrent_info.hpp"
#include "xtime.hh"
#include <iostream>
#include <fstream>
@@ -26,7 +16,22 @@
#include <boost/thread/thread.hpp>
using namespace boost::filesystem;
+
+#ifdef USE_TORRENT
+
+#include "libtorrent/entry.hpp"
+#include "libtorrent/bencode.hpp"
+#include "libtorrent/magnet_uri.hpp"
+#include "libtorrent/torrent_info.hpp"
+#include "libtorrent/file.hpp"
+#include "libtorrent/session.hpp"
+#include "libtorrent/storage.hpp"
+#include "libtorrent/hasher.hpp"
+#include "libtorrent/create_torrent.hpp"
+#include "libtorrent/torrent_info.hpp"
+
using namespace libtorrent;
+
static char const* state_str[] = {"checking (q)", "checking", "dl metadata", "downloading", "finished", "seeding", "allocating", "checking (r)"};
class Downloader::Impl {
@@ -205,6 +210,23 @@ class Downloader::Impl {
return result;
}
};
+#else
+class Downloader::Impl {
+ public:
+ Impl() : m_uploadRate(0), m_downloadRate(0) {}
+ void pause(bool state) {}
+ void pauseResume(std::string sha1) {}
+ void addTorrent(std::string url) {}
+ void removeTorrent(std::string sha1) {}
+ std::vector<Torrent> getTorrents() const {
+ std::vector<Torrent> result;
+ return result;
+ }
+ public:
+ int m_uploadRate;
+ int m_downloadRate;
+};
+#endif
Downloader::Downloader(): self(new Impl) {
ConfigItem::StringList urls = config["dlc/torrent_urls"].sl();
diff --git a/game/downloader.hh b/game/downloader.hh
index bdbc0b5..e8ce360 100644
--- a/game/downloader.hh
+++ b/game/downloader.hh
@@ -28,6 +28,13 @@ class Downloader : boost::noncopyable {
std::vector<Torrent> getTorrents() const;
int getUploadRate() const;
int getDownloadRate() const;
+ static bool enabled() {
+ #ifdef USE_TORRENT
+ return true;
+ #else
+ return false;
+ #endif
+ }
private:
class Impl;
boost::scoped_ptr<Impl> self;
diff --git a/game/main.cc b/game/main.cc
index 876f9ef..ac33cf2 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -387,5 +387,7 @@ void outputOptionalFeatureStatus() {
(input::MidiDrums::enabled() ? "Enabled" : "Disabled")
<< std::endl << " Webcam support: " <<
(Webcam::enabled() ? "Enabled" : "Disabled")
+ << std::endl << " Torrent support: " <<
+ (Downloader::enabled() ? "Enabled" : "Disabled")
<< std::endl << std::endl;
}
diff --git a/game/screen_downloads.cc b/game/screen_downloads.cc
index 98f5f8b..4a9ab76 100644
--- a/game/screen_downloads.cc
+++ b/game/screen_downloads.cc
@@ -82,6 +82,8 @@ void ScreenDownloads::draw() {
<< ", " << boost::lexical_cast<std::string>(int(round(torrent.progress*100))) << "%"
<< ", size: " << addSuffix(torrent.size)
<< " (down: " << addSuffix(torrent.downloadRate,"/s") << ", up: " << addSuffix(torrent.uploadRate,"/s") << ")";
+ } else if(!Downloader::enabled()) {
+ info << _("Torrent support disabled");
} else {
info << _("No torrent available");
}
|
|
From: Tapio V. <aa...@us...> - 2012-09-16 21:04:58
|
Author: Tapio Vierros <tap...@gm...>
Date: Mon Sep 17 00:04:13 2012 +0300
DLC settings in their own menu in configuration screen.
---
game/screen_intro.cc | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/game/screen_intro.cc b/game/screen_intro.cc
index 3ce76bf..dc33ebc 100644
--- a/game/screen_intro.cc
+++ b/game/screen_intro.cc
@@ -165,6 +165,7 @@ void ScreenIntro::populateMenu() {
MenuOptions audiomenu;
MenuOptions gfxmenu;
MenuOptions gamemenu;
+ MenuOptions dlcmenu;
// Populate the submenus
for (Config::iterator it = config.begin(); it != config.end(); ++it) {
// Skip items that are configured elsewhere
@@ -172,6 +173,7 @@ void ScreenIntro::populateMenu() {
MenuOptions* opts = &gamemenu; // Default to game menu
if (it->first.find("audio/") != std::string::npos) opts = &audiomenu;
else if (it->first.find("graphic/") != std::string::npos) opts = &gfxmenu;
+ else if (it->first.find("dlc/") != std::string::npos) opts = &dlcmenu;
// Push the ConfigItem to the submenu
opts->push_back(MenuOption(_(it->second.getShortDesc().c_str()), _(it->second.getLongDesc().c_str()), &it->second));
opts->back().image = config_bg;
@@ -184,6 +186,7 @@ void ScreenIntro::populateMenu() {
configmain.push_back(MenuOption(_("Audio"), _("Configure general audio settings"), audiomenu, "intro_configure.svg"));
configmain.push_back(MenuOption(_("Graphics"), _("Configure rendering and video settings"), gfxmenu, "intro_configure.svg"));
configmain.push_back(MenuOption(_("Game"), _("Gameplay related options"), gamemenu, "intro_configure.svg"));
+ configmain.push_back(MenuOption(_("DLC"), _("DLC related settings"), dlcmenu, "intro_configure.svg"));
configmain.push_back(MenuOption(_("Paths"), _("Setup song and data paths"), "Paths", "intro_configure.svg"));
// Add to root menu
m_menu.add(MenuOption(_("Configure"), _("Configure audio and game options"), configmain, "intro_configure.svg"));
|
|
From: Tapio V. <aa...@us...> - 2012-09-16 21:00:41
|
Author: Tapio Vierros <tap...@gm...>
Date: Sun Sep 16 23:59:41 2012 +0300
Fix typo.
---
game/screen_downloads.cc | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/game/screen_downloads.cc b/game/screen_downloads.cc
index 53852af..98f5f8b 100644
--- a/game/screen_downloads.cc
+++ b/game/screen_downloads.cc
@@ -91,7 +91,8 @@ void ScreenDownloads::draw() {
m_theme->comment.draw(info.str());
// Additional info
std::ostringstream message;
- message << boost::format(_("Use left/right keys to scoll accross the %1% torrent(s) (down: %2%, up: %3%)")) % torrents.size() % addSuffix(m_downloader.getDownloadRate(),"/s") % addSuffix(m_downloader.getUploadRate(),"/s");
+ message << boost::format(_("Use left/right keys to scroll across the %1% torrent(s) (down: %2%, up: %3%)"))
+ % torrents.size() % addSuffix(m_downloader.getDownloadRate(),"/s") % addSuffix(m_downloader.getUploadRate(),"/s");
m_theme->comment_bg.dimensions.middle().screenBottom(-0.01);
m_theme->comment_bg.draw();
m_theme->comment.dimensions.left(-0.48).screenBottom(-0.023);
|
|
From: Tapio V. <aa...@us...> - 2012-09-16 21:00:38
|
Author: Tapio Vierros <tap...@gm...> Date: Sun Sep 16 23:56:40 2012 +0300 Hack fix compilation on my machine. Had forced compile error: you must define either BOOST_ASIO_SEPARATE_COMPILATION or BOOST_ASIO_DYN_LINK in your project in order for asio`s declarations to be correct. If you're linking dynamically against libtorrent, define BOOST_ASIO_DYN_LINK otherwise BOOST_ASIO_SEPARATE_COMPILATION. You can also use pkg-config or boost build, to automatically apply these defines --- game/downloader.cc | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/game/downloader.cc b/game/downloader.cc index 8de8fb8..b8a15ca 100644 --- a/game/downloader.cc +++ b/game/downloader.cc @@ -1,5 +1,7 @@ #include "downloader.hh" +#define BOOST_ASIO_DYN_LINK + #include "fs.hh" #include "config.hh" #include "configuration.hh" |
|
From: Yoda-JM <yo...@us...> - 2012-09-16 19:22:29
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Sun Sep 16 21:20:44 2012 +0200
change: add capability to set hash and torrent
If you want to set a hash in the configuration just enter hash:<HASH>
and if you want to enter a torrent file : torrent:</path/to/torrent>
---
game/downloader.cc | 18 ++++++++++++++++--
game/downloader.hh | 1 +
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/game/downloader.cc b/game/downloader.cc
index cc377a4..8de8fb8 100644
--- a/game/downloader.cc
+++ b/game/downloader.cc
@@ -18,6 +18,7 @@
#include <fstream>
#include <iterator>
#include <iomanip>
+#include <boost/algorithm/string/predicate.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
@@ -114,7 +115,7 @@ class Downloader::Impl {
m_torrents = torrents;
}
// Sleep a little, much if the cam isn't active
- boost::thread::sleep(now() + 0.5);
+ boost::thread::sleep(now() + 0.2);
}
}
@@ -167,7 +168,20 @@ class Downloader::Impl {
error_code ec;
add_torrent_params params;
params.save_path = savePath.string();
- params.url = url;
+ if (boost::starts_with(url, "hash:")) {
+ // we have a hash
+ params.info_hash = sha1_hash(url.substr(sizeof("hash:")-1));
+ } else if (boost::starts_with(url, "torrent:")) {
+ // we have a torrent file
+ params.ti = new torrent_info(url.substr(sizeof("torrent:")-1).c_str(), ec);
+ if(ec) {
+ std::clog << "torrent/error: cannot add torrent file: " << ec.message() << std::endl;
+ return;
+ }
+ } else {
+ // we have an url (http, magnet, https, other)
+ params.url = url;
+ }
if(config["dlc/autostart"].b()) {
params.flags |= add_torrent_params::flag_auto_managed;
} else {
diff --git a/game/downloader.hh b/game/downloader.hh
index ad301bc..bdbc0b5 100644
--- a/game/downloader.hh
+++ b/game/downloader.hh
@@ -4,6 +4,7 @@
#include <boost/scoped_ptr.hpp>
#include <boost/noncopyable.hpp>
#include <vector>
+#include <string>
struct Torrent {
Torrent() {};
|
|
From: Yoda-JM <yo...@us...> - 2012-09-16 03:14:20
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Sun Sep 16 05:12:07 2012 +0200
new: add new torrent information
Add the upload and download rate for the session and per torrent. Also
add the torrent size.
---
game/downloader.cc | 25 ++++++++++++++++++++++---
game/downloader.hh | 6 ++++++
game/screen_downloads.cc | 26 ++++++++++++++++++++++++--
3 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/game/downloader.cc b/game/downloader.cc
index 1b5adb4..cc377a4 100644
--- a/game/downloader.cc
+++ b/game/downloader.cc
@@ -36,6 +36,8 @@ class Downloader::Impl {
std::vector<Torrent> m_torrents;
public:
+ int m_uploadRate;
+ int m_downloadRate;
Impl() try {
m_quit = false;
session_settings settings;
@@ -58,10 +60,14 @@ class Downloader::Impl {
std::deque<alert*> alerts;
s.pop_alerts(&alerts);
for(std::deque<alert*>::const_iterator ita = alerts.begin() ; ita != alerts.end(); ++ita) {
- std::clog << "torrent/error: " << (*ita)->what() << std::endl;
+ std::clog << "torrent/error: " << (*ita)->what() << ": " << (*ita)->message() << std::endl;
}
- // update torrent informations
+ // update session information
+ session_status ss = s.status();
+ m_uploadRate = ss.upload_rate;
+ m_downloadRate = ss.download_rate;
+ // update torrent information
std::vector<Torrent> torrents;
std::vector<torrent_handle> torrent_handles = s.get_torrents();
for(std::vector<torrent_handle>::const_iterator it = torrent_handles.begin() ; it != torrent_handles.end() ; ++it) {
@@ -75,11 +81,20 @@ class Downloader::Impl {
t.state = state_str[status.state];
}
t.progress = status.progress;
+ t.uploadRate = status.upload_rate;
+ t.downloadRate = status.download_rate;
t.sha1 = h.info_hash().to_string();
+ try {
+ torrent_info const& info = h.get_torrent_info();
+ t.size = info.total_size();
+ } catch(libtorrent_exception &ex) {
+ // do nothing, info are just not available
+ t.size = 0;
+ }
+ torrents.push_back(t);
std::string percent = boost::lexical_cast<std::string>(int(round(t.progress*100)));
std::clog << "torrent/debug: " << t.name << " (" << t.state << ":" << percent << "%)" << std::endl;
- torrents.push_back(t);
/*
// display files when metadata are here
try {
@@ -193,3 +208,7 @@ void Downloader::addTorrent(std::string url) { self->addTorrent(url); }
void Downloader::removeTorrent(std::string sha1) { self->removeTorrent(sha1); }
std::vector<Torrent> Downloader::getTorrents() const { return self->getTorrents(); };
+
+int Downloader::getUploadRate() const { return self->m_uploadRate; };
+
+int Downloader::getDownloadRate() const { return self->m_downloadRate; };
diff --git a/game/downloader.hh b/game/downloader.hh
index 1b0a0d0..ad301bc 100644
--- a/game/downloader.hh
+++ b/game/downloader.hh
@@ -1,5 +1,6 @@
#pragma once
+#include <boost/cstdint.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/noncopyable.hpp>
#include <vector>
@@ -10,6 +11,9 @@ struct Torrent {
std::string state;
std::string sha1;
float progress;
+ int uploadRate;
+ int downloadRate;
+ boost::int64_t size;
};
class Downloader : boost::noncopyable {
@@ -21,6 +25,8 @@ class Downloader : boost::noncopyable {
void addTorrent(std::string url);
void removeTorrent(std::string sha1);
std::vector<Torrent> getTorrents() const;
+ int getUploadRate() const;
+ int getDownloadRate() const;
private:
class Impl;
boost::scoped_ptr<Impl> self;
diff --git a/game/screen_downloads.cc b/game/screen_downloads.cc
index 93f5e87..53852af 100644
--- a/game/screen_downloads.cc
+++ b/game/screen_downloads.cc
@@ -6,6 +6,7 @@
#include "joystick.hh"
#include "theme.hh"
#include "i18n.hh"
+#include <boost/assign.hpp>
#include <boost/bind.hpp>
#include <boost/format.hpp>
@@ -44,6 +45,25 @@ void ScreenDownloads::manageEvent(SDL_Event event) {
}
}
+namespace {
+ std::string addSuffix(boost::int64_t val, std::string suffix = "") {
+ std::string unit = "b";
+ std::vector<std::string> modifier = boost::assign::list_of("")("k")("M")("H")("T")("P");
+ std::string chosenModifier = modifier.back();
+ for(std::vector<std::string>::const_iterator it = modifier.begin() ; it != modifier.end() ; ++it) {
+ if(val < 1024) {
+ chosenModifier = *it;
+ break;
+ } else {
+ val /= 1024;
+ }
+ }
+ std::ostringstream ret;
+ ret << boost::lexical_cast<std::string>(val) << " " << chosenModifier << unit << suffix;
+ return ret.str();
+ }
+}
+
void ScreenDownloads::draw() {
m_theme->bg.draw();
std::vector<Torrent> torrents = m_downloader.getTorrents();
@@ -59,7 +79,9 @@ void ScreenDownloads::draw() {
<< "Torrent " << (m_selectedTorrent+1) << "/" << torrents.size() << ": "
<< torrent.name
<< ", state=" << torrent.state
- << ", " << boost::lexical_cast<std::string>(int(round(torrent.progress*100))) << "%";
+ << ", " << boost::lexical_cast<std::string>(int(round(torrent.progress*100))) << "%"
+ << ", size: " << addSuffix(torrent.size)
+ << " (down: " << addSuffix(torrent.downloadRate,"/s") << ", up: " << addSuffix(torrent.uploadRate,"/s") << ")";
} else {
info << _("No torrent available");
}
@@ -69,7 +91,7 @@ void ScreenDownloads::draw() {
m_theme->comment.draw(info.str());
// Additional info
std::ostringstream message;
- message << boost::format(_("Use left/right keys to scoll accross the %1% torrent(s)")) % torrents.size();
+ message << boost::format(_("Use left/right keys to scoll accross the %1% torrent(s) (down: %2%, up: %3%)")) % torrents.size() % addSuffix(m_downloader.getDownloadRate(),"/s") % addSuffix(m_downloader.getUploadRate(),"/s");
m_theme->comment_bg.dimensions.middle().screenBottom(-0.01);
m_theme->comment_bg.draw();
m_theme->comment.dimensions.left(-0.48).screenBottom(-0.023);
|
|
From: Yoda-JM <yo...@us...> - 2012-09-15 17:55:12
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Mar 17 01:25:28 2012 +0200
Ffmpeg API keeps changing, fix some deprecation warnings...
---
game/ffmpeg.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 4756997..cca7971 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -33,7 +33,7 @@ FFmpeg::~FFmpeg() {
if (pResampleCtx) audio_resample_close(pResampleCtx);
if (pAudioCodecCtx) avcodec_close(pAudioCodecCtx);
if (pVideoCodecCtx) avcodec_close(pVideoCodecCtx);
- if (pFormatCtx) av_close_input_file(pFormatCtx);
+ if (pFormatCtx) avformat_close_input(&pFormatCtx);
}
double FFmpeg::duration() const {
@@ -46,7 +46,7 @@ void FFmpeg::open() {
av_register_all();
av_log_set_level(AV_LOG_ERROR);
if (avformat_open_input(&pFormatCtx, m_filename.c_str(), NULL, NULL)) throw std::runtime_error("Cannot open input file");
- if (av_find_stream_info(pFormatCtx) < 0) throw std::runtime_error("Cannot find stream information");
+ if (avformat_find_stream_info(pFormatCtx, NULL) < 0) throw std::runtime_error("Cannot find stream information");
pFormatCtx->flags |= AVFMT_FLAG_GENPTS;
videoStream = -1;
audioStream = -1;
|
|
From: Yoda-JM <yo...@us...> - 2012-09-15 17:55:09
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Feb 13 03:18:27 2012 +0200
Yet another FFMPEG API switch (remove deprecated function calls). Use proper scope for AVFrameWrapper.
---
game/ffmpeg.cc | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index bc84f8c..4756997 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -45,7 +45,7 @@ void FFmpeg::open() {
boost::mutex::scoped_lock l(s_avcodec_mutex);
av_register_all();
av_log_set_level(AV_LOG_ERROR);
- if (av_open_input_file(&pFormatCtx, m_filename.c_str(), NULL, 0, NULL)) throw std::runtime_error("Cannot open input file");
+ if (avformat_open_input(&pFormatCtx, m_filename.c_str(), NULL, NULL)) throw std::runtime_error("Cannot open input file");
if (av_find_stream_info(pFormatCtx) < 0) throw std::runtime_error("Cannot find stream information");
pFormatCtx->flags |= AVFMT_FLAG_GENPTS;
videoStream = -1;
@@ -63,14 +63,14 @@ void FFmpeg::open() {
AVCodecContext* cc = pFormatCtx->streams[videoStream]->codec;
pVideoCodec = avcodec_find_decoder(cc->codec_id);
if (!pVideoCodec) throw std::runtime_error("Cannot find video codec");
- if (avcodec_open(cc, pVideoCodec) < 0) throw std::runtime_error("Cannot open video codec");
+ if (avcodec_open2(cc, pVideoCodec, NULL) < 0) throw std::runtime_error("Cannot open video codec");
pVideoCodecCtx = cc;
}
if (decodeAudio) {
AVCodecContext* cc = pFormatCtx->streams[audioStream]->codec;
pAudioCodec = avcodec_find_decoder(cc->codec_id);
if (!pAudioCodec) throw std::runtime_error("Cannot find audio codec");
- if (avcodec_open(cc, pAudioCodec) < 0) throw std::runtime_error("Cannot open audio codec");
+ if (avcodec_open2(cc, pAudioCodec, NULL) < 0) throw std::runtime_error("Cannot open audio codec");
pAudioCodecCtx = cc;
pResampleCtx = av_audio_resample_init(AUDIO_CHANNELS, cc->channels, m_rate, cc->sample_rate, SAMPLE_FMT_S16, SAMPLE_FMT_S16, 16, 10, 0, 0.8);
if (!pResampleCtx) throw std::runtime_error("Cannot create resampling context");
@@ -146,16 +146,6 @@ struct ReadFramePacket: public AVPacket {
}
};
-struct AVFrameWrapper {
- AVFrame* m_frame;
- AVFrameWrapper(): m_frame(avcodec_alloc_frame()) {
- if (!m_frame) throw std::runtime_error("Unable to allocate AVFrame");
- }
- ~AVFrameWrapper() { av_free(m_frame); }
- operator AVFrame*() { return m_frame; }
- AVFrame* operator->() { return m_frame; }
-} videoFrame;
-
void FFmpeg::decodePacket() {
ReadFramePacket packet(pFormatCtx);
int packetSize = packet.size;
@@ -171,6 +161,16 @@ void FFmpeg::decodePacket() {
}
int FFmpeg::decodeVideoFrame(ReadFramePacket& packet) {
+ struct AVFrameWrapper {
+ AVFrame* m_frame;
+ AVFrameWrapper(): m_frame(avcodec_alloc_frame()) {
+ if (!m_frame) throw std::runtime_error("Unable to allocate AVFrame");
+ }
+ ~AVFrameWrapper() { av_free(m_frame); }
+ operator AVFrame*() { return m_frame; }
+ AVFrame* operator->() { return m_frame; }
+ } videoFrame;
+
int frameFinished = 0;
int decodeSize = avcodec_decode_video2(pVideoCodecCtx, videoFrame, &frameFinished, &packet);
if (decodeSize < 0) throw std::runtime_error("cannot decode video frame");
|
|
From: Yoda-JM <yo...@us...> - 2012-09-15 17:55:05
|
Author: Lasse Karkkainen <tro...@tr...> Date: Sun Feb 12 09:24:52 2012 +0200 FFMPEG cleanup. Buffering bugfixes and some rewriting/restructuring of code. --- game/ffmpeg.cc | 234 +++++++++++++++++++------------------------------------- game/ffmpeg.hh | 25 +++--- 2 files changed, 93 insertions(+), 166 deletions(-) |
|
From: Yoda-JM <yo...@us...> - 2012-09-15 17:55:03
|
Author: Vincent Le Ligeour <yo...@us...> Date: Sat Sep 15 19:44:01 2012 +0200 bugfix: remove custom FindBoost.cmake Our custom (smart) FindBoost.cmake does not work. We use the one shipped with CMake. --- cmake/Modules/FindBoost.cmake | 416 ----------------------------------------- game/CMakeLists.txt | 2 +- tools/CMakeLists.txt | 2 +- 3 files changed, 2 insertions(+), 418 deletions(-) |
|
From: Yoda-JM <yo...@us...> - 2012-09-15 17:11:26
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Sep 15 19:09:28 2012 +0200
new: add interface to pause/resume/remove torrents
Add GUI to remove torrents from session (backspace) or pause/resume
torrent (space).
The default torrent status is paused (seeding/leaching not automatically
started).
---
data/schema.xml | 4 ++++
game/downloader.cc | 31 ++++++++++++++++++++++++++++++-
game/downloader.hh | 3 +++
game/screen_downloads.cc | 11 +++++++++++
4 files changed, 48 insertions(+), 1 deletions(-)
diff --git a/data/schema.xml b/data/schema.xml
index 6c98cfc..72a015b 100644
--- a/data/schema.xml
+++ b/data/schema.xml
@@ -272,4 +272,8 @@ to save the current settings to XML.
<short>DLC save directory</short>
<long>Where to save DLC. DATADIR at the beginning means all Performous data folders.</long>
</entry>
+ <entry name="dlc/autostart" type="bool" value="false">
+ <short>Automatically start DLC</short>
+ <short>Automatically start DLC (seeding and downloading) when performous starts.</short>
+ </entry>
</performous>
diff --git a/game/downloader.cc b/game/downloader.cc
index d3d9bf5..1b5adb4 100644
--- a/game/downloader.cc
+++ b/game/downloader.cc
@@ -69,8 +69,13 @@ class Downloader::Impl {
torrent_status status = h.status();
Torrent t;
t.name = h.name();
- t.state = state_str[status.state];
+ if(status.paused) {
+ t.state = "paused";
+ } else {
+ t.state = state_str[status.state];
+ }
t.progress = status.progress;
+ t.sha1 = h.info_hash().to_string();
std::string percent = boost::lexical_cast<std::string>(int(round(t.progress*100)));
std::clog << "torrent/debug: " << t.name << " (" << t.state << ":" << percent << "%)" << std::endl;
@@ -98,6 +103,21 @@ class Downloader::Impl {
}
}
+ void removeTorrent(std::string sha1) {
+ torrent_handle h = s.find_torrent(sha1_hash(sha1));
+ s.remove_torrent(h);
+ }
+
+ void pauseResume(std::string sha1) {
+ torrent_handle h = s.find_torrent(sha1_hash(sha1));
+ if(h.status().paused) {
+ h.resume();
+ } else {
+ h.auto_managed(false);
+ h.pause();
+ }
+ }
+
void pause(bool state) {
if (state) {
s.pause();
@@ -133,6 +153,11 @@ class Downloader::Impl {
add_torrent_params params;
params.save_path = savePath.string();
params.url = url;
+ if(config["dlc/autostart"].b()) {
+ params.flags |= add_torrent_params::flag_auto_managed;
+ } else {
+ params.flags &= ~add_torrent_params::flag_auto_managed;
+ }
std::clog << "torrent/info: adding " << url << " (saving in " << savePath << ")" << std::endl;
s.add_torrent(params, ec);
if(ec) {
@@ -161,6 +186,10 @@ Downloader::~Downloader() {}
void Downloader::pause(bool state) { self->pause(state); }
+void Downloader::pauseResume(std::string sha1) { self->pauseResume(sha1); }
+
void Downloader::addTorrent(std::string url) { self->addTorrent(url); }
+void Downloader::removeTorrent(std::string sha1) { self->removeTorrent(sha1); }
+
std::vector<Torrent> Downloader::getTorrents() const { return self->getTorrents(); };
diff --git a/game/downloader.hh b/game/downloader.hh
index 79b44a8..1b0a0d0 100644
--- a/game/downloader.hh
+++ b/game/downloader.hh
@@ -8,6 +8,7 @@ struct Torrent {
Torrent() {};
std::string name;
std::string state;
+ std::string sha1;
float progress;
};
@@ -16,7 +17,9 @@ class Downloader : boost::noncopyable {
Downloader();
~Downloader();
void pause(bool state);
+ void pauseResume(std::string sha1);
void addTorrent(std::string url);
+ void removeTorrent(std::string sha1);
std::vector<Torrent> getTorrents() const;
private:
class Impl;
diff --git a/game/screen_downloads.cc b/game/screen_downloads.cc
index 9b82dce..93f5e87 100644
--- a/game/screen_downloads.cc
+++ b/game/screen_downloads.cc
@@ -30,6 +30,17 @@ void ScreenDownloads::manageEvent(SDL_Event event) {
} else if (event.type == SDL_KEYDOWN) {
int key = event.key.keysym.sym;
SDLMod modifier = event.key.keysym.mod;
+ if (key == SDLK_SPACE) {
+ std::vector<Torrent> torrents = m_downloader.getTorrents();
+ if(m_selectedTorrent < torrents.size()) {
+ m_downloader.pauseResume(torrents[m_selectedTorrent].sha1);
+ }
+ } else if(key == SDLK_BACKSPACE) {
+ std::vector<Torrent> torrents = m_downloader.getTorrents();
+ if(m_selectedTorrent < torrents.size()) {
+ m_downloader.removeTorrent(torrents[m_selectedTorrent].sha1);
+ }
+ }
}
}
|
|
From: Yoda-JM <yo...@us...> - 2012-09-15 16:09:50
|
Author: Vincent Le Ligeour <yo...@us...> Date: Sat Sep 15 18:07:59 2012 +0200 new: add configuration and display of torrent Add configuration of torrent save path (using DATADIR shortcut if required) and display some basic information in screen download. The torrent magnet can be added in configuration file. --- data/schema.xml | 11 ++++ game/downloader.cc | 129 ++++++++++++++++++++++++++++++++++++++------- game/downloader.hh | 20 +++++-- game/main.cc | 3 +- game/screen_downloads.cc | 100 +++++++++-------------------------- game/screen_downloads.hh | 10 ++-- game/theme.cc | 1 - game/theme.hh | 2 - 8 files changed, 166 insertions(+), 110 deletions(-) |
|
From: Yoda-JM <yo...@us...> - 2012-09-14 23:12:46
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Sep 15 01:11:59 2012 +0200
fix: remove libtorrent deprecated warnings
---
game/downloader.cc | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/game/downloader.cc b/game/downloader.cc
index 30b8bc8..91f4658 100644
--- a/game/downloader.cc
+++ b/game/downloader.cc
@@ -30,7 +30,10 @@ struct Downloader::Impl {
add_torrent_params p;
p.save_path = (getDataDir() / "songs" / "dlc").string();
- add_magnet_uri(s, "magnet:?xt=urn:btih:7ea1b59cce1737437a66e29a2843b5ce3a0c8cd9", p);
+ error_code ec;
+ add_torrent_params params;
+ params.url = "magnet:?xt=urn:btih:7ea1b59cce1737437a66e29a2843b5ce3a0c8cd9";
+ s.add_torrent(params, ec);
pause(false);
} catch (std::exception& e) {
std::clog << "downloader/error: " << e.what() << std::endl;
@@ -43,7 +46,10 @@ struct Downloader::Impl {
s.stop_lsd();
s.stop_dht();
} else {
- if (!s.is_listening()) s.listen_on(std::make_pair(6881, 6889));
+ if (!s.is_listening()) {
+ error_code ec;
+ s.listen_on(std::make_pair(6881, 6889), ec);
+ }
s.start_dht();
s.start_lsd();
s.start_upnp();
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 23:12:43
|
Author: Vincent Le Ligeour <yo...@us...> Date: Sat Sep 15 00:52:43 2012 +0200 Merge branch 'master' into torrent --- |
|
From: Yoda-JM <yo...@us...> - 2012-09-14 23:12:41
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Sep 15 00:39:18 2012 +0200
bugfix: clean empty sentences when parsing is done
When parsing is done, empty sentences could stay in the vocal track,
leading to a fatal error crashing performous. This helps cleaning the
tracks on the finilize step.
---
game/songparser.cc | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/game/songparser.cc b/game/songparser.cc
index d698b15..9866392 100644
--- a/game/songparser.cc
+++ b/game/songparser.cc
@@ -135,8 +135,22 @@ void SongParser::resetNoteParsingState() {
void SongParser::finalize() {
std::vector<std::string> tracks = m_song.getVocalTrackNames();
for(std::vector<std::string>::const_iterator it = tracks.begin() ; it != tracks.end() ; ++it) {
- // Adjust negative notes
VocalTrack& vocal = m_song.getVocalTrack(*it);
+ // Remove empty sentences
+ {
+ Note::Type lastType = Note::NORMAL;
+ for (Notes::iterator itn = vocal.notes.begin(); itn != vocal.notes.end();) {
+ Note::Type type = itn->type;
+ if(type == Note::SLEEP && lastType == Note::SLEEP) {
+ std::clog << "songparser/warning: Discarding empty sentence" << std::endl;
+ itn = vocal.notes.erase(itn);
+ } else {
+ ++itn;
+ }
+ lastType = type;
+ }
+ }
+ // Adjust negative notes
if (vocal.noteMin <= 0) {
unsigned int shift = (1 - vocal.noteMin / 12) * 12;
vocal.noteMin += shift;
@@ -150,8 +164,8 @@ void SongParser::finalize() {
if (!vocal.notes.empty()) vocal.beginTime = vocal.notes.front().begin, vocal.endTime = vocal.notes.back().end;
// Compute maximum score
double max_score = 0.0;
- for (Notes::iterator it = vocal.notes.begin(); it != vocal.notes.end(); ++it) {
- max_score += it->maxScore();
+ for (Notes::iterator itn = vocal.notes.begin(); itn != vocal.notes.end(); ++itn) {
+ max_score += itn->maxScore();
}
vocal.m_scoreFactor = 1.0 / max_score;
}
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 23:12:38
|
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jul 18 13:47:31 2012 +0300
Webcam: if default resolution is smaller than VGA, try to get VGA.
---
game/webcam.cc | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/game/webcam.cc b/game/webcam.cc
index 85fa849..561dff3 100644
--- a/game/webcam.cc
+++ b/game/webcam.cc
@@ -30,6 +30,17 @@ Webcam::Webcam(int cam_id):
if (!m_capture->isOpened())
throw std::runtime_error("Could not initialize webcam capturing!");
}
+ // Try to get at least VGA resolution
+ if (m_capture->get(CV_CAP_PROP_FRAME_WIDTH) < 640
+ || m_capture->get(CV_CAP_PROP_FRAME_HEIGHT) < 480) {
+ m_capture->set(CV_CAP_PROP_FRAME_WIDTH, 640);
+ m_capture->set(CV_CAP_PROP_FRAME_HEIGHT, 480);
+ }
+ // Print actual values
+ std::cout << "Webcam frame properties: "
+ << m_capture->get(CV_CAP_PROP_FRAME_WIDTH) << "x"
+ << m_capture->get(CV_CAP_PROP_FRAME_HEIGHT) << std::endl;
+
// Initialize the video writer
#ifdef SAVE_WEBCAM_VIDEO
float fps = m_capture->get(CV_CAP_PROP_FPS);
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 23:12:35
|
Author: Alvaro Fernando Garcia <alv...@gm...>
Date: Tue Jul 17 07:39:15 2012 -0300
Fix covers draw graphic issue on songs screen.
---
game/screen_songs.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index afe23a1..0d56f26 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -202,8 +202,8 @@ void ScreenSongs::drawMultimedia() {
}
if (!m_jukebox) {
m_songbg_ground->draw();
- drawCovers();
theme->bg.draw();
+ drawCovers();
}
}
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 23:12:33
|
Author: Alvaro Fernando Garcia <alv...@gm...>
Date: Tue Jul 17 07:36:34 2012 -0300
Fix ffmpeg compile issue.
---
game/ffmpeg.cc | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index e4440ed..ac0889a 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -12,6 +12,10 @@ extern "C" {
#include SWSCALE_INCLUDE
}
+#if (LIBAVCODEC_VERSION_INT) < (AV_VERSION_INT(52,94,3))
+# define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16
+#endif
+
#define AUDIO_CHANNELS 2
/*static*/ boost::mutex FFmpeg::s_avcodec_mutex;
@@ -66,7 +70,7 @@ void FFmpeg::open() {
switch (m_mediaType) {
case AVMEDIA_TYPE_AUDIO:
- m_resampleContext = av_audio_resample_init(AUDIO_CHANNELS, cc->channels, m_rate, cc->sample_rate, SAMPLE_FMT_S16, SAMPLE_FMT_S16, 16, 10, 0, 0.8);
+ m_resampleContext = av_audio_resample_init(AUDIO_CHANNELS, cc->channels, m_rate, cc->sample_rate, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16, 16, 10, 0, 0.8);
if (!m_resampleContext) throw std::runtime_error("Cannot create resampling context");
audioQueue.setSamplesPerSecond(AUDIO_CHANNELS * m_rate);
break;
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 23:12:30
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jul 14 21:25:02 2012 +0300
Mirror webcam image.
---
game/webcam.cc | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/game/webcam.cc b/game/webcam.cc
index b3b66fe..85fa849 100644
--- a/game/webcam.cc
+++ b/game/webcam.cc
@@ -105,6 +105,8 @@ void Webcam::render() {
bitmap.buf.swap(m_frame.data); // Get back our buffer (FIXME: do we need to?)
m_frameAvailable = false;
}
+ using namespace glmath;
+ Transform trans(scale(vec3(-1.0, 1.0, 1.0)));
m_surface.draw(); // Draw
#endif
}
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 23:12:27
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Jul 10 06:18:44 2012 +0300
Revert "Fix video playback issue in dance mode."
This reverts commit b049a44b8966e8a27f2a91793956322eb2c8d335.
packet.pts contains incorrect timecode, causing B frames to be displayed
out of order. Yes, "pts" stands for "presentation time stamp" but apparently
it still contains decode time stamp values. The timecode system of libav is
retarded.
---
game/ffmpeg.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 616384e..e4440ed 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -161,8 +161,8 @@ void FFmpeg::decodePacket() {
packetSize -= decodeSize; // Move forward within the packet
if (!frameFinished) continue;
// Update current position if timecode is available
- if (packet.pts != int64_t(AV_NOPTS_VALUE)) {
- m_position = double(packet.pts) * av_q2d(m_formatContext->streams[m_streamId]->time_base);
+ if (frame->pkt_pts != uint64_t(AV_NOPTS_VALUE)) {
+ m_position = double(frame->pkt_pts) * av_q2d(m_formatContext->streams[m_streamId]->time_base);
}
if (m_mediaType == AVMEDIA_TYPE_VIDEO) processVideo(frame); else processAudio(frame);
}
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 23:12:24
|
Author: Alvaro Fernando Garcia <alv...@gm...>
Date: Tue Jul 10 00:06:37 2012 -0300
Fix video playback issue in dance mode.
---
game/ffmpeg.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index e4440ed..616384e 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -161,8 +161,8 @@ void FFmpeg::decodePacket() {
packetSize -= decodeSize; // Move forward within the packet
if (!frameFinished) continue;
// Update current position if timecode is available
- if (frame->pkt_pts != uint64_t(AV_NOPTS_VALUE)) {
- m_position = double(frame->pkt_pts) * av_q2d(m_formatContext->streams[m_streamId]->time_base);
+ if (packet.pts != int64_t(AV_NOPTS_VALUE)) {
+ m_position = double(packet.pts) * av_q2d(m_formatContext->streams[m_streamId]->time_base);
}
if (m_mediaType == AVMEDIA_TYPE_VIDEO) processVideo(frame); else processAudio(frame);
}
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 23:12:21
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Jul 8 11:38:55 2012 +0300
Fix indent: only blocks use tabs; line splitting and other things use only two spaces.
---
game/ffmpeg.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 1393760..e4440ed 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -155,8 +155,8 @@ void FFmpeg::decodePacket() {
AVFrameWrapper frame;
int frameFinished = 0;
int decodeSize = (m_mediaType == AVMEDIA_TYPE_VIDEO ?
- avcodec_decode_video2(m_codecContext, frame, &frameFinished, &packet) :
- avcodec_decode_audio4(m_codecContext, frame, &frameFinished, &packet));
+ avcodec_decode_video2(m_codecContext, frame, &frameFinished, &packet) :
+ avcodec_decode_audio4(m_codecContext, frame, &frameFinished, &packet));
if (decodeSize < 0) throw std::runtime_error("cannot decode avframe");
packetSize -= decodeSize; // Move forward within the packet
if (!frameFinished) continue;
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 22:51:40
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Sep 15 00:39:18 2012 +0200
bugfix: clean empty sentences when parsing is done
When parsing is done, empty sentences could stay in the vocal track,
leading to a fatal error crashing performous. This helps cleaning the
tracks on the finilize step.
(cherry picked from commit 74fd863d3be6146d9f2453c7f33231ede1adab3a)
---
game/songparser.cc | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/game/songparser.cc b/game/songparser.cc
index ac9f3f6..f024168 100644
--- a/game/songparser.cc
+++ b/game/songparser.cc
@@ -121,8 +121,22 @@ SongParser::SongParser(Song& s):
void SongParser::finalize() {
std::vector<std::string> tracks = m_song.getVocalTrackNames();
for(std::vector<std::string>::const_iterator it = tracks.begin() ; it != tracks.end() ; ++it) {
- // Adjust negative notes
VocalTrack& vocal = m_song.getVocalTrack(*it);
+ // Remove empty sentences
+ {
+ Note::Type lastType = Note::NORMAL;
+ for (Notes::iterator itn = vocal.notes.begin(); itn != vocal.notes.end();) {
+ Note::Type type = itn->type;
+ if(type == Note::SLEEP && lastType == Note::SLEEP) {
+ std::clog << "songparser/warning: Discarding empty sentence" << std::endl;
+ itn = vocal.notes.erase(itn);
+ } else {
+ ++itn;
+ }
+ lastType = type;
+ }
+ }
+ // Adjust negative notes
if (vocal.noteMin <= 0) {
unsigned int shift = (1 - vocal.noteMin / 12) * 12;
vocal.noteMin += shift;
@@ -136,8 +150,8 @@ void SongParser::finalize() {
if (!vocal.notes.empty()) vocal.beginTime = vocal.notes.front().begin, vocal.endTime = vocal.notes.back().end;
// Compute maximum score
double max_score = 0.0;
- for (Notes::iterator it = vocal.notes.begin(); it != vocal.notes.end(); ++it) {
- max_score += it->maxScore();
+ for (Notes::iterator itn = vocal.notes.begin(); itn != vocal.notes.end(); ++itn) {
+ max_score += itn->maxScore();
}
vocal.m_scoreFactor = 1.0 / max_score;
}
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 22:42:05
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Sep 15 00:38:34 2012 +0200
test
---
game/downloader.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/downloader.cc b/game/downloader.cc
index 754ee4d..30b8bc8 100644
--- a/game/downloader.cc
+++ b/game/downloader.cc
@@ -29,7 +29,7 @@ struct Downloader::Impl {
pause(true);
add_torrent_params p;
- p.save_path = getDataDir() / "songs" / "dlc";
+ p.save_path = (getDataDir() / "songs" / "dlc").string();
add_magnet_uri(s, "magnet:?xt=urn:btih:7ea1b59cce1737437a66e29a2843b5ce3a0c8cd9", p);
pause(false);
} catch (std::exception& e) {
|
|
From: Yoda-JM <yo...@us...> - 2012-09-14 22:42:00
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Sep 15 00:39:18 2012 +0200
bugfix: clean empty sentences when parsing is done
When parsing is done, empty sentences could stay in the vocal track,
leading to a fatal error crashing performous. This helps cleaning the
tracks on the finilize step.
---
game/songparser.cc | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/game/songparser.cc b/game/songparser.cc
index d698b15..9866392 100644
--- a/game/songparser.cc
+++ b/game/songparser.cc
@@ -135,8 +135,22 @@ void SongParser::resetNoteParsingState() {
void SongParser::finalize() {
std::vector<std::string> tracks = m_song.getVocalTrackNames();
for(std::vector<std::string>::const_iterator it = tracks.begin() ; it != tracks.end() ; ++it) {
- // Adjust negative notes
VocalTrack& vocal = m_song.getVocalTrack(*it);
+ // Remove empty sentences
+ {
+ Note::Type lastType = Note::NORMAL;
+ for (Notes::iterator itn = vocal.notes.begin(); itn != vocal.notes.end();) {
+ Note::Type type = itn->type;
+ if(type == Note::SLEEP && lastType == Note::SLEEP) {
+ std::clog << "songparser/warning: Discarding empty sentence" << std::endl;
+ itn = vocal.notes.erase(itn);
+ } else {
+ ++itn;
+ }
+ lastType = type;
+ }
+ }
+ // Adjust negative notes
if (vocal.noteMin <= 0) {
unsigned int shift = (1 - vocal.noteMin / 12) * 12;
vocal.noteMin += shift;
@@ -150,8 +164,8 @@ void SongParser::finalize() {
if (!vocal.notes.empty()) vocal.beginTime = vocal.notes.front().begin, vocal.endTime = vocal.notes.back().end;
// Compute maximum score
double max_score = 0.0;
- for (Notes::iterator it = vocal.notes.begin(); it != vocal.notes.end(); ++it) {
- max_score += it->maxScore();
+ for (Notes::iterator itn = vocal.notes.begin(); itn != vocal.notes.end(); ++itn) {
+ max_score += itn->maxScore();
}
vocal.m_scoreFactor = 1.0 / max_score;
}
|