Changeset - r22883:e713e5b73adc
[Not reviewed]
master
0 23 0
Niels Martin Hansen - 7 years ago 2018-03-17 13:51:30
nielsm@indvikleren.dk
Codechange: Pass a MusicSongInfo struct instead of bare filename to music drivers.

Preparation for later extending the info passed to music drivers.
23 files changed with 85 insertions and 41 deletions:
0 comments (0 inline, 0 general)
src/base_media_base.h
Show inline comments
 
@@ -282,17 +282,29 @@ static const uint NUM_SONG_CLASSES    = 
 
/** Maximum number of songs in the full playlist; theme song + the classes */
 
static const uint NUM_SONGS_AVAILABLE = 1 + NUM_SONG_CLASSES * NUM_SONGS_CLASS;
 

	
 
/** Maximum number of songs in the (custom) playlist */
 
static const uint NUM_SONGS_PLAYLIST  = 32;
 

	
 
enum MusicTrackType {
 
	MTT_STANDARDMIDI, ///< Standard MIDI file
 
};
 

	
 
/** Metadata about a music track. */
 
struct MusicSongInfo {
 
	char songname[32];       ///< name of song displayed in UI
 
	byte tracknr;            ///< track number of song displayed in UI
 
	const char *filename;    ///< file on disk containing song (when used in MusicSet class, this pointer is owned by MD5File object for the file)
 
	MusicTrackType filetype; ///< decoder required for song file
 
};
 

	
 
/** All data of a music set. */
 
struct MusicSet : BaseSet<MusicSet, NUM_SONGS_AVAILABLE, false> {
 
	/** The name of the different songs. */
 
	char song_name[NUM_SONGS_AVAILABLE][32];
 
	byte track_nr[NUM_SONGS_AVAILABLE];
 
	/** Data about individual songs in set. */
 
	MusicSongInfo songinfo[NUM_SONGS_AVAILABLE];
 
	/** Number of valid songs in set. */
 
	byte num_available;
 

	
 
	bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename);
 
};
 

	
 
/** All data/functions related with replacing the base music */
src/music.cpp
Show inline comments
 
@@ -63,19 +63,22 @@ template <class Tbase_set>
 
bool MusicSet::FillSetDetails(IniFile *ini, const char *path, const char *full_filename)
 
