Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (546)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java Sound & OpenAL / Re: fmod 4 java - DspUnit.GetSpectrum returns 0's on: 2007-12-30 20:23:56
I don't know about what your DSPUnit is. But the loop for the Swing graphics display is quite correct, whereever you might add some double-buffering to it.

Yea I know, but I don't feel like continuing until I figure out how to get the spectrum.
2  Java Game APIs & Engines / Java Sound & OpenAL / Re: fmod 4 java - DspUnit.GetSpectrum returns 0's on: 2007-12-19 16:43:55
maybe try with a PCM sound file... if it works then convert PCM to mp3 using JLayer API and open the converted PCM to do the work.
WAV files use PCM right? Doesn't seem to work using a WAV-file.
3  Java Game APIs & Engines / Java Sound & OpenAL / fmod 4 java - DspUnit.GetSpectrum returns 0's on: 2007-12-18 19:18:29
Hello there,

I am using fmod4java to get the spectrum of a soundstream I'm playing. I have initialized fmod, activated the dspunit, set a soundstream to play an mp3. The Spectrum type DspUnit.GetSpectrum() returns, however, is "empty", i.e. it is full of 0.0.. Does anyone have an idea what I'm doing wrong?

This is the code (which is not complete, comments, other classes and debugging left out)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
  private void initFMOD() {
   try {
      FMOD.init(44100, 32, 0);

      activeSoundStream = SoundStream.open("everyday.mp3", Mode.SW2D, 0, 0);

      DspUnit.getFFTUnit().setActive(true);

      activeChannel = activeSoundStream.playEx(Channel.FREE, DspUnit.getFFTUnit(), false);
      activeChannel.setVolume(255); // Just in case

      dspTimer = new Timer(1000, this); // No need to rush it now
     dspTimer.start();

      updateFFT();
   } catch (FMODException error) {
      System.out.println("FMODException: "+error);
   }
  }

  public void updateFFT() {
     Graphics g = w_oPanel.getGraphics();
     g.setColor(Color.WHITE);

     dspSpectrum = DspUnit.getSpectrum();
     float bands = 0;
     for(int i=0;i<511;i++) {
        bands += dspSpectrum.getBand(i); // This doesn't make bands useful, but shows it contains 0.0 after adding all getBands
    }
     g.drawString(""+bands, 150, 150); // Draws 0.0
 }
 
  public void actionPerformed(ActionEvent e) {
     if (e.getSource() == dspTimer) {
        updateFFT();
     }
  }
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

atombrot (20 views)
2014-08-19 09:29:53

Tekkerue (21 views)
2014-08-16 06:45:27

Tekkerue (21 views)
2014-08-16 06:22:17

Tekkerue (12 views)
2014-08-16 06:20:21

Tekkerue (19 views)
2014-08-16 06:12:11

Rayexar (55 views)
2014-08-11 02:49:23

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (27 views)
2014-08-08 02:01:56

Norakomi (35 views)
2014-08-06 19:49:38

BurntPizza (64 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!