OpenTTD Source 20241224-master-gf74b0cf984
|
Music playback for Windows. More...
#include "../stdafx.h"
#include "../string_func.h"
#include "win32_m.h"
#include <windows.h>
#include <mmsystem.h>
#include "../os/windows/win32.h"
#include "../debug.h"
#include "midifile.hpp"
#include "midi.h"
#include "../base_media_base.h"
#include "../core/mem_func.hpp"
#include <mutex>
#include "../safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | PlaybackSegment |
Functions | |
static uint8_t | ScaleVolume (uint8_t original, uint8_t scale) |
void CALLBACK | MidiOutProc (HMIDIOUT hmo, UINT wMsg, DWORD_PTR, DWORD_PTR dwParam1, DWORD_PTR) |
static void | TransmitChannelMsg (uint8_t status, uint8_t p1, uint8_t p2=0) |
static void | TransmitSysex (const uint8_t *&msg_start, size_t &remaining) |
static void | TransmitStandardSysex (MidiSysexMessage msg) |
void CALLBACK | TimerCallback (UINT uTimerID, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) |
Realtime MIDI playback service routine. | |
Variables | ||
struct { | ||
UINT time_period | ||
obtained timer precision value More... | ||
HMIDIOUT midi_out | ||
handle to open midiOut More... | ||
UINT timer_id | ||
ID of active multimedia timer. More... | ||
std::mutex lock | ||
synchronization for playback status fields More... | ||
bool playing | ||
flag indicating that playback is active More... | ||
int do_start | ||
flag for starting playback of next_file at next opportunity More... | ||
bool do_stop | ||
flag for stopping playback at next opportunity More... | ||
uint8_t current_volume | ||
current effective volume setting More... | ||
uint8_t new_volume | ||
volume setting to change to More... | ||
MidiFile current_file | ||
file currently being played from More... | ||
PlaybackSegment current_segment | ||
segment info for current playback More... | ||
DWORD playback_start_time | ||
timestamp current file began playback More... | ||
size_t current_block | ||
next block index to send More... | ||
MidiFile next_file | ||
upcoming file to play More... | ||
PlaybackSegment next_segment | ||
segment info for upcoming file More... | ||
uint8_t channel_volumes [16] | ||
last seen volume controller values in raw data More... | ||
} | _midi | |
static FMusicDriver_Win32 | iFMusicDriver_Win32 | |
Music playback for Windows.
Definition in file win32_m.cpp.
void CALLBACK MidiOutProc | ( | HMIDIOUT | hmo, |
UINT | wMsg, | ||
DWORD_PTR | , | ||
DWORD_PTR | dwParam1, | ||
DWORD_PTR | |||
) |
Definition at line 62 of file win32_m.cpp.
|
static |
Definition at line 56 of file win32_m.cpp.
void CALLBACK TimerCallback | ( | UINT | uTimerID, |
UINT | , | ||
DWORD_PTR | , | ||
DWORD_PTR | , | ||
DWORD_PTR | |||
) |
Realtime MIDI playback service routine.
This is called by the multimedia timer.
Definition at line 111 of file win32_m.cpp.
References MidiFile::DataBlock::data, Debug, lengthof, MidiFile::DataBlock::realtime, and MidiFile::DataBlock::ticktime.
Referenced by MusicDriver_Win32::PlaySong().
|
static |
Definition at line 71 of file win32_m.cpp.
|
static |
Definition at line 100 of file win32_m.cpp.
|
static |
Definition at line 76 of file win32_m.cpp.
uint8_t channel_volumes[16] |
last seen volume controller values in raw data
Definition at line 50 of file win32_m.cpp.
size_t current_block |
next block index to send
Definition at line 46 of file win32_m.cpp.
MidiFile current_file |
file currently being played from
Definition at line 43 of file win32_m.cpp.
PlaybackSegment current_segment |
segment info for current playback
Definition at line 44 of file win32_m.cpp.
uint8_t current_volume |
current effective volume setting
Definition at line 40 of file win32_m.cpp.
int do_start |
flag for starting playback of next_file at next opportunity
Definition at line 38 of file win32_m.cpp.
bool do_stop |
flag for stopping playback at next opportunity
Definition at line 39 of file win32_m.cpp.
|
static |
Definition at line 53 of file win32_m.cpp.
std::mutex lock |
synchronization for playback status fields
Definition at line 35 of file win32_m.cpp.
Referenced by SmallStack< Titem, Tindex, Tinvalid, Tgrowth_step, Tmax_size >::Branch(), NetworkHTTPSocketHandler::Connect(), SmallStack< Titem, Tindex, Tinvalid, Tgrowth_step, Tmax_size >::Contains(), CopyPalette(), DebugPrint(), DebugSendRemoteMessages(), PacketWriter::Destroy(), VideoDriver::DrainCommandQueue(), PacketWriter::Finish(), VideoDriver::GameLoopPause(), HTTPThreadSafeCallback::HandleQueue(), NetworkHTTPSocketHandler::HTTPReceive(), HTTPThreadSafeCallback::IsQueueEmpty(), MusicDriver_FluidSynth::IsSongPlaying(), MakeScreenshot(), MxSetMusicSource(), NetworkHTTPRequest::NetworkHTTPRequest(), NetworkHTTPRequest::NetworkHTTPRequest(), NetworkHTTPUninitialize(), HTTPThreadSafeCallback::OnFailure(), HTTPThreadSafeCallback::OnReceiveData(), MusicDriver_DMusic::PlaySong(), MusicDriver_FluidSynth::PlaySong(), SmallStack< Titem, Tindex, Tinvalid, Tgrowth_step, Tmax_size >::Pop(), SmallStack< Titem, Tindex, Tinvalid, Tgrowth_step, Tmax_size >::Push(), VideoDriver::QueueOnMainThread(), MusicDriver_FluidSynth::SetVolume(), MusicDriver_FluidSynth::Start(), StartNewThread(), MusicDriver_FluidSynth::Stop(), MusicDriver_FluidSynth::StopSong(), PacketWriter::TransferToNetworkQueue(), NetworkSurveyHandler::Transmit(), HTTPThreadSafeCallback::WaitTillEmptyOrCondition(), PacketWriter::Write(), NetworkHTTPRequest::~NetworkHTTPRequest(), and PacketWriter::~PacketWriter().
HMIDIOUT midi_out |
handle to open midiOut
Definition at line 33 of file win32_m.cpp.
uint8_t new_volume |
volume setting to change to
Definition at line 41 of file win32_m.cpp.
MidiFile next_file |
upcoming file to play
Definition at line 47 of file win32_m.cpp.
PlaybackSegment next_segment |
segment info for upcoming file
Definition at line 48 of file win32_m.cpp.
DWORD playback_start_time |
timestamp current file began playback
Definition at line 45 of file win32_m.cpp.
bool playing |
flag indicating that playback is active
Definition at line 37 of file win32_m.cpp.
UINT time_period |
obtained timer precision value
Definition at line 32 of file win32_m.cpp.
UINT timer_id |
ID of active multimedia timer.
Definition at line 34 of file win32_m.cpp.