{
 
	bool ret = this->BaseSet<MusicSet, NUM_SONGS_AVAILABLE, false>::FillSetDetails(ini, path, full_filename);
 
	if (ret) {
 
		this->num_available = 0;
 
		IniGroup *names = ini->GetGroup("names");
 
		for (uint i = 0, j = 1; i < lengthof(this->song_name); i++) {
 
		for (uint i = 0, j = 1; i < lengthof(this->songinfo); i++) {
 
			const char *filename = this->files[i].filename;
 
			if (names == NULL || StrEmpty(filename)) {
 
				this->song_name[i][0] = '\0';
 
				this->songinfo[i].songname[0] = '\0';
 
				continue;
 
			}
 

	
 
			this->songinfo[i].filename = filename; // non-owned pointer
 
			this->songinfo[i].filetype = MTT_STANDARDMIDI;
 

	
 
			IniItem *item = NULL;
 
			/* As we possibly add a path to the filename and we compare
 
			 * on the filename with the path as in the .obm, we need to
 
			 * keep stripping path elements until we find a match. */
 
			for (const char *p = filename; p != NULL; p = strchr(p, PATHSEPCHAR)) {
 
				/* Remove possible double path separator characters from
 
@@ -88,13 +91,13 @@ bool MusicSet::FillSetDetails(IniFile *i
 

	
 
			if (item == NULL || StrEmpty(item->value)) {
 
				DEBUG(grf, 0, "Base music set song name missing: %s", filename);
 
				return false;
 
			}
 

	
 
			strecpy(this->song_name[i], item->value, lastof(this->song_name[i]));
 
			this->track_nr[i] = j++;
 
			strecpy(this->songinfo[i].songname, item->value, lastof(this->songinfo[i].songname));
 
			this->songinfo[i].tracknr = j++;
 
			this->num_available++;
 
		}
 
	}
 
	return ret;
 
}
src/music/allegro_m.cpp
Show inline comments
 
@@ -55,16 +55,18 @@ void MusicDriver_Allegro::Stop()
 
	if (_midi != NULL) destroy_midi(_midi);
 
	_midi = NULL;
 

	
 
	if (--_allegro_instance_count == 0) allegro_exit();
 
}
 

	
 
void MusicDriver_Allegro::PlaySong(const char *filename)
 
void MusicDriver_Allegro::PlaySong(const MusicSongInfo &song)
 
{
 
	if (song.filetype != MTT_STANDARDMIDI) return;
 

	
 
	if (_midi != NULL) destroy_midi(_midi);
 
	_midi = load_midi(filename);
 
	_midi = load_midi(song.filename);
 
	play_midi(_midi, false);
 
}
 

	
 
void MusicDriver_Allegro::StopSong()
 
{
 
	stop_midi();
src/music/allegro_m.h
Show inline comments
 
@@ -18,13 +18,13 @@
 
class MusicDriver_Allegro : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
src/music/bemidi.cpp
Show inline comments
 
@@ -9,12 +9,13 @@
 

	
 
/** @file bemidi.cpp Support for BeOS midi. */
 

	
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "bemidi.h"
 
#include "../base_media_base.h"
 

	
 
/* BeOS System Includes */
 
#include <MidiSynthFile.h>
 

	
 
#include "../safeguards.h"
 

	
 
@@ -31,17 +32,19 @@ const char *MusicDriver_BeMidi::Start(co
 

	
 
void MusicDriver_BeMidi::Stop()
 
{
 
	midiSynthFile.UnloadFile();
 
}
 

	
 
void MusicDriver_BeMidi::PlaySong(const char *filename)
 
void MusicDriver_BeMidi::PlaySong(const MusicSongInfo &song)
 
{
 
	if (song.filetype != MTT_STANDARDMIDI) return;
 

	
 
	this->Stop();
 
	entry_ref midiRef;
 
	get_ref_for_path(filename, &midiRef);
 
	get_ref_for_path(song.filename, &midiRef);
 
	midiSynthFile.LoadFile(&midiRef);
 
	midiSynthFile.Start();
 
}
 

	
 
void MusicDriver_BeMidi::StopSong()
 
{
src/music/bemidi.h
Show inline comments
 
@@ -18,13 +18,13 @@
 
class MusicDriver_BeMidi : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
src/music/cocoa_m.cpp
Show inline comments
 
@@ -16,12 +16,13 @@
 
#ifdef WITH_COCOA
 

	
 
#include "../stdafx.h"
 
#include "../os/macosx/macos.h"
 
#include "cocoa_m.h"
 
#include "../debug.h"
 
#include "../base_media_base.h"
 

	
 
#define Rect        OTTDRect
 
#define Point       OTTDPoint
 
#include <CoreServices/CoreServices.h>
 
#include <AudioUnit/AudioUnit.h>
 
#include <AudioToolbox/AudioToolbox.h>
 
@@ -140,14 +141,16 @@ void MusicDriver_Cocoa::Stop()
 

	
 
/**
 
 * Starts playing a new song.
 
 *
 
 * @param filename Path to a MIDI file.
 
 */
 
void MusicDriver_Cocoa::PlaySong(const char *filename)
 
void MusicDriver_Cocoa::PlaySong(const MusicSongInfo &song)
 
{
 
	if (song.filetype != MTT_STANDARDMIDI) return;
 

	
 
	DEBUG(driver, 2, "cocoa_m: trying to play '%s'", filename);
 

	
 
	this->StopSong();
 
	if (_sequence != NULL) {
 
		DisposeMusicSequence(_sequence);
 
		_sequence = NULL;
 
@@ -155,13 +158,13 @@ void MusicDriver_Cocoa::PlaySong(const c
 

	
 
	if (NewMusicSequence(&_sequence) != noErr) {
 
		DEBUG(driver, 0, "cocoa_m: Failed to create music sequence");
 
		return;
 
	}
 

	
 
	const char *os_file = OTTD2FS(filename);
 
	const char *os_file = OTTD2FS(song.filename);
 
	CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8*)os_file, strlen(os_file), false);
 

	
 
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
 
	if (MacOSVersionIsAtLeast(10, 5, 0)) {
 
		if (MusicSequenceFileLoad(_sequence, url, kMusicSequenceFile_AnyType, 0) != noErr) {
 
			DEBUG(driver, 0, "cocoa_m: Failed to load MIDI file");
src/music/cocoa_m.h
Show inline comments
 
@@ -17,13 +17,13 @@
 
class MusicDriver_Cocoa : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
src/music/dmusic.cpp
Show inline comments
 
@@ -18,12 +18,13 @@
 
#endif
 
#include "../debug.h"
 
#include "../os/windows/win32.h"
 
#include "../core/mem_func.hpp"
 
#include "../thread/thread.h"
 
#include "../fileio_func.h"
 
#include "../base_media_base.h"
 
#include "dmusic.h"
 
#include "midifile.hpp"
 
#include "midi.h"
 

	
 
#include <windows.h>
 
#include <dmksctrl.h>
 
@@ -1222,17 +1223,19 @@ void MusicDriver_DMusic::Stop()
 
	delete _thread_mutex;
 

	
 
	CoUninitialize();
 
}
 

	
 

	
 
void MusicDriver_DMusic::PlaySong(const char *filename)
 
void MusicDriver_DMusic::PlaySong(const MusicSongInfo &song)
 
{
 
	if (song.filetype != MTT_STANDARDMIDI) return;
 

	
 
	ThreadMutexLocker lock(_thread_mutex);
 

	
 
	_playback.next_file.LoadFile(filename);
 
	_playback.next_file.LoadFile(song.filename);
 
	_playback.next_segment.start = 0;
 
	_playback.next_segment.end = 0;
 
	_playback.next_segment.loop = false;
 

	
 
	_playback.do_start = true;
 
	SetEvent(_thread_event);
src/music/dmusic.h
Show inline comments
 
@@ -20,13 +20,13 @@ public:
 
	virtual ~MusicDriver_DMusic();
 

	
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
src/music/extmidi.cpp
Show inline comments
 
@@ -14,12 +14,13 @@
 
#include "../string_func.h"
 
#include "../core/alloc_func.hpp"
 
#include "../sound/sound_driver.hpp"
 
#include "../video/video_driver.hpp"
 
#include "../gfx_func.h"
 
#include "extmidi.h"
 
#include "../base_media_base.h"
 
#include <fcntl.h>
 
#include <sys/types.h>
 
#include <sys/wait.h>
 
#include <unistd.h>
 
#include <signal.h>
 
#include <sys/stat.h>
 
@@ -80,15 +81,17 @@ void MusicDriver_ExtMidi::Stop()
 
	free(params[0]);
 
	free(params);
 
	this->song[0] = '\0';
 
	this->DoStop();
 
}
 

	
 
void MusicDriver_ExtMidi::PlaySong(const char *filename)
 
void MusicDriver_ExtMidi::PlaySong(const MusicSongInfo &song)
 
{
 
	strecpy(this->song, filename, lastof(this->song));
 
	if (song.filetype != MTT_STANDARDMIDI) return;
 

	
 
	strecpy(this->song, song.filename, lastof(this->song));
 
	this->DoStop();
 
}
 

	
 
void MusicDriver_ExtMidi::StopSong()
 
{
 
	this->song[0] = '\0';
src/music/extmidi.h
Show inline comments
 
@@ -25,13 +25,13 @@ private:
 

	
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
src/music/libtimidity.cpp
Show inline comments
 
@@ -11,12 +11,13 @@
 

	
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "../sound_type.h"
 
#include "../debug.h"
 
#include "libtimidity.h"
 
#include "../base_media_base.h"
 
#include <fcntl.h>
 
#include <sys/types.h>
 
#include <sys/wait.h>
 
#include <unistd.h>
 
#include <signal.h>
 
#include <sys/stat.h>
 
@@ -70,17 +71,19 @@ const char *MusicDriver_LibTimidity::Sta
 
void MusicDriver_LibTimidity::Stop()
 
{
 
	if (_midi.status == MIDI_PLAYING) this->StopSong();
 
	mid_exit();
 
}
 

	
 
void MusicDriver_LibTimidity::PlaySong(const char *filename)
 
void MusicDriver_LibTimidity::PlaySong(const MusicSongInfo &song)
 
{
 
	if (song.filetype != MTT_STANDARDMIDI) return;
 

	
 
	this->StopSong();
 

	
 
	_midi.stream = mid_istream_open_file(filename);
 
	_midi.stream = mid_istream_open_file(song.filename);
 
	if (_midi.stream == NULL) {
 
		DEBUG(driver, 0, "Could not open music file");
 
		return;
 
	}
 

	
 
	_midi.song = mid_song_load(_midi.stream, &_midi.options);
src/music/libtimidity.h
Show inline comments
 
@@ -18,13 +18,13 @@
 
class MusicDriver_LibTimidity : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
src/music/music_driver.hpp
Show inline comments
 
@@ -11,20 +11,22 @@
 

	
 
#ifndef MUSIC_MUSIC_DRIVER_HPP
 
#define MUSIC_MUSIC_DRIVER_HPP
 

	
 
#include "../driver.h"
 

	
 
struct MusicSongInfo;
 

	
 
/** Driver for all music playback. */
 
class MusicDriver : public Driver {
 
public:
 
	/**
 
	 * Play a particular song.
 
	 * @param filename The name of file with the song to play.
 
	 */
 
	virtual void PlaySong(const char *filename) = 0;
 
	virtual void PlaySong(const MusicSongInfo &song) = 0;
 

	
 
	/**
 
	 * Stop playing the current song.
 
	 */
 
	virtual void StopSong() = 0;
 

	
src/music/null_m.h
Show inline comments
 
@@ -18,13 +18,13 @@
 
class MusicDriver_Null : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param) { return NULL; }
 

	
 
	/* virtual */ void Stop() { }
 

	
 
	/* virtual */ void PlaySong(const char *filename) { }
 
	/* virtual */ void PlaySong(const MusicSongInfo &song) { }
 

	
 
	/* virtual */ void StopSong() { }
 

	
 
	/* virtual */ bool IsSongPlaying() { return true; }
 

	
 
	/* virtual */ void SetVolume(byte vol) { }
src/music/os2_m.cpp
Show inline comments
 
@@ -9,12 +9,13 @@
 

	
 
/** @file os2_m.cpp Music playback on OS/2. */
 

	
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "os2_m.h"
 
#include "../base_media_base.h"
 

	
 
#define INCL_DOS
 
#define INCL_OS2MM
 
#define INCL_WIN
 

	
 
#include <stdarg.h>
 
@@ -46,17 +47,19 @@ static long CDECL MidiSendCommand(const 
 
	return mciSendString(buf, NULL, 0, NULL, 0);
 
}
 

	
 
/** OS/2's music player's factory. */
 
static FMusicDriver_OS2 iFMusicDriver_OS2;
 

	
 
void MusicDriver_OS2::PlaySong(const char *filename)
 
void MusicDriver_OS2::PlaySong(const MusicSongInfo &song)
 
{
 
	if (song.filetype != MTT_STANDARDMIDI) return;
 

	
 
	MidiSendCommand("close all");
 

	
 
	if (MidiSendCommand("open %s type sequencer alias song", filename) != 0) {
 
	if (MidiSendCommand("open %s type sequencer alias song", song.filename) != 0) {
 
		return;
 
	}
 

	
 
	MidiSendCommand("play song from 0");
 
}
 

	
src/music/os2_m.h
Show inline comments
 
@@ -18,13 +18,13 @@
 
class MusicDriver_OS2 : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
src/music/qtmidi.cpp
Show inline comments
 
@@ -28,12 +28,13 @@
 

	
 
#ifndef NO_QUICKTIME
 

	
 
#include "../stdafx.h"
 
#include "qtmidi.h"
 
#include "../debug.h"
 
#include "../base_media_base.h"
 

	
 
#define Rect  OTTDRect
 
#define Point OTTDPoint
 
#include <QuickTime/QuickTime.h>
 
#undef Rect
 
#undef Point
 
@@ -255,14 +256,15 @@ void MusicDriver_QtMidi::Stop()
 

	
 
/**
 
 * Starts playing a new song.
 
 *
 
 * @param filename Path to a MIDI file.
 
 */
 
void MusicDriver_QtMidi::PlaySong(const char *filename)
 
void MusicDriver_QtMidi::PlaySong(const MusicSongInfo &song)
 
{
 
	if (song.filetype != MTT_STANDARDMIDI) return;
 
	if (!_quicktime_started) return;
 

	
 
	DEBUG(driver, 2, "qtmidi: trying to play '%s'", filename);
 
	switch (_quicktime_state) {
 
		case QT_STATE_PLAY:
 
			StopSong();
 
@@ -273,13 +275,13 @@ void MusicDriver_QtMidi::PlaySong(const 
 
			DisposeMovie(_quicktime_movie);
 
			DEBUG(driver, 3, "qtmidi: previous tune disposed");
 
			_quicktime_state = QT_STATE_IDLE;
 
			FALLTHROUGH;
 

	
 
		case QT_STATE_IDLE:
 
			LoadMovieForMIDIFile(filename, &_quicktime_movie);
 
			LoadMovieForMIDIFile(song.filename, &_quicktime_movie);
 
			SetMovieVolume(_quicktime_movie, VOLUME);
 
			StartMovie(_quicktime_movie);
 
			_quicktime_state = QT_STATE_PLAY;
 
	}
 
	DEBUG(driver, 3, "qtmidi: playing '%s'", filename);
 
}
src/music/qtmidi.h
Show inline comments
 
@@ -17,13 +17,13 @@
 
class MusicDriver_QtMidi : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
src/music/win32_m.cpp
Show inline comments
 
@@ -15,12 +15,13 @@
 
#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 "../safeguards.h"
 

	
 
struct PlaybackSegment {
 
	uint32 start, end;
 
	size_t start_block;
 
@@ -301,18 +302,20 @@ void CALLBACK TimerCallback(UINT uTimerI
 
		} else {
 
			_midi.do_stop = true;
 
		}
 
	}
 
}
 

	
 
void MusicDriver_Win32::PlaySong(const char *filename)
 
void MusicDriver_Win32::PlaySong(const MusicSongInfo &song)
 
{
 
	if (song.filetype != MTT_STANDARDMIDI) return;
 

	
 
	DEBUG(driver, 2, "Win32-MIDI: PlaySong: entry");
 
	EnterCriticalSection(&_midi.lock);
 

	
 
	_midi.next_file.LoadFile(filename);
 
	_midi.next_file.LoadFile(song.filename);
 
	_midi.next_segment.start = 0;
 
	_midi.next_segment.end = 0;
 
	_midi.next_segment.loop = false;
 

	
 
	DEBUG(driver, 2, "Win32-MIDI: PlaySong: setting flag");
 
	_midi.do_stop = _midi.playing;
src/music/win32_m.h
Show inline comments
 
@@ -18,13 +18,13 @@
 
class MusicDriver_Win32 : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
src/music_gui.cpp
Show inline comments
 
@@ -39,23 +39,23 @@
 
 * Get the name of the song.
 
 * @param index of the song.
 
 * @return the name of the song.
 
 */
 
static const char *GetSongName(int index)
 
{
 
	return BaseMusic::GetUsedSet()->song_name[index];
 
	return BaseMusic::GetUsedSet()->songinfo[index].songname;
 
}
 

	
 
/**
 
 * Get the track number of the song.
 
 * @param index of the song.
 
 * @return the track number of the song.
 
 */
 
static int GetTrackNumber(int index)
 
{
 
	return BaseMusic::GetUsedSet()->track_nr[index];
 
	return BaseMusic::GetUsedSet()->songinfo[index].tracknr;
 
}
 

	
 
/** The currently played song */
 
static byte _music_wnd_cursong = 1;
 
/** Whether a song is currently played */
 
static bool _song_is_active = false;
 
@@ -183,16 +183,18 @@ static void MusicVolumeChanged(byte new_
 
	MusicDriver::GetInstance()->SetVolume(new_vol);
 
}
 

	
 
static void DoPlaySong()
 
{
 
	char filename[MAX_PATH];
 
	if (FioFindFullPath(filename, lastof(filename), BASESET_DIR, BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename) == NULL) {
 
		FioFindFullPath(filename, lastof(filename), OLD_GM_DIR, BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename);
 
	MusicSongInfo songinfo = BaseMusic::GetUsedSet()->songinfo[_music_wnd_cursong - 1]; // copy
 
	if (FioFindFullPath(filename, lastof(filename), BASESET_DIR, songinfo.filename) == NULL) {
 
		FioFindFullPath(filename, lastof(filename), OLD_GM_DIR, songinfo.filename);
 
	}
 
	MusicDriver::GetInstance()->PlaySong(filename);
 
	songinfo.filename = filename; // non-owned pointer
 
	MusicDriver::GetInstance()->PlaySong(songinfo);
 
	SetWindowDirty(WC_MUSIC_WINDOW, 0);
 
}
 

	
 
static void DoStopMusic()
 
{
 
	MusicDriver::GetInstance()->StopSong();
0 comments (0 inline, 0 general)