Search code examples
javaimageprocessingimage-scaling

Trying to load an image to my future soundboard and it wont work. anyone?


So I'm working towards making a soundboard. I'm messing around with processing and I would like a image on the screen. however the image wont show when I load it.

import ddf.minim.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; import ddf.minim.signals.*;import ddf.minim.spi.*;import ddf.minim.ugens.*;PImage soundboard;PImage [] array= new PImage[0];Minim minim; AudioPlayer player;Boolean player1= false;void setup(){  minim = newMinim(this)  player = minim.loadFile("deadmau5.mp3")  imageMode(CENTER); soundboard=loadImage("https://pbs.twimg.com/profile_images/544877364916654080/sxoWk6Sz.png");}void draw(){    imageMode(CENTER); soundboard =loadImage("https://pbs.twimg.com/profile_images/544877364916654080/sxoWk6Sz.png"); } void mousePressed(){  player1=!player1;if (player1){  player.play();}else {  player.pause();  player.rewind();}}

for future reference how to i sort out the code with the sampler on this? I'm such a noob, Yes i know lol. Can someone explain why it's not showing? thank you very much guys.


Solution

  • You're never displaying your image. You're loading it, but you aren't displaying it. You need to call the image() function to draw your image to the screen.

    PImage soundboard;
    
    void setup() {  
      imageMode(CENTER);
      soundboard=loadImage("https://pbs.twimg.com/profile_images/544877364916654080/sxoWk6Sz.png");
    }
    
    void draw() {    
      image(soundboard, 25, 25);
    }