Skip to content

Commit bc5a2ee

Browse files
committed
Remove duplicate code to fix build with glib
1 parent 831cba1 commit bc5a2ee

3 files changed

Lines changed: 3 additions & 122 deletions

File tree

src/synth/fluid_synth.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ fluid_synth_get_preset_by_sfont_name(fluid_synth_t *synth, const char *sfontname
104104
static void fluid_synth_update_presets(fluid_synth_t *synth);
105105
static void fluid_synth_update_gain_LOCAL(fluid_synth_t *synth);
106106
static int fluid_synth_update_polyphony_LOCAL(fluid_synth_t *synth, int new_polyphony);
107-
static int fluid_synth_render_blocks(fluid_synth_t *synth, int blockcount);
108107

109108
static fluid_voice_t *fluid_synth_free_voice_by_kill_LOCAL(fluid_synth_t *synth);
110109
static void fluid_synth_kill_by_exclusive_class_LOCAL(fluid_synth_t *synth,
@@ -5118,7 +5117,7 @@ void fluid_synth_process_event_queue(fluid_synth_t *synth)
51185117
* Must be called from renderer thread only!
51195118
* @return number of blocks rendered. Might (often) return less than requested
51205119
*/
5121-
static int
5120+
int
51225121
fluid_synth_render_blocks(fluid_synth_t *synth, int blockcount)
51235122
{
51245123
int i, maxblocks;

src/synth/fluid_synth.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ fluid_synth_write_float_channels(fluid_synth_t *synth, int len,
259259
void *channels_out[], int channels_off[],
260260
int channels_incr[]);
261261

262+
int fluid_synth_render_blocks(fluid_synth_t *synth, int blockcount);
263+
262264
fluid_preset_t *fluid_synth_find_preset(fluid_synth_t *synth,
263265
int banknum,
264266
int prognum);

src/synth/fluid_synth_write_int.cpp

Lines changed: 0 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -34,126 +34,6 @@
3434

3535
#include <cstdint>
3636

37-
/* --------------------------------------------------------------------------
38-
* Local static helpers/tables
39-
*
40-
* -------------------------------------------------------------------------- */
41-
42-
static FLUID_INLINE unsigned int fluid_synth_get_ticks(fluid_synth_t *synth)
43-
{
44-
return fluid_atomic_int_get(&synth->ticks_since_start);
45-
}
46-
47-
static FLUID_INLINE void fluid_synth_add_ticks(fluid_synth_t *synth, int val)
48-
{
49-
fluid_atomic_int_add(&synth->ticks_since_start, val);
50-
}
51-
52-
53-
/***************************************************************
54-
* FLUID SAMPLE TIMERS
55-
* Timers that use written audio data as timing reference
56-
*/
57-
struct _fluid_sample_timer_t
58-
{
59-
fluid_sample_timer_t *next; /* Single linked list of timers */
60-
unsigned long starttick;
61-
fluid_timer_callback_t callback;
62-
void *data;
63-
int isfinished;
64-
};
65-
66-
/*
67-
* fluid_sample_timer_process - called when synth->ticks is updated
68-
*/
69-
static void fluid_sample_timer_process(fluid_synth_t *synth)
70-
{
71-
fluid_sample_timer_t *st;
72-
long msec;
73-
int cont;
74-
unsigned int ticks = fluid_synth_get_ticks(synth);
75-
76-
for (st = synth->sample_timers; st; st = st->next)
77-
{
78-
if (st->isfinished)
79-
{
80-
continue;
81-
}
82-
83-
msec = (long)(1000.0 * ((double)(ticks - st->starttick)) / synth->sample_rate);
84-
cont = (*st->callback)(st->data, msec);
85-
86-
if (cont == 0)
87-
{
88-
st->isfinished = 1;
89-
}
90-
}
91-
}
92-
93-
/*
94-
* Process blocks (FLUID_BUFSIZE) of audio.
95-
* Must be called from renderer thread only!
96-
* @return number of blocks rendered. Might (often) return less than requested
97-
*/
98-
static int fluid_synth_render_blocks(fluid_synth_t *synth, int blockcount)
99-
{
100-
int i, maxblocks;
101-
fluid_profile_ref_var(prof_ref);
102-
103-
/* Assign ID of synthesis thread */
104-
// synth->synth_thread_id = fluid_thread_get_id ();
105-
106-
fluid_check_fpe("??? Just starting up ???");
107-
108-
fluid_rvoice_eventhandler_dispatch_all(synth->eventhandler);
109-
110-
/* do not render more blocks than we can store internally */
111-
maxblocks = fluid_rvoice_mixer_get_bufcount(synth->eventhandler->mixer);
112-
113-
if (blockcount > maxblocks)
114-
{
115-
blockcount = maxblocks;
116-
}
117-
118-
for (i = 0; i < blockcount; i++)
119-
{
120-
fluid_sample_timer_process(synth);
121-
fluid_synth_add_ticks(synth, FLUID_BUFSIZE);
122-
123-
/* If events have been queued waiting for fluid_rvoice_eventhandler_dispatch_all()
124-
* (should only happen with parallel render) stop processing and go for rendering
125-
*/
126-
if (fluid_rvoice_eventhandler_dispatch_count(synth->eventhandler))
127-
{
128-
// Something has happened, we can't process more
129-
blockcount = i + 1;
130-
break;
131-
}
132-
}
133-
134-
fluid_check_fpe("fluid_sample_timer_process");
135-
136-
blockcount = fluid_rvoice_mixer_render(synth->eventhandler->mixer, blockcount);
137-
138-
/* Testcase, that provokes a denormal floating point error */
139-
#if 0
140-
{
141-
float num = 1;
142-
143-
while(num != 0)
144-
{
145-
num *= 0.5;
146-
};
147-
};
148-
#endif
149-
fluid_check_fpe("??? Remainder of synth_one_block ???");
150-
fluid_profile(FLUID_PROF_ONE_BLOCK,
151-
prof_ref,
152-
fluid_rvoice_mixer_get_active_voices(synth->eventhandler->mixer),
153-
blockcount * FLUID_BUFSIZE);
154-
return blockcount;
155-
}
156-
15737
/* --------------------------------------------------------------------------
15838
* Integer write core: tag dispatch + traits (C++11)
15939
* -------------------------------------------------------------------------- */

0 commit comments

Comments
 (0)