diff options
author | Max Horn | 2009-05-12 23:31:55 +0000 |
---|---|---|
committer | Max Horn | 2009-05-12 23:31:55 +0000 |
commit | 05c3c6ccb3ce41dbe5605073ed54a2290525e179 (patch) | |
tree | 0d34b65732355f975e12423fc7683bb64ae14abf /engines/sci/sfx/player | |
parent | e3d79c58f0e94e03a8176a32ea1355e6dbb2a055 (diff) | |
download | scummvm-rg350-05c3c6ccb3ce41dbe5605073ed54a2290525e179.tar.gz scummvm-rg350-05c3c6ccb3ce41dbe5605073ed54a2290525e179.tar.bz2 scummvm-rg350-05c3c6ccb3ce41dbe5605073ed54a2290525e179.zip |
SCI: Replaced SFX_OK/SFX_ERROR by Common::Error, and got rid of sfx/sfx.h
svn-id: r40517
Diffstat (limited to 'engines/sci/sfx/player')
-rw-r--r-- | engines/sci/sfx/player/player.cpp | 38 | ||||
-rw-r--r-- | engines/sci/sfx/player/polled.cpp | 46 | ||||
-rw-r--r-- | engines/sci/sfx/player/realtime.cpp | 59 |
3 files changed, 70 insertions, 73 deletions
diff --git a/engines/sci/sfx/player/player.cpp b/engines/sci/sfx/player/player.cpp index e2ad9e5213..2336978743 100644 --- a/engines/sci/sfx/player/player.cpp +++ b/engines/sci/sfx/player/player.cpp @@ -112,11 +112,11 @@ static void player_void_callback(void) { /* API implementation */ -static int player_set_option(char *name, char *value) { - return SFX_ERROR; +static Common::Error player_set_option(char *name, char *value) { + return Common::kUnknownError; } -static int player_init(ResourceManager *resmgr, int expected_latency) { +static Common::Error player_init(ResourceManager *resmgr, int expected_latency) { MidiDriverType musicDriver = MidiDriver::detectMusicDriver(MDT_PCSPK | MDT_ADLIB); switch(musicDriver) { @@ -148,10 +148,10 @@ static int player_init(ResourceManager *resmgr, int expected_latency) { mididrv->open(resmgr); mididrv->setVolume(volume); - return SFX_OK; + return Common::kNoError; } -static int player_add_iterator(SongIterator *it, uint32 start_time) { +static Common::Error player_add_iterator(SongIterator *it, uint32 start_time) { mutex->lock(); SIMSG_SEND(it, SIMSG_SET_PLAYMASK(mididrv->getPlayMask())); SIMSG_SEND(it, SIMSG_SET_RHYTHM(mididrv->hasRhythmChannel())); @@ -166,15 +166,15 @@ static int player_add_iterator(SongIterator *it, uint32 start_time) { play_it_done = 0; mutex->unlock(); - return SFX_OK; + return Common::kNoError; } -static int player_fade_out(void) { +static Common::Error player_fade_out(void) { warning("Attempt to fade out - not implemented yet"); - return SFX_ERROR; + return Common::kUnknownError; } -static int player_stop(void) { +static Common::Error player_stop(void) { debug(3, "Player: Stopping song iterator %p", (void *)play_it); mutex->lock(); delete play_it; @@ -183,23 +183,23 @@ static int player_stop(void) { static_cast<MidiDriver *>(mididrv)->send(0xb0 + i, SCI_MIDI_CHANNEL_NOTES_OFF, 0); mutex->unlock(); - return SFX_OK; + return Common::kNoError; } -static int player_send_iterator_message(const SongIterator::Message &msg) { +static Common::Error player_send_iterator_message(const SongIterator::Message &msg) { mutex->lock(); if (!play_it) { mutex->unlock(); - return SFX_ERROR; + return Common::kUnknownError; } songit_handle_message(&play_it, msg); mutex->unlock(); - return SFX_OK; + return Common::kNoError; } -static int player_pause(void) { +static Common::Error player_pause(void) { mutex->lock(); play_paused = 1; play_pause_diff = wakeup_time.msecsDiff(current_time); @@ -207,27 +207,27 @@ static int player_pause(void) { mididrv->playSwitch(false); mutex->unlock(); - return SFX_OK; + return Common::kNoError; } -static int player_resume(void) { +static Common::Error player_resume(void) { mutex->lock(); wakeup_time = Audio::Timestamp(current_time.msecs() + play_pause_diff, SFX_TICKS_PER_SEC); mididrv->playSwitch(true); play_paused = 0; mutex->unlock(); - return SFX_OK; + return Common::kNoError; } -static int player_exit(void) { +static Common::Error player_exit(void) { mididrv->close(); delete mididrv; delete mutex; delete play_it; play_it = NULL; - return SFX_OK; + return Common::kNoError; } sfx_player_t sfx_player_player = { diff --git a/engines/sci/sfx/player/polled.cpp b/engines/sci/sfx/player/polled.cpp index 706e6581b7..27d0f88ffe 100644 --- a/engines/sci/sfx/player/polled.cpp +++ b/engines/sci/sfx/player/polled.cpp @@ -268,13 +268,13 @@ static void pp_timer_callback() { /* Hey, we're polled anyway ;-) */ } -static int pp_set_option(char *name, char *value) { - return SFX_ERROR; +static Common::Error pp_set_option(char *name, char *value) { + return Common::kUnknownError; } -static int pp_init(ResourceManager *resmgr, int expected_latency) { +static Common::Error pp_init(ResourceManager *resmgr, int expected_latency) { if (!g_system->getMixer()->isReady()) - return SFX_ERROR; + return Common::kUnknownError; Resource *res = NULL, *res2 = NULL; @@ -286,7 +286,7 @@ static int pp_init(ResourceManager *resmgr, int expected_latency) { if (!seq) { sciprintf("[sfx:seq:polled] Initialisation failed: Could not find software sequencer\n"); - return SFX_ERROR; + return Common::kUnknownError; } if (seq->patch_nr != SFX_SEQ_PATCHFILE_NONE) { @@ -304,7 +304,7 @@ static int pp_init(ResourceManager *resmgr, int expected_latency) { (res2) ? res2->size : 0)) { sciprintf("[sfx:seq:polled] Initialisation failed: Sequencer '%s', v%s failed to initialise\n", seq->name, seq->version); - return SFX_ERROR; + return Common::kUnknownError; } seq->set_volume(seq, volume); @@ -314,10 +314,10 @@ static int pp_init(ResourceManager *resmgr, int expected_latency) { g_system->getMixer()->playInputStream(Audio::Mixer::kSFXSoundType, 0, newStream); sfx_player_polled.polyphony = seq->polyphony; - return SFX_OK; + return Common::kNoError; } -static int pp_add_iterator(SongIterator *it, uint32 start_time) { +static Common::Error pp_add_iterator(SongIterator *it, uint32 start_time) { SongIterator *old = play_it; SIMSG_SEND(it, SIMSG_SET_PLAYMASK(seq->playmask)); @@ -339,15 +339,15 @@ static int pp_add_iterator(SongIterator *it, uint32 start_time) { new_song = 1; } - return SFX_OK; + return Common::kNoError; } -static int pp_fade_out() { +static Common::Error pp_fade_out() { warning(__FILE__": Attempt to fade out- not implemented yet"); - return SFX_ERROR; + return Common::kUnknownError; } -static int pp_stop() { +static Common::Error pp_stop() { SongIterator *it = play_it; play_it = NULL; @@ -356,28 +356,28 @@ static int pp_stop() { seq->allstop(seq); - return SFX_OK; + return Common::kNoError; } -static int pp_send_iterator_message(const SongIterator::Message &msg) { +static Common::Error pp_send_iterator_message(const SongIterator::Message &msg) { if (!play_it) - return SFX_ERROR; + return Common::kUnknownError; songit_handle_message(&play_it, msg); - return SFX_OK; + return Common::kNoError; } -static int pp_pause() { +static Common::Error pp_pause() { play_paused = 1; seq->set_volume(seq, 0); - return SFX_OK; + return Common::kNoError; } -static int pp_resume() { +static Common::Error pp_resume() { if (!play_it) { play_paused = 0; - return SFX_OK; /* Nothing to resume */ + return Common::kNoError; /* Nothing to resume */ } if (play_paused) @@ -387,15 +387,15 @@ static int pp_resume() { play_paused = 0; seq->set_volume(seq, volume); - return SFX_OK; + return Common::kNoError; } -static int pp_exit() { +static Common::Error pp_exit() { seq->exit(seq); delete play_it; play_it = NULL; - return SFX_OK; + return Common::kNoError; } sfx_player_t sfx_player_polled = { diff --git a/engines/sci/sfx/player/realtime.cpp b/engines/sci/sfx/player/realtime.cpp index 2b6d9a18d0..b279e91908 100644 --- a/engines/sci/sfx/player/realtime.cpp +++ b/engines/sci/sfx/player/realtime.cpp @@ -137,7 +137,7 @@ static Resource *find_patch(ResourceManager *resmgr, const char *seq_name, int p if (patchfile != SFX_SEQ_PATCHFILE_NONE) { res = resmgr->findResource(kResourceTypePatch, patchfile, 0); if (!res) { - fprintf(stderr, "[SFX] " __FILE__": patch.%03d requested by sequencer (%s), but not found\n", + warning("[SFX] " __FILE__": patch.%03d requested by sequencer (%s), but not found", patchfile, seq_name); } } @@ -147,19 +147,19 @@ static Resource *find_patch(ResourceManager *resmgr, const char *seq_name, int p /* API implementation */ -static int rt_set_option(char *name, char *value) { - return SFX_ERROR; +static Common::Error rt_set_option(char *name, char *value) { + return Common::kUnknownError; } -static int rt_init(ResourceManager *resmgr, int expected_latency) { +static Common::Error rt_init(ResourceManager *resmgr, int expected_latency) { Resource *res = NULL, *res2 = NULL; void *seq_dev = NULL; seq = sfx_find_sequencer(NULL); if (!seq) { - fprintf(stderr, "[SFX] " __FILE__": Could not find sequencer\n"); - return SFX_ERROR; + warning("[SFX] " __FILE__": Could not find sequencer"); + return Common::kUnknownError; } sfx_player_realtime.polyphony = seq->polyphony; @@ -175,8 +175,8 @@ static int rt_init(ResourceManager *resmgr, int expected_latency) { res2 ? res2->size : 0, res2 ? res2->data : NULL, seq_dev)) { - fprintf(stderr, "[SFX] " __FILE__": Sequencer failed to initialize\n"); - return SFX_ERROR; + warning("[SFX] " __FILE__": Sequencer failed to initialize"); + return Common::kUnknownError; } play_writeahead = expected_latency; @@ -188,10 +188,10 @@ static int rt_init(ResourceManager *resmgr, int expected_latency) { if (seq->reset_timer) seq->reset_timer(0); - return SFX_OK; + return Common::kNoError; } -static int rt_add_iterator(SongIterator *it, uint32 start_time) { +static Common::Error rt_add_iterator(SongIterator *it, uint32 start_time) { if (seq->reset_timer) /* Restart timer counting if possible */ seq->reset_timer(start_time); @@ -203,15 +203,15 @@ static int rt_add_iterator(SongIterator *it, uint32 start_time) { play_it_done = 0; play_moredelay = 0; - return SFX_OK; + return Common::kNoError; } -static int rt_fade_out(void) { - fprintf(stderr, __FILE__": Attempt to fade out- not implemented yet\n"); - return SFX_ERROR; +static Common::Error rt_fade_out(void) { + warning(__FILE__": Attempt to fade out- not implemented yet"); + return Common::kUnknownError; } -static int rt_stop(void) { +static Common::Error rt_stop(void) { SongIterator *it = play_it; play_it = NULL; @@ -220,45 +220,42 @@ static int rt_stop(void) { if (seq && seq->allstop) seq->allstop(); - return SFX_OK; + return Common::kNoError; } -static int rt_send_iterator_message(const SongIterator::Message &msg) { +static Common::Error rt_send_iterator_message(const SongIterator::Message &msg) { if (!play_it) - return SFX_ERROR; + return Common::kUnknownError; songit_handle_message(&play_it, msg); - return SFX_OK; + return Common::kNoError; } -static int rt_pause(void) { +static Common::Error rt_pause(void) { play_pause_started = g_system->getMillis(); - /* Also, indicate that we haven't modified the time counter - ** yet */ + // Also, indicate that we haven't modified the time counter yet play_pause_counter = play_pause_started; play_paused = 1; if (!seq->allstop) { sciprintf("[SFX] Cannot suspend sequencer, sound will continue for a bit\n"); - return SFX_OK; + return Common::kNoError; } else return seq->allstop(); } -static int rt_resume(void) { +static Common::Error rt_resume(void) { play_paused = 0; - return SFX_OK; + return Common::kNoError; } -static int rt_exit(void) { - int retval = SFX_OK; - +static Common::Error rt_exit(void) { if (seq->close()) { - fprintf(stderr, "[SFX] Sequencer reported error on close\n"); - retval = SFX_ERROR; + warning("[SFX] Sequencer reported error on close"); + return Common::kUnknownError; } - return retval; + return Common::kNoError; } sfx_player_t sfx_player_realtime = { |