src/music/dmusic.cpp
branchgamebalance
changeset 9909 dce9a6923bb7
parent 9895 7bd07f43b0e3
child 6720 35756db7e577
--- a/src/music/dmusic.cpp	Tue Jun 12 11:56:35 2007 +0000
+++ b/src/music/dmusic.cpp	Wed Jun 13 11:00:24 2007 +0000
@@ -1,5 +1,7 @@
 /* $Id$ */
 
+/** @file dmusic.cpp */
+
 #ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT
 
 #include "../stdafx.h"
@@ -14,13 +16,13 @@
 #include <dmusicf.h>
 
 
-// the performance object controls manipulation of the segments
+/** the performance object controls manipulation of the segments */
 static IDirectMusicPerformance* performance = NULL;
 
-// the loader object can load many types of DMusic related files
+/** the loader object can load many types of DMusic related files */
 static IDirectMusicLoader* loader = NULL;
 
-// the segment object is where the MIDI data is stored for playback
+/** the segment object is where the MIDI data is stored for playback */
 static IDirectMusicSegment* segment = NULL;
 
 static bool seeking = false;
@@ -54,12 +56,12 @@
 			return "ole32.dll load failed";
 	}
 
-	// Initialize COM
+	/* Initialize COM */
 	if (FAILED(proc.CoInitialize(NULL))) {
 		return "COM initialization failed";
 	}
 
-	// create the performance object
+	/* create the performance object */
 	if (FAILED(proc.CoCreateInstance(
 				CLSID_DirectMusicPerformance,
 				NULL,
@@ -71,7 +73,7 @@
 		return "Failed to create the performance object";
 	}
 
-	// initialize it
+	/* initialize it */
 	if (FAILED(performance->Init(NULL, NULL, NULL))) {
 		performance->Release();
 		performance = NULL;
@@ -79,7 +81,7 @@
 		return "Failed to initialize performance object";
 	}
 
-	// choose default Windows synth
+	/* choose default Windows synth */
 	if (FAILED(performance->AddPort(NULL))) {
 		performance->CloseDown();
 		performance->Release();
@@ -88,7 +90,7 @@
 		return "AddPort failed";
 	}
 
-	// create the loader object; this will be used to load the MIDI file
+	/* create the loader object; this will be used to load the MIDI file */
 	if (FAILED(proc.CoCreateInstance(
 				CLSID_DirectMusicLoader,
 				NULL,
@@ -136,7 +138,7 @@
 
 static void DMusicMidiPlaySong(const char* filename)
 {
-	// set up the loader object info
+	/* set up the loader object info */
 	DMUS_OBJECTDESC obj_desc;
 	ZeroMemory(&obj_desc, sizeof(obj_desc));
 	obj_desc.dwSize = sizeof(obj_desc);
@@ -148,13 +150,13 @@
 		obj_desc.wszFileName, lengthof(obj_desc.wszFileName)
 	);
 
-	// release the existing segment if we have any
+	/* release the existing segment if we have any */
 	if (segment != NULL) {
 		segment->Release();
 		segment = NULL;
 	}
 
-	// make a new segment
+	/* make a new segment */
 	if (FAILED(loader->GetObject(
 				&obj_desc, IID_IDirectMusicSegment, (LPVOID*)&segment
 			))) {
@@ -162,7 +164,7 @@
 		return;
 	}
 
-	// tell the segment what kind of data it contains
+	/* tell the segment what kind of data it contains */
 	if (FAILED(segment->SetParam(
 				GUID_StandardMIDIFile, 0xFFFFFFFF, 0, 0, performance
 			))) {
@@ -170,13 +172,13 @@
 		return;
 	}
 
-	// tell the segment to 'download' the instruments
+	/* tell the segment to 'download' the instruments */
 	if (FAILED(segment->SetParam(GUID_Download, 0xFFFFFFFF, 0, 0, performance))) {
 		DEBUG(driver, 0, "DirectMusic: failed to download instruments");
 		return;
 	}
 
-	// start playing the MIDI file
+	/* start playing the MIDI file */
 	if (FAILED(performance->PlaySegment(segment, 0, 0, NULL))) {
 		DEBUG(driver, 0, "DirectMusic: PlaySegment failed");
 		return;
@@ -210,8 +212,7 @@
 
 static void DMusicMidiSetVolume(byte vol)
 {
-	// 0 - 127 -> -2000 - 0
-	long db = vol * 2000 / 127 - 2000;
+	long db = vol * 2000 / 127 - 2000; ///< 0 - 127 -> -2000 - 0
 	performance->SetGlobalParam(GUID_PerfMasterVolume, &db, sizeof(db));
 }