Skip to content

Commit

Permalink
preparing code for 0.2.3.5 release, and removing 0.2.4 related code
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.code.sf.net/p/wildmidi/svn/trunk@147 c49d981e-1564-41db-a9da-c6d570d03c1e
  • Loading branch information
Chris Ison committed Dec 1, 2011
1 parent dd7b154 commit 5e3f035
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 266 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dnl
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ([2.65])
AC_INIT([WildMidi],[0.2.4.0dev],[http://sourceforge.net/tracker/?group_id=42635&atid=433744],[wildmidi],[http://wildmidi.sourceforge.net])
AC_INIT([WildMidi],[0.2.3.5],[http://sourceforge.net/tracker/?group_id=42635&atid=433744],[wildmidi],[http://wildmidi.sourceforge.net])
AC_REVISION([$Revision: 1.16 $])
AC_CONFIG_SRCDIR([src/wildmidi_lib.c])
AC_CONFIG_HEADERS([include/config.h])
Expand Down
5 changes: 4 additions & 1 deletion docs/WildMidi_Init.3
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ By default libWildMidi uses linear interpolation for the resampling of the sound
libWildMidi has an 8 reflection reverb engine. Use this option to give more depth to the output.
.PP
.IP WM_MO_WHOLETEMPO
In some cases libWildMidi has been used in projects that to not support fractional 'beats per minute'(BPM). Since MIDI specifications allow for fractional BPM, libWildMidi has included a "work around" for projects that do not support them. By adding WM_MO_WHOLETEMPO to the initialization options, libWildMidi will round down fractional BPM's to nearest whole number.
Ignores the fractional or decimal part of a tempo setting. If you are having timing issues try \fIWM_MO_ROUNDTEMPO\fP before trying this option. This option added due to some software not supporting fractional tempos allowable in the MIDI specification.
.PP
.IP WM_MO_ROUNDTEMPO
Rounds the fractional or decimal part of a tempo setting. Try this option is you are having timing issues, if this fails then try \fIWM_MO_WHOLETEMPO\fP. This option added due to some software not supporting fractional tempos allowable in the MIDI specification.
.RE
.PP
.SH SEE ALSO
Expand Down
3 changes: 1 addition & 2 deletions include/wildmidi_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,4 @@ extern int WildMidi_FastSeek ( midi * handle, unsigned long int *sample_pos);
extern int WildMidi_Close (midi * handle);
extern int WildMidi_Shutdown ( void );
// NOTE: Not Yet Implemented Or Tested Properly
extern int WildMidi_Live(midi * handle, unsigned long int midi_event);
// extern void WildMidi_ReverbSet(midi * handle, float width, float wet, float dry, float damp, float roomsize);
extern int WildMidi_Live(midi * handle, unsigned long int midi_event);
2 changes: 1 addition & 1 deletion src/DevTest.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
GNU Lesser General Public License along with WildMIDI. If not, see
<http://www.gnu.org/licenses/>.
Email: [email protected].netchar
Email: [email protected].net
*/

#include "config.h"
Expand Down
6 changes: 3 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ libWildMidi_la_CFLAGS= $(PREFER_NON_PIC)
libWildMidi_la_LDFLAGS= -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -shared $(LDFLAGS) -no-undefined -export-symbols-regex '^WildMidi.*'
libWildMidi_la_LIBADD= -lm -lc

bin_PROGRAMS= wildmidi wildmididebug
bin_PROGRAMS= wildmidi
wildmidi_libs= $(top_builddir)/src/libWildMidi.la
wildmidi_SOURCES= wildmidi.c
wildmidi_LDADD= $(AUDDR) $(LDFLAGS) $(wildmidi_libs)
wildmidi_DEPENDENCIES= $(wildmidi_libs)

wildmididebug_SOURCES= wm_error.c file_io.c reverb.c lock.c gus_pat.c wildmidi_lib.c wildmidi.c
wildmididebug_LDADD= $(AUDDR) $(LDFLAGS)
## wildmididebug_SOURCES= wm_error.c file_io.c reverb.c lock.c gus_pat.c wildmidi_lib.c wildmidi.c
## wildmididebug_LDADD= $(AUDDR) $(LDFLAGS)

137 changes: 30 additions & 107 deletions src/wildmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,30 +755,14 @@ do_syntax (void) {
printf("wildmidi [options] filename.mid\n\r\n");
}

static void *midi_ptr = NULL;

#if (defined _WIN32) || (defined __CYGWIN__)
void CALLBACK midi_callback(HMIDIIN midi_in, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
{
void * tmp_data = midi_in;
tmp_data = &dwInstance;
tmp_data = &dwParam2;

if (uMsg == MIM_DATA)
{
fprintf(stderr,"\r\n%lx\r\n",dwParam1);
WildMidi_Live(midi_ptr,dwParam1);
}
}
#endif

int
main (int argc, char **argv) {
struct _WM_Info * wm_info = NULL;
int i;
int option_index = 0;
unsigned long int mixer_options = 0;
static char *config_file = NULL;
static char *config_file = NULL;
void *midi_ptr = NULL;
unsigned char master_volume = 100;
int output_result = 0;
char * output_buffer = NULL;
Expand All @@ -799,7 +783,6 @@ main (int argc, char **argv) {
static int spinpoint = 0;
unsigned long int seek_to_sample = 0;
int inpause = 0;
int input_dev_no = -1;

#ifndef _WIN32
int my_tty;
Expand All @@ -814,13 +797,10 @@ main (int argc, char **argv) {
#define resetty() (_tty.c_oflag = _res_oflg, _tty.c_lflag = _res_lflg,\
(void) tcsetattr(my_tty, TCSADRAIN, &_tty))
#endif
#if (defined _WIN32) || (defined __CYGWIN__)
HMIDIIN midi_in;
#endif

do_version();
while (1) {
i = getopt_long (argc, argv, "vho:lr:c:m:btk:p:ed:i:wn", long_options, &option_index);
i = getopt_long (argc, argv, "vho:lr:c:m:btk:p:ed:wn", long_options, &option_index);
if (i == -1)
break;
switch (i) {
Expand Down Expand Up @@ -865,9 +845,6 @@ main (int argc, char **argv) {
case 'p': // set test patch
test_patch = (unsigned char)atoi(optarg);
break;
case 'i': // set input device
input_dev_no = atoi(optarg);
break;
case 'w': // whole number tempo
mixer_options |= WM_MO_WHOLETEMPO;
break;
Expand All @@ -885,7 +862,6 @@ main (int argc, char **argv) {
strncpy (config_file, WILDMIDI_CFG, sizeof(WILDMIDI_CFG));
config_file[sizeof(WILDMIDI_CFG)] = '\0';
}
// if ((optind < argc) || (test_midi) || (input_dev_no != -1)) {
if ((optind < argc) || (test_midi)) {
printf("Initializing Sound System\r\n");

Expand Down Expand Up @@ -932,60 +908,29 @@ main (int argc, char **argv) {
fcntl(0, F_SETFL, FNONBLOCK);
}
#endif
#if (defined _WIN32) || (defined __CYGWIN__)
if (input_dev_no != -1)
{
if (midiInOpen(&midi_in, input_dev_no, (DWORD)midi_callback, (DWORD)NULL, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
{
printf("Failed to open midi device 0x%02x.\n", input_dev_no);
input_dev_no = -1;
} else {
if (midiInStart(midi_in) != MMSYSERR_NOERROR)
{
printf("Failed to start midi device 0x%02x.\n", input_dev_no);
midiInClose(midi_in);
input_dev_no = -1;
}
}
}
#endif


// while ((optind < argc) || (test_midi) || (input_dev_no != -1)) {
while ((optind < argc) || (test_midi)) {
if (!test_midi) {
if (input_dev_no != -1)
{
/*
midi_ptr = WildMidi_OpenBuffer(NULL, 0);
wm_info = WildMidi_GetInfo(midi_ptr);
printf("Playing from midi device %i\n",input_dev_no);
*/
printf("Also accepting input from midi device %i\n",input_dev_no);
}
// } else
{
char * real_file = strrchr(argv[optind], '/');
if (real_file == NULL) {
real_file = strrchr(argv[optind], '\\');
}

printf ("Playing ");
if (real_file != NULL) {
printf("%s \r\n", (real_file+1));
} else {
printf("%s \r\n", argv[optind]);
}

midi_ptr = WildMidi_Open (argv[optind]);
if (midi_ptr == NULL) {
optind++;
continue;
}
wm_info = WildMidi_GetInfo(midi_ptr);
char * real_file = strrchr(argv[optind], '/');
if (real_file == NULL) {
real_file = strrchr(argv[optind], '\\');
}

printf ("Playing ");
if (real_file != NULL) {
printf("%s \r\n", (real_file+1));
} else {
printf("%s \r\n", argv[optind]);
}

midi_ptr = WildMidi_Open (argv[optind]);
if (midi_ptr == NULL) {
optind++;
continue;
}
wm_info = WildMidi_GetInfo(midi_ptr);

optind++;
}
optind++;
} else {
if (test_count == midi_test_max) {
break;
Expand Down Expand Up @@ -1014,7 +959,6 @@ main (int argc, char **argv) {
while (1) {
count_diff = wm_info->approx_total_samples - wm_info->current_sample;

// if ((count_diff == 0) && (input_dev_no == -1))
if (count_diff == 0)
break;

Expand Down Expand Up @@ -1102,19 +1046,9 @@ main (int argc, char **argv) {

if (inpause) {
wm_info = WildMidi_GetInfo(midi_ptr);
// if (input_dev_no == -1)
{
perc_play = (wm_info->current_sample * 100) / wm_info->approx_total_samples;
pro_mins = wm_info->current_sample / (rate * 60);
pro_secs = (wm_info->current_sample % (rate * 60)) / rate;
}
/*
} else {
perc_play = 0;
pro_mins = 0;
pro_secs = 0;
}
*/
perc_play = (wm_info->current_sample * 100) / wm_info->approx_total_samples;
pro_mins = wm_info->current_sample / (rate * 60);
pro_secs = (wm_info->current_sample % (rate * 60)) / rate;
{
int mode_count = 0;
if (mixer_options & WM_MO_LOG_VOLUME) {
Expand Down Expand Up @@ -1145,30 +1079,19 @@ main (int argc, char **argv) {
continue;
}

// if ((count_diff < 4096) && (input_dev_no == -1)) {
if (count_diff < 1024) {
if (count_diff < 4096) {
output_result = WildMidi_GetOutput (midi_ptr, output_buffer, (count_diff * 4));
} else {
output_result = WildMidi_GetOutput (midi_ptr, output_buffer, 4096);
}

if ((output_result <= 0) && (input_dev_no == -1))
if (output_result <= 0)
break;

wm_info = WildMidi_GetInfo(midi_ptr);
// if (input_dev_no == -1)
{
perc_play = (wm_info->current_sample * 100) / wm_info->approx_total_samples;
pro_mins = wm_info->current_sample / (rate * 60);
pro_secs = (wm_info->current_sample % (rate * 60)) / rate;
}
/*
} else {
perc_play = 0;
pro_mins = 0;
pro_secs = 0;
}
*/
perc_play = (wm_info->current_sample * 100) / wm_info->approx_total_samples;
pro_mins = wm_info->current_sample / (rate * 60);
pro_secs = (wm_info->current_sample % (rate * 60)) / rate;
{
int mode_count = 0;
if (mixer_options & WM_MO_LOG_VOLUME) {
Expand Down
Loading

0 comments on commit 5e3f035

Please sign in to comment.