annotate system/Init.cpp @ 1305:9f9f55a8af92 mp3-gapless

Add gapless flag to MP3FileReader, and implement trimming the delay samples from the start (padding is not yet trimmed from end)
author Chris Cannam
date Tue, 29 Nov 2016 11:35:56 +0000
parents 23d3a6eca5c3
children a090221caeda
rev   line source
Chris@404 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@404 2
Chris@404 3 /*
Chris@404 4 Sonic Visualiser
Chris@404 5 An audio file viewer and annotation editor.
Chris@404 6 Centre for Digital Music, Queen Mary, University of London.
Chris@404 7 This file copyright 2006 Chris Cannam.
Chris@404 8
Chris@404 9 This program is free software; you can redistribute it and/or
Chris@404 10 modify it under the terms of the GNU General Public License as
Chris@404 11 published by the Free Software Foundation; either version 2 of the
Chris@404 12 License, or (at your option) any later version. See the file
Chris@404 13 COPYING included with this distribution for more information.
Chris@404 14 */
Chris@404 15
Chris@404 16 #include <iostream>
Chris@404 17
Chris@658 18 #include <qglobal.h>
Chris@658 19
Chris@842 20 #ifdef Q_OS_WIN32
Chris@404 21
Chris@404 22 #include <fcntl.h>
Chris@658 23
Chris@658 24 // required for SetDllDirectory
Chris@658 25 #define _WIN32_WINNT 0x0502
Chris@404 26 #include <windows.h>
Chris@404 27
Chris@404 28 // Set default file open mode to binary
Chris@404 29 //#undef _fmode
Chris@404 30 //int _fmode = _O_BINARY;
Chris@404 31
Chris@404 32 void redirectStderr()
Chris@404 33 {
Chris@658 34 #ifdef NO_PROBABLY_NOT
Chris@404 35 HANDLE stderrHandle = GetStdHandle(STD_ERROR_HANDLE);
Chris@404 36 if (!stderrHandle) return;
Chris@404 37
Chris@404 38 AllocConsole();
Chris@404 39
Chris@404 40 CONSOLE_SCREEN_BUFFER_INFO info;
Chris@404 41 GetConsoleScreenBufferInfo(stderrHandle, &info);
Chris@404 42 info.dwSize.Y = 1000;
Chris@404 43 SetConsoleScreenBufferSize(stderrHandle, info.dwSize);
Chris@404 44
Chris@404 45 int h = _open_osfhandle((long)stderrHandle, _O_TEXT);
Chris@404 46 if (h) {
Chris@404 47 FILE *fd = _fdopen(h, "w");
Chris@404 48 if (fd) {
Chris@404 49 *stderr = *fd;
Chris@404 50 setvbuf(stderr, NULL, _IONBF, 0);
Chris@404 51 }
Chris@404 52 }
Chris@658 53 #endif
Chris@404 54 }
Chris@404 55
Chris@404 56 #endif
Chris@404 57
Chris@404 58 extern void svSystemSpecificInitialisation()
Chris@404 59 {
Chris@842 60 #ifdef Q_OS_WIN32
Chris@404 61 redirectStderr();
Chris@658 62
Chris@658 63 // Remove the CWD from the DLL search path, just in case
Chris@658 64 SetDllDirectory(L"");
Chris@658 65 putenv("PATH=");
Chris@404 66 #else
Chris@404 67 #endif
Chris@404 68 }
Chris@404 69
Chris@404 70
Chris@404 71