[Already sent with thread "Segfault on double-clicking a instrument in
the "Sound library" frame", but sent here alone with revelant subject]
Hi,
This patch avoid a segfault when double-clicking a drumkit's
instrument in the "Sound library" panel. The problems seems to be that
the instrument position is not found in the current drumkit and "-1" is
return, which is bad. So, force the position to be 0 seems to be fix the
problem.
It is certainly not the right way to do it, but at least the attached
patch seems to solve the problem for me.
However, I know it is crappy :-)
Bye
--- libs/hydrogen/src/sampler/sampler.cpp.orig 2008-02-14 15:25:07.000000000 +0100
+++ libs/hydrogen/src/sampler/sampler.cpp 2008-02-14 15:29:36.000000000 +0100
@@ -320,7 +320,6 @@
int nInitialSamplePos = ( int )pNote->m_fSamplePosition;
int nSamplePos = nInitialSamplePos;
int nTimes = nInitialBufferPos + nAvail_bytes;
- int nInstrument = pSong->get_instrument_list()->get_pos( pNote->get_instrument() );
// filter
bool bUseLPF = pNote->get_instrument()->is_filter_active();
@@ -350,8 +349,8 @@
if ( __audio_output->has_track_outs() ) {
// hack hack hack: cast to JackOutput
#ifdef JACK_SUPPORT
- float* track_out_L = ( ( JackOutput* )__audio_output )->getTrackOut_L( nInstrument );
- float* track_out_R = ( ( JackOutput* )__audio_output )->getTrackOut_L( nInstrument );
+ float* track_out_L = ( ( JackOutput* )__audio_output )->getTrackOut_L( 0 );
+ float* track_out_R = ( ( JackOutput* )__audio_output )->getTrackOut_R( 0 );
assert( track_out_L );
assert( track_out_R );
track_out_L[nBufferPos] = pSample_data_L[nSamplePos] * cost_track * fADSRValue;
@@ -465,7 +464,6 @@
float fInitialSamplePos = pNote->m_fSamplePosition;
float fSamplePos = pNote->m_fSamplePosition;
int nTimes = nInitialBufferPos + nAvail_bytes;
- int nInstrument = pSong->get_instrument_list()->get_pos( pNote->get_instrument() );
// filter
bool bUseLPF = pNote->get_instrument()->is_filter_active();
@@ -503,8 +501,8 @@
if ( __audio_output->has_track_outs() ) {
#ifdef JACK_SUPPORT
// hack hack hack: cast to JackOutput
- float* track_out_L = ( ( JackOutput* )__audio_output )->getTrackOut_L( nInstrument );
- float* track_out_R = ( ( JackOutput* )__audio_output )->getTrackOut_L( nInstrument );
+ float* track_out_L = ( ( JackOutput* )__audio_output )->getTrackOut_L( 0 );
+ float* track_out_R = ( ( JackOutput* )__audio_output )->getTrackOut_R( 0 );
assert( track_out_L );
assert( track_out_R );
track_out_L[nBufferPos] = fVal_L * cost_track * fADSRValue;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel