src/music/bemidi.cpp
author bjarni
Mon, 05 Feb 2007 21:16:56 +0000
changeset 6192 c6adfc929c6b
parent 5726 8f399788f6c9
child 6298 c30fe89622df
permissions -rw-r--r--
(svn r8605) -Codechange: [OSX] changed all objective C to objective C++
This will permanently solve the issue where compilation on OSX broke because C++ code was added to some header files

-Note: (important if you develop mac specific code)
taken from http://developer.apple.com/releasenotes/Cocoa/Objective-C++.html
gdb lacks an integrated C++ with Objective-C parser. This means that gdb won't be able to evaluate expressions that contain both C++ and Objective-C constructs.
gdb assumes that the language for ".mm" files is C++.
you can change it to objective C by typing: (gdb) set language objc
Mixing C++ and objective C has some limitation (see link for all of them)
/* $Id$ */

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

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

static BMidiSynthFile midiSynthFile;

static const char *bemidi_start(const char * const *parm)
{
	return NULL;
}

static void bemidi_stop(void)
{
	midiSynthFile.UnloadFile();
}

static void bemidi_play_song(const char *filename)
{
	bemidi_stop();
	entry_ref midiRef;
	get_ref_for_path(filename, &midiRef);
	midiSynthFile.LoadFile(&midiRef);
	midiSynthFile.Start();
}

static void bemidi_stop_song(void)
{
	midiSynthFile.UnloadFile();
}

static bool bemidi_is_playing(void)
{
	return !midiSynthFile.IsFinished();
}

static void bemidi_set_volume(byte vol)
{
	fprintf(stderr, "BeMidi: Set volume not implemented\n");
}

const HalMusicDriver _bemidi_music_driver = {
	bemidi_start,
	bemidi_stop,
	bemidi_play_song,
	bemidi_stop_song,
	bemidi_is_playing,
	bemidi_set_volume,
};