|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| Simple C# Sound |
|
![]() Uphoreum Member since: 7/17/2006 From: Plymouth, MN, United States |
||||
|
|
||||
| I'm creating a CHIP-8 emulator (I'm hoping this will make an NES emulator easier in the future) and sound-wise, I simply need to emit a single pitch tone when the sound timer is greater than zero. I don't want to deal with DirectX for something this simple, especially since I'm using GDI+ for graphics, so I wouldn't be using any other components of DirectX. The problem is, I can't find a way to emit a simple tone out the speaker. I know about Console.Beep, but for one thing, it comes out the motherboard speaker which isn't what I want and second it pauses the program while it plays the sound which may mess with the framerates a bit. Is there a way to emit a tone using only the .NET Framework or will I need to use some sort of other library? |
||||
|
||||
![]() Scet GDNet+ Member since: 8/3/2002 From: Mississauga, Canada |
||||
|
|
||||
| I used System.Media.SystemSounds.Beep.Play, which is probably just a wrapper for the Win32 PlaySound function. |
||||
|
||||
![]() Uphoreum Member since: 7/17/2006 From: Plymouth, MN, United States |
||||
|
|
||||
| That's not quite what I'm looking for. That plays that Windows beep sound with an empty space between. I need a constant stream of sound for as long as the timer is going. Basically, I want a Console.Beep type thing only coming out of the speakers instead. Thanks though! |
||||
|
||||
![]() Trillian Member since: 4/28/2005 From: Montreal, Canada |
||||
|
|
||||
| If you're willing to Pinvoke your way through it, waveOutWrite might be adequate although i've never used it. |
||||
|
||||
![]() Headkaze Member since: 2/20/2006 From: Perth, Australia |
||||
|
|
||||
| I found quite a few examples of doing this in C# on the web. Just use "C# tone generator" as your search terms. |
||||
|
||||
![]() benryves GDNet+ Member since: 9/4/2003 From: Purley, United Kingdom |
||||
|
|
||||
| I used MIDI for my CHIP-8 emulator - this is probably the easiest way for simple tones (there's a basic MIDI API wrapper in the source). For my Master System emulator, I'm using the Windows waveOut API, using the wrapper by Ianier Munoz. ................................................................................................................................................................. [Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++] |
||||
|
||||
![]() capn_midnight GDNet+ Member since: 9/11/2000 From: Chambersburg, PA, United States |
||||
|
|
||||
| try System.Console.Beep(int frequency, int duration) "aut viam inveniam aut faciam"---[My Site]---[Some Research and Development]---[3H-GDC]---[An Art Gallery] |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|