forked from len0rd/rockbox
SDL: Silence a large number of compile warnings (WIP)
There are some real bugs in here, but we're drowning in warnings. Change-Id: I7c2c0eafc8426327521bdd8a3ac2d3742ac16864
This commit is contained in:
parent
2ad6c3438e
commit
e28d1fe916
44 changed files with 424 additions and 395 deletions
|
@ -62,5 +62,5 @@ extern flac_loader flac;
|
|||
|
||||
#endif /* FLAC_MUSIC */
|
||||
|
||||
extern int Mix_InitFLAC();
|
||||
extern void Mix_QuitFLAC();
|
||||
extern int Mix_InitFLAC(void);
|
||||
extern void Mix_QuitFLAC(void);
|
||||
|
|
|
@ -58,5 +58,5 @@ extern mikmod_loader mikmod;
|
|||
|
||||
#endif /* MOD_MUSIC */
|
||||
|
||||
extern int Mix_InitMOD();
|
||||
extern void Mix_QuitMOD();
|
||||
extern int Mix_InitMOD(void);
|
||||
extern void Mix_QuitMOD(void);
|
||||
|
|
|
@ -43,5 +43,5 @@ extern smpeg_loader smpeg;
|
|||
|
||||
#endif /* MUSIC_MP3 */
|
||||
|
||||
extern int Mix_InitMP3();
|
||||
extern void Mix_QuitMP3();
|
||||
extern int Mix_InitMP3(void);
|
||||
extern void Mix_QuitMP3(void);
|
||||
|
|
|
@ -49,5 +49,5 @@ extern vorbis_loader vorbis;
|
|||
|
||||
#endif /* OGG_MUSIC */
|
||||
|
||||
extern int Mix_InitOgg();
|
||||
extern void Mix_QuitOgg();
|
||||
extern int Mix_InitOgg(void);
|
||||
extern void Mix_QuitOgg(void);
|
||||
|
|
|
@ -173,7 +173,7 @@ static void music_internal_initialize_volume(void);
|
|||
static void music_internal_volume(int volume);
|
||||
static int music_internal_play(Mix_Music *music, double position);
|
||||
static int music_internal_position(double position);
|
||||
static int music_internal_playing();
|
||||
static int music_internal_playing(void);
|
||||
static void music_internal_halt(void);
|
||||
|
||||
|
||||
|
@ -193,8 +193,8 @@ void Mix_HookMusicFinished(void (*music_finished)(void))
|
|||
static int music_halt_or_loop (void)
|
||||
{
|
||||
/* Restart music if it has to loop */
|
||||
|
||||
if (!music_internal_playing())
|
||||
|
||||
if (!music_internal_playing())
|
||||
{
|
||||
#ifdef USE_NATIVE_MIDI
|
||||
/* Native MIDI handles looping internally */
|
||||
|
@ -211,17 +211,17 @@ static int music_halt_or_loop (void)
|
|||
current_fade = music_playing->fading;
|
||||
music_internal_play(music_playing, 0.0);
|
||||
music_playing->fading = current_fade;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
music_internal_halt();
|
||||
if (music_finished_hook)
|
||||
music_finished_hook();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ void music_mixer(void *udata, Uint8 *stream, int len)
|
|||
music_playing->fading = MIX_NO_FADING;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
music_halt_or_loop();
|
||||
if (!music_internal_playing())
|
||||
return;
|
||||
|
@ -309,7 +309,7 @@ void music_mixer(void *udata, Uint8 *stream, int len)
|
|||
#endif
|
||||
#ifdef OGG_MUSIC
|
||||
case MUS_OGG:
|
||||
|
||||
|
||||
left = OGG_playAudio(music_playing->data.ogg, stream, len);
|
||||
break;
|
||||
#endif
|
||||
|
@ -334,7 +334,7 @@ void music_mixer(void *udata, Uint8 *stream, int len)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
skip:
|
||||
/* Handle seamless music looping */
|
||||
if (left > 0 && left < len) {
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
/* This is for use with the SDL library */
|
||||
#ifndef __TIMIDITY_CONFIG_H__
|
||||
#define __TIMIDITY_CONFIG_H__
|
||||
#ifndef SDL
|
||||
#define SDL
|
||||
#endif
|
||||
#include "SDL_config.h"
|
||||
#include "SDL_endian.h"
|
||||
|
||||
|
@ -24,7 +26,7 @@
|
|||
#define DEFAULT_PROGRAM 0
|
||||
|
||||
/* 9 here is MIDI channel 10, which is the standard percussion channel.
|
||||
Some files (notably C:\WINDOWS\CANYON.MID) think that 16 is one too.
|
||||
Some files (notably C:\WINDOWS\CANYON.MID) think that 16 is one too.
|
||||
On the other hand, some files know that 16 is not a drum channel and
|
||||
try to play music on it. This is now a runtime option, so this isn't
|
||||
a critical choice anymore. */
|
||||
|
@ -131,7 +133,7 @@ typedef double FLOAT_T;
|
|||
#define MAX_CONTROL_RATIO 255
|
||||
|
||||
typedef unsigned int uint32;
|
||||
typedef int int32;
|
||||
typedef int int32;
|
||||
typedef unsigned short uint16;
|
||||
typedef short int16;
|
||||
typedef unsigned char uint8;
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
it under the terms of the Perl Artistic License, available in COPYING.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <SDL_rwops.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "instrum.h"
|
||||
#include "playmidi.h"
|
||||
|
@ -69,14 +70,14 @@ int XG_System_variation_type;
|
|||
|
||||
|
||||
static void adjust_amplification(void)
|
||||
{
|
||||
{
|
||||
master_volume = (FLOAT_T)(amplification) / (FLOAT_T)100.0;
|
||||
master_volume /= 2;
|
||||
}
|
||||
|
||||
|
||||
static void adjust_master_volume(int32 vol)
|
||||
{
|
||||
{
|
||||
master_volume = (double)(vol*amplification) / 1638400.0L;
|
||||
master_volume /= 2;
|
||||
}
|
||||
|
@ -146,7 +147,7 @@ static void select_sample(int v, Instrument *ip)
|
|||
}
|
||||
|
||||
f=voice[v].orig_frequency;
|
||||
/*
|
||||
/*
|
||||
No suitable sample found! We'll select the sample whose root
|
||||
frequency is closest to the one we want. (Actually we should
|
||||
probably convert the low, high, and root frequencies to MIDI note
|
||||
|
@ -214,11 +215,11 @@ static void select_stereo_samples(int v, InstrumentLayer *lp)
|
|||
|
||||
static void recompute_freq(int v)
|
||||
{
|
||||
int
|
||||
int
|
||||
sign=(voice[v].sample_increment < 0), /* for bidirectional loops */
|
||||
pb=channel[voice[v].channel].pitchbend;
|
||||
double a;
|
||||
|
||||
|
||||
if (!voice[v].sample->sample_rate)
|
||||
return;
|
||||
|
||||
|
@ -262,22 +263,22 @@ static void recompute_freq(int v)
|
|||
(double)(play_mode->rate)),
|
||||
FRACTION_BITS);
|
||||
|
||||
if (sign)
|
||||
if (sign)
|
||||
a = -a; /* need to preserve the loop direction */
|
||||
|
||||
voice[v].sample_increment = (int32)(a);
|
||||
}
|
||||
|
||||
static int expr_curve[128] = {
|
||||
7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11,
|
||||
11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15,
|
||||
15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22,
|
||||
22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31,
|
||||
32, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44,
|
||||
45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 59, 60, 61, 63,
|
||||
64, 65, 67, 68, 70, 71, 73, 75, 76, 78, 80, 82, 83, 85, 87, 89,
|
||||
7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11,
|
||||
11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15,
|
||||
15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22,
|
||||
22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31,
|
||||
32, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44,
|
||||
45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 59, 60, 61, 63,
|
||||
64, 65, 67, 68, 70, 71, 73, 75, 76, 78, 80, 82, 83, 85, 87, 89,
|
||||
91, 93, 95, 97, 99, 102, 104, 106, 109, 111, 113, 116, 118, 121,
|
||||
124, 127
|
||||
124, 127
|
||||
};
|
||||
|
||||
static int panf(int pan, int speaker, int separation)
|
||||
|
@ -423,7 +424,7 @@ static void recompute_amp(int v)
|
|||
/* just a variant of note_on() */
|
||||
static int vc_alloc(int j)
|
||||
{
|
||||
int i=voices;
|
||||
int i=voices;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
|
@ -439,7 +440,7 @@ static void kill_note(int i);
|
|||
|
||||
static void kill_others(int i)
|
||||
{
|
||||
int j=voices;
|
||||
int j=voices;
|
||||
|
||||
if (!voice[i].sample->exclusiveClass) return;
|
||||
|
||||
|
@ -769,7 +770,7 @@ static void start_note(MidiEvent *e, int i)
|
|||
ip = lp->instrument;
|
||||
if (ip->type == INST_GUS && ip->samples != 1)
|
||||
{
|
||||
ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,
|
||||
ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,
|
||||
"Strange: percussion instrument with %d samples!", ip->samples);
|
||||
}
|
||||
|
||||
|
@ -989,14 +990,14 @@ static void kill_note(int i)
|
|||
/* Only one instance of a note can be playing on a single channel. */
|
||||
static void note_on(MidiEvent *e)
|
||||
{
|
||||
int i=voices, lowest=-1;
|
||||
int i=voices, lowest=-1;
|
||||
int32 lv=0x7FFFFFFF, v;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
if (voice[i].status == VOICE_FREE)
|
||||
lowest=i; /* Can't get a lower volume than silence */
|
||||
else if (voice[i].channel==e->channel &&
|
||||
else if (voice[i].channel==e->channel &&
|
||||
(voice[i].note==e->a || channel[voice[i].channel].mono))
|
||||
kill_note(i);
|
||||
}
|
||||
|
@ -1007,7 +1008,7 @@ static void note_on(MidiEvent *e)
|
|||
start_note(e,lowest);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* Look for the decaying note with the lowest volume */
|
||||
i=voices;
|
||||
|
@ -1136,7 +1137,7 @@ static void all_notes_off(int c)
|
|||
if (voice[i].status==VOICE_ON &&
|
||||
voice[i].channel==c)
|
||||
{
|
||||
if (channel[c].sustain)
|
||||
if (channel[c].sustain)
|
||||
{
|
||||
voice[i].status=VOICE_SUSTAINED;
|
||||
ctl->note(i);
|
||||
|
@ -1151,7 +1152,7 @@ static void all_sounds_off(int c)
|
|||
{
|
||||
int i=voices;
|
||||
while (i--)
|
||||
if (voice[i].channel==c &&
|
||||
if (voice[i].channel==c &&
|
||||
voice[i].status != VOICE_FREE &&
|
||||
voice[i].status != VOICE_DIE)
|
||||
{
|
||||
|
@ -1232,29 +1233,29 @@ static void seek_forward(int32 until_time)
|
|||
current_event->a;
|
||||
channel[current_event->channel].pitchfactor=0;
|
||||
break;
|
||||
|
||||
|
||||
case ME_PITCHWHEEL:
|
||||
channel[current_event->channel].pitchbend=
|
||||
current_event->a + current_event->b * 128;
|
||||
channel[current_event->channel].pitchfactor=0;
|
||||
break;
|
||||
|
||||
|
||||
case ME_MAINVOLUME:
|
||||
channel[current_event->channel].volume=current_event->a;
|
||||
break;
|
||||
|
||||
|
||||
case ME_MASTERVOLUME:
|
||||
adjust_master_volume(current_event->a + (current_event->b <<7));
|
||||
break;
|
||||
|
||||
|
||||
case ME_PAN:
|
||||
channel[current_event->channel].panning=current_event->a;
|
||||
break;
|
||||
|
||||
|
||||
case ME_EXPRESSION:
|
||||
channel[current_event->channel].expression=current_event->a;
|
||||
break;
|
||||
|
||||
|
||||
case ME_PROGRAM:
|
||||
/* if (ISDRUMCHANNEL(current_event->channel)) */
|
||||
if (channel[current_event->channel].kit)
|
||||
|
@ -1310,11 +1311,11 @@ static void seek_forward(int32 until_time)
|
|||
case ME_RESET_CONTROLLERS:
|
||||
reset_controllers(current_event->channel);
|
||||
break;
|
||||
|
||||
|
||||
case ME_TONE_BANK:
|
||||
channel[current_event->channel].bank=current_event->a;
|
||||
break;
|
||||
|
||||
|
||||
case ME_EOT:
|
||||
current_sample=current_event->time;
|
||||
return;
|
||||
|
@ -1336,7 +1337,7 @@ static void skip_to(int32 until_time)
|
|||
buffered_count=0;
|
||||
buffer_pointer=common_buffer;
|
||||
current_event=event_list;
|
||||
|
||||
|
||||
if (until_time)
|
||||
seek_forward(until_time);
|
||||
ctl->reset();
|
||||
|
@ -1351,15 +1352,15 @@ static int apply_controls(void)
|
|||
switch(rc=ctl->read(&val))
|
||||
{
|
||||
case RC_QUIT: /* [] */
|
||||
case RC_LOAD_FILE:
|
||||
case RC_LOAD_FILE:
|
||||
case RC_NEXT: /* >>| */
|
||||
case RC_REALLY_PREVIOUS: /* |<< */
|
||||
return rc;
|
||||
|
||||
|
||||
case RC_CHANGE_VOLUME:
|
||||
if (val>0 || amplification > -val)
|
||||
amplification += val;
|
||||
else
|
||||
else
|
||||
amplification=0;
|
||||
if (amplification > MAX_AMPLIFICATION)
|
||||
amplification=MAX_AMPLIFICATION;
|
||||
|
@ -1382,20 +1383,20 @@ static int apply_controls(void)
|
|||
skip_to(0);
|
||||
did_skip=1;
|
||||
break;
|
||||
|
||||
|
||||
case RC_JUMP:
|
||||
if (val >= sample_count)
|
||||
return RC_NEXT;
|
||||
skip_to(val);
|
||||
return rc;
|
||||
|
||||
|
||||
case RC_FORWARD: /* >> */
|
||||
if (val+current_sample >= sample_count)
|
||||
return RC_NEXT;
|
||||
skip_to(val+current_sample);
|
||||
did_skip=1;
|
||||
break;
|
||||
|
||||
|
||||
case RC_BACK: /* << */
|
||||
if (current_sample > val)
|
||||
skip_to(current_sample-val);
|
||||
|
@ -1405,10 +1406,10 @@ static int apply_controls(void)
|
|||
break;
|
||||
}
|
||||
while (rc!= RC_NONE);
|
||||
|
||||
|
||||
/* Advertise the skip so that we stop computing the audio buffer */
|
||||
if (did_skip)
|
||||
return RC_JUMP;
|
||||
return RC_JUMP;
|
||||
else
|
||||
return rc;
|
||||
}
|
||||
|
@ -1466,7 +1467,7 @@ static int compute_data(void *stream, int32 count)
|
|||
s32tobuf(stream, common_buffer, channels*AUDIO_BUFFER_SIZE);
|
||||
buffer_pointer=common_buffer;
|
||||
buffered_count=0;
|
||||
|
||||
|
||||
ctl->current_time(current_sample);
|
||||
if ((rc=apply_controls())!=RC_NONE)
|
||||
return rc;
|
||||
|
@ -1485,7 +1486,7 @@ int Timidity_PlaySome(void *stream, int samples)
|
|||
//printf("Timidity_PlaySome()\n");
|
||||
int rc = RC_NONE;
|
||||
int32 end_sample;
|
||||
|
||||
|
||||
if ( ! midi_playing ) {
|
||||
return RC_NONE;
|
||||
}
|
||||
|
@ -1504,33 +1505,33 @@ int Timidity_PlaySome(void *stream, int samples)
|
|||
else
|
||||
note_on(current_event);
|
||||
break;
|
||||
|
||||
|
||||
case ME_NOTEOFF:
|
||||
current_event->a += channel[current_event->channel].transpose;
|
||||
note_off(current_event);
|
||||
break;
|
||||
|
||||
|
||||
case ME_KEYPRESSURE:
|
||||
adjust_pressure(current_event);
|
||||
break;
|
||||
|
||||
|
||||
/* Effects affecting a single channel */
|
||||
|
||||
|
||||
case ME_PITCH_SENS:
|
||||
channel[current_event->channel].pitchsens=current_event->a;
|
||||
channel[current_event->channel].pitchfactor=0;
|
||||
break;
|
||||
|
||||
|
||||
case ME_PITCHWHEEL:
|
||||
channel[current_event->channel].pitchbend=
|
||||
current_event->a + current_event->b * 128;
|
||||
channel[current_event->channel].pitchfactor=0;
|
||||
/* Adjust pitch for notes already playing */
|
||||
adjust_pitchbend(current_event->channel);
|
||||
ctl->pitch_bend(current_event->channel,
|
||||
ctl->pitch_bend(current_event->channel,
|
||||
channel[current_event->channel].pitchbend);
|
||||
break;
|
||||
|
||||
|
||||
case ME_MAINVOLUME:
|
||||
channel[current_event->channel].volume=current_event->a;
|
||||
adjust_volume(current_event->channel);
|
||||
|
@ -1540,7 +1541,7 @@ int Timidity_PlaySome(void *stream, int samples)
|
|||
case ME_MASTERVOLUME:
|
||||
adjust_master_volume(current_event->a + (current_event->b <<7));
|
||||
break;
|
||||
|
||||
|
||||
case ME_REVERBERATION:
|
||||
channel[current_event->channel].reverberation=current_event->a;
|
||||
break;
|
||||
|
@ -1555,13 +1556,13 @@ int Timidity_PlaySome(void *stream, int samples)
|
|||
adjust_panning(current_event->channel);
|
||||
ctl->panning(current_event->channel, current_event->a);
|
||||
break;
|
||||
|
||||
|
||||
case ME_EXPRESSION:
|
||||
channel[current_event->channel].expression=current_event->a;
|
||||
adjust_volume(current_event->channel);
|
||||
ctl->expression(current_event->channel, current_event->a);
|
||||
break;
|
||||
|
||||
|
||||
case ME_PROGRAM:
|
||||
/* if (ISDRUMCHANNEL(current_event->channel)) { */
|
||||
if (channel[current_event->channel].kit) {
|
||||
|
@ -1574,23 +1575,23 @@ int Timidity_PlaySome(void *stream, int samples)
|
|||
}
|
||||
ctl->program(current_event->channel, current_event->a);
|
||||
break;
|
||||
|
||||
|
||||
case ME_SUSTAIN:
|
||||
channel[current_event->channel].sustain=current_event->a;
|
||||
if (!current_event->a)
|
||||
drop_sustain(current_event->channel);
|
||||
ctl->sustain(current_event->channel, current_event->a);
|
||||
break;
|
||||
|
||||
|
||||
case ME_RESET_CONTROLLERS:
|
||||
reset_controllers(current_event->channel);
|
||||
redraw_controllers(current_event->channel);
|
||||
break;
|
||||
|
||||
|
||||
case ME_ALL_NOTES_OFF:
|
||||
all_notes_off(current_event->channel);
|
||||
break;
|
||||
|
||||
|
||||
case ME_ALL_SOUNDS_OFF:
|
||||
all_sounds_off(current_event->channel);
|
||||
break;
|
||||
|
@ -1725,7 +1726,7 @@ void Timidity_FreeSong(MidiSong *song)
|
|||
{
|
||||
if (free_instruments_afterwards)
|
||||
free_instruments();
|
||||
|
||||
|
||||
free(song->events);
|
||||
free(song);
|
||||
}
|
||||
|
@ -1743,4 +1744,3 @@ void Timidity_Close(void)
|
|||
free_instruments();
|
||||
free_pathlist();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
it under the terms of the Perl Artistic License, available in COPYING.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <SDL_rwops.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "instrum.h"
|
||||
#include "playmidi.h"
|
||||
|
@ -282,11 +283,11 @@ static MidiEventList *read_midi_event(void)
|
|||
at+=getvl();
|
||||
if (SDL_RWread(rw,&me,1,1)!=1)
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: read_midi_event: %s",
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: read_midi_event: %s",
|
||||
current_filename, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(me==0xF0 || me == 0xF7) /* SysEx event */
|
||||
{
|
||||
int32 sret;
|
||||
|
@ -340,9 +341,9 @@ static MidiEventList *read_midi_event(void)
|
|||
case 0x51: /* Tempo */
|
||||
SDL_RWread(rw,&a,1,1); SDL_RWread(rw,&b,1,1); SDL_RWread(rw,&c,1,1);
|
||||
MIDIEVENT(at, ME_TEMPO, c, a, b);
|
||||
|
||||
|
||||
default:
|
||||
ctl->cmsg(CMSG_INFO, VERB_DEBUG,
|
||||
ctl->cmsg(CMSG_INFO, VERB_DEBUG,
|
||||
"(Meta event type 0x%02x, length %ld)", type, len);
|
||||
SDL_RWseek(rw, len, RW_SEEK_CUR);
|
||||
break;
|
||||
|
@ -414,7 +415,7 @@ static MidiEventList *read_midi_event(void)
|
|||
case 101: nrpn=0; rpn_lsb[lastchan]=b; break;
|
||||
case 99: nrpn=1; rpn_msb[lastchan]=b; break;
|
||||
case 98: nrpn=1; rpn_lsb[lastchan]=b; break;
|
||||
|
||||
|
||||
case 6:
|
||||
if (nrpn)
|
||||
{
|
||||
|
@ -455,13 +456,13 @@ static MidiEventList *read_midi_event(void)
|
|||
*/
|
||||
}
|
||||
|
||||
ctl->cmsg(CMSG_INFO, VERB_DEBUG,
|
||||
ctl->cmsg(CMSG_INFO, VERB_DEBUG,
|
||||
"(Data entry (MSB) for NRPN %02x,%02x: %ld)",
|
||||
rpn_msb[lastchan], rpn_lsb[lastchan],
|
||||
b);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch((rpn_msb[lastchan]<<8) | rpn_lsb[lastchan])
|
||||
{
|
||||
case 0x0000: /* Pitch bend sensitivity */
|
||||
|
@ -473,22 +474,22 @@ static MidiEventList *read_midi_event(void)
|
|||
MIDIEVENT(at, ME_PITCH_SENS, lastchan, 2, 0);
|
||||
|
||||
default:
|
||||
ctl->cmsg(CMSG_INFO, VERB_DEBUG,
|
||||
ctl->cmsg(CMSG_INFO, VERB_DEBUG,
|
||||
"(Data entry (MSB) for RPN %02x,%02x: %ld)",
|
||||
rpn_msb[lastchan], rpn_lsb[lastchan],
|
||||
b);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
ctl->cmsg(CMSG_INFO, VERB_DEBUG,
|
||||
ctl->cmsg(CMSG_INFO, VERB_DEBUG,
|
||||
"(Control %d: %d)", a, b);
|
||||
break;
|
||||
}
|
||||
if (control != 255)
|
||||
{
|
||||
MIDIEVENT(at, control, lastchan, b, 0);
|
||||
{
|
||||
MIDIEVENT(at, control, lastchan, b, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -505,15 +506,15 @@ static MidiEventList *read_midi_event(void)
|
|||
b &= 0x7F;
|
||||
MIDIEVENT(at, ME_PITCHWHEEL, lastchan, a, b);
|
||||
|
||||
default:
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
default:
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"*** Can't happen: status 0x%02X, channel 0x%02X",
|
||||
laststatus, lastchan);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
|
@ -574,7 +575,7 @@ static int read_track(int append)
|
|||
meep=next;
|
||||
next=meep->next;
|
||||
}
|
||||
|
||||
|
||||
new->next=next;
|
||||
meep->next=new;
|
||||
|
||||
|
@ -720,7 +721,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
|
|||
}
|
||||
if (current_set[meep->event.channel] != new_value)
|
||||
current_set[meep->event.channel]=new_value;
|
||||
else
|
||||
else
|
||||
skip_this_event=1;
|
||||
}
|
||||
else
|
||||
|
@ -776,7 +777,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
|
|||
if (mprog==SPECIAL_PROGRAM)
|
||||
break;
|
||||
|
||||
if (XG_System_On && banknum==SFXBANK && !tonebank[SFXBANK] && tonebank[120])
|
||||
if (XG_System_On && banknum==SFXBANK && !tonebank[SFXBANK] && tonebank[120])
|
||||
banknum = 120;
|
||||
|
||||
/*if (current_config_pc42b) pcmap(&banknum, &dnote, &mprog, &drumsflag);*/
|
||||
|
@ -812,7 +813,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
|
|||
new_value=meep->event.a;
|
||||
if (current_kit[meep->event.channel] != new_value)
|
||||
current_kit[meep->event.channel]=new_value;
|
||||
else
|
||||
else
|
||||
skip_this_event=1;
|
||||
break;
|
||||
}
|
||||
|
@ -846,7 +847,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
|
|||
}
|
||||
if (tonebank[SFXBANK] || tonebank[120]) /* Is this a defined tone bank? */
|
||||
new_value=SFX_BANKTYPE;
|
||||
else
|
||||
else
|
||||
{
|
||||
ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,
|
||||
"XG Sfx bank is undefined");
|
||||
|
@ -873,7 +874,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
|
|||
}
|
||||
else if (tonebank[meep->event.a]) /* Is this a defined tone bank? */
|
||||
new_value=meep->event.a;
|
||||
else
|
||||
else
|
||||
{
|
||||
ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,
|
||||
"Tone bank %d is undefined", meep->event.a);
|
||||
|
@ -924,7 +925,7 @@ static MidiEvent *groom_list(int32 divisions,int32 *eventsp,int32 *samplesp)
|
|||
lp->type=ME_EOT;
|
||||
our_event_count++;
|
||||
free_midi_list();
|
||||
|
||||
|
||||
*eventsp=our_event_count;
|
||||
*samplesp=st;
|
||||
return groomed_list;
|
||||
|
@ -968,11 +969,11 @@ past_riff:
|
|||
{
|
||||
/* if (ferror(fp))
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", current_filename,
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", current_filename,
|
||||
strerror(errno));
|
||||
}
|
||||
else*/
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: Not a MIDI file!", current_filename);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1010,18 +1011,18 @@ past_riff:
|
|||
|
||||
if (len > 6)
|
||||
{
|
||||
ctl->cmsg(CMSG_WARNING, VERB_NORMAL,
|
||||
"%s: MIDI file header size %ld bytes",
|
||||
ctl->cmsg(CMSG_WARNING, VERB_NORMAL,
|
||||
"%s: MIDI file header size %ld bytes",
|
||||
current_filename, len);
|
||||
SDL_RWseek(rw, len-6, RW_SEEK_CUR); /* skip the excess */
|
||||
}
|
||||
if (format<0 || format >2)
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: Unknown MIDI file format %d", current_filename, format);
|
||||
return 0;
|
||||
}
|
||||
ctl->cmsg(CMSG_INFO, VERB_VERBOSE,
|
||||
ctl->cmsg(CMSG_INFO, VERB_VERBOSE,
|
||||
"Format: %d Tracks: %d Divisions: %d", format, tracks, divisions);
|
||||
|
||||
/* Put a do-nothing event first in the list for easier processing */
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
it under the terms of the Perl Artistic License, available in COPYING.
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
#include "config.h"
|
||||
#include "SDL.h"
|
||||
#include "common.h"
|
||||
#include "instrum.h"
|
||||
#include "playmidi.h"
|
||||
|
@ -88,7 +88,7 @@ static int read_config_file(const char *name)
|
|||
{
|
||||
if (words != 2)
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: line %d: Must specify exactly one patch name\n",
|
||||
name, line);
|
||||
return -2;
|
||||
|
@ -101,14 +101,14 @@ static int read_config_file(const char *name)
|
|||
if (words < 2)
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: line %d: No drum set number given\n",
|
||||
"%s: line %d: No drum set number given\n",
|
||||
name, line);
|
||||
return -2;
|
||||
}
|
||||
i=atoi(w[1]);
|
||||
if (i<0 || i>127)
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: line %d: Drum set must be between 0 and 127\n",
|
||||
name, line);
|
||||
return -2;
|
||||
|
@ -125,14 +125,14 @@ static int read_config_file(const char *name)
|
|||
if (words < 2)
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: line %d: No bank number given\n",
|
||||
"%s: line %d: No bank number given\n",
|
||||
name, line);
|
||||
return -2;
|
||||
}
|
||||
i=atoi(w[1]);
|
||||
if (i<0 || i>127)
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: line %d: Tone bank must be between 0 and 127\n",
|
||||
name, line);
|
||||
return -2;
|
||||
|
@ -161,7 +161,7 @@ static int read_config_file(const char *name)
|
|||
}
|
||||
if (!bank)
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: line %d: Must specify tone bank or drum set "
|
||||
"before assignment\n",
|
||||
name, line);
|
||||
|
@ -188,7 +188,7 @@ static int read_config_file(const char *name)
|
|||
k=atoi(cp);
|
||||
if ((k<0 || k>MAX_AMPLIFICATION) || (*cp < '0' || *cp > '9'))
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: line %d: amplification must be between "
|
||||
"0 and %d\n", name, line, MAX_AMPLIFICATION);
|
||||
return -2;
|
||||
|
@ -200,7 +200,7 @@ static int read_config_file(const char *name)
|
|||
k=atoi(cp);
|
||||
if ((k<0 || k>127) || (*cp < '0' || *cp > '9'))
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: line %d: note must be between 0 and 127\n",
|
||||
name, line);
|
||||
return -2;
|
||||
|
@ -220,7 +220,7 @@ static int read_config_file(const char *name)
|
|||
if ((k<0 || k>127) ||
|
||||
(k==0 && *cp!='-' && (*cp < '0' || *cp > '9')))
|
||||
{
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
|
||||
"%s: line %d: panning must be left, right, "
|
||||
"center, or between -100 and 100\n",
|
||||
name, line);
|
||||
|
@ -302,7 +302,7 @@ int Timidity_Init(int rate, int format, int channels, int samples)
|
|||
}
|
||||
if ( channels == 1 ) {
|
||||
play_mode->encoding |= PE_MONO;
|
||||
}
|
||||
}
|
||||
switch (format) {
|
||||
case AUDIO_S8:
|
||||
s32tobuf = s32tos8;
|
||||
|
@ -356,4 +356,3 @@ const char *Timidity_Error(void)
|
|||
{
|
||||
return(timidity_error);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ typedef struct WaveFMT {
|
|||
Uint32 FMTchunk;
|
||||
Uint32 fmtlen;
|
||||
*/
|
||||
Uint16 encoding;
|
||||
Uint16 encoding;
|
||||
Uint16 channels; /* 1 = mono, 2 = stereo */
|
||||
Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */
|
||||
Uint32 byterate; /* Average bytes per second */
|
||||
|
@ -213,11 +213,11 @@ int WAVStream_PlaySome(Uint8 *stream, int len)
|
|||
}
|
||||
data = SDL_stack_alloc(Uint8, len);
|
||||
if (data)
|
||||
{
|
||||
{
|
||||
SDL_RWread(music->rw, data, len, 1);
|
||||
SDL_MixAudio(stream, data, len, wavestream_volume);
|
||||
SDL_stack_free(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return left;
|
||||
|
@ -286,7 +286,7 @@ static SDL_RWops *LoadWAVStream (SDL_RWops *src, SDL_AudioSpec *spec,
|
|||
|
||||
/* WAV magic header */
|
||||
Uint32 RIFFchunk;
|
||||
Uint32 wavelen;
|
||||
// Uint32 wavelen;
|
||||
Uint32 WAVEmagic;
|
||||
|
||||
/* FMT chunk */
|
||||
|
@ -296,7 +296,7 @@ static SDL_RWops *LoadWAVStream (SDL_RWops *src, SDL_AudioSpec *spec,
|
|||
|
||||
/* Check the magic header */
|
||||
RIFFchunk = SDL_ReadLE32(src);
|
||||
wavelen = SDL_ReadLE32(src);
|
||||
// wavelen = SDL_ReadLE32(src);
|
||||
WAVEmagic = SDL_ReadLE32(src);
|
||||
if ( (RIFFchunk != RIFF) || (WAVEmagic != WAVE) ) {
|
||||
Mix_SetError("Unrecognized file type (not WAVE)");
|
||||
|
@ -416,7 +416,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec,
|
|||
Uint32 AIFFmagic;
|
||||
/* SSND chunk */
|
||||
Uint32 offset;
|
||||
Uint32 blocksize;
|
||||
// Uint32 blocksize;
|
||||
/* COMM format chunk */
|
||||
Uint16 channels = 0;
|
||||
Uint32 numsamples = 0;
|
||||
|
@ -459,7 +459,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec,
|
|||
case SSND:
|
||||
found_SSND = 1;
|
||||
offset = SDL_ReadBE32(src);
|
||||
blocksize = SDL_ReadBE32(src);
|
||||
// blocksize = SDL_ReadBE32(src);
|
||||
*start = SDL_RWtell(src) + offset;
|
||||
break;
|
||||
|
||||
|
@ -485,7 +485,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec,
|
|||
was_error = 1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
if (!found_COMM) {
|
||||
Mix_SetError("Bad AIFF file (no COMM chunk)");
|
||||
was_error = 1;
|
||||
|
@ -518,4 +518,3 @@ done:
|
|||
}
|
||||
return(src);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue