* 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 cocoa_m.cpp
* @brief MIDI music player for MacOS X using CoreAudio.
if (track_length > _seq_length) _seq_length = track_length;
}
/* Add 8 beats for reverb/long note release */
_seq_length += 8;
DoSetVolume();
MusicPlayerSetSequence(_player, _sequence);
MusicPlayerPreroll(_player);
if (MusicPlayerStart(_player) != noErr) return;
_playing = true;
DEBUG(driver, 3, "cocoa_m: playing '%s'", filename);
}
/**
* Stops playing the current song, if the player is active.
*/
void MusicDriver_Cocoa::StopSong()
{
MusicPlayerStop(_player);
MusicPlayerSetSequence(_player, NULL);
_playing = false;
}
/**
* Changes the playing volume of the MIDI player.
*
* @param vol The desired volume, range of the value is @c 0-127
*/
void MusicDriver_Cocoa::SetVolume(byte vol)
{
_volume = vol;
DoSetVolume();
}
#endif /* WITH_COCOA */
src/music/cocoa_m.h
➞
Show inline comments
new file 100644
/* $Id$ */
/*
* 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 cocoa_m.h Base of music playback via CoreAudio. */