void AmeSystemSound::initialize() { if (mInited) uninitialize(); source = ""; mixer = 0; mPause = false; mPlay = false; mUserStop = false; QSettings settings(AmeDirs::global()->stdDir(AmeDirs::Configs) + "/Sound", QSettings::IniFormat); if (useMixer) { QString mixerCard = settings.value("Mixer/mixer_card", "hw:0").toString(); QString mixerDevice = settings.value("Mixer/mixer_device", "Master").toString(); setupMixer(mixerCard, mixerDevice); } // Phonon initialization media = new Phonon::MediaObject(this); output = new Phonon::AudioOutput(Phonon::MusicCategory, this); Phonon::createPath(media, output); mPause = false; mPlay = false; mUserStop = false; mInited = true; return; }
VolumeALSA::VolumeALSA() { //alsa mixer m_mixer = 0; QSettings settings(Qmmp::configFile(), QSettings::IniFormat); QString card = settings.value("ALSA/mixer_card","hw:0").toString(); QString dev = settings.value("ALSA/mixer_device", "PCM").toString(); setupMixer(card, dev); }
bool AmeSystemSound::reinitMixer(QString card, QString device) { if (!useMixer) return false; if (mixer) { snd_mixer_close(mixer); mixer = 0; } setupMixer(card, device); return true; }
void OSystem_IPHONE::initBackend() { #ifdef IPHONE_SANDBOXED _savefileManager = new DefaultSaveFileManager(iPhone_getDocumentsDir()); #else _savefileManager = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH); #endif _timerManager = new DefaultTimerManager(); gettimeofday(&_startTime, NULL); setupMixer(); setTimerCallback(&OSystem_IPHONE::timerHandler, 10); EventsBaseBackend::initBackend(); }
void OSystem_SDL::initBackend() { assert(!_inited); int joystick_num = ConfMan.getInt("joystick_num"); uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER; if (ConfMan.hasKey("disable_sdl_parachute")) sdlFlags |= SDL_INIT_NOPARACHUTE; #ifdef _WIN32_WCE if (ConfMan.hasKey("use_GDI") && ConfMan.getBool("use_GDI")) { SDL_VideoInit("windib", 0); sdlFlags ^= SDL_INIT_VIDEO; } #endif if (joystick_num > -1) sdlFlags |= SDL_INIT_JOYSTICK; if (SDL_Init(sdlFlags) == -1) { error("Could not initialize SDL: %s", SDL_GetError()); } _graphicsMutex = createMutex(); SDL_ShowCursor(SDL_DISABLE); // Enable unicode support if possible SDL_EnableUNICODE(1); memset(&_oldVideoMode, 0, sizeof(_oldVideoMode)); memset(&_videoMode, 0, sizeof(_videoMode)); memset(&_transactionDetails, 0, sizeof(_transactionDetails)); _cksumValid = false; #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && !defined(DISABLE_SCALERS) _videoMode.mode = GFX_DOUBLESIZE; _videoMode.scaleFactor = 2; _videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio"); _scalerProc = Normal2x; #else // for small screen platforms _videoMode.mode = GFX_NORMAL; _videoMode.scaleFactor = 1; _videoMode.aspectRatioCorrection = false; _scalerProc = Normal1x; #endif _scalerType = 0; _modeFlags = 0; #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) _videoMode.fullscreen = ConfMan.getBool("fullscreen"); #else _videoMode.fullscreen = true; #endif #if !defined(MACOSX) && !defined(__SYMBIAN32__) // Setup a custom program icon. // Don't set icon on OS X, as we use a nicer external icon there. // Don't for Symbian: it uses the EScummVM.aif file for the icon. setupIcon(); #endif // enable joystick if (joystick_num > -1 && SDL_NumJoysticks() > 0) { printf("Using joystick: %s\n", SDL_JoystickName(0)); _joystick = SDL_JoystickOpen(joystick_num); } // Create the savefile manager, if none exists yet (we check for this to // allow subclasses to provide their own). if (_savefile == 0) { #ifdef UNIX _savefile = new POSIXSaveFileManager(); #else _savefile = new DefaultSaveFileManager(); #endif } // Create and hook up the mixer, if none exists yet (we check for this to // allow subclasses to provide their own). if (_mixer == 0) { setupMixer(); } // Create and hook up the timer manager, if none exists yet (we check for // this to allow subclasses to provide their own). if (_timer == 0) { // Note: We could implement a custom SDLTimerManager by using // SDL_AddTimer. That might yield better timer resolution, but it would // also change the semantics of a timer: Right now, ScummVM timers // *never* run in parallel, due to the way they are implemented. If we // switched to SDL_AddTimer, each timer might run in a separate thread. // However, not all our code is prepared for that, so we can't just // switch. Still, it's a potential future change to keep in mind. _timer = new DefaultTimerManager(); _timerID = SDL_AddTimer(10, &timer_handler, _timer); } // Invoke parent implementation of this method OSystem::initBackend(); _inited = true; }