Files
@ r27487:4d1c2a7bde00
Branch filter:
Location: cpp/openttd-patchpack/source/src/music/os2_m.cpp - annotation
r27487:4d1c2a7bde00
2.2 KiB
text/x-c
Codechange: remove queue_wrap / last_position from mouse movement
No backend uses it anymore, so also no longer any need to support
it.
No backend uses it anymore, so also no longer any need to support
it.
r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r9111:983de9c5a848 r9111:983de9c5a848 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r22888:a5ba89e2c64e r22883:e713e5b73adc r27175:3b7d2aa1c902 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r21383:942c32fb8b0e r21383:942c32fb8b0e r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r17629:21e9dfd343cd r17629:21e9dfd343cd r17629:21e9dfd343cd r17629:21e9dfd343cd r17629:21e9dfd343cd r27175:3b7d2aa1c902 r5584:545d748cc681 r27175:3b7d2aa1c902 r5584:545d748cc681 r5584:545d748cc681 r17629:21e9dfd343cd r7170:38b143754b40 r7170:38b143754b40 r22883:e713e5b73adc r5584:545d748cc681 r22888:a5ba89e2c64e r22883:e713e5b73adc r5584:545d748cc681 r22888:a5ba89e2c64e r5584:545d748cc681 r27175:3b7d2aa1c902 r5584:545d748cc681 r11627:b2d9c9dc2432 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7170:38b143754b40 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7170:38b143754b40 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7170:38b143754b40 r5584:545d748cc681 r5584:545d748cc681 r23607:36c15679007d r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r24218:c32caa9f014d r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7170:38b143754b40 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 | /*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file os2_m.cpp Music playback on OS/2. */
#include "../stdafx.h"
#include "../openttd.h"
#include "os2_m.h"
#include "midifile.hpp"
#include "../base_media_base.h"
#include "../3rdparty/fmt/format.h"
#define INCL_DOS
#define INCL_OS2MM
#define INCL_WIN
#include <os2.h>
#include <os2me.h>
#include "../safeguards.h"
/**********************
* OS/2 MIDI PLAYER
**********************/
/* Interesting how similar the MCI API in OS/2 is to the Win32 MCI API,
* eh? Anyone would think they both came from the same place originally! ;)
*/
/**
* Send a midi command.
* @param cmd The command to send.
* @return The result of sending it.
*/
static long CDECL MidiSendCommand(const std::string_view cmd)
{
return mciSendString(cmd.data(), nullptr, 0, nullptr, 0);
}
/** OS/2's music player's factory. */
static FMusicDriver_OS2 iFMusicDriver_OS2;
void MusicDriver_OS2::PlaySong(const MusicSongInfo &song)
{
std::string filename = MidiFile::GetSMFFile(song);
MidiSendCommand("close all");
if (filename.empty()) return;
if (MidiSendCommand(fmt::format("open {} type sequencer alias song", filename)) != 0) {
return;
}
MidiSendCommand("play song from 0");
}
void MusicDriver_OS2::StopSong()
{
MidiSendCommand("close all");
}
void MusicDriver_OS2::SetVolume(byte vol)
{
MidiSendCommand("set song audio volume %d", ((vol/127)*100));
}
bool MusicDriver_OS2::IsSongPlaying()
{
char buf[16];
mciSendString("status song mode", buf, sizeof(buf), nullptr, 0);
return strcmp(buf, "playing") == 0 || strcmp(buf, "seeking") == 0;
}
const char *MusicDriver_OS2::Start(const StringList &parm)
{
return 0;
}
void MusicDriver_OS2::Stop()
{
MidiSendCommand("close all");
}
|