20 |
#include <iostream> |
#include <iostream> |
21 |
#include <cstring> |
#include <cstring> |
22 |
|
|
23 |
|
#include <glibmmconfig.h> |
24 |
|
// threads.h must be included first to be able to build with |
25 |
|
// G_DISABLE_DEPRECATED |
26 |
|
#if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION == 31 && GLIBMM_MICRO_VERSION >= 2) || \ |
27 |
|
(GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION > 31) || GLIBMM_MAJOR_VERSION > 2 |
28 |
|
#include <glibmm/threads.h> |
29 |
|
#endif |
30 |
|
|
31 |
#include <glibmm/convert.h> |
#include <glibmm/convert.h> |
32 |
#include <glibmm/dispatcher.h> |
#include <glibmm/dispatcher.h> |
33 |
#include <glibmm/miscutils.h> |
#include <glibmm/miscutils.h> |
804 |
|
|
805 |
void Loader::thread_function() |
void Loader::thread_function() |
806 |
{ |
{ |
807 |
printf("thread_function self=%x\n", Glib::Threads::Thread::self()); |
printf("thread_function self=%p\n", |
808 |
|
static_cast<void*>(Glib::Threads::Thread::self())); |
809 |
printf("Start %s\n", filename.c_str()); |
printf("Start %s\n", filename.c_str()); |
810 |
try { |
try { |
811 |
RIFF::File* riff = new RIFF::File(filename); |
RIFF::File* riff = new RIFF::File(filename); |
827 |
} |
} |
828 |
|
|
829 |
Loader::Loader(const char* filename) |
Loader::Loader(const char* filename) |
830 |
: filename(filename), thread(0), progress(0.f) |
: filename(filename), gig(0), thread(0), progress(0.f) |
831 |
{ |
{ |
832 |
} |
} |
833 |
|
|
838 |
#else |
#else |
839 |
thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Loader::thread_function)); |
thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Loader::thread_function)); |
840 |
#endif |
#endif |
841 |
printf("launch thread=%x\n", thread); |
printf("launch thread=%p\n", static_cast<void*>(thread)); |
842 |
} |
} |
843 |
|
|
844 |
float Loader::get_progress() |
float Loader::get_progress() |
883 |
|
|
884 |
void Saver::thread_function() |
void Saver::thread_function() |
885 |
{ |
{ |
886 |
printf("thread_function self=%x\n", Glib::Threads::Thread::self()); |
printf("thread_function self=%p\n", |
887 |
|
static_cast<void*>(Glib::Threads::Thread::self())); |
888 |
printf("Start %s\n", filename.c_str()); |
printf("Start %s\n", filename.c_str()); |
889 |
try { |
try { |
890 |
gig::progress_t progress; |
gig::progress_t progress; |
921 |
#else |
#else |
922 |
thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Saver::thread_function)); |
thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Saver::thread_function)); |
923 |
#endif |
#endif |
924 |
printf("launch thread=%x\n", thread); |
printf("launch thread=%p\n", static_cast<void*>(thread)); |
925 |
} |
} |
926 |
|
|
927 |
float Saver::get_progress() |
float Saver::get_progress() |
1081 |
if (dialog.run() == Gtk::RESPONSE_OK) { |
if (dialog.run() == Gtk::RESPONSE_OK) { |
1082 |
std::string filename = dialog.get_filename(); |
std::string filename = dialog.get_filename(); |
1083 |
printf("filename=%s\n", filename.c_str()); |
printf("filename=%s\n", filename.c_str()); |
1084 |
printf("on_action_file_open self=%x\n", Glib::Threads::Thread::self()); |
printf("on_action_file_open self=%p\n", |
1085 |
|
static_cast<void*>(Glib::Threads::Thread::self())); |
1086 |
load_file(filename.c_str()); |
load_file(filename.c_str()); |
1087 |
current_gig_dir = Glib::path_get_dirname(filename); |
current_gig_dir = Glib::path_get_dirname(filename); |
1088 |
} |
} |
1152 |
void MainWindow::on_loader_finished() |
void MainWindow::on_loader_finished() |
1153 |
{ |
{ |
1154 |
printf("Loader finished!\n"); |
printf("Loader finished!\n"); |
1155 |
printf("on_loader_finished self=%x\n", Glib::Threads::Thread::self()); |
printf("on_loader_finished self=%p\n", |
1156 |
|
static_cast<void*>(Glib::Threads::Thread::self())); |
1157 |
load_gig(loader->gig, loader->filename.c_str()); |
load_gig(loader->gig, loader->filename.c_str()); |
1158 |
progress_dialog->hide(); |
progress_dialog->hide(); |
1159 |
} |
} |
1345 |
void MainWindow::__import_queued_samples() { |
void MainWindow::__import_queued_samples() { |
1346 |
std::cout << "Starting sample import\n" << std::flush; |
std::cout << "Starting sample import\n" << std::flush; |
1347 |
Glib::ustring error_files; |
Glib::ustring error_files; |
1348 |
printf("Samples to import: %d\n", m_SampleImportQueue.size()); |
printf("Samples to import: %d\n", int(m_SampleImportQueue.size())); |
1349 |
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); |
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); |
1350 |
iter != m_SampleImportQueue.end(); ) { |
iter != m_SampleImportQueue.end(); ) { |
1351 |
printf("Importing sample %s\n",(*iter).sample_path.c_str()); |
printf("Importing sample %s\n",(*iter).sample_path.c_str()); |
2663 |
try |
try |
2664 |
{ |
{ |
2665 |
if (!hFile) throw std::string(_("could not open file")); |
if (!hFile) throw std::string(_("could not open file")); |
|
int bitdepth; |
|
2666 |
switch (info.format & 0xff) { |
switch (info.format & 0xff) { |
2667 |
case SF_FORMAT_PCM_S8: |
case SF_FORMAT_PCM_S8: |
2668 |
case SF_FORMAT_PCM_16: |
case SF_FORMAT_PCM_16: |
2669 |
case SF_FORMAT_PCM_U8: |
case SF_FORMAT_PCM_U8: |
|
bitdepth = 16; |
|
|
break; |
|
2670 |
case SF_FORMAT_PCM_24: |
case SF_FORMAT_PCM_24: |
2671 |
case SF_FORMAT_PCM_32: |
case SF_FORMAT_PCM_32: |
2672 |
case SF_FORMAT_FLOAT: |
case SF_FORMAT_FLOAT: |
2673 |
case SF_FORMAT_DOUBLE: |
case SF_FORMAT_DOUBLE: |
|
bitdepth = 24; |
|
2674 |
break; |
break; |
2675 |
default: |
default: |
2676 |
sf_close(hFile); |
sf_close(hFile); |
3301 |
descriptionArea.show_all(); |
descriptionArea.show_all(); |
3302 |
|
|
3303 |
if (dialog.run() == Gtk::RESPONSE_OK) { |
if (dialog.run() == Gtk::RESPONSE_OK) { |
3304 |
printf("on_action_merge_files self=%x\n", Glib::Threads::Thread::self()); |
printf("on_action_merge_files self=%p\n", |
3305 |
|
static_cast<void*>(Glib::Threads::Thread::self())); |
3306 |
std::vector<std::string> filenames = dialog.get_filenames(); |
std::vector<std::string> filenames = dialog.get_filenames(); |
3307 |
|
|
3308 |
// merge the selected files to the currently open .gig file |
// merge the selected files to the currently open .gig file |