// This is f*****g stupid as hell; if this method makes it into a release, somebody shoot me in // the head. public void delayTap1(int channel, int volume) { try { InputStream file_input_stream = p.createInput(modpath); delayplayerA = new Player(interpolation); delayplayerA.set_module(Player.load_module(file_input_stream)); file_input_stream.close(); delayplayerA.set_loop(true); delayplayerA.receivebuffer(buffersize); for (int i = 0; i < delayplayerA.get_num_channels(); i++) { if (i != channel) { delayplayerA.ibxm.chanmute[i] = true; } } delayplayerA.ibxm.channels[channel].chanvol_override = volume; delayplayerA.play(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (LineUnavailableException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
/** * Load the MOD/XM/S3M module by filepath string. If the second parameter is false, the module * will not automatically start to play. The third parameter is the starting volume as a float * value between -40.0f and 6.020f. Start at the bottom if you want to fade a module in. * * @return int */ public int doModLoad(String tune, boolean autostart, int startVol) { filepath = tune; modpath = tune; headerCheck(tune); PApplet.println("Header checked: " + modtype); if (loadSuccess > 0) { loadSuccess = 0; } InputStream file_input_stream = p.createInput(tune); try { if (playing == true) { player.stop(); PApplet.println("stopped"); } player = new Player(interpolation); player.set_module(Player.load_module(file_input_stream)); file_input_stream.close(); player.set_loop(true); player.receivebuffer(buffersize); if (autostart) { player.play(); songStart = p.millis(); } this.setGlobvol(startVol); PApplet.println(player.get_title()); PApplet.println(player.song_duration); songLength = player.song_duration / 48000; infotext = new String[player.get_num_instruments()]; for (int i = 0; i < (player.get_num_instruments()); i++) { infotext[i] = ""; // store copies of all the instruments for changeSample Instrument tempinst_old = player.module.instruments[i]; oldsamples.add(i, tempinst_old); if (player.ins_name(i) != null) { PApplet.println(player.ins_name(i)); infotext[i] = player.ins_name(i); } } chantranspose = new int[player.get_num_channels()]; for (int c = 0; c < player.get_num_channels(); c++) { chantranspose[c] = 0; } loopstart = new int[player.get_num_instruments()]; looplength = new int[player.get_num_instruments()]; origloopstart = new int[player.get_num_instruments()]; origlooplength = new int[player.get_num_instruments()]; sampledatalength = new int[player.get_num_instruments()]; for (int ins = 0; ins < player.get_num_instruments(); ins++) { // initialise loopinfo arrays origloopstart[ins] = 0; origlooplength[ins] = 0; sampledatalength[ins] = player.module.instruments[ins].samples[0].sample_data_length; // store initial loop info for loopReset // System.out.println("Orig start: " + // player.module.instruments[ins].samples[0].loop_start); // System.out.println("Orig length: " // +player.module.instruments[ins].samples[0].loop_length); origloopstart[ins] = player.module.instruments[ins].samples[0].loop_start; origlooplength[ins] = player.module.instruments[ins].samples[0].loop_length; } PApplet.println("Channels:" + player.get_num_channels()); // PApplet.println(player.output_line.getControls()); try { // volCtrl = (FloatControl) player.output_line.getControl(FloatControl.Type.MASTER_GAIN); // volCtrl.setValue(startVol); } catch (Exception e) { PApplet.println( "Mystery javasound failure lucky dip! This week's prize: " + e.getMessage()); } try { muteCtrl = (BooleanControl) player.output_line.getControl(BooleanControl.Type.MUTE); } catch (Exception e) { PApplet.println(e.getMessage()); } /* for (int i=0; i < numchannels; i++){ globvol = startVol; try { player.ibxm.channels[i].chanvol_override = startVol; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }*/ title = player.get_title(); numchannels = player.get_num_channels(); jamnote = new int[player.get_num_channels()]; jaminst = new int[player.get_num_channels()]; for (int c = 0; c < player.get_num_channels(); c++) { jamnote[c] = 0; jaminst[c] = 0; } numinstruments = player.get_num_instruments(); numpatterns = player.ibxm.module.get_sequence_length(); playing = true; loadSuccess = 1; initialtempo = player.get_bpm(); bpmvalue = player.get_bpm(); currentrowcount = player.ibxm.total_rows; endcount = 0; // if (player.get_num_channels() > 0) { // sequencecounter = 0; // refreshpattern(); // displayCurrentpattern(); // } } catch (Exception e) { PApplet.println(e.getMessage()); PApplet.println("Printing stack trace... "); e.printStackTrace(); } return loadSuccess; }