42bs Posted March 6, 2022 Share Posted March 6, 2022 I am struggling with the DACs or better the description of them. I understand, each DAC has a range from -$800x to $7ffx, right? So writing "toggling" the DAC with 4kHz from $8000 to $7fff should give a tone? Or do I also have to setup JIT1? Quote Link to comment Share on other sites More sharing options...
Zerosquare Posted March 6, 2022 Share Posted March 6, 2022 The PWM DACs (DAC1, DAC2) don't work correctly, and they're not even connected to anything in the Jaguar. Forget about them. If you want to use sound, you need to use the synchronous serial interface (I²S): - Set SMODE to $0000000D - Set SCLK according to the sample rate you want: SCLK = (system_clock / (64 * sample_rate)) - 1 (system_clock = 26593900 Hz for PAL, and 26590906 Hz for NTSC) - Set IMASK and D_I2SENA in D_FLAGS - Set bit 8 in JOYSTICK (to disable the audio mute) You'll get a DSP interrupt at the sample rate frequency. Write the output values to L_I2S and R_I2S, and clear the interrupt flags as usual. 1 Quote Link to comment Share on other sites More sharing options...
42bs Posted March 6, 2022 Author Share Posted March 6, 2022 Oh puta... I nearly started riding a dead horse. I have been really too long away from the Jaguar. Thx! Quote Link to comment Share on other sites More sharing options...
Cyprian Posted March 6, 2022 Share Posted March 6, 2022 2 hours ago, Zerosquare said: The PWM DACs (DAC1, DAC2) don't work correctly, and they're not even connected to anything in the Jaguar. Forget about them. If you want to use sound, you need to use the synchronous serial interface (I²S): - Set SMODE to $0000000D - Set SCLK according to the sample rate you want: SCLK = (system_clock / (64 * sample_rate)) - 1 (system_clock = 26593900 Hz for PAL, and 26590906 Hz for NTSC) - Set IMASK and D_I2SENA in D_FLAGS - Set bit 8 in JOYSTICK (to disable the audio mute) You'll get a DSP interrupt at the sample rate frequency. Write the output values to L_I2S and R_I2S, and clear the interrupt flags as usual. and what about a 'bitnes'? are those DAC's 16bit or 14 bit? Quote Link to comment Share on other sites More sharing options...
42bs Posted March 7, 2022 Author Share Posted March 7, 2022 As I understand I2C is 16bit signed. But it really is a pity one has to setup DSP code to handle sound. My goal was to have a bytebeat intro 256 bytes ... well, let's see. 1 Quote Link to comment Share on other sites More sharing options...
Zerosquare Posted March 7, 2022 Share Posted March 7, 2022 (edited) 42 minutes ago, 42bs said: As I understand I2C is 16bit signed. Yes. 42 minutes ago, 42bs said: But it really is a pity one has to setup DSP code to handle sound. My goal was to have a bytebeat intro 256 bytes ... well, let's see. You can "cheat" by not enabling the DSP interrupt, and writing to the L_I2S/R_I2S when you want (you still need to configure SCLK, SMODE and JOYSTICK). That's not recommended because it can introduce audio artifacts, but this is a 256-byte intro, so... I don't know if doing everything with the 68k will work, but it's worth a try. I guess you could use a timer, or maybe even sync with the I²S stream by reading and clearing the I²S interrupt flag with the 68k. Good luck Edited March 7, 2022 by Zerosquare 1 Quote Link to comment Share on other sites More sharing options...
42bs Posted March 7, 2022 Author Share Posted March 7, 2022 Setting up the I2C timer and then writing L_I2S/R_I2S works great. bytebeat needs a timer anyway, so I use the same interrupt for incrementing it and writing the I2S register(s). Thx again. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.