Задайте вопросЗадайте вопрос
 

Общие обсужденияExtension to play music in Small Basic

  • 29 ноября 2008 г. 3:16RushworksОтвечающийМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    Here's an extension to Small Basic that plays tones from your internal speaker.

    It is similar to QB's PLAY statement, but still needs a bit of work.

    There is no error checking, and no way to stop playing in the middle of a string.

    The new object is ToneGenerator

    There are two methods-
        
        PlayString(string)

            the string can be any note C, C#, D, D#, E, F, F#, G, G#, A, A#, B 
            or you can change the octave by typing the letter O followed by a number 1 - 6 ex. O3
            or you can change the length of the note by typing the letter L followed by a number 1 - 9 ex. L2
            or you can add a pause by typing the letter P followed by a number 1 - 9 ex. P7
        
            you end up with something like    ToneGenerator.PlayString("O4 L3 GAGFEF L6 G")

            I haven't tested this a lot, but it should ignore everything else.

    and 

        PlayTone(frequency, duration)

            this method will simply beep at the frequency and duration you input

    To use it, copy the ToneGen.dll and ToneGen.xml to your C:\Program Files\Microsoft\Small Basic\lib folder.

    The sample included plays Mary had a little lamb.

    http://code.msdn.microsoft.com/ExtToneGenerator

Все ответы