diff options
Diffstat (limited to 'src/music')
-rw-r--r-- | src/music/allegro_m.cpp | 16 | ||||
-rw-r--r-- | src/music/bemidi.cpp | 2 | ||||
-rw-r--r-- | src/music/cocoa_m.cpp | 28 | ||||
-rw-r--r-- | src/music/dmusic.cpp | 58 | ||||
-rw-r--r-- | src/music/extmidi.cpp | 12 | ||||
-rw-r--r-- | src/music/fluidsynth.cpp | 14 | ||||
-rw-r--r-- | src/music/midifile.cpp | 14 | ||||
-rw-r--r-- | src/music/null_m.h | 2 | ||||
-rw-r--r-- | src/music/os2_m.cpp | 4 | ||||
-rw-r--r-- | src/music/qtmidi.cpp | 18 | ||||
-rw-r--r-- | src/music/win32_m.cpp | 2 |
11 files changed, 85 insertions, 85 deletions
diff --git a/src/music/allegro_m.cpp b/src/music/allegro_m.cpp index 906aec84f..959f15611 100644 --- a/src/music/allegro_m.cpp +++ b/src/music/allegro_m.cpp @@ -20,7 +20,7 @@ #include "../safeguards.h" static FMusicDriver_Allegro iFMusicDriver_Allegro; -static MIDI *_midi = NULL; +static MIDI *_midi = nullptr; /** * There are multiple modules that might be using Allegro and @@ -30,14 +30,14 @@ extern int _allegro_instance_count; const char *MusicDriver_Allegro::Start(const char * const *param) { - if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) { + if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) { DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error); return "Failed to set up Allegro"; } _allegro_instance_count++; /* Initialise the sound */ - if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL) != 0) { + if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, nullptr) != 0) { DEBUG(driver, 0, "allegro: install_sound failed '%s'", allegro_error); return "Failed to set up Allegro sound"; } @@ -48,13 +48,13 @@ const char *MusicDriver_Allegro::Start(const char * const *param) return "No sound card found"; } - return NULL; + return nullptr; } void MusicDriver_Allegro::Stop() { - if (_midi != NULL) destroy_midi(_midi); - _midi = NULL; + if (_midi != nullptr) destroy_midi(_midi); + _midi = nullptr; if (--_allegro_instance_count == 0) allegro_exit(); } @@ -63,12 +63,12 @@ void MusicDriver_Allegro::PlaySong(const MusicSongInfo &song) { std::string filename = MidiFile::GetSMFFile(song); - if (_midi != NULL) destroy_midi(_midi); + if (_midi != nullptr) destroy_midi(_midi); if (!filename.empty()) { _midi = load_midi(filename.c_str()); play_midi(_midi, false); } else { - _midi = NULL; + _midi = nullptr; } } diff --git a/src/music/bemidi.cpp b/src/music/bemidi.cpp index ff56d787f..090ac0f90 100644 --- a/src/music/bemidi.cpp +++ b/src/music/bemidi.cpp @@ -28,7 +28,7 @@ static FMusicDriver_BeMidi iFMusicDriver_BeMidi; const char *MusicDriver_BeMidi::Start(const char * const *parm) { - return NULL; + return nullptr; } void MusicDriver_BeMidi::Stop() diff --git a/src/music/cocoa_m.cpp b/src/music/cocoa_m.cpp index 2416cade0..c27a0a092 100644 --- a/src/music/cocoa_m.cpp +++ b/src/music/cocoa_m.cpp @@ -35,8 +35,8 @@ static FMusicDriver_Cocoa iFMusicDriver_Cocoa; -static MusicPlayer _player = NULL; -static MusicSequence _sequence = NULL; +static MusicPlayer _player = nullptr; +static MusicSequence _sequence = nullptr; static MusicTimeStamp _seq_length = 0; static bool _playing = false; static byte _volume = 127; @@ -45,12 +45,12 @@ static byte _volume = 127; /** Set the volume of the current sequence. */ static void DoSetVolume() { - if (_sequence == NULL) return; + if (_sequence == nullptr) return; AUGraph graph; MusicSequenceGetAUGraph(_sequence, &graph); - AudioUnit output_unit = NULL; + AudioUnit output_unit = nullptr; /* Get output audio unit */ UInt32 node_count = 0; @@ -82,7 +82,7 @@ static void DoSetVolume() { #if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) ComponentDescription desc; - AUGraphGetNodeInfo(graph, node, &desc, NULL, NULL, &unit); + AUGraphGetNodeInfo(graph, node, &desc, nullptr, nullptr, &unit); comp_type = desc.componentType; #endif } @@ -92,7 +92,7 @@ static void DoSetVolume() break; } } - if (output_unit == NULL) { + if (output_unit == nullptr) { DEBUG(driver, 1, "cocoa_m: Failed to get output node to set volume"); return; } @@ -109,7 +109,7 @@ const char *MusicDriver_Cocoa::Start(const char * const *parm) { if (NewMusicPlayer(&_player) != noErr) return "failed to create music player"; - return NULL; + return nullptr; } @@ -131,8 +131,8 @@ bool MusicDriver_Cocoa::IsSongPlaying() */ void MusicDriver_Cocoa::Stop() { - if (_player != NULL) DisposeMusicPlayer(_player); - if (_sequence != NULL) DisposeMusicSequence(_sequence); + if (_player != nullptr) DisposeMusicPlayer(_player); + if (_sequence != nullptr) DisposeMusicSequence(_sequence); } @@ -148,9 +148,9 @@ void MusicDriver_Cocoa::PlaySong(const MusicSongInfo &song) DEBUG(driver, 2, "cocoa_m: trying to play '%s'", filename.c_str()); this->StopSong(); - if (_sequence != NULL) { + if (_sequence != nullptr) { DisposeMusicSequence(_sequence); - _sequence = NULL; + _sequence = nullptr; } if (filename.empty()) return; @@ -190,7 +190,7 @@ void MusicDriver_Cocoa::PlaySong(const MusicSongInfo &song) CFRelease(url); /* Construct audio graph */ - AUGraph graph = NULL; + AUGraph graph = nullptr; MusicSequenceGetAUGraph(_sequence, &graph); AUGraphOpen(graph); @@ -204,7 +204,7 @@ void MusicDriver_Cocoa::PlaySong(const MusicSongInfo &song) MusicSequenceGetTrackCount(_sequence, &num_tracks); _seq_length = 0; for (UInt32 i = 0; i < num_tracks; i++) { - MusicTrack track = NULL; + MusicTrack track = nullptr; MusicTimeStamp track_length = 0; UInt32 prop_size = sizeof(MusicTimeStamp); MusicSequenceGetIndTrack(_sequence, i, &track); @@ -230,7 +230,7 @@ void MusicDriver_Cocoa::PlaySong(const MusicSongInfo &song) void MusicDriver_Cocoa::StopSong() { MusicPlayerStop(_player); - MusicPlayerSetSequence(_player, NULL); + MusicPlayerSetSequence(_player, nullptr); _playing = false; } diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index bf8657ef4..41ccd6102 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -141,16 +141,16 @@ static struct { /** Handle to our worker thread. */ static std::thread _dmusic_thread; /** Event to signal the thread that it should look at a state change. */ -static HANDLE _thread_event = NULL; +static HANDLE _thread_event = nullptr; /** Lock access to playback data that is not thread-safe. */ static std::mutex _thread_mutex; /** The direct music object manages buffers and ports. */ -static IDirectMusic *_music = NULL; +static IDirectMusic *_music = nullptr; /** The port object lets us send MIDI data to the synthesizer. */ -static IDirectMusicPort *_port = NULL; +static IDirectMusicPort *_port = nullptr; /** The buffer object collects the data to sent. */ -static IDirectMusicBuffer *_buffer = NULL; +static IDirectMusicBuffer *_buffer = nullptr; /** List of downloaded DLS instruments. */ static std::vector<IDirectMusicDownload *> _dls_downloads; @@ -438,7 +438,7 @@ bool DLSFile::LoadFile(const TCHAR *file) DEBUG(driver, 2, "DMusic: Try to load DLS file %s", FS2OTTD(file)); FILE *f = _tfopen(file, _T("rb")); - if (f == NULL) return false; + if (f == nullptr) return false; FileCloser f_scope(f); @@ -879,13 +879,13 @@ static const char *LoadDefaultDLSFile(const char *user_dls) if ((caps.dwFlags & (DMUS_PC_DLS | DMUS_PC_DLS2)) != 0 && (caps.dwFlags & DMUS_PC_GMINHARDWARE) == 0) { DLSFile dls_file; - if (user_dls == NULL) { + if (user_dls == nullptr) { /* Try loading the default GM DLS file stored in the registry. */ HKEY hkDM; if (SUCCEEDED(RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\DirectMusic"), 0, KEY_READ, &hkDM))) { TCHAR dls_path[MAX_PATH]; DWORD buf_size = sizeof(dls_path); // Buffer size as to be given in bytes! - if (SUCCEEDED(RegQueryValueEx(hkDM, _T("GMFilePath"), NULL, NULL, (LPBYTE)dls_path, &buf_size))) { + if (SUCCEEDED(RegQueryValueEx(hkDM, _T("GMFilePath"), nullptr, nullptr, (LPBYTE)dls_path, &buf_size))) { TCHAR expand_path[MAX_PATH * 2]; ExpandEnvironmentStrings(dls_path, expand_path, lengthof(expand_path)); if (!dls_file.LoadFile(expand_path)) DEBUG(driver, 1, "Failed to load default GM DLS file from registry"); @@ -906,7 +906,7 @@ static const char *LoadDefaultDLSFile(const char *user_dls) } /* Get download port and allocate download IDs. */ - IDirectMusicPortDownload *download_port = NULL; + IDirectMusicPortDownload *download_port = nullptr; if (FAILED(_port->QueryInterface(IID_IDirectMusicPortDownload, (LPVOID *)&download_port))) return "Can't get download port"; DWORD dlid_wave = 0, dlid_inst = 0; @@ -920,7 +920,7 @@ static const char *LoadDefaultDLSFile(const char *user_dls) /* Download wave data. */ for (DWORD i = 0; i < dls_file.waves.size(); i++) { - IDirectMusicDownload *dl_wave = NULL; + IDirectMusicDownload *dl_wave = nullptr; if (FAILED(download_port->AllocateBuffer((DWORD)(sizeof(WAVE_DOWNLOAD) + dwAppend * dls_file.waves[i].fmt.wf.nBlockAlign + dls_file.waves[i].data.size()), &dl_wave))) { download_port->Release(); return "Can't allocate wave download buffer"; @@ -984,7 +984,7 @@ static const char *LoadDefaultDLSFile(const char *user_dls) i_size += offsets * sizeof(ULONG); /* Allocate download buffer. */ - IDirectMusicDownload *dl_inst = NULL; + IDirectMusicDownload *dl_inst = nullptr; if (FAILED(download_port->AllocateBuffer((DWORD)i_size, &dl_inst))) { download_port->Release(); return "Can't allocate instrument download buffer"; @@ -1085,19 +1085,19 @@ static const char *LoadDefaultDLSFile(const char *user_dls) download_port->Release(); } - return NULL; + return nullptr; } const char *MusicDriver_DMusic::Start(const char * const *parm) { /* Initialize COM */ - if (FAILED(CoInitializeEx(NULL, COINITBASE_MULTITHREADED))) return "COM initialization failed"; + if (FAILED(CoInitializeEx(nullptr, COINITBASE_MULTITHREADED))) return "COM initialization failed"; /* Create the DirectMusic object */ if (FAILED(CoCreateInstance( CLSID_DirectMusic, - NULL, + nullptr, CLSCTX_INPROC, IID_IDirectMusic, (LPVOID*)&_music @@ -1106,7 +1106,7 @@ const char *MusicDriver_DMusic::Start(const char * const *parm) } /* Assign sound output device. */ - if (FAILED(_music->SetDirectSound(NULL, NULL))) return "Can't set DirectSound interface"; + if (FAILED(_music->SetDirectSound(nullptr, nullptr))) return "Can't set DirectSound interface"; /* MIDI events need to be send to the synth in time before their playback time * has come. By default, we try send any events at least 50 ms before playback. */ @@ -1149,7 +1149,7 @@ const char *MusicDriver_DMusic::Start(const char * const *parm) params.dwSize = sizeof(DMUS_PORTPARAMS); params.dwValidParams = DMUS_PORTPARAMS_CHANNELGROUPS; params.dwChannelGroups = 1; - if (FAILED(_music->CreatePort(guidPort, ¶ms, &_port, NULL))) return "Failed to create port"; + if (FAILED(_music->CreatePort(guidPort, ¶ms, &_port, nullptr))) return "Failed to create port"; /* Activate port. */ if (FAILED(_port->Activate(TRUE))) return "Failed to activate port"; @@ -1159,19 +1159,19 @@ const char *MusicDriver_DMusic::Start(const char * const *parm) desc.dwSize = sizeof(DMUS_BUFFERDESC); desc.guidBufferFormat = KSDATAFORMAT_SUBTYPE_DIRECTMUSIC; desc.cbBuffer = 1024; - if (FAILED(_music->CreateMusicBuffer(&desc, &_buffer, NULL))) return "Failed to create music buffer"; + if (FAILED(_music->CreateMusicBuffer(&desc, &_buffer, nullptr))) return "Failed to create music buffer"; /* On soft-synths (e.g. the default DirectMusic one), we might need to load a wavetable set to get music. */ const char *dls = LoadDefaultDLSFile(GetDriverParam(parm, "dls")); - if (dls != NULL) return dls; + if (dls != nullptr) return dls; /* Create playback thread and synchronization primitives. */ - _thread_event = CreateEvent(NULL, FALSE, FALSE, NULL); - if (_thread_event == NULL) return "Can't create thread shutdown event"; + _thread_event = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (_thread_event == nullptr) return "Can't create thread shutdown event"; if (!StartNewThread(&_dmusic_thread, "ottd:dmusic", &MidiThreadProc)) return "Can't create MIDI output thread"; - return NULL; + return nullptr; } @@ -1191,34 +1191,34 @@ void MusicDriver_DMusic::Stop() /* Unloaded any instruments we loaded. */ if (_dls_downloads.size() > 0) { - IDirectMusicPortDownload *download_port = NULL; + IDirectMusicPortDownload *download_port = nullptr; _port->QueryInterface(IID_IDirectMusicPortDownload, (LPVOID *)&download_port); /* Instruments refer to waves. As the waves are at the beginning of the download list, * do the unload from the back so that references are cleared properly. */ - for (std::vector<IDirectMusicDownload *>::reverse_iterator i = _dls_downloads.rbegin(); download_port != NULL && i != _dls_downloads.rend(); i++) { + for (std::vector<IDirectMusicDownload *>::reverse_iterator i = _dls_downloads.rbegin(); download_port != nullptr && i != _dls_downloads.rend(); i++) { download_port->Unload(*i); (*i)->Release(); } _dls_downloads.clear(); - if (download_port != NULL) download_port->Release(); + if (download_port != nullptr) download_port->Release(); } - if (_buffer != NULL) { + if (_buffer != nullptr) { _buffer->Release(); - _buffer = NULL; + _buffer = nullptr; } - if (_port != NULL) { + if (_port != nullptr) { _port->Activate(FALSE); _port->Release(); - _port = NULL; + _port = nullptr; } - if (_music != NULL) { + if (_music != nullptr) { _music->Release(); - _music = NULL; + _music = nullptr; } CloseHandle(_thread_event); diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp index f7fc454df..b390c42f5 100644 --- a/src/music/extmidi.cpp +++ b/src/music/extmidi.cpp @@ -52,7 +52,7 @@ const char *MusicDriver_ExtMidi::Start(const char * const * parm) if (StrEmpty(command)) command = EXTERNAL_PLAYER " " MIDI_ARG; #endif - /* Count number of arguments, but include 3 extra slots: 1st for command, 2nd for song title, and 3rd for terminating NULL. */ + /* Count number of arguments, but include 3 extra slots: 1st for command, 2nd for song title, and 3rd for terminating nullptr. */ uint num_args = 3; for (const char *t = command; *t != '\0'; t++) if (*t == ' ') num_args++; @@ -63,7 +63,7 @@ const char *MusicDriver_ExtMidi::Start(const char * const * parm) uint p = 1; while (true) { this->params[p] = strchr(this->params[p - 1], ' '); - if (this->params[p] == NULL) break; + if (this->params[p] == nullptr) break; this->params[p][0] = '\0'; this->params[p]++; @@ -75,7 +75,7 @@ const char *MusicDriver_ExtMidi::Start(const char * const * parm) this->song[0] = '\0'; this->pid = -1; - return NULL; + return nullptr; } void MusicDriver_ExtMidi::Stop() @@ -103,7 +103,7 @@ void MusicDriver_ExtMidi::StopSong() bool MusicDriver_ExtMidi::IsSongPlaying() { - if (this->pid != -1 && waitpid(this->pid, NULL, WNOHANG) == this->pid) { + if (this->pid != -1 && waitpid(this->pid, nullptr, WNOHANG) == this->pid) { this->pid = -1; } if (this->pid == -1 && this->song[0] != '\0') this->DoPlay(); @@ -146,7 +146,7 @@ void MusicDriver_ExtMidi::DoStop() * 5 seconds = 5000 milliseconds, 10 ms per cycle => 500 cycles. */ for (int i = 0; i < 500; i++) { kill(this->pid, SIGTERM); - if (waitpid(this->pid, NULL, WNOHANG) == this->pid) { + if (waitpid(this->pid, nullptr, WNOHANG) == this->pid) { /* It has shut down, so we are done */ this->pid = -1; return; @@ -159,6 +159,6 @@ void MusicDriver_ExtMidi::DoStop() /* Gracefully stopping failed. Do it the hard way * and wait till the process finally died. */ kill(this->pid, SIGKILL); - waitpid(this->pid, NULL, 0); + waitpid(this->pid, nullptr, 0); this->pid = -1; } diff --git a/src/music/fluidsynth.cpp b/src/music/fluidsynth.cpp index 49e50eb9e..4623716a4 100644 --- a/src/music/fluidsynth.cpp +++ b/src/music/fluidsynth.cpp @@ -39,7 +39,7 @@ static const char *default_sf[] = { "/usr/share/sounds/sf2/TimGM6mb.sf2", "/usr/share/sounds/sf2/FluidR3_GS.sf2", - NULL + nullptr }; static void RenderMusicStream(int16 *buffer, size_t samples) @@ -81,18 +81,18 @@ const char *MusicDriver_FluidSynth::Start(const char * const *param) if (sfont_id == FLUID_FAILED) return "Could not open sound font"; } - _midi.player = NULL; + _midi.player = nullptr; uint32 samplerate = MxSetMusicSource(RenderMusicStream); fluid_synth_set_sample_rate(_midi.synth, samplerate); DEBUG(driver, 1, "Fluidsynth: samplerate %.0f", (float)samplerate); - return NULL; + return nullptr; } void MusicDriver_FluidSynth::Stop() { - MxSetMusicSource(NULL); + MxSetMusicSource(nullptr); this->StopSong(); delete_fluid_synth(_midi.synth); delete_fluid_settings(_midi.settings); @@ -117,13 +117,13 @@ void MusicDriver_FluidSynth::PlaySong(const MusicSongInfo &song) if (fluid_player_add(_midi.player, filename.c_str()) != FLUID_OK) { DEBUG(driver, 0, "Could not open music file"); delete_fluid_player(_midi.player); - _midi.player = NULL; + _midi.player = nullptr; return; } if (fluid_player_play(_midi.player) != FLUID_OK) { DEBUG(driver, 0, "Could not start midi player"); delete_fluid_player(_midi.player); - _midi.player = NULL; + _midi.player = nullptr; return; } } @@ -138,7 +138,7 @@ void MusicDriver_FluidSynth::StopSong() } delete_fluid_player(_midi.player); fluid_synth_system_reset(_midi.synth); - _midi.player = NULL; + _midi.player = nullptr; } bool MusicDriver_FluidSynth::IsSongPlaying() diff --git a/src/music/midifile.cpp b/src/music/midifile.cpp index 97fb2edf8..3717ad5d3 100644 --- a/src/music/midifile.cpp +++ b/src/music/midifile.cpp @@ -24,7 +24,7 @@ /* SMF reader based on description at: http://www.somascape.org/midi/tech/mfile.html */ -static MidiFile *_midifile_instance = NULL; +static MidiFile *_midifile_instance = nullptr; /** * Owning byte buffer readable as a stream. @@ -426,7 +426,7 @@ bool MidiFile::LoadFile(const char *filename) bool success = false; FILE *file = FioFOpenFile(filename, "rb", Subdirectory::BASESET_DIR); - if (file == NULL) return false; + if (file == nullptr) return false; SMFHeader header; if (!ReadSMFHeader(file, header)) goto cleanup; @@ -815,7 +815,7 @@ bool MidiFile::LoadSong(const MusicSongInfo &song) { size_t songdatalen = 0; byte *songdata = GetMusicCatEntryData(song.filename, song.cat_index, songdatalen); - if (songdata != NULL) { + if (songdata != nullptr) { bool result = this->LoadMpsData(songdata, songdatalen); free(songdata); return result; @@ -1024,7 +1024,7 @@ std::string MidiFile::GetSMFFile(const MusicSongInfo &song) char basename[MAX_PATH]; { const char *fnstart = strrchr(song.filename, PATHSEPCHAR); - if (fnstart == NULL) { + if (fnstart == nullptr) { fnstart = song.filename; } else { fnstart++; @@ -1054,7 +1054,7 @@ std::string MidiFile::GetSMFFile(const MusicSongInfo &song) byte *data; size_t datalen; data = GetMusicCatEntryData(song.filename, song.cat_index, datalen); - if (data == NULL) return std::string(); + if (data == nullptr) return std::string(); MidiFile midifile; if (!midifile.LoadMpsData(data, datalen)) { @@ -1082,7 +1082,7 @@ static bool CmdDumpSMF(byte argc, char *argv[]) return false; } - if (_midifile_instance == NULL) { + if (_midifile_instance == nullptr) { IConsolePrint(CC_ERROR, "There is no MIDI file loaded currently, make sure music is playing, and you're using a driver that works with raw MIDI."); return false; } @@ -1120,7 +1120,7 @@ MidiFile::MidiFile() MidiFile::~MidiFile() { if (_midifile_instance == this) { - _midifile_instance = NULL; + _midifile_instance = nullptr; } } diff --git a/src/music/null_m.h b/src/music/null_m.h index 837eeb092..8eb7d6792 100644 --- a/src/music/null_m.h +++ b/src/music/null_m.h @@ -17,7 +17,7 @@ /** The music player that does nothing. */ class MusicDriver_Null : public MusicDriver { public: - const char *Start(const char * const *param) override { return NULL; } + const char *Start(const char * const *param) override { return nullptr; } void Stop() override { } diff --git a/src/music/os2_m.cpp b/src/music/os2_m.cpp index 1689f00a6..92e177f84 100644 --- a/src/music/os2_m.cpp +++ b/src/music/os2_m.cpp @@ -45,7 +45,7 @@ static long CDECL MidiSendCommand(const char *cmd, ...) va_start(va, cmd); vseprintf(buf, lastof(buf), cmd, va); va_end(va); - return mciSendString(buf, NULL, 0, NULL, 0); + return mciSendString(buf, nullptr, 0, nullptr, 0); } /** OS/2's music player's factory. */ @@ -78,7 +78,7 @@ void MusicDriver_OS2::SetVolume(byte vol) bool MusicDriver_OS2::IsSongPlaying() { char buf[16]; - mciSendString("status song mode", buf, sizeof(buf), NULL, 0); + mciSendString("status song mode", buf, sizeof(buf), nullptr, 0); return strcmp(buf, "playing") == 0 || strcmp(buf, "seeking") == 0; } diff --git a/src/music/qtmidi.cpp b/src/music/qtmidi.cpp index f8ab150e7..f8412a2dc 100644 --- a/src/music/qtmidi.cpp +++ b/src/music/qtmidi.cpp @@ -60,7 +60,7 @@ static void SetMIDITypeIfNeeded(const FSRef *ref) assert(ref); - if (noErr != FSGetCatalogInfo(ref, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo, &catalogInfo, NULL, NULL, NULL)) return; + if (noErr != FSGetCatalogInfo(ref, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo, &catalogInfo, nullptr, nullptr, nullptr)) return; if (!(catalogInfo.nodeFlags & kFSNodeIsDirectoryMask)) { FileInfo * const info = (FileInfo *) catalogInfo.finderInfo; if (info->fileType != MIDI_TYPE && !(info->finderFlags & kIsAlias)) { @@ -94,8 +94,8 @@ static bool LoadMovieForMIDIFile(const char *path, Movie *moov) short refnum = 0; short resid = 0; - assert(path != NULL); - assert(moov != NULL); + assert(path != nullptr); + assert(moov != nullptr); DEBUG(driver, 2, "qtmidi: start loading '%s'...", path); @@ -116,15 +116,15 @@ static bool LoadMovieForMIDIFile(const char *path, Movie *moov) return false; } - if (noErr != FSPathMakeRef((const UInt8 *) path, &fsref, NULL)) return false; + if (noErr != FSPathMakeRef((const UInt8 *) path, &fsref, nullptr)) return false; SetMIDITypeIfNeeded(&fsref); - if (noErr != FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, NULL, &fsspec, NULL)) return false; + if (noErr != FSGetCatalogInfo(&fsref, kFSCatInfoNone, nullptr, nullptr, &fsspec, nullptr)) return false; if (OpenMovieFile(&fsspec, &refnum, fsRdPerm) != noErr) return false; DEBUG(driver, 3, "qtmidi: '%s' successfully opened", path); - if (noErr != NewMovieFromFile(moov, refnum, &resid, NULL, - newMovieActive | newMovieDontAskUnresolvedDataRefs, NULL)) { + if (noErr != NewMovieFromFile(moov, refnum, &resid, nullptr, + newMovieActive | newMovieDontAskUnresolvedDataRefs, nullptr)) { CloseMovieFile(refnum); return false; } @@ -191,7 +191,7 @@ static int _quicktime_state = QT_STATE_IDLE; ///< Current player state. const char *MusicDriver_QtMidi::Start(const char * const *parm) { InitQuickTimeIfNeeded(); - return (_quicktime_started) ? NULL : "can't initialize QuickTime"; + return (_quicktime_started) ? nullptr : "can't initialize QuickTime"; } @@ -215,7 +215,7 @@ bool MusicDriver_QtMidi::IsSongPlaying() MoviesTask(_quicktime_movie, 0); /* Check wether movie ended. */ if (IsMovieDone(_quicktime_movie) || - (GetMovieTime(_quicktime_movie, NULL) >= + (GetMovieTime(_quicktime_movie, nullptr) >= GetMovieDuration(_quicktime_movie))) { _quicktime_state = QT_STATE_STOP; } diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp index bdba202f2..de5facd48 100644 --- a/src/music/win32_m.cpp +++ b/src/music/win32_m.cpp @@ -396,7 +396,7 @@ const char *MusicDriver_Win32::Start(const char * const *parm) if (timeBeginPeriod(_midi.time_period) == MMSYSERR_NOERROR) { /* success */ DEBUG(driver, 2, "Win32-MIDI: Start: timer resolution is %d", (int)_midi.time_period); - return NULL; + return nullptr; } } midiOutClose(_midi.midi_out); |